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

Evergreen Git git at git.evergreen-ils.org
Tue Jul 24 14:35:53 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  75c5dbedacc9dce74510eac72aaa06be15a866d9 (commit)
       via  b10b52d842f609708e52897fc171b2c75c94e339 (commit)
      from  04611dffa458982ada067357e1b7aa54a075356c (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 75c5dbedacc9dce74510eac72aaa06be15a866d9
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Wed Jan 25 12:47:40 2012 -0500

    Add component to *force* external browser use
    
    For http/https urls that don't go to the host we are logged into.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Michael Peters <mrpeters at library.in.gov>
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

diff --git a/Open-ILS/xul/staff_client/components/forceexternal.js b/Open-ILS/xul/staff_client/components/forceexternal.js
new file mode 100644
index 0000000..d93aaca
--- /dev/null
+++ b/Open-ILS/xul/staff_client/components/forceexternal.js
@@ -0,0 +1,143 @@
+const nsISupports           = Components.interfaces.nsISupports;
+const nsICategoryManager    = Components.interfaces.nsICategoryManager;
+const nsIComponentRegistrar = Components.interfaces.nsIComponentRegistrar;
+const nsIContentPolicy      = Components.interfaces.nsIContentPolicy;
+const nsIFactory            = Components.interfaces.nsIFactory;
+const nsIModule             = Components.interfaces.nsIModule;
+const nsIWindowWatcher      = Components.interfaces.nsIWindowWatcher;
+
+const WINDOW_MAIN = "eg_main"
+
+const fe_contractID = "@mozilla.org/content-policy;1?type=egfe";
+const fe_CID = Components.ID("{D969ED61-DF4C-FA12-A2A6-70AA94C222FB}");
+// category names are sorted alphabetically. Typical command-line handlers use a
+// category that begins with the letter "m".
+const fe_category = "m-egfe";
+
+const myAppHandler = {
+
+   shouldLoad: function(contentType, contentLocation, requestOrigin, node, mimeTypeGuess, extra)
+   {
+      if (contentType == nsIContentPolicy.TYPE_DOCUMENT) {
+          var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].
+            getService(Components.interfaces.nsIWindowMediator);
+          var targetWindow = wm.getMostRecentWindow("eg_main");
+          if (targetWindow != null) {
+            var host = targetWindow.G.data.server_unadorned;
+            if(host && (contentLocation.scheme == 'http' || contentLocation.scheme == 'https') && contentLocation.host != host) {
+                // first construct an nsIURI object using the ioservice
+                var ioservice = Components.classes["@mozilla.org/network/io-service;1"]
+                                .getService(Components.interfaces.nsIIOService);
+
+                var uriToOpen = ioservice.newURI(contentLocation.spec, null, null);
+
+                var extps = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
+                                .getService(Components.interfaces.nsIExternalProtocolService);
+
+                // now, open it!
+                extps.loadURI(uriToOpen, null);
+
+                return nsIContentPolicy.REJECT_REQUEST;
+            }
+          }
+      }
+      return nsIContentPolicy.ACCEPT;
+   },
+
+   shouldProcess: function(contentType, contentLocation, requestOrigin, insecNode, mimeType, extra)
+   {
+      return nsIContentPolicy.ACCEPT;
+   },
+
+  /* nsISupports */
+  QueryInterface : function fe_QI(iid)
+  {
+    if (iid.equals(nsIContentPolicy) ||
+        iid.equals(nsIFactory) ||
+        iid.equals(nsISupports))
+      return this;
+
+    throw Components.results.NS_ERROR_NO_INTERFACE;
+  },
+
+  /* nsIFactory */
+
+  createInstance : function fe_CI(outer, iid)
+  {
+    if (outer != null)
+      throw Components.results.NS_ERROR_NO_AGGREGATION;
+
+    return this.QueryInterface(iid);
+  },
+
+  lockFactory : function fe_lock(lock)
+  {
+    /* no-op */
+  }
+};
+
+/**
+ * The XPCOM glue that implements nsIModule
+ */
+const myAppHandlerModule = {
+  /* nsISupports */
+  QueryInterface : function mod_QI(iid)
+  {
+    if (iid.equals(nsIModule) ||
+        iid.equals(nsISupports))
+      return this;
+
+    throw Components.results.NS_ERROR_NO_INTERFACE;
+  },
+
+  /* nsIModule */
+  getClassObject : function mod_gch(compMgr, cid, iid)
+  {
+    if (cid.equals(fe_CID))
+      return myAppHandler.QueryInterface(iid);
+
+    throw Components.results.NS_ERROR_NOT_REGISTERED;
+  },
+
+  registerSelf : function mod_regself(compMgr, fileSpec, location, type)
+  {
+    compMgr.QueryInterface(nsIComponentRegistrar);
+
+    compMgr.registerFactoryLocation(fe_CID,
+                                    "myAppHandler",
+                                    fe_contractID,
+                                    fileSpec,
+                                    location,
+                                    type);
+
+    var catMan = Components.classes["@mozilla.org/categorymanager;1"].
+      getService(nsICategoryManager);
+    catMan.addCategoryEntry("content-policy",
+                            fe_category,
+                            fe_contractID, true, true);
+  },
+
+  unregisterSelf : function mod_unreg(compMgr, location, type)
+  {
+    compMgr.QueryInterface(nsIComponentRegistrar);
+    compMgr.unregisterFactoryLocation(fe_CID, location);
+
+    var catMan = Components.classes["@mozilla.org/categorymanager;1"].
+      getService(nsICategoryManager);
+    catMan.deleteCategoryEntry("content-policy", fe_category);
+  },
+
+  canUnload : function (compMgr)
+  {
+    return true;
+  }
+};
+
+/* The NSGetModule function is the magic entry point that XPCOM uses to find what XPCOM objects
+ * this component provides
+ */
+function NSGetModule(comMgr, fileSpec)
+{
+  return myAppHandlerModule;
+}
+

commit b10b52d842f609708e52897fc171b2c75c94e339
Author: Thomas Berezansky <tsbere at mvlc.org>
Date:   Wed Jan 25 11:18:39 2012 -0500

    Allow opening of links in default browser
    
    And do so for the "Get Help With Evergreen" portal link.
    
    Signed-off-by: Thomas Berezansky <tsbere at mvlc.org>
    Signed-off-by: Michael Peters <mrpeters at library.in.gov>
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js
index f3c0222..d10c503 100644
--- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js
+++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js
@@ -2292,6 +2292,7 @@ commands:
         }
         content_params.new_tab = function(a,b,c) { return obj.new_tab(a,b,c); };
         content_params.set_tab = function(a,b,c) { return obj.set_tab(a,b,c); };
+        content_params.open_external = function(a) { return obj.open_external(a); };
         content_params.close_tab = function() { return obj.close_tab(); };
         content_params.new_patron_tab = function(a,b) { return obj.new_patron_tab(a,b); };
         content_params.set_patron_tab = function(a,b) { return obj.set_patron_tab(a,b); };
@@ -2412,6 +2413,21 @@ commands:
         return frame;
     },
 
+    'open_external' : function(url) {
+        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+        // first construct an nsIURI object using the ioservice
+        var ioservice = Components.classes["@mozilla.org/network/io-service;1"]
+                            .getService(Components.interfaces.nsIIOService);
+
+        var uriToOpen = ioservice.newURI(url, null, null);
+
+        var extps = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
+                            .getService(Components.interfaces.nsIExternalProtocolService);
+
+        // now, open it!
+        extps.loadURI(uriToOpen, null);
+    },
+
     'get_barcode' : function(window, context, barcode) {
         JSAN.use('util.network');
         JSAN.use('util.sound');
diff --git a/Open-ILS/xul/staff_client/defaults/preferences/standalone_xul_app.js b/Open-ILS/xul/staff_client/defaults/preferences/standalone_xul_app.js
index 5350bb7..2b2fe74 100644
--- a/Open-ILS/xul/staff_client/defaults/preferences/standalone_xul_app.js
+++ b/Open-ILS/xul/staff_client/defaults/preferences/standalone_xul_app.js
@@ -66,3 +66,8 @@ pref("extensions.update.url", "chrome://mozapps/locale/extensions/extensions.pro
 pref("extensions.getMoreExtensionsURL", "chrome://mozapps/locale/extensions/extensions.properties");
 pref("extensions.getMoreThemesURL", "chrome://mozapps/locale/extensions/extensions.properties");
 
+// Allow opening of web stuff in external apps
+// suppress external-load warning for standard browser schemes
+pref("network.protocol-handler.warn-external.http", false);
+pref("network.protocol-handler.warn-external.https", false);
+pref("network.protocol-handler.warn-external.ftp", false);
diff --git a/Open-ILS/xul/staff_client/server/index.xhtml b/Open-ILS/xul/staff_client/server/index.xhtml
index 57aef29..15d77c2e 100644
--- a/Open-ILS/xul/staff_client/server/index.xhtml
+++ b/Open-ILS/xul/staff_client/server/index.xhtml
@@ -110,13 +110,7 @@
                 
                 //Place your helpdesk link here
                 function helpdesk(newtab) {
-                        loc = "http://evergreen-ils.org/communicate.php";
-                        var params = {'tab_name':'Evergreen Project Website'};
-                        
-                        if(newtab)
-                                xulG.new_tab(loc, params, {}); 
-                        else
-                                xulG.set_tab(loc, params, {}); 
+                        xulG.open_external("http://evergreen-ils.org/communicate.php");
                 }
                 
                 //A good place for a Google map.  Evergreen Indiana uses GIS data to create a Google map to verify if a library is within district boundaries
@@ -532,8 +526,7 @@
               onclick="try { helpdesk(false); } catch(E) { alert(E); }" alt=
               "Submit A Helpdesk Ticket" /></td>
 
-              <td><img class="newtabimg" src="skin/media/images/portal/newtab2.PNG" alt="Open in a new tab"
-              onclick="try { helpdesk(true); } catch(E) { alert(E); }" /> <a href="#"
+              <td><a href="#"
               onclick="try { helpdesk(false); } catch(E) { alert(E); }">&staff.client.portal.helpdesk;</a></td>
             </tr>
 

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

Summary of changes:
 .../xul/staff_client/chrome/content/main/menu.js   |   16 +++
 .../xul/staff_client/components/forceexternal.js   |  143 ++++++++++++++++++++
 .../defaults/preferences/standalone_xul_app.js     |    5 +
 Open-ILS/xul/staff_client/server/index.xhtml       |   11 +--
 4 files changed, 166 insertions(+), 9 deletions(-)
 create mode 100644 Open-ILS/xul/staff_client/components/forceexternal.js


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list