From 6cd54ec447b27b8dddc6417bf07bf26ae9142a50 Mon Sep 17 00:00:00 2001 From: Hassan Hashmi <75794688+hassanhashmey@users.noreply.github.com> Date: Sun, 4 Feb 2024 22:53:17 +0500 Subject: [PATCH] added addon domain in CP --- .../websiteFunctions/websiteFunctions.js | 32 +- .../websiteFunctions/createDomain.html | 308 ++++++++++-------- websiteFunctions/website.py | 10 +- 3 files changed, 201 insertions(+), 149 deletions(-) diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index 1325ab4fc..5ba902fde 100755 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -4521,6 +4521,21 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) { var statusFile; + + $scope.webselection = true; + $scope.WebsiteType = function () { + var type = $scope.websitetype; + if (type == 'Sub Domain') { + $scope.webselection = false; + $scope.DomainCreateForm = true; + + } else if (type == 'Addon Domain') { + $scope.DomainCreateForm = false; + $scope.webselection = true; + $scope.masterDomain = $('#defaultSite').html() + } + }; + $scope.WebsiteSelection = function () { $scope.DomainCreateForm = false; }; @@ -4584,8 +4599,11 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) { // // var domainName = $scope.own_domainNameCreate; // } + var type = $scope.websitetype; + var domainName = $scope.domainNameCreate; + var data = { domainName: domainName, phpSelection: phpSelection, @@ -4603,6 +4621,8 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) { } }; + // console.log(data) + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); @@ -10759,7 +10779,7 @@ app.controller('ListDockersitecontainer', function ($scope, $http) { $scope.refreshStatus = function () { - $('#actionLoading').show(); + $('#actionLoading').show(); url = "/docker/getContainerStatus"; var data = {name: $scope.cName}; var config = { @@ -10771,7 +10791,7 @@ app.controller('ListDockersitecontainer', function ($scope, $http) { $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { - $('#actionLoading').hide(); + $('#actionLoading').hide(); if (response.data.containerStatus === 1) { console.log(response.data.status); $scope.status = response.data.status; @@ -10786,7 +10806,7 @@ app.controller('ListDockersitecontainer', function ($scope, $http) { } function cantLoadInitialData(response) { - $('#actionLoading').hide(); + $('#actionLoading').hide(); PNotify.error({ title: 'Unable to complete request', text: "Problem in connecting to server" @@ -10796,7 +10816,7 @@ app.controller('ListDockersitecontainer', function ($scope, $http) { }; $scope.restarthStatus = function () { - $('#actionLoading').show(); + $('#actionLoading').show(); url = "/docker/RestartContainerAPP"; var data = { name: $scope.cName, @@ -10811,7 +10831,7 @@ app.controller('ListDockersitecontainer', function ($scope, $http) { $http.post(url, data, config).then(ListInitialData, cantLoadInitialData); function ListInitialData(response) { - $('#actionLoading').hide(); + $('#actionLoading').hide(); if (response.data.status === 1) { if (response.data.data[0] === 1) { new PNotify({ @@ -10838,7 +10858,7 @@ app.controller('ListDockersitecontainer', function ($scope, $http) { } function cantLoadInitialData(response) { - $('#actionLoading').hide(); + $('#actionLoading').hide(); PNotify.error({ title: 'Unable to complete request', text: "Problem in connecting to server" diff --git a/websiteFunctions/templates/websiteFunctions/createDomain.html b/websiteFunctions/templates/websiteFunctions/createDomain.html index b258a2664..80914250c 100755 --- a/websiteFunctions/templates/websiteFunctions/createDomain.html +++ b/websiteFunctions/templates/websiteFunctions/createDomain.html @@ -104,172 +104,198 @@ {% trans "Details" %} -
- -
- -
- -
- -
+ {% if defaultSite == 'NONE' %} +
+
+

{% trans "You need to create website before creating Sub/Addon domains." %}

+
- {#
#} - {# #} - {#
#} - {# #} - {#
#} - {#
#} - {##} - {#
#} - {# #} - {#
#} - {# #} - {#
#} - {#
{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}
#} - {#
#} + {% else %} +
- {# My Work . #} + -
- -
- -
-
-
- -
- -
-
{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}
-
+
+ +
+ - {% for php in phps %} - - {% endfor %} - -
-
- -
- -
-
- -
-
- -
-
- +
- -
-
- + + + +
+ +
+
- -
-
- + + {#
#} + {# #} + {#
#} + {# #} + {#
#} + {#
#} + {##} + {#
#} + {# #} + {#
#} + {# #} + {#
#} + {#
{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}
#} + {#
#} + + {# My Work . #} + +
+ +
+
-
- -
- -
- - -
-
- -
- -
- -
-

{$ currentStatus $}

+
+ +
+
+
{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}
+
-
-
- 70% Complete + {# My Work End #} + +
+ +
+ +
+
+ +
+ +
+
+ +
+
+ +
+
+
-
-

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

+ +
+
+ +
- -
-

{% trans "Website succesfully created." %}

+ +
+
+ +
- - -
-

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

-
- -
-
-
- -
- +
+ +
+ + +
-
- -
+
+ +
+ +
+

{$ currentStatus $}

+
+ +
+
+ 70% Complete +
+
+ +
+

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

+
+ +
+

{% trans "Website succesfully created." %}

+
+ + +
+

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

+
+ + +
+
+ +
+ +
+ +
+
+ + + +
+ {% endif %}
diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 81787069b..22361812f 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -705,12 +705,18 @@ class WebsiteManager: except: pass - try: admin = Administrator.objects.get(pk=userID) defaultDomain = Websites.objects.get(pk=admin.defaultSite).domain except: - defaultDomain = 'NONE' + try: + admin = Administrator.objects.get(pk=userID) + websites = ACLManager.findWebsiteObjects(currentACL, userID) + admin.defaultSite = websites[0].id + admin.save() + defaultDomain = websites[0].domain + except: + defaultDomain='NONE' url = "https://platform.cyberpersons.com/CyberpanelAdOns/Adonpermission" data = {