diff --git a/dns/dnsManager.py b/dns/dnsManager.py index cc7765ace..67cf5f9e9 100644 --- a/dns/dnsManager.py +++ b/dns/dnsManager.py @@ -15,6 +15,7 @@ from models import Domains,Records from re import match,I,M from plogical.mailUtilities import mailUtilities from plogical.acl import ACLManager +from manageServices.models import PDNSStatus class DNSManager: @@ -56,7 +57,16 @@ class DNSManager: secondNSIP = data['secondNSIP'] if Domains.objects.filter(name=domainForNS).count() == 0: - newZone = Domains(admin=admin, name=domainForNS, type="NATIVE") + + try: + pdns = PDNSStatus.objects.get(pk=1) + if pdns.type == 'MASTER': + newZone = Domains(admin=admin, name=domainForNS, type="MASTER") + else: + newZone = Domains(admin=admin, name=domainForNS, type="NATIVE") + except: + newZone = Domains(admin=admin, name=domainForNS, type="NATIVE") + newZone.save() content = "ns1." + domainForNS + " hostmaster." + domainForNS + " 1 10800 3600 604800 3600" diff --git a/dns/models.py b/dns/models.py index 3a9e27305..8db112e90 100644 --- a/dns/models.py +++ b/dns/models.py @@ -1,10 +1,3 @@ -# This is an auto-generated Django model module. -# You'll have to do the following manually to clean this up: -# * Rearrange models' order -# * Make sure each model has one field with primary_key=True -# * Make sure each ForeignKey has `on_delete` set to the desired behavior. -# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table -# Feel free to rename the models, but don't rename db_table values or field names. from __future__ import unicode_literals from django.db import models @@ -91,10 +84,3 @@ class Tsigkeys(models.Model): class Meta: db_table = 'tsigkeys' unique_together = (('name', 'algorithm'),) - - - -class DNSMaster: - type = models.CharField(max_length=5, default='NATIVE') - allow_axfr_ips = models.CharField(max_length=500, default='') - also_notify = models.CharField(max_length=500, default='') diff --git a/dockerManager/decorators.py b/dockerManager/decorators.py index 0b128d144..bd06190c7 100644 --- a/dockerManager/decorators.py +++ b/dockerManager/decorators.py @@ -11,11 +11,11 @@ from plogical.acl import ACLManager def preDockerRun(function): def wrap(request, *args, **kwargs): - try: - userID = request.session['userID'] + try: + userID = request.session['userID'] except KeyError: return redirect(loadLoginPage) - + currentACL = ACLManager.loadedACL(userID) if request.method == "POST": @@ -49,4 +49,4 @@ def preDockerRun(function): return function(request, *args, **kwargs) - return wrap + return wrap \ No newline at end of file diff --git a/manageServices/models.py b/manageServices/models.py index 1dfab7604..d0e84cea8 100644 --- a/manageServices/models.py +++ b/manageServices/models.py @@ -4,3 +4,9 @@ from __future__ import unicode_literals from django.db import models # Create your models here. + +class PDNSStatus(models.Model): + serverStatus = models.IntegerField(default=1) + type = models.CharField(max_length=6, default='NATIVE') + allow_axfr_ips = models.CharField(max_length=500, default='') + also_notify = models.CharField(max_length=500, default='') \ No newline at end of file diff --git a/manageServices/serviceManager.py b/manageServices/serviceManager.py new file mode 100644 index 000000000..79e8db8eb --- /dev/null +++ b/manageServices/serviceManager.py @@ -0,0 +1,87 @@ +import subprocess, shlex +from random import randint +from plogical.processUtilities import ProcessUtilities + +class ServiceManager: + + def __init__(self, extraArgs): + self.extraArgs = extraArgs + + + def managePDNS(self): + type = self.extraArgs['type'] + path = '/etc/pdns/pdns.conf' + + data = subprocess.check_output(shlex.split('sudo cat ' + path)).splitlines() + + if type == 'MASTER': + counter = 0 + + slaveIPData = self.extraArgs['slaveIPData'] + ipsString = slaveIPData.replace(',', '/32,') + + + for items in data: + if items.find('allow-axfr-ips') > -1: + data[counter] = '#' + data[counter] + + if items.find('also-notify') > -1: + data[counter] = '#' + data[counter] + + if items.find('daemon=') > -1: + data[counter] = '#' + data[counter] + + if items.find('disable-axfr') > -1: + data[counter] = '#' + data[counter] + + if items.find('slave') > -1: + data[counter] = '#' + data[counter] + + counter = counter + 1 + + tempPath = "/home/cyberpanel/" + str(randint(1000, 9999)) + writeToFile = open(tempPath, 'w') + + for items in data: + writeToFile.writelines(items + '\n') + + writeToFile.writelines('allow-axfr-ips=' + ipsString + '\n') + writeToFile.writelines('also-notify=' + slaveIPData + '\n') + writeToFile.writelines('daemon=no\n') + writeToFile.writelines('disable-axfr=no\n') + writeToFile.writelines('master=yes\n') + writeToFile.close() + else: + counter = 0 + + for items in data: + if items.find('allow-axfr-ips') > -1: + data[counter] = '#' + data[counter] + + if items.find('also-notify') > -1: + data[counter] = '#' + data[counter] + + if items.find('daemon=') > -1: + data[counter] = '#' + data[counter] + + if items.find('disable-axfr') > -1: + data[counter] = '#' + data[counter] + + if items.find('slave') > -1: + data[counter] = '#' + data[counter] + + counter = counter + 1 + + tempPath = "/home/cyberpanel/" + str(randint(1000, 9999)) + writeToFile = open(tempPath, 'w') + + for items in data: + writeToFile.writelines(items + '\n') + + writeToFile.writelines('slave=yes\n') + writeToFile.writelines('daemon=no\n') + writeToFile.close() + + command = 'sudo mv ' + tempPath + ' ' + path + ProcessUtilities.executioner(command) + diff --git a/manageServices/static/manageServices/manageServices.js b/manageServices/static/manageServices/manageServices.js index 4cbee2c59..ca700620a 100644 --- a/manageServices/static/manageServices/manageServices.js +++ b/manageServices/static/manageServices/manageServices.js @@ -5,128 +5,148 @@ /* Java script code */ -app.controller('powerDNS', function($scope, $http, $timeout, $window) { +app.controller('powerDNS', function ($scope, $http, $timeout, $window) { - $scope.pdnsLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = true; + $scope.pdnsLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + $scope.slaveIPs = true; - var pdnsStatus = false; + var pdnsStatus = false; - $('#pdnsStatus').change(function() { - pdnsStatus = $(this).prop('checked'); - }); + $('#pdnsStatus').change(function () { + pdnsStatus = $(this).prop('checked'); + }); - fetchPDNSStatus('powerdns'); - function fetchPDNSStatus(service){ + fetchPDNSStatus('powerdns'); + function fetchPDNSStatus(service) { - $scope.pdnsLoading = false; + $scope.pdnsLoading = false; - $('#pdnsStatus').bootstrapToggle('off'); + $('#pdnsStatus').bootstrapToggle('off'); - url = "/manageservices/fetchStatus"; + url = "/manageservices/fetchStatus"; - var data = { - 'service' : service - }; + var data = { + 'service': service + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - $scope.pdnsLoading = true; + $scope.pdnsLoading = true; - if(response.data.status === 1){ + if (response.data.status === 1) { - if (response.data.installCheck === 1) { - $('#pdnsStatus').bootstrapToggle('on'); - } - - }else{ - $scope.failedToFetch = false; - $scope.couldNotConnect = true; - $scope.changesApplied = true; - - $scope.errorMessage = response.data.error_message; - - } - - } - function cantLoadInitialDatas(response) { - $scope.pdnsLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = false; - $scope.changesApplied = true; + if (response.data.installCheck === 1) { + $('#pdnsStatus').bootstrapToggle('on'); } - } + $scope.slaveIPData = response.data.slaveIPData; + + } else { + $scope.failedToFetch = false; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + + $scope.errorMessage = response.data.error_message; + + } + + } + + function cantLoadInitialDatas(response) { + $scope.pdnsLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = false; + $scope.changesApplied = true; + } + + } + + $scope.saveStatus = function (service) { + + $scope.pdnsLoading = false; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = true; - $scope.saveStatus = function (service) { + url = "/manageservices/saveStatus"; - $scope.pdnsLoading = false; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = true; + if (service === 'powerdns') { + var data = { + status: pdnsStatus, + service: service, + dnsMode: $scope.dnsMode, + slaveIPData: $scope.slaveIPData + }; + }else { + var data = { + status: pdnsStatus, + service: service + }; + } + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - url = "/manageservices/saveStatus"; - - var data = { - status:pdnsStatus, - service: service - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + function ListInitialDatas(response) { + $scope.pdnsLoading = true; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + if (response.data.status === 1) { + + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = false; + + } + else { + $scope.errorMessage = response.data.error_message; + + $scope.failedToFetch = false; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + } + + } + + function cantLoadInitialDatas(response) { + $scope.policyServerLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = false; + $scope.changesApplied = true; + } - function ListInitialDatas(response) { - $scope.pdnsLoading = true; + }; - if(response.data.status === 1){ + $scope.modeChange = function () { + if ($scope.dnsMode === 'MASTER') { + $scope.slaveIPs = false; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = false; - - } - else{ - $scope.errorMessage = response.data.error_message; - - $scope.failedToFetch = false; - $scope.couldNotConnect = true; - $scope.changesApplied = true; - } - - } - function cantLoadInitialDatas(response) { - $scope.policyServerLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = false; - $scope.changesApplied = true; - } - - - }; + } else { + $scope.slaveIPs = true; + } + } }); @@ -137,129 +157,129 @@ app.controller('powerDNS', function($scope, $http, $timeout, $window) { /* Java script code */ -app.controller('postfix', function($scope, $http, $timeout, $window) { +app.controller('postfix', function ($scope, $http, $timeout, $window) { - $scope.serviceLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = true; + $scope.serviceLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = true; - var serviceStatus = false; + var serviceStatus = false; - $('#serviceStatus').change(function() { - serviceStatus = $(this).prop('checked'); - }); + $('#serviceStatus').change(function () { + serviceStatus = $(this).prop('checked'); + }); - fetchPDNSStatus('postfix'); - function fetchPDNSStatus(service){ + fetchPDNSStatus('postfix'); + function fetchPDNSStatus(service) { - $scope.serviceLoading = false; + $scope.serviceLoading = false; - $('#serviceStatus').bootstrapToggle('off'); + $('#serviceStatus').bootstrapToggle('off'); - url = "/manageservices/fetchStatus"; + url = "/manageservices/fetchStatus"; - var data = { - 'service' : service - }; + var data = { + 'service': service + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - $scope.serviceLoading = true; + $scope.serviceLoading = true; - if(response.data.status === 1){ + if (response.data.status === 1) { - if (response.data.installCheck === 1) { - $('#serviceStatus').bootstrapToggle('on'); - } - - }else{ - $scope.failedToFetch = false; - $scope.couldNotConnect = true; - $scope.changesApplied = true; - - $scope.errorMessage = response.data.error_message; - - } - - } - function cantLoadInitialDatas(response) { - $scope.serviceLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = false; - $scope.changesApplied = true; + if (response.data.installCheck === 1) { + $('#serviceStatus').bootstrapToggle('on'); } - } + } else { + $scope.failedToFetch = false; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + + $scope.errorMessage = response.data.error_message; + + } + + } + + function cantLoadInitialDatas(response) { + $scope.serviceLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = false; + $scope.changesApplied = true; + } + + } - $scope.saveStatus = function (service) { + $scope.saveStatus = function (service) { - $scope.serviceLoading = false; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = true; + $scope.serviceLoading = false; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + url = "/manageservices/saveStatus"; - url = "/manageservices/saveStatus"; + var data = { + status: serviceStatus, + service: service + }; - var data = { - status:serviceStatus, - service: service - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { - $scope.serviceLoading = true; + function ListInitialDatas(response) { + $scope.serviceLoading = true; - if(response.data.status === 1){ + if (response.data.status === 1) { - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = false; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = false; - } - else{ - $scope.errorMessage = response.data.error_message; + } + else { + $scope.errorMessage = response.data.error_message; - $scope.failedToFetch = false; - $scope.couldNotConnect = true; - $scope.changesApplied = true; - } + $scope.failedToFetch = false; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + } - } - function cantLoadInitialDatas(response) { - $scope.serviceLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = false; - $scope.changesApplied = true; - } + } + + function cantLoadInitialDatas(response) { + $scope.serviceLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = false; + $scope.changesApplied = true; + } - }; + }; }); @@ -268,129 +288,129 @@ app.controller('postfix', function($scope, $http, $timeout, $window) { /* Java script code */ -app.controller('pureFTPD', function($scope, $http, $timeout, $window) { +app.controller('pureFTPD', function ($scope, $http, $timeout, $window) { - $scope.serviceLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = true; + $scope.serviceLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = true; - var serviceStatus = false; + var serviceStatus = false; - $('#serviceStatus').change(function() { - serviceStatus = $(this).prop('checked'); - }); + $('#serviceStatus').change(function () { + serviceStatus = $(this).prop('checked'); + }); - fetchPDNSStatus('pureftpd'); - function fetchPDNSStatus(service){ + fetchPDNSStatus('pureftpd'); + function fetchPDNSStatus(service) { - $scope.serviceLoading = false; + $scope.serviceLoading = false; - $('#serviceStatus').bootstrapToggle('off'); + $('#serviceStatus').bootstrapToggle('off'); - url = "/manageservices/fetchStatus"; + url = "/manageservices/fetchStatus"; - var data = { - 'service' : service - }; + var data = { + 'service': service + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - $scope.serviceLoading = true; + $scope.serviceLoading = true; - if(response.data.status === 1){ + if (response.data.status === 1) { - if (response.data.installCheck === 1) { - $('#serviceStatus').bootstrapToggle('on'); - } - - }else{ - $scope.failedToFetch = false; - $scope.couldNotConnect = true; - $scope.changesApplied = true; - - $scope.errorMessage = response.data.error_message; - - } - - } - function cantLoadInitialDatas(response) { - $scope.serviceLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = false; - $scope.changesApplied = true; + if (response.data.installCheck === 1) { + $('#serviceStatus').bootstrapToggle('on'); } - } + } else { + $scope.failedToFetch = false; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + + $scope.errorMessage = response.data.error_message; + + } + + } + + function cantLoadInitialDatas(response) { + $scope.serviceLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = false; + $scope.changesApplied = true; + } + + } - $scope.saveStatus = function (service) { + $scope.saveStatus = function (service) { - $scope.serviceLoading = false; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = true; + $scope.serviceLoading = false; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + url = "/manageservices/saveStatus"; - url = "/manageservices/saveStatus"; + var data = { + status: serviceStatus, + service: service + }; - var data = { - status:serviceStatus, - service: service - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { - $scope.serviceLoading = true; + function ListInitialDatas(response) { + $scope.serviceLoading = true; - if(response.data.status === 1){ + if (response.data.status === 1) { - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = false; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = false; - } - else{ - $scope.errorMessage = response.data.error_message; + } + else { + $scope.errorMessage = response.data.error_message; - $scope.failedToFetch = false; - $scope.couldNotConnect = true; - $scope.changesApplied = true; - } + $scope.failedToFetch = false; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + } - } - function cantLoadInitialDatas(response) { - $scope.serviceLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = false; - $scope.changesApplied = true; - } + } + + function cantLoadInitialDatas(response) { + $scope.serviceLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = false; + $scope.changesApplied = true; + } - }; + }; }); diff --git a/manageServices/templates/manageServices/managePowerDNS.html b/manageServices/templates/manageServices/managePowerDNS.html index 50b0569f2..ca0b14ca5 100644 --- a/manageServices/templates/manageServices/managePowerDNS.html +++ b/manageServices/templates/manageServices/managePowerDNS.html @@ -3,86 +3,107 @@ {% block title %}{% trans "Manage PowerDNS - CyberPanel" %}{% endblock %} {% block content %} -{% load static %} -{% get_current_language as LANGUAGE_CODE %} - + {% load static %} + {% get_current_language as LANGUAGE_CODE %} + -
-
-

{% trans "Manage PowerDNS!" %} - {% trans "Services Docs" %}

-

{% trans "Enable or disable DNS services. " %}

-
+
+
+

{% trans "Manage PowerDNS!" %} - {% trans "Services Docs" %}

+

{% trans "Enable or disable DNS services. " %}

+
- {% if status %} + {% if status %} -
-
-

- {% trans "Manage PowerDNS" %} -

+
+
+

+ {% trans "Manage PowerDNS" %} +

-
-
+
+
-
-
+
+ -
- -
- -
-
+
+ +
+ +
+
-
- -
- +
+ +
+ +
+
{% trans 'Default is Slave Mode' %}
+
-
-
+
+ +
+ +
+
-
- -
+
+ +
+ -
+
+
+ +
+ +
+ +

{% trans "Error message: " %} {$ errorMessage $}

-
+
-
+

{% trans "Changes successfully applied." %}

+
+ +
+

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

+
+ +
-
-

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

-
+
+ +
- - - -
- - - +
-
+ + {% else %} + +
+

{% trans "Only administrator can manage services." %}

+
+ + {% endif %} + +
- {% else %} - -
-

{% trans "Only administrator can manage services." %}

-
- - {% endif %} - - -
- {% endblock %} diff --git a/manageServices/views.py b/manageServices/views.py index 399e62479..74bb11a60 100644 --- a/manageServices/views.py +++ b/manageServices/views.py @@ -10,11 +10,11 @@ import json from plogical.mailUtilities import mailUtilities import subprocess, shlex from plogical.acl import ACLManager +from models import PDNSStatus +from .serviceManager import ServiceManager # Create your views here. -# Create your views here. - def managePowerDNS(request): try: userID = request.session['userID'] @@ -90,14 +90,20 @@ def fetchStatus(request): service = data['service'] if service == 'powerdns': - if os.path.exists('/home/cyberpanel/powerdns'): - data_ret = {'status': 1, 'error_message': 'None', 'installCheck': 1} - json_data = json.dumps(data_ret) - return HttpResponse(json_data) - else: - data_ret = {'status': 1, 'error_message': 'None', 'installCheck': 0} - json_data = json.dumps(data_ret) - return HttpResponse(json_data) + data_ret = {} + data_ret['status'] = 1 + + try: + pdns = PDNSStatus.objects.get(pk=1) + data_ret['installCheck'] = pdns.serverStatus + data_ret['slaveIPData'] = pdns.also_notify + except: + PDNSStatus(serverStatus=1).save() + data_ret['installCheck'] = 0 + data_ret['slaveIPData'] = '' + + json_data = json.dumps(data_ret) + return HttpResponse(json_data) elif service == 'postfix': if os.path.exists('/home/cyberpanel/postfix'): @@ -151,26 +157,40 @@ def saveStatus(request): if service == 'powerdns': - servicePath = '/home/cyberpanel/powerdns' if status == True: - writeToFile = open(servicePath, 'w+') - writeToFile.close() + + pdns = PDNSStatus.objects.get(pk=1) + pdns.serverStatus = 1 + pdns.allow_axfr_ips = data['slaveIPData'].replace(',', '/32,') + pdns.also_notify = data['slaveIPData'] + pdns.type = data['dnsMode'] + pdns.save() + + extraArgs = {} + extraArgs['type'] = data['dnsMode'] + extraArgs['slaveIPData'] = data['slaveIPData'] + + sm = ServiceManager(extraArgs) + sm.managePDNS() + command = 'sudo systemctl start pdns' subprocess.call(shlex.split(command)) + command = 'sudo systemctl enable pdns' + subprocess.call(shlex.split(command)) else: + + pdns = PDNSStatus.objects.get(pk=1) + pdns.serverStatus = 0 + pdns.save() + command = 'sudo systemctl stop pdns' subprocess.call(shlex.split(command)) command = 'sudo systemctl disable pdns' subprocess.call(shlex.split(command)) - try: - os.remove(servicePath) - except: - pass - elif service == 'postfix': diff --git a/plogical/dnsUtilities.py b/plogical/dnsUtilities.py index ede2cc444..209cd2717 100644 --- a/plogical/dnsUtilities.py +++ b/plogical/dnsUtilities.py @@ -9,6 +9,7 @@ import subprocess import shlex from dns.models import Domains,Records from processUtilities import ProcessUtilities +from manageServices.models import PDNSStatus class DNS: @@ -36,7 +37,16 @@ class DNS: if len(subDomain) == 0: if Domains.objects.filter(name=topLevelDomain).count() == 0: - zone = Domains(admin=admin, name=topLevelDomain, type="NATIVE") + try: + pdns = PDNSStatus.objects.get(pk=1) + if pdns.type == 'MASTER': + zone = Domains(admin=admin, name=topLevelDomain, type="MASTER") + else: + zone = Domains(admin=admin, name=topLevelDomain, type="NATIVE") + except: + zone = Domains(admin=admin, name=topLevelDomain, type="NATIVE") + + zone.save() content = "ns1." + topLevelDomain + " hostmaster." + topLevelDomain + " 1 10800 3600 604800 3600" @@ -155,8 +165,14 @@ class DNS: record.save() else: if Domains.objects.filter(name=topLevelDomain).count() == 0: - zone = Domains(admin=admin, name=topLevelDomain, type="NATIVE") - zone.save() + try: + pdns = PDNSStatus.objects.get(pk=1) + if pdns.type == 'MASTER': + zone = Domains(admin=admin, name=topLevelDomain, type="MASTER") + else: + zone = Domains(admin=admin, name=topLevelDomain, type="NATIVE") + except: + zone = Domains(admin=admin, name=topLevelDomain, type="NATIVE") content = "ns1." + topLevelDomain + " hostmaster." + topLevelDomain + " 1 10800 3600 604800 3600" diff --git a/static/baseTemplate/assets/image-resources/logo-admin.png b/static/baseTemplate/assets/image-resources/logo-admin.png index 80ca74a3c..03deb86e9 100644 Binary files a/static/baseTemplate/assets/image-resources/logo-admin.png and b/static/baseTemplate/assets/image-resources/logo-admin.png differ diff --git a/static/dockerManager/dockerManager.js b/static/dockerManager/dockerManager.js index e77e55ed6..a89bcf670 100644 --- a/static/dockerManager/dockerManager.js +++ b/static/dockerManager/dockerManager.js @@ -169,9 +169,13 @@ app.controller('runContainer', function ($scope, $http) { }; - $.each($scope.portType, function (port, protocol) { - data[port + "/" + protocol] = $scope.eport[port]; - }); + try { + $.each($scope.portType, function (port, protocol) { + data[port + "/" + protocol] = $scope.eport[port]; + }); + } + catch (err) { + } var config = { headers: { diff --git a/static/emailMarketing/checklist.png b/static/emailMarketing/checklist.png index bb709fb21..5236aa0a8 100644 Binary files a/static/emailMarketing/checklist.png and b/static/emailMarketing/checklist.png differ diff --git a/static/emailMarketing/compose.png b/static/emailMarketing/compose.png index eaf70c277..4e786da4d 100644 Binary files a/static/emailMarketing/compose.png and b/static/emailMarketing/compose.png differ diff --git a/static/emailMarketing/mailing.png b/static/emailMarketing/mailing.png index b8586aea2..da227aa32 100644 Binary files a/static/emailMarketing/mailing.png and b/static/emailMarketing/mailing.png differ diff --git a/static/emailMarketing/paper-plane.png b/static/emailMarketing/paper-plane.png index 8135fdfb1..79998aa8d 100644 Binary files a/static/emailMarketing/paper-plane.png and b/static/emailMarketing/paper-plane.png differ diff --git a/static/emailMarketing/post-office.png b/static/emailMarketing/post-office.png index 6cdfb54cc..7419b2b29 100644 Binary files a/static/emailMarketing/post-office.png and b/static/emailMarketing/post-office.png differ diff --git a/static/filemanager/css/fileManager.css b/static/filemanager/css/fileManager.css index 104fb0e6d..b69fd4538 100644 --- a/static/filemanager/css/fileManager.css +++ b/static/filemanager/css/fileManager.css @@ -2,12 +2,21 @@ width: 25%; } -#navBar{ +/*#navBar{ background: -moz-linear-gradient(#a4dbf5, #8cc5e0); background: -webkit-linear-gradient(#a4dbf5, #8cc5e0); background: -o-linear-gradient(#a4dbf5, #8cc5e0); +}*/ +#navBar { + background: #0daeff; /* Old browsers */ + background: -moz-linear-gradient(-45deg, #0daeff 0%,#3939ad 30%); /* FF3.6-15 */ + background: -webkit-linear-gradient(-45deg, #0daeff 0%,#3939ad 30%); /* Chrome10-25,Safari5.1-6 */ + background: linear-gradient(-45deg, #0daeff 0%,#3939ad 30%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3939ad', endColorstr='#0daeff',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */ +} +.navbar-brand { + margin: 0 1rem 0 1rem; } - #mainRow{ margin: 1%; } @@ -41,4 +50,127 @@ #htmlEditorStyles{ margin-bottom: 2%; margin-top: 2%; -} \ No newline at end of file +} +.flex-wrap { + display: flex; + flex-wrap: wrap; +} +.mt-5 { + margin-top: 5px !important; +} +.mt-10 { + margin-top: 10px; +} +.mt-20 { + margin-top: 20px; +} +.mt-30 { + margin-top: 30px; +} +.mr-10 { + margin-right: 10px; +} +.mb-10 { + margin-bottom: 10px; +} +.ml-10 { + margin-left: 10px; +} +.my-10 { + margin-top: 10px; + margin-bottom: 10px; +} + +.mx-5 { + margin-left: 5px; + margin-right: 5px; +} +.mx-10 { + margin-left: 10px; + margin-right: 10px; +} +.header-logo { + width: 315px; +/* text-align: center;*/ + font-size: 16px; + float: left; + position: relative; +} + +a.nav-link { + color: #add8e6; +} +a.nav-link:hover { + color: #E4F2F7; +} + +.point-events { + pointer-events: all; +} + +.card-header { + padding: .75rem 1.25rem; + margin-bottom: 0; + background-color: transparent; + border-bottom: none; +} +.form-control { + padding: 0 .5rem; + border: 1px solid #eeeeee; + color: #777; + font-size: .95em; +} + .form-control[readonly] { + background-color: transparent; +} +a { + color: #6C6CA4; + text-decoration: none; + background-color: transparent; + -webkit-text-decoration-skip: objects; +} +a:hover { + color: #8989B6; + text-decoration: none; + background-color: transparent; + -webkit-text-decoration-skip: objects; +} + +#tableHead { + background: #8989B6; + color: #E1E1EC; +} +.table td, .table th { + padding: .15em; + vertical-align: top; + border-top: 1px solid #e9ecef; +} +.table thead th { + vertical-align: bottom; + border-bottom: 1px solid #e9ecef; + font-weight: 400; +} + +.table td { + font-size: 14px; + color: #666666; +} +.list-group-item { + padding: .2em 1.25rem; +} + +i.fa.fa-file { + color: #6C6CA4 !important; +} +i.fa.fa-minus { + color: #6C6CA4 !important; +} +i.fa.fa-plus { + color: #6C6CA4 !important; +} +.list-group-item { + background-color: transparent; +} +.bg-lightgray { + background: #F9F9FA; +} diff --git a/static/filemanager/images/fileManager.png b/static/filemanager/images/fileManager.png index eeb27580f..03deb86e9 100644 Binary files a/static/filemanager/images/fileManager.png and b/static/filemanager/images/fileManager.png differ diff --git a/static/filemanager/js/fileManager.js b/static/filemanager/js/fileManager.js index cd88bc316..82e9410b7 100644 --- a/static/filemanager/js/fileManager.js +++ b/static/filemanager/js/fileManager.js @@ -711,6 +711,7 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader, function findFileExtension(fileName) { return (/[.]/.exec(fileName)) ? /[^.]+$/.exec(fileName) : undefined; } + $scope.fetchForTableSecondary(null, "startPoint"); // html editor @@ -1568,6 +1569,4 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader, }; -}); - - +}); \ No newline at end of file diff --git a/static/images/change-license.png b/static/images/change-license.png new file mode 100644 index 000000000..bc0c7479d Binary files /dev/null and b/static/images/change-license.png differ diff --git a/static/images/icons/add-ssl.png b/static/images/icons/add-ssl.png new file mode 100644 index 000000000..1b29a8d6f Binary files /dev/null and b/static/images/icons/add-ssl.png differ diff --git a/static/images/icons/change-php.png b/static/images/icons/change-php.png new file mode 100644 index 000000000..54ac72fea Binary files /dev/null and b/static/images/icons/change-php.png differ diff --git a/static/images/icons/checklist.png b/static/images/icons/checklist.png new file mode 100644 index 000000000..5236aa0a8 Binary files /dev/null and b/static/images/icons/checklist.png differ diff --git a/static/images/icons/compose.png b/static/images/icons/compose.png new file mode 100644 index 000000000..4e786da4d Binary files /dev/null and b/static/images/icons/compose.png differ diff --git a/static/images/icons/delete-ftp.png b/static/images/icons/delete-ftp.png index 1af1bcb12..d622eeb75 100644 Binary files a/static/images/icons/delete-ftp.png and b/static/images/icons/delete-ftp.png differ diff --git a/static/images/icons/domains.png b/static/images/icons/domains.png index 21cebc575..8cdb93355 100644 Binary files a/static/images/icons/domains.png and b/static/images/icons/domains.png differ diff --git a/static/images/icons/file.png b/static/images/icons/file.png index 964214349..dabb56702 100644 Binary files a/static/images/icons/file.png and b/static/images/icons/file.png differ diff --git a/static/images/icons/ftp-upload.png b/static/images/icons/ftp-upload.png index eb3a86453..31235bd81 100644 Binary files a/static/images/icons/ftp-upload.png and b/static/images/icons/ftp-upload.png differ diff --git a/static/images/icons/git-logo.png b/static/images/icons/git-logo.png index 72dee99e1..e871f125c 100644 Binary files a/static/images/icons/git-logo.png and b/static/images/icons/git-logo.png differ diff --git a/static/images/icons/joomla-logo.png b/static/images/icons/joomla-logo.png index 6eee7e82b..8cb876527 100644 Binary files a/static/images/icons/joomla-logo.png and b/static/images/icons/joomla-logo.png differ diff --git a/static/images/icons/laptop.png b/static/images/icons/laptop.png index 7bb3b59c1..948ab080d 100644 Binary files a/static/images/icons/laptop.png and b/static/images/icons/laptop.png differ diff --git a/static/images/icons/locked.png b/static/images/icons/locked.png index 110376bb0..e9d0559c0 100644 Binary files a/static/images/icons/locked.png and b/static/images/icons/locked.png differ diff --git a/static/images/icons/log-file-format.png b/static/images/icons/log-file-format.png index a1b96fd0b..684a65212 100644 Binary files a/static/images/icons/log-file-format.png and b/static/images/icons/log-file-format.png differ diff --git a/static/images/icons/mailing.png b/static/images/icons/mailing.png new file mode 100644 index 000000000..da227aa32 Binary files /dev/null and b/static/images/icons/mailing.png differ diff --git a/static/images/icons/office-material.png b/static/images/icons/office-material.png index 743e27b08..07809dadc 100644 Binary files a/static/images/icons/office-material.png and b/static/images/icons/office-material.png differ diff --git a/static/images/icons/open_basedir.png b/static/images/icons/open_basedir.png index 2cf48be53..895d5cf1e 100644 Binary files a/static/images/icons/open_basedir.png and b/static/images/icons/open_basedir.png differ diff --git a/static/images/icons/paper-plane.png b/static/images/icons/paper-plane.png new file mode 100644 index 000000000..79998aa8d Binary files /dev/null and b/static/images/icons/paper-plane.png differ diff --git a/static/images/icons/pencilcase.png b/static/images/icons/pencilcase.png index 6d2c3be36..9aa1dd5be 100644 Binary files a/static/images/icons/pencilcase.png and b/static/images/icons/pencilcase.png differ diff --git a/static/images/icons/post-office.png b/static/images/icons/post-office.png new file mode 100644 index 000000000..7419b2b29 Binary files /dev/null and b/static/images/icons/post-office.png differ diff --git a/static/images/icons/prestashop.png b/static/images/icons/prestashop.png index 0ab1d644c..f25ce5c60 100644 Binary files a/static/images/icons/prestashop.png and b/static/images/icons/prestashop.png differ diff --git a/static/images/icons/repeat.png b/static/images/icons/repeat.png index a5b7bcfdb..cdbb2ef52 100644 Binary files a/static/images/icons/repeat.png and b/static/images/icons/repeat.png differ diff --git a/static/images/icons/sort.png b/static/images/icons/sort.png index a53593ae8..8f30ca3dc 100644 Binary files a/static/images/icons/sort.png and b/static/images/icons/sort.png differ diff --git a/static/images/icons/warning.png b/static/images/icons/warning.png index e298ba22b..a6a4e1ca4 100644 Binary files a/static/images/icons/warning.png and b/static/images/icons/warning.png differ diff --git a/static/images/icons/web-domain.png b/static/images/icons/web-domain.png index 37c5a0253..271e6900d 100644 Binary files a/static/images/icons/web-domain.png and b/static/images/icons/web-domain.png differ diff --git a/static/images/icons/wordpress.png b/static/images/icons/wordpress.png index aa162c65e..f2112c790 100644 Binary files a/static/images/icons/wordpress.png and b/static/images/icons/wordpress.png differ diff --git a/static/images/license-status.png b/static/images/license-status.png new file mode 100644 index 000000000..cf1fa8ab4 Binary files /dev/null and b/static/images/license-status.png differ diff --git a/static/images/not-available-preview.png b/static/images/not-available-preview.png new file mode 100644 index 000000000..94b06eae2 Binary files /dev/null and b/static/images/not-available-preview.png differ diff --git a/static/manageSSL/manageSSL.js b/static/manageSSL/manageSSL.js index 8c4753276..783e5081e 100644 --- a/static/manageSSL/manageSSL.js +++ b/static/manageSSL/manageSSL.js @@ -17,8 +17,6 @@ app.controller('sslIssueCtrl', function($scope,$http) { $scope.issueSSLBtn = false; }; - - $scope.issueSSL = function(){ $scope.manageSSLLoading = false; diff --git a/static/manageServices/manageServices.js b/static/manageServices/manageServices.js index 4cbee2c59..ca700620a 100644 --- a/static/manageServices/manageServices.js +++ b/static/manageServices/manageServices.js @@ -5,128 +5,148 @@ /* Java script code */ -app.controller('powerDNS', function($scope, $http, $timeout, $window) { +app.controller('powerDNS', function ($scope, $http, $timeout, $window) { - $scope.pdnsLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = true; + $scope.pdnsLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + $scope.slaveIPs = true; - var pdnsStatus = false; + var pdnsStatus = false; - $('#pdnsStatus').change(function() { - pdnsStatus = $(this).prop('checked'); - }); + $('#pdnsStatus').change(function () { + pdnsStatus = $(this).prop('checked'); + }); - fetchPDNSStatus('powerdns'); - function fetchPDNSStatus(service){ + fetchPDNSStatus('powerdns'); + function fetchPDNSStatus(service) { - $scope.pdnsLoading = false; + $scope.pdnsLoading = false; - $('#pdnsStatus').bootstrapToggle('off'); + $('#pdnsStatus').bootstrapToggle('off'); - url = "/manageservices/fetchStatus"; + url = "/manageservices/fetchStatus"; - var data = { - 'service' : service - }; + var data = { + 'service': service + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - $scope.pdnsLoading = true; + $scope.pdnsLoading = true; - if(response.data.status === 1){ + if (response.data.status === 1) { - if (response.data.installCheck === 1) { - $('#pdnsStatus').bootstrapToggle('on'); - } - - }else{ - $scope.failedToFetch = false; - $scope.couldNotConnect = true; - $scope.changesApplied = true; - - $scope.errorMessage = response.data.error_message; - - } - - } - function cantLoadInitialDatas(response) { - $scope.pdnsLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = false; - $scope.changesApplied = true; + if (response.data.installCheck === 1) { + $('#pdnsStatus').bootstrapToggle('on'); } - } + $scope.slaveIPData = response.data.slaveIPData; + + } else { + $scope.failedToFetch = false; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + + $scope.errorMessage = response.data.error_message; + + } + + } + + function cantLoadInitialDatas(response) { + $scope.pdnsLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = false; + $scope.changesApplied = true; + } + + } + + $scope.saveStatus = function (service) { + + $scope.pdnsLoading = false; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = true; - $scope.saveStatus = function (service) { + url = "/manageservices/saveStatus"; - $scope.pdnsLoading = false; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = true; + if (service === 'powerdns') { + var data = { + status: pdnsStatus, + service: service, + dnsMode: $scope.dnsMode, + slaveIPData: $scope.slaveIPData + }; + }else { + var data = { + status: pdnsStatus, + service: service + }; + } + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - url = "/manageservices/saveStatus"; - - var data = { - status:pdnsStatus, - service: service - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + function ListInitialDatas(response) { + $scope.pdnsLoading = true; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + if (response.data.status === 1) { + + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = false; + + } + else { + $scope.errorMessage = response.data.error_message; + + $scope.failedToFetch = false; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + } + + } + + function cantLoadInitialDatas(response) { + $scope.policyServerLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = false; + $scope.changesApplied = true; + } - function ListInitialDatas(response) { - $scope.pdnsLoading = true; + }; - if(response.data.status === 1){ + $scope.modeChange = function () { + if ($scope.dnsMode === 'MASTER') { + $scope.slaveIPs = false; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = false; - - } - else{ - $scope.errorMessage = response.data.error_message; - - $scope.failedToFetch = false; - $scope.couldNotConnect = true; - $scope.changesApplied = true; - } - - } - function cantLoadInitialDatas(response) { - $scope.policyServerLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = false; - $scope.changesApplied = true; - } - - - }; + } else { + $scope.slaveIPs = true; + } + } }); @@ -137,129 +157,129 @@ app.controller('powerDNS', function($scope, $http, $timeout, $window) { /* Java script code */ -app.controller('postfix', function($scope, $http, $timeout, $window) { +app.controller('postfix', function ($scope, $http, $timeout, $window) { - $scope.serviceLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = true; + $scope.serviceLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = true; - var serviceStatus = false; + var serviceStatus = false; - $('#serviceStatus').change(function() { - serviceStatus = $(this).prop('checked'); - }); + $('#serviceStatus').change(function () { + serviceStatus = $(this).prop('checked'); + }); - fetchPDNSStatus('postfix'); - function fetchPDNSStatus(service){ + fetchPDNSStatus('postfix'); + function fetchPDNSStatus(service) { - $scope.serviceLoading = false; + $scope.serviceLoading = false; - $('#serviceStatus').bootstrapToggle('off'); + $('#serviceStatus').bootstrapToggle('off'); - url = "/manageservices/fetchStatus"; + url = "/manageservices/fetchStatus"; - var data = { - 'service' : service - }; + var data = { + 'service': service + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - $scope.serviceLoading = true; + $scope.serviceLoading = true; - if(response.data.status === 1){ + if (response.data.status === 1) { - if (response.data.installCheck === 1) { - $('#serviceStatus').bootstrapToggle('on'); - } - - }else{ - $scope.failedToFetch = false; - $scope.couldNotConnect = true; - $scope.changesApplied = true; - - $scope.errorMessage = response.data.error_message; - - } - - } - function cantLoadInitialDatas(response) { - $scope.serviceLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = false; - $scope.changesApplied = true; + if (response.data.installCheck === 1) { + $('#serviceStatus').bootstrapToggle('on'); } - } + } else { + $scope.failedToFetch = false; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + + $scope.errorMessage = response.data.error_message; + + } + + } + + function cantLoadInitialDatas(response) { + $scope.serviceLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = false; + $scope.changesApplied = true; + } + + } - $scope.saveStatus = function (service) { + $scope.saveStatus = function (service) { - $scope.serviceLoading = false; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = true; + $scope.serviceLoading = false; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + url = "/manageservices/saveStatus"; - url = "/manageservices/saveStatus"; + var data = { + status: serviceStatus, + service: service + }; - var data = { - status:serviceStatus, - service: service - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { - $scope.serviceLoading = true; + function ListInitialDatas(response) { + $scope.serviceLoading = true; - if(response.data.status === 1){ + if (response.data.status === 1) { - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = false; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = false; - } - else{ - $scope.errorMessage = response.data.error_message; + } + else { + $scope.errorMessage = response.data.error_message; - $scope.failedToFetch = false; - $scope.couldNotConnect = true; - $scope.changesApplied = true; - } + $scope.failedToFetch = false; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + } - } - function cantLoadInitialDatas(response) { - $scope.serviceLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = false; - $scope.changesApplied = true; - } + } + + function cantLoadInitialDatas(response) { + $scope.serviceLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = false; + $scope.changesApplied = true; + } - }; + }; }); @@ -268,129 +288,129 @@ app.controller('postfix', function($scope, $http, $timeout, $window) { /* Java script code */ -app.controller('pureFTPD', function($scope, $http, $timeout, $window) { +app.controller('pureFTPD', function ($scope, $http, $timeout, $window) { - $scope.serviceLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = true; + $scope.serviceLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = true; - var serviceStatus = false; + var serviceStatus = false; - $('#serviceStatus').change(function() { - serviceStatus = $(this).prop('checked'); - }); + $('#serviceStatus').change(function () { + serviceStatus = $(this).prop('checked'); + }); - fetchPDNSStatus('pureftpd'); - function fetchPDNSStatus(service){ + fetchPDNSStatus('pureftpd'); + function fetchPDNSStatus(service) { - $scope.serviceLoading = false; + $scope.serviceLoading = false; - $('#serviceStatus').bootstrapToggle('off'); + $('#serviceStatus').bootstrapToggle('off'); - url = "/manageservices/fetchStatus"; + url = "/manageservices/fetchStatus"; - var data = { - 'service' : service - }; + var data = { + 'service': service + }; - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { + function ListInitialDatas(response) { - $scope.serviceLoading = true; + $scope.serviceLoading = true; - if(response.data.status === 1){ + if (response.data.status === 1) { - if (response.data.installCheck === 1) { - $('#serviceStatus').bootstrapToggle('on'); - } - - }else{ - $scope.failedToFetch = false; - $scope.couldNotConnect = true; - $scope.changesApplied = true; - - $scope.errorMessage = response.data.error_message; - - } - - } - function cantLoadInitialDatas(response) { - $scope.serviceLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = false; - $scope.changesApplied = true; + if (response.data.installCheck === 1) { + $('#serviceStatus').bootstrapToggle('on'); } - } + } else { + $scope.failedToFetch = false; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + + $scope.errorMessage = response.data.error_message; + + } + + } + + function cantLoadInitialDatas(response) { + $scope.serviceLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = false; + $scope.changesApplied = true; + } + + } - $scope.saveStatus = function (service) { + $scope.saveStatus = function (service) { - $scope.serviceLoading = false; - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = true; + $scope.serviceLoading = false; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + url = "/manageservices/saveStatus"; - url = "/manageservices/saveStatus"; + var data = { + status: serviceStatus, + service: service + }; - var data = { - status:serviceStatus, - service: service - }; - - var config = { - headers : { - 'X-CSRFToken': getCookie('csrftoken') - } - }; + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; - - $http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas); + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); - function ListInitialDatas(response) { - $scope.serviceLoading = true; + function ListInitialDatas(response) { + $scope.serviceLoading = true; - if(response.data.status === 1){ + if (response.data.status === 1) { - $scope.failedToFetch = true; - $scope.couldNotConnect = true; - $scope.changesApplied = false; + $scope.failedToFetch = true; + $scope.couldNotConnect = true; + $scope.changesApplied = false; - } - else{ - $scope.errorMessage = response.data.error_message; + } + else { + $scope.errorMessage = response.data.error_message; - $scope.failedToFetch = false; - $scope.couldNotConnect = true; - $scope.changesApplied = true; - } + $scope.failedToFetch = false; + $scope.couldNotConnect = true; + $scope.changesApplied = true; + } - } - function cantLoadInitialDatas(response) { - $scope.serviceLoading = true; - $scope.failedToFetch = true; - $scope.couldNotConnect = false; - $scope.changesApplied = true; - } + } + + function cantLoadInitialDatas(response) { + $scope.serviceLoading = true; + $scope.failedToFetch = true; + $scope.couldNotConnect = false; + $scope.changesApplied = true; + } - }; + }; }); diff --git a/static/websiteFunctions/websiteFunctions.css b/static/websiteFunctions/websiteFunctions.css index bc1818f18..0dcd1a28c 100644 --- a/static/websiteFunctions/websiteFunctions.css +++ b/static/websiteFunctions/websiteFunctions.css @@ -9,4 +9,231 @@ .website-content-box{ border-radius: 25px; border-color:#3498db -} \ No newline at end of file +} + +.table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>th { + color: #777777; + font-weight: 400; + border-color: #cccccc; + border-width: 1px; + background-color: transparent; +} + +.table { + font-size: 14px; + width: 100%; + border-spacing: 0; + border-collapse: separate; + border-radius: 5px; + background: #fdfdfd; + padding: 0px 12px; + margin: 10px 12px; +} + +.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th { + /* padding: 10px; */ + border-top-width: 1px; + border-top-style: solid; + text-align: left; +} + +.mt-5 { + margin-top: 5px; +} +.mt-10 { + margin-top: 10px; +} +.mt-20 { + margin-top: 20px; +} +.mt-30 { + margin-top: 30px; +} +.mr-10 { + margin-right: 10px; +} +.mb-10 { + margin-bottom: 10px; +} +.ml-10 { + margin-left: 10px; +} +.my-10 { + margin-top: 10px; + margin-bottom: 10px; +} + +.mx-5 { + margin-left: 5px; + margin-right: 5px; +} +.mx-10 { + margin-left: 10px; + margin-right: 10px; +} + +.title-hero { + font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; + margin: 0 0 15px; + padding: 0; + text-transform: none; + font-size: 14px; + opacity: 1; + color: #777777; + font-weight: 400; +} + +.bs-badge { + font-size: 11px; + font-weight: 400; + line-height: 19px; + display: inline-block; + min-width: 20px; + padding: 0 5px 0 4px; + border-radius: 2px; +} + +.row-title { + color: #778899; +} + +/*span.h4 { + white-space: nowrap; +}*/ +.panel-body { + white-space: nowrap; +} + +.bg-gradient-9 { + background: #0daeff; /* Old browsers */ + background: -moz-linear-gradient(-45deg, #0daeff 0%,#3939ad 30%); /* FF3.6-15 */ + background: -webkit-linear-gradient(-45deg, #0daeff 0%,#3939ad 30%); /* Chrome10-25,Safari5.1-6 */ + background: linear-gradient(-45deg, #0daeff 0%,#3939ad 30%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3939ad', endColorstr='#0daeff',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */ +} + +#page-header .user-account-btn>a.user-profile .glyph-icon, .logo-bg { + background-color: rgba(0,0,0,.15); +} + +a:hover { + text-decoration: none; +} + +.text-success { + color: #29A329 !important; +} + +.alert-success, .alert-success a, .parsley-success { + color: #1e620f; + border-color: #7cd362; + background: #E4FFE4; +} + +.flex { + display: flex; +} + +.align-center { + margin: 0 auto; +} +.text-bold { + font-weight: 600; +} +.tile-box-shortcut .tile-header { + background: 0 0; + padding: 25px; + position: absolute; + font-size: 18px; + font-weight: 400; + left: 3em; + bottom: 0px; +} +.tile-box-shortcut .tile-content-wrapper>.glyph-icon { + position: absolute; + left: 25px; + top: 40px; +} + +.fa { + display: inline-block; + font: normal normal normal 14px/1 FontAwesome; + font-size: 2.25em; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + position: absolute; + left: 25px; + top: 28px; +} +.bs-badge { + font-size: 18px; + font-weight: 100; + line-height: 19px; + display: inline-block; + min-width: 20px; + padding: 0 5px 0 4px; + border-radius: 2px; + color: #afeeee; +} +.tile-box-shortcut .bs-badge { + left: auto; + right: 10px; + top: 30px; + background: transparent; +} +#sidebar-menu { + background: #EAEAF1; +} +#page-sidebar ul li a .glyph-icon { + color: #191970; +} +#header-logo .logo-content-big, .logo-content-small { + height: 40px; + left: 15px; +} +#mobile-navigation .logo-content-small { + width: 50px; + display: block; + left: 75px; +} +#header-nav-left { + margin: 0 20px; +} + +#page-content { + background: #ffffff; +} + +.service-panel { + background: #A1BDC6 !important; +} +.serviceImg img { + box-shadow: 0 0 2px 1px rgba(0,0,0,.05); +} +.btn-icon { + top: 0px; + left: 0px; + margin: 0px auto; + position: relative; + font-size: 16px; +} + +.tab-mod { + color: #777777; + background: transparent; + border-color: #dddddd; +} + +.btn-primary { + background: #33ADFF; + border-color: #0099FF; +} +.btn-primary:hover,.btn-primary:focus { + background: #5CBDFF; + border-color: #33ADFF; +} + +.btn-min-width { + min-width: 350px; +} diff --git a/static/websiteFunctions/websiteFunctions.js b/static/websiteFunctions/websiteFunctions.js index c195f6741..22f8a3ea7 100644 --- a/static/websiteFunctions/websiteFunctions.js +++ b/static/websiteFunctions/websiteFunctions.js @@ -247,10 +247,8 @@ app.controller('listWebsites', function ($scope, $http) { } function cantLoadInitialData(response) { - console.log("not good"); } - $scope.getFurtherWebsitesFromDB = function (pageNumber) { var config = { @@ -287,6 +285,58 @@ app.controller('listWebsites', function ($scope, $http) { } + }; + + $scope.cyberPanelLoading = true; + + $scope.issueSSL = function (virtualHost) { + $scope.cyberPanelLoading = false; + + var url = "/manageSSL/issueSSL"; + + + var data = { + virtualHost: virtualHost + }; + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + $scope.cyberPanelLoading = true; + if (response.data.SSL === 1) { + new PNotify({ + title: 'Success!', + text: 'SSL successfully issued.', + type: 'success' + }); + } + else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + + } + + function cantLoadInitialDatas(response) { + $scope.cyberPanelLoading = true; + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page', + type: 'error' + }); + } + + }; });