[open-ils-commits] r13835 - in branches/rel_1_6/Open-ILS/web: js/dojo/openils js/dojo/openils/widget js/ui/default/acq/picklist templates/default/conify/global/acq (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Aug 13 17:11:59 EDT 2009


Author: erickson
Date: 2009-08-13 17:11:53 -0400 (Thu, 13 Aug 2009)
New Revision: 13835

Modified:
   branches/rel_1_6/Open-ILS/web/js/dojo/openils/PermaCrud.js
   branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
   branches/rel_1_6/Open-ILS/web/js/ui/default/acq/picklist/view_list.js
   branches/rel_1_6/Open-ILS/web/templates/default/conify/global/acq/provider.tt2
Log:
backporting 13830:13834.  initial pagination support.  when enabled, back/prev links appear in a small nav pane just above the grid, added support for limit/offset to pcrud search and retrieveall calls, turn on pagination in the provider list page, fixed some bugs in creating new picklists by name

Modified: branches/rel_1_6/Open-ILS/web/js/dojo/openils/PermaCrud.js
===================================================================
--- branches/rel_1_6/Open-ILS/web/js/dojo/openils/PermaCrud.js	2009-08-13 21:09:25 UTC (rev 13834)
+++ branches/rel_1_6/Open-ILS/web/js/dojo/openils/PermaCrud.js	2009-08-13 21:11:53 UTC (rev 13835)
@@ -109,6 +109,8 @@
             var order_by = {};
             if (opts.order_by) order_by.order_by = opts.order_by;
             if (opts.select) order_by.select = opts.select;
+            if (opts.limit) order_by.limit = opts.limit;
+            if (opts.offset) order_by.offset = opts.offset;
             
             var method = 'open-ils.pcrud.search.' + fm_class;
             if(!opts.streaming) method += '.atomic';
@@ -153,6 +155,8 @@
             var order_by = {};
             if (opts.order_by) order_by.order_by = opts.order_by;
             if (opts.select) order_by.select = opts.select;
+            if (opts.limit) order_by.limit = opts.limit;
+            if (opts.offset) order_by.offset = opts.offset;
 
             var method = 'open-ils.pcrud.search.' + fm_class;
             if(!opts.streaming) method += '.atomic';

Modified: branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js
===================================================================
--- branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js	2009-08-13 21:09:25 UTC (rev 13834)
+++ branches/rel_1_6/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js	2009-08-13 21:11:53 UTC (rev 13835)
@@ -1,6 +1,7 @@
 if(!dojo._hasResource['openils.widget.AutoGrid']) {
     dojo.provide('openils.widget.AutoGrid');
     dojo.require('dojox.grid.DataGrid');
+    dojo.require('dijit.layout.ContentPane');
     dojo.require('openils.widget.AutoWidget');
     dojo.require('openils.widget.AutoFieldWidget');
     dojo.require('openils.widget.EditPane');
@@ -22,6 +23,9 @@
             selectorWidth : '1.5',
             showColumnPicker : false,
             columnPickerPrefix : null,
+            displayLimit : 15,
+            displayOffset : 0,
+            showPaginator : false,
 
             /* by default, don't show auto-generated (sequence) fields */
             showSequenceFields : false, 
@@ -65,6 +69,43 @@
                         }
                     );
                 }
+
+                if(this.showPaginator) {
+                    var self = this;
+                    this.paginator = new dijit.layout.ContentPane();
+
+
+                    var back = dojo.create('a', {
+                        innerHTML : 'Back', 
+                        style : 'padding-right:6px;',
+                        href : 'javascript:void(0);', 
+                        onclick : function() { 
+                            self.resetStore();
+                            self.cachedQueryOpts.offset = self.displayOffset -= self.displayLimit;
+                            self.loadAll(self.cachedQueryOpts, self.cachedQuerySearch);
+                        }
+                    });
+
+                    var forw = dojo.create('a', {
+                        innerHTML : 'Next', 
+                        style : 'padding-right:6px;',
+                        href : 'javascript:void(0);', 
+                        onclick : function() { 
+                            self.resetStore();
+                            self.cachedQueryOpts.offset = self.displayOffset += self.displayLimit;
+                            self.loadAll(self.cachedQueryOpts, self.cachedQuerySearch);
+                        }
+                    });
+
+                    dojo.place(this.paginator.domNode, this.domNode, 'before');
+                    dojo.place(back, this.paginator.domNode);
+                    dojo.place(forw, this.paginator.domNode);
+                    this.loadProgressIndicator = dojo.create('img', {
+                        src:'/opac/images/progressbar_green.gif',
+                        style:'height:16px;width:16px;'
+                    });
+                    dojo.place(this.loadProgressIndicator, this.paginator.domNode);
+                }
             },
 
             /* Don't allow sorting on the selector column */
@@ -439,16 +480,28 @@
 
             loadAll : function(opts, search) {
                 dojo.require('openils.PermaCrud');
-                if(!opts) opts = {};
+                if(this.loadProgressIndicator)
+                    dojo.style(this.loadProgressIndicator, 'visibility', 'visible');
                 var self = this;
+                opts = dojo.mixin(
+                    {limit : this.displayLimit, offset : this.displayOffset}, 
+                    opts || {}
+                );
                 opts = dojo.mixin(opts, {
                     async : true,
                     streaming : true,
                     onresponse : function(r) {
                         var item = openils.Util.readResponse(r);
                         self.store.newItem(item.toStoreItem());
+                    },
+                    oncomplete : function() {
+                        if(self.loadProgressIndicator) 
+                            dojo.style(self.loadProgressIndicator, 'visibility', 'hidden');
                     }
                 });
+
+                this.cachedQuerySearch = search;
+                this.cachedQueryOpts = opts;
                 if(search)
                     new openils.PermaCrud().search(this.fmClass, search, opts);
                 else

Modified: branches/rel_1_6/Open-ILS/web/js/ui/default/acq/picklist/view_list.js
===================================================================
--- branches/rel_1_6/Open-ILS/web/js/ui/default/acq/picklist/view_list.js	2009-08-13 21:09:25 UTC (rev 13834)
+++ branches/rel_1_6/Open-ILS/web/js/ui/default/acq/picklist/view_list.js	2009-08-13 21:11:53 UTC (rev 13835)
@@ -53,11 +53,13 @@
                 ['open-ils.acq', 'open-ils.acq.picklist.retrieve'],
                 {   async: true,
                     params: [openils.User.authtoken, plId,
-                        {flesh_lineitem_count:1, flesh_username:1}],
+                        {flesh_lineitem_count:1, flesh_owner:1}],
 
                     oncomplete: function(r) {
-                        if(pl = openils.Util.readResponse(r)) 
+                        if(pl = openils.Util.readResponse(r)) {
+                           plCache[pl.id()] = pl;
                            plListGrid.store.newItem(acqpl.toStoreData([pl]).items[0]);
+                        }
                     }
                 }
             );

Modified: branches/rel_1_6/Open-ILS/web/templates/default/conify/global/acq/provider.tt2
===================================================================
--- branches/rel_1_6/Open-ILS/web/templates/default/conify/global/acq/provider.tt2	2009-08-13 21:09:25 UTC (rev 13834)
+++ branches/rel_1_6/Open-ILS/web/templates/default/conify/global/acq/provider.tt2	2009-08-13 21:11:53 UTC (rev 13835)
@@ -78,6 +78,7 @@
                 defaultCellWidth='"auto"'
                 autoHeight='true'
                 fmClass='acqpro'
+                showPaginator='true'
                 editOnEnter='true'>
             <thead>
                 <tr><th field='name' get='getProviderName' formatter='formatName'/></tr>



More information about the open-ils-commits mailing list