some i18n, fewer steps for freezing/thawing holds, and disabling editing of hold...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 3 Apr 2008 17:41:49 +0000 (17:41 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 3 Apr 2008 17:41:49 +0000 (17:41 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@9209 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
Open-ILS/xul/staff_client/server/patron/holds.js
Open-ILS/xul/staff_client/server/patron/holds.xul
Open-ILS/xul/staff_client/server/patron/holds_overlay.xul
Open-ILS/xul/staff_client/server/skin/global.css

index b978159..e11ddac 100644 (file)
@@ -314,3 +314,18 @@ staff.circ.checkin.renew_failed.override=Override Renew Failure?
 staff.circ.renew.barcode=Barcode: %1$s
 staff.circ.renew.barcode.status=Barcode: %1$s Status: %2$s
 staff.circ.renew.barcode.msg=Barcode: %1$s Message: %2$s
+staff.circ.holds.activate.prompt=Are you sure you would like to activate hold %1$s?
+staff.circ.holds.activate.prompt.plural=Are you sure you would like to activate holds %1$s?
+staff.circ.holds.suspend.prompt=Are you sure you would like to suspend hold %1$s?
+staff.circ.holds.suspend.prompt.plural=Are you sure you would like to suspend holds %1$s?
+staff.circ.holds.modifying_holds=Modifying Holds
+staff.circ.holds.modifying_holds.yes=Yes
+staff.circ.holds.modifying_holds.no=No
+staff.circ.holds.already_activated=Hold %1$s was already activated.
+staff.circ.holds.already_activated.plural=Holds %1$s were already activated.
+staff.circ.holds.already_suspended=Hold %1$s was already suspended.
+staff.circ.holds.already_suspended.plural=Holds %1$s were already suspended.
+staff.circ.holds.unexpected_error.not_likely_modified=Holds not likely modified.
+staff.circ.holds.unexpected_error.not_likely_activated=Holds not likely activated.
+staff.circ.holds.unexpected_error.not_likely_suspended=Holds not likely suspended.
+
index dba1b17..e3f2685 100644 (file)
@@ -127,7 +127,8 @@ patron.holds.prototype = {
                                                obj.controller.view.cmd_holds_edit_email_notify.setAttribute('disabled','false');
                                                obj.controller.view.cmd_holds_edit_selection_depth.setAttribute('disabled','false');
                                                obj.controller.view.cmd_holds_edit_thaw_date.setAttribute('disabled','false');
-                                               obj.controller.view.cmd_holds_edit_freeze.setAttribute('disabled','false');
+                                               obj.controller.view.cmd_holds_activate.setAttribute('disabled','false');
+                                               obj.controller.view.cmd_holds_suspend.setAttribute('disabled','false');
                                                obj.controller.view.cmd_show_notifications.setAttribute('disabled','false');
                                                obj.controller.view.cmd_holds_retarget.setAttribute('disabled','false');
                                                obj.controller.view.cmd_holds_cancel.setAttribute('disabled','false');
@@ -143,7 +144,8 @@ patron.holds.prototype = {
                                                obj.controller.view.cmd_holds_edit_email_notify.setAttribute('disabled','true');
                                                obj.controller.view.cmd_holds_edit_selection_depth.setAttribute('disabled','true');
                                                obj.controller.view.cmd_holds_edit_thaw_date.setAttribute('disabled','true');
-                                               obj.controller.view.cmd_holds_edit_freeze.setAttribute('disabled','true');
+                                               obj.controller.view.cmd_holds_activate.setAttribute('disabled','true');
+                                               obj.controller.view.cmd_holds_suspend.setAttribute('disabled','true');
                                                obj.controller.view.cmd_show_notifications.setAttribute('disabled','true');
                                                obj.controller.view.cmd_holds_retarget.setAttribute('disabled','true');
                                                obj.controller.view.cmd_holds_cancel.setAttribute('disabled','true');
@@ -451,53 +453,90 @@ patron.holds.prototype = {
                                                        }
                                                }
                                        ],
-                    'cmd_holds_edit_freeze' : [
+                    'cmd_holds_suspend' : [
                                                ['command'],
                                                function() {
                                                        try {
-                                                               var xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: vertical">';
-                                                               xml += '<description>Freeze or un-freeze these holds?</description>';
-                                                               xml += '<hbox><button value="freeze" label="Freeze" accesskey="F" name="fancy_submit"/>';
-                                                               xml += '<button value="unfreeze" label="Un-Freeze" accesskey="U" 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="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
-                                                               netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
-                                                               //obj.data.temp_mid = xml; obj.data.stash('temp_mid');
-                                                               //obj.data.temp_bot = bot_xml; obj.data.stash('temp_bot');
-                                                               JSAN.use('util.window'); var win = new util.window();
-                                                               var fancy_prompt_data = win.open(
-                                                                       urls.XUL_FANCY_PROMPT,
-                                                                       //+ '?xml_in_stash=temp_mid'
-                                                                       //+ '&bottom_xml_in_stash=temp_bot'
-                                                                       //+ '&title=' + window.escape('Set Email Notification for Holds'),
-                                                                       'fancy_prompt', 'chrome,resizable,modal',
-                                                                       { 'xml' : xml, 'bottom_xml' : bot_xml, 'title' : 'Set Email Notification for Holds' }
-                                                               );
-                                                               if (fancy_prompt_data.fancy_status == 'incomplete') { return; }
-                                                               var freeze = fancy_prompt_data.fancy_submit == 'freeze' ? get_db_true() : get_db_false();
-                                                               var msg = 'Are you sure you would like to ' + ( get_bool( freeze ) ? 'freeze' : 'un-freeze' ) + ' hold' + ( obj.retrieve_ids.length > 1 ? 's ' : ' ') + util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', ') + '?';
-                                                               var r = obj.error.yns_alert(msg,'Modifying Holds','Yes','No',null,'Check here to confirm this message');
+                                var hold_list = util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', '); 
+                                                               var r = obj.error.yns_alert(
+                                    obj.retrieve_ids.length > 1 ?
+                                    document.getElementById('circStrings').getFormattedString('staff.circ.holds.suspend.prompt.plural',[hold_list]) :
+                                    document.getElementById('circStrings').getFormattedString('staff.circ.holds.suspend.prompt',[hold_list]),
+                                    document.getElementById('circStrings').getString('staff.circ.holds.modifying_holds'),
+                                    document.getElementById('circStrings').getString('staff.circ.holds.modifying_holds.yes'),
+                                    document.getElementById('circStrings').getString('staff.circ.holds.modifying_holds.no'),
+                                    null,
+                                    document.getElementById('commonStrings').getString('common.confirm')
+                                );
                                                                if (r == 0) {
+                                    var already_suspended = [];
                                                                        for (var i = 0; i < obj.retrieve_ids.length; i++) {
                                                                                var hold = obj.holds_map[ obj.retrieve_ids[i].id ];
-                                                                               hold.frozen(  freeze ); 
-                                                                               if ( ! get_bool( freeze ) ) {
-                                                                                       hold.thaw_date( null );
-                                                                               }
+                                        if ( get_bool( hold.frozen() ) ) {
+                                            already_suspended.push( hold.id() );
+                                            continue; 
+                                        }
+                                                                               hold.frozen('t'); 
+                                                                               hold.thaw_date(null);
+                                                                               hold.ischanged('1');
+                                        hold = obj.flatten_copy(hold);
+                                                                               var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
+                                                                               if (typeof robj.ilsevent != 'undefined') throw(robj);
+                                                                       }
+                                    if (already_suspended.length == 1) {
+                                        alert( document.getElementById('circStrings').getFormattedString('staff.circ.holds.already_suspended',[already_suspended[0]]) );
+                                    } else if (already_suspended.length > 1) {
+                                        alert( document.getElementById('circStrings').getFormattedString('staff.circ.holds.already_suspended.plural',[already_suspended.join(', ')]) );
+                                    }
+                                                                       obj.clear_and_retrieve(true);
+                                                               }
+                                                       } catch(E) {
+                                                               obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.holds.unexpected_error.not_likely_suspended'),E);
+                                                       }
+                                               }
+                                       ],
+                    'cmd_holds_activate' : [
+                                               ['command'],
+                                               function() {
+                                                       try {
+                                var hold_list = util.functional.map_list( obj.retrieve_ids, function(o){return o.id;}).join(', '); 
+                                                               var r = obj.error.yns_alert(
+                                    obj.retrieve_ids.length > 1 ?
+                                    document.getElementById('circStrings').getFormattedString('staff.circ.holds.activate.prompt.plural',[hold_list]) :
+                                    document.getElementById('circStrings').getFormattedString('staff.circ.holds.activate.prompt',[hold_list]),
+                                    document.getElementById('circStrings').getString('staff.circ.holds.modifying_holds'),
+                                    document.getElementById('circStrings').getString('staff.circ.holds.modifying_holds.yes'),
+                                    document.getElementById('circStrings').getString('staff.circ.holds.modifying_holds.no'),
+                                    null,
+                                    document.getElementById('commonStrings').getString('common.confirm')
+                                );
+                                                               if (r == 0) {
+                                    var already_activated = [];
+                                                                       for (var i = 0; i < obj.retrieve_ids.length; i++) {
+                                                                               var hold = obj.holds_map[ obj.retrieve_ids[i].id ];
+                                        if ( ! get_bool( hold.frozen() ) ) {
+                                            already_activated.push( hold.id() );
+                                            continue; 
+                                        }
+                                                                               hold.frozen('f'); 
+                                                                               hold.thaw_date(null);
                                                                                hold.ischanged('1');
                                         hold = obj.flatten_copy(hold);
                                                                                var robj = obj.network.simple_request('FM_AHR_UPDATE',[ ses(), hold ]);
                                                                                if (typeof robj.ilsevent != 'undefined') throw(robj);
                                                                        }
+                                    if (already_activated.length == 1) {
+                                        alert( document.getElementById('circStrings').getFormattedString('staff.circ.holds.already_activated',[already_activated[0]]) );
+                                    } else if (already_activated.length > 1) {
+                                        alert( document.getElementById('circStrings').getFormattedString('staff.circ.holds.already_activated.plural',[already_activated.join(', ')]) );
+                                    }
                                                                        obj.clear_and_retrieve(true);
                                                                }
                                                        } catch(E) {
-                                                               obj.error.standard_unexpected_error_alert('Holds not likely modified.',E);
+                                                               obj.error.standard_unexpected_error_alert(document.getElementById('circStrings').getString('staff.circ.holds.unexpected_error.not_likely_activated'),E);
                                                        }
                                                }
                                        ],
-
                     'cmd_holds_edit_thaw_date' : [
                                                ['command'],
                                                function() {
@@ -746,7 +785,8 @@ patron.holds.prototype = {
                 obj.controller.view.cmd_holds_edit_phone_notify.setAttribute('disabled','true');
                 obj.controller.view.cmd_holds_edit_email_notify.setAttribute('disabled','true');
                                obj.controller.view.cmd_holds_edit_thaw_date.setAttribute('disabled','true');
-                               obj.controller.view.cmd_holds_edit_freeze.setAttribute('disabled','true');
+                               obj.controller.view.cmd_holds_activate.setAttribute('disabled','true');
+                               obj.controller.view.cmd_holds_suspend.setAttribute('disabled','true');
                 obj.controller.view.cmd_holds_edit_selection_depth.setAttribute('disabled','true');
                 obj.controller.view.cmd_show_notifications.setAttribute('disabled','true');
                 obj.controller.view.cmd_holds_retarget.setAttribute('disabled','true');
index 2c2807c..9d04847 100644 (file)
@@ -84,8 +84,9 @@
                <command id="cmd_holds_edit_phone_notify" />
                <command id="cmd_holds_edit_email_notify" />
                <command id="cmd_holds_edit_thaw_date" />
-               <command id="cmd_holds_edit_freeze" />
-               <command id="cmd_holds_edit_selection_depth" disabled="true" hidden="true"/>
+               <command id="cmd_holds_activate" />
+               <command id="cmd_holds_suspend" />
+               <command id="cmd_holds_edit_selection_depth" />
                <command id="cmd_broken" disabled="true" hidden="true"/>
                <command id="cmd_holds_retarget"/>
                <command id="cmd_holds_cancel" />
index 3911ffe..85198be 100644 (file)
 
 <popupset id="holds_popupset">
        <popup id="holds_actions" position="at_pointer"> 
-               <menuitem command="sel_clip" label="Copy to Clipboard" accesskey="C" />
-               <menuitem label="Show in Catalog" command="cmd_show_catalog" accesskey="S"/>
-               <menuitem command="sel_copy_details" label="Show Item Details" accesskey="I" />
-               <menuitem command="sel_patron" label="Show Last Few Circulations" accesskey="L"/>
+               <menuitem command="sel_clip" label="&staff.circ.holds.copy_to_clipboard;" accesskey="&staff.circ.holds.copy_to_clipboard.accesskey;" />
+               <menuitem label="&staff.circ.holds.show_in_catalog;" command="cmd_show_catalog" accesskey="&staff.circ.holds.show_in_catalog.accesskey;"/>
+               <menuitem command="sel_copy_details" label="&staff.circ.holds.show_item_details;" accesskey="&staff.circ.holds.show_item_details.accesskey;" />
+               <menuitem command="sel_patron" label="&staff.circ.holds.show_last_few_circulations;" accesskey="&staff.circ.holds.show_last_few_circulations.accesskey;"/>
                <menuseparator />
-               <menuitem label="Retrieve Patron" command="cmd_retrieve_patron" accesskey="P"/>
-               <menuitem label="Show Notices" command="cmd_show_notifications" accesskey="N" />
+               <menuitem label="&staff.circ.holds.retrieve_patron;" command="cmd_retrieve_patron" accesskey="&staff.circ.holds.retrieve_patron.accesskey;"/>
+               <menuitem label="&staff.circ.holds.show_notices;" command="cmd_show_notifications" accesskey="&staff.circ.holds.show_notices.accesskey;" />
                <menuseparator />
-               <menuitem label="Edit Pickup Library" command="cmd_holds_edit_pickup_lib" accesskey="L"/>
-               <menuitem label="Edit Phone Notification" command="cmd_holds_edit_phone_notify" accesskey="P"/>
-               <menuitem label="Set Email Notification" command="cmd_holds_edit_email_notify" accesskey="E"/>
-               <menuitem label="Edit Thaw Date" command="cmd_holds_edit_thaw_date" accesskey="T"/>
-               <menuitem label="Set Freeze" command="cmd_holds_edit_freeze" accesskey="F"/>
-               <!--
-               <menuitem label="Edit Hold Range" command="cmd_holds_edit_selection_depth" accesskey="R"/>
-               <menuitem label="Edit Hold Focus" command="cmd_broken" accesskey="F"/>
-               -->
+               <menuitem label="&staff.circ.holds.edit_pickup_library;" command="cmd_holds_edit_pickup_lib" accesskey="&staff.circ.holds.edit_pickup_library.accesskey;"/>
+               <menuitem label="&staff.circ.holds.edit_phone_notification;" command="cmd_holds_edit_phone_notify" accesskey="&staff.circ.holds.edit_phone_notification.accesskey;"/>
+               <menuitem label="&staff.circ.holds.set_email_notification;" command="cmd_holds_edit_email_notify" accesskey="&staff.circ.holds.set_email_notification.accesskey;"/>
+               <menuitem label="&staff.circ.holds.edit_activation_date;" command="cmd_holds_edit_thaw_date" accesskey="&staff.circ.holds.edit_activation_date;"/>
+               <menuitem label="&staff.circ.holds.activate_hold;" command="cmd_holds_activate" accesskey="&staff.circ.holds.activate_hold.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;"/>
                <menuseparator />
-               <menuitem command="sel_mark_items_damaged" label="Mark Item Damaged" accesskey="D"/>
-               <menuitem command="sel_mark_items_missing" label="Mark Item Missing" accesskey="M"/>
-               <menuitem label="Find Another Target" command="cmd_holds_retarget" accesskey="T"/>
-               <menuitem label="Cancel Hold" command="cmd_holds_cancel" accesskey="C"/>
+               <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.retarget;" command="cmd_holds_retarget" accesskey="&staff.circ.holds.retarget.accesskey;"/>
+               <menuitem label="&staff.circ.holds.cancel;" command="cmd_holds_cancel" accesskey="&staff.circ.holds.cancel.accesskey;"/>
                <menuseparator />
-               <menuitem command="save_columns" label="Save Columns"/>
+               <menuitem command="save_columns" label="&staff.circ.holds.save_columns;" accesskey="&staff.circ.holds.save_columns.accesskey;"/>
        </popup>
 </popupset>
 
     <menubar>
         <menu label="Actions for Selected Holds" accesskey="S">
             <menupopup>
-                <menuitem command="sel_clip" label="Copy to Clipboard" accesskey="C" />
-                <menuitem label="Show in Catalog" command="cmd_show_catalog"  accesskey="S"/>
-                <menuitem command="sel_copy_details" label="Show Item Details" accesskey="I" />
-                <menuitem command="sel_patron" label="Show Last Few Circulations" accesskey="L"/>
+                <menuitem command="sel_clip" label="&staff.circ.holds.copy_to_clipboard;" accesskey="&staff.circ.holds.copy_to_clipboard.accesskey;" />
+                <menuitem label="&staff.circ.holds.show_in_catalog;" command="cmd_show_catalog" accesskey="&staff.circ.holds.show_in_catalog.accesskey;"/>
+                <menuitem command="sel_copy_details" label="&staff.circ.holds.show_item_details;" accesskey="&staff.circ.holds.show_item_details.accesskey;" />
+                <menuitem command="sel_patron" label="&staff.circ.holds.show_last_few_circulations;" accesskey="&staff.circ.holds.show_last_few_circulations.accesskey;"/>
                 <menuseparator />
-                <menuitem label="Retrieve Patron" command="cmd_retrieve_patron" accesskey="P"/>
-                <menuitem label="Show Notices" command="cmd_show_notifications" accesskey="N" />
+                <menuitem label="&staff.circ.holds.retrieve_patron;" command="cmd_retrieve_patron" accesskey="&staff.circ.holds.retrieve_patron.accesskey;"/>
+                <menuitem label="&staff.circ.holds.show_notices;" command="cmd_show_notifications" accesskey="&staff.circ.holds.show_notices.accesskey;" />
                 <menuseparator />
-                <menuitem label="Edit Pickup Library" command="cmd_holds_edit_pickup_lib" accesskey="L"/>
-                <menuitem label="Edit Phone Notification" command="cmd_holds_edit_phone_notify" accesskey="P"/>
-                <menuitem label="Set Email Notification" command="cmd_holds_edit_email_notify" accesskey="E" />
-                <menuitem label="Edit Thaw Date" command="cmd_holds_edit_thaw_date" accesskey="T"/>
-                <menuitem label="Set Freeze" command="cmd_holds_edit_freeze" accesskey="F"/>
-                <!--
-                <menuitem label="Edit Hold Range" command="cmd_holds_edit_selection_depth" accesskey="R" />
-                <menuitem label="Edit Hold Focus" command="cmd_broken" accesskey="F" />
-                -->
+                <menuitem label="&staff.circ.holds.edit_pickup_library;" command="cmd_holds_edit_pickup_lib" accesskey="&staff.circ.holds.edit_pickup_library.accesskey;"/>
+                <menuitem label="&staff.circ.holds.edit_phone_notification;" command="cmd_holds_edit_phone_notify" accesskey="&staff.circ.holds.edit_phone_notification.accesskey;"/>
+                <menuitem label="&staff.circ.holds.set_email_notification;" command="cmd_holds_edit_email_notify" accesskey="&staff.circ.holds.set_email_notification.accesskey;"/>
+                <menuitem label="&staff.circ.holds.edit_activation_date;" command="cmd_holds_edit_thaw_date" accesskey="&staff.circ.holds.edit_activation_date;"/>
+                <menuitem label="&staff.circ.holds.activate_hold;" command="cmd_holds_activate" accesskey="&staff.circ.holds.activate_hold.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;"/>
                 <menuseparator />
-                <menuitem command="sel_mark_items_damaged" label="Mark Item Damaged" accesskey="D"/>
-                <menuitem command="sel_mark_items_missing" label="Mark Item Missing" accesskey="M"/>
-                <menuitem label="Find Another Target" command="cmd_holds_retarget" accesskey="T"/>
-                <menuitem label="Cancel Hold" command="cmd_holds_cancel"  accesskey="C"/>
+                <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.retarget;" command="cmd_holds_retarget" accesskey="&staff.circ.holds.retarget.accesskey;"/>
+                <menuitem label="&staff.circ.holds.cancel;" command="cmd_holds_cancel" accesskey="&staff.circ.holds.cancel.accesskey;"/>
                 <menuseparator />
-                <menuitem command="save_columns" label="Save Columns"/>
+                <menuitem command="save_columns" label="&staff.circ.holds.save_columns;" accesskey="&staff.circ.holds.save_columns.accesskey;"/>
             </menupopup>
         </menu>
     </menubar>
index 6920684..1e35ecd 100644 (file)
@@ -96,3 +96,10 @@ listitem { border-bottom: solid thin black; }
 checkbox[id="native-evergreen-catalog_service"] { display: none; }
 textbox[id="native-evergreen-catalog_username"] { display: none; }
 textbox[id="native-evergreen-catalog_password"] { display: none; }
+
+/*
+ * disable Edit Hold Range and Edit Hold Focus by default; should probably be using perms/settings for this
+ */
+.edit_hold_range { display: none; }
+.edit_hold_focus { display: none; }
+