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

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

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

Log:
Add openFile method to PendingReviewedGrid & ErrorFileGrid and use it into PendingCommitGrid to open a file on double-click on it

Changed paths:
    U   web/doc-editor/trunk/js/ui/component/ErrorFileGrid.js
    U   web/doc-editor/trunk/js/ui/component/PendingCommitGrid.js
    U   web/doc-editor/trunk/js/ui/component/PendingReviewGrid.js
svn-diffs-292055.txt (text/x-diff, 27 KB)
Modified: web/doc-editor/trunk/js/ui/component/ErrorFileGrid.js
===================================================================
--- web/doc-editor/trunk/js/ui/component/ErrorFileGrid.js	2009-12-12 22:03:50 UTC (rev 292054)
+++ web/doc-editor/trunk/js/ui/component/ErrorFileGrid.js	2009-12-12 23:51:49 UTC (rev 292055)
@@ -206,7 +206,7 @@

             var FilePath = grid.store.getAt(rowIndex).data.path,
                 FileName = grid.store.getAt(rowIndex).data.name,
-				tmp;
+                tmp;

             grid.getSelectionModel().selectRow(rowIndex);

@@ -222,136 +222,142 @@
         },
         rowdblclick : function(grid, rowIndex, e)
         {
-            var storeRecord = grid.store.getAt(rowIndex),
-                FilePath    = storeRecord.data.path,
-                FileName    = storeRecord.data.name,
-                FileID      = Ext.util.md5('FE-' + phpDoc.userLang + FilePath + FileName),
-                error       = [];
+            this.openFile(grid.store.getAt(rowIndex).data.id);
+        }
+    },

-            // Render only if this tab don't exist yet
-            if (!Ext.getCmp('main-panel').findById('FE-' + FileID)) {
+    openFile : function(rowId)
+    {

-                // Find all error for this file to pass to error_type.php page
-                error = [];
+        var storeRecord = this.store.getById(rowId),
+            FilePath    = storeRecord.data.path,
+            FileName    = storeRecord.data.name,
+            FileID      = Ext.util.md5('FE-' + phpDoc.userLang + FilePath + FileName),
+            error       = [];

-                grid.store.each(function(record)
-                {
-                    if ( record.data.path === FilePath && record.data.name === FileName && !error[record.data.type] ) {
-                        error.push(record.data.type);
-                    }
-                });
+        // Render only if this tab don't exist yet
+        if (!Ext.getCmp('main-panel').findById('FE-' + FileID)) {

-                Ext.getCmp('main-panel').add({
-                    id          : 'FE-' + FileID,
-                    title       : FileName,
-                    layout      : 'border',
-                    iconCls     : 'iconTabError',
-                    closable    : true,
-                    originTitle : FileName,
-                    defaults    : { split : true },
-                    tabTip      : String.format(
-                        _('File with error : in {0}'), FilePath
-                    ),
-                    items : [
-                        {
-                            xtype       : 'panel',
-                            id          : 'FE-error-desc-' + FileID,
-                            region      : 'north',
-                            layout      : 'fit',
-                            title       : _('Error description'),
-                            height      : 150,
-                            collapsible : true,
-                            collapsed   : true,
-                            items : {
-                                xtype      : 'iframepanel',
-                                id         : 'FE-error-type-' + FileID,
-                                loadMask   : true,
-                                defaultSrc : './error?dir=' + FilePath +
-                                                    '&file=' + FileName
-                            }
-                        }, {
-                            region      : 'west',
-                            xtype       : 'panel',
-                            title       : _('VCSLog'),
-                            collapsible : true,
-                            collapsed   : true,
-                            layout      : 'fit',
-                            bodyBorder  : false,
-                            width       : 375,
-                            items       : {
-                                xtype       : 'tabpanel',
-                                activeTab   : 0,
-                                tabPosition : 'bottom',
-                                defaults    : { autoScroll : true },
-                                items       : [
-                                    new ui.component.VCSLogGrid({
-                                        layout    : 'fit',
-                                        title     : phpDoc.userLang,
-                                        prefix    : 'FE-LANG',
-                                        fid       : FileID,
-                                        fpath     : phpDoc.userLang + FilePath,
-                                        fname     : FileName,
-                                        loadStore : (phpDoc.userConf.conf_error_displaylog === 'true')
-                                    }),
-                                    new ui.component.VCSLogGrid({
-                                        layout    : 'fit',
-                                        title     : 'en',
-                                        prefix    : 'FE-EN',
-                                        fid       : FileID,
-                                        fpath     : 'en' + FilePath,
-                                        fname     : FileName,
-                                        loadStore : (phpDoc.userConf.conf_error_displaylog === 'true')
-                                    })
-                                ]
-                            }
-                        }, new ui.component.FilePanel(
-                        {
-                            id             : 'FE-LANG-PANEL-' + FileID,
-                            region         : 'center',
-                            title          : String.format(_('{0} File: '), phpDoc.userLang) + FilePath + FileName,
-                            prefix         : 'FE',
-                            ftype          : 'LANG',
-                            fid            : FileID,
-                            fpath          : FilePath,
-                            fname          : FileName,
-                            lang           : phpDoc.userLang,
-                            parser         : 'xml',
-                            storeRecord    : storeRecord,
-                            syncScrollCB   : true,
-                            syncScroll     : true,
-                            syncScrollConf : 'conf_error_scrollbars'
-                        }), new ui.component.FilePanel(
-                        {
-                            id             : 'FE-EN-PANEL-' + FileID,
-                            region         : 'east',
-                            width          : 575,
-                            title          : _('en File: ') + FilePath + FileName,
-                            prefix         : 'FE',
-                            ftype          : 'EN',
-                            fid            : FileID,
-                            fpath          : FilePath,
-                            fname          : FileName,
-                            lang           : 'en',
-                            parser         : 'xml',
-                            storeRecord    : storeRecord,
-                            syncScroll     : true,
-                            syncScrollConf : 'conf_error_scrollbars'
-                        })
-                    ]
-                });
-                Ext.getCmp('main-panel').setActiveTab('FE-' + FileID);
+            // Find all error for this file to pass to error_type.php page
+            error = [];

-                // Set the bg image for north collapsed el
-                if (Ext.getCmp('FE-' + FileID).getLayout().north.collapsedEl) {
-                    Ext.getCmp('FE-' + FileID).getLayout().north.collapsedEl.addClass(
-                        'x-layout-collapsed-east-error-desc'
-                    );
+            this.store.each(function(record)
+            {
+                if ( record.data.path === FilePath && record.data.name === FileName && !error[record.data.type] ) {
+                    error.push(record.data.type);
                 }
+            });

-            } else {
-                // This tab already exist. We focus it.
-                Ext.getCmp('main-panel').setActiveTab('FE-' + FileID);
+            Ext.getCmp('main-panel').add({
+                id          : 'FE-' + FileID,
+                title       : FileName,
+                layout      : 'border',
+                iconCls     : 'iconTabError',
+                closable    : true,
+                originTitle : FileName,
+                defaults    : { split : true },
+                tabTip      : String.format(
+                    _('File with error : in {0}'), FilePath
+                ),
+                items : [
+                    {
+                        xtype       : 'panel',
+                        id          : 'FE-error-desc-' + FileID,
+                        region      : 'north',
+                        layout      : 'fit',
+                        title       : _('Error description'),
+                        height      : 150,
+                        collapsible : true,
+                        collapsed   : true,
+                        items : {
+                            xtype      : 'iframepanel',
+                            id         : 'FE-error-type-' + FileID,
+                            loadMask   : true,
+                            defaultSrc : './error?dir=' + FilePath +
+                                                '&file=' + FileName
+                        }
+                    }, {
+                        region      : 'west',
+                        xtype       : 'panel',
+                        title       : _('VCSLog'),
+                        collapsible : true,
+                        collapsed   : true,
+                        layout      : 'fit',
+                        bodyBorder  : false,
+                        width       : 375,
+                        items       : {
+                            xtype       : 'tabpanel',
+                            activeTab   : 0,
+                            tabPosition : 'bottom',
+                            defaults    : { autoScroll : true },
+                            items       : [
+                                new ui.component.VCSLogGrid({
+                                    layout    : 'fit',
+                                    title     : phpDoc.userLang,
+                                    prefix    : 'FE-LANG',
+                                    fid       : FileID,
+                                    fpath     : phpDoc.userLang + FilePath,
+                                    fname     : FileName,
+                                    loadStore : (phpDoc.userConf.conf_error_displaylog === 'true')
+                                }),
+                                new ui.component.VCSLogGrid({
+                                    layout    : 'fit',
+                                    title     : 'en',
+                                    prefix    : 'FE-EN',
+                                    fid       : FileID,
+                                    fpath     : 'en' + FilePath,
+                                    fname     : FileName,
+                                    loadStore : (phpDoc.userConf.conf_error_displaylog === 'true')
+                                })
+                            ]
+                        }
+                    }, new ui.component.FilePanel(
+                    {
+                        id             : 'FE-LANG-PANEL-' + FileID,
+                        region         : 'center',
+                        title          : String.format(_('{0} File: '), phpDoc.userLang) + FilePath + FileName,
+                        prefix         : 'FE',
+                        ftype          : 'LANG',
+                        fid            : FileID,
+                        fpath          : FilePath,
+                        fname          : FileName,
+                        lang           : phpDoc.userLang,
+                        parser         : 'xml',
+                        storeRecord    : storeRecord,
+                        syncScrollCB   : true,
+                        syncScroll     : true,
+                        syncScrollConf : 'conf_error_scrollbars'
+                    }), new ui.component.FilePanel(
+                    {
+                        id             : 'FE-EN-PANEL-' + FileID,
+                        region         : 'east',
+                        width          : 575,
+                        title          : _('en File: ') + FilePath + FileName,
+                        prefix         : 'FE',
+                        ftype          : 'EN',
+                        fid            : FileID,
+                        fpath          : FilePath,
+                        fname          : FileName,
+                        lang           : 'en',
+                        parser         : 'xml',
+                        storeRecord    : storeRecord,
+                        syncScroll     : true,
+                        syncScrollConf : 'conf_error_scrollbars'
+                    })
+                ]
+            });
+            Ext.getCmp('main-panel').setActiveTab('FE-' + FileID);
+
+            // Set the bg image for north collapsed el
+            if (Ext.getCmp('FE-' + FileID).getLayout().north.collapsedEl) {
+                Ext.getCmp('FE-' + FileID).getLayout().north.collapsedEl.addClass(
+                    'x-layout-collapsed-east-error-desc'
+                );
             }
+
+        } else {
+            // This tab already exist. We focus it.
+            Ext.getCmp('main-panel').setActiveTab('FE-' + FileID);
         }
     },


Modified: web/doc-editor/trunk/js/ui/component/PendingCommitGrid.js
===================================================================
--- web/doc-editor/trunk/js/ui/component/PendingCommitGrid.js	2009-12-12 22:03:50 UTC (rev 292054)
+++ web/doc-editor/trunk/js/ui/component/PendingCommitGrid.js	2009-12-12 23:51:49 UTC (rev 292055)
@@ -470,7 +470,7 @@
                 FileType    = storeRecord.data.type,
                 FilePath    = storeRecord.data.path,
                 FileName    = storeRecord.data.name,
-                FileLang, tmp;
+                FileLang, tmp, found;

             if (FileType === 'new') {

@@ -503,16 +503,46 @@
                     ui.component.RepositoryTree.getInstance().openFile(FileLang+FilePath, FileName);
                 } else {

+                    found = false;
+
                     // Find the id of this row into StaleFileGrid.store and open it !
                     ui.component.StaleFileGrid.getInstance().store.each(function(row) {

                         if( (row.data['path']) === FilePath && row.data['name'] === FileName ) {
                             ui.component.StaleFileGrid.getInstance().openFile(row.data.id);
+                            found = true;
                             return;
                         }
                     });
+
+                    // If we haven't found this file in StaleFileGrid, we try into File in error grid.
+                    if( !found ) {
+
+                        // Find the id of this row into ErrorFileGrid.store and open it !
+                        ui.component.ErrorFileGrid.getInstance().store.each(function(row) {
+
+                            if( (row.data['path']) === FilePath && row.data['name'] === FileName ) {
+                                ui.component.ErrorFileGrid.getInstance().openFile(row.data.id);
+                                found = true;
+                                return;
+                            }
+                        });
+                    }
+
+                    // If we haven't found this file in File in error grid, we search in Pending Reviewed grid.
+                    if( !found ) {
+
+                        // Find the id of this row into PendingReviewGrid.store and open it !
+                        ui.component.PendingReviewGrid.getInstance().store.each(function(row) {
+
+                            if( (row.data['path']) === FilePath && row.data['name'] === FileName ) {
+                                ui.component.PendingReviewGrid.getInstance().openFile(row.data.id);
+                                found = true;
+                                return;
+                            }
+                        });
+                    }
                 }
-
             }

             if (FileType === 'delete') {

Modified: web/doc-editor/trunk/js/ui/component/PendingReviewGrid.js
===================================================================
--- web/doc-editor/trunk/js/ui/component/PendingReviewGrid.js	2009-12-12 22:03:50 UTC (rev 292054)
+++ web/doc-editor/trunk/js/ui/component/PendingReviewGrid.js	2009-12-12 23:51:49 UTC (rev 292055)
@@ -262,7 +262,7 @@
                 FilePath    = storeRecord.data.path,
                 FileName    = storeRecord.data.name,
                 fpath_split = FilePath.split('/'),
-				tmp;
+                tmp;

             grid.getSelectionModel().selectRow(rowIndex);

@@ -279,102 +279,108 @@
         },
         rowdblclick : function(grid, rowIndex, e)
         {
-            var storeRecord = grid.store.getAt(rowIndex),
-                FilePath    = storeRecord.data.path,
-                FileName    = storeRecord.data.name,
-                FileID      = Ext.util.md5('FNR-' + phpDoc.userLang + FilePath + FileName);
+            this.openFile(grid.store.getAt(rowIndex).data.id);
+        }
+    },

-            // Render only if this tab don't exist yet
-            if (!Ext.getCmp('main-panel').findById('FNR-' + FileID)) {
+    openFile : function(rowId)
+    {
+        var storeRecord = this.store.getById(rowId),
+            FilePath    = storeRecord.data.path,
+            FileName    = storeRecord.data.name,
+            FileID      = Ext.util.md5('FNR-' + phpDoc.userLang + FilePath + FileName);

-                Ext.getCmp('main-panel').add({
-                    id          : 'FNR-' + FileID,
-                    title       : FileName,
-                    layout      : 'border',
-                    iconCls     : 'iconTabNeedReviewed',
-                    closable    : true,
-                    originTitle : FileName,
-                    defaults    : { split : true },
-                    tabTip      : String.format(
-                        _('Need Reviewed in: {0}'), FilePath
-                    ),
-                    items : [
-                        {
-                            region      : 'west',
-                            xtype       : 'panel',
-                            title       : _('VCSLog'),
-                            collapsible : true,
-                            collapsed   : true,
-                            layout      : 'fit',
-                            bodyBorder  : false,
-                            width       : 375,
-                            items : {
-                                xtype       : 'tabpanel',
-                                activeTab   : 0,
-                                tabPosition : 'bottom',
-                                defaults    : { autoScroll : true },
-                                items       : [
-                                    new ui.component.VCSLogGrid({
-                                        layout    : 'fit',
-                                        title     : phpDoc.userLang,
-                                        prefix    : 'FNR-LANG',
-                                        fid       : FileID,
-                                        fpath     : phpDoc.userLang + FilePath,
-                                        fname     : FileName,
-                                        loadStore : (phpDoc.userConf.conf_reviewed_displaylog === 'true')
-                                    }), new ui.component.VCSLogGrid({
-                                        layout    : 'fit',
-                                        title     : 'en',
-                                        prefix    : 'FNR-EN',
-                                        fid       : FileID,
-                                        fpath     : 'en' + FilePath,
-                                        fname     : FileName,
-                                        loadStore : (phpDoc.userConf.conf_reviewed_displaylog === 'true')
-                                    })
-                                ]
-                            }
-                        }, new ui.component.FilePanel(
-                        {
-                            id             : 'FNR-LANG-PANEL-' + FileID,
-                            region         : 'center',
-                            title          : String.format(_('{0} File: '), phpDoc.userLang) + FilePath + FileName,
-                            prefix         : 'FNR',
-                            ftype          : 'LANG',
-                            fid            : FileID,
-                            fpath          : FilePath,
-                            fname          : FileName,
-                            lang           : phpDoc.userLang,
-                            parser         : 'xml',
-                            storeRecord    : storeRecord,
-                            syncScrollCB   : true,
-                            syncScroll     : true,
-                            syncScrollConf : 'conf_reviewed_scrollbars'
-                        }), new ui.component.FilePanel(
-                        {
-                            id             : 'FNR-EN-PANEL-' + FileID,
-                            region         : 'east',
-                            width          : 575,
-                            title          : _('en File: ') + FilePath + FileName,
-                            prefix         : 'FNR',
-                            ftype          : 'EN',
-                            fid            : FileID,
-                            fpath          : FilePath,
-                            fname          : FileName,
-                            lang           : 'en',
-                            parser         : 'xml',
-                            storeRecord    : storeRecord,
-                            syncScroll     : true,
-                            syncScrollConf : 'conf_reviewed_scrollbars'
-                        })
-                    ]
-                });
-                Ext.getCmp('main-panel').setActiveTab('FNR-' + FileID);
+        // Render only if this tab don't exist yet
+        if (!Ext.getCmp('main-panel').findById('FNR-' + FileID)) {

-            } else {
-                // This tab already exist. We focus it.
-                Ext.getCmp('main-panel').setActiveTab('FNR-' + FileID);
-            }
+            Ext.getCmp('main-panel').add({
+                id          : 'FNR-' + FileID,
+                title       : FileName,
+                layout      : 'border',
+                iconCls     : 'iconTabNeedReviewed',
+                closable    : true,
+                originTitle : FileName,
+                defaults    : { split : true },
+                tabTip      : String.format(
+                    _('Need Reviewed in: {0}'), FilePath
+                ),
+                items : [
+                    {
+                        region      : 'west',
+                        xtype       : 'panel',
+                        title       : _('VCSLog'),
+                        collapsible : true,
+                        collapsed   : true,
+                        layout      : 'fit',
+                        bodyBorder  : false,
+                        width       : 375,
+                        items : {
+                            xtype       : 'tabpanel',
+                            activeTab   : 0,
+                            tabPosition : 'bottom',
+                            defaults    : { autoScroll : true },
+                            items       : [
+                                new ui.component.VCSLogGrid({
+                                    layout    : 'fit',
+                                    title     : phpDoc.userLang,
+                                    prefix    : 'FNR-LANG',
+                                    fid       : FileID,
+                                    fpath     : phpDoc.userLang + FilePath,
+                                    fname     : FileName,
+                                    loadStore : (phpDoc.userConf.conf_reviewed_displaylog === 'true')
+                                }), new ui.component.VCSLogGrid({
+                                    layout    : 'fit',
+                                    title     : 'en',
+                                    prefix    : 'FNR-EN',
+                                    fid       : FileID,
+                                    fpath     : 'en' + FilePath,
+                                    fname     : FileName,
+                                    loadStore : (phpDoc.userConf.conf_reviewed_displaylog === 'true')
+                                })
+                            ]
+                        }
+                    }, new ui.component.FilePanel(
+                    {
+                        id             : 'FNR-LANG-PANEL-' + FileID,
+                        region         : 'center',
+                        title          : String.format(_('{0} File: '), phpDoc.userLang) + FilePath + FileName,
+                        prefix         : 'FNR',
+                        ftype          : 'LANG',
+                        fid            : FileID,
+                        fpath          : FilePath,
+                        fname          : FileName,
+                        lang           : phpDoc.userLang,
+                        parser         : 'xml',
+                        storeRecord    : storeRecord,
+                        syncScrollCB   : true,
+                        syncScroll     : true,
+                        syncScrollConf : 'conf_reviewed_scrollbars'
+                    }), new ui.component.FilePanel(
+                    {
+                        id             : 'FNR-EN-PANEL-' + FileID,
+                        region         : 'east',
+                        width          : 575,
+                        title          : _('en File: ') + FilePath + FileName,
+                        prefix         : 'FNR',
+                        ftype          : 'EN',
+                        fid            : FileID,
+                        fpath          : FilePath,
+                        fname          : FileName,
+                        lang           : 'en',
+                        parser         : 'xml',
+                        storeRecord    : storeRecord,
+                        syncScroll     : true,
+                        syncScrollConf : 'conf_reviewed_scrollbars'
+                    })
+                ]
+            });
+            Ext.getCmp('main-panel').setActiveTab('FNR-' + FileID);
+
+        } else {
+            // This tab already exist. We focus it.
+            Ext.getCmp('main-panel').setActiveTab('FNR-' + FileID);
         }
+
     },

     initComponent : function()
@@ -438,8 +444,8 @@
 {
     if (!ui.component._PendingReviewGrid.instance) {
         if (!config) {
-			config = {};
-		}
+            config = {};
+        }
         ui.component._PendingReviewGrid.instance = new ui.component.PendingReviewGrid(config);
     }
     return ui.component._PendingReviewGrid.instance;
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.