[open-ils-commits] r7680 - in trunk/Open-ILS/xul/staff_client: chrome/content/main server/main server/patron

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Aug 15 14:08:23 EDT 2007


Author: phasefx
Date: 2007-08-15 14:04:27 -0400 (Wed, 15 Aug 2007)
New Revision: 7680

Modified:
   trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
   trunk/Open-ILS/xul/staff_client/server/main/gen_offline_widgets.xul
   trunk/Open-ILS/xul/staff_client/server/patron/barcode_entry.xul
Log:
UI for user-org-opt-in feature

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2007-08-15 17:47:04 UTC (rev 7679)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2007-08-15 18:04:27 UTC (rev 7680)
@@ -173,6 +173,9 @@
 	'MERGE_RECORDS' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.records.merge' },
 	'PATRON_BARCODE_EXISTS' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.barcode.exists' },
 	'RECALCULATE_STANDING_PENALTIES' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.penalties.update' },
+    'USER_ORG_UNIT_OPT_IN_FEATURE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.org_unit_opt_in.enabled' },
+    'USER_ORG_UNIT_OPT_IN_CHECK' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.org_unit_opt_in.check' },
+    'USER_ORG_UNIT_OPT_IN_CREATE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.org_unit_opt_in.create' },
 }
 
 const urls = {

Modified: trunk/Open-ILS/xul/staff_client/server/main/gen_offline_widgets.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/main/gen_offline_widgets.xul	2007-08-15 17:47:04 UTC (rev 7679)
+++ trunk/Open-ILS/xul/staff_client/server/main/gen_offline_widgets.xul	2007-08-15 18:04:27 UTC (rev 7680)
@@ -19,7 +19,7 @@
 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
 
 <window id="gen_offline_menus_win" 
-	onload="try { gen_offline_menus_init(); } catch(E) { alert(E); }"
+	onload="try { my_init(); } catch(E) { alert(E); }"
 	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
 
@@ -34,10 +34,9 @@
 	<script>
 	<![CDATA[
 
-		function gen_offline_menus_init() {
+        function my_init() {
+            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 
-			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-
 			if (typeof JSAN == 'undefined') {
 				throw(
 					"The JSAN library object is missing."
@@ -51,6 +50,18 @@
 			JSAN.use('util.error'); g.error = new util.error();
 			JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
 			JSAN.use('util.network'); g.network = new util.network();
+
+            gen_offline_menus_init();
+
+            var r = g.network.simple_request('USER_ORG_UNIT_OPT_IN_FEATURE',[]);
+            g.data.user_org_unit_opt_in_enabled = (r == "1" || r == 1);
+            g.data.stash('user_org_unit_opt_in_enabled');
+        }
+
+		function gen_offline_menus_init() {
+
+			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+
 			JSAN.use('util.functional');
 
 			save_object('offline_ou_list', build_ou_list());

Modified: trunk/Open-ILS/xul/staff_client/server/patron/barcode_entry.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/barcode_entry.xul	2007-08-15 17:47:04 UTC (rev 7679)
+++ trunk/Open-ILS/xul/staff_client/server/patron/barcode_entry.xul	2007-08-15 18:04:27 UTC (rev 7680)
@@ -39,6 +39,8 @@
 				JSAN.use('util.error'); g.error = new util.error();
 				g.error.sdump('D_TRACE','my_init() for patron/barcode_entry.xul');
 
+                JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
+
 				var tb = document.getElementById('barcode_tb');
 				tb.addEventListener(
 					'keypress',
@@ -102,9 +104,38 @@
 							return;
 						}
 
-						sound.good();
-
-						spawn(barcode);
+                        if (g.data.user_org_unit_opt_in_enabled) {
+                            var r = net.simple_request('USER_ORG_UNIT_OPT_IN_CHECK',[ ses(), robj ]);
+                            if (typeof r.ilsevent != 'undefined') {
+                                throw(r);
+                            } else {
+    
+                                if (r == 0) {
+                                
+                                    JSAN.use('patron.util');
+                                    var parts = patron.util.retrieve_name_via_id( ses(), robj );
+    
+                                    if (0 != g.error.yns_alert(
+                                        'Does patron ' + parts[0] + ', ' + parts[1] + (parts[2] ? ' ' + parts[2] : '') + ' from ' + g.data.hash.aou[ parts[3] ].shortname() + ' consent to having their personal information shared with your library?',
+                                        'Patron/Library Opt-In Confirmation',
+                                        'Accept', 'Deny', null, 'Check here to confirm this message'
+                                        )
+                                    ) {
+                                        tb.select(); tb.focus();
+                                        return;
+                                    } else {
+                                        var c = net.simple_request('USER_ORG_UNIT_OPT_IN_CREATE',[ ses(), robj ]);
+                                        if (typeof c.ilsevent != 'undefined') throw(r);
+                                    }
+                                }
+    
+    						    sound.good();
+    						    spawn(barcode);
+                            }
+                        } else {
+						    sound.good();
+						    spawn(barcode);
+                        }
 					}
 				);
 			} catch(E) {



More information about the open-ils-commits mailing list