[open-ils-commits] [GIT] Evergreen ILS branch rel_2_1 updated. 5b1dd7898de6e96e22e137f116d8f8418b8c1236

Evergreen Git git at git.evergreen-ils.org
Mon Apr 23 13:59:46 EDT 2012


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, rel_2_1 has been updated
       via  5b1dd7898de6e96e22e137f116d8f8418b8c1236 (commit)
      from  da0f2e9a54fea02523506fac8a435d379f9cfd5b (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 5b1dd7898de6e96e22e137f116d8f8418b8c1236
Author: Jason Etheridge <jason at esilibrary.com>
Date:   Fri Mar 30 15:32:53 2012 -0400

    unsaved data loophole
    
    The Start/Previous/Next/End/Search Results buttons in the staff client OPAC
    wrapper do not fire unsaved data warnings for the MARC editor when changing
    records. This plugs that hole, but it's not a complete solution, as you can
    still move away from the record by clicking on hyperlinks in the OPAC View,
    though that's less likely to happen.
    
    Signed-off-by: Jason Etheridge <jason at esilibrary.com>
    Signed-off-by: Michael Peters <mrpeters at library.in.gov>

diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
index 4c94b29..11c7d3c 100644
--- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
+++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
@@ -402,34 +402,58 @@ function set_opac() {
                 $('record_prev').disabled = true; $('record_end').disabled = true;
                 $('record_pos').setAttribute('value','');
 
+                function safe_to_proceed() {
+                    if (typeof xulG.is_tab_locked == 'undefined') { return true; }
+                    if (! xulG.is_tab_locked()) { return true; }
+                    var r = window.confirm(
+                        document.getElementById('offlineStrings').getString(
+                           'generic.unsaved_data_warning'
+                        )
+                    );
+                    if (r) {
+                        while ( xulG.unlock_tab() > 0 ) {};
+                        return true;
+                    } else {
+                        return false;
+                    }
+                }
+
                 win.attachEvt("rdetail", "nextPrevDrawn",
                     function(rIndex,rCount){
                         $('record_pos').setAttribute('value', document.getElementById('offlineStrings').getFormattedString('cat.record.counter', [(1+rIndex), rCount ? rCount : 1]));
                         if (win.rdetailNext) {
-                            g.f_record_next = function() { 
-                                g.view_override = g.view; 
-                                win.rdetailNext(); 
+                            g.f_record_next = function() {
+                                if (safe_to_proceed()) {
+                                    g.view_override = g.view;
+                                    win.rdetailNext();
+                                }
                             }
                             $('record_next').disabled = false;
                         }
                         if (win.rdetailPrev) {
-                            g.f_record_prev = function() { 
-                                g.view_override = g.view; 
-                                win.rdetailPrev(); 
+                            g.f_record_prev = function() {
+                                if (safe_to_proceed()) {
+                                    g.view_override = g.view;
+                                    win.rdetailPrev();
+                                }
                             }
                             $('record_prev').disabled = false;
                         }
                         if (win.rdetailStart) {
                             g.f_record_start = function() { 
-                                g.view_override = g.view; 
-                                win.rdetailStart(); 
+                                if (safe_to_proceed()) {
+                                    g.view_override = g.view;
+                                    win.rdetailStart();
+                                }
                             }
                             $('record_start').disabled = false;
                         }
                         if (win.rdetailEnd) {
                             g.f_record_end = function() { 
-                                g.view_override = g.view; 
-                                win.rdetailEnd(); 
+                                if (safe_to_proceed()) {
+                                    g.view_override = g.view;
+                                    win.rdetailEnd();
+                                }
                             }
                             $('record_end').disabled = false;
                         }
@@ -483,6 +507,7 @@ function set_opac() {
         content_params.lock_tab = xulG.lock_tab;
         content_params.unlock_tab = xulG.unlock_tab;
         content_params.inspect_tab = xulG.inspect_tab;
+        content_params.is_tab_locked = xulG.is_tab_locked;
         content_params.new_patron_tab = xulG.new_patron_tab;
         content_params.set_patron_tab = xulG.set_patron_tab;
         content_params.volume_item_creator = xulG.volume_item_creator;
@@ -610,6 +635,7 @@ function bib_in_new_tab() {
         content_params.lock_tab = xulG.lock_tab;
         content_params.unlock_tab = xulG.unlock_tab;
         content_params.inspect_tab = xulG.inspect_tab;
+        content_params.is_tab_locked = xulG.is_tab_locked;
         content_params.new_patron_tab = xulG.new_patron_tab;
         content_params.set_patron_tab = xulG.set_patron_tab;
         content_params.volume_item_creator = xulG.volume_item_creator;
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 38bf9f7..4633fdc 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js
+++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js
@@ -2047,6 +2047,14 @@ commands:
         var panel = this.controller.view.panels.childNodes[ idx ];
         while ( panel.lastChild ) panel.removeChild( panel.lastChild );
 
+        content_params.is_tab_locked = function() {
+            dump('is_tab_locked\n');
+            var id = tab.getAttribute('id');
+            if (typeof obj.tab_semaphores[id] == 'undefined') {
+                return false;
+            }
+            return obj.tab_semaphores[id] > 0;
+        }
         content_params.lock_tab = function() { 
             dump('lock_tab\n');
             var id = tab.getAttribute('id');
diff --git a/Open-ILS/xul/staff_client/chrome/content/util/browser.js b/Open-ILS/xul/staff_client/chrome/content/util/browser.js
index 63b00be..57e214a 100644
--- a/Open-ILS/xul/staff_client/chrome/content/util/browser.js
+++ b/Open-ILS/xul/staff_client/chrome/content/util/browser.js
@@ -288,6 +288,7 @@ util.browser.prototype = {
                 };
             }
             if (!cw.xulG.inspect_tab) { cw.xulG.inspect_tab = function() { return window.xulG.inspect_tab(); }; }
+            if (!cw.xulG.is_tab_locked) { cw.xulG.is_tab_locked = function() { return window.xulG.is_tab_locked(); }; }
             if (!cw.xulG.new_patron_tab) { cw.xulG.new_patron_tab = function(a,b) { return window.xulG.new_patron_tab(a,b); }; }
             if (!cw.xulG.set_patron_tab) { cw.xulG.set_patron_tab = function(a,b) { return window.xulG.set_patron_tab(a,b); }; }
             if (!cw.xulG.volume_item_creator) { cw.xulG.volume_item_creator = function(a) { return window.xulG.volume_item_creator(a); }; }
diff --git a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
index 7dd52fc..aef1335 100644
--- a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
+++ b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
@@ -290,6 +290,7 @@ menu.tab7.accesskey=7
 menu.tab8.accesskey=8
 menu.tab9.accesskey=9
 menu.tab10.accesskey=0
+generic.unsaved_data_warning=This action may cause you to lose unsaved information in the current interface. Continue anyway?
 browser.reload.unsaved_data_warning=This page may have unsaved data. Reload it anyway?
 menu.close_tab.unsaved_data_warning=This tab may have unsaved data. Close it anyway?
 menu.replace_tab.unsaved_data_warning=This tab may have unsaved data. Replace it anyway?

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

Summary of changes:
 .../xul/staff_client/chrome/content/cat/opac.js    |   46 +++++++++++++++----
 .../xul/staff_client/chrome/content/main/menu.js   |    8 +++
 .../staff_client/chrome/content/util/browser.js    |    1 +
 .../chrome/locale/en-US/offline.properties         |    1 +
 4 files changed, 46 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list