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

Evergreen Git git at git.evergreen-ils.org
Tue Jul 24 12:49:33 EDT 2012


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  df90cb78bc9ef86bea4ccef7f87ce5147e5e0a7d (commit)
       via  92ae1ecae956c2a2772a585f7d8602712cbfd9e9 (commit)
       via  2353b9392fd60d37be326e8548bdd01faf8fd756 (commit)
       via  3b637c3583d661bc9f4f08d1b2a9aa5f7c0aa9c3 (commit)
       via  01f4982df0ec1bdc1aa9daa7eaf45c34acaeb0ce (commit)
       via  0fcae937415f3971ca0ca5bee8a7d7175d3c9a7a (commit)
       via  c108746532548fd8d3fadd15736375a57208d485 (commit)
      from  0438399769af9d9747a0185a8ae73a3cc944c00d (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 df90cb78bc9ef86bea4ccef7f87ce5147e5e0a7d
Author: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>
Date:   Tue Jul 24 12:46:08 2012 -0400

    Acq: PO view interface sometimes fails to load in development enviroments
    
    Should not affect production environments, but requiring
    dijit.form.Button quiets an error on my system when I don't have
    a openils_dojo.js bundle installed.
    
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

diff --git a/Open-ILS/web/js/ui/default/acq/po/view_po.js b/Open-ILS/web/js/ui/default/acq/po/view_po.js
index 19b7527..f3cf4df 100644
--- a/Open-ILS/web/js/ui/default/acq/po/view_po.js
+++ b/Open-ILS/web/js/ui/default/acq/po/view_po.js
@@ -1,3 +1,4 @@
+dojo.require("dijit.form.Button");
 dojo.require("dojo.string");
 dojo.require('dijit.layout.ContentPane');
 dojo.require('openils.PermaCrud');

commit 92ae1ecae956c2a2772a585f7d8602712cbfd9e9
Author: Bill Erickson <berick at esilibrary.com>
Date:   Fri Jul 13 12:07:56 2012 -0400

    ACQ : lineitem recovers focus from various interfaces
    
    1. When viewing an invoice then clicking on the title link for a lineitem,
    the user is taken away to the copy grid within the PO page for the
    lineitem.This adds a "Return to Invoice" button in the copy grid which
    takes the user back to the invoice, focused on the lineitem in question.
    
    2. Adds a "Return to Search" button for PL/PO pages to return to the
    lineitem in question when the PL or PO links are selected for a lineitem
    in a set of search results.
    
    3. Adds a "Return to Invoice" button to PO/Picklist pages with lineitem
    focus when the page was accessed from the invoice UI.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

diff --git a/Open-ILS/src/templates/acq/common/li_table.tt2 b/Open-ILS/src/templates/acq/common/li_table.tt2
index 8c6b065..9eb8d35 100644
--- a/Open-ILS/src/templates/acq/common/li_table.tt2
+++ b/Open-ILS/src/templates/acq/common/li_table.tt2
@@ -158,6 +158,10 @@
             <table style='width:100%'>
                 <tr>
                     <td class="acq-lit-li-menu-left">
+                        <span class='hidden' id='acq-lit-copies-back-to-invoice-button-wrapper'>
+                            <button dojoType='dijit.form.Button' id='acq-lit-copies-back-to-invoice-button' 
+                                scrollOnFocus='false'>[% l('&#x2196; Return To Invoice') %]</button>
+                        </span>
                         <div dojoType='dijit.form.Button' id='acq-lit-copies-back-button' scrollOnFocus='false'>&#x2196; Return</div>
                         <span style='margin-left:10px;padding-left:10px;border-left:2px solid #aaa;'>
                             Item Count: 
diff --git a/Open-ILS/src/templates/acq/picklist/view.tt2 b/Open-ILS/src/templates/acq/picklist/view.tt2
index a209c3e..65af63b 100644
--- a/Open-ILS/src/templates/acq/picklist/view.tt2
+++ b/Open-ILS/src/templates/acq/picklist/view.tt2
@@ -12,6 +12,13 @@
             </div>
         </div>
     </div>
+    <div class='hidden' id='acq-pl-return-to-search'>
+        <button dojoType='dijit.form.Button' id='acq-pl-return-to-search-button'>[% l('&#x2196; Return to Search') %]</button>
+    </div>
+    <div class='hidden' id='acq-pl-return-to-invoice'>
+        <button dojoType='dijit.form.Button' id='acq-pl-return-to-invoice-button'>[% l('&#x2196; Return to Invoice') %]</button>
+    </div>
+
     <script type="text/javascript">var plId = '[% ctx.page_args.0 %]';</script>
     [% INCLUDE 'acq/common/li_table.tt2' %]
 </div>
diff --git a/Open-ILS/src/templates/acq/po/view.tt2 b/Open-ILS/src/templates/acq/po/view.tt2
index 605ad7a..2084e10 100644
--- a/Open-ILS/src/templates/acq/po/view.tt2
+++ b/Open-ILS/src/templates/acq/po/view.tt2
@@ -109,6 +109,16 @@
                     <td></td>
                     <th>[% l('Allow activation with <br/> zero-copy lineitems') %]</th>
                     <td><input type='checkbox' id='acq-po-activate-zero-copies' onclick='checkCouldActivatePo()'/></td>
+                    <td>
+                        <div class='hidden' id='acq-po-return-to-search'>
+                            <button dojoType='dijit.form.Button' id='acq-po-return-to-search-button'>[% l('&#x2196; Return to Search') %]</button>
+                        </div>
+                        <div class='hidden' id='acq-po-return-to-invoice'>
+                            <button dojoType='dijit.form.Button' id='acq-po-return-to-invoice-button'>[% l('&#x2196; Return to Invoice') %]</button>
+                        </div>
+                    </td>
+                    <td/>
+                </tr>
                 <tr>
                     <td colspan='3'>
                         <a class="hidden" id="acq-po-split" href="javascript:void(0);"
diff --git a/Open-ILS/web/js/dojo/openils/acq/nls/acq.js b/Open-ILS/web/js/dojo/openils/acq/nls/acq.js
index 7d4ce58..26a0452 100644
--- a/Open-ILS/web/js/dojo/openils/acq/nls/acq.js
+++ b/Open-ILS/web/js/dojo/openils/acq/nls/acq.js
@@ -62,7 +62,7 @@
     "INVOICE_ITEM_DETAILS" : "${0} <br/> ${1} <br/> ${2}. <br/> Estimated Price: $${3}. <br/> Lineitem ID: ${4} <br/> PO: ${5} <br/> Order Date: ${6}",
     "INVOICE_CONFIRM_ITEM_DELETE" : "Remove this $${0} '${1}' charge from the invoice?",
     "INVOICE_CONFIRM_ENTRY_DETACH" : "Remove $${0} charge for item '${1}, ${2} [${3}] from the invoice?",
-    "LINEITEM_SUMMARY" : "<div class='acq-lineitem-summary'><a href='${19}'>${0}</a>, by ${1} (${2})</div>\n<div class='acq-lineitem-summary-extra'>\n${3} Ordered, ${4} Received, ${7} Invoiced, ${8} Claimed, ${9} Cancelled</div>\n<div class='acq-lineitem-summary-extra'>Estimated $${6}, Encumbered $${16}, Paid $${17}</div>\n<div class='acq-lineitem-summary-extra'>\n# ${10} <a style='padding-right: 10px;' class='hidden${20}'  href='${11}/acq/po/view/${12}'>&#x2318; ${13} ${18}</a>\n<a style='padding-right: 10px;' class='hidden${21}' href='${11}/acq/picklist/view/${14}'>&#x2756; ${15}</a></div>",
+    "LINEITEM_SUMMARY" : "<div class='acq-lineitem-summary'><a href='${19}?focus_li=${10}'>${0}</a>, by ${1} (${2})</div>\n<div class='acq-lineitem-summary-extra'>\n${3} Ordered, ${4} Received, ${7} Invoiced, ${8} Claimed, ${9} Cancelled</div>\n<div class='acq-lineitem-summary-extra'>Estimated $${6}, Encumbered $${16}, Paid $${17}</div>\n<div class='acq-lineitem-summary-extra'>\n# ${10} <a style='padding-right: 10px;' class='hidden${20}'  href='${11}/acq/po/view/${12}?focus_li=${10}'>&#x2318; ${13} ${18}</a>\n<a style='padding-right: 10px;' class='hidden${21}' href='${11}/acq/picklist/view/${14}?focus_li=${10}'>&#x2756; ${15}</a></div>",
     "INVOICE_CONFIRM_PRORATE" : "Prorate charges?\n\nAny subsequent changes to the invoice that would affect prorated amounts should be resolved manually.",
     "INVOICE_EXTRA_COPIES" : "You are attempting to invoice <b>${0}</b> more copies than originally ordered.  <br/><br/>To add these items to the original order, select a fund and choose 'Add New Items' below.  <br/>After saving the invoice, you may finish editing and importing the new copies from the lineitem details page.",
     "INVOICE_ITEM_PO_DETAILS" : "<b>${0}</b><br/><a href='${1}/acq/po/view/${2}'>PO #${3} ${4}</a><br/>Total Estimated Cost: $${5}",
diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js
index 54ce6cc..d0a9d84 100644
--- a/Open-ILS/web/js/ui/default/acq/common/li_table.js
+++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js
@@ -459,7 +459,7 @@ function AcqLiTable() {
             if(po && !this.isMeta) {
                 openils.Util.show(nodeByName('po', row), 'inline');
                 var link = nodeByName('po_link', row);
-                link.setAttribute('href', oilsBasePath + '/acq/po/view/' + li.purchase_order());
+                link.setAttribute('href', oilsBasePath + '/acq/po/view/' + li.purchase_order() + '?focus_li=' + li.id());
                 link.innerHTML += po.name();
 
                 openils.Util.show(nodeByName('pro', row), 'inline');
@@ -485,7 +485,7 @@ function AcqLiTable() {
 
                     openils.Util.show(nodeByName('pl', row), 'inline');
                     var link = nodeByName('pl_link', row);
-                    link.setAttribute('href', oilsBasePath + '/acq/picklist/view/' + li.picklist());
+                    link.setAttribute('href', oilsBasePath + '/acq/picklist/view/' + li.picklist() + '?focus_li=' + li.id());
                     link.innerHTML += pl.name();
                 }
             }
@@ -1121,6 +1121,15 @@ function AcqLiTable() {
         if (typeof force_fetch == "undefined")
             force_fetch = false;
 
+        if (document.referrer.match(/invoice/)) {
+            // got here from the invoice page, show the 'return-to-invoice' button
+            var cgi = new openils.CGI({url : document.referrer});
+            cgi.param('focus_li', liId);
+            openils.Util.show(dojo.byId('acq-lit-copies-back-to-invoice-button-wrapper'), 'inline');
+            var button = dojo.byId('acq-lit-copies-back-to-invoice-button');
+            button.onclick = function() { location.href = cgi.url() };
+        }
+
         openils.acq.Lineitem.fetchAndRender(liId, {}, 
             function(li, html) {
                 dojo.byId('acq-lit-copies-li-summary').innerHTML = html;
diff --git a/Open-ILS/web/js/ui/default/acq/picklist/view.js b/Open-ILS/web/js/ui/default/acq/picklist/view.js
index 7cbc0c5..c125daf 100644
--- a/Open-ILS/web/js/ui/default/acq/picklist/view.js
+++ b/Open-ILS/web/js/ui/default/acq/picklist/view.js
@@ -2,6 +2,7 @@ dojo.require('dojo.date.stamp');
 dojo.require('dojo.date.locale');
 dojo.require('openils.User');
 dojo.require('openils.Util');
+dojo.require('openils.CGI');
 dojo.require('dijit.layout.ContentPane');
 
 var plist;
@@ -25,6 +26,24 @@ function load() {
         }
     );
 
+    /* if we got here from the search/invoice page with a focused LI,
+     * return to the previous page with the same LI focused */
+    var cgi = new openils.CGI();
+    if (cgi.param('focus_li')) {
+        dojo.forEach(
+            ['search', 'invoice'], // perhaps a wee bit too loose
+            function(source) {
+                if (document.referrer.match(new RegExp(source))) {
+                    openils.Util.show('acq-pl-return-to-' + source);
+                    var newCgi = new openils.CGI({url : document.referrer});
+                    newCgi.param('focus_li', cgi.param('focus_li'));
+                    dojo.byId('acq-pl-return-to-' + source + '-button').onclick = function() {
+                        location.href = newCgi.url();
+                    }
+                }
+            }
+        );
+    }
 }
 
 function drawPl() {
diff --git a/Open-ILS/web/js/ui/default/acq/po/view_po.js b/Open-ILS/web/js/ui/default/acq/po/view_po.js
index 53acfa4..19b7527 100644
--- a/Open-ILS/web/js/ui/default/acq/po/view_po.js
+++ b/Open-ILS/web/js/ui/default/acq/po/view_po.js
@@ -353,6 +353,26 @@ function renderPo() {
     );
     openils.Util.show("acq-po-view-history", "inline");
 
+    
+    /* if we got here from the search/invoice page with a focused LI,
+     * return to the previous page with the same LI focused */
+    var cgi = new openils.CGI();
+    if (cgi.param('focus_li')) {
+        dojo.forEach(
+            ['search', 'invoice'], // perhaps a wee bit too loose
+            function(source) {
+                if (document.referrer.match(new RegExp(source))) {
+                    openils.Util.show('acq-po-return-to-' + source);
+                    var newCgi = new openils.CGI({url : document.referrer});
+                    newCgi.param('focus_li', cgi.param('focus_li'));
+                    dojo.byId('acq-po-return-to-' + source + '-button').onclick = function() {
+                        location.href = newCgi.url();
+                    }
+                }
+            }
+        );
+    }
+
     prepareInvoiceFeatures();
 }
 

commit 2353b9392fd60d37be326e8548bdd01faf8fd756
Author: Bill Erickson <berick at esilibrary.com>
Date:   Fri Jul 13 16:31:41 2012 -0400

    ACQ : Support lineitem fucus in ACQ unified search
    
    Adds support for a "focus_li" URL parameter to ACQ unified search
    results pages.  When present, the page of results containing the
    requested lineitem are loaded (instead of the default page 1) and the
    lineitem is made visible in the viewable screen using the lineitem table
    focusLi mechanism.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table_pager.js b/Open-ILS/web/js/ui/default/acq/common/li_table_pager.js
index 20d8a17..de24dcb 100644
--- a/Open-ILS/web/js/ui/default/acq/common/li_table_pager.js
+++ b/Open-ILS/web/js/ui/default/acq/common/li_table_pager.js
@@ -60,6 +60,40 @@ function LiTablePager() {
         }
     };
 
+    this.focusLi = function() {
+        var liId = this.liTable.focusLineitem;
+        if (liId && this.liTable.liCache[liId] && dojo.byId('li-title-ref-' + liId))
+            this.liTable.focusLi();
+    };
+
+    /* given a lineitem to focus, this will determine what page in 
+     * the results set the lineitem sits, then fetch that page 
+     * of results.  Returns false if no focus requested.
+     */
+    this.loadFocusLi = function() {
+        var liId = this.liTable.focusLineitem;
+        if (!liId) return false;
+
+        var _this = this;
+        this.getAllLineitemIDs(
+            function(r) {
+                var allIds = openils.Util.readResponse(r);
+                var idx = dojo.indexOf(allIds, liId);
+                // if li not found, result is loading page 1
+
+                var page = 1;
+                while ( idx >= (page * _this.displayLimit) ) { 
+                    page++;
+                }
+
+                _this.displayOffset = (_this.displayLimit * (page - 1));
+                _this.dataLoader();
+            }
+        );
+
+        return true;
+    };
+
     this.getAllLineitemIDs = function(callback) {
         this.dataLoader({
             "id_list": true,
diff --git a/Open-ILS/web/js/ui/default/acq/search/unified.js b/Open-ILS/web/js/ui/default/acq/search/unified.js
index 68fb3bb..b7f0137 100644
--- a/Open-ILS/web/js/ui/default/acq/search/unified.js
+++ b/Open-ILS/web/js/ui/default/acq/search/unified.js
@@ -775,6 +775,13 @@ function ResultManager(liPager, poGrid, plGrid, invGrid) {
     };
 
     this.resultsComplete = function() {
+
+        // now that the records are loaded, we need to do the actual focusing
+        if (this.result_type == 'lineitem') {
+            if (this.liPager) 
+                this.liPager.focusLi();
+        }
+
         if (!this.count_results)
             this.show("no_results");
         else this.finish(this.result_type);
@@ -838,6 +845,15 @@ function ResultManager(liPager, poGrid, plGrid, invGrid) {
             );
         }
 
+        // if the caller has requested we focus on a specific
+        // lineitem, allow the pager to find the lineitem
+        // and load the results directly.
+        if (this.result_type == 'lineitem') {
+            if (this.liPager && this.liPager.loadFocusLi()) { 
+                return;
+            }
+        }
+
         interface.dataLoader();
     };
 }

commit 3b637c3583d661bc9f4f08d1b2a9aa5f7c0aa9c3
Author: Bill Erickson <berick at esilibrary.com>
Date:   Thu Jul 12 16:23:14 2012 -0400

    ACQ : Support for lineitem focus in invoice UI
    
    Adds support for a "focus_li" URL parameter.  When set, the UI will
    scroll to the lineitem and provide a brief color change on the table row
    to help orient.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

diff --git a/Open-ILS/web/js/dojo/openils/acq/Lineitem.js b/Open-ILS/web/js/dojo/openils/acq/Lineitem.js
index 4d0ec80..ec28214 100644
--- a/Open-ILS/web/js/dojo/openils/acq/Lineitem.js
+++ b/Open-ILS/web/js/dojo/openils/acq/Lineitem.js
@@ -122,7 +122,7 @@ openils.acq.Lineitem.fetchAndRender = function(liId, args, callback) {
         ['open-ils.acq', 'open-ils.acq.lineitem.retrieve.authoritative'],
         {
             params : [ openils.User.authtoken, liId, args ],
-
+            async : true,
             oncomplete : function(r) {
                 var lineitem = openils.Util.readResponse(r);
                 if(!lineitem) return;
diff --git a/Open-ILS/web/js/ui/default/acq/invoice/view.js b/Open-ILS/web/js/ui/default/acq/invoice/view.js
index a326299..8422b8d 100644
--- a/Open-ILS/web/js/ui/default/acq/invoice/view.js
+++ b/Open-ILS/web/js/ui/default/acq/invoice/view.js
@@ -35,6 +35,7 @@ var virtualId = -1;
 var extraCopies = {};
 var extraCopiesFund;
 var widgetRegistry = {acqie : {}, acqii : {}};
+var focusLineitem;
 
 function nodeByName(name, context) {
     return dojo.query('[name='+name+']', context)[0];
@@ -44,6 +45,7 @@ function init() {
 
     attachLi = cgi.param('attach_li');
     attachPo = cgi.param('attach_po');
+    focusLineitem = new openils.CGI().param('focus_li');
 
     itemTypes = pcrud.retrieveAll('aiit');
 
@@ -430,6 +432,39 @@ function updateReceiveLink(li) {
     link.onclick = function() { location.href =  oilsBasePath + '/acq/invoice/receive/' + invoiceId; };
 }
 
+/*
+ * Ensures focusLineitem is in view and causes a brief 
+ * border around the lineitem to come to life then fade.
+ */
+function focusLi() {
+    if (!focusLineitem) return;
+
+    // set during addLineitem()
+    var node = dojo.byId('li-title-ref-' + focusLineitem);
+
+    console.log('focus: li-title-ref-' + focusLineitem + ' : ' + node);
+
+    // LI may not yet be rendered
+    if (!node) return; 
+
+    console.log('focusing ' + focusLineitem);
+
+    // prevent numerous re-focuses
+    focusLineitem = null; 
+
+    // causes the full row to be visible
+    dijit.scrollIntoView(node);
+
+    dojo.require('dojox.fx');
+
+    setTimeout(
+        function() {
+            dojox.fx.highlight({color : '#BB4433', node : node, duration : 2000}).play();
+        }, 
+    100);
+}
+
+
 function addInvoiceEntry(entry) {
 
     openils.Util.removeCSSClass(dojo.byId('acq-invoice-entry-header'), 'hidden');
@@ -455,6 +490,9 @@ function addInvoiceEntry(entry) {
             entry.purchase_order(li.purchase_order());
             nodeByName('title_details', row).innerHTML = html;
 
+            nodeByName('title_details', row).parentNode.id = 'li-title-ref-' + li.id();
+            console.log(dojo.byId('li-title-ref-' + li.id()));
+
             updateReceiveLink(li);
 
             dojo.forEach(
@@ -499,6 +537,9 @@ function addInvoiceEntry(entry) {
                     );
                 }
             );
+
+            if (focusLineitem == li.id())
+                focusLi();
         }
     );
 

commit 01f4982df0ec1bdc1aa9daa7eaf45c34acaeb0ce
Author: Bill Erickson <berick at esilibrary.com>
Date:   Thu Jul 12 14:09:32 2012 -0400

    ACQ : worksheet Return action focuses lineitem
    
    Adds a new Return button to the lineitem worksheet page which returns
    the user to the previous interface with the lineitem in question
    focused.  Uses a new CGI param "focus_li".
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

diff --git a/Open-ILS/src/templates/acq/lineitem/worksheet.tt2 b/Open-ILS/src/templates/acq/lineitem/worksheet.tt2
index 262c270..8b95e03 100644
--- a/Open-ILS/src/templates/acq/lineitem/worksheet.tt2
+++ b/Open-ILS/src/templates/acq/lineitem/worksheet.tt2
@@ -1,8 +1,15 @@
 [% WRAPPER "base.tt2" %]
 [% ctx.page_title = "Lineitem Worksheet" %]
-<script type="text/javascript">var liId = "[% ctx.page_args.0 %]";</script>
+<script type="text/javascript">
+    var liId = "[% ctx.page_args.0 %]";
+    dojo.require('openils.CGI');
+    var cgi = new openils.CGI({url : document.referrer});
+    cgi.param('focus_li', liId);
+    var returnRef = cgi.url();
+</script>
 <h1>Lineitem Worksheet</h1>
-<br/>
+<div dojoType='dijit.form.Button' scrollOnFocus='false' onClick='location.href = returnRef'>&#x2196; Return</div>
+<br/><br/>
 <div id="acq-worksheet-contents"></div>
 <div class='hidden'>
     <div jsId='progressDialog' dojoType='openils.widget.ProgressDialog' message='Loading Worksheet...'></div>

commit 0fcae937415f3971ca0ca5bee8a7d7175d3c9a7a
Author: Bill Erickson <berick at esilibrary.com>
Date:   Thu Jul 12 14:01:50 2012 -0400

    ACQ : Lineitem recovers focus after actions
    
    After useing the Copies, Notes, or title-click actions on a lineitem,
    using the "Return" button will now cause the lineitem in question to be
    visible on the lineitem list page upon return.  After returning, there
    is also a brief border coloration around the lineitem to help the user
    re-orient.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

diff --git a/Open-ILS/src/templates/acq/common/li_table.tt2 b/Open-ILS/src/templates/acq/common/li_table.tt2
index 1ec4d17..8c6b065 100644
--- a/Open-ILS/src/templates/acq/common/li_table.tt2
+++ b/Open-ILS/src/templates/acq/common/li_table.tt2
@@ -74,7 +74,7 @@
             <tbody id='acq-lit-tbody'>
                 <tr id='acq-lit-row' class='acq-lit-row'>
                     <td name='selector'><input type='checkbox' name='selectbox'/></td>
-                    <td style='width:75%;'>
+                    <td style='width:75%;' name='bib-info-cell'>
                         <table style='width:100%;'>
                             <tbody>
                                 <tr>
diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js
index 8215946..54ce6cc 100644
--- a/Open-ILS/web/js/ui/default/acq/common/li_table.js
+++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js
@@ -14,6 +14,7 @@ dojo.require('dojo.data.ItemFileReadStore');
 dojo.require('openils.widget.ProgressDialog');
 dojo.require('openils.PermaCrud');
 dojo.require("openils.widget.PCrudAutocompleteBox");
+dojo.require('openils.CGI');
 
 if (!localeStrings) {   /* we can do this because javascript doesn't have block scope */
     dojo.requireLocalization('openils.acq', 'acq');
@@ -81,6 +82,8 @@ function AcqLiTable() {
     );
     this.vlAgent = new VLAgent();
 
+    this.focusLineitem = new openils.CGI().param('focus_li');
+
     dojo.byId("acq-lit-li-actions-selector").onchange = function() { 
         self.applySelectedLiAction(this.options[this.selectedIndex].value);
         this.selectedIndex = 0;
@@ -149,6 +152,37 @@ function AcqLiTable() {
         }
     };
 
+    /*
+     * Ensures this.focusLineitem is in view and causes a brief 
+     * border around the lineitem to come to life then fade.
+     */
+    this.focusLi = function() {
+        if (!this.focusLineitem) return;
+
+        // set during addLineitem()
+        var node = dojo.byId('li-title-ref-' + this.focusLineitem);
+
+        // LI may not yet be rendered
+        if (!node) return; 
+
+        // prevent numerous re-focuses
+        this.focusLineitem = null; 
+        
+        // causes the full row to be visible
+        dijit.scrollIntoView(node);
+
+        // may as well..
+        dojo.query('[attr=title]', node)[0].focus();
+
+        dojo.require('dojox.fx');
+
+        setTimeout(
+            function() {
+                dojox.fx.highlight({color : '#BB4433', node : node, duration : 2000}).play();
+            }, 
+        100);
+    };
+
     this.show = function(div) {
         openils.Util.hide('acq-lit-table-div');
         openils.Util.hide('acq-lit-info-div');
@@ -159,6 +193,7 @@ function AcqLiTable() {
         switch(div) {
             case 'list':
                 openils.Util.show('acq-lit-table-div');
+                this.focusLi();
                 break;
             case 'info':
                 openils.Util.show('acq-lit-info-div');
@@ -345,6 +380,9 @@ function AcqLiTable() {
         dojo.forEach(tds, function(td) {self.setRowAttr(td, liWrapper, td.getAttribute('attr'), td.getAttribute('attr_type'));});
         dojo.query('[name=source_label]', row)[0].appendChild(document.createTextNode(li.source_label()));
 
+        // so we can scroll to it later
+        dojo.query('[name=bib-info-cell]', row)[0].id = 'li-title-ref-' + li.id();
+
         var identifier =
             liWrapper.findAttr("isbn", "lineitem_marc_attr_definition") ||
             liWrapper.findAttr("upc", "lineitem_marc_attr_definition");
@@ -472,6 +510,11 @@ function AcqLiTable() {
         if (skip_final_placement) {
             return row;
         }
+
+        // the last LI may be rendered after the call to show('list'),
+        // so make sure it's focused if necessary.
+        if (this.focusLineitem == li.id())
+            this.focusLi();
     };
 
     this._liCountClaims = function(li) {
@@ -709,6 +752,7 @@ function AcqLiTable() {
      */
     this.drawLiNotes = function(li) {
         var self = this;
+        this.focusLineitem = li.id();
 
         if (!acqLitAlertAlertText._store_ready)
             this._setAlertStore();
@@ -910,6 +954,7 @@ function AcqLiTable() {
     }
 
     this.drawInfo = function(liId) {
+        this.focusLineitem = liId;
         if (!this._isRelatedViewer) {
             var d = dojo.byId("acq-lit-info-related");
             if (!this.relCache[liId]) {
@@ -1072,6 +1117,7 @@ function AcqLiTable() {
     }
 
     this.drawCopies = function(liId, force_fetch) {
+        this.focusLineitem = liId;
         if (typeof force_fetch == "undefined")
             force_fetch = false;
 

commit c108746532548fd8d3fadd15736375a57208d485
Author: Bill Erickson <berick at esilibrary.com>
Date:   Fri Jul 13 11:49:00 2012 -0400

    Support custom URL mangling in openils.CGI JS lib
    
    Adds a new optoinal parameter to the openils.CGI constructor called
    'args', which currently supports 'url' and 'query' fields.  If the URL
    is provided, CGI uses the value from args.url instead of location.href
    and location.search.  Additionally, if 'query' is provided, it's used
    instead of location.search and takes precedence over any query in
    args.url;
    
    It's also now possible to set parameter values.  By default, setting a
    value overwrites the full array of values from multi-value params.  You
    can use the 'push' argument to push the value onto the list instead of
    clobbering it.
    
    There are two new methods, queryString() and url().  The first returns
    the query string, the second the full URL with uri-escaped query string
    included.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

diff --git a/Open-ILS/web/js/dojo/openils/CGI.js b/Open-ILS/web/js/dojo/openils/CGI.js
index d63576e..d79c825 100644
--- a/Open-ILS/web/js/dojo/openils/CGI.js
+++ b/Open-ILS/web/js/dojo/openils/CGI.js
@@ -20,22 +20,38 @@ if(!dojo._hasResource["openils.CGI"]) {
     dojo.provide("openils.CGI");
     dojo.declare('openils.CGI', null, {
 
-        constructor : function() {
+        constructor : function(args) {
 
             this._keys = new Array();
             this.data = new Object();
 
-            var string = location.search.replace(/^\?/,"");
+            var query = location.search.replace(/^\?/,"");
             this.server_name = location.href.replace(/^https?:\/\/([^\/]+).+$/,"$1");
+            this.base_url = location.href.replace(/(.*)\?.*/, '$1'); // proto://hostname/full/path
+
+            // if the user specifies URL components, override URL
+            // components pulled from the current page
+            if (args) {
+                if (url = args.url) { // assignment
+                    this.base_url = url.replace(/(.*)\?.*/, '$1');
+                    query = '';
+                    if (url.match(/\?(.*)/))
+                        query = url.match(/\?(.*)/)[0];
+                }
+                if (args.query)
+                    query = args.query;
+
+                query = query.replace(/^\?/, '');
+            }
 
             var key = ""; 
             var value = "";
             var inkey = true;
             var invalue = false;
 
-            for( var idx = 0; idx!= string.length; idx++ ) {
+            for( var idx = 0; idx!= query.length; idx++ ) {
 
-                var c = string.charAt(idx);
+                var c = query.charAt(idx);
 
                 if( c == "=" )	{
                     invalue = true;
@@ -57,16 +73,38 @@ if(!dojo._hasResource["openils.CGI"]) {
                 else if(invalue) value += c;
             }
 
-            if( ! this.data[key] ) this.data[key] = [];
-            this.data[key].push(decodeURIComponent(value));
-            this._keys.push(key);
+            if (key.length) {
+                if( ! this.data[key] ) this.data[key] = [];
+                this.data[key].push(decodeURIComponent(value));
+                this._keys.push(key);
+            }
         },
 
         /* returns the value for the given param.  If there is only one value for the
            given param, it returns that value.  Otherwise it returns an array of values
          */
-        param : function(p) {
-            if(this.data[p] == null) return null;
+        param : function(p, val, push) {
+            if (p == null || p == '') // invalid param name
+                return null;
+
+            // set param value
+            if (arguments.length > 1) { 
+                if (this.keys().indexOf(p) == -1)
+                    this._keys.push(p);
+
+                if (dojo.isArray(this.data[p])) {
+                    if (push) {
+                        this.data[p].push(val);
+                    } else {
+                        this.data[p] = val;
+                    }
+                } else {
+                    this.data[p] = val;
+                }
+            }
+
+            if(this.data[p] == null)
+                return null;
             if(this.data[p].length == 1)
                 return this.data[p][0];
             return this.data[p];
@@ -77,21 +115,48 @@ if(!dojo._hasResource["openils.CGI"]) {
             return this._keys;
         },
 
+        /* returns the URI-encoded query string */
+        queryString : function() {
+            var query = "";
+            var _this = this;
+
+            dojo.forEach(this.keys(),
+                function(key) {
+                    var params = _this.param(key);
+                    if (!dojo.isArray(params))
+                        params = [params];
+
+                    dojo.forEach(params,
+                        function(param) {
+                            if (param == null) return;
+                            query += ';' + key + '=' + encodeURIComponent(param);
+                        }
+                    );
+                }
+            );
+
+            return query.replace(/^;/, '?');
+        },
+
+        url : function() {
+            return this.base_url + this.queryString();
+        },
+
         /* debugging method */
         toString : function() {
-            var string = "";
+            var query = "";
             var keys = this.keys();
 
             for( var k in keys ) {
-                string += keys[k] + " : ";
+                query += keys[k] + " : ";
                 var params = this.param(keys[k]);
 
                 for( var p in params ) {
-                    string +=  params[p] + " ";
+                    query +=  params[p] + " ";
                 }
-                string += "\n";
+                query += "\n";
             }
-            return string;
+            return query;
         }
     });
 }

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

Summary of changes:
 Open-ILS/src/templates/acq/common/li_table.tt2     |    6 +-
 Open-ILS/src/templates/acq/lineitem/worksheet.tt2  |   11 ++-
 Open-ILS/src/templates/acq/picklist/view.tt2       |    7 ++
 Open-ILS/src/templates/acq/po/view.tt2             |   10 ++
 Open-ILS/web/js/dojo/openils/CGI.js                |   93 +++++++++++++++++---
 Open-ILS/web/js/dojo/openils/acq/Lineitem.js       |    2 +-
 Open-ILS/web/js/dojo/openils/acq/nls/acq.js        |    2 +-
 Open-ILS/web/js/ui/default/acq/common/li_table.js  |   59 ++++++++++++-
 .../web/js/ui/default/acq/common/li_table_pager.js |   34 +++++++
 Open-ILS/web/js/ui/default/acq/invoice/view.js     |   41 +++++++++
 Open-ILS/web/js/ui/default/acq/picklist/view.js    |   19 ++++
 Open-ILS/web/js/ui/default/acq/po/view_po.js       |   21 +++++
 Open-ILS/web/js/ui/default/acq/search/unified.js   |   16 ++++
 13 files changed, 300 insertions(+), 21 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list