From 23d08d9571ff0c422d98bf4db902dfc1d13285b1 Mon Sep 17 00:00:00 2001
From: phasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Thu, 15 Apr 2010 16:02:48 +0000
Subject: [PATCH] toward making fancy prompt dimensions sticky, just need to
 give the oils_persist mechanism support for resize events

git-svn-id: svn://svn.open-ils.org/ILS/trunk@16242 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 .../xul/staff_client/chrome/content/OpenILS/global_util.js   | 12 +++++++++---
 .../xul/staff_client/chrome/content/util/fancy_prompt.xul    |  5 +++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js
index e4b1b85ffc..ec9bdfa31d 100644
--- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js
+++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js
@@ -66,8 +66,14 @@
         }
     }
 
-    function persist_helper() {
+    function persist_helper(base_key_suffix) {
         try {
+            if (base_key_suffix) {
+                base_key_suffix = base_key_suffix.replace(/[^A-Za-z]/g,'_') + '_';
+            } else {
+                base_key_suffix = '';
+            }
+
             function gen_event_handler(etype,node) {
                 return function(ev) {
                     try {
@@ -90,7 +96,7 @@
                             target = ev.target;
                         }
                         var filename = location.pathname.split('/')[ location.pathname.split('/').length - 1 ];
-                        var base_key = 'oils_persist_' + String(location.hostname + '_' + filename + '_' + target.getAttribute('id')).replace('/','_','g') + '_';
+                        var base_key = 'oils_persist_' + String(location.hostname + '_' + filename + '_' + target.getAttribute('id')).replace('/','_','g') + '_' + base_key_suffix;
                         var attribute_list = target.getAttribute('oils_persist').split(' ');
                         dump('on_oils_persist: <<< ' + target.nodeName + '.id = ' + target.id + '\t' + bk + '\n');
                         for (var j = 0; j < attribute_list.length; j++) {
@@ -126,7 +132,7 @@
             var nodes = document.getElementsByAttribute('oils_persist','*');
             for (var i = 0; i < nodes.length; i++) {
                 var filename = location.pathname.split('/')[ location.pathname.split('/').length - 1 ];
-                var base_key = 'oils_persist_' + String(location.hostname + '_' + filename + '_' + nodes[i].getAttribute('id')).replace('/','_','g') + '_';
+                var base_key = 'oils_persist_' + String(location.hostname + '_' + filename + '_' + nodes[i].getAttribute('id')).replace('/','_','g') + '_' + base_key_suffix;
                 var attribute_list = nodes[i].getAttribute('oils_persist').split(' ');
                 dump('persist_helper: >>> ' + nodes[i].nodeName + '.id = ' + nodes[i].id + '\t' + base_key + '\n');
                 for (var j = 0; j < attribute_list.length; j++) {
diff --git a/Open-ILS/xul/staff_client/chrome/content/util/fancy_prompt.xul b/Open-ILS/xul/staff_client/chrome/content/util/fancy_prompt.xul
index 8d32d89faa..5a7aeea396 100644
--- a/Open-ILS/xul/staff_client/chrome/content/util/fancy_prompt.xul
+++ b/Open-ILS/xul/staff_client/chrome/content/util/fancy_prompt.xul
@@ -19,7 +19,8 @@
 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
 
 <window id="fancy_prompt_win" 
-    onload="try { my_init(); font_helper(); } catch(E) { alert(E); }"
+    onload="try { my_init(); font_helper(); persist_helper( xul_param('title',{'modal_xulG':true}) ); } catch(E) { alert(E); }"
+    oils_persist="width height"
     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
     <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
@@ -38,7 +39,7 @@
         function my_init() {
             try {
                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-                        if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
+                if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
                 JSAN.errorLevel = "die"; // none, warn, or die
                 JSAN.addRepository('/xul/server/');
                 JSAN.use('util.error'); g.error = new util.error();
-- 
2.11.0