From: Bill Erickson Date: Fri, 25 Jan 2013 20:50:48 +0000 (-0500) Subject: ACQ upload form persist scratch X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1042f454ea80b03166f01468460dc8e413133ae9;p=evergreen%2Fequinox.git ACQ upload form persist scratch Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/web/js/ui/default/acq/common/vlagent.js b/Open-ILS/web/js/ui/default/acq/common/vlagent.js index c92a135f2c..a4db898faf 100644 --- a/Open-ILS/web/js/ui/default/acq/common/vlagent.js +++ b/Open-ILS/web/js/ui/default/acq/common/vlagent.js @@ -1,5 +1,6 @@ dojo.require('openils.widget.AutoFieldWidget'); dojo.require('openils.PermaCrud'); +dojo.require('openils.XUL'); function VLAgent(args) { args = args || {}; @@ -21,14 +22,18 @@ function VLAgent(args) { {key : 'fall_through_merge_profile', cls : 'vmp'}, {key : 'existing_queue', cls : 'vbq'} ]; - + this.loaded = false; + var xulStorage = openils.XUL.localStorage(); + var storekey = 'eg.acq.'; this.init = function() { var self = this; dojo.forEach(this.widgets, function(widg) { + + var cval = xulStorage.getItem(storekey + widg.key); if (widg.cls) { // selectors new openils.widget.AutoFieldWidget({ @@ -38,14 +43,16 @@ function VLAgent(args) { parentNode : dojo.byId('acq_vl:' + widg.key), searchFilter : (widg.cls == 'vbq') ? {queue_type : 'acq'} : null, useWriteStore : (widg.cls == 'vbq') - }).build(function(dijit) { - widg.dijit = dijit; + }).build(function(dij) { + widg.dijit = dij; + if (cval) widg.dijit.attr('value', cval); self.attachOnChange(widg); }); } else { // bools widg.dijit = dijit.byId('acq_vl:' + widg.key); if (!widg.dijit) return; // some fields optional + if (cval) widg.dijit.attr('value', cval); self.attachOnChange(widg); } } @@ -134,8 +141,14 @@ function VLAgent(args) { var values = {}; dojo.forEach(this.widgets, function(widg) { - if (widg.dijit) + if (widg.dijit) { values[widg.key] = widg.dijit.attr('value'); + if (values[widg.key]) { + xulStorage.setItem(storekey + widg.key, values[widg.key]); + } else { + xulStorage.removeItem(storekey + widg.key); + } + } } ); return values;