usman
2021-05-17 13:09:54 +05:00
parent d070a9f466
commit d27e2bce30
11 changed files with 219 additions and 17 deletions

View File

@@ -428,6 +428,9 @@
<li><a href="{% url 'listWebsites' %}"
title="{% trans 'List Websites' %}"><span>{% trans "List Websites" %}</span></a>
</li>
<li><a href="{% url 'CreateNewDomain' %}"
title="{% trans 'Create New Domain' %}"><span>{% trans "Create New Domain" %}</span></a>
</li>
<li><a href="{% url 'listChildDomains' %}"
title="{% trans 'List Child Domains' %}"><span>{% trans "List Child Domains" %}</span></a>
</li>

View File

@@ -14,7 +14,7 @@ from websiteFunctions.models import Websites
from plogical.virtualHostUtilities import virtualHostUtilities
from plogical.sslUtilities import sslUtilities
from plogical.vhost import vhost
from shutil import copytree, ignore_patterns
from shutil import ignore_patterns
class ServerStatusUtil:

View File

@@ -89,7 +89,7 @@
color: #333;
}
#searchbar {
#toolbar #searchbar {
height: 19px;
border: 1px solid #ccc;
padding: 2px 5px;
@@ -99,7 +99,7 @@
max-width: 100%;
}
#searchbar:focus {
#toolbar #searchbar:focus {
border-color: #999;
}
@@ -128,6 +128,7 @@
/* FILTER COLUMN */
#changelist-filter {
flex: 0 0 240px;
order: 1;
width: 240px;
background: #f8f8f8;

View File

@@ -120,7 +120,8 @@ input[type="submit"], button {
}
#changelist-search .quiet {
width: 100%;
width: 0;
flex: 1 0 auto;
margin: 5px 0 0 25px;
}
@@ -156,7 +157,7 @@ input[type="submit"], button {
}
#changelist-filter {
width: 200px;
flex-basis: 200px;
}
.change-list .filtered .results,
@@ -216,7 +217,7 @@ input[type="submit"], button {
}
textarea {
max-width: 518px;
max-width: 100%;
max-height: 120px;
}
@@ -557,6 +558,7 @@ input[type="submit"], button {
.aligned .form-row,
.aligned .form-row > div {
display: flex;
flex-wrap: wrap;
max-width: 100vw;
}

View File

@@ -1896,7 +1896,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
function ListInitialDatas(response) {
if (response.data.sslStatus == 1) {
if (response.data.sslStatus === 1) {
$scope.sslSaved = false;
$scope.couldNotSaveSSL = true;
@@ -2040,9 +2040,14 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = true;
$scope.DomainCreateForm = true;
var statusFile;
$scope.WebsiteSelection = function (){
$scope.DomainCreateForm = false;
};
$scope.createDomain = function () {
$scope.domainLoading = false;
@@ -2053,6 +2058,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
$scope.couldNotConnect = true;
$scope.goBackDisable = true;
$scope.currentStatus = "Starting creation..";
$scope.DomainCreateForm = true;
var ssl, dkimCheck, openBasedir;
@@ -2091,7 +2097,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
phpSelection: phpSelection,
ssl: ssl,
path: path,
masterDomain: $("#domainNamePage").text(),
masterDomain: $scope.masterDomain,
dkimCheck: dkimCheck,
openBasedir: openBasedir
};
@@ -2114,6 +2120,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
$scope.domainLoading = true;
$scope.installationDetailsForm = true;
$scope.DomainCreateForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = false;
$scope.success = true;
@@ -2130,6 +2137,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
$scope.domainLoading = true;
$scope.installationDetailsForm = true;
$scope.DomainCreateForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = true;
@@ -2144,11 +2152,13 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
$scope.goBack = function () {
$scope.domainLoading = true;
$scope.installationDetailsForm = false;
$scope.DomainCreateForm = true;
$scope.installationProgress = true;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = true;
$scope.DomainCreateForm = true;
$("#installProgress").css("width", "0%");
};
@@ -2194,6 +2204,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
$scope.domainLoading = true;
$scope.installationDetailsForm = true;
$scope.DomainCreateForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = false;
$scope.success = true;
@@ -2221,6 +2232,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
$scope.domainLoading = true;
$scope.installationDetailsForm = true;
$scope.DomainCreateForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = true;

View File

@@ -1896,7 +1896,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
function ListInitialDatas(response) {
if (response.data.sslStatus == 1) {
if (response.data.sslStatus === 1) {
$scope.sslSaved = false;
$scope.couldNotSaveSSL = true;
@@ -2040,9 +2040,14 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = true;
$scope.DomainCreateForm = true;
var statusFile;
$scope.WebsiteSelection = function (){
$scope.DomainCreateForm = false;
};
$scope.createDomain = function () {
$scope.domainLoading = false;
@@ -2053,6 +2058,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
$scope.couldNotConnect = true;
$scope.goBackDisable = true;
$scope.currentStatus = "Starting creation..";
$scope.DomainCreateForm = true;
var ssl, dkimCheck, openBasedir;
@@ -2091,7 +2097,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
phpSelection: phpSelection,
ssl: ssl,
path: path,
masterDomain: $("#domainNamePage").text(),
masterDomain: $scope.masterDomain,
dkimCheck: dkimCheck,
openBasedir: openBasedir
};
@@ -2114,6 +2120,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
$scope.domainLoading = true;
$scope.installationDetailsForm = true;
$scope.DomainCreateForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = false;
$scope.success = true;
@@ -2130,6 +2137,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
$scope.domainLoading = true;
$scope.installationDetailsForm = true;
$scope.DomainCreateForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = true;
@@ -2144,11 +2152,13 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
$scope.goBack = function () {
$scope.domainLoading = true;
$scope.installationDetailsForm = false;
$scope.DomainCreateForm = true;
$scope.installationProgress = true;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = true;
$scope.DomainCreateForm = true;
$("#installProgress").css("width", "0%");
};
@@ -2194,6 +2204,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
$scope.domainLoading = true;
$scope.installationDetailsForm = true;
$scope.DomainCreateForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = false;
$scope.success = true;
@@ -2221,6 +2232,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
$scope.domainLoading = true;
$scope.installationDetailsForm = true;
$scope.DomainCreateForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = true;

View File

@@ -0,0 +1,158 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "Create New Domain - CyberPanel" %}{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<div class="container">
<div id="page-title">
<h2>{% trans "Create Child Domain" %}</h2>
<p>{% trans "Create child-domains, child domains are owned by a master website. " %}</p>
</div>
<div ng-controller="websitePages" class="panel">
<div class="panel-body">
<h3 class="content-box-header">
{% trans "Details" %} <img ng-hide="domainLoading"
src="{% static 'images/loading.gif' %}">
</h3>
<div class="example-box-wrapper">
<form name="websiteCreationForm" action="/" id="createPackages"
class="form-horizontal bordered-row panel-body">
<div class="form-group">
<label class="col-sm-3 control-label">{% trans "Select Website" %} </label>
<div class="col-sm-6">
<select ng-change="WebsiteSelection()" ng-model="masterDomain" class="form-control">
{% for items in websiteList %}
<option>{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
<div ng-hide="DomainCreateForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Domain Name" %}</label>
<div class="col-sm-6">
<input name="dom" type="text" class="form-control"
ng-model="domainNameCreate" required>
</div>
</div>
<div ng-hide="DomainCreateForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Path" %}: /home/{$ masterDomain $}/ </label>
<div class="col-sm-6">
<input type="text" class="form-control" ng-model="docRootPath" required>
</div>
<div ng-show="websiteCreationForm.dom.$error.pattern"
class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>
</div>
<div ng-hide="DomainCreateForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Select PHP" %}</label>
<div class="col-sm-6">
<select ng-model="phpSelection" class="form-control">
{% for php in phps %}
<option>{{ php }}</option>
{% endfor %}
</select>
</div>
</div>
<div ng-hide="DomainCreateForm" ng-hide="installationDetailsForm"
class="form-group">
<label class="col-sm-3 control-label">{% trans "Additional Features" %}</label>
<div class="col-sm-9">
<div class="checkbox">
<label>
<input ng-model="sslCheck" type="checkbox" value="">
SSL
</label>
</div>
</div>
<label class="col-sm-3 control-label"></label>
<div class="col-sm-9">
<div class="checkbox">
<label>
<input ng-model="dkimCheck" type="checkbox" value="">
DKIM Support
</label>
</div>
</div>
<label class="col-sm-3 control-label"></label>
<div class="col-sm-9">
<div class="checkbox">
<label>
<input ng-model="openBasedir" type="checkbox" value="">
open_basedir Protection
</label>
</div>
</div>
</div>
<div ng-hide="DomainCreateForm" class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
<button type="button" ng-click="createDomain()"
class="btn btn-primary btn-lg">{% trans "Create Domain" %}</button>
</div>
</div>
<div ng-hide="installationProgress" class="form-group">
<label class="col-sm-2 control-label"></label>
<div class="col-sm-7">
<div class="alert alert-success text-center">
<h2>{$ currentStatus $}</h2>
</div>
<div class="progress">
<div id="installProgress" class="progress-bar" role="progressbar"
aria-valuenow="70" aria-valuemin="0" aria-valuemax="100"
style="width:0%">
<span class="sr-only">70% Complete</span>
</div>
</div>
<div ng-hide="errorMessageBox" class="alert alert-danger">
<p>{% trans "Error message:" %} {$ errorMessage $}</p>
</div>
<div ng-hide="success" class="alert alert-success">
<p>{% trans "Website succesfully created." %}</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>
<div ng-hide="installationProgress" class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
<button type="button" ng-disabled="goBackDisable" ng-click="goBack()"
class="btn btn-primary btn-lg">{% trans "Go Back" %}</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@@ -242,10 +242,10 @@
<div class="content-box-wrapper">
<div class="row mx-10">
<div class="col-md-3 panel-body">
<a href="" ng-click="showCreateDomainForm()" title="{% trans 'Add Domains' %}" href="">
<a href="{% url 'CreateNewDomain' %}" title="{% trans 'Add Domains' %}" href="">
<img src="{% static 'images/icons/domains.png' %}" width="65" class="mr-10">
</a>
<a ng-click="showCreateDomainForm()" title="{% trans 'Add Domains' %}" href=""
<a href="{% url 'CreateNewDomain' %}" title="{% trans 'Add Domains' %}" href=""
title="{% trans 'Add Domains' %}">
<span class="h4">{% trans "Add Domains" %}</span>
</a>
@@ -275,7 +275,7 @@
<div class="col-md-3 panel-body">
<a href="{% url 'listCron' %}?domain={{ domain }}" target="_self" title="{% trans 'Add new Cron Job' %}"
href="" title="{% trans 'List Domains' %}">
href="" title="{% trans 'Add new Cron Job' %}">
<img src="{% static 'images/icons/repeat.png' %}" width="65" class="mr-10">
</a>
<a href="{% url 'listCron' %}?domain={{ domain }}" target="_self" title="{% trans 'Add new Cron Job' %}"
@@ -314,7 +314,6 @@
class="current-pack">{% trans "Invalid Domain (Note: You don't need to add 'http' or 'https')" %}</div>
</div>
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Select PHP" %}</label>
<div class="col-sm-6">
@@ -326,7 +325,6 @@
</div>
</div>
<div ng-hide="installationDetailsForm" ng-hide="installationDetailsForm"
class="form-group">
<label class="col-sm-3 control-label">{% trans "Additional Features" %}</label>
@@ -358,7 +356,6 @@
</div>
</div>
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
@@ -368,7 +365,6 @@
</div>
</div>
<div ng-hide="installationProgress" class="form-group">
<label class="col-sm-2 control-label"></label>
<div class="col-sm-7">

View File

@@ -11,6 +11,10 @@ urlpatterns = [
url(r'^deleteWebsite$', views.deleteWebsite, name='deleteWebsite'),
url(r'^siteState$', views.siteState, name='siteState'),
##
url(r'^CreateNewDomain$', views.CreateNewDomain, name='CreateNewDomain'),
# Website modification url

View File

@@ -46,6 +46,14 @@ def deleteWebsite(request):
except KeyError:
return redirect(loadLoginPage)
def CreateNewDomain(request):
try:
userID = request.session['userID']
wm = WebsiteManager()
return wm.CreateNewDomain(request, userID)
except KeyError:
return redirect(loadLoginPage)
def siteState(request):
try:
userID = request.session['userID']

View File

@@ -75,6 +75,12 @@ class WebsiteManager:
{'websiteList': websitesName}, 'deleteWebsite')
return proc.render()
def CreateNewDomain(self, request=None, userID=None, data=None):
currentACL = ACLManager.loadedACL(userID)
websitesName = ACLManager.findAllSites(currentACL, userID)
proc = httpProc(request, 'websiteFunctions/createDomain.html', {'websiteList': websitesName, 'phps': PHPManager.findPHPVersions()})
return proc.render()
def siteState(self, request=None, userID=None, data=None):
currentACL = ACLManager.loadedACL(userID)