Permalink
Browse files

revisions folder löschen

  • Loading branch information...
1 parent 8bec06d commit dd155a96202e1b7eb11d30b003239dcf58e45c07 Stephan committed Dec 13, 2012
Showing with 24 additions and 3 deletions.
  1. +3 −3 app/modules/localeEdit/localeEdit.js
  2. +19 −0 localeEditFileManager.js
  3. +2 −0 server.js
@@ -174,13 +174,13 @@ function(app, jquery, Views ) {
}).appendTo($fileWrapper);
$btnDelete.html('Löschen');
$btnDelete.click(function(){
- $.ajax({ url: '/api/deleteUserFile/',
+ $.ajax({ url: '/api/deleteRevisionFolder/',
type: 'POST',
data: {
- Filename: value.name
+ Foldername: value.name
}
}).success(function(data){
- Localeedit.InitFileListUi();
+ Localeedit.InitRevisionListUi();
});
});
View
@@ -90,6 +90,25 @@ exports.GetUserFiles = function(req, res) {
});
};
+exports.DeleteRevisionFolder = function(req, res) {
+ var dirName = getUserFolder(req);
+ var folderToDelete = req.body.Foldername;
+
+
+ fs.unlink(dirName + '/' + folderToDelete, function (err) {
+ if (err) {
+ //ToDo Error: EISDIR, unlink '/home/stephan/workspaces/locale-js-editor/files/user_1/201211117942_backUp'
+ res.writeHead(200, { 'Content-Type': 'application/json' });
+ res.write(JSON.stringify( { state: 'error'}));
+ res.end();
+ } else {
+ res.writeHead(200, { 'Content-Type': 'application/json' });
+ res.write(JSON.stringify( { state: 'success'}));
+ res.end();
+ }
+ });
+};
+
exports.GetCurrentRevisions = function(req, res) {
var dirName = getUserFolder(req);
console.log('Retrieving UserFiles: ');
View
@@ -179,6 +179,8 @@ app.get('/files/*', function(req, res){
//get a array of uploaded js files which represent the basis for our future work
app.get('/api/currentfiles', filemanager.GetUserFiles);
app.get('/api/getCurrentRevisions', filemanager.GetCurrentRevisions);
+app.post('/api/deleteRevisionFolder', express.bodyParser(), filemanager.DeleteRevisionFolder);
+
//get the locales as json array of locale objects
app.get('/api/getworkinglocales', filemanager.GetCurrentWorkingLocales);
app.post('/api/deleteUserFile',express.bodyParser(), filemanager.DeleteUserFile);

0 comments on commit dd155a9

Please sign in to comment.