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

From: Date: Sat, 12 Dec 2009 17:34:37 +0000
Subject: svn: /web/doc-editor/trunk/js/ui/component/ PendingCommitGrid.js PendingTranslateGrid.js
Groups: php.doc.web 
Request: Send a blank email to doc-web+get-1303@lists.php.net to get a copy of this message
yannick Sat, 12 Dec 2009 17:34:37 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=292039 Log: Add openFile method to PendingTranslate and use it into PendingCommit to edit a file from this module Changed paths: U web/doc-editor/trunk/js/ui/component/PendingCommitGrid.js U web/doc-editor/trunk/js/ui/component/PendingTranslateGrid.js Modified: web/doc-editor/trunk/js/ui/component/PendingCommitGrid.js =================================================================== --- web/doc-editor/trunk/js/ui/component/PendingCommitGrid.js 2009-12-12 16:22:32 UTC (rev 292038) +++ web/doc-editor/trunk/js/ui/component/PendingCommitGrid.js 2009-12-12 17:34:37 UTC (rev 292039) @@ -327,7 +327,7 @@ { scope : this, text : '<b>'+_('View in a new Tab')+'</b>', - iconCls : 'iconView', + iconCls : 'PendingCommit', handler : function() { this.grid.fireEvent('rowdblclick', @@ -377,7 +377,18 @@ { Ext.apply(this, { - items: [{ + items: [ + { + scope : this, + text : '<b>'+_('Edit in a new Tab')+'</b>', + iconCls : 'PendingCommit', + handler : function() + { + this.grid.fireEvent('rowdblclick', + this.grid, this.rowIdx, this.event + ); + } + }, '-',{ scope : this, text : _('Clear this change'), iconCls : 'iconPageDelete', @@ -461,6 +472,24 @@ FileName = storeRecord.data.name, FileLang, tmp; + if (FileType === 'new') { + + tmp = FilePath.split('/'); + FileLang = tmp[0]; + tmp.shift(); + + FilePath = "/" + tmp.join('/'); + + // Find the id of this row into StaleFileGrid.store and open it ! + ui.component.PendingTranslateGrid.getInstance().store.each(function(row) { + + if( (row.data['path']) === FilePath && row.data['name'] === FileName ) { + ui.component.PendingTranslateGrid.getInstance().openFile(row.data.id); + return; + } + }); + } + if (FileType === 'update') { tmp = FilePath.split('/'); @@ -479,6 +508,7 @@ if( (row.data['path']) === FilePath && row.data['name'] === FileName ) { ui.component.StaleFileGrid.getInstance().openFile(row.data.id); + return; } }); } Modified: web/doc-editor/trunk/js/ui/component/PendingTranslateGrid.js =================================================================== --- web/doc-editor/trunk/js/ui/component/PendingTranslateGrid.js 2009-12-12 16:22:32 UTC (rev 292038) +++ web/doc-editor/trunk/js/ui/component/PendingTranslateGrid.js 2009-12-12 17:34:37 UTC (rev 292039) @@ -130,51 +130,57 @@ }, rowdblclick : function(grid, rowIndex, e) { - var storeRecord = grid.store.getAt(rowIndex), - FilePath = storeRecord.data.path, - FileName = storeRecord.data.name, - FileID = Ext.util.md5('FNU-' + phpDoc.userLang + FilePath + FileName), - diff = ''; + this.openFile(grid.store.getAt(rowIndex).data.id); + } + }, - // Render only if this tab don't exist yet - if (!Ext.getCmp('main-panel').findById('FNT-' + FileID)) { + openFile : function(rowId) + { - Ext.getCmp('main-panel').add( - { - id : 'FNT-' + FileID, - layout : 'border', - title : FileName, - originTitle : FileName, - iconCls : 'iconTabNeedTranslate', - closable : true, - defaults : { split : true }, - tabTip : String.format( - _('Need Translate: in {0}'), FilePath - ), - items : [new ui.component.FilePanel( - { - id : 'FNT-TRANS-PANEL-' + FileID, - region : 'center', - title : _('New File: ') + phpDoc.userLang + FilePath + FileName, - isTrans : true, - prefix : 'FNT', - ftype : 'TRANS', - fid : FileID, - fpath : FilePath, - fname : FileName, - lang : phpDoc.userLang, - parser : 'xml', - storeRecord : storeRecord, - syncScrollCB : false - }) - ] - }); - Ext.getCmp('main-panel').setActiveTab('FNT-' + FileID); + var storeRecord = this.store.getById(rowId), + FilePath = storeRecord.data.path, + FileName = storeRecord.data.name, + FileID = Ext.util.md5('FNU-' + phpDoc.userLang + FilePath + FileName), + diff = ''; - } else { - // This tab already exist. We focus it. - Ext.getCmp('main-panel').setActiveTab('FNT-' + FileID); - } + // Render only if this tab don't exist yet + if (!Ext.getCmp('main-panel').findById('FNT-' + FileID)) { + + Ext.getCmp('main-panel').add( + { + id : 'FNT-' + FileID, + layout : 'border', + title : FileName, + originTitle : FileName, + iconCls : 'iconTabNeedTranslate', + closable : true, + defaults : { split : true }, + tabTip : String.format( + _('Need Translate: in {0}'), FilePath + ), + items : [new ui.component.FilePanel( + { + id : 'FNT-TRANS-PANEL-' + FileID, + region : 'center', + title : _('New File: ') + phpDoc.userLang + FilePath + FileName, + isTrans : true, + prefix : 'FNT', + ftype : 'TRANS', + fid : FileID, + fpath : FilePath, + fname : FileName, + lang : phpDoc.userLang, + parser : 'xml', + storeRecord : storeRecord, + syncScrollCB : false + }) + ] + }); + Ext.getCmp('main-panel').setActiveTab('FNT-' + FileID); + + } else { + // This tab already exist. We focus it. + Ext.getCmp('main-panel').setActiveTab('FNT-' + FileID); } },

« previous php.doc.web (#1303) next »