[open-ils-commits] [GIT] Evergreen ILS branch master updated. 70cabed6c13a6fb5479e13ac88bd28cabbfcecde
Evergreen Git
git at git.evergreen-ils.org
Mon Apr 23 13:50:40 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, master has been updated
via 70cabed6c13a6fb5479e13ac88bd28cabbfcecde (commit)
from 3e7d2d4f5fa87ebad94cff70b98cfbb9c5f9dd6a (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 70cabed6c13a6fb5479e13ac88bd28cabbfcecde
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 14c4cd3..7b98020 100644
--- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
+++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
@@ -439,44 +439,70 @@ function set_opac() {
$('record_back_to_results').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;
}
if (win.rdetailBackToResults) {
g.f_record_back_to_results = function() {
- g.view_override = g.view;
- win.rdetailBackToResults();
- if (g.view != "opac") {
- set_opac();
- opac_wrapper_set_help_context();
+ if (safe_to_proceed()) {
+ g.view_override = g.view;
+ win.rdetailBackToResults();
+ if (g.view != "opac") {
+ set_opac();
+ opac_wrapper_set_help_context();
+ }
}
}
$('record_back_to_results').disabled = false;
@@ -531,6 +557,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;
@@ -709,6 +736,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 113ea93..c004f05 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js
+++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js
@@ -2240,6 +2240,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 37f0466..88c0fe3 100644
--- a/Open-ILS/xul/staff_client/chrome/content/util/browser.js
+++ b/Open-ILS/xul/staff_client/chrome/content/util/browser.js
@@ -293,6 +293,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 961ad06..23cd01a 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
@@ -296,6 +296,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 | 58 +++++++++++++++-----
.../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, 53 insertions(+), 15 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list