mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-21 02:29:23 +00:00
added ability to delete file when f8 key pressed
This commit is contained in:
parent
11698af3ab
commit
636bac5f94
6 changed files with 40 additions and 27 deletions
|
|
@ -67,6 +67,8 @@ is pressed and current file is directory.
|
|||
|
||||
* Added function getSelectedNames.
|
||||
|
||||
* Added ability to delete file when f8 key pressed.
|
||||
|
||||
|
||||
2012.03.01, Version 0.1.9
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ There is a short list:
|
|||
- **Page Down** - down on one page
|
||||
- **Home** - to begin of list
|
||||
- **End** - to end of list
|
||||
- **Delete** - remove current file
|
||||
- **F8, Delete** - remove current file
|
||||
- **Shift + Delete** - remove without prompt
|
||||
- **Insert** - select current file
|
||||
- **F2** - rename current file
|
||||
|
|
|
|||
|
|
@ -38,10 +38,11 @@ var CloudCommander, Util, DOM = {}, CloudFunc;
|
|||
|
||||
/* Обьект содержит функции для работы с CloudCmd API */
|
||||
RESTfull = function(){
|
||||
this.delete = function(pUrl, pCallBack){
|
||||
this.delete = function(pUrl, pData, pCallBack){
|
||||
sendRequest({
|
||||
method : 'DELETE',
|
||||
url : CloudFunc.FS + pUrl,
|
||||
data : pData,
|
||||
callback : pCallBack
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ var CloudCommander, Util, DOM;
|
|||
F5 : 116,
|
||||
F6 : 117,
|
||||
F7 : 118,
|
||||
F8 : 119,
|
||||
F10 : 121,
|
||||
|
||||
TRA : 192 /* Typewritten Reverse Apostrophe (`) */
|
||||
|
|
@ -171,6 +172,10 @@ var CloudCommander, Util, DOM;
|
|||
DOM.promptNewDir();
|
||||
break;
|
||||
|
||||
case KEY.F8:
|
||||
DOM.promptDeleteCurrent(lCurrent);
|
||||
break;
|
||||
|
||||
case KEY.F:
|
||||
DOM.promptDeleteCurrent(lCurrent);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@
|
|||
exports.appcache = srvrequire('appcache'),
|
||||
exports.cache = srvrequire('cache').Cache,
|
||||
exports.cloudfunc = librequire('cloudfunc'),
|
||||
exports.dir = srvrequire('dir');
|
||||
exports.dir = srvrequire('dir'),
|
||||
exports.rest = srvrequire('rest').api,
|
||||
exports.update = srvrequire('update'),
|
||||
exports.ischanged = srvrequire('ischanged');
|
||||
|
|
|
|||
|
|
@ -109,26 +109,25 @@
|
|||
else
|
||||
main.sendError(pParams, pErr);
|
||||
});
|
||||
else
|
||||
fs.stat(p.name, function(pError, pStat){
|
||||
if(!pError)
|
||||
if( pStat.isDirectory() )
|
||||
main.commander.getDirContent(pParams.name, function(pError, pData){
|
||||
if(!pError){
|
||||
pParams.request.url += '.json';
|
||||
pParams.data = Util.stringifyJSON(pData);
|
||||
main.sendResponse(pParams);
|
||||
}
|
||||
else
|
||||
main.sendError(pParams, pError);
|
||||
});
|
||||
else
|
||||
main.sendFile(pParams);
|
||||
else
|
||||
fs.stat(p.name, function(pError, pStat){
|
||||
if(!pError)
|
||||
if( pStat.isDirectory() )
|
||||
main.commander.getDirContent(pParams.name, function(pError, pData){
|
||||
if(!pError){
|
||||
pParams.request.url += '.json';
|
||||
pParams.data = Util.stringifyJSON(pData);
|
||||
main.sendResponse(pParams);
|
||||
}
|
||||
else
|
||||
main.sendError(pParams, pError);
|
||||
});
|
||||
else
|
||||
main.sendError(pParams, pError);
|
||||
|
||||
});
|
||||
|
||||
main.sendFile(pParams);
|
||||
else
|
||||
main.sendError(pParams, pError);
|
||||
|
||||
});
|
||||
break;
|
||||
|
||||
case 'PUT':
|
||||
|
|
@ -157,12 +156,18 @@
|
|||
case 'DELETE':
|
||||
if(lQuery === 'dir')
|
||||
fs.rmdir(p.name, function(pError){
|
||||
if(!pError)
|
||||
main.sendResponse(pParams, 'Folder ' + p.name + ' deleted.');
|
||||
else
|
||||
main.sendError(pParams, pError);
|
||||
if(!pError)
|
||||
main.sendResponse(pParams, 'Folder ' + p.name + ' deleted.');
|
||||
else
|
||||
main.sendError(pParams, pError);
|
||||
});
|
||||
else if(lQuery === 'files'){
|
||||
getBody(p.request, function(pBody){
|
||||
var lFiles = Util.parseJSON(pBody);
|
||||
for(var i = 0, n = lFiles.length; i < n; i ++)
|
||||
Util.log(lFiles[i]);
|
||||
});
|
||||
else
|
||||
}else
|
||||
fs.unlink(p.name, function(pError){
|
||||
if(!pError)
|
||||
main.sendResponse(pParams, 'File ' + p.name + ' delete.');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue