svn: /web/doc-editor/trunk/ js/locale/fr.js js/ui/component/NotInENGrid.js js/ui/component/PendingCommitGrid.js js/ui/task/GetFileTask.js php/ExtJsController.php php/SvnClient.php themes/img/eye.png themes/style.css

[email protected] (Yannick Torres)
Newsgroups php.doc.web
Message-ID <[email protected]>
yannick                                  Sun, 15 Nov 2009 18:58:58 +0000

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

Log:
Allow to view the content of a file witch is not in EN tree into a new tab

Changed paths:
    U   web/doc-editor/trunk/js/locale/fr.js
    U   web/doc-editor/trunk/js/ui/component/NotInENGrid.js
    U   web/doc-editor/trunk/js/ui/component/PendingCommitGrid.js
    U   web/doc-editor/trunk/js/ui/task/GetFileTask.js
    U   web/doc-editor/trunk/php/ExtJsController.php
    U   web/doc-editor/trunk/php/SvnClient.php
    A   web/doc-editor/trunk/themes/img/eye.png
    U   web/doc-editor/trunk/themes/style.css
svn-diffs-290795.txt (text/x-diff, 12.6 KB)
Modified: web/doc-editor/trunk/js/locale/fr.js
===================================================================
--- web/doc-editor/trunk/js/locale/fr.js	2009-11-15 18:06:03 UTC (rev 290794)
+++ web/doc-editor/trunk/js/locale/fr.js	2009-11-15 18:58:58 UTC (rev 290795)
@@ -129,9 +129,10 @@
 i18n["Filter: "] = "Filtrer : ";
 i18n["Your filter must contain at least 3 characters"] = "Votre filtre doit comporter au moins 3 caractères";
 i18n["Not in EN tree"] = "Non présent en EN";
+i18n["Not In EN: in {0}"] = "Non présent en EN : dans {0}";
 i18n["Remove this file"] = "Supprimer ce fichier";
 i18n["This action will mark this file as need deleted.<br/><br/>You need commit this change to take it effect.<br/><br/>Please, confirm this action."] = "Voulez-vous marquer ce fichier comme devant être effacé ?<br/><br/>L'effacement sera effectif qu'une fois le commit émis.<br/><br/>Vous devez confirmer cette action.";
-
+i18n["View in a new Tab"] = "Voir dans un nouvel onglet";
 i18n["Translation build status"] = "Statut de la compilation";
 i18n["Language"] = "Langage";


Modified: web/doc-editor/trunk/js/ui/component/NotInENGrid.js
===================================================================
--- web/doc-editor/trunk/js/ui/component/NotInENGrid.js	2009-11-15 18:06:03 UTC (rev 290794)
+++ web/doc-editor/trunk/js/ui/component/NotInENGrid.js	2009-11-15 18:58:58 UTC (rev 290795)
@@ -55,6 +55,7 @@
 // NotInENGrid view
 ui.component._NotInENGrid.view = new Ext.grid.GroupingView({
     forceFit     : true,
+    startCollapsed: true,
     groupTextTpl : '{[values.rs[0].data["path"]]} ' +
                    '({[values.rs.length]} ' +
                    '{[values.rs.length > 1 ? "' + _('Files') + '" : "' + _('File') + '"]})',
@@ -83,14 +84,31 @@
         {
             items : [{
                 scope   : this,
-                text    : _('Remove this file'),
-                iconCls : 'iconDelete',
+                text    : '<b>'+_('View in a new Tab')+'</b>',
+                iconCls : 'iconView',
                 handler : function()
                 {
                     this.grid.fireEvent('rowdblclick',
                         this.grid, this.rowIdx, this.event
                     );
                 }
+            }, {
+                scope   : this,
+                text    : _('Remove this file'),
+                iconCls : 'iconDelete',
+                handler : function()
+                {
+                   var storeRecord = this.grid.store.getAt(this.rowIdx),
+                       FilePath    = storeRecord.data.path,
+                       FileName    = storeRecord.data.name,
+                       tmp;
+
+                   tmp = new ui.task.MarkDeleteTask({
+                       fpath       : FilePath,
+                       fname       : FileName,
+                       storeRecord : storeRecord
+                   });
+                }
             }]
         });
     }
@@ -125,13 +143,49 @@
             var storeRecord = grid.store.getAt(rowIndex),
                 FilePath    = storeRecord.data.path,
                 FileName    = storeRecord.data.name,
-				tmp;
+                FileID      = Ext.util.md5('FNIEN-' + phpDoc.userLang + FilePath + FileName);

-            tmp = new ui.task.MarkDeleteTask({
-                fpath       : FilePath,
-                fname       : FileName,
-                storeRecord : storeRecord
-            });
+
+            // Render only if this tab don't exist yet
+            if (!Ext.getCmp('main-panel').findById('FNIEN-' + FileID)) {
+
+                Ext.getCmp('main-panel').add(
+                {
+                    id             : 'FNIEN-' + FileID,
+                    layout         : 'border',
+                    title          : FileName,
+                    originTitle    : FileName,
+                    iconCls        : 'iconTabView',
+                    closable       : true,
+                    defaults       : { split : true },
+                    tabTip         : String.format(
+                        _('Not In EN: in {0}'), FilePath
+                    ),
+                    items : [
+                       new ui.component.FilePanel(
+                        {
+                            id             : 'FNIEN-NotInEN-PANEL-' + FileID,
+                            region         : 'center',
+                            title          : _('File: ') + FilePath + FileName,
+                            prefix         : 'FNIEN',
+                            ftype          : 'NotInEN',
+                            fid            : FileID,
+                            fpath          : FilePath,
+                            fname          : FileName,
+                            readOnly       : true,
+                            lang           : phpDoc.userLang,
+                            parser         : 'xml',
+                            storeRecord    : storeRecord,
+                            syncScroll     : false
+                        })
+                    ]
+                });
+                Ext.getCmp('main-panel').setActiveTab('FNIEN-' + FileID);
+
+            } else {
+                // This tab already exist. We focus it.
+                Ext.getCmp('main-panel').setActiveTab('FNIEN-' + FileID);
+            }
         }
     },

@@ -156,8 +210,8 @@
 {
     if (!ui.component._NotInENGrid.instance) {
         if (!config) {
-			config = {};
-		}
+           config = {};
+        }
         ui.component._NotInENGrid.instance = new ui.component.NotInENGrid(config);
     }
     return ui.component._NotInENGrid.instance;

Modified: web/doc-editor/trunk/js/ui/component/PendingCommitGrid.js
===================================================================
--- web/doc-editor/trunk/js/ui/component/PendingCommitGrid.js	2009-11-15 18:06:03 UTC (rev 290794)
+++ web/doc-editor/trunk/js/ui/component/PendingCommitGrid.js	2009-11-15 18:58:58 UTC (rev 290795)
@@ -317,6 +317,59 @@
         {
             items: [
                 {
+                    scope   : this,
+                    text    : '<b>'+_('View in a new Tab')+'</b>',
+                    iconCls : 'iconView',
+                    handler : function()
+                    {
+                       var storeRecord = this.grid.store.getAt(this.rowIdx),
+                           FilePath    = storeRecord.data.path,
+                           FileName    = storeRecord.data.name,
+                           FileID      = Ext.util.md5('FNIEN-' + phpDoc.userLang + FilePath + FileName);
+
+
+                       // Render only if this tab don't exist yet
+                       if (!Ext.getCmp('main-panel').findById('FNIEN-' + FileID)) {
+
+                           Ext.getCmp('main-panel').add(
+                           {
+                               id             : 'FNIEN-' + FileID,
+                               layout         : 'border',
+                               title          : FileName,
+                               originTitle    : FileName,
+                               iconCls        : 'iconTabView',
+                               closable       : true,
+                               defaults       : { split : true },
+                               tabTip         : String.format(
+                                   _('Not In EN: in {0}'), FilePath
+                               ),
+                               items : [
+                                  new ui.component.FilePanel(
+                                   {
+                                       id             : 'FNIEN-NotInEN-PANEL-' + FileID,
+                                       region         : 'center',
+                                       title          : _('File: ') + FilePath + FileName,
+                                       prefix         : 'FNIEN',
+                                       ftype          : 'NotInEN',
+                                       fid            : FileID,
+                                       fpath          : FilePath,
+                                       fname          : FileName,
+                                       readOnly       : true,
+                                       lang           : '',
+                                       parser         : 'xml',
+                                       storeRecord    : storeRecord,
+                                       syncScroll     : false
+                                   })
+                               ]
+                           });
+                           Ext.getCmp('main-panel').setActiveTab('FNIEN-' + FileID);
+
+                       } else {
+                           // This tab already exist. We focus it.
+                           Ext.getCmp('main-panel').setActiveTab('FNIEN-' + FileID);
+                       }
+                    }
+                }, {
                     scope    : this,
                     text     : '<b>' + _('Cancel') + '<b>',
                     iconCls  : 'iconPageDelete',

Modified: web/doc-editor/trunk/js/ui/task/GetFileTask.js
===================================================================
--- web/doc-editor/trunk/js/ui/task/GetFileTask.js	2009-11-15 18:06:03 UTC (rev 290794)
+++ web/doc-editor/trunk/js/ui/task/GetFileTask.js	2009-11-15 18:58:58 UTC (rev 290795)
@@ -5,7 +5,8 @@
 {
     Ext.apply(this, config);

-    var id_prefix = this.prefix + '-' + this.ftype;
+    var id_prefix    = this.prefix + '-' + this.ftype,
+        readOriginal = (this.ftype == 'NotInEN') ? true : false;

     // Mask the panel
     Ext.get(id_prefix + '-PANEL-' + this.fid).mask(
@@ -20,7 +21,8 @@
         params : {
             task     : 'getFile',
             FilePath : this.fpath,
-            FileName : this.fname
+            FileName : this.fname,
+            readOriginal: readOriginal
         },
         success : function(response)
         {

Modified: web/doc-editor/trunk/php/ExtJsController.php
===================================================================
--- web/doc-editor/trunk/php/ExtJsController.php	2009-11-15 18:06:03 UTC (rev 290794)
+++ web/doc-editor/trunk/php/ExtJsController.php	2009-11-15 18:58:58 UTC (rev 290795)
@@ -323,6 +323,10 @@
         $FilePath = $this->getRequestVariable('FilePath');
         $FileName = $this->getRequestVariable('FileName');

+        $readOriginal = $this->hasRequestVariable('readOriginal')
+                        ? $this->getRequestVariable('readOriginal')
+                        : false;
+
         $t = explode('/', $FilePath);
         $FileLang = array_shift($t);
         $FilePath = implode('/', $t);
@@ -331,7 +335,7 @@
         // If this utf-8, we don't need to use utf8_encode to pass to this app, else, we apply it

         $file     = new File($FileLang, $FilePath, $FileName);
-        $content  = $file->read();
+        $content  = $file->read($readOriginal);
         $encoding = $file->getEncoding($content);

         $return = array();

Modified: web/doc-editor/trunk/php/SvnClient.php
===================================================================
--- web/doc-editor/trunk/php/SvnClient.php	2009-11-15 18:06:03 UTC (rev 290794)
+++ web/doc-editor/trunk/php/SvnClient.php	2009-11-15 18:58:58 UTC (rev 290795)
@@ -331,7 +331,7 @@
             $cmdCreate = "svn add $filesCreate ; svn propset svn:keywords \"Revision\" $filesCreate ; ";
         }
         if (trim($filesDelete) != '') {
-            $cmdDelete = "svn rm -f $filesDelete ; ";
+            $cmdDelete = "svn delete $filesDelete ; ";
         }

         // Escape single quote

Added: web/doc-editor/trunk/themes/img/eye.png
===================================================================
(Binary files differ)


Property changes on: web/doc-editor/trunk/themes/img/eye.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: web/doc-editor/trunk/themes/style.css
===================================================================
--- web/doc-editor/trunk/themes/style.css	2009-11-15 18:06:03 UTC (rev 290794)
+++ web/doc-editor/trunk/themes/style.css	2009-11-15 18:58:58 UTC (rev 290795)
@@ -269,10 +269,14 @@
     background-image: url(../themes/img/page_link.png) !important;
 } .iconTabNeedTranslate {
     background-image: url(../themes/img/page_add.png) !important;
+} .iconTabView {
+    background-image: url(../themes/img/eye.png) !important;
 } .iconTabNeedUpdate {
     background-image: url(../themes/img/arrow_refresh.png) !important;
 } .iconDelete {
     background-image: url(../themes/img/delete.png) !important;
+} .iconView {
+    background-image: url(../themes/img/eye.png) !important;
 } .iconFolderOpen {
     background-image: url(../themes/img/folder-open.gif) !important;
 } .iconFolderClose {
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.