diff --git a/baseTemplate/static/baseTemplate/custom-js/system-status.js b/baseTemplate/static/baseTemplate/custom-js/system-status.js index 41680df3f..1f6fe8d9d 100755 --- a/baseTemplate/static/baseTemplate/custom-js/system-status.js +++ b/baseTemplate/static/baseTemplate/custom-js/system-status.js @@ -98,6 +98,23 @@ app.filter('getwebsitename', function () { }; }); +function getWebsiteName(domain){ + if (domain !== undefined) { + + domain = domain.replace(/-/g, ''); + + var domainName = domain.split("."); + + var finalDomainName = domainName[0]; + + if (finalDomainName.length > 5) { + finalDomainName = finalDomainName.substring(0, 4); + } + + return finalDomainName; + } +} + app.controller('systemStatusInfo', function ($scope, $http, $timeout) { //getStuff(); diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html index 8d2fb2653..357572f37 100755 --- a/baseTemplate/templates/baseTemplate/index.html +++ b/baseTemplate/templates/baseTemplate/index.html @@ -98,7 +98,7 @@ - + {% block styles %} {% endblock %} @@ -963,6 +963,7 @@ + diff --git a/databases/static/databases/databases.js b/databases/static/databases/databases.js index d42958142..7b10cf48a 100755 --- a/databases/static/databases/databases.js +++ b/databases/static/databases/databases.js @@ -6,25 +6,31 @@ /* Java script code to create database */ app.controller('createDatabase', function ($scope, $http) { - $scope.createDatabaseLoading = true; - $scope.dbDetails = true; - $scope.databaseCreationFailed = true; - $scope.databaseCreated = true; - $scope.couldNotConnect = true; - $scope.generatedPasswordView = true; + $(document).ready(function () { + $(".dbDetails").hide(); + $(".generatedPasswordDetails").hide(); + $('#create-database-select').select2(); + }); + + $('#create-database-select').on('select2:select', function (e) { + var data = e.params.data; + $scope.databaseWebsite = data.text; + $(".dbDetails").show(); + $("#domainDatabase").text(getWebsiteName(data.text)); + $("#domainUsername").text(getWebsiteName(data.text)); + }); $scope.showDetailsBoxes = function () { $scope.dbDetails = false; - }; + } + + $scope.createDatabaseLoading = true; $scope.createDatabase = function () { $scope.createDatabaseLoading = false; $scope.dbDetails = false; - $scope.databaseCreationFailed = true; - $scope.databaseCreated = true; - $scope.couldNotConnect = true; var databaseWebsite = $scope.databaseWebsite; @@ -65,26 +71,24 @@ app.controller('createDatabase', function ($scope, $http) { function ListInitialDatas(response) { - if (response.data.createDBStatus == 1) { + if (response.data.createDBStatus === 1) { $scope.createDatabaseLoading = true; $scope.dbDetails = false; - $scope.databaseCreationFailed = true; - $scope.databaseCreated = false; - $scope.couldNotConnect = true; - - - } - - else { - + new PNotify({ + title: 'Success!', + text: 'Database successfully created.', + type: 'success' + }); + } else { $scope.createDatabaseLoading = true; $scope.dbDetails = false; - $scope.databaseCreationFailed = false; - $scope.databaseCreated = true; - $scope.couldNotConnect = true; - $scope.errorMessage = response.data.error_message; + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); } @@ -96,21 +100,23 @@ app.controller('createDatabase', function ($scope, $http) { $scope.createDatabaseLoading = true; $scope.dbDetails = true; - $scope.databaseCreationFailed = true; - $scope.databaseCreated = true; - $scope.couldNotConnect = false; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page', + type: 'error' + }); } }; $scope.generatePassword = function () { - $scope.generatedPasswordView = false; + $(".generatedPasswordDetails").show(); $scope.dbPassword = randomPassword(16); }; $scope.usePassword = function () { - $scope.generatedPasswordView = true; + $(".generatedPasswordDetails").hide(); }; }); @@ -170,9 +176,7 @@ app.controller('deleteDatabase', function ($scope, $http) { $scope.couldNotConnect = true; - } - - else { + } else { $scope.deleteDatabaseLoading = true; $scope.fetchedDatabases = true; $scope.databaseDeletionFailed = false; @@ -240,9 +244,7 @@ app.controller('deleteDatabase', function ($scope, $http) { $scope.couldNotConnect = true; - } - - else { + } else { $scope.deleteDatabaseLoading = true; $scope.fetchedDatabases = true; $scope.databaseDeletionFailed = false; @@ -344,8 +346,7 @@ app.controller('listDBs', function ($scope, $http) { $scope.dbLoading = true; $scope.domainFeteched = $scope.selectedDomain; - } - else { + } else { $scope.notificationsBox = false; $scope.canNotChangePassword = false; $scope.dbLoading = true; @@ -411,8 +412,7 @@ app.controller('listDBs', function ($scope, $http) { $scope.domainFeteched = $scope.selectedDomain; - } - else { + } else { $scope.recordsFetched = true; $scope.passwordChanged = true; $scope.canNotChangePassword = true; @@ -481,8 +481,7 @@ app.controller('listDBs', function ($scope, $http) { $scope.dbHost = response.data.dbHost; - } - else { + } else { new PNotify({ title: 'Operation Failed!', text: response.data.error_message, @@ -537,8 +536,7 @@ app.controller('listDBs', function ($scope, $http) { type: 'success' }); - } - else { + } else { new PNotify({ title: 'Operation Failed!', text: response.data.error_message, @@ -570,7 +568,7 @@ app.controller('listDBs', function ($scope, $http) { app.controller('phpMyAdmin', function ($scope, $http, $window) { $scope.cyberPanelLoading = true; - $scope.generateAccess = function() { + $scope.generateAccess = function () { $scope.cyberPanelLoading = false; @@ -593,12 +591,14 @@ app.controller('phpMyAdmin', function ($scope, $http, $window) { if (response.data.status === 1) { var rUrl = '/phpmyadmin/phpmyadminsignin.php?username=' + response.data.username + '&token=' + response.data.token; $window.location.href = rUrl; + } else { } - else {} } - function cantLoadInitialDatas(response) {$scope.cyberPanelLoading = true;} + function cantLoadInitialDatas(response) { + $scope.cyberPanelLoading = true; + } } diff --git a/databases/templates/databases/createDatabase.html b/databases/templates/databases/createDatabase.html index ab809bba2..14f5451bb 100755 --- a/databases/templates/databases/createDatabase.html +++ b/databases/templates/databases/createDatabase.html @@ -25,7 +25,7 @@
- {% for items in websitesList %} {% endfor %} @@ -35,24 +35,23 @@ - -
+
-
{$databaseWebsite|getwebsitename$}_{$ dbName $}
+
_{$ dbName $}
-
+
-
{$databaseWebsite|getwebsitename$}_{$ dbUsername $}
+
_{$ dbUsername $}
-
+
@@ -62,7 +61,7 @@
-
+
@@ -73,37 +72,13 @@
-
+
- - -
- -
-
-

{% trans "Cannot create database. Error message:" %} {$ errorMessage $}

-
- -
-

{% trans "Database created successfully." %}

-
- - -
-

{% trans "Could not connect to server. Please refresh this page." %}

-
-
- - - -
- - diff --git a/ftp/static/ftp/ftp.js b/ftp/static/ftp/ftp.js index a80377e6b..113845c8f 100755 --- a/ftp/static/ftp/ftp.js +++ b/ftp/static/ftp/ftp.js @@ -6,22 +6,22 @@ /* Java script code to create account */ app.controller('createFTPAccount', function ($scope, $http) { + + + $(document).ready(function () { + $( ".ftpDetails" ).hide(); + $( ".ftpPasswordView" ).hide(); + $('.create-ftp-acct-select').select2(); + }); + + $('.create-ftp-acct-select').on('select2:select', function (e) { + var data = e.params.data; + $scope.ftpDomain = data.text; + $( ".ftpDetails" ).show(); + + }); + $scope.ftpLoading = true; - $scope.ftpDetails = true; - $scope.canNotCreate = true; - $scope.successfullyCreated = true; - $scope.couldNotConnect = true; - - $scope.showFTPDetails = function () { - - $scope.ftpLoading = true; - $scope.ftpDetails = false; - $scope.canNotCreate = true; - $scope.successfullyCreated = true; - $scope.couldNotConnect = true; - - - }; $scope.createFTPAccount = function () { @@ -62,37 +62,35 @@ app.controller('createFTPAccount', function ($scope, $http) { function ListInitialDatas(response) { - if (response.data.creatFTPStatus == 1) { - + if (response.data.creatFTPStatus === 1) { $scope.ftpLoading = true; - $scope.ftpDetails = false; - $scope.canNotCreate = true; - $scope.successfullyCreated = false; - $scope.couldNotConnect = true; + new PNotify({ + title: 'Success!', + text: 'FTP account successfully created.', + type: 'success' + }); } else { $scope.ftpLoading = true; - $scope.ftpDetails = false; - $scope.canNotCreate = false; - $scope.successfullyCreated = true; - $scope.couldNotConnect = true; - - $scope.errorMessage = response.data.error_message; + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); } - } - function cantLoadInitialDatas(response) { $scope.ftpLoading = true; - $scope.ftpDetails = false; - $scope.canNotCreate = true; - $scope.successfullyCreated = true; - $scope.couldNotConnect = false; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page', + type: 'error' + }); } @@ -109,15 +107,13 @@ app.controller('createFTPAccount', function ($scope, $http) { /// - $scope.generatedPasswordView = true; - $scope.generatePassword = function () { - $scope.generatedPasswordView = false; + $( ".ftpPasswordView" ).show(); $scope.ftpPassword = randomPassword(16); }; $scope.usePassword = function () { - $scope.generatedPasswordView = true; + $(".ftpPasswordView" ).hide(); }; }); diff --git a/ftp/templates/ftp/createFTPAccount.html b/ftp/templates/ftp/createFTPAccount.html index d82425c7b..eb32ccad3 100755 --- a/ftp/templates/ftp/createFTPAccount.html +++ b/ftp/templates/ftp/createFTPAccount.html @@ -41,7 +41,7 @@
- {% for items in websiteList %} {% endfor %} @@ -53,7 +53,7 @@ -
+
-
+
@@ -74,7 +74,7 @@
-
+
-
+
-
+
-
- -
-
-

{% trans "Cannot create FTP account. Error message:" %} {$ errorMessage - $}

-
- -
-

{% trans "FTP Account with username:" %} {$ ftpUserName - $} {% trans "is successfully created." %}

-
-
-

{% trans "FTP Account with username:" %} {$ ftpUserName - $} {% trans "is successfully created." %}

-
- -
- - -
- - {% endif %} diff --git a/plogical/acl.py b/plogical/acl.py index e02c95782..b87a85f72 100755 --- a/plogical/acl.py +++ b/plogical/acl.py @@ -409,35 +409,34 @@ class ACLManager: websiteNames = [] if currentACL['admin'] == 1: - allWebsites = Websites.objects.all() + allWebsites = Websites.objects.all().order_by('domain') for items in allWebsites: websiteNames.append(items.domain) if fetchChilds: - for child in items.childdomains_set.all(): + for child in items.childdomains_set.all().order_by('domain'): websiteNames.append(child.domain) - else: admin = Administrator.objects.get(pk=userID) - websites = admin.websites_set.all() + websites = admin.websites_set.all().order_by('domain') admins = Administrator.objects.filter(owner=admin.pk) for items in websites: websiteNames.append(items.domain) if fetchChilds: - for child in items.childdomains_set.all(): + for child in items.childdomains_set.all().order_by('domain'): websiteNames.append(child.domain) for items in admins: - webs = items.websites_set.all() + webs = items.websites_set.all().order_by('domain') for web in webs: websiteNames.append(web.domain) if fetchChilds: - for child in web.childdomains_set.all(): + for child in web.childdomains_set.all().order_by('domain'): websiteNames.append(child.domain) @@ -469,13 +468,13 @@ class ACLManager: @staticmethod def findWebsiteObjects(currentACL, userID): if currentACL['admin'] == 1: - return Websites.objects.all() + return Websites.objects.all().order_by('domain') else: websiteList = [] admin = Administrator.objects.get(pk=userID) - websites = admin.websites_set.all() + websites = admin.websites_set.all().order_by('domain') for items in websites: websiteList.append(items) @@ -483,7 +482,7 @@ class ACLManager: admins = Administrator.objects.filter(owner=admin.pk) for items in admins: - webs = items.websites_set.all() + webs = items.websites_set.all().order_by('domain') for web in webs: websiteList.append(web) @@ -494,12 +493,12 @@ class ACLManager: domainsList = [] if currentACL['admin'] == 1: - domains = Websites.objects.all() + domains = Websites.objects.all().order_by('domain') for items in domains: domainsList.append(items.domain) else: admin = Administrator.objects.get(pk=userID) - domains = admin.websites_set.all() + domains = admin.websites_set.all().order_by('domain') for items in domains: domainsList.append(items.domain) @@ -507,7 +506,7 @@ class ACLManager: admins = Administrator.objects.filter(owner=admin.pk) for items in admins: - doms = items.websites_set.all() + doms = items.websites_set.all().order_by('domain') for dom in doms: domainsList.append(dom.domain) @@ -518,12 +517,12 @@ class ACLManager: domainsList = [] if currentACL['admin'] == 1: - domains = Websites.objects.order_by('domain').all() + domains = Websites.objects.all().order_by('domain') for items in domains: domainsList.append(items.domain) else: admin = Administrator.objects.get(pk=userID) - domains = admin.websites_set.all() + domains = admin.websites_set.all().order_by('domain') for items in domains: domainsList.append(items.domain) @@ -531,7 +530,7 @@ class ACLManager: admins = Administrator.objects.filter(owner=admin.pk) for items in admins: - doms = items.websites_set.all() + doms = items.websites_set.all().order_by('domain') for dom in doms: domainsList.append(dom.domain) return domainsList @@ -675,7 +674,7 @@ class ACLManager: for items in websiteNames: website = Websites.objects.get(domain = items) - for childDomain in website.childdomains_set.all(): + for childDomain in website.childdomains_set.all().order_by('domain'): childDomains.append(childDomain.domain) return childDomains diff --git a/static/baseTemplate/custom-js/system-status.js b/static/baseTemplate/custom-js/system-status.js index 41680df3f..1f6fe8d9d 100644 --- a/static/baseTemplate/custom-js/system-status.js +++ b/static/baseTemplate/custom-js/system-status.js @@ -98,6 +98,23 @@ app.filter('getwebsitename', function () { }; }); +function getWebsiteName(domain){ + if (domain !== undefined) { + + domain = domain.replace(/-/g, ''); + + var domainName = domain.split("."); + + var finalDomainName = domainName[0]; + + if (finalDomainName.length > 5) { + finalDomainName = finalDomainName.substring(0, 4); + } + + return finalDomainName; + } +} + app.controller('systemStatusInfo', function ($scope, $http, $timeout) { //getStuff(); diff --git a/static/databases/databases.js b/static/databases/databases.js index d42958142..7b10cf48a 100644 --- a/static/databases/databases.js +++ b/static/databases/databases.js @@ -6,25 +6,31 @@ /* Java script code to create database */ app.controller('createDatabase', function ($scope, $http) { - $scope.createDatabaseLoading = true; - $scope.dbDetails = true; - $scope.databaseCreationFailed = true; - $scope.databaseCreated = true; - $scope.couldNotConnect = true; - $scope.generatedPasswordView = true; + $(document).ready(function () { + $(".dbDetails").hide(); + $(".generatedPasswordDetails").hide(); + $('#create-database-select').select2(); + }); + + $('#create-database-select').on('select2:select', function (e) { + var data = e.params.data; + $scope.databaseWebsite = data.text; + $(".dbDetails").show(); + $("#domainDatabase").text(getWebsiteName(data.text)); + $("#domainUsername").text(getWebsiteName(data.text)); + }); $scope.showDetailsBoxes = function () { $scope.dbDetails = false; - }; + } + + $scope.createDatabaseLoading = true; $scope.createDatabase = function () { $scope.createDatabaseLoading = false; $scope.dbDetails = false; - $scope.databaseCreationFailed = true; - $scope.databaseCreated = true; - $scope.couldNotConnect = true; var databaseWebsite = $scope.databaseWebsite; @@ -65,26 +71,24 @@ app.controller('createDatabase', function ($scope, $http) { function ListInitialDatas(response) { - if (response.data.createDBStatus == 1) { + if (response.data.createDBStatus === 1) { $scope.createDatabaseLoading = true; $scope.dbDetails = false; - $scope.databaseCreationFailed = true; - $scope.databaseCreated = false; - $scope.couldNotConnect = true; - - - } - - else { - + new PNotify({ + title: 'Success!', + text: 'Database successfully created.', + type: 'success' + }); + } else { $scope.createDatabaseLoading = true; $scope.dbDetails = false; - $scope.databaseCreationFailed = false; - $scope.databaseCreated = true; - $scope.couldNotConnect = true; - $scope.errorMessage = response.data.error_message; + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); } @@ -96,21 +100,23 @@ app.controller('createDatabase', function ($scope, $http) { $scope.createDatabaseLoading = true; $scope.dbDetails = true; - $scope.databaseCreationFailed = true; - $scope.databaseCreated = true; - $scope.couldNotConnect = false; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page', + type: 'error' + }); } }; $scope.generatePassword = function () { - $scope.generatedPasswordView = false; + $(".generatedPasswordDetails").show(); $scope.dbPassword = randomPassword(16); }; $scope.usePassword = function () { - $scope.generatedPasswordView = true; + $(".generatedPasswordDetails").hide(); }; }); @@ -170,9 +176,7 @@ app.controller('deleteDatabase', function ($scope, $http) { $scope.couldNotConnect = true; - } - - else { + } else { $scope.deleteDatabaseLoading = true; $scope.fetchedDatabases = true; $scope.databaseDeletionFailed = false; @@ -240,9 +244,7 @@ app.controller('deleteDatabase', function ($scope, $http) { $scope.couldNotConnect = true; - } - - else { + } else { $scope.deleteDatabaseLoading = true; $scope.fetchedDatabases = true; $scope.databaseDeletionFailed = false; @@ -344,8 +346,7 @@ app.controller('listDBs', function ($scope, $http) { $scope.dbLoading = true; $scope.domainFeteched = $scope.selectedDomain; - } - else { + } else { $scope.notificationsBox = false; $scope.canNotChangePassword = false; $scope.dbLoading = true; @@ -411,8 +412,7 @@ app.controller('listDBs', function ($scope, $http) { $scope.domainFeteched = $scope.selectedDomain; - } - else { + } else { $scope.recordsFetched = true; $scope.passwordChanged = true; $scope.canNotChangePassword = true; @@ -481,8 +481,7 @@ app.controller('listDBs', function ($scope, $http) { $scope.dbHost = response.data.dbHost; - } - else { + } else { new PNotify({ title: 'Operation Failed!', text: response.data.error_message, @@ -537,8 +536,7 @@ app.controller('listDBs', function ($scope, $http) { type: 'success' }); - } - else { + } else { new PNotify({ title: 'Operation Failed!', text: response.data.error_message, @@ -570,7 +568,7 @@ app.controller('listDBs', function ($scope, $http) { app.controller('phpMyAdmin', function ($scope, $http, $window) { $scope.cyberPanelLoading = true; - $scope.generateAccess = function() { + $scope.generateAccess = function () { $scope.cyberPanelLoading = false; @@ -593,12 +591,14 @@ app.controller('phpMyAdmin', function ($scope, $http, $window) { if (response.data.status === 1) { var rUrl = '/phpmyadmin/phpmyadminsignin.php?username=' + response.data.username + '&token=' + response.data.token; $window.location.href = rUrl; + } else { } - else {} } - function cantLoadInitialDatas(response) {$scope.cyberPanelLoading = true;} + function cantLoadInitialDatas(response) { + $scope.cyberPanelLoading = true; + } } diff --git a/static/ftp/ftp.js b/static/ftp/ftp.js index a80377e6b..113845c8f 100644 --- a/static/ftp/ftp.js +++ b/static/ftp/ftp.js @@ -6,22 +6,22 @@ /* Java script code to create account */ app.controller('createFTPAccount', function ($scope, $http) { + + + $(document).ready(function () { + $( ".ftpDetails" ).hide(); + $( ".ftpPasswordView" ).hide(); + $('.create-ftp-acct-select').select2(); + }); + + $('.create-ftp-acct-select').on('select2:select', function (e) { + var data = e.params.data; + $scope.ftpDomain = data.text; + $( ".ftpDetails" ).show(); + + }); + $scope.ftpLoading = true; - $scope.ftpDetails = true; - $scope.canNotCreate = true; - $scope.successfullyCreated = true; - $scope.couldNotConnect = true; - - $scope.showFTPDetails = function () { - - $scope.ftpLoading = true; - $scope.ftpDetails = false; - $scope.canNotCreate = true; - $scope.successfullyCreated = true; - $scope.couldNotConnect = true; - - - }; $scope.createFTPAccount = function () { @@ -62,37 +62,35 @@ app.controller('createFTPAccount', function ($scope, $http) { function ListInitialDatas(response) { - if (response.data.creatFTPStatus == 1) { - + if (response.data.creatFTPStatus === 1) { $scope.ftpLoading = true; - $scope.ftpDetails = false; - $scope.canNotCreate = true; - $scope.successfullyCreated = false; - $scope.couldNotConnect = true; + new PNotify({ + title: 'Success!', + text: 'FTP account successfully created.', + type: 'success' + }); } else { $scope.ftpLoading = true; - $scope.ftpDetails = false; - $scope.canNotCreate = false; - $scope.successfullyCreated = true; - $scope.couldNotConnect = true; - - $scope.errorMessage = response.data.error_message; + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); } - } - function cantLoadInitialDatas(response) { $scope.ftpLoading = true; - $scope.ftpDetails = false; - $scope.canNotCreate = true; - $scope.successfullyCreated = true; - $scope.couldNotConnect = false; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page', + type: 'error' + }); } @@ -109,15 +107,13 @@ app.controller('createFTPAccount', function ($scope, $http) { /// - $scope.generatedPasswordView = true; - $scope.generatePassword = function () { - $scope.generatedPasswordView = false; + $( ".ftpPasswordView" ).show(); $scope.ftpPassword = randomPassword(16); }; $scope.usePassword = function () { - $scope.generatedPasswordView = true; + $(".ftpPasswordView" ).hide(); }; }); diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 082de360c..13e27403d 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -140,8 +140,7 @@ class WebsiteManager: else: return ACLManager.loadError() - websitesName = ACLManager.findAllSites(currentACL, userID) - return render(request, 'websiteFunctions/listCron.html', {'domain': request.GET.get('domain'), 'websiteList': websitesName}) + return render(request, 'websiteFunctions/listCron.html', {'domain': request.GET.get('domain')}) except BaseException as msg: return HttpResponse(str(msg))