From 07d7df646193ede5a9002efb61b4c4c8317760c2 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 24 Aug 2012 18:14:00 +0300 Subject: [PATCH 1/2] Update lib/client/menu.js --- lib/client/menu.js | 50 ++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/lib/client/menu.js b/lib/client/menu.js index 4322129a..2eae0e36 100644 --- a/lib/client/menu.js +++ b/lib/client/menu.js @@ -14,9 +14,24 @@ var CloudCommander, $; /* enable and disable menu constant */ CloudCommander.Menu.ENABLED = false; - /* function return configureation - * for menu - */ + + CloudCommander.Menu.showEditor = (function(pReadOnly){ + Util.Images.showLoad(); + var lCloudcmd = CloudCommander; + var lEditor = pReadOnly ? lCloudcmd.Viewer:lCloudcmd.Editor; + var lCurrent = Util.getCurrentFile(); + if(lCurrent){ + if(typeof lEditor === 'function') + lEditor(lCurrent); + else{ + lEditor = lEditor.get(); + if(lEditor && lEditor.show) + lEditor.show(lCurrent); + } + } + }); + + /* function return configureation for menu */ CloudCommander.Menu.getConfig = (function(){ return{ // define which elements trigger this menu @@ -30,32 +45,12 @@ var CloudCommander, $; }, // define the elements of the menu items: { - view: {name: 'View', callback: function(key, opt){ - var lCurrent = Util.getCurrentFile(); - if(lCurrent){ - if(typeof CloudCommander.Viewer === 'function') - CloudCommander.Viewer(lCurrent); - else{ - var lViewer = CloudCommander.Viewer.get(); - if(lViewer && lViewer.show) - lViewer.show(lCurrent); - } + view: {name: 'View', callback: function(key, opt){ + CloudCommander.showEditor(true); }}, edit: {name: 'Edit', callback: function(key, opt){ - Util.Images.showLoad(); - - if(typeof CloudCommander.Editor === 'function') - CloudCommander.Editor(); - else{ - var lEditor = CloudCommander.Editor.get(); - if(lEditor && lEditor.show){ - var lCurrent = Util.getCurrentFile(); - if(lCurrent) - lEditor.show(lCurrent); - } - } - + CloudCommander.showEditor(false); }}, 'delete': {name: 'Delete', @@ -90,11 +85,10 @@ var CloudCommander, $; document.body.removeChild(lDownload); }, 10000); } - else{ + else Util.Images.showError({ responseText: 'Error: You trying to' + 'download same file to often'}); - } }} } }; From 185527a6ae973e86a3269d8ece4d11265c6c38fc Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 24 Aug 2012 18:14:45 +0300 Subject: [PATCH 2/2] Update lib/client/menu.js --- lib/client/menu.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/client/menu.js b/lib/client/menu.js index 2eae0e36..f3c88fcb 100644 --- a/lib/client/menu.js +++ b/lib/client/menu.js @@ -46,11 +46,11 @@ var CloudCommander, $; // define the elements of the menu items: { view: {name: 'View', callback: function(key, opt){ - CloudCommander.showEditor(true); + CloudCommander.Menu.showEditor(true); }}, edit: {name: 'Edit', callback: function(key, opt){ - CloudCommander.showEditor(false); + CloudCommander.Menu.showEditor(false); }}, 'delete': {name: 'Delete',