feature(edit) save file only if it was changed

This commit is contained in:
coderaiser 2013-07-17 07:28:57 +00:00
parent 5eafc73283
commit 306ed640b7
2 changed files with 21 additions and 15 deletions

View file

@ -118,6 +118,8 @@ getJSONfromFileTable.
* feature(rest) add put patch
* feature(edit) save file only if it was changed
2012.04.22, v0.2.0

View file

@ -77,22 +77,26 @@ var CloudCmd, Util, DOM, JsDiff, ace;
lValue = Ace.getValue(),
lLength = lValue.length;
DOM.setCurrentSize( lLength, lCurrent );
diff(lName, lValue, function(pDiff) {
var lData,
lPatch = '',
lDiffLength = pDiff.length;
if ( Util.strCmp(Value, lValue) )
Util.log('edit: nothing to save');
else {
DOM.setCurrentSize( lLength, lCurrent );
if (lDiffLength >= lLength)
lData = lValue;
else {
lData = pDiff;
lPatch = '?patch';
}
DOM.RESTfull.save( lPath, lData, null, lPatch);
});
diff(lName, lValue, function(pDiff) {
var lData,
lPatch = '',
lDiffLength = pDiff.length;
if (lDiffLength >= lLength)
lData = lValue;
else {
lData = pDiff;
lPatch = '?patch';
}
DOM.RESTfull.save( lPath, lData, null, lPatch);
});
}
}
});
}