Cyberpanel_Haabi

This commit is contained in:
Ghassan
2023-03-10 22:35:34 +05:00
parent 696709c9e0
commit f21f59031a
6 changed files with 200 additions and 0 deletions

View File

@@ -172,6 +172,63 @@ app.controller('createIncrementalBackups', function ($scope, $http, $timeout) {
};
// $scope.RestoreV2Backup = function () {
//
// // $scope.status = '';
// //
// // $scope.cyberpanelLoading = false;
// //
// //
// // url = "/IncrementalBackups/submitBackupCreation";
//
//
// console.log($scope.websiteToBeBacked)
// console.log($scope.websiteData)
// var websites = document.getElementById('create-backup-select');
// var selected_website = websites.options[websites.selectedIndex].innerHTML;
// console.log(selected_website);
//
// var data = {
// websiteToBeBacked: $scope.websiteToBeBacked,
// backupDestinations: $scope.backupDestinations,
// websiteData: $scope.websiteData,
// websiteEmails: $scope.websiteEmails,
// websiteSSLs: $scope.websiteSSLs,
// websiteDatabases: $scope.websiteDatabases
//
// };
//
// // var config = {
// // headers: {
// // 'X-CSRFToken': getCookie('csrftoken')
// // }
// // };
// //
// //
// // $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
// //
// //
// // function ListInitialDatas(response) {
// //
// // if (response.data.status === 1) {
// // $scope.tempPath = response.data.tempPath;
// // getBackupStatus();
// // } else {
// // $scope.cyberpanelLoading = true;
// // new PNotify({
// // title: 'Operation Failed!',
// // text: response.data.error_message,
// // type: 'error'
// // });
// // }
// //
// // }
// //
// // function cantLoadInitialDatas(response) {
// // }
//
// };
$scope.deleteBackup = function (id) {
@@ -1143,7 +1200,19 @@ app.controller('restoreRemoteBackupsInc', function ($scope, $http, $timeout) {
});
function RestoreV2Backup() {
var websites = document.getElementById('create-backup-select');
var selected_website = websites.options[websites.selectedIndex].innerHTML;
console.log(selected_website);
url = "/IncrementalBackups/submitBackupCreation";
data = {
website:selected_website,
}
}
app.controller('createV2Backups', function ($scope, $http, $timeout){
$scope.cyberpanelLoading = true;
$scope.selectbackuptype = function () {

View File

@@ -0,0 +1,113 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "Backup Website" %}{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<div class="container">
<div id="page-title">
<h2>{% trans "Restore V2 Backup Site" %} - <a target="_blank" href="http://go.cyberpanel.net/backup" style="height: 23px;line-height: 21px;" class="btn btn-border btn-alt border-red btn-link font-red" title=""><span>{% trans "Backup Docs" %}</span></a></h2>
<p>{% trans "This page can be used to restore your backup sites" %}</p>
</div>
<div ng-controller="backupWebsiteControl" class="panel">
<div class="panel-body">
<h3 class="title-hero">
{% trans "Restore V2 Backup Site" %} <img ng-hide="backupLoading" src="{% static 'images/loading.gif' %}">
</h3>
<div class="example-box-wrapper">
<form action="/IncBackups/static" class="form-horizontal bordered-row">
<div class="form-group">
<label class="col-sm-3 control-label">{% trans "Select Website" %} </label>
<div class="col-sm-6">
<select id="create-backup-select" ng-model="websiteToBeBacked" class="form-control">
{% for items in websiteList %}
<option value="{{ items }}">{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
{# <div class="form-group destinationHide">#}
{# <label class="col-sm-3 control-label">{% trans "Destination" %}</label>#}
{# <div class="col-sm-6">#}
{# <select ng-change="destinationSelection()" ng-model="backupDestinations" class="form-control">#}
{# <option>{% trans "Home" %}</option>#}
{# </select>#}
{# </div>#}
{# </div>#}
<!---- if Backup is running ----->
{# <div ng-hide="runningBackup" class="form-group">#}
{##}
{# <div class="col-sm-12">#}
{##}
{# <table class="table">#}
{# <thead>#}
{# <tr>#}
{# <th></th>#}
{# <th>{% trans "File Name" %}</th>#}
{# <th>{% trans "Status" %} <img ng-hide="backupLoadingBottom" src="{% static 'images/loading.gif' %}"></th>#}
{# </tr>#}
{# </thead>#}
{# <tbody>#}
{# <tr>#}
{# <td>{% trans "Running" %}</td>#}
{# <td>{$ fileName $}</td>#}
{# <td style="color: red"><strong>{$ status $}</strong></td>#}
{# </tr>#}
{# </tbody>#}
{# </table>#}
{# </div>#}
{# </div>#}
<!---- if Backup is running------>
<div class="form-group destinationHide">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
<button type="button" onclick="RestoreV2Backup()" class="btn btn-primary btn-lg btn-block">{% trans "Create Backup" %}</button>
</div>
</div>
<div ng-hide="cancelButton" class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
<button type="button" ng-click="cancelBackup()" class="btn btn-primary btn-lg btn-block">{% trans "Cancel Backup" %}</button>
</div>
</div>
<!------ List of records --------------->
<!------ List of records --------------->
</form>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@@ -25,5 +25,6 @@ urlpatterns = [
### V2 Backups URls
url(r'^createV2Backup$', views.createV2Backup, name='createV2Backup'),
url(r'^createV2BackupSetup$', views.createV2BackupSetup, name='createV2BackupSetup'),
url(r'^RestoreV2backupSite$', views.RestoreV2backupSite, name='RestoreV2backupSite'),
]

View File

@@ -51,6 +51,14 @@ def _get_user_acl(request):
return user_id, current_acl
def RestoreV2backupSite(request):
try:
userID = request.session['userID']
bm = BackupManager()
return bm.RestoreV2backupSite(request, userID)
except KeyError:
return redirect(loadLoginPage)
def create_backup(request):
try:

View File

@@ -52,6 +52,12 @@ class BackupManager:
proc = httpProc(request, 'backup/backup.html', {'websiteList': websitesName}, 'createBackup')
return proc.render()
def RestoreV2backupSite(self, request=None, userID=None, data=None):
currentACL = ACLManager.loadedACL(userID)
websitesName = ACLManager.findAllSites(currentACL, userID)
proc = httpProc(request, 'IncBackups/RestoreV2Backup.html', {'websiteList': websitesName}, 'createBackup')
return proc.render()
def gDrive(self, request=None, userID=None, data=None):
currentACL = ACLManager.loadedACL(userID)
admin = Administrator.objects.get(pk=userID)

View File

@@ -727,6 +727,9 @@
<li><a href="{% url 'createV2Backup' %}"
title="{% trans "Create V2 Backup" %}"><span>{% trans "Create V2 Backup" %}</span></a>
</li>
<li><a href="{% url 'RestoreV2backupSite' %}"
title="{% trans "Restore V2 Backup" %}"><span>{% trans "Restore V2 Backup" %}</span></a>
</li>
</ul>