"MERGE_RESULT_SUCCESS": "Record merge is complete.",
"THESAURI": "Thesauri (${0})",
"AUTHORITY_FIELDS": "Authority Fields (${0})",
- "CONTROL_SET_METADATA": "(${0}) ${1} / ${2}"
+ "CONTROL_SET_METADATA": "(${0}) ${1} / ${2}",
+ "AUTHORITY_FIELD_METADATA": "${3} (${1} ‡${2}) ${4}"
}
+/* To be used by interfaces for editing child tables of acs. */
function render_control_set_metadata(control_set) {
var anchor = dojo.byId("control-set-metadata");
anchor.href = oilsBasePath + "/cat/authority/control_set?focus=" +
);
openils.Util.show("control-set-metadata-holder");
}
+
+/* To be used by interfaces for editing child tables of acsaf. They not
+ * only want to know what acsaf they belong to, but for convenience they
+ * should also have handy the acs id to which their parent acsaf belongs,
+ * so they can provide the most helpful "back" link.
+ */
+function render_authority_field_metadata(authority_field, control_set_id) {
+ var anchor = dojo.byId("authority-field-metadata");
+ var href = oilsBasePath +
+ "/cat/authority/control_set_authority_field?focus=" +
+ authority_field.id();
+ if (control_set_id) href += "&acs=" + control_set_id;
+
+ anchor.href = href;
+ anchor.innerHTML = dojo.string.substitute(
+ localeStrings.AUTHORITY_FIELD_METADATA, [
+ "id", "tag", "sf_list", "name", "description"
+ ].map(function(k) {
+ var v = authority_field[k]();
+ return (v == null) ? "" : v;
+ })
+ );
+ openils.Util.show("authority-field-metadata-holder");
+}
[% WRAPPER default/base.tt2 %]
-<style type="text/css">
- .control-set-metadata-holder { text-align: left }
-</style>
[% ctx.page_title = "Configure Authority Authority Fields" %]
<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
<div dojoType="dijit.layout.ContentPane" layoutAlign="top" class="oils-header-panel">
editOnEnter="true">
<thead>
<tr>
- <th field="bib_fields" name="Controlled Bib Fields"></th>
+ <th field="bib_fields" name="Controlled Bib Fields" get="get_just_id" formatter="format_bib_fields"></th>
<th field="axis_maps" name="Axes"></th>
</tr>
</thead>
);
}
+ function get_just_id(row_index, item) {
+ if (item) return this.grid.store.getValue(item, "id");
+ }
+
+ function format_bib_fields(id) {
+ if (id) {
+ var text = acsaf_cache[id].bib_fields().map(
+ function(f) { return f.tag(); }
+ ).sort().join(", ");
+ var href = "control_set_bib_field?";
+ if (control_set)
+ href += "acs=" + control_set.id() + "&";
+ href += "acsaf=" + id;
+ return "<a href='" + href + "'>" + text + "</a>";
+ }
+ }
function my_init() {
cgi = new openils.CGI();
if (control_set) {
control_set = pcrud.retrieve("acs", control_set);
render_control_set_metadata(control_set);
- /* XXX TODO
- when browsing by control_set, make it impossible to
- create/edit acsaf objects with any other control_set.
- */
+
+ acsaf_grid.overrideEditWidgets.control_set =
+ new dijit.form.TextBox({"disabled": true});
+ acsaf_grid.overrideEditWidgets.control_set.shove =
+ {"create": control_set.id()};
}
acsaf_grid.onPostCreate = function(o) { acsaf_cache[o.id()] = o; };
--- /dev/null
+[% WRAPPER default/base.tt2 %]
+[% ctx.page_title = "Configure Authority Control Set Bib Fields" %]
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+ <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class="oils-header-panel">
+ <div>Control Set Bib Fields</div>
+ <div>
+ <button dojoType="dijit.form.Button" onClick="acsbf_grid.showCreateDialog()">New Control Set Bib Field</button>
+ <button dojoType="dijit.form.Button" onClick="acsbf_grid.deleteSelected()">Delete Selected</button>
+ </div>
+ </div>
+ <div id="authority-field-metadata-holder" class="hidden">
+ Showing only control set bib fields linked to authority field:
+ <a id="authority-field-metadata"></a>
+ </div>
+ <div>
+ <table jsId="acsbf_grid"
+ dojoType="openils.widget.AutoGrid"
+ autoHeight="true"
+ defaultCellWidth="'auto'"
+ suppressEditFields="['id']"
+ fieldOrder="['tag','authority_field']"
+ query="{id: '*'}"
+ fmClass="acsbf"
+ editOnEnter="true">
+ </table>
+ </div>
+</div>
+<script type="text/javascript"
+ src="[% ctx.media_prefix %]/js/ui/default/cat/authority/common.js"></script>
+<script type="text/javascript">
+ dojo.require("openils.widget.AutoGrid");
+ dojo.require("openils.CGI");
+ dojo.require("openils.PermaCrud");
+
+ dojo.requireLocalization("openils.authority", "authority");
+ var localeStrings =
+ dojo.i18n.getLocalization("openils.authority", "authority");
+
+ var cgi, pcrud;
+
+ function my_init() {
+ var authority_field, control_set_id;
+ var where = {"id": {"!=": null}};
+
+ cgi = new openils.CGI();
+ pcrud = new openils.PermaCrud();
+
+ authority_field = cgi.param("acsaf");
+ control_set_id = cgi.param("acs");
+
+ if (authority_field) {
+ /* This block not only limits the scope of our search for acsbf
+ objects, but makes sure that we create/update only acsbf's
+ that link back to the authority field (acsaf) we're interested
+ in. */
+ authority_field = pcrud.retrieve("acsaf", authority_field);
+ where.authority_field = authority_field.id();
+ render_authority_field_metadata(authority_field, control_set_id);
+
+ acsbf_grid.overrideEditWidgets.authority_field =
+ new dijit.form.TextBox({"disabled": true});
+ acsbf_grid.overrideEditWidgets.authority_field.shove =
+ {"create": authority_field.id()};
+ }
+
+ acsbf_grid.loadAll({"order_by": {"acsbf": "tag"}}, where);
+ }
+
+ openils.Util.addOnLoad(my_init);
+</script>
+[% END %]
[% WRAPPER default/base.tt2 %]
-<style type="text/css">
- .control-set-metadata-holder { text-align: left }
-</style>
[% ctx.page_title = "Configure Authority Thesauri" %]
<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
<div dojoType="dijit.layout.ContentPane" layoutAlign="top" class="oils-header-panel">
control_set = pcrud.retrieve("acs", control_set);
where.control_set = control_set.id();
render_control_set_metadata(control_set);
+
+ at_grid.overrideEditWidgets.control_set =
+ new dijit.form.TextBox({"disabled": true});
+ at_grid.overrideEditWidgets.control_set.shove =
+ {"create": control_set.id()};
}
at_grid.loadAll({"order_by": {"at": "code"}}, where);