svn: /web/doc-editor/trunk/js/ui/cmp/ PatchesTreeGrid.js WorkTreeGrid.js
[email protected] (Yannick Torres)
| Newsgroups | php.doc.web |
|---|---|
| Message-ID | <[email protected]> |
yannick Wed, 26 May 2010 20:52:54 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=299826
Log:
Use the same method to display a diff from work & patches TreeGrid
Changed paths:
U web/doc-editor/trunk/js/ui/cmp/PatchesTreeGrid.js
U web/doc-editor/trunk/js/ui/cmp/WorkTreeGrid.js
svn-diffs-299826.txt
(text/x-diff, 8.6 KB)
Modified: web/doc-editor/trunk/js/ui/cmp/PatchesTreeGrid.js
===================================================================
--- web/doc-editor/trunk/js/ui/cmp/PatchesTreeGrid.js 2010-05-26 20:45:54 UTC (rev 299825)
+++ web/doc-editor/trunk/js/ui/cmp/PatchesTreeGrid.js 2010-05-26 20:52:54 UTC (rev 299826)
@@ -219,48 +219,7 @@
iconCls: 'iconViewDiff',
hidden: (FileType == 'delete' || FileType == 'new'),
handler: function(){
- // Render only if this tab don't exist yet
- if (!Ext.getCmp('main-panel').findById('diff_panel_pending_' + FileID)) {
-
- // Add tab for the diff
- Ext.getCmp('main-panel').add({
- xtype: 'panel',
- id: 'diff_panel_pending_' + FileID,
- iconCls: 'iconTabLink',
- title: _('Diff'),
- tabTip: String.format(_('Diff for file: {0}'), FilePath + FileName),
- closable: true,
- autoScroll: true,
- html: '<div id="diff_content_pending_' + FileID + '" class="diff-content"></div>'
- });
-
- // We need to activate HERE this tab, otherwise, we can mask it (el() is not defined)
- Ext.getCmp('main-panel').setActiveTab('diff_panel_pending_' + FileID);
-
- Ext.get('diff_panel_pending_' + FileID).mask('<img src="themes/img/loading.gif" style="vertical-align: middle;" /> ' +
- _('Please, wait...'));
-
- // Load diff data
- XHR({
- scope: this,
- params: {
- task: 'getDiff',
- DiffType: 'file',
- FilePath: FilePath,
- FileName: FileName
- },
- success: function(r){
- var o = Ext.util.JSON.decode(r.responseText);
-
- // We display in diff div
- Ext.get('diff_content_pending_' + FileID).dom.innerHTML = o.content;
- Ext.get('diff_panel_pending_' + FileID).unmask();
- }
- });
- }
- else {
- Ext.getCmp('main-panel').setActiveTab('diff_panel_pending_' + FileID);
- }
+ ui.cmp.WorkTreeGrid.getInstance().displayDiff(FileID, FilePath, FileName);
}
}, {
text: _('Download the diff as a patch'),
@@ -388,16 +347,7 @@
baseParams: {
module: 'PatchesForReview'
}
- }
- /*
- tbar: [{
- scope: this,
- iconCls: 'iconRefresh',
- handler: function(){
- this.getRootNode().reload();
- }
- }]
- */
+ }
});
ui.cmp.PatchesTreeGrid.superclass.initComponent.call(this);
Modified: web/doc-editor/trunk/js/ui/cmp/WorkTreeGrid.js
===================================================================
--- web/doc-editor/trunk/js/ui/cmp/WorkTreeGrid.js 2010-05-26 20:45:54 UTC (rev 299825)
+++ web/doc-editor/trunk/js/ui/cmp/WorkTreeGrid.js 2010-05-26 20:52:54 UTC (rev 299826)
@@ -412,52 +412,12 @@
}]
}
}, '-', {
+ scope: this,
text: _('View diff'),
iconCls: 'iconViewDiff',
hidden: (FileType == 'delete' || FileType == 'new'),
handler: function(){
- // Render only if this tab don't exist yet
- if (!Ext.getCmp('main-panel').findById('diff_panel_pending_' + FileID)) {
-
- // Add tab for the diff
- Ext.getCmp('main-panel').add({
- xtype: 'panel',
- id: 'diff_panel_pending_' + FileID,
- iconCls: 'iconTabLink',
- title: _('Diff'),
- tabTip: String.format(_('Diff for file: {0}'), FilePath + FileName),
- closable: true,
- autoScroll: true,
- html: '<div id="diff_content_pending_' + FileID + '" class="diff-content"></div>'
- });
-
- // We need to activate HERE this tab, otherwise, we can mask it (el() is not defined)
- Ext.getCmp('main-panel').setActiveTab('diff_panel_pending_' + FileID);
-
- Ext.get('diff_panel_pending_' + FileID).mask('<img src="themes/img/loading.gif" style="vertical-align: middle;" /> ' +
- _('Please, wait...'));
-
- // Load diff data
- XHR({
- scope: this,
- params: {
- task: 'getDiff',
- DiffType: 'file',
- FilePath: FilePath,
- FileName: FileName
- },
- success: function(r){
- var o = Ext.util.JSON.decode(r.responseText);
-
- // We display in diff div
- Ext.get('diff_content_pending_' + FileID).dom.innerHTML = o.content;
- Ext.get('diff_panel_pending_' + FileID).unmask();
- }
- });
- }
- else {
- Ext.getCmp('main-panel').setActiveTab('diff_panel_pending_' + FileID);
- }
+ ui.cmp.WorkTreeGrid.getInstance().displayDiff(FileID, FilePath, FileName);
}
}, {
text: _('Download the diff as a patch'),
@@ -618,16 +578,6 @@
module: 'workInProgress'
}
}
- /*
- tbar: [{
- scope: this,
- iconCls: 'iconRefresh',
- handler: function(){
- this.getRootNode().reload();
- }
- }]
- */
-
});
ui.cmp.WorkTreeGrid.superclass.initComponent.call(this);
@@ -646,6 +596,51 @@
this.updateColumnWidths();
},
+ displayDiff: function(FileID, FilePath, FileName) {
+ // Render only if this tab don't exist yet
+ if (!Ext.getCmp('main-panel').findById('diff_panel_pending_' + FileID)) {
+
+ // Add tab for the diff
+ Ext.getCmp('main-panel').add({
+ xtype: 'panel',
+ id: 'diff_panel_pending_' + FileID,
+ iconCls: 'iconTabLink',
+ title: _('Diff'),
+ tabTip: String.format(_('Diff for file: {0}'), FilePath + FileName),
+ closable: true,
+ autoScroll: true,
+ html: '<div id="diff_content_pending_' + FileID + '" class="diff-content"></div>'
+ });
+
+ // We need to activate HERE this tab, otherwise, we can mask it (el() is not defined)
+ Ext.getCmp('main-panel').setActiveTab('diff_panel_pending_' + FileID);
+
+ Ext.get('diff_panel_pending_' + FileID).mask('<img src="themes/img/loading.gif" style="vertical-align: middle;" /> ' +
+ _('Please, wait...'));
+
+ // Load diff data
+ XHR({
+ scope: this,
+ params: {
+ task: 'getDiff',
+ DiffType: 'file',
+ FilePath: FilePath,
+ FileName: FileName
+ },
+ success: function(r){
+ var o = Ext.util.JSON.decode(r.responseText);
+
+ // We display in diff div
+ Ext.get('diff_content_pending_' + FileID).dom.innerHTML = o.content;
+ Ext.get('diff_panel_pending_' + FileID).unmask();
+ }
+ });
+ }
+ else {
+ Ext.getCmp('main-panel').setActiveTab('diff_panel_pending_' + FileID);
+ }
+ },
+
delRecord: function(fid){
var rootNode = this.getRootNode();