</links>
</class>
- <class id="acs" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="authority::control_set" oils_persist:tablename="authority.control_set" reporter:label="Authority Control Set">
+ <class id="acs" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="authority::control_set" oils_persist:tablename="authority.control_set" reporter:label="Authority Control Set" oils_persist:field_safe="true">
<fields oils_persist:primary="id" oils_persist:sequence="authority.control_set_id_seq">
<field reporter:label="Control Set ID" name="id" reporter:datatype="id" reporter:selector="name"/>
<field reporter:label="Name" name="name" reporter:datatype="text" oils_persist:i18n="true" oils_obj:required="true" />
</permacrud>
</class>
- <class id="acsaf" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="authority::control_set_authority_field" oils_persist:tablename="authority.control_set_authority_field" reporter:label="Authority Control Set Authority Field">
+ <class id="acsaf" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="authority::control_set_authority_field" oils_persist:tablename="authority.control_set_authority_field" reporter:label="Authority Control Set Authority Field" oils_persist:field_safe="true">
<fields oils_persist:primary="id" oils_persist:sequence="authority.control_set_authority_field_id_seq">
<field reporter:label="Control Set Authority Field ID" name="id" reporter:datatype="id" reporter:selector="name"/>
<field reporter:label="Main Entry" name="main_entry" reporter:datatype="link"/>
</permacrud>
</class>
- <class id="acsbf" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="authority::control_set_bib_field" oils_persist:tablename="authority.control_set_bib_field" reporter:label="Authority Control Set Bib Field">
+ <class id="acsbf" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="authority::control_set_bib_field" oils_persist:tablename="authority.control_set_bib_field" reporter:label="Authority Control Set Bib Field" oils_persist:field_safe="true">
<fields oils_persist:primary="id" oils_persist:sequence="authority.control_set_bib_field_id_seq">
<field reporter:label="Controlled Bib Field ID" name="id" reporter:datatype="id" reporter:selector="name"/>
<field reporter:label="Controlling Authority Field" name="authority_field" reporter:datatype="link"/>
</permacrud>
</class>
- <class id="at" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="authority::thesaurus" oils_persist:tablename="authority.thesaurus" reporter:label="Authority Thesaurus">
+ <class id="at" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="authority::thesaurus" oils_persist:tablename="authority.thesaurus" reporter:label="Authority Thesaurus" oils_persist:field_safe="true">
<fields oils_persist:primary="code">
<field reporter:label="Thesaurus Code" name="code" reporter:datatype="id" reporter:selector="name"/>
<field reporter:label="Control Set" name="control_set" reporter:datatype="link"/>
</permacrud>
</class>
- <class id="aba" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="authority::browse_axis" oils_persist:tablename="authority.browse_axis" reporter:label="Authority Browse Axis">
+ <class id="aba" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="authority::browse_axis" oils_persist:tablename="authority.browse_axis" reporter:label="Authority Browse Axis" oils_persist:field_safe="true">
<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"/>
</permacrud>
</class>
- <class id="abaafm" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="authority::browse_axis_authority_field_map" oils_persist:tablename="authority.browse_axis_authority_field_map" reporter:label="Authority Browse Axis Field Map">
+ <class id="abaafm" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="authority::browse_axis_authority_field_map" oils_persist:tablename="authority.browse_axis_authority_field_map" reporter:label="Authority Browse Axis Field Map" oils_persist:field_safe="true">
<fields oils_persist:primary="id" oils_persist:sequence="authority.browse_axis_authority_field_map_id_seq">
<field reporter:label="Axis Authority Field Map ID" name="id" reporter:datatype="id"/>
<field reporter:label="Authority Field" name="field" oils_obj:required="true" reporter:datatype="link"/>
*/
if(!dojo._hasResource["openils.AuthorityControlSet"]) {
-
- dojo.require('openils.PermaCrud');
dojo.require('MARC.FixedFields');
dojo._hasResource["openils.AuthorityControlSet"] = true;
// TODO -- push the raw tree into the oils cache for later reuse
- var pcrud = new openils.PermaCrud({authtoken : ses()});
-
// fetch everything up front...
- openils.AuthorityControlSet._control_set_list = pcrud.retrieveAll('acs');
- openils.AuthorityControlSet._thesaurus_list = pcrud.retrieveAll('at');
- openils.AuthorityControlSet._authority_field_list = pcrud.retrieveAll('acsaf');
- openils.AuthorityControlSet._bib_field_list = pcrud.retrieveAll('acsbf');
- openils.AuthorityControlSet._browse_axis_list = pcrud.retrieveAll('aba');
- openils.AuthorityControlSet._browse_field_map_list = pcrud.retrieveAll('abaafm');
+ this._preFetchWithFielder({
+ "acs": "_control_set_list",
+ "at": "_thesaurus_list",
+ "acsaf": "_authority_field_list",
+ "acsbf": "_bib_field_list",
+ "aba": "_browse_axis_list",
+ "abaafm": "_browse_field_map_list"
+ });
openils.AuthorityControlSet._browse_axis_by_name = {};
dojo.forEach( openils.AuthorityControlSet._browse_axis_list, function (ba) {
}
},
+ _preFetchWithFielder: function(map) {
+ // TODO get pkeys from fieldmapper but use fielder to get everything
+ },
+
controlSetId: function (x) {
if (x) this._controlset = ''+x;
return this._controlset;
},
controlSetByThesaurusCode: function (x) {
+ console.log("1");
var thes = dojo.filter(
openils.AuthorityControlSet._thesaurus_list,
function (at) { return at.code() == x }
)[0];
+ console.log("2");
return this.controlSet(thes.controlSet());
},
+ '/' + page
+ '/' + per_page
;
+ console.log("doAuthorityBrowse 3: " + url);
dojo.xhrGet({
"url": url,
"handleAs": "xml",
function displayAuthorityRecords(doc) {
console.log("displayAuthorityRecords");
+ var acs_helper = new openils.AuthorityControlSet();
+ console.log("got acs_helper");
dojo.query("record", doc).forEach(
function(record) {
console.log("record");
var m = new MARC.Record({"xml": record});
+ console.log("got m");
+ var s = m.extractFixedField("Subj");
+ console.log("got s");
+ var cs = acs_helper.controlSetByThesaurusCode(s);
+ console.log("got cs");
dojo.create(
"div", {
- "innerHTML": "record here, Subj is " +
- m.extractFixedField("Subj")
+ "innerHTML": "record here, control set is " + cs
}, "test-holder"
);
}