mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 22:06:05 +01:00
feature: add search and ordering to dropdowns
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'websiteFunctions/websiteFunctions.css' %}">
|
||||
<link rel="stylesheet" type="text/css" href="https://www.jsdelivr.com/package/npm/fontawesome">
|
||||
<link rel="icon" type="image/png" href="{% static 'baseTemplate/assets/finalBase/favicon.png' %}">
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||
{% block styles %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -963,6 +963,7 @@
|
||||
|
||||
<!-- Sparklines charts -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrious/4.0.2/qrious.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||
<script src="{% static 'baseTemplate/custom-js/pnotify.custom.min.js' %}"></script>
|
||||
<script src="{% static 'baseTemplate/custom-js/system-status.js' %}"></script>
|
||||
<script src="{% static 'packages/packages.js' %}"></script>
|
||||
|
||||
@@ -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,
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select Website" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-change="showDetailsBoxes()" ng-model="databaseWebsite" class="form-control">
|
||||
<select id="create-database-select" ng-model="databaseWebsite" class="form-control">
|
||||
{% for items in websitesList %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
@@ -35,24 +35,23 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<div ng-hide="dbDetails" class="form-group">
|
||||
<div class="form-group dbDetails">
|
||||
<label class="col-sm-3 control-label">{% trans "Database Name" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="dom" type="text" class="form-control" ng-model="dbName" required>
|
||||
</div>
|
||||
<div class="current-pack">{$databaseWebsite|getwebsitename$}_{$ dbName $}</div>
|
||||
<div class="current-pack"><span id="domainDatabase"></span>_{$ dbName $}</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="dbDetails" class="form-group">
|
||||
<div class="form-group dbDetails">
|
||||
<label class="col-sm-3 control-label">{% trans "User Name" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" name="email" class="form-control" ng-model="dbUsername" required>
|
||||
</div>
|
||||
<div class="current-pack">{$databaseWebsite|getwebsitename$}_{$ dbUsername $}</div>
|
||||
<div class="current-pack"><span id="domainUsername"></span>_{$ dbUsername $}</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="dbDetails" class="form-group">
|
||||
<div class="form-group dbDetails">
|
||||
<label class="col-sm-3 control-label">{% trans "Password" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="password" name="email" class="form-control" ng-model="dbPassword" required>
|
||||
@@ -62,7 +61,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="generatedPasswordView" class="form-group">
|
||||
<div class="form-group generatedPasswordDetails">
|
||||
<label class="col-sm-3 control-label">{% trans "Generated Password" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" name="email" class="form-control" ng-model="dbPassword" required>
|
||||
@@ -73,37 +72,13 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="dbDetails" class="form-group">
|
||||
<div class="form-group dbDetails">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="createDatabase()" class="btn btn-primary btn-lg">{% trans "Create Database" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<div ng-hide="databaseCreationFailed" class="alert alert-danger">
|
||||
<p>{% trans "Cannot create database. Error message:" %} {$ errorMessage $}</p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="databaseCreated" class="alert alert-success">
|
||||
<p>{% trans "Database created successfully." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="couldNotConnect" class="alert alert-danger">
|
||||
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
@@ -6,22 +6,22 @@
|
||||
/* Java script code to create account */
|
||||
app.controller('createFTPAccount', function ($scope, $http) {
|
||||
|
||||
$scope.ftpLoading = true;
|
||||
$scope.ftpDetails = true;
|
||||
$scope.canNotCreate = true;
|
||||
$scope.successfullyCreated = true;
|
||||
$scope.couldNotConnect = true;
|
||||
|
||||
$scope.showFTPDetails = function () {
|
||||
|
||||
$(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 = 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();
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select Website" %} </label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-change="showFTPDetails()" ng-model="ftpDomain" class="form-control">
|
||||
<select class="create-ftp-acct-select" ng-model="ftpDomain" class="form-control">
|
||||
{% for items in websiteList %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
@@ -53,7 +53,7 @@
|
||||
<!------ Modification form that appears after a click --------------->
|
||||
|
||||
|
||||
<div ng-hide="ftpDetails" class="form-group">
|
||||
<div class="form-group ftpDetails">
|
||||
<label class="col-sm-3 control-label">{% trans "User Name" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input ng-change="hideFewDetails()" type="text" class="form-control"
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<div ng-hide="ftpDetails" class="form-group">
|
||||
<div class="form-group ftpDetails">
|
||||
<label class="col-sm-3 control-label">{% trans "FTP Password" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="password" class="form-control" ng-model="ftpPassword" required>
|
||||
@@ -74,7 +74,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="generatedPasswordView" class="form-group">
|
||||
<div class="form-group ftpPasswordView">
|
||||
<label class="col-sm-3 control-label">{% trans "Generated Password" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" name="email" class="form-control" ng-model="ftpPassword"
|
||||
@@ -86,7 +86,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="ftpDetails" class="form-group">
|
||||
<div ng-hide="ftpDetails" class="form-group ftpDetails">
|
||||
<label class="col-sm-3 control-label">{% trans "Path (Relative)" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input placeholder="{% trans 'Leave empty to select default home directory.' %}"
|
||||
@@ -98,7 +98,7 @@
|
||||
<!------ Modification form that appears after a click --------------->
|
||||
|
||||
|
||||
<div ng-hide="ftpDetails" class="form-group">
|
||||
<div class="form-group dbDetails">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="createFTPAccount()"
|
||||
@@ -106,29 +106,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-6">
|
||||
<div ng-hide="canNotCreate" class="alert alert-danger">
|
||||
<p>{% trans "Cannot create FTP account. Error message:" %} {$ errorMessage
|
||||
$}</p>
|
||||
</div>
|
||||
|
||||
<div ng-hide="successfullyCreated" class="alert alert-success">
|
||||
<p>{% trans "FTP Account with username:" %} {$ ftpUserName
|
||||
$} {% trans "is successfully created." %}</p>
|
||||
</div>
|
||||
<div ng-hide="couldNotConnect" class="alert alert-success">
|
||||
<p>{% trans "FTP Account with username:" %} {$ ftpUserName
|
||||
$} {% trans "is successfully created." %}</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
{% endif %}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,22 +6,22 @@
|
||||
/* Java script code to create account */
|
||||
app.controller('createFTPAccount', function ($scope, $http) {
|
||||
|
||||
$scope.ftpLoading = true;
|
||||
$scope.ftpDetails = true;
|
||||
$scope.canNotCreate = true;
|
||||
$scope.successfullyCreated = true;
|
||||
$scope.couldNotConnect = true;
|
||||
|
||||
$scope.showFTPDetails = function () {
|
||||
|
||||
$(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 = 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();
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user