Quick launch now supports opening a view using a url
authorMartin Taal <martin.taal@openbravo.com>
Wed, 09 Mar 2011 12:17:41 +0100
changeset 11139 a23df6e847ed
parent 11138 2a2c6483ec7d
child 11141 12ab2f0c3bb5
Quick launch now supports opening a view using a url
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-quick-launch.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-quick-launch.js	Wed Mar 09 12:16:47 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-quick-launch.js	Wed Mar 09 12:17:41 2011 +0100
@@ -83,6 +83,17 @@
     }
   },
   
+  // handle the case that someone entered a url in the quick launch
+  doHide: function(){
+    if (this.members[1].getField('value').getValue() && this.members[1].getField('value').getValue().contains('?')) {
+      var params = OB.Utilities.getUrlParameters(this.members[1].getField('value').getValue());
+      if (params && params.tabId) {
+        OB.Utilities.openDirectTab(params.tabId, params.recordId, params.command);
+      }      
+    }
+    this.Super('doHide', arguments);
+  },
+  
   initWidget: function(){
     this.members = [isc.DynamicForm.create({
       visibility: 'hidden',
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js	Wed Mar 09 12:16:47 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js	Wed Mar 09 12:17:41 2011 +0100
@@ -361,8 +361,9 @@
 // ** {{{OB.Utilities.getUrlParameters}}} **
 // Returns the url parameters as a javascript object. Note works for simple cases
 // where no & is used for character encoding, this is fine for most cases.
-OB.Utilities.getUrlParameters = function(){
-  var vars = {}, hash, href = window.location.href, hashes = href.slice(href.indexOf('?') + 1).split('&');
+OB.Utilities.getUrlParameters = function(href){
+  href = href || window.location.href;
+  var vars = {}, hash, hashes = href.slice(href.indexOf('?') + 1).split('&');
   
   for (var i = 0; i < hashes.length; i++) {
     hash = hashes[i].split('=');