[open-ils-commits] r14855 - in trunk/Open-ILS: src/sql/Pg src/sql/Pg/upgrade xul/staff_client/chrome/content/main (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Nov 10 13:43:23 EST 2009


Author: erickson
Date: 2009-11-10 13:43:19 -0500 (Tue, 10 Nov 2009)
New Revision: 14855

Added:
   trunk/Open-ILS/src/sql/Pg/upgrade/0076.data.coust.ui_circ_patron_display_timeout_interval.sql
Modified:
   trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
   trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
   trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame.xul
Log:

Patch from Lebbeous Fogle-Weekley to support configured staff client idle timeout delays.  When staff has been
idle for X amount of time (per org unit setting), the staff client display will minimize.  Staff is not 
logged out of the server based on this setting.  Use this in environments where unattended staff clients should
be minimized for privacy reasons.




Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2009-11-10 16:59:11 UTC (rev 14854)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2009-11-10 18:43:19 UTC (rev 14855)
@@ -51,7 +51,7 @@
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0075'); -- dbs
+INSERT INTO config.upgrade_log (version) VALUES ('0076'); -- senator
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,

Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2009-11-10 16:59:11 UTC (rev 14854)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2009-11-10 18:43:19 UTC (rev 14855)
@@ -1622,10 +1622,10 @@
   'If enabled and a patron has outstanding bills and the alert page is not required, show the billing tab by default, instead of the checkout tab, when a patron is loaded',
   'bool' ),
 
-( 'ui.circ.patron_display_timeout_interval',
-  'GUI: Patron display timeout interval',
-  'Set this if you would like patron displays in the staff client to be closed after a certain interval of inactivity.  Example ''5 minutes''',
-  'interval' ),
+( 'ui.general.idle_timeout',
+    'GUI: Idle timeout',
+    'If you want staff client windows to be minimized after a certain amount of system idle time, set this to the number of seconds of idle time that you want to allow before minimizing (requires staff client restart).',
+    'integer' ),
 
 ( 'ui.circ.in_house_use.entry_cap',
   'GUI: Record In-House Use: Maximum # of uses allowed per entry.',

Added: trunk/Open-ILS/src/sql/Pg/upgrade/0076.data.coust.ui_circ_patron_display_timeout_interval.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0076.data.coust.ui_circ_patron_display_timeout_interval.sql	                        (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0076.data.coust.ui_circ_patron_display_timeout_interval.sql	2009-11-10 18:43:19 UTC (rev 14855)
@@ -0,0 +1,13 @@
+-- Correct the description of the org unit setting to match its use.
+
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0076'); -- senator
+
+DELETE FROM config.org_unit_setting_type WHERE name = 'ui.circ.patron_display_timeout_interval';
+
+INSERT INTO config.org_unit_setting_type
+    (name, label, description, datatype) VALUES
+    ('ui.general.idle_timeout', 'GUI: Idle timeout', 'If you want staff client windows to be minimized after a certain amount of system idle time, set this to the number of seconds of idle time that you want to allow before minimizing (requires staff client restart).', 'integer');
+
+COMMIT;

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame.xul	2009-11-10 16:59:11 UTC (rev 14854)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame.xul	2009-11-10 18:43:19 UTC (rev 14855)
@@ -35,16 +35,37 @@
 
     <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
     <!-- BEHAVIOR -->
-        <script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};</script>
-        <scripts id="openils_util_scripts"/>
+    <script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {}; var idleService = null; var idleObserver = null;</script>
+    <scripts id="openils_util_scripts"/>
 
     <script type="text/javascript" src="JSAN.js"/>
     <script type="text/javascript" src="constants.js"/>
     <script type="text/javascript" src="../OpenILS/util/fmall.js"/>
     <script type="text/javascript">
     <![CDATA[
+        function setup_idle_observer(delay) {
+            dump("will minimize after " + delay + " idle seconds\n");
+            idleService = Components.classes[
+                "@mozilla.org/widget/idleservice;1"
+            ].getService(Components.interfaces.nsIIdleService);
+            idleObserver = {
+                observe: function(subject, topic, data) {
+                    if (topic == "idle") {
+                        window.minimize();
+                        dump("minimizing window; subject: " + subject +
+                            ", topic: " + topic +
+                            ", data: " + data + "\n");
+                    }
+                }
+            };
+            idleService.addIdleObserver(idleObserver, delay); // seconds
+            // You could remove the IdleObserver with the following line...
+            // idleService.removeIdleObserver(idleObserver, delay);
+            // ... but why would we?
+        }
         function my_init() {
             try {
+
                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                 if (typeof JSAN == 'undefined') { throw(document.getElementById('offlineStrings').getString('common.jsan.missing')); }
                 JSAN.errorLevel = "die"; // none, warn, or die
@@ -69,6 +90,8 @@
 
                 document.title = g.window.appshell_name_increment() + ': ' + g.data.list.au[0].usrname() + '@' + g.data.ws_name + '.' + g.data.server_unadorned;
 
+                var delay = g.data.hash.aous["ui.general.idle_timeout"];
+                if (delay) setup_idle_observer(delay);
             } catch(E) {
                 var err_msg = document.getElementById("offlineStrings").getFormattedString("common.exception", ["menu_frame.xul", E]);
                 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }



More information about the open-ils-commits mailing list