LP#1378169: make context OU selector on funds page sticky
authorGalen Charlton <gmc@esilibrary.com>
Tue, 7 Oct 2014 03:56:13 +0000 (20:56 -0700)
committerMike Rylander <mrylander@gmail.com>
Thu, 19 Feb 2015 22:27:49 +0000 (17:27 -0500)
This patch uses local storage to persist the selected value of the
context OU selector on the funds page.  This is meant to ease
workflows where an acquisitions administrator needs to frequently
transfer money between funds that are attached to children of
a system-level OU.  Specifically, rather than defaulting to
the user's workstation OU, the selector will default to the
OU selected the last time the funds page was opened.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/web/js/ui/default/acq/financial/list_funds.js

index 09a47d5..915f781 100644 (file)
@@ -19,6 +19,10 @@ dojo.require('fieldmapper.OrgUtils');
 dojo.requireLocalization('openils.acq', 'acq');
 var localeStrings = dojo.i18n.getLocalization('openils.acq', 'acq');
 
+dojo.require('openils.XUL');
+var xulStorage = openils.XUL.localStorage();
+var storekey = 'eg.acq.fund.list.context_ou_selector';
+
 var contextOrg;
 var rolloverResponses;
 var rolloverMode = false;
@@ -35,7 +39,7 @@ var adminPermOrgs = [];
 var cachedFunds = [];
 
 function initPage() {
-    contextOrg = openils.User.user.ws_ou();
+    contextOrg = xulStorage.getItem(storekey) || openils.User.user.ws_ou();
 
     /* Reveal controls for rollover without money if org units say ok.
      * Actual ability to do the operation is controlled in the database, of
@@ -56,6 +60,7 @@ function initPage() {
         dojo.connect(contextOrgSelector, 'onChange',
             function() {
                 contextOrg = this.attr('value');
+                xulStorage.setItem(storekey, contextOrg);
                 dojo.byId('oils-acq-rollover-ctxt-org').innerHTML = 
                     fieldmapper.aou.findOrgUnit(contextOrg).shortname();
                 rolloverMode = false;