mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 21:35:55 +01:00
This commit is contained in:
@@ -89,9 +89,8 @@
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'baseTemplate/custom-js/pnotify.custom.min.css' %}">
|
||||
<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"/>
|
||||
<link type="text/css" href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet"/>
|
||||
{% block styles %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -1222,12 +1222,17 @@ class virtualHostUtilities:
|
||||
return 0, str(msg)
|
||||
|
||||
@staticmethod
|
||||
def deleteDomain(virtualHostName):
|
||||
def deleteDomain(virtualHostName, DeleteDocRoot=0):
|
||||
try:
|
||||
|
||||
numberOfWebsites = Websites.objects.count() + ChildDomains.objects.count()
|
||||
vhost.deleteCoreConf(virtualHostName, numberOfWebsites)
|
||||
delWebsite = ChildDomains.objects.get(domain=virtualHostName)
|
||||
|
||||
if DeleteDocRoot:
|
||||
command = 'rm -rf %s' % (delWebsite.path)
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
delWebsite.delete()
|
||||
installUtilities.installUtilities.reStartLiteSpeed()
|
||||
|
||||
@@ -1432,6 +1437,10 @@ def main():
|
||||
|
||||
parser.add_argument('--server', help='Switch server parameter.')
|
||||
|
||||
## Doc root deletion for child domain
|
||||
|
||||
parser.add_argument('--DeleteDocRoot', help='Doc root deletion for child domain.')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.function == "createVirtualHost":
|
||||
@@ -1524,7 +1533,7 @@ def main():
|
||||
elif args.function == 'changeOpenBasedir':
|
||||
virtualHostUtilities.changeOpenBasedir(args.virtualHostName, args.openBasedirValue)
|
||||
elif args.function == 'deleteDomain':
|
||||
virtualHostUtilities.deleteDomain(args.virtualHostName)
|
||||
virtualHostUtilities.deleteDomain(args.virtualHostName, int(args.DeleteDocRoot))
|
||||
elif args.function == 'switchServer':
|
||||
virtualHostUtilities.switchServer(args.virtualHostName, args.phpVersion, int(args.server), args.tempStatusPath)
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ function getCookie(name) {
|
||||
return cookieValue;
|
||||
}
|
||||
|
||||
|
||||
/* Java script code to create account */
|
||||
app.controller('createWebsite', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
@@ -388,7 +389,6 @@ app.controller('listWebsites', function ($scope, $http) {
|
||||
|
||||
app.controller('listChildDomainsMain', function ($scope, $http, $timeout) {
|
||||
|
||||
|
||||
$scope.currentPage = 1;
|
||||
$scope.recordsToShow = 10;
|
||||
|
||||
@@ -700,7 +700,59 @@ app.controller('listChildDomainsMain', function ($scope, $http, $timeout) {
|
||||
|
||||
|
||||
}
|
||||
var DeleteDomain;
|
||||
$scope.deleteDomainInit = function (childDomainForDeletion){
|
||||
DeleteDomain = childDomainForDeletion;
|
||||
};
|
||||
|
||||
$scope.deleteChildDomain = function () {
|
||||
$scope.cyberPanelLoading = false;
|
||||
url = "/websites/submitDomainDeletion";
|
||||
|
||||
var data = {
|
||||
websiteName: DeleteDomain,
|
||||
DeleteDocRoot: $scope.DeleteDocRoot
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
$scope.cyberPanelLoading = true;
|
||||
if (response.data.websiteDeleteStatus === 1) {
|
||||
new PNotify({
|
||||
title: 'Success!',
|
||||
text: 'Child Domain successfully deleted.',
|
||||
type: 'success'
|
||||
});
|
||||
$scope.getFurtherWebsitesFromDB();
|
||||
} 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'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ function getCookie(name) {
|
||||
return cookieValue;
|
||||
}
|
||||
|
||||
|
||||
/* Java script code to create account */
|
||||
app.controller('createWebsite', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
@@ -388,7 +389,6 @@ app.controller('listWebsites', function ($scope, $http) {
|
||||
|
||||
app.controller('listChildDomainsMain', function ($scope, $http, $timeout) {
|
||||
|
||||
|
||||
$scope.currentPage = 1;
|
||||
$scope.recordsToShow = 10;
|
||||
|
||||
@@ -700,7 +700,59 @@ app.controller('listChildDomainsMain', function ($scope, $http, $timeout) {
|
||||
|
||||
|
||||
}
|
||||
var DeleteDomain;
|
||||
$scope.deleteDomainInit = function (childDomainForDeletion){
|
||||
DeleteDomain = childDomainForDeletion;
|
||||
};
|
||||
|
||||
$scope.deleteChildDomain = function () {
|
||||
$scope.cyberPanelLoading = false;
|
||||
url = "/websites/submitDomainDeletion";
|
||||
|
||||
var data = {
|
||||
websiteName: DeleteDomain,
|
||||
DeleteDocRoot: $scope.DeleteDocRoot
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
$scope.cyberPanelLoading = true;
|
||||
if (response.data.websiteDeleteStatus === 1) {
|
||||
new PNotify({
|
||||
title: 'Success!',
|
||||
text: 'Child Domain successfully deleted.',
|
||||
type: 'success'
|
||||
});
|
||||
$scope.getFurtherWebsitesFromDB();
|
||||
} 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'
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
</a>
|
||||
<a target="_blank" href="/filemanager/{$ web.masterDomain $}" title="Open File Manager">
|
||||
--
|
||||
{$ web.path $}</a>
|
||||
File Manager</a>
|
||||
</div>
|
||||
<div class="col-md-2 content-box-header" style="text-transform: none;">
|
||||
<a href="/websites/{$ web.masterDomain $}/{$ web.domain $}" target="_blank"
|
||||
@@ -69,9 +69,48 @@
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-4 content-box-header">
|
||||
<i class="p fa fa-user-circle btn-icon text-muted" data-toggle="tooltip"
|
||||
data-placement="right" title="Master Domain/Owner"> </i>
|
||||
<span ng-bind="web.masterDomain" style="text-transform: none"></span>
|
||||
<i class="p fa fa-trash-o btn-icon text-muted" data-toggle="tooltip"
|
||||
data-placement="right"
|
||||
title="Delete Child Domain"> </i>
|
||||
<span><a ng-click='deleteDomainInit(web.domain)' data-toggle="modal" data-target="#DeleteChild" href=""
|
||||
style="text-transform: none">Delete</a></span>
|
||||
<div id="DeleteChild" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×
|
||||
</button>
|
||||
<h4 class="modal-title">Delete Child Domain
|
||||
<img ng-hide="$parent.cyberPanelLoading"
|
||||
src="/static/images/loading.gif"
|
||||
style="display: none;">
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form name="DeleteDocumentRootForm" action="/" class="form-horizontal">
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-2 control-label">{% trans "" %}</label>
|
||||
<div class="col-sm-8">
|
||||
<input ng-model="$parent.DeleteDocRoot" type="checkbox" value="">
|
||||
Delete Document Root
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary"
|
||||
ng-click="deleteChildDomain()">Delete Now
|
||||
</button>
|
||||
<button type="button" ng-disabled="savingSettings"
|
||||
class="btn btn-default" data-dismiss="modal">
|
||||
Close
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 content-box-header">
|
||||
<i class="p fa fa-map-marker btn-icon text-muted" data-toggle="tooltip"
|
||||
@@ -114,7 +153,8 @@
|
||||
<button type="button" class="close" data-dismiss="modal">×
|
||||
</button>
|
||||
<h4 class="modal-title">Convert Child Domain to normal Website
|
||||
<img ng-hide="$parent.cyberPanelLoading" src="/static/images/loading.gif"
|
||||
<img ng-hide="$parent.cyberPanelLoading"
|
||||
src="/static/images/loading.gif"
|
||||
style="display: none;">
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
@@ -535,13 +535,18 @@ class WebsiteManager:
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
websiteName = data['websiteName']
|
||||
|
||||
try:
|
||||
DeleteDocRoot = int(data['DeleteDocRoot'])
|
||||
except:
|
||||
DeleteDocRoot = 0
|
||||
|
||||
if ACLManager.checkOwnership(websiteName, admin, currentACL) == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('websiteDeleteStatus', 0)
|
||||
|
||||
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"
|
||||
execPath = execPath + " deleteDomain --virtualHostName " + websiteName
|
||||
execPath = execPath + " deleteDomain --virtualHostName " + websiteName + ' --DeleteDocRoot %s' % (str(DeleteDocRoot))
|
||||
ProcessUtilities.outputExecutioner(execPath)
|
||||
|
||||
data_ret = {'status': 1, 'websiteDeleteStatus': 1, 'error_message': "None"}
|
||||
|
||||
Reference in New Issue
Block a user