wphomechanges

This commit is contained in:
Hassan Hashmi
2022-06-20 13:27:55 +05:00
parent 19fab57d1f
commit 7f0849fde7
5 changed files with 359 additions and 103 deletions

View File

@@ -1476,6 +1476,108 @@ app.controller('WPsiteHome', function ($scope, $http, $timeout, $compile, $windo
}; };
$scope.installwpcore = function () {
$('#wordpresshomeloading').show();
var data = {
WPid: $('#WPid').html(),
}
$scope.wordpresshomeloading = false;
var url = "/websites/installwpcore";
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$('#wordpresshomeloading').hide();
$scope.wordpresshomeloading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success!',
text: 'installwpcore done.',
type: 'success'
});
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$('#wordpresshomeloading').hide();
$scope.wordpresshomeloading = true;
alert(response)
}
};
$scope.dataintegrity = function () {
$('#wordpresshomeloading').show();
var data = {
WPid: $('#WPid').html(),
}
$scope.wordpresshomeloading = false;
var url = "/websites/dataintegrity";
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
$('#wordpresshomeloading').hide();
$scope.wordpresshomeloading = true;
if (response.data.status === 1) {
new PNotify({
title: 'Success!',
text: 'dataintegrity done.',
type: 'success'
});
} else {
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}
}
function cantLoadInitialDatas(response) {
$('#wordpresshomeloading').hide();
$scope.wordpresshomeloading = true;
alert(response)
}
};
}); });

View File

@@ -65,7 +65,7 @@
Open Open
</a> </a>
<a target="_blank" <a target="_blank"
href="/filemanager/{{ wpsite.owner.domain }}?path={{wpsite.path}}" href="/filemanager/{{ wpsite.owner.domain }}?path={{ wpsite.path }}"
style="margin-left: 4%"> style="margin-left: 4%">
<svg xmlns="http://www.w3.org/2000/svg" <svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xlink="http://www.w3.org/1999/xlink"
@@ -224,6 +224,17 @@
for="maintenanceMode"></label> for="maintenanceMode"></label>
</div> </div>
</div> </div>
<div class="col-md-3">
<h6 style="font-weight: bold"> WP Corn</h6>
<div class="custom-control custom-switch">
<input
type="checkbox"
class="custom-control-input ng-pristine ng-untouched ng-valid ng-empty"
id="maintenanceMode">
<label class="custom-control-label"
for="maintenanceMode"></label>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -498,110 +509,53 @@
</div> </div>
<hr> <hr>
<div class="d-lg-flex d-none justify-content-center"> <div style="display: flex; flex-wrap: wrap">
<a href="/websites/{{ wpsite.owner.domain }}"> <div class="col-sm-11">
<svg xmlns="http://www.w3.org/2000/svg" <a href="/websites/{{ wpsite.owner.domain }}">
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" <svg xmlns="http://www.w3.org/2000/svg"
focusable="false" width="1em" height="1em" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);" focusable="false" width="1em" height="1em"
preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"> style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
<path d="M16 18H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2zM6 6v10h10V6z" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32">
fill="#626262"></path> <path d="M16 18H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2zM6 6v10h10V6z"
<path d="M26 12v4h-4v-4h4m0-2h-4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2z" fill="#626262"></path>
fill="#626262"></path> <path d="M26 12v4h-4v-4h4m0-2h-4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2z"
<path d="M26 22v4h-4v-4h4m0-2h-4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2z" fill="#626262"></path>
fill="#626262"></path> <path d="M26 22v4h-4v-4h4m0-2h-4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2z"
<path d="M16 22v4h-4v-4h4m0-2h-4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2z" fill="#626262"></path>
fill="#626262"></path> <path d="M16 22v4h-4v-4h4m0-2h-4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2z"
</svg> fill="#626262"></path>
Manage Application </svg>
</a> Manage Application
<a ng-click="autoUpdateConfigurationsInit()" data-toggle="modal" </a>
data-target="#autoUpdateConfig" style="margin-left: 3%" <a ng-click="autoUpdateConfigurationsInit()" data-toggle="modal"
href="javascript: void(0);"> data-target="#autoUpdateConfig" style="margin-left: 3%"
<svg xmlns="http://www.w3.org/2000/svg" href="javascript: void(0);">
xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" <svg xmlns="http://www.w3.org/2000/svg"
focusable="false" width="1em" height="1em" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true"
style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);" focusable="false" width="1em" height="1em"
preserveAspectRatio="xMidYMid meet" viewBox="0 0 20 20"> style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
<path d="M10.2 3.28c3.53 0 6.43 2.61 6.92 6h2.08l-3.5 4l-3.5-4h2.32a4.439 4.439 0 0 0-4.32-3.45c-1.45 0-2.73.71-3.54 1.78L4.95 5.66a6.965 6.965 0 0 1 5.25-2.38zm-.4 13.44c-3.52 0-6.43-2.61-6.92-6H.8l3.5-4c1.17 1.33 2.33 2.67 3.5 4H5.48a4.439 4.439 0 0 0 4.32 3.45c1.45 0 2.73-.71 3.54-1.78l1.71 1.95a6.95 6.95 0 0 1-5.25 2.38z" preserveAspectRatio="xMidYMid meet" viewBox="0 0 20 20">
fill="#626262"></path> <path d="M10.2 3.28c3.53 0 6.43 2.61 6.92 6h2.08l-3.5 4l-3.5-4h2.32a4.439 4.439 0 0 0-4.32-3.45c-1.45 0-2.73.71-3.54 1.78L4.95 5.66a6.965 6.965 0 0 1 5.25-2.38zm-.4 13.44c-3.52 0-6.43-2.61-6.92-6H.8l3.5-4c1.17 1.33 2.33 2.67 3.5 4H5.48a4.439 4.439 0 0 0 4.32 3.45c1.45 0 2.73-.71 3.54-1.78l1.71 1.95a6.95 6.95 0 0 1-5.25 2.38z"
</svg> fill="#626262"></path>
Autoupdate Configurations </svg>
</a> Autoupdate Configurations
</a>
</div>
<div id="autoUpdateConfig" class="modal fade" tabindex="-1" role="dialog" <div class="col-sm-1">
aria-hidden="true">
<div class="modal-dialog">
<!-- Modal content--> <a data-toggle="modal"
<div class="modal-content"> data-target="#securitymodel" style="margin-left: 3%"
<div class="modal-header"> href="javascript: void(0);">
<button type="button" class="close" data-dismiss="modal"> <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" width="1em"
&times; style="-ms-transform: rotate(360deg); -webkit-transform: rotate(360deg); transform: rotate(360deg);"
</button> height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24">
<h4 class="modal-title">{% trans "Updates" %}</h4> <path fill="#626262"
</div> d="M12 22q-3.475-.875-5.737-3.988Q4 14.9 4 11.1V5l8-3l8 3v6.1q0 3.8-2.262 6.912Q15.475 21.125 12 22Zm0-2.1q2.425-.75 4.05-2.962q1.625-2.213 1.9-4.938H12V4.125l-6 2.25v5.175q0 .175.05.45H12Z"/>
<div class="modal-body"> </svg>
<form> Security
</a>
<h4 style="margin: 2%">Configure setting for automatic
updates.</h4>
<div class="row">
<label class="col-lg-6">Automatic Updates
(Currently:
{{ wpsite.AutoUpdates }})</label>
<div class="col-lg-6">
<select id="AutomaticUpdates"
style="padding: 10px">
<option>Disabled</option>
<option>Minor and Security Updates</option>
<option>All (minor and major)</option>
</select>
</div>
</div>
<div class="row">
<label class="col-lg-4">Plugins
(Currently: {{ wpsite.PluginUpdates }})</label>
<div class="col-lg-8">
<select id="Plugins"
style="padding: 10px">
<option>Enabled</option>
<option>Disabled</option>
</select>
</div>
</div>
<div class="row">
<label class="col-lg-4">Themes
(Currently: {{ wpsite.ThemeUpdates }})</label>
<div class="col-lg-8">
<select id="Themes"
style="padding: 10px">
<option>Enabled</option>
<option>Disabled</option>
</select>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary"
ng-click="SaveUpdateConfig()">Save
</button>
<button type="button" ng-disabled="savingSettings"
class="btn btn-default" data-dismiss="modal">
Close
</button>
</div>
</div>
</div>
<!-- /.modal-dialog -->
</div> </div>
</div> </div>
</div> </div>
@@ -610,6 +564,119 @@
</div> </div>
</div> </div>
</div> </div>
<!-------Start Model of AutoUpdateCongiguration-->
<div id="autoUpdateConfig" class="modal fade" tabindex="-1" role="dialog"
aria-hidden="true">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
&times;
</button>
<h4 class="modal-title">{% trans "Updates" %}</h4>
</div>
<div class="modal-body">
<form>
<h4 style="margin: 2%">Configure setting for automatic
updates.</h4>
<div class="row">
<label class="col-lg-6">Automatic Updates
(Currently:
{{ wpsite.AutoUpdates }})</label>
<div class="col-lg-6">
<select id="AutomaticUpdates"
style="padding: 10px">
<option>Disabled</option>
<option>Minor and Security Updates</option>
<option>All (minor and major)</option>
</select>
</div>
</div>
<div class="row">
<label class="col-lg-4">Plugins
(Currently: {{ wpsite.PluginUpdates }})</label>
<div class="col-lg-8">
<select id="Plugins"
style="padding: 10px">
<option>Enabled</option>
<option>Disabled</option>
</select>
</div>
</div>
<div class="row">
<label class="col-lg-4">Themes
(Currently: {{ wpsite.ThemeUpdates }})</label>
<div class="col-lg-8">
<select id="Themes"
style="padding: 10px">
<option>Enabled</option>
<option>Disabled</option>
</select>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary"
ng-click="SaveUpdateConfig()">Save
</button>
<button type="button" ng-disabled="savingSettings"
class="btn btn-default" data-dismiss="modal">
Close
</button>
</div>
</div>
</div>
<!-- /.modal-dialog -->
</div>
<!-------End Model of AutoUpdateCongiguration-->
<!-------Start Model of Security-->
<div id="securitymodel" class="modal fade" tabindex="-1" role="dialog"
aria-hidden="true">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
&times;
</button>
<h4 class="modal-title">{% trans "Security" %}</h4>
</div>
<div class="modal-body center-div">
<button
data-toggle="modal"
data-target="#DeleteMember" aria-label=""
ng-click="dataintegrity()"
type="button" class="btn btn-border btn-alt border-azure btn-link font-black">
data integrity
</button>
<button
data-toggle="modal"
data-target="#DeleteMember" aria-label=""
ng-click="installwpcore()"
type="button" class="btn btn-border btn-alt border-azure btn-link font-black">
Install WP Core
</button>
</div>
</div>
</div>
<!-- /.modal-dialog -->
</div>
<!-------End Model of Security-->
<div id="DeployToProduction" class="modal fade" role="dialog"> <div id="DeployToProduction" class="modal fade" role="dialog">
<div class="modal-dialog"> <div class="modal-dialog">
<!-- Modal content--> <!-- Modal content-->

View File

@@ -43,6 +43,9 @@ urlpatterns = [
url(r'^DeploytoProduction', views.DeploytoProduction, name='DeploytoProduction'), url(r'^DeploytoProduction', views.DeploytoProduction, name='DeploytoProduction'),
url(r'^WPCreateBackup', views.WPCreateBackup, name='WPCreateBackup'), url(r'^WPCreateBackup', views.WPCreateBackup, name='WPCreateBackup'),
url(r'^RestoreWPbackupNow', views.RestoreWPbackupNow, name='RestoreWPbackupNow'), url(r'^RestoreWPbackupNow', views.RestoreWPbackupNow, name='RestoreWPbackupNow'),
url(r'^RestoreWPbackupNow', views.RestoreWPbackupNow, name='RestoreWPbackupNow'),
url(r'^dataintegrity', views.dataintegrity, name='dataintegrity'),
url(r'^installwpcore', views.installwpcore, name='installwpcore'),

View File

@@ -386,6 +386,50 @@ def RestoreWPbackupNow(request):
return redirect(loadLoginPage) return redirect(loadLoginPage)
def installwpcore(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.installwpcore(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def dataintegrity(request):
try:
userID = request.session['userID']
result = pluginManager.preWebsiteCreation(request)
if result != 200:
return result
wm = WebsiteManager()
coreResult = wm.dataintegrity(userID, json.loads(request.body))
result = pluginManager.postWebsiteCreation(request, coreResult)
if result != 200:
return result
return coreResult
except KeyError:
return redirect(loadLoginPage)
def GetCurrentThemes(request): def GetCurrentThemes(request):
try: try:

View File

@@ -914,6 +914,46 @@ class WebsiteManager:
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
def installwpcore(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPid = data['WPid']
time.sleep(2)
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None',}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def dataintegrity(self, userID=None, data=None):
try:
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)
WPid = data['WPid']
time.sleep(2)
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None',}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException as msg:
data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
def UpdatePlugins(self, userID=None, data=None): def UpdatePlugins(self, userID=None, data=None):
try: try: