[open-ils-commits] r7837 - in trunk/Open-ILS/xul/staff_client: chrome/content/util server/cat

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Sep 26 13:28:11 EDT 2007


Author: phasefx
Date: 2007-09-26 13:18:22 -0400 (Wed, 26 Sep 2007)
New Revision: 7837

Modified:
   trunk/Open-ILS/xul/staff_client/chrome/content/util/widgets.js
   trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.js
Log:
sticky prefs for stat cat library filter in item editor.. not finished, just commiting for convenience

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/widgets.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/widgets.js	2007-09-26 17:09:23 UTC (rev 7836)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/widgets.js	2007-09-26 17:18:22 UTC (rev 7837)
@@ -347,7 +347,9 @@
 					document.getElementById( element_id ).setAttribute(attribute, blob[ element_id ][ attribute ]);
 				}
 			}
+            return blob;
 		}
+        return {};
 	} catch(E) {
 		alert('Error loading preferences: ' + E);
 	}

Modified: trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.js	2007-09-26 17:09:23 UTC (rev 7836)
+++ trunk/Open-ILS/xul/staff_client/server/cat/copy_editor.js	2007-09-26 17:18:22 UTC (rev 7837)
@@ -966,6 +966,7 @@
     JSAN.use('util.widgets'); util.widgets.remove_children(x);
     for (var i = 0; i < sc_libs2.length; i++) {
         var menuitem = document.createElement('menuitem');
+        menuitem.setAttribute('id','filter_'+sc_libs2[i][1]);
         menuitem.setAttribute('type','checkbox');
         menuitem.setAttribute('checked','true');
         menuitem.setAttribute('label',sc_libs2[i][0]);
@@ -974,6 +975,17 @@
         x.appendChild(menuitem);
     }
 
+    JSAN.use('util.file'); 
+	var file = new util.file('copy_editor_prefs.'+g.data.server_unadorned);
+	g.copy_editor_prefs = util.widgets.load_attributes(file);
+    for (var i in g.copy_editor_prefs) {
+        if (i.match(/filter_/) && g.copy_editor_prefs[i].checked == '') {
+            try { 
+                g.toggle_stat_cat_display( document.getElementById(i) ); 
+            } catch(E) { alert(E); }
+        }
+    }
+
 	/******************************************************************************************************/
 	/* Prepare the panes */
 
@@ -1197,6 +1209,14 @@
             nl[n].setAttribute('hidden','true');
         }
     }
+    g.copy_editor_prefs[ el.getAttribute('id') ] = { 'checked' : visible };
+	JSAN.use('util.widgets'); JSAN.use('util.file'); var file = new util.file('copy_editor_prefs.'+g.data.server_unadorned);
+    var what_to_save = {};
+    for (var i in g.copy_editor_prefs) {
+        what_to_save[i] = [];
+        for (var j in g.copy_editor_prefs[i]) what_to_save[i].push(j);
+    }
+	util.widgets.save_attributes(file, what_to_save );
 }
 
 /******************************************************************************************************/



More information about the open-ils-commits mailing list