update: file manager select color

This commit is contained in:
Usman Nasir
2020-10-22 16:15:40 +05:00
parent e4e633d920
commit b815d10600
6 changed files with 36 additions and 30 deletions

View File

@@ -11,7 +11,8 @@ from filemanager.models import Trash
class FileManager: class FileManager:
modes = {'php': 'application/x-httpd-php', 'javascript': 'javascript', 'python': 'text/x-python', modes = {'php': 'application/x-httpd-php', 'javascript': 'javascript', 'python': 'text/x-python',
'html': 'text/html', 'go': 'text/x-go', 'css': 'text/css', 'java': 'text/x-java', 'perl': 'text/x-perl'} 'html': 'text/html', 'go': 'text/x-go', 'css': 'text/css', 'java': 'text/x-java', 'perl': 'text/x-perl',
'scss': 'text/x-sass'}
def __init__(self, request, data): def __init__(self, request, data):
self.request = request self.request = request
@@ -29,12 +30,14 @@ class FileManager:
return FileManager.modes['html'] return FileManager.modes['html']
elif fileName.endswith('.go'): elif fileName.endswith('.go'):
return FileManager.modes['go'] return FileManager.modes['go']
elif fileName.endswith('.css') or fileName.endswith('.scss'): elif fileName.endswith('.css'):
return FileManager.modes['css'] return FileManager.modes['css']
elif fileName.endswith('.pl') or fileName.endswith('.PL'): elif fileName.endswith('.pl') or fileName.endswith('.PL'):
return FileManager.modes['perl'] return FileManager.modes['perl']
elif fileName.endswith('.java'): elif fileName.endswith('.java'):
return FileManager.modes['java'] return FileManager.modes['java']
elif fileName.endswith('.scss'):
return FileManager.modes['scss']
else: else:
return "" return ""
@@ -123,7 +126,12 @@ class FileManager:
""" """
elif mode == FileManager.modes['perl']: elif mode == FileManager.modes['perl']:
return """ return """
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.58.1/mode/perl/perl.min.js" integrity="sha512-6rKFA1mIjmFqxMM/b0dtjQOWFRAoqKCmhb7/6u2KohJcP4poKbrUI08Yf5GXsK+rkCr2dQnppV7gMe2a0HGQBQ==" crossorigin="anonymous"></script> """ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.58.1/mode/perl/perl.min.js" integrity="sha512-6rKFA1mIjmFqxMM/b0dtjQOWFRAoqKCmhb7/6u2KohJcP4poKbrUI08Yf5GXsK+rkCr2dQnppV7gMe2a0HGQBQ==" crossorigin="anonymous"></script>
"""
elif mode == FileManager.modes['scss']:
return """
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.58.1/mode/sass/sass.min.js" integrity="sha512-lFZETu8ovGFrFbFWAJnwgJrRcQ06C0BhjySIpBFPUatL/vqFz/mZIvXhlLtbOwbvRCp+XcLCmTEigKOJPN+YhA==" crossorigin="anonymous"></script>
"""
else: else:
return '' return ''

View File

@@ -199,4 +199,8 @@ fileManager.controller('editFileCtrl', function ($scope, $http, $window) {
}; };
$scope.closeWindow = function () {
window.close();
};
}); });

View File

@@ -310,7 +310,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
var collectionOfA = tableBody.getElementsByTagName("tr"); var collectionOfA = tableBody.getElementsByTagName("tr");
for (var i = 0; i < collectionOfA.length; i++) { for (var i = 0; i < collectionOfA.length; i++) {
collectionOfA[i].style.background = "aliceblue"; collectionOfA[i].style.background = "#ccdbe8";
var getFileName = collectionOfA[i].getElementsByTagName('td')[0].innerHTML; var getFileName = collectionOfA[i].getElementsByTagName('td')[0].innerHTML;
allFilesAndFolders.push(getFileName); allFilesAndFolders.push(getFileName);
} }
@@ -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 === "rgb(204, 219, 232)") {
var tempArray = []; var tempArray = [];
nodeName.style.background = "None"; nodeName.style.background = "None";
@@ -356,7 +356,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
return; return;
} }
nodeName.style.background = "aliceblue"; nodeName.style.background = "#ccdbe8";
for (var j = 0; j < allFilesAndFolders.length; j++) { for (var j = 0; j < allFilesAndFolders.length; j++) {
@@ -1179,7 +1179,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
}; };
/// move /// move
$scope.moveLoading = true; $scope.moveLoading = true;
@@ -1196,7 +1195,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
} }
$scope.startMoving = function () { $scope.startMoving = function () {
$scope.moveLoading = false; $scope.moveLoading = false;
@@ -1340,7 +1338,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 === "#ccdbe8") {
var tempArray = []; var tempArray = [];
nodeName.style.background = "None"; nodeName.style.background = "None";
@@ -1356,7 +1354,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
return; return;
} }
nodeName.style.background = "aliceblue"; nodeName.style.background = "#ccdbe8";
for (var j = 0; j < allFilesAndFolders.length; j++) { for (var j = 0; j < allFilesAndFolders.length; j++) {
@@ -1372,7 +1370,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
// activating deactivating functions // activating deactivating functions
$scope.buttonActivator(); $scope.buttonActivator();
}; };
// rename // rename

View File

@@ -148,6 +148,13 @@
</select> </select>
{{ additionalOptions | safe }} {{ additionalOptions | safe }}
</ul> </ul>
<button style="float:right" ng-click="putFileContents()" type="button"
class="btn btn-light">{% trans "Save Changes" %} <img ng-hide="cyberPanelLoading"
src="{% static 'filemanager/images/loadingSmall.gif' %}">
</button>
<button style="float:right; margin-left: 1%" ng-click="closeWindow()" type="button"
class="btn btn-danger">{% trans "Close" %}
</button>
</div> </div>
</nav> </nav>
@@ -166,17 +173,6 @@
</div> </div>
</div> </div>
<div class="fixed-bottom">
<div class="card" style="margin-left: 15%; margin-right: 15%; margin-bottom: -1%">
<div class="card-body">
<p><span>Editing {{ fileName }}</span>
<button style="float:right" ng-click="putFileContents()" type="button"
class="btn btn-outline-success">{% trans "Save Changes" %} <img ng-hide="cyberPanelLoading" src="{% static 'filemanager/images/loadingSmall.gif' %}"></button>
</p>
</div>
</div>
</div>
</div> </div>
<!--- File Manager body ends ----> <!--- File Manager body ends ---->

View File

@@ -199,4 +199,8 @@ fileManager.controller('editFileCtrl', function ($scope, $http, $window) {
}; };
$scope.closeWindow = function () {
window.close();
};
}); });

View File

@@ -310,7 +310,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
var collectionOfA = tableBody.getElementsByTagName("tr"); var collectionOfA = tableBody.getElementsByTagName("tr");
for (var i = 0; i < collectionOfA.length; i++) { for (var i = 0; i < collectionOfA.length; i++) {
collectionOfA[i].style.background = "aliceblue"; collectionOfA[i].style.background = "#ccdbe8";
var getFileName = collectionOfA[i].getElementsByTagName('td')[0].innerHTML; var getFileName = collectionOfA[i].getElementsByTagName('td')[0].innerHTML;
allFilesAndFolders.push(getFileName); allFilesAndFolders.push(getFileName);
} }
@@ -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 === "rgb(204, 219, 232)") {
var tempArray = []; var tempArray = [];
nodeName.style.background = "None"; nodeName.style.background = "None";
@@ -356,7 +356,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
return; return;
} }
nodeName.style.background = "aliceblue"; nodeName.style.background = "#ccdbe8";
for (var j = 0; j < allFilesAndFolders.length; j++) { for (var j = 0; j < allFilesAndFolders.length; j++) {
@@ -1179,7 +1179,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
}; };
/// move /// move
$scope.moveLoading = true; $scope.moveLoading = true;
@@ -1196,7 +1195,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
} }
$scope.startMoving = function () { $scope.startMoving = function () {
$scope.moveLoading = false; $scope.moveLoading = false;
@@ -1340,7 +1338,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 === "#ccdbe8") {
var tempArray = []; var tempArray = [];
nodeName.style.background = "None"; nodeName.style.background = "None";
@@ -1356,7 +1354,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
return; return;
} }
nodeName.style.background = "aliceblue"; nodeName.style.background = "#ccdbe8";
for (var j = 0; j < allFilesAndFolders.length; j++) { for (var j = 0; j < allFilesAndFolders.length; j++) {
@@ -1372,7 +1370,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
// activating deactivating functions // activating deactivating functions
$scope.buttonActivator(); $scope.buttonActivator();
}; };
// rename // rename