mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 13:25:51 +01:00
pluginfunctionDone
This commit is contained in:
@@ -102,7 +102,7 @@ class NormalBackupJobLogs(models.Model):
|
||||
|
||||
|
||||
class wpplugins(models.Model):
|
||||
owner = models.ForeignKey(Websites, on_delete=models.CASCADE)
|
||||
owner = models.ForeignKey(Administrator, on_delete=models.CASCADE)
|
||||
Name = models.CharField(max_length=255, default='')
|
||||
config = models.TextField()
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ function getCookie(name) {
|
||||
}
|
||||
return cookieValue;
|
||||
}
|
||||
|
||||
var arry = []
|
||||
|
||||
function selectpluginJs(val) {
|
||||
@@ -37,18 +38,29 @@ function selectpluginJs(val) {
|
||||
|
||||
}
|
||||
|
||||
app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
$scope.SearchPluginName = function () {
|
||||
var DeletePluginURL;
|
||||
|
||||
function DeletePluginBuucket(url) {
|
||||
DeletePluginURL = url;
|
||||
}
|
||||
|
||||
function FinalDeletePluginBuucket() {
|
||||
window.location.href = DeletePluginURL;
|
||||
}
|
||||
|
||||
var SPVal;
|
||||
app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window, $compile) {
|
||||
|
||||
$scope.SearchPluginName = function (val) {
|
||||
SPVal = val;
|
||||
url = "/websites/SearchOnkeyupPlugin";
|
||||
|
||||
var searchcontent = $scope.searchcontent;
|
||||
|
||||
|
||||
|
||||
var data = {
|
||||
pluginname : searchcontent
|
||||
pluginname: searchcontent
|
||||
};
|
||||
|
||||
var config = {
|
||||
@@ -63,9 +75,7 @@ app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window) {
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if (response.data.status === 1) {
|
||||
// console.log(response.data);
|
||||
|
||||
|
||||
if (SPVal == 'add') {
|
||||
$('#mysearch').show()
|
||||
document.getElementById('mysearch').innerHTML = "";
|
||||
var res = response.data.plugns.plugins
|
||||
@@ -74,12 +84,26 @@ app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window) {
|
||||
//
|
||||
var tml = '<option onclick="selectpluginJs(\'' + res[i].slug + '\')" style=" border-bottom: 1px solid rgba(90, 91, 92, 0.5); padding: 5px; " value="' + res[i].slug + '">' + res[i].name + '</option> <br>';
|
||||
$('#mysearch').append(tml);
|
||||
}
|
||||
} else if (SPVal == 'eidt') {
|
||||
$('#mysearch').show()
|
||||
document.getElementById('mysearch').innerHTML = "";
|
||||
var res = response.data.plugns.plugins
|
||||
// console.log(res);
|
||||
for (i = 0; i <= res.length; i++) {
|
||||
//
|
||||
var tml = '<option ng-click="Addplugin(\'' + res[i].slug + '\')" style=" border-bottom: 1px solid rgba(90, 91, 92, 0.5); padding: 5px; " value="' + res[i].slug + '">' + res[i].name + '</option> <br>';
|
||||
var temp = $compile(tml)($scope)
|
||||
angular.element(document.getElementById('mysearch')).append(temp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
// $scope.errorMessage = response.data.error_message;
|
||||
alert("Status not = 1: Error..."+response.data.error_message)
|
||||
alert("Status not = 1: Error..." + response.data.error_message)
|
||||
}
|
||||
|
||||
|
||||
@@ -87,11 +111,136 @@ app.controller('WPAddNewPlugin', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
alert("Error..."+response)
|
||||
alert("Error..." + response)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$scope.AddNewplugin = function () {
|
||||
|
||||
url = "/websites/AddNewpluginAjax";
|
||||
|
||||
var bucketname = $scope.PluginbucketName
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var data = {
|
||||
config: arry,
|
||||
Name: bucketname
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if (response.data.status === 1) {
|
||||
alert("added..........");
|
||||
location.reload();
|
||||
} else {
|
||||
|
||||
// $scope.errorMessage = response.data.error_message;
|
||||
alert("Status not = 1: Error..." + response.data.error_message)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
alert("Error..." + response)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$scope.deletesPlgin = function (val) {
|
||||
|
||||
url = "/websites/deletesPlgin";
|
||||
|
||||
|
||||
var data = {
|
||||
pluginname: val,
|
||||
pluginbBucketID: $('#pluginbID').html()
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if (response.data.status === 1) {
|
||||
location.reload();
|
||||
|
||||
} else {
|
||||
|
||||
// $scope.errorMessage = response.data.error_message;
|
||||
alert("Status not = 1: Error..." + response.data.error_message)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
alert("Error..." + response)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$scope.Addplugin = function (slug) {
|
||||
$('#mysearch').hide()
|
||||
|
||||
url = "/websites/Addplugineidt";
|
||||
|
||||
|
||||
var data = {
|
||||
pluginname: slug,
|
||||
pluginbBucketID: $('#pluginbID').html()
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if (response.data.status === 1) {
|
||||
location.reload();
|
||||
|
||||
} else {
|
||||
|
||||
// $scope.errorMessage = response.data.error_message;
|
||||
alert("Status not = 1: Error..." + response.data.error_message)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
alert("Error..." + response)
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -774,8 +923,9 @@ app.controller('listChildDomainsMain', function ($scope, $http, $timeout) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
var DeleteDomain;
|
||||
$scope.deleteDomainInit = function (childDomainForDeletion){
|
||||
$scope.deleteDomainInit = function (childDomainForDeletion) {
|
||||
DeleteDomain = childDomainForDeletion;
|
||||
};
|
||||
|
||||
@@ -2118,7 +2268,7 @@ app.controller('websitePages', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
var statusFile;
|
||||
|
||||
$scope.WebsiteSelection = function (){
|
||||
$scope.WebsiteSelection = function () {
|
||||
$scope.DomainCreateForm = false;
|
||||
};
|
||||
|
||||
@@ -2831,8 +2981,7 @@ RewriteRule ^(.*)$ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
|
||||
$scope.rewriteRules = httpToHTTPS + $scope.rewriteRules;
|
||||
} else if ($scope.rewriteTemplate === "Force NON-WWW -> WWW") {
|
||||
$scope.rewriteRules = nonWWWToWWW + $scope.rewriteRules;
|
||||
}
|
||||
else if ($scope.rewriteTemplate === "Force WWW -> NON-WWW") {
|
||||
} else if ($scope.rewriteTemplate === "Force WWW -> NON-WWW") {
|
||||
$scope.rewriteRules = WWWToNonWWW + $scope.rewriteRules;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<label>{% trans "Search Plugin Name" %}</label>
|
||||
|
||||
<input name="searchcontent" type="text" class="form-control" ng-model="searchcontent"
|
||||
ng-keyup="SearchPluginName()"
|
||||
ng-keyup="SearchPluginName('add')"
|
||||
placeholder="{% trans "Search Plugin...." %}" required>
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button ng-disabled="websiteCreationForm.dom.$error.required || websiteCreationForm.email.$invalid"
|
||||
type="button"
|
||||
type="button" ng-click="AddNewplugin()"
|
||||
class="btn btn-primary btn-lg">{% trans "Add Plugin Bucket" %}</button>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -11,11 +11,93 @@
|
||||
<div id="page-title">
|
||||
<h2 id="domainNamePage"><h2>{% trans "Configure Plugins" %}</h2>
|
||||
<a class="pull-right btn btn-primary" href="{% url "Addnewplugin" %}">{% trans "Add New Plugin" %}</a>
|
||||
|
||||
</h2>
|
||||
</div>
|
||||
<h3>List of Saved Plugins Bucket</h3>
|
||||
<table class="table table-hover dataTable no-footer" id="basicTable" role="grid">
|
||||
<thead style="background-color: #0a6ebd">
|
||||
<tr role="row" class="plans-head">
|
||||
<th style="color: #fff0ff" class="sorting_desc" tabindex="0"
|
||||
aria-controls="basicTable" rowspan="1" colspan="1"
|
||||
aria-sort="descending"
|
||||
aria-label="Title: activate to sort column ascending">ID
|
||||
</th>
|
||||
<th style="color: #fff0ff" class="sorting" tabindex="0"
|
||||
aria-controls="basicTable" rowspan="1" colspan="1"
|
||||
aria-label="Places: activate to sort column ascending">File name
|
||||
</th>
|
||||
|
||||
<th style="color: #fff0ff" class="sorting" tabindex="0"
|
||||
aria-controls="basicTable" rowspan="1" colspan="1"
|
||||
aria-label="Places: activate to sort column ascending">Action
|
||||
</th>
|
||||
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for sub in Selectedplugins %}
|
||||
|
||||
<tr role="row" class="odd">
|
||||
<td class="v-align-middle sorting_1">
|
||||
<p>{{ sub.id }}</p>
|
||||
|
||||
</td>
|
||||
<td class="v-align-middle">
|
||||
<p>{{ sub.Name }}</p>
|
||||
</td>
|
||||
<td class="row form-group">
|
||||
<div class="col">
|
||||
<a href="{% url 'EidtPlugin'%}?ID={{sub.id}}"
|
||||
type="button" class="btn btn-border btn-alt border-green btn-link font-green">
|
||||
Edit
|
||||
</a>
|
||||
</div>
|
||||
<div class="col">
|
||||
|
||||
|
||||
<button
|
||||
onclick="DeletePluginBuucket('{% url 'ConfigurePlugins' %}?delete={{ sub.id }}')"
|
||||
data-toggle="modal"
|
||||
data-target="#DeleteMember" aria-label=""
|
||||
type="button" class="btn btn-border btn-alt border-red btn-link font-red">
|
||||
Delete
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!------------Modal---->
|
||||
|
||||
<div class="modal fade stick-up" id="DeleteMember" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title">Deleting Plugin Bucket</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Are you sure?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
|
||||
<button type="button" onclick="FinalDeletePluginBuucket()" class="btn btn-primary">Yes</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "plugin - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
<div class="container">
|
||||
<span id="pluginbID" style="display: none">{{ pluginbID }}</span>
|
||||
<div id="page-title">
|
||||
<h2 id="domainNamePage">{% trans "Eidt Plugin Bucket" %}
|
||||
|
||||
</h2>
|
||||
</div>
|
||||
<div ng-controller="WPAddNewPlugin" class="panel">
|
||||
<div class="panel-body">
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
<form name="websiteCreationForm" action="/" id="createPackages"
|
||||
class="form-horizontal bordered-row panel-body">
|
||||
|
||||
|
||||
<label>{% trans "Search Plugin Name" %}</label>
|
||||
|
||||
<input name="searchcontent" type="text" class="form-control" ng-model="searchcontent"
|
||||
ng-keyup="SearchPluginName('eidt')"
|
||||
placeholder="{% trans "Search Plugin...." %}" required>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="mysearch" class="col-lg-12" style="display: none; border-top: none!important;
|
||||
border: 1px solid rgba(90, 91, 92, 0.7);
|
||||
position: absolute; z-index: 1;
|
||||
background-color: #FFFFFF">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<h3>Selected Plugin</h3>
|
||||
<div id="sedplugn" style=" display: flex; flex-direction: row;">
|
||||
{% for plugin in Selectedplugins %}
|
||||
<div id="selplug"
|
||||
style="background-color: #12207a; color: #FFFFFF; padding: 5px; border-radius: 30px">
|
||||
{{plugin}}
|
||||
<svg ng-click="deletesPlgin('{{plugin}}')" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"
|
||||
role="img" width="1em" height="1em"
|
||||
preserveAspectRatio="xMidYMid meet" viewBox="0 0 16 16">
|
||||
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
|
||||
stroke-width="1.5" d="m11.25 4.75l-6.5 6.5m0-6.5l6.5 6.5"/>
|
||||
</svg>
|
||||
|
||||
</div>
|
||||
   
|
||||
{% endfor %}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button ng-disabled="websiteCreationForm.dom.$error.required || websiteCreationForm.email.$invalid"
|
||||
type="button" ng-click="AddNewplugin()"
|
||||
class="btn btn-primary btn-lg">{% trans "Add Plugin Bucket" %}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -22,9 +22,13 @@ urlpatterns = [
|
||||
#### AddPlugin
|
||||
url(r'^ConfigurePlugins$', views.ConfigurePlugins, name='ConfigurePlugins'),
|
||||
url(r'^Addnewplugin$', views.Addnewplugin, name='Addnewplugin'),
|
||||
url(r'^EidtPlugin$', views.EidtPlugin, name='EidtPlugin'),
|
||||
|
||||
## AddPlugin Ajax
|
||||
url(r'^SearchOnkeyupPlugin$', views.SearchOnkeyupPlugin, name='SearchOnkeyupPlugin'),
|
||||
url(r'^AddNewpluginAjax$', views.AddNewpluginAjax, name='AddNewpluginAjax'),
|
||||
url(r'^deletesPlgin', views.deletesPlgin, name='deletesPlgin'),
|
||||
url(r'^Addplugineidt', views.Addplugineidt, name='Addplugineidt'),
|
||||
|
||||
|
||||
# Website modification url
|
||||
|
||||
@@ -10,6 +10,7 @@ import plogical.CyberCPLogFileWriter as logging
|
||||
|
||||
|
||||
from plogical.httpProc import httpProc
|
||||
from websiteFunctions.models import wpplugins
|
||||
from websiteFunctions.website import WebsiteManager
|
||||
from websiteFunctions.pluginManager import pluginManager
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
@@ -38,6 +39,16 @@ def WPCreate(request):
|
||||
def ConfigurePlugins(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
userobj = Administrator.objects.get(pk=userID)
|
||||
DeleteFileID = request.GET.get('delete', None)
|
||||
if DeleteFileID != None:
|
||||
try:
|
||||
jobobj = wpplugins.objects.get(pk=DeleteFileID, owner=userobj)
|
||||
jobobj.delete()
|
||||
Deleted = 1
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile("DeleteFileID ....... %s....msg.....%s" % (DeleteFileID,msg))
|
||||
Deleted = 0
|
||||
wm = WebsiteManager()
|
||||
return wm.ConfigurePlugins(request, userID)
|
||||
except KeyError:
|
||||
@@ -73,6 +84,84 @@ def SearchOnkeyupPlugin(request):
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def AddNewpluginAjax(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
result = pluginManager.preWebsiteCreation(request)
|
||||
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
coreResult = wm.AddNewpluginAjax(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postWebsiteCreation(request, coreResult)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def EidtPlugin(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
pluginbID = request.GET.get('ID')
|
||||
wm = WebsiteManager()
|
||||
return wm.EidtPlugin(request, userID, pluginbID)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def deletesPlgin(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
result = pluginManager.preWebsiteCreation(request)
|
||||
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
coreResult = wm.deletesPlgin(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postWebsiteCreation(request, coreResult)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def Addplugineidt(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
result = pluginManager.preWebsiteCreation(request)
|
||||
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
wm = WebsiteManager()
|
||||
coreResult = wm.Addplugineidt(userID, json.loads(request.body))
|
||||
|
||||
result = pluginManager.postWebsiteCreation(request, coreResult)
|
||||
if result != 200:
|
||||
return result
|
||||
|
||||
return coreResult
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
|
||||
def modifyWebsite(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
@@ -12,7 +12,7 @@ django.setup()
|
||||
import json
|
||||
from plogical.acl import ACLManager
|
||||
import plogical.CyberCPLogFileWriter as logging
|
||||
from websiteFunctions.models import Websites, ChildDomains, GitLogs
|
||||
from websiteFunctions.models import Websites, ChildDomains, GitLogs, wpplugins
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
import subprocess
|
||||
import shlex
|
||||
@@ -89,12 +89,21 @@ class WebsiteManager:
|
||||
return proc.render()
|
||||
|
||||
def ConfigurePlugins(self, request=None, userID=None, data=None):
|
||||
|
||||
DataPass ={}
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
adminNames = ACLManager.loadAllUsers(userID)
|
||||
packagesName = ACLManager.loadPackages(userID, currentACL)
|
||||
phps = PHPManager.findPHPVersions()
|
||||
userobj = Administrator.objects.get(pk=userID)
|
||||
|
||||
Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps}
|
||||
|
||||
|
||||
|
||||
Selectedplugins = wpplugins.objects.filter(owner = userobj)
|
||||
#data['Selectedplugins'] = wpplugins.objects.filter(ProjectOwner=HostingCompany)
|
||||
|
||||
Data = {'packageList': packagesName, "owernList": adminNames, 'phps': phps, 'Selectedplugins' : Selectedplugins,}
|
||||
proc = httpProc(request, 'websiteFunctions/WPConfigurePlugins.html',
|
||||
Data, 'createWebsite')
|
||||
return proc.render()
|
||||
@@ -137,6 +146,113 @@ class WebsiteManager:
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def AddNewpluginAjax(self, userID=None, data=None):
|
||||
try:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
userobj = Administrator.objects.get(pk=userID)
|
||||
|
||||
config = data['config']
|
||||
Name = data['Name']
|
||||
# pluginname = data['pluginname']
|
||||
# logging.CyberCPLogFileWriter.writeToFile("config ....... %s"%config)
|
||||
# logging.CyberCPLogFileWriter.writeToFile(" Name ....... %s"%Name)
|
||||
|
||||
|
||||
addpl = wpplugins(Name=Name, config=json.dumps(config), owner=userobj)
|
||||
addpl.save()
|
||||
|
||||
data_ret = {'status': 1}
|
||||
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'AddNewpluginAjax': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def EidtPlugin(self,request=None, userID=None, pluginbID=None):
|
||||
Data ={}
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
pluginobj = wpplugins.objects.get(pk=pluginbID)
|
||||
lmo = json.loads(pluginobj.config)
|
||||
Data['Selectedplugins'] = lmo
|
||||
Data['pluginbID'] = pluginbID
|
||||
|
||||
|
||||
proc = httpProc(request, 'websiteFunctions/WPEidtPlugin.html',
|
||||
Data, 'createWebsite')
|
||||
return proc.render()
|
||||
|
||||
|
||||
def deletesPlgin(self, userID=None, data=None,):
|
||||
try:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
userobj = Administrator.objects.get(pk=userID)
|
||||
pluginname = data['pluginname']
|
||||
pluginbBucketID = data['pluginbBucketID']
|
||||
# logging.CyberCPLogFileWriter.writeToFile("pluginbID ....... %s" % pluginbBucketID)
|
||||
# logging.CyberCPLogFileWriter.writeToFile("pluginname ....... %s" % pluginname)
|
||||
|
||||
|
||||
|
||||
obj = wpplugins.objects.get(pk=pluginbBucketID, owner=userobj)
|
||||
ab = []
|
||||
ab = json.loads(obj.config)
|
||||
ab.remove(pluginname)
|
||||
obj.config = json.dumps(ab)
|
||||
obj.save()
|
||||
|
||||
data_ret = {'status': 1}
|
||||
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'deletesPlgin': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def Addplugineidt(self, userID=None, data=None,):
|
||||
try:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
userobj = Administrator.objects.get(pk=userID)
|
||||
pluginname = data['pluginname']
|
||||
pluginbBucketID = data['pluginbBucketID']
|
||||
|
||||
#logging.CyberCPLogFileWriter.writeToFile("pluginbID ....... %s" % pluginbBucketID)
|
||||
#logging.CyberCPLogFileWriter.writeToFile("pluginname ....... %s" % pluginname)
|
||||
|
||||
pObj = wpplugins.objects.get(pk=pluginbBucketID, owner=userobj)
|
||||
listofplugin = json.loads(pObj.config)
|
||||
try:
|
||||
index = listofplugin.index(pluginname)
|
||||
print('index.....%s' % index)
|
||||
if (index >= 0):
|
||||
data_ret = {'status': 0, 'deletesPlgin': 0, 'error_message': str('Already Save in your Plugin lis')}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except:
|
||||
ab = []
|
||||
ab = json.loads(pObj.config)
|
||||
ab.append(pluginname)
|
||||
pObj.config = json.dumps(ab)
|
||||
pObj.save()
|
||||
|
||||
|
||||
data_ret = {'status': 1}
|
||||
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
except BaseException as msg:
|
||||
data_ret = {'status': 0, 'deletesPlgin': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def modifyWebsite(self, request=None, userID=None, data=None):
|
||||
|
||||
Reference in New Issue
Block a user