additional setting for improved wp page

This commit is contained in:
usmannasir
2025-04-01 15:25:17 +05:00
parent 0385786716
commit e0a218ae76
2 changed files with 29 additions and 7 deletions

View File

@@ -304,13 +304,24 @@
</style> </style>
<div ng-controller="listWebsites" class="container"> <div class="container">
{% if debug_info %}
<div class="alert alert-info">
<h4>Debug Information</h4>
<p>Total WordPress Sites: {{ total_sites }}</p>
<p>User ID: {{ debug_info.user_id }}</p>
<p>Is Admin: {{ debug_info.is_admin }}</p>
<p>WP Sites Count: {{ debug_info.wp_sites_count }}</p>
</div>
{% endif %}
{% if not wpsite %} {% if not wpsite %}
<div class="alert alert-info"> <div class="alert alert-info">
No WordPress sites found. <a href="{% url 'createWordpress' %}" class="alert-link">Install WordPress</a> to get started. No WordPress sites found. <a href="{% url 'createWordpress' %}" class="alert-link">Install WordPress</a> to get started.
</div> </div>
{% endif %} {% endif %}
{% if wpsite %}
<div class="top-actions"> <div class="top-actions">
<h2>WordPress Toolkit {% if help_url %}<a href="{{ help_url }}" class="btn-tool">Help</a>{% endif %}</h2> <h2>WordPress Toolkit {% if help_url %}<a href="{{ help_url }}" class="btn-tool">Help</a>{% endif %}</h2>
<div> <div>
@@ -331,7 +342,7 @@
<a href="{% url 'WPHome' %}?ID={{ site.id }}" class="btn-tool"> <a href="{% url 'WPHome' %}?ID={{ site.id }}" class="btn-tool">
<i class="fas fa-cog"></i> Manage <i class="fas fa-cog"></i> Manage
</a> </a>
<button type="button" class="btn-tool" onclick="DeleteWPNow('{% url 'ListWPSites' %}?DeleteID={{ site.id }}')"> <button type="button" class="btn-tool" onclick="DeleteWPNow('{% url "ListWPSites" %}', '{{ site.id }}')">
<i class="fas fa-trash"></i> Delete <i class="fas fa-trash"></i> Delete
</button> </button>
</div> </div>
@@ -593,9 +604,9 @@
} }
}); });
function DeleteWPNow(url) { function DeleteWPNow(baseUrl, siteId) {
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 = url; window.location.href = baseUrl + '?DeleteID=' + siteId;
} }
} }
</script> </script>

View File

@@ -142,7 +142,8 @@ class WebsiteManager:
admin = Administrator.objects.get(pk=userID) admin = Administrator.objects.get(pk=userID)
data = {} data = {}
data['wp'] = ACLManager.GetALLWPObjects(currentACL, userID) wp_sites = ACLManager.GetALLWPObjects(currentACL, userID)
data['wp'] = wp_sites
try: try:
if DeleteID != None: if DeleteID != None:
@@ -164,8 +165,18 @@ class WebsiteManager:
'production_status': True # You can modify this based on your needs 'production_status': True # You can modify this based on your needs
}) })
proc = httpProc(request, 'websiteFunctions/WPsitesList.html', context = {
{"wpsite": sites}) "wpsite": sites,
"status": 1,
"total_sites": len(sites),
"debug_info": {
"user_id": userID,
"is_admin": currentACL.get('admin', 0),
"wp_sites_count": wp_sites.count()
}
}
proc = httpProc(request, 'websiteFunctions/WPsitesList.html', context)
return proc.render() return proc.render()
def WPHome(self, request=None, userID=None, WPid=None, DeleteID=None): def WPHome(self, request=None, userID=None, WPid=None, DeleteID=None):