RESOLVED - # 1596: don't show mail in preview on right click
authorPhilipp Schüle <p.schuele@metaways.de>
Wed, 2 Sep 2009 14:08:36 +0000 (14:08 +0000)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 2 Sep 2009 14:08:36 +0000 (14:08 +0000)
http://www.tine20.org/bugtracker/view.php?id=1596

- renamed details panel
- added config option to grid if details panel should be updated on context menu
- added details panel to extdoc

git-svn-id: file:///www/metaways/svn.tine20.org/repo/trunk@10291 8d11cdf3-9d2f-0410-bbb5-e098f187f06b

docs/ext-doc.xml
tine20/Addressbook/js/ContactGridDetailsPanel.js
tine20/Felamimail/js/FelamimailGridDetailsPanel.js
tine20/Felamimail/js/FelamimailGridPanel.js
tine20/RequestTracker/js/TicketGridPanel.js
tine20/Timetracker/js/TimesheetGridPanel.js
tine20/Tinebase/js/widgets/app/GridPanel.js
tine20/Tinebase/js/widgets/grid/DetailsPanel.js

index c1a5455..9b586ea 100644 (file)
@@ -56,6 +56,7 @@
         <source src="../tine20/Tinebase/js/data/RecordStore.js"/>\r
         <source src="../tine20/Tinebase/js/data/RecordProxy.js"/>\r
         <source src="../tine20/Tinebase/js/widgets/app/GridPanel.js"/>\r
+        <source src="../tine20/Tinebase/js/widgets/grid/DetailsPanel.js"/>\r
         <source src="../tine20/Tinebase/js/widgets/form/" match="*.js"/>\r
         <source src="../tine20/Addressbook/js/ContactGrid.js"/>\r
         <source src="../tine20/Admin/js/UserEditDialog.js"/>\r
index c5365ef..ec17f49 100644 (file)
@@ -16,9 +16,9 @@ Ext.namespace('Tine.Addressbook');
  * the details panel (shows contact details)
  * 
  * @class Tine.Felamimail.GridDetailsPanel
- * @extends Tine.widgets.grid.DetailsPanel
+ * @extends Tine.Tinebase.widgets.grid.DetailsPanel
  */
-Tine.Addressbook.ContactGridDetailsPanel = Ext.extend(Tine.widgets.grid.DetailsPanel, {
+Tine.Addressbook.ContactGridDetailsPanel = Ext.extend(Tine.Tinebase.widgets.grid.DetailsPanel, {
     
     il8n: null,
     felamimail: false,
index 2a0c267..39bedf3 100644 (file)
@@ -14,7 +14,7 @@ Ext.namespace('Tine.Felamimail');
 /**
  * @namespace   Tine.Felamimail
  * @class       Tine.Felamimail.GridDetailsPanel
- * @extends     Tine.widgets.grid.DetailsPanel
+ * @extends     Tine.Tinebase.widgets.grid.DetailsPanel
  * 
  * <p>Message Grid Details Panel</p>
  * <p>the details panel (shows message content)</p>
@@ -34,7 +34,7 @@ Ext.namespace('Tine.Felamimail');
  * @constructor
  * Create a new Tine.Felamimail.GridDetailsPanel
  */
- Tine.Felamimail.GridDetailsPanel = Ext.extend(Tine.widgets.grid.DetailsPanel, {
+ Tine.Felamimail.GridDetailsPanel = Ext.extend(Tine.Tinebase.widgets.grid.DetailsPanel, {
     
     /**
      * config
index 0614a52..fdf9d08 100644 (file)
@@ -24,6 +24,7 @@ Ext.namespace('Tine.Felamimail');
  * TODO         add show source code function
  * TODO         make doubleclick work again: show mail in new window (no edit dialog)
  * TODO         add pdf export
+ * TODO         enable preview panel update after ctx menu itemclick (only for non-delete actions)?
  * </pre></p>
  * 
  * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
@@ -67,6 +68,8 @@ Tine.Felamimail.GridPanel = Ext.extend(Tine.Tinebase.widgets.app.GridPanel, {
         enableDragDrop: true,
         ddGroup: 'mailToTreeDDGroup'
     },
+    // we don't want to update the preview panel on context menu
+    updateDetailsPanelOnCtxMenu: false,
     
     /**
      * Return CSS class to apply to rows depending upon flags
index f444bee..ef58cd9 100644 (file)
     },
     
     initDetailsPanel: function() {
-        this.detailsPanel = new Tine.widgets.grid.DetailsPanel({
+        this.detailsPanel = new Tine.Tinebase.widgets.grid.DetailsPanel({
             defaultHeight: 375,
             gridpanel: this,
             currentId: null,
index 7cecd0a..b53acaa 100644 (file)
@@ -289,7 +289,7 @@ Tine.Timetracker.TimesheetGridPanel = Ext.extend(Tine.Tinebase.widgets.app.GridP
     },
     
     initDetailsPanel: function() {
-        this.detailsPanel = new Tine.widgets.grid.DetailsPanel({
+        this.detailsPanel = new Tine.Tinebase.widgets.grid.DetailsPanel({
             gridpanel: this,
             
             // use default Tpl for default and multi view
index 9f70800..54f1dad 100644 (file)
@@ -87,7 +87,7 @@ Tine.Tinebase.widgets.app.GridPanel = Ext.extend(Ext.Panel, {
         limit: 50
     },
     /**
-     * @cfg {Tine.widgets.grid.DetailsPanel} detailsPanel
+     * @cfg {Tine.Tinebase.widgets.grid.DetailsPanel} detailsPanel
      * if set, it becomes rendered in region south 
      */
     detailsPanel: null,
@@ -111,8 +111,20 @@ Tine.Tinebase.widgets.app.GridPanel = Ext.extend(Ext.Panel, {
      * specialised strings for delete action button
      */
     i18nDeleteActionText: null,
+
+    /**
+     * @cfg {Bool} i18nDeleteRecordAction 
+     * update details panel if context menu is shown
+     */
+    updateDetailsPanelOnCtxMenu: true,
     
     /**
+     * @type Bool
+     * @property updateOnSelectionChange
+     */
+    updateOnSelectionChange: false,
+
+    /**
      * @type Ext.Toolbar
      * @property actionToolbar
      */
@@ -313,7 +325,9 @@ Tine.Tinebase.widgets.app.GridPanel = Ext.extend(Ext.Panel, {
         });
         this.selectionModel.on('selectionchange', function(sm) {
             Tine.widgets.actionUpdater(sm, this.actions, this.recordClass.getMeta('containerProperty'), !this.evalGrants);
-            
+            if (this.updateOnSelectionChange && this.detailsPanel) {
+                this.detailsPanel.onDetailsUpdate(sm);
+            }
         }, this);
         
         // we allways have a paging toolbar
@@ -385,11 +399,16 @@ Tine.Tinebase.widgets.app.GridPanel = Ext.extend(Ext.Panel, {
         
         this.grid.on('rowcontextmenu', function(grid, row, e) {
             e.stopEvent();
-            if(!grid.getSelectionModel().isSelected(row)) {
-                grid.getSelectionModel().selectRow(row);
+            var selModel = grid.getSelectionModel();
+            if(!selModel.isSelected(row)) {
+                // disable preview update if config option is set to false
+                this.updateOnSelectionChange = this.updateDetailsPanelOnCtxMenu;
+                selModel.selectRow(row);
             }
             
             this.contextMenu.showAt(e.getXY());
+            // reset preview update
+            this.updateOnSelectionChange = true;
         }, this);
         
     },
index e650d40..edeeb20 100644 (file)
@@ -3,50 +3,86 @@
  * 
  * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
  * @author      Cornelius Weiss <c.weiss@metaways.de>
- * @copyright   Copyright (c) 2007-2008 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @copyright   Copyright (c) 2007-2009 Metaways Infosystems GmbH (http://www.metaways.de)
  * @version     $Id$
  *
  */
  
-Ext.namespace('Tine.widgets', 'Tine.widgets.grid');
+Ext.namespace('Tine.Tinebase.widgets', 'Tine.Tinebase.widgets.grid');
 
 /**
- * details panel
+ * grid details panel
  * 
- * @class Tine.widgets.grid.DetailsPanel
- * @extends Ext.Panel
+ * @namespace   Tine.Tinebase.widgets.grid
+ * @class       Tine.Tinebase.widgets.grid.DetailsPanel
+ * @extends     Ext.Panel
+ * 
+ * <p>Grid Details Panel</p>
+ * <p><pre>
+ * </pre></p>
+ * 
+ * @license     http://www.gnu.org/licenses/agpl.html AGPL Version 3
+ * @author      Cornelius Weiss <c.weiss@metaways.de>
+ * @copyright   Copyright (c) 2007-2009 Metaways Infosystems GmbH (http://www.metaways.de)
+ * @version     $Id$
+ * 
+ * @param       {Object} config
+ * @constructor
+ * Create a new Tine.Tinebase.widgets.grid.DetailsPanel
  */
-Tine.widgets.grid.DetailsPanel = Ext.extend(Ext.Panel, {
+Tine.Tinebase.widgets.grid.DetailsPanel = Ext.extend(Ext.Panel, {
     /**
-     * @cfg {Number}
+     * @cfg {Number} defaultHeight
      * default Heights
      */
     defaultHeight: 125,
     
     /**
-     * @property {Tine.Tinebase.widgets.app.GridPanel}
+     * @property grid
+     * @type Tine.Tinebase.widgets.app.GridPanel
      */
     grid: null,
 
     /**
-     * @property {}
+     * @property record
+     * @type Tine.Tinebase.data.Record
      */
     record: null,
     
+    /**
+     * @private
+     */
     border: false,
     autoScroll: true,
     layout: 'fit',
     
+    /**
+     * update template
+     * 
+     * @param {Tine.Tinebase.data.Record} record
+     * @param {Mixed} body
+     */
     updateDetails: function(record, body) {
         this.tpl.overwrite(body, record.data);
     },
     
+    /**
+     * show default template
+     * 
+     * @param {Mixed} body
+     */
     showDefault: function(body) {
         if (this.defaultTpl) {
             this.defaultTpl.overwrite(body);
         }
     },
     
+    /**
+     * show template for multiple rows
+     * 
+     * @param {Ext.grid.RowSelectionModel} sm
+     * @param {Mixed} body
+     */
     showMulti: function(sm, body) {
         if (this.multiTpl) {
             this.multiTpl.overwrite(body);
@@ -54,15 +90,20 @@ Tine.widgets.grid.DetailsPanel = Ext.extend(Ext.Panel, {
     },
     
     /**
+     * bind grid to details panel
      * 
-     * @param grid
+     * @param {Tine.Tinebase.widgets.app.GridPanel} grid
      */
     doBind: function(grid) {
         this.grid = grid;
         
+        /*
         grid.getSelectionModel().on('selectionchange', function(sm) {
-            this.onDetailsUpdate(sm);
+            if (this.updateOnSelectionChange) {
+                this.onDetailsUpdate(sm);
+            }
         }, this);
+        */
         
         grid.store.on('load', function(store) {
             this.onDetailsUpdate(grid.getSelectionModel());
@@ -70,8 +111,9 @@ Tine.widgets.grid.DetailsPanel = Ext.extend(Ext.Panel, {
     },
     
     /**
+     * update details panel
      * 
-     * @param sm selection model
+     * @param {Ext.grid.RowSelectionModel} sm
      */
     onDetailsUpdate: function(sm) {
         var count = sm.getCount();
@@ -87,6 +129,11 @@ Tine.widgets.grid.DetailsPanel = Ext.extend(Ext.Panel, {
         }
     },
     
+    /**
+     * get load mask
+     * 
+     * @return {Ext.LoadMask}
+     */
     getLoadMask: function() {
         if (! this.loadMask) {
             this.loadMask = new Ext.LoadMask(this.el);
@@ -94,5 +141,4 @@ Tine.widgets.grid.DetailsPanel = Ext.extend(Ext.Panel, {
         
         return this.loadMask;
     }
-    
-});
\ No newline at end of file
+});