mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
feature(rest) write -> save
This commit is contained in:
parent
3d16dd8137
commit
c27f30f84b
5 changed files with 16 additions and 10 deletions
|
|
@ -572,7 +572,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
lName = Dialog.prompt(lMsg, lName);
|
||||
|
||||
if (lName)
|
||||
RESTful.save(lDir + lName + lType, null, CloudCmd.refresh);
|
||||
RESTful.write(lDir + lName + lType, null, CloudCmd.refresh);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -942,10 +942,13 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
* @callback - function({data, name}) {}
|
||||
* @currentFile
|
||||
*/
|
||||
this.saveCurrentData = function(url, data, callback, query) {
|
||||
DOM.RESTful.save(url, data, function() {
|
||||
this.saveCurrentData = function(url, data, callback, query) {
|
||||
if (!query)
|
||||
query = '';
|
||||
|
||||
DOM.RESTful.write(url + query, data, function() {
|
||||
DOM.saveDataToStorage(url, data);
|
||||
}, query);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -185,7 +185,10 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
|
|||
Value = lValue;
|
||||
|
||||
Util.ifExec(isLength && !isAllowed, function() {
|
||||
DOM.RESTful.save(lPath, lValue, onSave, query);
|
||||
if (!query)
|
||||
query = '';
|
||||
|
||||
DOM.RESTful.write(lPath + query, lValue, onSave);
|
||||
}, function(callback) {
|
||||
DOM.checkStorageHash(lPath, function(error, equal) {
|
||||
var isString = Util.isString(patch),
|
||||
|
|
@ -272,7 +275,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch;
|
|||
ret = Dialog.confirm(text + msg);
|
||||
|
||||
if (ret)
|
||||
DOM.RESTful.save(path, Value, onSave);
|
||||
DOM.RESTful.write(path, Value, onSave);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ var Util, DOM, CloudCmd;
|
|||
var path = dir + file.name,
|
||||
data = event.target.result;
|
||||
|
||||
DOM.RESTful.save(path, data, CloudCmd.refresh);
|
||||
DOM.RESTful.write(path, data, CloudCmd.refresh);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
|
|||
CloudCmd.execFromModule('FilePicker', 'saveFile', function(pName, pData) {
|
||||
var lPath = DOM.getCurrentDirPath() + pName;
|
||||
|
||||
DOM.RESTful.save(lPath, pData, CloudCmd.refresh);
|
||||
DOM.RESTful.write(lPath, pData, CloudCmd.refresh);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ var Util, DOM, CloudCmd;
|
|||
});
|
||||
};
|
||||
|
||||
this.save = function(url, data, callback, query) {
|
||||
this.write = function(url, data, callback) {
|
||||
sendRequest({
|
||||
method : 'PUT',
|
||||
url : CloudFunc.FS + url + (query || ''),
|
||||
url : CloudFunc.FS + url,
|
||||
data : data,
|
||||
callback : callback,
|
||||
imgPosition : { top: true }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue