Admin -> Local Admin -> Item Attribute Editor collab/dyrcona/admin_copy_editor
authorJason Etheridge <jason@esilibrary.com>
Tue, 24 Apr 2012 20:54:20 +0000 (16:54 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Tue, 10 Jul 2012 13:39:13 +0000 (09:39 -0400)
Main purpose is to allow you to spawn the Item Attribute Editor for the purpose
of configuring templates and using the Hide Fields feature without actually
finding an item to work and putting it at risk of accidental modification.

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/chrome/content/main/menu.js
Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
Open-ILS/xul/staff_client/server/cat/copy_editor.js

index 8180820..6594927 100644 (file)
 <!ENTITY staff.main.menu.admin.local_admin.work_log.accesskey "W">
 <!ENTITY staff.main.menu.admin.local_admin.copy_template.label "Copy Template Editor">
 <!ENTITY staff.main.menu.admin.local_admin.copy_template.accesskey "T">
+<!ENTITY staff.main.menu.admin.local_admin.item_attribute_editor.label "Item Attribute Editor">
+<!ENTITY staff.main.menu.admin.local_admin.item_attribute_editor.accesskey "E">
 <!ENTITY staff.main.menu.admin.local_admin.patrons_due_refunds.label "Patrons with Negative Balances">
 <!ENTITY staff.main.menu.admin.local_admin.patrons_due_refunds.accesskey "N">
 <!ENTITY staff.main.menu.admin.local_admin.address_alert.label "Address Alerts">
index f3c0222..5499ba5 100644 (file)
@@ -834,6 +834,17 @@ main.menu.prototype = {
                     open_eg_web_page("conify/global/asset/copy_template");
                 }
             ],
+            "cmd_local_admin_item_attribute_editor": [
+                ["oncommand"],
+                function(event) {
+                    obj.command_tab(
+                        event,
+                        urls.XUL_COPY_EDITOR,
+                        { 'tab_name' : offlineStrings.getString('menu.local_admin.item_attribute_editor.tab') },
+                        { 'admin' : true, 'not_modal' : true }
+                    );
+                }
+            ],
             'cmd_local_admin_patrons_due_refunds' : [
                 ['oncommand'],
                 function(event) {
index 836d2b3..e763c82 100644 (file)
     <command id="cmd_local_admin_work_log" />
     <command id="cmd_local_admin_patrons_due_refunds" />
     <command id="cmd_local_admin_copy_template" />
+    <command id="cmd_local_admin_item_attribute_editor" />
     <command id="cmd_local_admin_address_alert"
              perm="ADMIN_ADDRESS_ALERT VIEW_ADDRESS_ALERT" />
     <command id="cmd_local_admin_circ_limit_set"
                 <menuitem label="&staff.main.menu.admin.local_admin.conify.copy_location_order.label;" command="cmd_local_admin_copy_location_order"/>
                 <menuitem label="&staff.main.menu.admin.local_admin.copy_location_group.label;" command="cmd_local_admin_copy_location_group"/>
                 <menuitem label="&staff.main.menu.admin.local_admin.copy_template.label;" accesskey="&staff.main.menu.admin.local_admin.copy_template.accesskey;" command="cmd_local_admin_copy_template"/>
+                <menuitem label="&staff.main.menu.admin.local_admin.item_attribute_editor.label;" accesskey="&staff.main.menu.admin.local_admin.item_attribute_editor.accesskey;" command="cmd_local_admin_item_attribute_editor"/>
                 <menuitem label="&staff.main.menu.admin.local_admin.conify.idl_field_doc.label;" command="cmd_local_admin_idl_field_doc"/>
                 <menuitem label="&staff.main.menu.admin.local_admin.conify.grp_penalty_threshold.label;" command="cmd_local_admin_grp_penalty_threshold"/>
                 <menuitem label="&staff.main.menu.admin.local_admin.hold_matrix_matchpoint.label;" command="cmd_local_admin_hold_matrix_matchpoint"/>
index 5a5b0c4..68faca4 100644 (file)
@@ -260,6 +260,7 @@ menu.cmd_authority_manage.tab=Manage Authorities
 menu.local_admin.barcode_completion.tab=Barcode Completion
 menu.local_admin.circ_matrix_matchpoint.tab=Circulation Policies
 menu.local_admin.hold_matrix_matchpoint.tab=Hold Policies
+menu.local_admin.item_attribute_editor.tab=Admin Item Attribute Editor
 menu.local_admin.work_log.tab=Work Log
 menu.local_admin.patrons_due_refunds.tab=Patrons With Negative Balances
 menu.circulation.staged_patrons.tab=Pending Patrons
index f4af660..f6088a5 100644 (file)
@@ -53,6 +53,36 @@ function my_init() {
         g.callnumbers = xul_param('callnumbers',{'concat':true,'JSON2js_if_cgi':true,'JSON2js_if_xpcom':true,'stash_name':'temp_callnumbers','clear_xpcom':true,'modal_xulG':true});
 
         /******************************************************************************************************/
+        /* If invoked from the Local Admin menu, rig up a fake item and disable save/create functionality */
+
+        if (xulG.admin) {
+            xulG.edit = 1;
+            var fake_item = new acp();
+            fake_item.id( -1 );
+            fake_item.barcode( 'fake_item' );
+            fake_item.call_number( -1 );
+            fake_item.circ_lib(ses('ws_ou'));
+            /* FIXME -- use constants; really, refactor this into a library somewhere that can be used by chrome and
+               remote xul for new copies */
+            fake_item.deposit(0);
+            fake_item.price(0);
+            fake_item.deposit_amount(0);
+            fake_item.fine_level(2); // Normal
+            fake_item.loan_duration(2); // Normal
+            fake_item.location(1); // Stacks
+            fake_item.status(0);
+            fake_item.circulate(get_db_true());
+            fake_item.holdable(get_db_true());
+            fake_item.opac_visible(get_db_true());
+            fake_item.ref(get_db_false());
+            fake_item.mint_condition(get_db_true());
+            g.copies = [ fake_item ];
+            $('save').hidden = true;
+            $('save').disabled = true;
+            $('non_unified_buttons').hidden = true;
+        }
+
+        /******************************************************************************************************/
         /* Get preference (if it exists) for copy location label order */
 
         g.cl_first = false; // Default to legacy OU first mode
@@ -611,10 +641,15 @@ g.apply_owning_lib = function(ou_id) {
                 g.map_acn[copy.call_number()] = volume;
             }
             var old_volume = g.map_acn[copy.call_number()];
-            var acn_blob = g.network.simple_request(
-                'FM_ACN_FIND_OR_CREATE',
-                [ses(),old_volume.label(),old_volume.record(),ou_id,old_volume.prefix().id(),old_volume.suffix().id(),old_volume.label_class().id()]
-            );
+            var acn_blob;
+            if (! xulG.admin) {
+                acn_blob = g.network.simple_request(
+                    'FM_ACN_FIND_OR_CREATE',
+                    [ses(),old_volume.label(),old_volume.record(),ou_id,old_volume.prefix().id(),old_volume.suffix().id(),old_volume.label_class().id()]
+                );
+            } else {
+                acn_blob = { 'acn_id' : -1 }; // spawned from Local Admin menu, so fake item and call number
+            }
             if (typeof acn_blob.ilsevent != 'undefined') {
                 g.error.standard_unexpected_error_alert($('catStrings').getFormattedString('staff.cat.copy_editor.apply_owning_lib.call_number.error', [copy.barcode()]), acn_blob);
                 continue;
@@ -635,6 +670,7 @@ g.apply_owning_lib = function(ou_id) {
 g.safe_to_change_owning_lib = function() {
     try {
         if (xulG.unified_interface) { return false; }
+        if (xulG.admin) { return false; }
         var safe = true;
         for (var i = 0; i < g.copies.length; i++) {
             var cn = g.copies[i].call_number();