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

Evergreen Git git at git.evergreen-ils.org
Tue Jan 15 09:17:11 EST 2013


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  0f2a698496d13f07c78a34ae8c6a4b8cffe69253 (commit)
      from  1970bb4d66f3c39c9843a5cd21a30bb1c947f101 (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 0f2a698496d13f07c78a34ae8c6a4b8cffe69253
Author: Bill Erickson <berick at esilibrary.com>
Date:   Mon Oct 1 11:54:00 2012 -0400

    ACQ invoice search persistence repaired
    
    Use XUL cookieService / cookieManager for managing cookies in embedded
    web pages, since dojo.cookie cannot manage cookies within xulrunner.
    
    Persist cookies for 30 days.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

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 59d73ce..42f8377 100644
--- a/Open-ILS/web/js/ui/default/acq/invoice/view.js
+++ b/Open-ILS/web/js/ui/default/acq/invoice/view.js
@@ -13,6 +13,7 @@ dojo.require('openils.widget.EditPane');
 dojo.require('openils.widget.AutoFieldWidget');
 dojo.require('openils.widget.ProgressDialog');
 dojo.require('openils.acq.Lineitem');
+dojo.require('openils.XUL');
 
 dojo.requireLocalization('openils.acq', 'acq');
 var localeStrings = dojo.i18n.getLocalization('openils.acq', 'acq');
@@ -250,13 +251,29 @@ function doAttachPo(idx) {
     );
 }
 
+// XUL cookie bits
+var cookieUriSSL, cookieSvc, cookieMgr;
+
 function performSearch(pageDir, clearFirst) {
     if (clearFirst)
         clearSearchResTable(); 
 
     var searchObject = termManager.buildSearchObject();
-    dojo.cookie('invs', base64Encode(searchObject));
-    dojo.cookie('invc', dojo.byId("acq-unified-conjunction").getValue());
+
+    if (openils.XUL.isXUL()) {
+
+        cookieSvc.setCookieString(cookieUriSSL, null, 
+            "invs=" + base64Encode(searchObject) + ';max-age=2592000', null);
+
+        cookieSvc.setCookieString(cookieUriSSL, null, 
+            "invc=" + dojo.byId("acq-unified-conjunction").getValue() + 
+                ';max-age=2592000', null);
+
+    } else {
+
+        dojo.cookie('invs', base64Encode(searchObject));
+        dojo.cookie('invc', dojo.byId("acq-unified-conjunction").getValue());
+    }
 
     if (pageDir == 0) { // new search
         resultsLoader.displayOffset = 0;
@@ -339,12 +356,48 @@ function renderUnifiedSearch() {
         resultManager.no_results_popup = true;
         resultManager.submitter = smartSearchSubmitter;
 
-        var searchObject = dojo.cookie('invs');
-        console.log('loaded ' + searchObject);
+        var searchObject, searchConjunction;
+
+        if (openils.XUL.isXUL()) {
+    
+            if (!cookieSvc) {
+
+                var ios = Components.classes["@mozilla.org/network/io-service;1"]
+                    .getService(Components.interfaces.nsIIOService);
+
+                cookieUriSSL = ios.newURI("https://" + location.hostname, null, null);
+    
+                cookieSvc = Components.classes["@mozilla.org/cookieService;1"]
+                    .getService(Components.interfaces.nsICookieService);
+
+
+                cookieManager = Components.classes["@mozilla.org/cookiemanager;1"]
+                    .getService(Components.interfaces.nsICookieManager);
+            }
+
+            var iter = cookieManager.enumerator;
+            while (iter.hasMoreElements()) {
+                var cookie = iter.getNext();
+                if (cookie instanceof Components.interfaces.nsICookie) {
+                    if (cookie.name == 'invs')
+                        searchObject = cookie.value;
+                    if (cookie.name == 'invc')
+                        searchConjunction = cookie.value;
+                }
+            }
+
+        } else {
+            // useful for web-based testing
+            searchObject = dojo.cookie('invs');
+            searchConjunction = dojo.cookie('invc');
+        }
+
         if (searchObject) {
+
             // if there is a search object cookie, populate the search form
             termManager.reflect(base64Decode(searchObject));
-            dojo.byId("acq-unified-conjunction").setValue(dojo.cookie('invc'));
+            dojo.byId("acq-unified-conjunction").setValue(searchConjunction);
+
         } else {
             console.log('adding row');
             termManager.addRow();

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

Summary of changes:
 Open-ILS/web/js/ui/default/acq/invoice/view.js |   63 ++++++++++++++++++++++--
 1 files changed, 58 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list