staff.circ_modifier.display localization for rendering circ modifiers
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 12 Sep 2010 18:43:38 +0000 (18:43 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 12 Sep 2010 18:43:38 +0000 (18:43 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@17614 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js
Open-ILS/xul/staff_client/server/cat/copy_editor.js
Open-ILS/xul/staff_client/server/circ/alternate_copy_summary.js
Open-ILS/xul/staff_client/server/circ/pre_cat_fields.xul
Open-ILS/xul/staff_client/server/circ/util.js
Open-ILS/xul/staff_client/server/locale/en-US/common.properties
Open-ILS/xul/staff_client/server/serial/batch_receive.js

index 7ec636d..803e107 100644 (file)
@@ -519,9 +519,11 @@ OpenILS.data.prototype = {
         this.chain.push(
             function() {
                 try {
-                    var robj = obj.network.simple_request('CIRC_MODIFIER_LIST',[]);
+                    var robj = obj.network.simple_request('CIRC_MODIFIER_LIST',[{'full':true}]);
                     if (typeof robj.ilsevent != 'undefined') throw(robj);
-                    obj.list.circ_modifier = robj;
+                    obj.list.ccm = robj == null ? [] : robj;
+                    obj.hash.ccm = util.functional.convert_object_list_to_hash( obj.list.ccm );
+                    obj.list.circ_modifier = util.functional.map_list( obj.list.ccm, function(o) { return o.code(); } );
                     obj.data_progress('Retrieved circ modifier list. ');
                 } catch(E) {
                     var error = 'Error: ' + js2JSON(E);
index 646789d..5fd09ae 100644 (file)
@@ -888,8 +888,8 @@ g.panes_and_field_names = {
     [
         $('catStrings').getString('staff.cat.copy_editor.field.circulation_modifier.label'),
         {    
-            render: 'fm.circ_modifier() == null ? $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null") : fm.circ_modifier()',
-            input: 'c = function(v){ g.apply("circ_modifier",v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( [ [ $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null"), "<HACK:KLUDGE:NULL>" ] ].concat( util.functional.map_list( g.data.list.circ_modifier, function(obj) { return [ obj, obj ]; } ).sort() ) ); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
+            render: 'fm.circ_modifier() == null ? $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null") : $("commonStrings").getFormattedString("staff.circ_modifier.display",[fm.circ_modifier(),g.data.hash.ccm[fm.circ_modifier()].name(),g.data.hash.ccm[fm.circ_modifier()].description()])',
+            input: 'c = function(v){ g.apply("circ_modifier",v); if (typeof post_c == "function") post_c(v); }; x = util.widgets.make_menulist( [ [ $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null"), "<HACK:KLUDGE:NULL>" ] ].concat( util.functional.map_list( g.data.list.ccm, function(obj) { return [ $("commonStrings").getFormattedString("staff.circ_modifier.display",[obj.code(),obj.name(),obj.description()]), obj.code() ]; } ).sort() ) ); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
         }
     ],
 ],
index 0deea00..8128241 100644 (file)
@@ -168,7 +168,8 @@ function load_item() {
             set("circ_as_type", details.copy.circ_as_type()); 
             set("copy_circ_lib" , typeof details.copy.circ_lib() == 'object' ? details.copy.circ_lib().shortname() : data.hash.aou[ details.copy.circ_lib() ].shortname()); 
             set_tooltip("copy_circ_lib" , typeof details.copy.circ_lib() == 'object' ? details.copy.circ_lib().name() : data.hash.aou[ details.copy.circ_lib() ].name()); 
-            set("circ_modifier", details.copy.circ_modifier()); 
+            var cm = details.copy.circ_modifier();
+            set("circ_modifier", document.getElementById('commonStrings').getFormattedString('staff.circ_modifier.display',[cm,data.hash.ccm[cm].name(),data.hash.ccm[cm].description()])); 
             set("circulate", get_localized_bool( details.copy.circulate() )); 
             set("copy_number", details.copy.copy_number()); 
             set("copy_create_date", util.date.formatted_date( details.copy.create_date(), '%{localized}' )); 
index 2668ad3..e8b20d6 100644 (file)
             JSAN.use('util.widgets'); JSAN.use('util.functional');
             var x = util.widgets.make_menulist( 
                 [ [ $("catStrings").getString("staff.cat.copy_editor.field.unset_or_null"), "<HACK:KLUDGE:NULL>" ] ].concat( 
-                    util.functional.map_list( g.data.list.circ_modifier, function(obj) { return [ obj, obj ]; } ).sort() 
+                    util.functional.map_list(
+                        g.data.list.ccm,
+                        function(obj) {
+                            return [
+                                document.getElementById('commonStrings').getFormattedString('staff.circ_modifier.display',[obj.code(),obj.name(),obj.description()]),
+                                obj.code()
+                            ];
+                        }
+                    ).sort() 
                 ) 
             );
             x.setAttribute('id','dummy_circ_modifier');
index 1f37859..3697f5a 100644 (file)
@@ -875,7 +875,7 @@ circ.util.columns = function(modify,params) {
             'flex' : 1,
             'primary' : false,
             'hidden' : true,
-            'editable' : false, 'render' : function(my) { return my.acp.circ_modifier(); }
+            'editable' : false, 'render' : function(my) { var cm = my.acp.circ_modifier(); return document.getElementById('commonStrings').getFormattedString('staff.circ_modifier.display',[cm,data.hash.ccm[cm].name(),data.hash.ccm[cm].description()]); }
         },
         {
             'id' : 'status_changed_time',
index 968d52c..029ed41 100644 (file)
@@ -34,6 +34,7 @@ staff.acp_label_call_number=Call Number
 staff.acp_label_circ_as_type=Circulate As Type
 staff.acp_label_circ_lib=Circulation Library
 staff.acp_label_circ_modifier=Circulation Modifier
+staff.circ_modifier.display=%1$s : %2$s : %3$s
 staff.acp_label_copy_number=Copy Number
 staff.acp_label_deposit_amount=Deposit Amount
 staff.acp_label_fine_level=Fine Level
index f43995d..b549683 100644 (file)
@@ -182,8 +182,7 @@ function BatchReceiver() {
                                     dojo.create(
                                         "menuitem", {
                                             "value": mod.code(),
-                                            /* XXX use format string */
-                                            "label": mod.code()+" "+mod.name()
+                                            "label": document.getElementById('commonStrings').getFormattedString('staff.circ_modifier.display',[mod.code(),mod.name(),mod.description()]) 
                                         }, menupopup, "last"
                                     );
                                 }