wire up Top of Queue toggle for staff client hold interface
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 27 Oct 2009 07:09:48 +0000 (07:09 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 27 Oct 2009 07:09:48 +0000 (07:09 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@14625 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/locale/en-US/lang.dtd
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/locale/en-US/patron.properties
Open-ILS/xul/staff_client/server/patron/holds.js
Open-ILS/xul/staff_client/server/patron/holds_overlay.xul

index 3cb462e..011f64a 100644 (file)
 <!ENTITY staff.circ.holds.edit_hold_range.accesskey "R">
 <!ENTITY staff.circ.holds.edit_hold_focus "Edit Hold Focus">
 <!ENTITY staff.circ.holds.edit_hold_focus.accesskey "F">
+<!ENTITY staff.circ.holds.set_top_of_queue "Set Top of Queue">
+<!ENTITY staff.circ.holds.set_top_of_queue.accesskey "Q">
 <!ENTITY staff.circ.holds.mark_item_damaged "Mark Item Damaged">
 <!ENTITY staff.circ.holds.mark_item_damaged.accesskey "D">
 <!ENTITY staff.circ.holds.mark_item_missing "Mark Item Missing">
index 3a83706..1ad6131 100644 (file)
@@ -1886,6 +1886,15 @@ circ.util.hold_columns = function(modify,params) {
         },
         {
             'persist' : 'hidden width ordinal',
+            'id' : 'top_of_queue',
+            'label' : document.getElementById('commonStrings').getString('staff.ahr_top_of_queue_label'),
+            'flex' : 1,
+            'primary' : false,
+            'hidden' : true,
+            'editable' : false, 'render' : function(my) { return get_bool( my.ahr.cut_in_line() ) ? document.getElementById('commonStrings').getString('common.yes') : document.getElementById('commonStrings').getString('common.no') ; }
+        },
+        {
+            'persist' : 'hidden width ordinal',
             'id' : 'target',
             'label' : document.getElementById('commonStrings').getString('staff.ahr_target_label'),
             'flex' : 1,
index 1b8b435..e0d428f 100644 (file)
@@ -53,6 +53,7 @@ staff.ahr_pickup_lib_label=Pickup Library
 staff.ahr_prev_check_time_label=Previous Check Time
 staff.ahr_requestor_label=Requestor
 staff.ahr_selection_depth_label=Selection Depth
+staff.ahr_top_of_queue_label=Top of Queue
 staff.ahr_status_label=Status
 staff.ahr_target_label=Target
 staff.ahr_usr_label=User
index e58ca1f..3f08b1c 100644 (file)
@@ -160,6 +160,21 @@ staff.patron.holds.holds_edit_email_notify.enable_email.plural=Are you sure you
 staff.patron.holds.holds_edit_email_notify.disable_email.singular=Are you sure you would like to disable email notification for hold %1$s?
 staff.patron.holds.holds_edit_email_notify.disable_email.plural=Are you sure you would like to disable email notification for hold %1$s?
 staff.patron.holds.holds_edit_email_notify.mod_holds_title=Modifying Holds
+
+staff.patron.holds.holds_cut_in_line.description=Move to the front of the holds queue above other holds that are not likewise flagged Top of Queue?
+staff.patron.holds.holds_cut_in_line.btn_cut.label=Top of Queue
+staff.patron.holds.holds_cut_in_line.btn_cut.accesskey=T
+staff.patron.holds.holds_cut_in_line.btn_no_cut.label=No Top of Queue
+staff.patron.holds.holds_cut_in_line.btn_no_cut.accesskey=N
+staff.patron.holds.holds_cut_in_line.btn_cancel.label=Cancel
+staff.patron.holds.holds_cut_in_line.btn_cancel.accesskey=C
+staff.patron.holds.holds_cut_in_line.set_notifs=Set Top of Queue (Force to Front) for Holds
+staff.patron.holds.holds_cut_in_line.enable_cut.singular=Are you sure you would like to enable Top of Queue for hold %1$s?
+staff.patron.holds.holds_cut_in_line.enable_cut.plural=Are you sure you would like to enable Top of Queue for holds %1$s?
+staff.patron.holds.holds_cut_in_line.disable_cut.singular=Are you sure you would like to disable Top of Queue for hold %1$s?
+staff.patron.holds.holds_cut_in_line.disable_cut.plural=Are you sure you would like to disable Top of Queue for hold %1$s?
+staff.patron.holds.holds_cut_in_line.mod_holds_title=Modifying Holds
+
 staff.patron.holds.holds_retarget.reset_hold_message.singular=Are you sure you would like to reset hold %1$s?
 staff.patron.holds.holds_retarget.reset_hold_message.plural=Are you sure you would like to reset holds %1$s?
 staff.patron.holds.holds_retarget.reset_hold_title=Resetting Holds
index 828f485..5057a87 100644 (file)
@@ -535,6 +535,62 @@ patron.holds.prototype = {
                             }
                         }
                     ],
+                    'cmd_holds_cut_in_line' : [
+                        ['command'],
+                        function() {
+                            try {
+                                var xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: vertical">';
+                                xml += '<description>'+$("patronStrings").getString('staff.patron.holds.holds_cut_in_line.description')+'</description>';
+                                xml += '<hbox><button value="cut" label="'+$("patronStrings").getString('staff.patron.holds.holds_cut_in_line.btn_cut.label')+'"';
+                                xml += ' accesskey="'+$("patronStrings").getString('staff.patron.holds.holds_cut_in_line.btn_cut.accesskey')+'" name="fancy_submit"/>';
+                                xml += '<button value="nocut" label="'+$("patronStrings").getString('staff.patron.holds.holds_cut_in_line.btn_no_cut.label')+'"';
+                                xml += '  accesskey="'+$("patronStrings").getString('staff.patron.holds.holds_cut_in_line.btn_no_cut.accesskey')+'" name="fancy_submit"/></hbox>';
+                                xml += '</vbox>';
+                                var bot_xml = '<hbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: vertical">';
+                                bot_xml += '<spacer flex="1"/><button label="'+$("patronStrings").getString('staff.patron.holds.holds_cut_in_line.btn_cancel.label')+'"';
+                                bot_xml += ' accesskey="'+$("patronStrings").getString('staff.patron.holds.holds_cut_in_line.btn_cancel.accesskey')+'" name="fancy_cancel"/></hbox>';
+                                netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
+                                JSAN.use('util.window'); var win = new util.window();
+                                var fancy_prompt_data = win.open(
+                                    urls.XUL_FANCY_PROMPT,
+                                    'fancy_prompt', 'chrome,resizable,modal',
+                                    { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : $("patronStrings").getString('staff.patron.holds.holds_cut_in_line.set_notifs') }
+                                );
+                                if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
+                                var cut = fancy_prompt_data.fancy_submit == 'cut' ? get_db_true() : get_db_false();
+
+                                var hold_list = util.functional.map_list(obj.retrieve_ids, function(o){return o.id;});
+                                var msg = '';
+                                if(get_bool(cut)) {
+                                    if(obj.retrieve_ids.length > 1) {
+                                        msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_cut_in_line.enable_cut.plural', [hold_list.join(', ')]);
+                                    } else {
+                                        msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_cut_in_line.enable_cut.singular', [hold_list.join(', ')]);
+                                    }
+                                } else {
+                                    if(obj.retrieve_ids.length > 1) {
+                                        msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_cut_in_line.disable_cut.plural', [hold_list.join(', ')]);
+                                    } else {
+                                        msg = $("patronStrings").getFormattedString('staff.patron.holds.holds_cut_in_line.disable_cut.singular', [hold_list.join(', ')]);
+                                    }
+                                }
+
+                                var r = obj.error.yns_alert(msg,
+                                        $("patronStrings").getString('staff.patron.holds.holds_cut_in_line.mod_holds_title'),
+                                        $("commonStrings").getString('common.yes'),
+                                        $("commonStrings").getString('common.no'),
+                                        null,
+                                        $("commonStrings").getString('common.check_to_confirm')
+                                );
+                                if (r == 0) {
+                                    circ.util.batch_hold_update(hold_list, { 'cut_in_line' : cut }, { 'progressmeter' : progressmeter, 'oncomplete' :  function() { obj.clear_and_retrieve(true); } });
+                                }
+                            } catch(E) {
+                                obj.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.holds.holds_not_modified'),E);
+                            }
+                        }
+                    ],
+
                     'cmd_holds_suspend' : [
                         ['command'],
                         function() {
index e462425..3844548 100644 (file)
@@ -27,6 +27,7 @@
     <command id="cmd_holds_edit_expire_time" />
     <command id="cmd_holds_activate" />
     <command id="cmd_holds_suspend" />
+    <command id="cmd_holds_cut_in_line" />
     <command id="cmd_holds_edit_selection_depth" />
     <command id="cmd_broken" disabled="true" hidden="true"/>
     <command id="cmd_holds_retarget"/>
@@ -55,6 +56,7 @@
         <menuitem label="&staff.circ.holds.suspend_hold;" command="cmd_holds_suspend" accesskey="&staff.circ.holds.suspend_hold.accesskey;"/>
         <menuitem label="&staff.circ.holds.edit_hold_range;" class="edit_hold_range" command="cmd_holds_edit_selection_depth" accesskey="&staff.circ.holds.edit_hold_range.accesskey;"/>
         <menuitem label="&staff.circ.holds.edit_hold_focus;" class="edit_hold_focus" command="cmd_broken" accesskey="&staff.circ.holds.edit_hold_focus.accesskey;"/>
+        <menuitem label="&staff.circ.holds.set_top_of_queue;" command="cmd_holds_cut_in_line" accesskey="&staff.circ.holds.set_top_of_queue.accesskey;"/>
         <menuseparator />
         <menuitem command="sel_mark_items_damaged" label="&staff.circ.holds.mark_item_damaged;" accesskey="&staff.circ.holds.mark_item_damaged.accesskey;"/>
         <menuitem command="sel_mark_items_missing" label="&staff.circ.holds.mark_item_missing;" accesskey="&staff.circ.holds.mark_item_missing.accesskey;"/>
                     <menuitem label="&staff.circ.holds.suspend_hold;" command="cmd_holds_suspend" accesskey="&staff.circ.holds.suspend_hold.accesskey;"/>
                     <menuitem label="&staff.circ.holds.edit_hold_range;" class="edit_hold_range" command="cmd_holds_edit_selection_depth" accesskey="&staff.circ.holds.edit_hold_range.accesskey;"/>
                     <menuitem label="&staff.circ.holds.edit_hold_focus;" class="edit_hold_focus" command="cmd_broken" accesskey="&staff.circ.holds.edit_hold_focus.accesskey;"/>
+                    <menuitem label="&staff.circ.holds.set_top_of_queue;" command="cmd_holds_cut_in_line" accesskey="&staff.circ.holds.set_top_of_queue.accesskey;"/>
                     <menuseparator />
                     <menuitem command="sel_mark_items_damaged" label="&staff.circ.holds.mark_item_damaged;" accesskey="&staff.circ.holds.mark_item_damaged.accesskey;"/>
                     <menuitem command="sel_mark_items_missing" label="&staff.circ.holds.mark_item_missing;" accesskey="&staff.circ.holds.mark_item_missing.accesskey;"/>