mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-01-06 15:42:06 +01:00
Initial commit for v2.4.3
This commit is contained in:
1
examplePlugin/__init__.py
Normal file
1
examplePlugin/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
default_app_config = 'examplePlugin.apps.ExamplepluginConfig'
|
||||
3
examplePlugin/admin.py
Normal file
3
examplePlugin/admin.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
8
examplePlugin/apps.py
Normal file
8
examplePlugin/apps.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class ExamplepluginConfig(AppConfig):
|
||||
name = 'examplePlugin'
|
||||
|
||||
def ready(self):
|
||||
from . import signals
|
||||
0
examplePlugin/enable_migrations
Normal file
0
examplePlugin/enable_migrations
Normal file
7
examplePlugin/meta.xml
Normal file
7
examplePlugin/meta.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<cyberpanelPluginConfig>
|
||||
<name>examplePlugin</name>
|
||||
<type>plugin</type>
|
||||
<description>This is an example plugin</description>
|
||||
<version>0</version>
|
||||
</cyberpanelPluginConfig>
|
||||
0
examplePlugin/migrations/__init__.py
Normal file
0
examplePlugin/migrations/__init__.py
Normal file
9
examplePlugin/models.py
Normal file
9
examplePlugin/models.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from django.db import models
|
||||
|
||||
|
||||
class ExamplePlugin(models.Model):
|
||||
name = models.CharField(unique=True, max_length=255)
|
||||
|
||||
class Meta:
|
||||
# db_table = "ExamplePlugin"
|
||||
pass
|
||||
4
examplePlugin/post_install
Normal file
4
examplePlugin/post_install
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
RESET = '\033[0;0m'
|
||||
BLUE = "\033[0;34m"
|
||||
print(BLUE + "Running Post-Install Script..." + RESET)
|
||||
4
examplePlugin/pre_install
Normal file
4
examplePlugin/pre_install
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
RESET = '\033[0;0m'
|
||||
GREEN = '\033[0;32m'
|
||||
print(GREEN + "Running Pre-Install Script..." + RESET)
|
||||
4
examplePlugin/pre_remove
Normal file
4
examplePlugin/pre_remove
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/usr/local/CyberCP/bin/python
|
||||
RESET = '\033[0;0m'
|
||||
GREEN = '\033[0;32m'
|
||||
print(GREEN + "Running Pre-Remove Script..." + RESET)
|
||||
17
examplePlugin/signals.py
Normal file
17
examplePlugin/signals.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from django.dispatch import receiver
|
||||
from django.http import HttpResponse
|
||||
from websiteFunctions.signals import postWebsiteDeletion
|
||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
|
||||
|
||||
# This plugin respond to an event after CyberPanel core finished deleting a website.
|
||||
# Original request object is passed, body can be accessed with request.body.
|
||||
|
||||
# If any Event handler returns a response object, CyberPanel will stop further processing and returns your response to browser.
|
||||
# To continue processing just return 200 from your events handlers.
|
||||
|
||||
@receiver(postWebsiteDeletion)
|
||||
def rcvr(sender, **kwargs):
|
||||
request = kwargs['request']
|
||||
logging.writeToFile('Hello World from Example Plugin.')
|
||||
return HttpResponse('Hello World from Example Plugin.')
|
||||
3
examplePlugin/static/examplePlugin/examplePlugin.js
Normal file
3
examplePlugin/static/examplePlugin/examplePlugin.js
Normal file
@@ -0,0 +1,3 @@
|
||||
$(document).ready(function () {
|
||||
console.log("using JS in static file...!");
|
||||
});
|
||||
52
examplePlugin/templates/examplePlugin/examplePlugin.html
Normal file
52
examplePlugin/templates/examplePlugin/examplePlugin.html
Normal file
@@ -0,0 +1,52 @@
|
||||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block styles %}
|
||||
<style>
|
||||
.exampleBody {
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block title %}Example plugin - CyberPanel{% endblock %}
|
||||
{% block content %}
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
<div class="container" id="examplePluginApp">
|
||||
|
||||
<div id="page-title">
|
||||
<h2 id="domainNamePage">{% trans "Example Plugin Page" %}</h2>
|
||||
<p>{% trans "Example Plugin Info" %}</p>
|
||||
</div>
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-heading container-fluid">
|
||||
<div class="col-xs-4"><h3 class="panel-title">{% trans "examplePlugin" %}</h3></div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="example-box-wrapper">
|
||||
<p class="exampleBody">[[ pluginBody ]]</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer_scripts %}
|
||||
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
|
||||
{# <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>#}
|
||||
<script src="{% static 'examplePlugin/examplePlugin.js' %}"></script>
|
||||
<script>
|
||||
let examplePluginApp = new Vue({
|
||||
delimiters: ['[[', ']]'],
|
||||
el: '#examplePluginApp',
|
||||
data: function () {
|
||||
return {
|
||||
pluginBody: "Example Plugin Body leveraging templated imported Vue.js",
|
||||
}
|
||||
},
|
||||
methods: {},
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
3
examplePlugin/tests.py
Normal file
3
examplePlugin/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
7
examplePlugin/urls.py
Normal file
7
examplePlugin/urls.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from django.urls import path
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.examplePlugin, name='examplePlugin'),
|
||||
]
|
||||
|
||||
7
examplePlugin/views.py
Normal file
7
examplePlugin/views.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from django.shortcuts import render, HttpResponse
|
||||
|
||||
|
||||
# Create your views here.
|
||||
|
||||
def examplePlugin(request):
|
||||
return render(request, 'examplePlugin/examplePlugin.html')
|
||||
Reference in New Issue
Block a user