<fields oils_persist:primary="code">
<field reporter:label="Code" name="code" reporter:datatype="id" reporter:selector="name" oils_obj:validate="^\S+$"/>
<field reporter:label="Name" name="name" reporter:datatype="text" oils_persist:i18n="true" oils_obj:required="true"/>
+ <field reporter:label="Sorter Attribute" name="sorter" reporter:datatype="link"/>
<field reporter:label="Description" name="description" reporter:datatype="text"/>
<field reporter:label="Authority Fields" name="fields" reporter:datatype="link" oils_persist:virtual="true"/>
<field reporter:label="Authority Field Maps" name="maps" reporter:datatype="link" oils_persist:virtual="true"/>
</fields>
<links>
+ <link field="sorter" reltype="has_a" key="name" map="" class="crad"/>
<link field="fields" reltype="has_many" key="axis" map="field" class="abaafm"/>
<link field="maps" reltype="has_many" key="axis" map="" class="abaafm"/>
</links>
CREATE TABLE authority.browse_axis (
code TEXT PRIMARY KEY,
name TEXT UNIQUE NOT NULL, -- i18n
+ sorter TEXT REFERENCES config.record_attr_definition (name) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
description TEXT
);
(71, 1, 11, '485', 'ivwxyz4', oils_i18n_gettext('71','See Also Tracing -- Form Subdivision','acsaf','name')),
(72, 1, 12, '448', 'aivwxyz4', oils_i18n_gettext('72','See Also Tracing -- Chronological Term','acsaf','name'));
-INSERT INTO authority.browse_axis (code,name,description) VALUES
- ('title','Title','Title axis'),
- ('author','Author','Author axis'),
- ('subject','Subject','Subject axis'),
- ('topic','Topic','Topic Subject axis');
+INSERT INTO authority.browse_axis (code,name,description,sorter) VALUES
+ ('title','Title','Title axis','titlesort'),
+ ('author','Author','Author axis','titlesort'),
+ ('subject','Subject','Subject axis','titlesort'),
+ ('topic','Topic','Topic Subject axis','titlesort');
INSERT INTO authority.browse_axis_authority_field_map (axis,field) VALUES
('author', 1 ),
"abaafm": "_browse_field_map_list"
});
- openils.AuthorityControlSet._browse_axis_by_name = {};
+ openils.AuthorityControlSet._browse_axis_by_code = {};
dojo.forEach( openils.AuthorityControlSet._browse_axis_list, function (ba) {
ba.maps(
dojo.filter(
function (m) { return m.axis() == ba.code() }
)
);
- openils.AuthorityControlSet._browse_axis_by_name[ba.code()] = ba;
+ openils.AuthorityControlSet._browse_axis_by_code[ba.code()] = ba;
});
// loop over each acs
return this.controlSet(thes.control_set());
},
+ browseAxisByCode: function(code) {
+ return openils.AuthorityControlSet._browse_axis_by_code[code];
+ },
+
bibFieldByTag: function (x) {
var me = this;
return dojo.filter(
bibFieldBrowseAxes : function (t) {
var blist = [];
- for (var bname in openils.AuthorityControlSet._browse_axis_by_name) {
+ for (var bcode in openils.AuthorityControlSet._browse_axis_by_code) {
dojo.forEach(
- openils.AuthorityControlSet._browse_axis_by_name[bname].maps(),
+ openils.AuthorityControlSet._browse_axis_by_code[bcode].maps(),
function (m) {
if (dojo.filter(
m.field().bib_fields(),
function (b) { return b.tag() == t }
).length > 0
- ) blist.push(bname);
+ ) blist.push(bcode);
}
);
}
"content": {"format": "marcxml"},
"preventCache": true,
"load": function(doc) {
- displayAuthorityRecords(doc);
+ displayAuthorityRecords(axis, doc);
setPagingLinks(axis, term, page, per_page);
}
});
* records, display each one in a table using the apporiate control set to
* determine which fields to show.
*/
-function displayAuthorityRecords(doc) {
+function displayAuthorityRecords(axis, doc) {
if (!acs_helper)
acs_helper = new openils.AuthorityControlSet();
var records = dojo.query("record", doc);
last_fetched_length = records.length;
- console.log("length here is " + last_fetched_length);
dojo.forEach(
records,
);
}
);
- displayRecordCounts(auth_ids);
+ displayRecordCounts(axis, auth_ids);
swapCanvas(dojo.byId("canvas_main"));
}
-function displayRecordCounts(auth_ids) {
+function displayRecordCounts(axis, auth_ids) {
fieldmapper.standardRequest(
["open-ils.cat", "open-ils.cat.authority.records.count_linked_bibs"], {
"params": [auth_ids],
if ((r = openils.Util.readResponse(r))) {
dojo.forEach(r, function(blob) {
if (blob.bibs > 0) {
- displayRecordCount(blob.authority, blob.bibs);
+ displayRecordCount(axis, blob.authority, blob.bibs);
}
});
}
);
}
-function displayRecordCount(id, count) {
+function displayRecordCount(axis, id, count) {
/* 1) put record count where we can see it */
dojo.query("#authority_" + id + " .authority-count-holder")[0].innerHTML =
"(" + count + ")"; /* XXX i18n ? */
args[PARAM_LOCATION] = depthSelGetNewLoc();
args[PARAM_TERM] = "identifier|authority_id[" + id + "]";
+ var axis_obj = acs_helper.browseAxisByCode(axis);
+ if (axis_obj.sorter())
+ args[PARAM_TERM] += " sort(" + axis_obj.sorter() + ")";
+
dojo.create(
"a", {
"innerHTML": span.innerHTML,
dojoType="openils.widget.AutoGrid"
autoHeight="true"
defaultCellWidth="'auto'"
- fieldOrder="['code','name','description']"
+ fieldOrder="['code','name','description','sorter']"
suppressEditFields="['id']"
query="{id: '*'}"
fmClass="aba"
dojo.require("openils.widget.AutoGrid");
function my_init() {
+ aba_grid.overrideWidgetArgs.sorter = {
+ "dijitArgs": {"query": {"sorter": "t"}}
+ };
aba_grid.loadAll({"order_by": {"aba": "code"}});
}