Axis-field map editor and editor for the axes themselves
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 22 Jun 2011 20:25:59 +0000 (16:25 -0400)
committerMike Rylander <mrylander@gmail.com>
Mon, 11 Jul 2011 17:48:30 +0000 (13:48 -0400)
The editor for the axes themselves is accessed directly from staff
client menu.  Everything else is reached indirectly from the control set
editor.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/web/js/dojo/openils/authority/nls/authority.js
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/web/templates/default/cat/authority/browse_axis.tt2 [new file with mode: 0644]
Open-ILS/web/templates/default/cat/authority/browse_axis_authority_field_map.tt2 [new file with mode: 0644]
Open-ILS/web/templates/default/cat/authority/control_set_authority_field.tt2
Open-ILS/xul/staff_client/chrome/content/main/menu.js
Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul

index 4c448c8..f7d2e24 100644 (file)
@@ -19,5 +19,6 @@
     "THESAURI": "Thesauri (${0})",
     "AUTHORITY_FIELDS": "Authority Fields (${0})",
     "CONTROL_SET_METADATA": "(${0}) ${1} / ${2}",
-    "AUTHORITY_FIELD_METADATA": "${3} (${1} ‡${2}) ${4}"
+    "AUTHORITY_FIELD_METADATA": "${3} (${1} ‡${2}) ${4}",
+    "NONE_LINK": "[None]"
 }
index f5e0502..9236215 100644 (file)
 <!ENTITY staff.main.menu.admin.server_admin.authority.accesskey "U">
 <!ENTITY staff.main.menu.admin.server_admin.authority.control_set.label "Control Sets">
 <!ENTITY staff.main.menu.admin.server_admin.authority.control_set.accesskey "C">
+<!ENTITY staff.main.menu.admin.server_admin.authority.browse_axis.label "Browse Axes">
+<!ENTITY staff.main.menu.admin.server_admin.authority.browse_axis.accesskey "B">
 
 <!ENTITY staff.main.menu.admin.server_admin.booking.label "Booking">
 <!ENTITY staff.main.menu.admin.server_admin.booking.accesskey "B">
diff --git a/Open-ILS/web/templates/default/cat/authority/browse_axis.tt2 b/Open-ILS/web/templates/default/cat/authority/browse_axis.tt2
new file mode 100644 (file)
index 0000000..fc31b6e
--- /dev/null
@@ -0,0 +1,33 @@
+[% WRAPPER default/base.tt2 %]
+[% ctx.page_title = "Configure Authority Browse Axes" %]
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+    <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class="oils-header-panel">
+        <div>Browse Axes</div>
+        <div>
+            <button dojoType="dijit.form.Button" onClick="aba_grid.showCreateDialog()">New Browse Axis</button>
+            <button dojoType="dijit.form.Button" onClick="aba_grid.deleteSelected()">Delete Selected</button>
+        </div>
+    </div>
+    <div>
+        <table  jsId="aba_grid"
+                dojoType="openils.widget.AutoGrid"
+                autoHeight="true"
+                defaultCellWidth="'auto'"
+                fieldOrder="['code','name','description']"
+                suppressEditFields="['id']"
+                query="{id: '*'}"
+                fmClass="aba"
+                editOnEnter="true">
+        </table>
+    </div>
+</div>
+<script type="text/javascript">
+    dojo.require("openils.widget.AutoGrid");
+
+    function my_init() {
+        aba_grid.loadAll({"order_by": {"aba": "code"}});
+    }
+
+    openils.Util.addOnLoad(my_init);
+</script>
+[% END %]
diff --git a/Open-ILS/web/templates/default/cat/authority/browse_axis_authority_field_map.tt2 b/Open-ILS/web/templates/default/cat/authority/browse_axis_authority_field_map.tt2
new file mode 100644 (file)
index 0000000..c12dfa8
--- /dev/null
@@ -0,0 +1,71 @@
+[% WRAPPER default/base.tt2 %]
+[% ctx.page_title = "Configure Browse Axis-Authority Field Maps" %]
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+    <div dojoType="dijit.layout.ContentPane" layoutAlign="top" class="oils-header-panel">
+        <div>Browse Axis-Authority Field Maps</div>
+        <div>
+            <button dojoType="dijit.form.Button" onClick="abaafm_grid.showCreateDialog()">New Browse Axis-Authority Field Map</button>
+            <button dojoType="dijit.form.Button" onClick="abaafm_grid.deleteSelected()">Delete Selected</button>
+        </div>
+    </div>
+    <div id="authority-field-metadata-holder" class="hidden">
+        Showing only browse axis-authority field maps linked to authority field:
+        <a id="authority-field-metadata"></a>
+    </div>
+    <div>
+        <table  jsId="abaafm_grid"
+                dojoType="openils.widget.AutoGrid"
+                autoHeight="true"
+                defaultCellWidth="'auto'"
+                suppressEditFields="['id']"
+                fieldOrder="['axis','field']"
+                query="{id: '*'}"
+                fmClass="abaafm"
+                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 abaafm
+               objects, but makes sure that we create/update only abaafm's
+               that link back to the authority field (acsaf) we're interested
+               in.  */
+            authority_field = pcrud.retrieve("acsaf", authority_field);
+            where.field = authority_field.id();
+            render_authority_field_metadata(authority_field, control_set_id);
+
+            abaafm_grid.overrideEditWidgets.field =
+                new dijit.form.TextBox({"disabled": true});
+            abaafm_grid.overrideEditWidgets.field.shove =
+                {"create": authority_field.id()};
+        }
+
+        abaafm_grid.loadAll({"order_by": {"abaafm": "axis"}}, where);
+    }
+
+    openils.Util.addOnLoad(my_init);
+</script>
+[% END %]
index 740d408..b4c88cf 100644 (file)
                 editOnEnter="true">
             <thead>
                 <tr>
-                    <th field="bib_fields" name="Controlled Bib Fields" get="get_just_id" formatter="format_bib_fields"></th>
-                    <th field="axis_maps" name="Axes"></th>
+                    <th field="bib_fields" name="Controlled Bib Fields"
+                        get="get_just_id" formatter="format_bib_fields"></th>
+                    <th field="axis_maps" name="Axes"
+                        get="get_just_id" formatter="format_axis_maps"></th>
                 </tr>
             </thead>
         </table>
         if (item) return this.grid.store.getValue(item, "id");
     }
 
+    function format_axis_maps(id) {
+        if (id) {
+            var text = acsaf_cache[id].axis_maps().map(
+                function(f) { return f.axis().name(); }
+            ).sort().join(", ") || localeStrings.NONE_LINK;
+            var href = "browse_axis_authority_field_map?";
+            if (control_set)
+                href += "acs=" + control_set.id() + "&amp;";
+            href += "acsaf=" + id;
+            return "<a href='" + href + "'>"  + text + "</a>";
+        }
+    }
+
     function format_bib_fields(id) {
         if (id) {
             var text = acsaf_cache[id].bib_fields().map(
                 function(f) { return f.tag(); }
-            ).sort().join(", ");
+            ).sort().join(", ") || localeStrings.NONE_LINK;
             var href = "control_set_bib_field?";
             if (control_set)
                 href += "acs=" + control_set.id() + "&amp;";
index 728c7d5..de70805 100644 (file)
@@ -963,6 +963,10 @@ main.menu.prototype = {
                 ['oncommand'],
                 function(event) { open_eg_web_page('cat/authority/control_set', null, event); }
             ],
+            'cmd_server_admin_authority_browse_axis': [
+                ['oncommand'],
+                function(event) { open_eg_web_page('cat/authority/browse_axis', null, event); }
+            ],
             'cmd_server_admin_booking_resource': [
                 ['oncommand'],
                 function(event) { open_eg_web_page('conify/global/booking/resource', null, event); }
index d1279c1..8f59ae8 100644 (file)
              />
 
     <command id="cmd_server_admin_authority_control_set" />
+    <command id="cmd_server_admin_authority_browse_axis" />
 
     <command id="cmd_server_admin_booking_resource" />
     <command id="cmd_server_admin_booking_resource_type" />
                 <menu id="main.menu.admin.server.authority" label="&staff.main.menu.admin.server_admin.authority.label;" accesskey="&staff.main.menu.admin.server_admin.authority.accesskey;">
                     <menupopup id="main.menu.admin.server.authority.popup">
                         <menuitem label="&staff.main.menu.admin.server_admin.authority.control_set.label;" command="cmd_server_admin_authority_control_set" accesskey="&staff.main.menu.admin.server_admin.authority.control_set.accesskey;"/>
+                        <menuitem label="&staff.main.menu.admin.server_admin.authority.browse_axis.label;" command="cmd_server_admin_authority_browse_axis" accesskey="&staff.main.menu.admin.server_admin.authority.browse_axis.accesskey;"/>
                     </menupopup>
                 </menu>