Myob shows all recent views
authorMartin Taal <martin.taal@openbravo.com>
Thu, 03 Mar 2011 16:17:44 +0100
changeset 10995 59896f979c5a
parent 10994 2f0491185ae7
child 10996 56009f6616dd
Myob shows all recent views
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_REF_LIST.xml
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-application-menu.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-recent-utilities.js
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-manager.js
modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_REF_LIST.xml	Thu Mar 03 15:36:30 2011 +0100
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_REF_LIST.xml	Thu Mar 03 16:17:44 2011 +0100
@@ -163,4 +163,16 @@
 <!--FF8081812DB867FE012DB86CD07D0017-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--FF8081812DB867FE012DB86CD07D0017--></AD_REF_LIST>
 
+<!--FF8081812E7BEED8012E7C2FCFB30063--><AD_REF_LIST>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <AD_REF_LIST_ID><![CDATA[FF8081812E7BEED8012E7C2FCFB30063]]></AD_REF_LIST_ID>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <VALUE><![CDATA[OBUIAPP_RecentViewList]]></VALUE>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <NAME><![CDATA[Recent views shown in the workspace]]></NAME>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <DESCRIPTION><![CDATA[Recent views shown in the workspace]]></DESCRIPTION>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <AD_REFERENCE_ID><![CDATA[A26BA480E2014707B47257024C3CBFF7]]></AD_REFERENCE_ID>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E7BEED8012E7C2FCFB30063--></AD_REF_LIST>
+
 </data>
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-application-menu.js	Thu Mar 03 15:36:30 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-application-menu.js	Thu Mar 03 16:17:44 2011 +0100
@@ -138,6 +138,7 @@
     } else if (item.externalUrl) {
       selectedView = {viewId: 'OBExternalPage', contentsURL: item.externalUrl, id: item.externalUrl, command: 'DEFAULT', tabTitle: item.title};
     }
+    selectedView.icon = item.icon;
     selectedView.type = item.type;
     OB.RecentUtilities.addRecent('UINAVBA_MenuRecentList', selectedView);
     OB.Layout.ViewManager.openView(selectedView.viewId, selectedView);
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-recent-utilities.js	Thu Mar 03 15:36:30 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-recent-utilities.js	Thu Mar 03 16:17:44 2011 +0100
@@ -128,4 +128,5 @@
   
   // Initialize RemoteCallManager object
   rcutils = OB.RecentUtilities = new RecentUtilities();
+  OB.RecentUtilitiesClass = RecentUtilities;
 })(OB, isc);
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-manager.js	Thu Mar 03 15:36:30 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-manager.js	Thu Mar 03 16:17:44 2011 +0100
@@ -38,13 +38,17 @@
   var tabSet = M.TabSet;
   
   function ViewManager(){
+    // keep the last 5 opened views
+    this.recentManager.recentNum = 5;
   }
   
   ViewManager.prototype = {
   
-    // if true then certain functions are disab
+    // if true then certain functions are disabled
     inStateHandling: false,
     
+    recentManager: new OB.RecentUtilitiesClass(),
+    
     // ** {{ ViewManager.views }} **
     // Collection of opened views
     views: {
@@ -209,6 +213,16 @@
     
       params = params || {};
       
+      // only add closable views to the recent items, this prevents the workspace
+      // view from being displayed, explicitly doing !== false to catch 
+      // views which don't have this set at all
+      if (params.canClose !== false) {
+        // add and set a default icon
+        vmgr.recentManager.addRecent('OBUIAPP_RecentViewList', 
+            isc.addProperties({icon: '[SKINIMG]../../org.openbravo.client.application/images/application-menu/iconWindow.png'}, 
+                params));
+      }
+      
       //
       // Returns the function implementation of a View
       //
--- a/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js	Thu Mar 03 15:36:30 2011 +0100
+++ b/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js	Thu Mar 03 16:17:44 2011 +0100
@@ -115,7 +115,7 @@
     this.setRecentList(recentViewsLinksLayout);
 
     OB.PropertyStore.addListener(function(propertyName, currentValue, newValue){
-      if (propertyName === 'UINAVBA_RecentLaunchList') {
+      if (propertyName === 'OBUIAPP_RecentViewList') {
         me.setRecentList(recentViewsLinksLayout);
       }
     });
@@ -337,12 +337,12 @@
     layout.removeMembers(layout.members);
     
     // reads the list of recents and displays them
-    recentList = OB.RecentUtilities.getRecentValue('UINAVBA_RecentLaunchList');
+    recentList = OB.Layout.ViewManager.recentManager.getRecentValue('OBUIAPP_RecentViewList');
     if (recentList && recentList.length > 0) {
     
       handleClickFunction = function(){
         if (this.updateRecent) {
-          OB.RecentUtilities.addRecent('UINAVBA_RecentLaunchList', this.recent);
+          OB.RecentUtilities.addRecent('OBUIAPP_RecentViewList', this.recent);
         }
         if (this.recent.viewId) {
           OB.Layout.ViewManager.openView(this.recent.viewId, this.recent);
@@ -384,7 +384,7 @@
           });
           entryLayout.addMember(lbl);
           // if a standard window then show the new icon
-          if (recent.tabId && !recent.singleRecord && !recent.readOnly) {
+          if (recent.windowId && !recent.singleRecord && !recent.readOnly) {
             // make a copy
             newRecent = isc.addProperties({}, recent);
             newRecent.command = 'NEW';