Essentials for URL selecting interface
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 29 Aug 2012 22:53:23 +0000 (18:53 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 21 Sep 2012 15:06:59 +0000 (11:06 -0400)
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/templates/url_verify/select_urls.tt2
Open-ILS/web/js/dojo/openils/widget/FlattenerGrid.js

index a834391..9359226 100644 (file)
@@ -9462,7 +9462,7 @@ SELECT  usr,
 
         <links>
             <link field="redirect_from" reltype="has_a" key="id" map="" class="uvu"/>
-            <link field="item" reltype="has_a" key="id" map="" class="cbrebi"/>
+            <link field="item" reltype="has_a" key="id" map="" class="uvsbrem" /><!-- surprise! -->
             <link field="url_selector" reltype="has_a" key="id" map="" class="uvus"/>
         </links>
 
index 8d1bd94..ccc9ae0 100644 (file)
@@ -3,13 +3,32 @@
 <script type="text/javascript">
     dojo.require("dijit.form.Button");
     dojo.require("openils.widget.FlattenerGrid");
+    dojo.require("openils.Util");
+    dojo.require("openils.CGI");
+
+    /* XXX TODO move everything except the require's above and the addOnLoad
+       below into a dojo module */
+    var initial_query = {};
+
+    openils.Util.addOnLoad(
+        function() {
+            var cgi = new openils.CGI();
+
+            initial_query.session_id = cgi.param("session_id");
+
+            grid.refresh();
+            // XXX Instead of grid.refresh(), once filter stuff is done:
+            //  grid.fetchLock = false;
+            //  grid.filterUi.doApply();
+        }
+    );
 </script>
 <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
     <div dojoType="dijit.layout.ContentPane"
          layoutAlign="top" class="oils-header-panel">
         <div>[% ctx.page_title %]</div>
         <div>
-            <!-- XXX any buttons needed go here -->
+            <span id="select-all-indicator"></span>
         </div>
     </div>
     <!-- <div class="oils-acq-basic-roomy">
         columnPersistKey='"url_verify.select_url"'
         autoHeight="10"
         editOnEnter="false"
+        autoFieldFields="null"
         autoCoreFields="true"
-        autoFieldFields="[]"
+        autoCoreFieldsUnsorted="true"
+        fetchLock="true"
+        mapExtras="{session_id: {path: 'item.session.id', filter: true}}"
         showLoadFilter="true"
-        fmClass="'uvsbrem'" >
+        query="initial_query"
+        fmClass="'uvu'">
         <thead>
             <tr>
+                <th field="title" fpath="item.target_biblio_record_entry.simple_record.title"></th>
+                <th field="author" fpath="item.target_biblio_record_entry.simple_record.author"></th>
+                <th field="isbn" fpath="item.target_biblio_record_entry.simple_record.isbn" _visible="false"></th>
+                <th field="issn" fpath="item.target_biblio_record_entry.simple_record.issn" _visible="false"></th>
+                <th field="bib_id" fpath="item.target_biblio_record_entry.id" _visible="false"></th>
             </tr>
         </thead>
     </table>
index 03166da..f968ddc 100644 (file)
@@ -17,6 +17,7 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) {
             "columnReordering": true,
             "columnPersistKey": null,
             "autoCoreFields": false,
+            "autoCoreFieldsUnsorted": false,
             "autoFieldFields": null,
             "showLoadFilter": false,    /* use FlattenerFilter(Dialog|Pane) */
             "filterAlwaysInDiv": null,  /* use FlattenerFilterPane and put its
@@ -300,10 +301,14 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) {
                 var cell_list = this.structure[0].cells[0];
                 var fields = dojo.clone(
                     fieldmapper.IDL.fmclasses[this.fmClass].fields
-                ).sort(
-                    function(a, b) { return a.label > b.label ? 1 : -1; }
                 );
 
+                if (!this.autoCoreFieldsUnsorted) {
+                    fields = fields.sort(
+                        function(a, b) { return a.label > b.label ? 1 : -1; }
+                    );
+                }
+
                 dojo.forEach(
                     fields, function(f) {
                         if (f.datatype == "link" || f.virtual)
@@ -320,8 +325,8 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) {
                         cell_list.push({
                             "field": f.name,
                             "name": f.label,
-                            "fsort": true,
-                            "_visible": false
+                            "fsort": true /*,
+                            "_visible": false */
                         });
                     }
                 );
@@ -862,6 +867,21 @@ if (!dojo._hasResource["openils.widget.FlattenerGrid"]) {
                 );
             },
 
+            /* Return true if every row known to the grid is selected. Code
+             * that calls this function will do so when it thinks the user
+             * might actually mean "select everything this grid could show"
+             * even though we don't necessarily know (and the user hasn't
+             * necessarily noticed) whether the grid has been scrolled as far
+             * down as possible and all the possible results have been
+             * fetched by the grid's store. */
+            "everythingSeemsSelected": function() {
+                return dojo.query(
+                    "[name=autogrid.selector]", this.domNode
+                ).filter(
+                    function(c) { return (!c.disabled && !c.checked) }
+                ).length == 0;
+            },
+
             /* Print the same data that the Flattener is feeding to the
              * grid, sorted the same way too. Remove limit and offset (i.e.,
              * print it all) unless those are passed in to the print() method.