mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-02-10 18:05:10 +08:00
feat(php): implement delete all files method
This commit is contained in:
@ -594,6 +594,29 @@ footer table tr td:first-child {
|
||||
width: 4%;
|
||||
}
|
||||
|
||||
.storedHeader {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.storedHeaderClearAll {
|
||||
padding-right: 52px;
|
||||
}
|
||||
|
||||
.clear-all {
|
||||
display: inline-block;
|
||||
width: 100px;
|
||||
padding: 2px;
|
||||
outline: 1px solid #E5E5E5;
|
||||
text-align: center;
|
||||
cursor:pointer;
|
||||
text-transform: uppercase;
|
||||
background-color: #F5F5F5;
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.select-user {
|
||||
color: #444444;
|
||||
font-family: Open Sans;
|
||||
|
||||
@ -310,6 +310,22 @@ if (typeof jQuery != "undefined") {
|
||||
});
|
||||
});
|
||||
|
||||
jq(document).on("click", ".clear-all", function () {
|
||||
if (confirm("Delete all the files?")) {
|
||||
jq.ajax({
|
||||
async: true,
|
||||
contentType: "text/xml",
|
||||
type: "delete",
|
||||
url: "delete",
|
||||
complete: function (data) {
|
||||
if (JSON.parse(data.responseText).status == 'success') {
|
||||
window.location.reload(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
jq(document).on("click", "#createSample", function () {
|
||||
jq(".try-editor").each(function () {
|
||||
var href = jq(this).attr("href");
|
||||
|
||||
@ -299,12 +299,15 @@ function convert()
|
||||
function delete()
|
||||
{
|
||||
try {
|
||||
$fileName = basename($_GET["fileName"]);
|
||||
if(isset($_GET["fileName"]) && !empty($_GET["fileName"])) {
|
||||
$fileName = basename($_GET["fileName"]);
|
||||
$filePath = getStoragePath($fileName);
|
||||
|
||||
$filePath = getStoragePath($fileName);
|
||||
|
||||
unlink($filePath); // delete a file
|
||||
delTree(getHistoryDir($filePath)); // delete all the elements from the history directory
|
||||
unlink($filePath); // delete a file
|
||||
delTree(getHistoryDir($filePath)); // delete all the elements from the history directory
|
||||
} else {
|
||||
delTree(getStoragePath('')); // delete the user's folder and all the containing files
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
sendlog("Deletion ".$e->getMessage(), "webedior-ajax.log");
|
||||
$result["error"] = "error: " . $e->getMessage();
|
||||
|
||||
@ -1,5 +1,12 @@
|
||||
<div class="stored-list">
|
||||
<span class="header-list">Your documents</span>
|
||||
<div class="storedHeader">
|
||||
<div class="storedHeaderText">
|
||||
<span class="header-list">Your documents</span>
|
||||
</div>
|
||||
<div class="storedHeaderClearAll">
|
||||
<div class="clear-all">Clear all</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="tableHeader" cellspacing="0" cellpadding="0" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user