[open-ils-commits] [GIT] Evergreen ILS branch master updated. 06ca57f3c603eedd8af38e3acf31791c64faa56b

Evergreen Git git at git.evergreen-ils.org
Mon Mar 2 21:30:25 EST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  06ca57f3c603eedd8af38e3acf31791c64faa56b (commit)
       via  05fd625e59b8b63b99c8890083b3949aedf2786c (commit)
       via  39fb2073effed0d5cabad6a0a2b562a3a0fcee40 (commit)
      from  d364097cf97040cc6b15bf52b6e2ca51891faa93 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 06ca57f3c603eedd8af38e3acf31791c64faa56b
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Thu Nov 13 09:42:45 2014 -0800

    LP#1287370: minor textual cleanup
    
    - remove trailing spaces
    - remove debug logging
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>
    Signed-off-by: Erica Rohlfs <erohlfs at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
index 873bb24..8936338 100644
--- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
+++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
@@ -40,7 +40,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
             suppressLinkedFields : null, // list of fields whose linked display data should not be fetched from the server
             urlNavigation : false,
 
-            // When using urlNavigation, this is a stash where the 
+            // When using urlNavigation, this is a stash where the
             // caller can place arbitrary data to be passed around
             // between pages.
             urlUserData : {},
@@ -66,7 +66,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                 this.overrideEditWidgets = {};
                 this.overrideEditWidgetClass = {};
                 this.overrideWidgetArgs = {};
-                this.extractUrlOps(); 
+                this.extractUrlOps();
 
 		this.nls = dojo.i18n.getLocalization('openils.widget', 'AutoFieldWidget');
 
@@ -101,7 +101,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                             self.cachedQueryOpts.offset = self.displayOffset += self.displayLimit;
                             if (self.urlNavigation) {
                                 self.applyAndExecuteUrlOps(
-                                    self.cachedQueryOpts.offset, 
+                                    self.cachedQueryOpts.offset,
                                     self.cachedQuerySearch
                                 );
                             } else {
@@ -128,7 +128,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                                             {fmClass:self.fmClass, suppressFilterFields:self.suppressFilterFields})
 
                                         self.filterDialog.onApply = function(filter) {
-                                            if (self.urlNavigation) { 
+                                            if (self.urlNavigation) {
                                                 self.applyAndExecuteUrlOps(0, filter);
 
                                             } else {
@@ -644,7 +644,6 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                         this.urlOpsApplied = true;
                         // on the first page load, apply the ops from the URL
                         if (this.urlOps) {
-                            console.log('applying url ops: ' + js2JSON(this.urlOps));
                             opts.offset = self.displayOffset = this.urlOps.offset;
                             search = dojo.mixin(search || {}, this.urlOps.filter);
                         }
diff --git a/Open-ILS/web/js/ui/default/acq/financial/list_funds.js b/Open-ILS/web/js/ui/default/acq/financial/list_funds.js
index fb1f246..69ec8b4 100644
--- a/Open-ILS/web/js/ui/default/acq/financial/list_funds.js
+++ b/Open-ILS/web/js/ui/default/acq/financial/list_funds.js
@@ -95,7 +95,7 @@ function initPage() {
             adminPermOrgs = list;
             loadFundGrid(
                 lfGrid.urlUserData.year
-                    || new openils.CGI().param('year') 
+                    || new openils.CGI().param('year')
                     || new Date().getFullYear().toString());
         },
         true, true

commit 05fd625e59b8b63b99c8890083b3949aedf2786c
Author: Bill Erickson <berick at esilibrary.com>
Date:   Tue Aug 12 12:03:05 2014 -0400

    LP#1287370: apply filter/offset persistence to the fund search page
    
    This patch completes the AutoGrid work and applies the
    filter & offset persistence to the fund search page.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>
    Signed-off-by: Erica Rohlfs <erohlfs at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/src/templates/acq/fund/list.tt2 b/Open-ILS/src/templates/acq/fund/list.tt2
index ab6de7b..17e6ee3 100644
--- a/Open-ILS/src/templates/acq/fund/list.tt2
+++ b/Open-ILS/src/templates/acq/fund/list.tt2
@@ -163,6 +163,7 @@
             fmClass='acqf'
             showLoadFilter='true'
             showPaginator='true'
+            urlNavigation='true'
             editOnEnter='true'>
         <thead>
             <tr>
diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
index 8dac610..873bb24 100644
--- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
+++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
@@ -38,7 +38,12 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
             showLoadFilter : true,
             onItemReceived : null,
             suppressLinkedFields : null, // list of fields whose linked display data should not be fetched from the server
-            urlBasedFilterPaging : false,
+            urlNavigation : false,
+
+            // When using urlNavigation, this is a stash where the 
+            // caller can place arbitrary data to be passed around
+            // between pages.
+            urlUserData : {},
 
             /* by default, don't show auto-generated (sequence) fields */
             showSequenceFields : false, 
@@ -61,6 +66,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                 this.overrideEditWidgets = {};
                 this.overrideEditWidgetClass = {};
                 this.overrideWidgetArgs = {};
+                this.extractUrlOps(); 
 
 		this.nls = dojo.i18n.getLocalization('openils.widget', 'AutoFieldWidget');
 
@@ -86,14 +92,21 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                         }
                     });
 
-                    // TODO: support self.urlBasedFilterPaging
+                    // TODO: support self.urlNavigation
                     var forw = dojo.create('a', {
                         innerHTML : self.nls.NEXT,
                         style : 'padding-right:6px;',
                         href : 'javascript:void(0);', 
                         onclick : function() { 
                             self.cachedQueryOpts.offset = self.displayOffset += self.displayLimit;
-                            self.refresh();
+                            if (self.urlNavigation) {
+                                self.applyAndExecuteUrlOps(
+                                    self.cachedQueryOpts.offset, 
+                                    self.cachedQuerySearch
+                                );
+                            } else {
+                                self.refresh();
+                            }
                         }
                     });
 
@@ -115,8 +128,8 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                                             {fmClass:self.fmClass, suppressFilterFields:self.suppressFilterFields})
 
                                         self.filterDialog.onApply = function(filter) {
-                                            if (self.urlBasedFilterPaging) { // TODO: grid config
-                                                self.applyFilterByPage(0, filter);
+                                            if (self.urlNavigation) { 
+                                                self.applyAndExecuteUrlOps(0, filter);
 
                                             } else {
                                                 self.cachedQuerySearch = filter;
@@ -147,10 +160,12 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                 }
             },
 
-            applyFilterByPage : function(offset, filter) {
+            // set URL options then jump to the new URL
+            applyAndExecuteUrlOps : function(offset, filter) {
                 var ops = {
                     filter : filter, // TODO: load from query cache on offset-only change
-                    offset : offset || 0
+                    offset : offset || 0,
+                    userData : this.urlUserData
                 }
 
                 var encoded = dojox.encoding.base64.encode(
@@ -164,19 +179,19 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                 location.href = cgi.url();
             },
 
-            extractFilterByPage : function() {
-                // these should only be extracted once per page
-                if (this.urlFiltersExtracted) return;
-                this.urlFiltersExtracted = true;
-
+            // extract options encoded in the URL
+            extractUrlOps : function() {
                 var ops = new openils.CGI().param('djgridops');
                 if (!ops) return;
 
-                return JSON2js(
+                ops = JSON2js(
                     dojox.encoding.base64.decode(ops)
                     .map(function(b) {return String.fromCharCode(b)})
                     .join("")
                 );
+
+                this.urlOps = ops;
+                this.urlUserData = ops.userData;
             },
 
             hideLoadProgressIndicator : function() {
@@ -624,16 +639,26 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                 if (!filter_triggered || !this.preFilterSearch)
                     this.preFilterSearch = dojo.clone( this.cachedQuerySearch );
 
-                var url_ops = this.extractFilterByPage();
-                if (url_ops) {
-                    opts.offset = url_ops.offset;
-                    search = dojo.mixin(search || {}, url_ops.filter);
+                if (this.urlNavigation) {
+                    if (!this.urlOpsApplied) {
+                        this.urlOpsApplied = true;
+                        // on the first page load, apply the ops from the URL
+                        if (this.urlOps) {
+                            console.log('applying url ops: ' + js2JSON(this.urlOps));
+                            opts.offset = self.displayOffset = this.urlOps.offset;
+                            search = dojo.mixin(search || {}, this.urlOps.filter);
+                        }
+                    } else {
+                        // subsequent calls to loadAll() suggest changing
+                        // filters / paging / etc, propagate new values
+                        // to the new URL
+                        return this.applyAndExecuteUrlOps(
+                            this.displayOffset,
+                            this.cachedQuerySearch
+                        );
+                    }
                 }
 
-                // TODO: remove these debug lines
-                console.log('search = ' + js2JSON(search));
-                console.log('opts = ' + js2JSON(opts));
-
                 if(search)
                     new openils.PermaCrud().search(this.fmClass, search, opts);
                 else
diff --git a/Open-ILS/web/js/ui/default/acq/financial/list_funds.js b/Open-ILS/web/js/ui/default/acq/financial/list_funds.js
index 915f781..fb1f246 100644
--- a/Open-ILS/web/js/ui/default/acq/financial/list_funds.js
+++ b/Open-ILS/web/js/ui/default/acq/financial/list_funds.js
@@ -41,6 +41,10 @@ var cachedFunds = [];
 function initPage() {
     contextOrg = xulStorage.getItem(storekey) || openils.User.user.ws_ou();
 
+    // Propagate the context org from the URL data into our org selector.
+    if (lfGrid.urlUserData && lfGrid.urlUserData.contextOrg)
+        contextOrg = lfGrid.urlUserData.contextOrg;
+
     /* Reveal controls for rollover without money if org units say ok.
      * Actual ability to do the operation is controlled in the database, of
      * course. */
@@ -64,6 +68,9 @@ function initPage() {
                 dojo.byId('oils-acq-rollover-ctxt-org').innerHTML = 
                     fieldmapper.aou.findOrgUnit(contextOrg).shortname();
                 rolloverMode = false;
+                // tell the grid to pass the context org info along
+                // with the encoded URL data so we can re-propagate
+                lfGrid.displayOffset = 0; // new org means a new search
                 gridDataLoader();
             }
         );
@@ -87,7 +94,8 @@ function initPage() {
         function(list) {
             adminPermOrgs = list;
             loadFundGrid(
-                new openils.CGI().param('year') 
+                lfGrid.urlUserData.year
+                    || new openils.CGI().param('year') 
                     || new Date().getFullYear().toString());
         },
         true, true
@@ -133,6 +141,9 @@ function loadFundGrid(year) {
         });
     }
 
+    lfGrid.urlUserData.year = year;
+    lfGrid.urlUserData.contextOrg = contextOrg;
+
     lfGrid.loadAll(
         {   
             flesh : 1,  
@@ -162,13 +173,18 @@ function loadYearSelector() {
                 fundFilterYearSelect.store = new dojo.data.ItemFileWriteStore({data:yearStore});
 
                 // default to this year
-                fundFilterYearSelect.setValue(new Date().getFullYear().toString());
+                fundFilterYearSelect.setValue(
+                    // propagate year from URL if available
+                    lfGrid.urlUserData.year ||
+                        new Date().getFullYear().toString()
+                );
 
                 dojo.connect(
                     fundFilterYearSelect, 
                     'onChange', 
                     function() { 
                         rolloverMode = false;
+                        lfGrid.displayOffset = 0;
                         gridDataLoader();
                     }
                 );

commit 39fb2073effed0d5cabad6a0a2b562a3a0fcee40
Author: Bill Erickson <berick at esilibrary.com>
Date:   Mon Aug 11 16:45:21 2014 -0400

    LP#1287370: allow AutoGrid to persist filter state and page offset
    
    By turning on a new AutoGrid option called urlNavigation,
    the current filter and offset is stored in a URL parameter
    called djgridops. This permits using the back button
    to return to an AutoGrid page at the place in the search
    results where the user left it.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>
    Signed-off-by: Erica Rohlfs <erohlfs at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Ben Shum <bshum at biblio.org>

diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
index 9114aa2..8dac610 100644
--- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
+++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
@@ -1,6 +1,7 @@
 if(!dojo._hasResource['openils.widget.AutoGrid']) {
     dojo.provide('openils.widget.AutoGrid');
     dojo.require('dojox.grid.DataGrid');
+    dojo.require("dojox.encoding.base64");
     dojo.require('dijit.layout.ContentPane');
     dojo.require('openils.widget.AutoWidget');
     dojo.require('openils.widget.AutoFieldWidget');
@@ -9,6 +10,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
     dojo.require('openils.widget.GridColumnPicker');
     dojo.require('openils.widget._GridHelperColumns');
     dojo.require('openils.Util');
+    dojo.require('openils.CGI');
     dojo.requireLocalization('openils.widget', 'AutoFieldWidget');
 
     dojo.declare(
@@ -36,6 +38,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
             showLoadFilter : true,
             onItemReceived : null,
             suppressLinkedFields : null, // list of fields whose linked display data should not be fetched from the server
+            urlBasedFilterPaging : false,
 
             /* by default, don't show auto-generated (sequence) fields */
             showSequenceFields : false, 
@@ -83,6 +86,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                         }
                     });
 
+                    // TODO: support self.urlBasedFilterPaging
                     var forw = dojo.create('a', {
                         innerHTML : self.nls.NEXT,
                         style : 'padding-right:6px;',
@@ -111,13 +115,18 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                                             {fmClass:self.fmClass, suppressFilterFields:self.suppressFilterFields})
 
                                         self.filterDialog.onApply = function(filter) {
-                                            self.cachedQuerySearch = filter;
-                                            self.resetStore();
-                                            self.loadAll(
-                                                dojo.mixin( { offset : 0 }, self.cachedQueryOpts ),
-                                                self.cachedQuerySearch,
-                                                true
-                                            );
+                                            if (self.urlBasedFilterPaging) { // TODO: grid config
+                                                self.applyFilterByPage(0, filter);
+
+                                            } else {
+                                                self.cachedQuerySearch = filter;
+                                                self.resetStore();
+                                                self.loadAll(
+                                                    dojo.mixin( { offset : 0 }, self.cachedQueryOpts ),
+                                                    self.cachedQuerySearch,
+                                                    true
+                                                );
+                                            }
                                         };
 
                                         self.filterDialog.startup();
@@ -138,6 +147,38 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                 }
             },
 
+            applyFilterByPage : function(offset, filter) {
+                var ops = {
+                    filter : filter, // TODO: load from query cache on offset-only change
+                    offset : offset || 0
+                }
+
+                var encoded = dojox.encoding.base64.encode(
+                    js2JSON(ops)
+                    .split("")
+                    .map(function(c) { return c.charCodeAt(0); })
+                );
+
+                var cgi = new openils.CGI();
+                cgi.param('djgridops', encoded);
+                location.href = cgi.url();
+            },
+
+            extractFilterByPage : function() {
+                // these should only be extracted once per page
+                if (this.urlFiltersExtracted) return;
+                this.urlFiltersExtracted = true;
+
+                var ops = new openils.CGI().param('djgridops');
+                if (!ops) return;
+
+                return JSON2js(
+                    dojox.encoding.base64.decode(ops)
+                    .map(function(b) {return String.fromCharCode(b)})
+                    .join("")
+                );
+            },
+
             hideLoadProgressIndicator : function() {
                 dojo.style(this.loadProgressIndicator, 'visibility', 'hidden');
             },
@@ -583,6 +624,16 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) {
                 if (!filter_triggered || !this.preFilterSearch)
                     this.preFilterSearch = dojo.clone( this.cachedQuerySearch );
 
+                var url_ops = this.extractFilterByPage();
+                if (url_ops) {
+                    opts.offset = url_ops.offset;
+                    search = dojo.mixin(search || {}, url_ops.filter);
+                }
+
+                // TODO: remove these debug lines
+                console.log('search = ' + js2JSON(search));
+                console.log('opts = ' + js2JSON(opts));
+
                 if(search)
                     new openils.PermaCrud().search(this.fmClass, search, opts);
                 else

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/templates/acq/fund/list.tt2           |    1 +
 Open-ILS/web/js/dojo/openils/widget/AutoGrid.js    |   91 ++++++++++++++++++--
 .../web/js/ui/default/acq/financial/list_funds.js  |   20 ++++-
 3 files changed, 102 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list