[open-ils-commits] [GIT] Evergreen ILS branch master updated. 3d358abbf1d069e66476e7edb21d6c43428521db

Evergreen Git git at git.evergreen-ils.org
Fri Dec 23 12:43:51 EST 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  3d358abbf1d069e66476e7edb21d6c43428521db (commit)
      from  3290c8297054c7e9376f3864e219f25197a543b8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3d358abbf1d069e66476e7edb21d6c43428521db
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Thu Sep 29 19:26:17 2011 -0400

    Reverse Copy Location picker labels via WS Setting
    
    If the setting is set then place the name before the org unit. This allows
    for typing of the start of the name without having to deal with the org
    unit shortname "eating" the start of the label (and thus type-in), but
    preserves the information the org unit provides.
    
    As an example, instead of having to type:
    CONS : St
    To get close to the default "Stacks" in a long list you could just type
    St
    And likely get to, or close to, Stacks.
    
    The option can be toggled from the Workstation Administration menu.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    
    Conflicts:
    
    	Open-ILS/xul/staff_client/chrome/content/main/menu.js
    	Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
    
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd
index e9a63bf..9e91870 100644
--- a/Open-ILS/web/opac/locale/en-US/lang.dtd
+++ b/Open-ILS/web/opac/locale/en-US/lang.dtd
@@ -855,6 +855,7 @@
 <!ENTITY staff.main.menu.admin.client.toolbars.label_position "Label Position">
 <!ENTITY staff.main.menu.admin.client.toolbars.label_position.side "Next to icons">
 <!ENTITY staff.main.menu.admin.client.toolbars.label_position.under "Under icons">
+<!ENTITY staff.main.menu.admin.client.copy_editor.copy_location.label "Copy Editor: Copy Location Name First">
 <!ENTITY staff.main.menu.admin.non_cat_type_edit.accesskey "n">
 <!ENTITY staff.main.menu.admin.non_cat_type_edit.label "Non-Cataloged Type Editor">
 <!ENTITY staff.main.menu.admin.offline_xacts.accesskey "T">
diff --git a/Open-ILS/xul/staff_client/chrome/content/main/main.js b/Open-ILS/xul/staff_client/chrome/content/main/main.js
index 9598484..c6b8b8d 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/main.js
+++ b/Open-ILS/xul/staff_client/chrome/content/main/main.js
@@ -321,6 +321,7 @@ function main_init() {
         G =  {};
         
         G.pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
+        G.pref.QueryInterface(Components.interfaces.nsIPrefBranch2);
         if (! G.pref.prefHasUserValue('general.useragent.override')) {
             G.pref.setCharPref('general.useragent.override',navigator.userAgent + ' oils_xulrunner /xul/server/');
         }
diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js
index fe93b18..ac82ea4 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js
+++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js
@@ -140,6 +140,14 @@ main.menu.prototype = {
             }
         }
 
+        var cl_first = xulG.pref.getBoolPref('oils.copy_editor.copy_location_name_first');
+        var menuitems = document.getElementsByAttribute('command','cmd_copy_editor_copy_location_first_toggle');
+        for(var i = 0; i < menuitems.length; i++)
+            menuitems[i].setAttribute('checked', cl_first ? 'true' : 'false');
+
+        xulG.pref.addObserver('', this, false);
+        window.addEventListener("unload", function(e) { this.stop_observing(); }, false);
+
         var network_meter = String( obj.data.hash.aous['ui.network.progress_meter'] ) == 'true';
         if (! network_meter) {
             var x = document.getElementById('network_progress');
@@ -1653,6 +1661,13 @@ main.menu.prototype = {
                     }
                 }
             ],
+            'cmd_copy_editor_copy_location_first_toggle' : [
+                ['oncommand'],
+                function() {
+                    var curvalue = xulG.pref.getBoolPref('oils.copy_editor.copy_location_name_first');
+                    xulG.pref.setBoolPref('oils.copy_editor.copy_location_name_first', !curvalue);
+                }
+            ],
         };
 
         JSAN.use('util.controller');
@@ -2436,6 +2451,25 @@ commands:
         else
             // user_false is used to indicate the user said "None of the above" to avoid fall-through erroring later.
             return "user_false";
+    },
+
+    'observe' : function(subject, topic, data) {
+        if (topic != "nsPref:changed") {
+            return;
+        }
+
+        switch(data) {
+            case 'oils.copy_editor.copy_location_name_first':
+                var cl_first = xulG.pref.getBoolPref('oils.copy_editor.copy_location_name_first');
+                var menuitems = document.getElementsByAttribute('command','cmd_copy_editor_copy_location_first_toggle');
+                for(var i = 0; i < menuitems.length; i++)
+                    menuitems[i].setAttribute('checked', cl_first ? 'true' : 'false');
+            break;
+        }
+    },
+
+    'stop_observing' : function() {
+        xulG.pref.removeObserver('oils.copy_editor.*', this);
     }
 }
 
diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
index 33b171a..5cc71b8 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
+++ b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
@@ -263,6 +263,7 @@
     <command id="cmd_debug_chrome_shell"
              perm="DEBUG_CLIENT"
              />
+    <command id="cmd_copy_editor_copy_location_first_toggle" />
 </commandset>
 
 <!-- The File menu on the main menu -->
@@ -428,6 +429,7 @@
                 <menuitem label="&staff.server.admin.index.printer;" command="cmd_local_admin_printer"/>
                 <menuitem label="&staff.main.menu.admin.template_edit.label;" accesskey="&staff.main.menu.admin.template_edit.accesskey;" command="cmd_print_list_template_edit"/>
                 <menuitem label="&staff.server.admin.index.fonts_and_sounds;" command="cmd_local_admin_fonts_and_sounds"/>
+                <menuitem type="checkbox" label="&staff.main.menu.admin.client.copy_editor.copy_location.label;" command="cmd_copy_editor_copy_location_first_toggle"/>
                 <menu id="main.menu.admin.client.hotkeys" label="&staff.main.menu.admin.client.hotkeys;">
                     <menupopup id="main.menu.admin.client.hotkeys.popup">
                         <menuitem label="&staff.main.menu.admin.client.hotkeys.toggle.label;" accesskey="&staff.main.menu.admin.client.hotkeys.toggle.accesskey;" type="checkbox" autocheck="false" command="cmd_hotkeys_toggle"/>
diff --git a/Open-ILS/xul/staff_client/defaults/preferences/prefs.js b/Open-ILS/xul/staff_client/defaults/preferences/prefs.js
index 3870af4..bf3d517 100644
--- a/Open-ILS/xul/staff_client/defaults/preferences/prefs.js
+++ b/Open-ILS/xul/staff_client/defaults/preferences/prefs.js
@@ -29,3 +29,6 @@ pref("open-ils.toolbar.defaultnewtab", false);
 
 // Template Toolkit Opac Enabled in Staff Client
 pref("oils.use_tpac", false);
+
+// Copy location name first in copy editor
+pref("oils.copy_editor.copy_location_name_first", false);
diff --git a/Open-ILS/xul/staff_client/server/cat/copy_editor.js b/Open-ILS/xul/staff_client/server/cat/copy_editor.js
index b6b5d93..cf541ff 100644
--- a/Open-ILS/xul/staff_client/server/cat/copy_editor.js
+++ b/Open-ILS/xul/staff_client/server/cat/copy_editor.js
@@ -52,6 +52,15 @@ 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});
 
+        /******************************************************************************************************/
+        /* Get preference (if it exists) for copy location label order */
+
+        g.cl_first = false; // Default to legacy OU first mode
+        var prefs = Components.classes['@mozilla.org/preferences-service;1']
+            .getService(Components.interfaces['nsIPrefBranch']);
+        try {
+            g.cl_first = prefs.getBoolPref('oils.copy_editor.copy_location_name_first');
+        } catch(E) { }
 
         /******************************************************************************************************/
         /* Quick fix, this was defined inline in the global scope but now needs g.error and g.copies from my_init */
@@ -929,7 +938,7 @@ g.panes_and_field_names = {
         $('catStrings').getString('staff.cat.copy_editor.field.location.label'),
         { 
             render: 'typeof fm.location() == "object" ? fm.location().name() : g.data.lookup("acpl",fm.location()).name()', 
-            input: 'c = function(v){ g.apply("location",v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( util.functional.map_list( g.get_acpl_list(), function(obj) { return [ g.data.hash.aou[ obj.owning_lib() ].shortname() + " : " + obj.name(), obj.id() ]; }).sort()); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
+            input: 'c = function(v){ g.apply("location",v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( util.functional.map_list( g.get_acpl_list(), function(obj) { return [ ' + (g.cl_first ? 'obj.name() + " : " + g.data.hash.aou[ obj.owning_lib() ].shortname()' : 'g.data.hash.aou[ obj.owning_lib() ].shortname() + " : " + obj.name()') + ', obj.id() ]; }).sort()); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
 
         }
     ],

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/web/opac/locale/en-US/lang.dtd            |    1 +
 .../xul/staff_client/chrome/content/main/main.js   |    1 +
 .../xul/staff_client/chrome/content/main/menu.js   |   34 ++++++++++++++++++++
 .../chrome/content/main/menu_frame_menus.xul       |    2 +
 .../xul/staff_client/defaults/preferences/prefs.js |    3 ++
 .../xul/staff_client/server/cat/copy_editor.js     |   11 ++++++-
 6 files changed, 51 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list