Skip to content

Commit

Permalink
update: file manager select color
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Oct 22, 2020
1 parent e4e633d commit b815d10
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 30 deletions.
14 changes: 11 additions & 3 deletions filemanager/filemanager.py
Expand Up @@ -11,7 +11,8 @@

class FileManager:
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):
self.request = request
Expand All @@ -29,12 +30,14 @@ def findMode(fileName):
return FileManager.modes['html']
elif fileName.endswith('.go'):
return FileManager.modes['go']
elif fileName.endswith('.css') or fileName.endswith('.scss'):
elif fileName.endswith('.css'):
return FileManager.modes['css']
elif fileName.endswith('.pl') or fileName.endswith('.PL'):
return FileManager.modes['perl']
elif fileName.endswith('.java'):
return FileManager.modes['java']
elif fileName.endswith('.scss'):
return FileManager.modes['scss']
else:
return ""

Expand Down Expand Up @@ -123,7 +126,12 @@ def findModeFiles(mode):
"""
elif mode == FileManager.modes['perl']:
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:
return ''

Expand Down
4 changes: 4 additions & 0 deletions filemanager/static/filemanager/js/codeMirror.js
Expand Up @@ -199,4 +199,8 @@ fileManager.controller('editFileCtrl', function ($scope, $http, $window) {

};

$scope.closeWindow = function () {
window.close();
};

});
13 changes: 5 additions & 8 deletions filemanager/static/filemanager/js/fileManager.js
Expand Up @@ -310,7 +310,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
var collectionOfA = tableBody.getElementsByTagName("tr");

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;
allFilesAndFolders.push(getFileName);
}
Expand Down Expand Up @@ -340,7 +340,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
var check = 1;
var getFileName = nodeName.getElementsByTagName('td')[0].innerHTML;

if (nodeName.style.backgroundColor === "aliceblue") {
if (nodeName.style.backgroundColor === "rgb(204, 219, 232)") {

var tempArray = [];
nodeName.style.background = "None";
Expand All @@ -356,7 +356,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
return;
}

nodeName.style.background = "aliceblue";
nodeName.style.background = "#ccdbe8";


for (var j = 0; j < allFilesAndFolders.length; j++) {
Expand Down Expand Up @@ -1179,7 +1179,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,

};


/// move

$scope.moveLoading = true;
Expand All @@ -1196,7 +1195,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,

}


$scope.startMoving = function () {

$scope.moveLoading = false;
Expand Down Expand Up @@ -1340,7 +1338,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
var check = 1;
var getFileName = nodeName.getElementsByTagName('td')[0].innerHTML;

if (nodeName.style.backgroundColor === "aliceblue") {
if (nodeName.style.backgroundColor === "#ccdbe8") {

var tempArray = [];
nodeName.style.background = "None";
Expand All @@ -1356,7 +1354,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
return;
}

nodeName.style.background = "aliceblue";
nodeName.style.background = "#ccdbe8";


for (var j = 0; j < allFilesAndFolders.length; j++) {
Expand All @@ -1372,7 +1370,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
// activating deactivating functions
$scope.buttonActivator();


};

// rename
Expand Down
18 changes: 7 additions & 11 deletions filemanager/templates/filemanager/editFile.html
Expand Up @@ -148,6 +148,13 @@
</select>
{{ additionalOptions | safe }}
</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>
</nav>

Expand All @@ -166,17 +173,6 @@
</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>

<!--- File Manager body ends ---->
Expand Down
4 changes: 4 additions & 0 deletions static/filemanager/js/codeMirror.js
Expand Up @@ -199,4 +199,8 @@ fileManager.controller('editFileCtrl', function ($scope, $http, $window) {

};

$scope.closeWindow = function () {
window.close();
};

});
13 changes: 5 additions & 8 deletions static/filemanager/js/fileManager.js
Expand Up @@ -310,7 +310,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
var collectionOfA = tableBody.getElementsByTagName("tr");

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;
allFilesAndFolders.push(getFileName);
}
Expand Down Expand Up @@ -340,7 +340,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
var check = 1;
var getFileName = nodeName.getElementsByTagName('td')[0].innerHTML;

if (nodeName.style.backgroundColor === "aliceblue") {
if (nodeName.style.backgroundColor === "rgb(204, 219, 232)") {

var tempArray = [];
nodeName.style.background = "None";
Expand All @@ -356,7 +356,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
return;
}

nodeName.style.background = "aliceblue";
nodeName.style.background = "#ccdbe8";


for (var j = 0; j < allFilesAndFolders.length; j++) {
Expand Down Expand Up @@ -1179,7 +1179,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,

};


/// move

$scope.moveLoading = true;
Expand All @@ -1196,7 +1195,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,

}


$scope.startMoving = function () {

$scope.moveLoading = false;
Expand Down Expand Up @@ -1340,7 +1338,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
var check = 1;
var getFileName = nodeName.getElementsByTagName('td')[0].innerHTML;

if (nodeName.style.backgroundColor === "aliceblue") {
if (nodeName.style.backgroundColor === "#ccdbe8") {

var tempArray = [];
nodeName.style.background = "None";
Expand All @@ -1356,7 +1354,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
return;
}

nodeName.style.background = "aliceblue";
nodeName.style.background = "#ccdbe8";


for (var j = 0; j < allFilesAndFolders.length; j++) {
Expand All @@ -1372,7 +1370,6 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
// activating deactivating functions
$scope.buttonActivator();


};

// rename
Expand Down

0 comments on commit b815d10

Please sign in to comment.