svn: /web/doc-editor/trunk/js/ locale/fr.js ui/component/PendingCommitGrid.js

[email protected] (Yannick Torres)
Newsgroups php.doc.web
Message-ID <[email protected]>
yannick                                  Sun, 22 Nov 2009 19:52:50 +0000

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

Log:
Handle view diff in PendingCommit grid

Changed paths:
    U   web/doc-editor/trunk/js/locale/fr.js
    U   web/doc-editor/trunk/js/ui/component/PendingCommitGrid.js

Modified: web/doc-editor/trunk/js/locale/fr.js
===================================================================
--- web/doc-editor/trunk/js/locale/fr.js	2009-11-22 19:48:03 UTC (rev 291147)
+++ web/doc-editor/trunk/js/locale/fr.js	2009-11-22 19:52:50 UTC (rev 291148)
@@ -105,6 +105,7 @@
 i18n["There is {0} file to close before commit.<br><br>{1}<br/><br/>Would you like I close it for you ?"] = "Il y a {0} fichier à fermer avant de commiter.<br><br>{1}<br/><br/>Voulez-vous que je les ferme pour vous ?";
 i18n["Please, wait until commit..."] = "Veuillez patienter...";
 i18n["Type"] = "Type";
+i18n["View Diff"] = "Voir la différence";
 i18n["View Diff..."] = "Voir la différence...";
 i18n["... of the {0} file"] = "... du fichier {0}";
 i18n["Forbidden"] = "Interdit";

Modified: web/doc-editor/trunk/js/ui/component/PendingCommitGrid.js
===================================================================
--- web/doc-editor/trunk/js/ui/component/PendingCommitGrid.js	2009-11-22 19:48:03 UTC (rev 291147)
+++ web/doc-editor/trunk/js/ui/component/PendingCommitGrid.js	2009-11-22 19:52:50 UTC (rev 291148)
@@ -233,41 +233,49 @@
                     iconCls : 'iconViewDiff',
                     handler : function()
                     {
-                        // Add tab for the diff
-                        Ext.getCmp('main-panel').add({
-                            xtype      : 'panel',
-                            id         : 'diff_panel_' + this.rowIdx,
-                            iconCls    : 'iconTabLink',
-                            title      : _('Diff'),
-                            tabTip     : _('Diff'),
-                            closable   : true,
-                            autoScroll : true,
-                            html       : '<div id="diff_content_' + this.rowIdx + '" class="diff-content"></div>'
-                        });
-                        Ext.getCmp('main-panel').setActiveTab('diff_panel_' + this.rowIdx);

-                        Ext.get('diff_panel_' + this.rowIdx).mask(
-                            '<img src="themes/img/loading.gif" style="vertical-align: middle;" /> ' +
-                            _('Please, wait...')
-                        );
+                        // Render only if this tab don't exist yet
+                        if (!Ext.getCmp('main-panel').findById('diff_panel_pending_' + this.rowIdx)) {

-                        // Load diff data
-                        XHR({
-                            scope   : this,
-                            params  : {
-                                task     : 'getDiff',
-                                FilePath : this.fpath,
-                                FileName : this.fname
-                            },
-                            success : function(response)
-                            {
-                                var o = Ext.util.JSON.decode(response.responseText);
+                            // Add tab for the diff
+                            Ext.getCmp('main-panel').add({
+                                xtype      : 'panel',
+                                id         : 'diff_panel_pending_' + this.rowIdx,
+                                iconCls    : 'iconTabLink',
+                                title      : _('Diff'),
+                                tabTip     : String.format(_('Diff for file: {0}'), this.fpath+this.fname),
+                                closable   : true,
+                                autoScroll : true,
+                                html       : '<div id="diff_content_pending_' + this.rowIdx + '" class="diff-content"></div>'
+                            });
+                            Ext.getCmp('main-panel').setActiveTab('diff_panel_pending_' + this.rowIdx);

-                                // We display in diff div
-                                Ext.get('diff_content_' + this.rowIdx).dom.innerHTML = o.content;
-                                Ext.get('diff_panel_' + this.rowIdx).unmask();
-                            }
-                        });
+                            Ext.get('diff_panel_pending_' + this.rowIdx).mask(
+                                '<img src="themes/img/loading.gif" style="vertical-align: middle;" /> ' +
+                                _('Please, wait...')
+                            );
+
+                            // Load diff data
+                            XHR({
+                                scope   : this,
+                                params  : {
+                                    task     : 'getDiff',
+                                    FilePath : this.fpath,
+                                    FileName : this.fname
+                                },
+                                success : function(response)
+                                {
+                                    var o = Ext.util.JSON.decode(response.responseText);
+
+                                    // We display in diff div
+                                    Ext.get('diff_content_pending_' + this.rowIdx).dom.innerHTML = o.content;
+                                    Ext.get('diff_panel_pending_' + this.rowIdx).unmask();
+                                }
+                            });
+                        } else {
+                            // This tab already exist. We focus it.
+                            Ext.getCmp('main-panel').setActiveTab('diff_panel_pending_' + this.rowIdx);
+                        }
                     }
                 }, {
                     scope   : this,
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.