mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
added ability to hide "Upload To" menu item
This commit is contained in:
parent
df5f2ee7e1
commit
480f9c4600
2 changed files with 53 additions and 44 deletions
|
|
@ -112,6 +112,9 @@ with clicks on files.
|
|||
|
||||
* Removed allowed from cache property in config.
|
||||
|
||||
* Added ability to hide "Upload To" menu item if
|
||||
no storage modules setted up in modules.json.
|
||||
|
||||
|
||||
2012.12.12, Version 0.1.8
|
||||
|
||||
|
|
|
|||
|
|
@ -112,18 +112,63 @@ var CloudCommander, Util, DOM, $;
|
|||
|
||||
if(pItems)
|
||||
for(lName in pItems){
|
||||
lFunc = pItems[lName];
|
||||
lFunc = pItems[lName];
|
||||
lRet[lName] = getItem(lName, lFunc);
|
||||
}
|
||||
|
||||
return lRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* download menu item callback
|
||||
*/
|
||||
function downloadFromMenu(key, opt){
|
||||
DOM.Images.showLoad();
|
||||
|
||||
var lPath = DOM.getCurrentPath(),
|
||||
lId = DOM.getIdBySrc(lPath);
|
||||
|
||||
Util.log('downloading file ' + lPath +'...');
|
||||
|
||||
lPath = lPath + '?download';
|
||||
|
||||
if(!DOM.getById(lId)){
|
||||
var lDownload = DOM.anyload({
|
||||
name : 'iframe',
|
||||
async : false,
|
||||
className : 'hidden',
|
||||
src : lPath,
|
||||
func : Util.retFunc(DOM.Images.hideLoad)
|
||||
});
|
||||
|
||||
DOM.Images.hideLoad();
|
||||
setTimeout(function() {
|
||||
document.body.removeChild(lDownload);
|
||||
}, 10000);
|
||||
}
|
||||
else
|
||||
DOM.Images.showError({
|
||||
responseText: 'Error: You trying to' +
|
||||
'download same file to often'});
|
||||
}
|
||||
|
||||
/**
|
||||
* function return configureation for menu
|
||||
*/
|
||||
function getConfig (){
|
||||
return{
|
||||
var lRet,
|
||||
lMenuItems = {
|
||||
'View' : Util.retExec(showEditor, true),
|
||||
'Edit' : Util.retExec(showEditor, false),
|
||||
'Delete' : Util.retExec(DOM.promptRemoveCurrent),
|
||||
};
|
||||
|
||||
if(UploadToItemNames.length)
|
||||
lMenuItems['Upload to'] = getUploadToItems(UploadToItemNames);
|
||||
|
||||
lMenuItems.Download = Util.retExec(downloadFromMenu);
|
||||
|
||||
lRet = {
|
||||
// define which elements trigger this menu
|
||||
selector: 'li',
|
||||
|
||||
|
|
@ -135,49 +180,10 @@ var CloudCommander, Util, DOM, $;
|
|||
},
|
||||
|
||||
// define the elements of the menu
|
||||
items: getAllItems({
|
||||
'View' : Util.retExec(showEditor, true),
|
||||
'Edit' : Util.retExec(showEditor, false),
|
||||
'Delete' : Util.retExec(DOM.promptRemoveCurrent),
|
||||
'Upload to' : getUploadToItems(UploadToItemNames)
|
||||
/*
|
||||
[
|
||||
'DropBox',
|
||||
'GDrive',
|
||||
'GitHub',
|
||||
'VK'
|
||||
])*/,
|
||||
'Download' : function(key, opt){
|
||||
DOM.Images.showLoad();
|
||||
|
||||
var lPath = DOM.getCurrentPath(),
|
||||
lId = DOM.getIdBySrc(lPath);
|
||||
|
||||
Util.log('downloading file ' + lPath +'...');
|
||||
|
||||
lPath = lPath + '?download';
|
||||
|
||||
if(!DOM.getById(lId)){
|
||||
var lDownload = DOM.anyload({
|
||||
name : 'iframe',
|
||||
async : false,
|
||||
className : 'hidden',
|
||||
src : lPath,
|
||||
func : Util.retFunc(DOM.Images.hideLoad)
|
||||
});
|
||||
|
||||
DOM.Images.hideLoad();
|
||||
setTimeout(function() {
|
||||
document.body.removeChild(lDownload);
|
||||
}, 10000);
|
||||
}
|
||||
else
|
||||
DOM.Images.showError({
|
||||
responseText: 'Error: You trying to' +
|
||||
'download same file to often'});
|
||||
}
|
||||
})
|
||||
items: getAllItems(lMenuItems)
|
||||
};
|
||||
|
||||
return lRet;
|
||||
}
|
||||
|
||||
/** function loads css and js of Menu
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue