mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-14 09:16:11 +01:00
This commit is contained in:
@@ -6,6 +6,7 @@ from websiteFunctions.models import Websites
|
|||||||
from random import randint
|
from random import randint
|
||||||
from django.core.files.storage import FileSystemStorage
|
from django.core.files.storage import FileSystemStorage
|
||||||
from plogical.acl import ACLManager
|
from plogical.acl import ACLManager
|
||||||
|
from filemanager.models import Trash
|
||||||
|
|
||||||
class FileManager:
|
class FileManager:
|
||||||
def __init__(self, request, data):
|
def __init__(self, request, data):
|
||||||
@@ -172,6 +173,12 @@ class FileManager:
|
|||||||
finalData['status'] = 1
|
finalData['status'] = 1
|
||||||
|
|
||||||
domainName = self.data['domainName']
|
domainName = self.data['domainName']
|
||||||
|
|
||||||
|
try:
|
||||||
|
skipTrash = self.data['skipTrash']
|
||||||
|
except:
|
||||||
|
skipTrash = False
|
||||||
|
|
||||||
website = Websites.objects.get(domain=domainName)
|
website = Websites.objects.get(domain=domainName)
|
||||||
self.homePath = '/home/%s' % (domainName)
|
self.homePath = '/home/%s' % (domainName)
|
||||||
|
|
||||||
@@ -180,8 +187,55 @@ class FileManager:
|
|||||||
if (self.data['path'] + '/' + item).find('..') > -1 or (self.data['path'] + '/' + item).find(self.homePath) == -1:
|
if (self.data['path'] + '/' + item).find('..') > -1 or (self.data['path'] + '/' + item).find(self.homePath) == -1:
|
||||||
return self.ajaxPre(0, 'Not allowed to move in this path, please choose location inside home!')
|
return self.ajaxPre(0, 'Not allowed to move in this path, please choose location inside home!')
|
||||||
|
|
||||||
|
if skipTrash:
|
||||||
command = 'rm -rf ' + self.returnPathEnclosed(self.data['path'] + '/' + item)
|
command = 'rm -rf ' + self.returnPathEnclosed(self.data['path'] + '/' + item)
|
||||||
ProcessUtilities.executioner(command, website.externalApp)
|
ProcessUtilities.executioner(command, website.externalApp)
|
||||||
|
else:
|
||||||
|
trashPath = '%s/.trash' % (self.homePath)
|
||||||
|
|
||||||
|
command = 'mkdir %s' % (trashPath)
|
||||||
|
ProcessUtilities.executioner(command, website.externalApp)
|
||||||
|
|
||||||
|
Trash(website=website, originalPath=self.returnPathEnclosed(self.data['path']), fileName=self.returnPathEnclosed(item)).save()
|
||||||
|
|
||||||
|
command = 'mv %s %s' % (self.returnPathEnclosed(self.data['path'] + '/' + item), trashPath)
|
||||||
|
ProcessUtilities.executioner(command, website.externalApp)
|
||||||
|
|
||||||
|
json_data = json.dumps(finalData)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
return self.ajaxPre(0, str(msg))
|
||||||
|
|
||||||
|
def restore(self):
|
||||||
|
try:
|
||||||
|
finalData = {}
|
||||||
|
finalData['status'] = 1
|
||||||
|
|
||||||
|
domainName = self.data['domainName']
|
||||||
|
|
||||||
|
try:
|
||||||
|
skipTrash = self.data['skipTrash']
|
||||||
|
except:
|
||||||
|
skipTrash = False
|
||||||
|
|
||||||
|
website = Websites.objects.get(domain=domainName)
|
||||||
|
self.homePath = '/home/%s' % (domainName)
|
||||||
|
|
||||||
|
for item in self.data['fileAndFolders']:
|
||||||
|
|
||||||
|
if (self.data['path'] + '/' + item).find('..') > -1 or (self.data['path'] + '/' + item).find(self.homePath) == -1:
|
||||||
|
return self.ajaxPre(0, 'Not allowed to move in this path, please choose location inside home!')
|
||||||
|
|
||||||
|
trashPath = '%s/.trash' % (self.homePath)
|
||||||
|
|
||||||
|
tItem = Trash.objects.get(website=website, fileName=self.returnPathEnclosed(item))
|
||||||
|
|
||||||
|
command = 'mv %s %s' % (self.returnPathEnclosed(trashPath + '/' + item), tItem.originalPath)
|
||||||
|
ProcessUtilities.executioner(command, website.externalApp)
|
||||||
|
|
||||||
|
tItem.delete()
|
||||||
|
|
||||||
|
|
||||||
json_data = json.dumps(finalData)
|
json_data = json.dumps(finalData)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
$scope.currentPath = "/home/" + domainName;
|
$scope.currentPath = "/home/" + domainName;
|
||||||
$scope.startingPath = domainName;
|
$scope.startingPath = domainName;
|
||||||
$scope.completeStartingPath = "/home/" + domainName;
|
$scope.completeStartingPath = "/home/" + domainName;
|
||||||
|
var trashPath = homePathBack + '/.trash'
|
||||||
|
|
||||||
$scope.editDisable = true;
|
$scope.editDisable = true;
|
||||||
// disable loading image on tree loading
|
// disable loading image on tree loading
|
||||||
@@ -218,7 +219,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function prepareChildNodeUL() {
|
function prepareChildNodeUL() {
|
||||||
|
|
||||||
// text nodes are created
|
// text nodes are created
|
||||||
@@ -305,7 +305,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
|
|
||||||
var tableBody = document.getElementById("tableBodyFiles");
|
var tableBody = document.getElementById("tableBodyFiles");
|
||||||
var getFileName = tableBody.firstChild.firstChild.innerHTML;
|
var getFileName = tableBody.firstChild.firstChild.innerHTML;
|
||||||
allFilesAndFolders = []
|
allFilesAndFolders = [];
|
||||||
|
|
||||||
var collectionOfA = tableBody.getElementsByTagName("tr");
|
var collectionOfA = tableBody.getElementsByTagName("tr");
|
||||||
|
|
||||||
@@ -340,7 +340,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
var check = 1;
|
var check = 1;
|
||||||
var getFileName = nodeName.getElementsByTagName('td')[0].innerHTML;
|
var getFileName = nodeName.getElementsByTagName('td')[0].innerHTML;
|
||||||
|
|
||||||
if (nodeName.style.backgroundColor == "aliceblue") {
|
if (nodeName.style.backgroundColor === "aliceblue") {
|
||||||
|
|
||||||
var tempArray = [];
|
var tempArray = [];
|
||||||
nodeName.style.background = "None";
|
nodeName.style.background = "None";
|
||||||
@@ -375,19 +375,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th scope="row"><i class="fa fa-folder" aria-hidden="true"></i></th>
|
|
||||||
<td>public_html</td>
|
|
||||||
<td>26KB</td>
|
|
||||||
<td>26 Oct</td>
|
|
||||||
<td>775</td>
|
|
||||||
<td>Folder/File</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
function createTR(fileName, fileSize, lastModified, permissions, dirCheck) {
|
function createTR(fileName, fileSize, lastModified, permissions, dirCheck) {
|
||||||
|
|
||||||
// text nodes are created
|
// text nodes are created
|
||||||
@@ -396,10 +383,8 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
var lastModifiedNode = document.createTextNode(lastModified);
|
var lastModifiedNode = document.createTextNode(lastModified);
|
||||||
var permissionsNode = document.createTextNode(permissions);
|
var permissionsNode = document.createTextNode(permissions);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
var iNodeFolder = document.createElement('i');
|
var iNodeFolder = document.createElement('i');
|
||||||
iNodeFolder.setAttribute('class', 'fa fa-folder');
|
iNodeFolder.setAttribute('class', 'fa fa-folder');
|
||||||
iNodeFolder.setAttribute('aria-hidden', 'true');
|
iNodeFolder.setAttribute('aria-hidden', 'true');
|
||||||
@@ -454,7 +439,8 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
|
|
||||||
var fileOrFolderNode = document.createTextNode("Folder");
|
var fileOrFolderNode = document.createTextNode("Folder");
|
||||||
fifthTDNode.appendChild(fileOrFolderNode)
|
fifthTDNode.appendChild(fileOrFolderNode)
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
thNode.appendChild(iNodeFile);
|
thNode.appendChild(iNodeFile);
|
||||||
trNode.appendChild(thNode);
|
trNode.appendChild(thNode);
|
||||||
trNode.addEventListener("click", function () {
|
trNode.addEventListener("click", function () {
|
||||||
@@ -485,6 +471,14 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
|
|
||||||
$scope.buttonActivator = function () {
|
$scope.buttonActivator = function () {
|
||||||
|
|
||||||
|
// for restore button
|
||||||
|
if($scope.currentPath === trashPath) {
|
||||||
|
var restoreBTN = document.getElementById("restoreRight");
|
||||||
|
restoreBTN.style.display = "block";
|
||||||
|
}else{
|
||||||
|
var restoreBTN = document.getElementById("restoreRight");
|
||||||
|
restoreBTN.style.display = "none";
|
||||||
|
}
|
||||||
// for edit button
|
// for edit button
|
||||||
if (allFilesAndFolders.length === 1) {
|
if (allFilesAndFolders.length === 1) {
|
||||||
var editNode = document.getElementById("editFile");
|
var editNode = document.getElementById("editFile");
|
||||||
@@ -507,7 +501,12 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
} else if (result[0] === "php") {
|
} else if (result[0] === "php") {
|
||||||
aceEditorMode = "ace/mode/php";
|
aceEditorMode = "ace/mode/php";
|
||||||
editNotRight.style.display = "Block";
|
editNotRight.style.display = "Block";
|
||||||
} else if (result[0] === "txt") {
|
}
|
||||||
|
else if (result[0] === "py") {
|
||||||
|
aceEditorMode = "ace/mode/python";
|
||||||
|
editNotRight.style.display = "Block";
|
||||||
|
}
|
||||||
|
else if (result[0] === "txt") {
|
||||||
aceEditorMode = "";
|
aceEditorMode = "";
|
||||||
editNotRight.style.display = "Block";
|
editNotRight.style.display = "Block";
|
||||||
} else if (result[0] === "htaccess") {
|
} else if (result[0] === "htaccess") {
|
||||||
@@ -523,7 +522,8 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
editNode.style.pointerEvents = "none";
|
editNode.style.pointerEvents = "none";
|
||||||
editNotRight.style.display = "None";
|
editNotRight.style.display = "None";
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
var editNode = document.getElementById("editFile");
|
var editNode = document.getElementById("editFile");
|
||||||
editNode.style.pointerEvents = "none";
|
editNode.style.pointerEvents = "none";
|
||||||
}
|
}
|
||||||
@@ -1385,7 +1385,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$scope.renameFile = function () {
|
$scope.renameFile = function () {
|
||||||
|
|
||||||
$scope.renameLoading = false;
|
$scope.renameLoading = false;
|
||||||
@@ -1494,13 +1493,11 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
$scope.groupPermissions = 0;
|
$scope.groupPermissions = 0;
|
||||||
$scope.wordlPermissions = 0;
|
$scope.wordlPermissions = 0;
|
||||||
|
|
||||||
|
|
||||||
$scope.showPermissionsModal = function () {
|
$scope.showPermissionsModal = function () {
|
||||||
$('#showPermissions').modal('show');
|
$('#showPermissions').modal('show');
|
||||||
$scope.permissionsPath = allFilesAndFolders[0];
|
$scope.permissionsPath = allFilesAndFolders[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$scope.updateReadPermissions = function (value) {
|
$scope.updateReadPermissions = function (value) {
|
||||||
|
|
||||||
switch (value) {
|
switch (value) {
|
||||||
@@ -1618,7 +1615,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$scope.changePermissionsRecursively = function () {
|
$scope.changePermissionsRecursively = function () {
|
||||||
$scope.changePermissions(1);
|
$scope.changePermissions(1);
|
||||||
};
|
};
|
||||||
@@ -1670,5 +1666,53 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///
|
||||||
|
|
||||||
|
//
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
$scope.showRestoreModal = function () {
|
||||||
|
$scope.createSuccess = true;
|
||||||
|
$scope.errorMessageFolder = true;
|
||||||
|
$scope.newFolderName = "";
|
||||||
|
$('#showRestore').modal('show');
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.restoreFinal = function () {
|
||||||
|
$scope.cyberPanelLoading = false;
|
||||||
|
var data = {
|
||||||
|
path: $scope.currentPath,
|
||||||
|
method: "restore",
|
||||||
|
fileAndFolders: allFilesAndFolders,
|
||||||
|
domainRandomSeed: domainRandomSeed,
|
||||||
|
domainName: domainName,
|
||||||
|
};
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
$('#showRestore').modal('hide');
|
||||||
|
var notification = alertify.notify('Successfully restored to its original location!', 'success', 5, function () {
|
||||||
|
});
|
||||||
|
$scope.fetchForTableSecondary(null, 'refresh');
|
||||||
|
} else {
|
||||||
|
var notification = alertify.notify('Files/Folders can not be restored', 'error', 5, function () {
|
||||||
|
console.log('dismissed');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -662,6 +662,37 @@
|
|||||||
<!--- Permissions modal -->
|
<!--- Permissions modal -->
|
||||||
|
|
||||||
|
|
||||||
|
<!--- Restore modal -->
|
||||||
|
|
||||||
|
<div id="showRestore" class="modal fade bd-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div id="htmlEditorLable" class="modal-header">
|
||||||
|
<h5 class="modal-title" >{% trans "Confirm Restore!" %} <img ng-hide="cyberPanelLoading" src="{% static 'filemanager/images/loadingSmall.gif' %}"></h5>
|
||||||
|
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form action="/">
|
||||||
|
<div class="form-group">
|
||||||
|
<small class="form-text text-muted">{% trans "This will restore file to its original location." %}</small>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<p>Are you sure?</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button ng-click="restoreFinal()" type="button" class="btn btn-primary">{% trans "Restore" %}</button>
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">{% trans "Close" %}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--- Restore modal -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -704,6 +735,7 @@
|
|||||||
<a style="border-bottom: 1px solid #007bff;" onclick="return false;" ng-click="showCompressionModal()" href="#"><li class="list-group-item"><i class="fa fa-compress" aria-hidden="true"></i> {% trans "Compress" %}</li></a>
|
<a style="border-bottom: 1px solid #007bff;" onclick="return false;" ng-click="showCompressionModal()" href="#"><li class="list-group-item"><i class="fa fa-compress" aria-hidden="true"></i> {% trans "Compress" %}</li></a>
|
||||||
<a style="border-bottom: 1px solid #007bff;" id="extractOnRight" onclick="return false;" ng-click="showExtractionModal()" href="#"><li class="list-group-item"><i class="fa fa-expand" aria-hidden="true"></i> {% trans "Extract" %}</li></a>
|
<a style="border-bottom: 1px solid #007bff;" id="extractOnRight" onclick="return false;" ng-click="showExtractionModal()" href="#"><li class="list-group-item"><i class="fa fa-expand" aria-hidden="true"></i> {% trans "Extract" %}</li></a>
|
||||||
<a style="border-bottom: 1px solid #007bff;" id="editOnRight" onclick="return false;" ng-click="showHTMLEditorModal()" href="#"><li class="list-group-item"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> {% trans "Edit" %}</li></a>
|
<a style="border-bottom: 1px solid #007bff;" id="editOnRight" onclick="return false;" ng-click="showHTMLEditorModal()" href="#"><li class="list-group-item"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> {% trans "Edit" %}</li></a>
|
||||||
|
<a style="border-bottom: 1px solid #007bff;" id="restoreRight" onclick="return false;" ng-click="showRestoreModal()" href="#"><li class="list-group-item"><i class="fa fa-window-restore" aria-hidden="true"></i> {% trans "Restore" %}</li></a>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -120,6 +120,8 @@ def controller(request):
|
|||||||
return fm.createNewFolder()
|
return fm.createNewFolder()
|
||||||
elif method == 'deleteFolderOrFile':
|
elif method == 'deleteFolderOrFile':
|
||||||
return fm.deleteFolderOrFile()
|
return fm.deleteFolderOrFile()
|
||||||
|
elif method == 'restore':
|
||||||
|
return fm.restore()
|
||||||
elif method == 'copy':
|
elif method == 'copy':
|
||||||
return fm.copy()
|
return fm.copy()
|
||||||
elif method == 'move':
|
elif method == 'move':
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
$scope.currentPath = "/home/" + domainName;
|
$scope.currentPath = "/home/" + domainName;
|
||||||
$scope.startingPath = domainName;
|
$scope.startingPath = domainName;
|
||||||
$scope.completeStartingPath = "/home/" + domainName;
|
$scope.completeStartingPath = "/home/" + domainName;
|
||||||
|
var trashPath = homePathBack + '/.trash'
|
||||||
|
|
||||||
$scope.editDisable = true;
|
$scope.editDisable = true;
|
||||||
// disable loading image on tree loading
|
// disable loading image on tree loading
|
||||||
@@ -218,7 +219,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function prepareChildNodeUL() {
|
function prepareChildNodeUL() {
|
||||||
|
|
||||||
// text nodes are created
|
// text nodes are created
|
||||||
@@ -305,7 +305,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
|
|
||||||
var tableBody = document.getElementById("tableBodyFiles");
|
var tableBody = document.getElementById("tableBodyFiles");
|
||||||
var getFileName = tableBody.firstChild.firstChild.innerHTML;
|
var getFileName = tableBody.firstChild.firstChild.innerHTML;
|
||||||
allFilesAndFolders = []
|
allFilesAndFolders = [];
|
||||||
|
|
||||||
var collectionOfA = tableBody.getElementsByTagName("tr");
|
var collectionOfA = tableBody.getElementsByTagName("tr");
|
||||||
|
|
||||||
@@ -340,7 +340,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
var check = 1;
|
var check = 1;
|
||||||
var getFileName = nodeName.getElementsByTagName('td')[0].innerHTML;
|
var getFileName = nodeName.getElementsByTagName('td')[0].innerHTML;
|
||||||
|
|
||||||
if (nodeName.style.backgroundColor == "aliceblue") {
|
if (nodeName.style.backgroundColor === "aliceblue") {
|
||||||
|
|
||||||
var tempArray = [];
|
var tempArray = [];
|
||||||
nodeName.style.background = "None";
|
nodeName.style.background = "None";
|
||||||
@@ -375,19 +375,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<th scope="row"><i class="fa fa-folder" aria-hidden="true"></i></th>
|
|
||||||
<td>public_html</td>
|
|
||||||
<td>26KB</td>
|
|
||||||
<td>26 Oct</td>
|
|
||||||
<td>775</td>
|
|
||||||
<td>Folder/File</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
function createTR(fileName, fileSize, lastModified, permissions, dirCheck) {
|
function createTR(fileName, fileSize, lastModified, permissions, dirCheck) {
|
||||||
|
|
||||||
// text nodes are created
|
// text nodes are created
|
||||||
@@ -396,10 +383,8 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
var lastModifiedNode = document.createTextNode(lastModified);
|
var lastModifiedNode = document.createTextNode(lastModified);
|
||||||
var permissionsNode = document.createTextNode(permissions);
|
var permissionsNode = document.createTextNode(permissions);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
var iNodeFolder = document.createElement('i');
|
var iNodeFolder = document.createElement('i');
|
||||||
iNodeFolder.setAttribute('class', 'fa fa-folder');
|
iNodeFolder.setAttribute('class', 'fa fa-folder');
|
||||||
iNodeFolder.setAttribute('aria-hidden', 'true');
|
iNodeFolder.setAttribute('aria-hidden', 'true');
|
||||||
@@ -454,7 +439,8 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
|
|
||||||
var fileOrFolderNode = document.createTextNode("Folder");
|
var fileOrFolderNode = document.createTextNode("Folder");
|
||||||
fifthTDNode.appendChild(fileOrFolderNode)
|
fifthTDNode.appendChild(fileOrFolderNode)
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
thNode.appendChild(iNodeFile);
|
thNode.appendChild(iNodeFile);
|
||||||
trNode.appendChild(thNode);
|
trNode.appendChild(thNode);
|
||||||
trNode.addEventListener("click", function () {
|
trNode.addEventListener("click", function () {
|
||||||
@@ -485,6 +471,14 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
|
|
||||||
$scope.buttonActivator = function () {
|
$scope.buttonActivator = function () {
|
||||||
|
|
||||||
|
// for restore button
|
||||||
|
if($scope.currentPath === trashPath) {
|
||||||
|
var restoreBTN = document.getElementById("restoreRight");
|
||||||
|
restoreBTN.style.display = "block";
|
||||||
|
}else{
|
||||||
|
var restoreBTN = document.getElementById("restoreRight");
|
||||||
|
restoreBTN.style.display = "none";
|
||||||
|
}
|
||||||
// for edit button
|
// for edit button
|
||||||
if (allFilesAndFolders.length === 1) {
|
if (allFilesAndFolders.length === 1) {
|
||||||
var editNode = document.getElementById("editFile");
|
var editNode = document.getElementById("editFile");
|
||||||
@@ -507,7 +501,12 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
} else if (result[0] === "php") {
|
} else if (result[0] === "php") {
|
||||||
aceEditorMode = "ace/mode/php";
|
aceEditorMode = "ace/mode/php";
|
||||||
editNotRight.style.display = "Block";
|
editNotRight.style.display = "Block";
|
||||||
} else if (result[0] === "txt") {
|
}
|
||||||
|
else if (result[0] === "py") {
|
||||||
|
aceEditorMode = "ace/mode/python";
|
||||||
|
editNotRight.style.display = "Block";
|
||||||
|
}
|
||||||
|
else if (result[0] === "txt") {
|
||||||
aceEditorMode = "";
|
aceEditorMode = "";
|
||||||
editNotRight.style.display = "Block";
|
editNotRight.style.display = "Block";
|
||||||
} else if (result[0] === "htaccess") {
|
} else if (result[0] === "htaccess") {
|
||||||
@@ -523,7 +522,8 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
editNode.style.pointerEvents = "none";
|
editNode.style.pointerEvents = "none";
|
||||||
editNotRight.style.display = "None";
|
editNotRight.style.display = "None";
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
var editNode = document.getElementById("editFile");
|
var editNode = document.getElementById("editFile");
|
||||||
editNode.style.pointerEvents = "none";
|
editNode.style.pointerEvents = "none";
|
||||||
}
|
}
|
||||||
@@ -1007,7 +1007,8 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
method: "deleteFolderOrFile",
|
method: "deleteFolderOrFile",
|
||||||
fileAndFolders: allFilesAndFolders,
|
fileAndFolders: allFilesAndFolders,
|
||||||
domainRandomSeed: domainRandomSeed,
|
domainRandomSeed: domainRandomSeed,
|
||||||
domainName: domainName
|
domainName: domainName,
|
||||||
|
skipTrash: $scope.skipTrash
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1384,7 +1385,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$scope.renameFile = function () {
|
$scope.renameFile = function () {
|
||||||
|
|
||||||
$scope.renameLoading = false;
|
$scope.renameLoading = false;
|
||||||
@@ -1493,13 +1493,11 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
$scope.groupPermissions = 0;
|
$scope.groupPermissions = 0;
|
||||||
$scope.wordlPermissions = 0;
|
$scope.wordlPermissions = 0;
|
||||||
|
|
||||||
|
|
||||||
$scope.showPermissionsModal = function () {
|
$scope.showPermissionsModal = function () {
|
||||||
$('#showPermissions').modal('show');
|
$('#showPermissions').modal('show');
|
||||||
$scope.permissionsPath = allFilesAndFolders[0];
|
$scope.permissionsPath = allFilesAndFolders[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$scope.updateReadPermissions = function (value) {
|
$scope.updateReadPermissions = function (value) {
|
||||||
|
|
||||||
switch (value) {
|
switch (value) {
|
||||||
@@ -1617,7 +1615,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
$scope.changePermissionsRecursively = function () {
|
$scope.changePermissionsRecursively = function () {
|
||||||
$scope.changePermissions(1);
|
$scope.changePermissions(1);
|
||||||
};
|
};
|
||||||
@@ -1669,5 +1666,53 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///
|
||||||
|
|
||||||
|
//
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
$scope.showRestoreModal = function () {
|
||||||
|
$scope.createSuccess = true;
|
||||||
|
$scope.errorMessageFolder = true;
|
||||||
|
$scope.newFolderName = "";
|
||||||
|
$('#showRestore').modal('show');
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.restoreFinal = function () {
|
||||||
|
$scope.cyberPanelLoading = false;
|
||||||
|
var data = {
|
||||||
|
path: $scope.currentPath,
|
||||||
|
method: "restore",
|
||||||
|
fileAndFolders: allFilesAndFolders,
|
||||||
|
domainRandomSeed: domainRandomSeed,
|
||||||
|
domainName: domainName,
|
||||||
|
};
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
$('#showRestore').modal('hide');
|
||||||
|
var notification = alertify.notify('Successfully restored to its original location!', 'success', 5, function () {
|
||||||
|
});
|
||||||
|
$scope.fetchForTableSecondary(null, 'refresh');
|
||||||
|
} else {
|
||||||
|
var notification = alertify.notify('Files/Folders can not be restored', 'error', 5, function () {
|
||||||
|
console.log('dismissed');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user