diff --git a/web/documentserver-example/nodejs/app.js b/web/documentserver-example/nodejs/app.js
index 9e1465b8..815e8b83 100644
--- a/web/documentserver-example/nodejs/app.js
+++ b/web/documentserver-example/nodejs/app.js
@@ -227,6 +227,41 @@ app.get("/convert", function (req, res) {
});
+app.delete("/file", function (req, res) {
+ try {
+ docManager.init(__dirname, req, res);
+
+ var fileName = req.query.filename;
+
+ var filePath = docManager.storagePath(fileName)
+ fileSystem.unlinkSync(filePath);
+
+ var userAddress = docManager.curUserHostAddress();
+ var historyPath = docManager.historyPath(fileName, userAddress, true);
+
+ var deleteFolderRecursive = function (path) {
+ if (fileSystem.existsSync(path)) {
+ var files = fileSystem.readdirSync(path);
+ files.forEach(function (file, index) {
+ var curPath = path + "/" + file;
+ if (fileSystem.lstatSync(curPath).isDirectory()) {
+ deleteFolderRecursive(curPath);
+ } else {
+ fileSystem.unlinkSync(curPath);
+ }
+ });
+ fileSystem.rmdirSync(path);
+ }
+ };
+ deleteFolderRecursive(historyPath);
+
+ res.write("{\"success\":true}");
+ } catch (ex) {
+ res.write(JSON.stringify(ex));
+ }
+ res.end();
+});
+
app.post("/track", function (req, res) {
docManager.init(__dirname, req, res);
diff --git a/web/documentserver-example/nodejs/public/images/delete-24.png b/web/documentserver-example/nodejs/public/images/delete-24.png
new file mode 100644
index 00000000..d4d2fc74
Binary files /dev/null and b/web/documentserver-example/nodejs/public/images/delete-24.png differ
diff --git a/web/documentserver-example/nodejs/public/javascripts/jscript.js b/web/documentserver-example/nodejs/public/javascripts/jscript.js
index ab90d1c6..2d07b542 100644
--- a/web/documentserver-example/nodejs/public/javascripts/jscript.js
+++ b/web/documentserver-example/nodejs/public/javascripts/jscript.js
@@ -262,6 +262,22 @@ if (typeof jQuery != "undefined") {
jq.unblockUI();
});
+ jq(document).on("click", ".delete-file", function () {
+ var fileName = jq(this).attr("data");
+
+ var requestAddress = "file?filename=" + fileName;
+
+ jq.ajax({
+ async: true,
+ contentType: "text/xml",
+ type: "delete",
+ url: requestAddress,
+ complete: function (data) {
+ document.location.reload();
+ }
+ });
+ });
+
jq.dropdownToggle({
switcherSelector: ".question",
dropdownID: "hint"
diff --git a/web/documentserver-example/nodejs/public/stylesheets/stylesheet.css b/web/documentserver-example/nodejs/public/stylesheets/stylesheet.css
index 2efc0e68..43d9e617 100644
--- a/web/documentserver-example/nodejs/public/stylesheets/stylesheet.css
+++ b/web/documentserver-example/nodejs/public/stylesheets/stylesheet.css
@@ -482,3 +482,7 @@ footer {
.icon-download {
margin-bottom: -5px;
}
+.icon-delete {
+ cursor: pointer;
+ margin-bottom: -6px;
+}
diff --git a/web/documentserver-example/nodejs/views/index.ejs b/web/documentserver-example/nodejs/views/index.ejs
index 696e5a6e..62d64ff7 100644
--- a/web/documentserver-example/nodejs/views/index.ejs
+++ b/web/documentserver-example/nodejs/views/index.ejs
@@ -183,6 +183,8 @@
<%= storedFiles[i].name %>
+
+