svn: /web/doc-editor/trunk/js/ui/component/ BugsGrid.js LocalMailGrid.js

[email protected] (Yannick Torres)
Newsgroups php.doc.web
Message-ID <[email protected]>
yannick                                  Sat, 12 Dec 2009 20:41:55 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=292048

Log:
Fix bug when we try to load a tab witch is already opened

Changed paths:
    U   web/doc-editor/trunk/js/ui/component/BugsGrid.js
    U   web/doc-editor/trunk/js/ui/component/LocalMailGrid.js

Modified: web/doc-editor/trunk/js/ui/component/BugsGrid.js
===================================================================
--- web/doc-editor/trunk/js/ui/component/BugsGrid.js	2009-12-12 20:41:17 UTC (rev 292047)
+++ web/doc-editor/trunk/js/ui/component/BugsGrid.js	2009-12-12 20:41:55 UTC (rev 292048)
@@ -102,22 +102,28 @@
                 BugsUrl   = grid.store.getAt(rowIndex).data.link,
                 BugsTitle = grid.store.getAt(rowIndex).data.title;

-            Ext.getCmp('main-panel').add({
-                id         : 'mifp_bugs_' + BugsId,
-                xtype      : 'iframepanel',
-                title      : _('Loading...'),
-                tabTip     : BugsTitle,
-                iconCls    : 'iconBugs',
-                loadMask   : true,
-                defaultSrc : BugsUrl,
-                listeners : {
-                    documentloaded : function(frame)
-                    {
-                        frame.ownerCt.setTitle(Ext.util.Format.substr(BugsTitle, 0, 20) + '...');
+            if (!Ext.getCmp('main-panel').findById('mifp_bugs_' + BugsId)) {
+
+                Ext.getCmp('main-panel').add({
+                    id         : 'mifp_bugs_' + BugsId,
+                    xtype      : 'iframepanel',
+                    title      : _('Loading...'),
+                    tabTip     : BugsTitle,
+                    iconCls    : 'iconBugs',
+                    loadMask   : true,
+                    defaultSrc : BugsUrl,
+                    listeners : {
+                        documentloaded : function(frame)
+                        {
+                            frame.ownerCt.setTitle(Ext.util.Format.substr(BugsTitle, 0, 20) + '...');
+                        }
                     }
-                }
-            });
-            Ext.getCmp('main-panel').setActiveTab('mifp_bugs_' + BugsId);
+                });
+                Ext.getCmp('main-panel').setActiveTab('mifp_bugs_' + BugsId);
+
+            } else {
+                Ext.getCmp('main-panel').setActiveTab('mifp_bugs_' + BugsId);
+            }
         }
     },

@@ -127,7 +133,7 @@
         {
             title : String.format(_('Open bugs for {0}'), 'doc-' + phpDoc.userLang),
             tbar  : [{
-				scope: this,
+                scope: this,
                 tooltip : _('Refresh this grid'),
                 iconCls : 'refresh',
                 handler : function()
@@ -146,8 +152,8 @@
 {
     if (!ui.component._BugsGrid.instance) {
         if (!config) {
-			config = {};
-		}
+            config = {};
+        }
         ui.component._BugsGrid.instance = new ui.component.BugsGrid(config);
     }
     return ui.component._BugsGrid.instance;

Modified: web/doc-editor/trunk/js/ui/component/LocalMailGrid.js
===================================================================
--- web/doc-editor/trunk/js/ui/component/LocalMailGrid.js	2009-12-12 20:41:17 UTC (rev 292047)
+++ web/doc-editor/trunk/js/ui/component/LocalMailGrid.js	2009-12-12 20:41:55 UTC (rev 292048)
@@ -108,24 +108,30 @@
                 MailUrl   = grid.store.getAt(rowIndex).data.link,
                 MailTitle = grid.store.getAt(rowIndex).data.title;

-            Ext.getCmp('main-panel').add({
-                xtype      : 'iframepanel',
-                id         : 'mifp_' + MailId,
-                title      : _('Loading...'),
-                tabTip     : MailTitle,
-                iconCls    : 'home-mailing-title',
-                loadMask   : true,
-                defaultSrc : MailUrl,
-                listeners : {
-                    documentloaded : function(frame)
-                    {
-                        frame.ownerCt.setTitle(
-                            Ext.util.Format.substr(MailTitle, 0, 20) + '...'
-                        );
+            if (!Ext.getCmp('main-panel').findById('mifp_' + MailId)) {
+
+                Ext.getCmp('main-panel').add({
+                    xtype      : 'iframepanel',
+                    id         : 'mifp_' + MailId,
+                    title      : _('Loading...'),
+                    tabTip     : MailTitle,
+                    iconCls    : 'home-mailing-title',
+                    loadMask   : true,
+                    defaultSrc : MailUrl,
+                    listeners : {
+                        documentloaded : function(frame)
+                        {
+                            frame.ownerCt.setTitle(
+                                Ext.util.Format.substr(MailTitle, 0, 20) + '...'
+                            );
+                        }
                     }
-                }
-            });
-            Ext.getCmp('main-panel').setActiveTab('mifp_' + MailId);
+                });
+                Ext.getCmp('main-panel').setActiveTab('mifp_' + MailId);
+
+            } else {
+                Ext.getCmp('main-panel').setActiveTab('mifp_' + MailId);
+            }
         }
     },
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.