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

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

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

Log:
Sub Menu view diff from Stale's file : we can now view the diff of an EN's file AND LANG's file

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

Modified: web/doc-editor/trunk/js/locale/fr.js
===================================================================
--- web/doc-editor/trunk/js/locale/fr.js	2009-11-22 18:57:37 UTC (rev 291145)
+++ web/doc-editor/trunk/js/locale/fr.js	2009-11-22 19:26:14 UTC (rev 291146)
@@ -87,6 +87,8 @@
 i18n["Modified by"] = "Modifié par";
 i18n["No pending for Commit"] = "Aucun commit en attente";
 i18n["Diff"] = "Différence";
+i18n["Diff for file: {0}"] = "Différence pour le fichier : {0}";
+
 i18n["Open all files about {0} extension"] = "Ouvrir tous les fichiers à propos de l'extension <b>{0}</b>";
 i18n["Saving data as a patch..."] = "Sauvegarde des données sous forme de patch";
 i18n["Finding the diff. Please, wait..."] = "Calcul de la différence. Veuillez patienter...";
@@ -103,7 +105,8 @@
 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";
 i18n["You can\'t do this action as anonymous user."] = "Vous ne pouvez pas effectuer cette action avec l'utilisateur anonyme.";
 i18n["Do you want to be alerted ?"] = "Voulez-vous être averti ?";

Modified: web/doc-editor/trunk/js/ui/component/StaleFileGrid.js
===================================================================
--- web/doc-editor/trunk/js/ui/component/StaleFileGrid.js	2009-11-22 18:57:37 UTC (rev 291145)
+++ web/doc-editor/trunk/js/ui/component/StaleFileGrid.js	2009-11-22 19:26:14 UTC (rev 291146)
@@ -128,50 +128,77 @@
             }, {
                 scope   : this,
                 hidden  : this.hideCommit,
-                text    : _('View Diff'),
+                text    : _('View Diff...'),
                 iconCls : 'iconViewDiff',
-                handler : function()
+                menu    : new Ext.menu.Menu({
+                    items: [{
+                        scope: this,
+                        hidden: (this.grid.store.getAt(this.rowIdx).data.needCommitEN === false),
+                        text: String.format(_('... of the {0} file'), 'EN'),
+                        handler: function() {
+                            this.openTab(this.rowIdx, 'en', this.fpath, this.fname);
+                        }
+                    }, {
+                        scope: this,
+                        hidden: (this.grid.store.getAt(this.rowIdx).data.needCommitLang === false),
+                        text: String.format(_('... of the {0} file'), phpDoc.userLang),
+                        handler: function() {
+                            this.openTab(this.rowIdx, phpDoc.userLang, this.fpath, this.fname);
+                        }
+                    }]
+                })
+            }]
+        });
+    },
+
+    openTab: function(rowIdx, lang, fpath, fname) {
+
+        // Render only if this tab don't exist yet
+        if (!Ext.getCmp('main-panel').findById('diff_panel_' + lang + '_' + rowIdx)) {
+
+            // Add tab for the diff
+            Ext.getCmp('main-panel').add({
+                xtype      : 'panel',
+                id         : 'diff_panel_' + lang + '_' + rowIdx,
+                title      : _('Diff'),
+                tabTip     : String.format(_('Diff for file: {0}'), lang+fpath+fname),
+                closable   : true,
+                autoScroll : true,
+                iconCls    : 'iconTabLink',
+                html: '<div id="diff_content_' + lang + '_' + rowIdx +
+                      '" class="diff-content"></div>'
+            });
+            Ext.getCmp('main-panel').setActiveTab('diff_panel_' + lang + '_' + rowIdx);
+
+            Ext.get('diff_panel_' + lang + '_' + rowIdx).mask(
+                '<img src="themes/img/loading.gif" ' +
+                'style="vertical-align: middle;" />' +
+                _('Please, wait...')
+            );
+
+            // Load diff data
+            XHR({
+                params  : {
+                    task     : 'getDiff',
+                    FilePath : lang + fpath,
+                    FileName : fname
+                },
+                success : function(response)
                 {
-                    // Add tab for the diff
-                    Ext.getCmp('main-panel').add({
-                        xtype      : 'panel',
-                        id         : 'diff_panel_' + this.rowIdx,
-                        title      : _('Diff'),
-                        tabTip     : _('Diff'),
-                        closable   : true,
-                        autoScroll : true,
-                        iconCls    : 'iconTabLink',
-                        html: '<div id="diff_content_' + this.rowIdx +
-                              '" class="diff-content"></div>'
-                    });
-                    Ext.getCmp('main-panel').setActiveTab('diff_panel_' + this.rowIdx);
+                    var o = Ext.util.JSON.decode(response.responseText);
+                    // We display in diff div
+                    Ext.get('diff_content_' + lang + '_' + rowIdx).dom.innerHTML = o.content;
+                    Ext.get('diff_panel_' + lang + '_' + rowIdx).unmask();
+                }
+            });

-                    Ext.get('diff_panel_' + this.rowIdx).mask(
-                        '<img src="themes/img/loading.gif" ' +
-                        'style="vertical-align: middle;" />' +
-                        _('Please, wait...')
-                    );
+        } else {
+            // This tab already exist. We focus it.
+            Ext.getCmp('main-panel').setActiveTab('diff_panel_' + lang + '_' + rowIdx);
+        }

-                    // Load diff data
-                    XHR({
-                        scope   : this,
-                        params  : {
-                            task     : 'getDiff',
-                            FilePath : this.lang + 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_' + this.rowIdx).dom.innerHTML = o.content;
-                            Ext.get('diff_panel_' + this.rowIdx).unmask();
-                        }
-                    });
-                }
-            }]
-        });
     }
+
 });
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.