mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-10 15:26:13 +01:00
maintenanceMod fix
This commit is contained in:
@@ -568,9 +568,60 @@ app.controller('listWebsites', function ($scope, $http, $window) {
|
|||||||
|
|
||||||
$scope.deleteWPSite = function(wp) {
|
$scope.deleteWPSite = function(wp) {
|
||||||
if (confirm('Are you sure you want to delete this WordPress site? This action cannot be undone.')) {
|
if (confirm('Are you sure you want to delete this WordPress site? This action cannot be undone.')) {
|
||||||
window.location.href = '/websites/ListWPSites?DeleteID=' + wp.id;
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
var data = {
|
||||||
|
wpid: wp.id,
|
||||||
|
domain: wp.domain
|
||||||
|
};
|
||||||
|
|
||||||
|
$http.post('/websites/deleteWordPressSite', data, config).then(
|
||||||
|
function(response) {
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
// Remove the WP site from the list
|
||||||
|
var site = $scope.WebSitesList.find(function(site) {
|
||||||
|
return site.domain === wp.domain;
|
||||||
|
});
|
||||||
|
if (site && site.wp_sites) {
|
||||||
|
site.wp_sites = site.wp_sites.filter(function(wpSite) {
|
||||||
|
return wpSite.id !== wp.id;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success!',
|
||||||
|
text: 'WordPress site deleted successfully.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Error!',
|
||||||
|
text: response.data.error_message || 'Could not delete WordPress site',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(response) {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Error!',
|
||||||
|
text: 'Could not connect to server',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.visitSite = function(wp) {
|
||||||
|
var url = wp.url || wp.domain;
|
||||||
|
if (!url) return '';
|
||||||
|
if (url.startsWith('http://') || url.startsWith('https://')) {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
return 'https://' + url;
|
||||||
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -173,7 +173,7 @@
|
|||||||
style="max-width: 100%; margin-bottom: 10px; min-height: 150px; background: #f5f5f5;"
|
style="max-width: 100%; margin-bottom: 10px; min-height: 150px; background: #f5f5f5;"
|
||||||
onerror="this.onerror=null; this.src='https://s.wordpress.org/style/images/about/WordPress-logotype-standard.png';">
|
onerror="this.onerror=null; this.src='https://s.wordpress.org/style/images/about/WordPress-logotype-standard.png';">
|
||||||
<div class="text-center wp-action-buttons">
|
<div class="text-center wp-action-buttons">
|
||||||
<a ng-href="{$ getFullUrl(wp.url) $}" target="_blank" class="btn btn-outline-secondary btn-sm wp-action-btn">
|
<a ng-href="{$ visitSite(wp) $}" target="_blank" class="btn btn-outline-secondary btn-sm wp-action-btn">
|
||||||
<i class="fa-solid fa-external-link"></i> Visit Site
|
<i class="fa-solid fa-external-link"></i> Visit Site
|
||||||
</a>
|
</a>
|
||||||
<a href="{% url 'AutoLogin' %}?id={$ wp.id $}" target="_blank" class="btn btn-outline-primary btn-sm wp-action-btn">
|
<a href="{% url 'AutoLogin' %}?id={$ wp.id $}" target="_blank" class="btn btn-outline-primary btn-sm wp-action-btn">
|
||||||
|
|||||||
Reference in New Issue
Block a user