mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-14 17:26:17 +01:00
additional setting for improved wp page
This commit is contained in:
@@ -87,18 +87,33 @@
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
|
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-site-card:hover {
|
||||||
|
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.wp-site-header {
|
.wp-site-header {
|
||||||
padding: 15px;
|
padding: 15px 20px;
|
||||||
border-bottom: 1px solid #f0f0f0;
|
border-bottom: 1px solid #f0f0f0;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
background: #f8f9fa;
|
||||||
|
border-radius: 8px 8px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-site-header a {
|
||||||
|
color: #2196F3;
|
||||||
|
text-decoration: none;
|
||||||
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wp-site-content {
|
.wp-site-content {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
|
display: flex;
|
||||||
|
gap: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wp-site-preview {
|
.wp-site-preview {
|
||||||
@@ -107,34 +122,45 @@
|
|||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
border: 1px solid #e0e0e0;
|
border: 1px solid #e0e0e0;
|
||||||
float: left;
|
|
||||||
margin-right: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.wp-site-info {
|
.wp-site-info {
|
||||||
margin-left: 220px;
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wp-site-info h3 {
|
||||||
|
margin: 0 0 20px 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-section {
|
.status-section {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||||
gap: 20px;
|
gap: 15px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tools-section {
|
.tools-section {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(2, 1fr);
|
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
||||||
gap: 20px;
|
gap: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-item, .tool-item {
|
.status-item, .tool-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 8px;
|
padding: 10px 15px;
|
||||||
background: #f8f9fa;
|
background: #f8f9fa;
|
||||||
border-radius: 4px;
|
border-radius: 6px;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-item span:first-child, .tool-item span:first-child {
|
||||||
|
font-weight: 500;
|
||||||
|
color: #555;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toggle-switch {
|
.toggle-switch {
|
||||||
@@ -188,39 +214,62 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.btn-tool {
|
.btn-tool {
|
||||||
padding: 5px 10px;
|
padding: 6px 12px;
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background: white;
|
background: white;
|
||||||
color: #333;
|
color: #333;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-size: 12px;
|
font-size: 13px;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
transition: all 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-tool:hover {
|
.btn-tool:hover {
|
||||||
background: #f8f9fa;
|
background: #f0f0f0;
|
||||||
|
border-color: #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
.warning-badge {
|
.btn-tool i {
|
||||||
background: #ffc107;
|
font-size: 14px;
|
||||||
color: #000;
|
}
|
||||||
padding: 2px 8px;
|
|
||||||
|
.badge {
|
||||||
|
padding: 4px 8px;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-primary {
|
||||||
|
background-color: #2196F3;
|
||||||
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.top-actions {
|
.top-actions {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 30px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
padding: 20px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-box {
|
.search-box {
|
||||||
padding: 8px;
|
padding: 8px 15px;
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
width: 300px;
|
width: 300px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-selector {
|
||||||
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@@ -247,7 +296,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 onclick="DeleteWPNow('{% url 'ListWPSites' %}', '{{ site.id }}')" class="btn-tool">
|
<button onclick="DeleteWPNow('{% url 'ListWPSites' %}?DeleteID={{ site.id }}')" class="btn-tool">
|
||||||
<i class="fas fa-trash"></i> Delete
|
<i class="fas fa-trash"></i> Delete
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -319,22 +368,66 @@
|
|||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
// Function to fetch and update site data
|
// Function to fetch and update site data
|
||||||
function updateSiteData(siteId) {
|
function updateSiteData(siteId) {
|
||||||
fetch(`/FetchWPdata?WPid=${siteId}`)
|
fetch('/websiteFunctions/FetchWPdata', {
|
||||||
.then(response => response.json())
|
method: 'POST',
|
||||||
.then(data => {
|
headers: {
|
||||||
if (data.status === 1) {
|
'Content-Type': 'application/json',
|
||||||
const site = data.ret_data;
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
WPid: siteId
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.status === 1) {
|
||||||
|
const site = data.ret_data;
|
||||||
|
|
||||||
// Update version
|
// Update version info
|
||||||
document.querySelector(`.wp-version[data-site-id="${siteId}"]`).textContent = site.version;
|
document.querySelector(`.wp-version[data-site-id="${siteId}"]`).textContent =
|
||||||
|
site.version || 'Unknown';
|
||||||
|
document.querySelector(`.plugin-status[data-site-id="${siteId}"]`).textContent =
|
||||||
|
`${site.activePlugins || 0} active`;
|
||||||
|
document.querySelector(`.theme-status[data-site-id="${siteId}"]`).textContent =
|
||||||
|
`${site.activeTheme || 'Unknown'}`;
|
||||||
|
document.querySelector(`.php-version[data-site-id="${siteId}"]`).textContent =
|
||||||
|
site.phpVersion || 'Unknown';
|
||||||
|
|
||||||
// Update toggles
|
// Update toggles
|
||||||
document.querySelector(`.search-indexing[data-site-id="${siteId}"]`).checked = site.searchIndex === 1;
|
document.querySelector(`.search-indexing[data-site-id="${siteId}"]`).checked =
|
||||||
document.querySelector(`.debugging[data-site-id="${siteId}"]`).checked = site.debugging === 1;
|
site.searchIndex === 1;
|
||||||
document.querySelector(`.password-protection[data-site-id="${siteId}"]`).checked = site.passwordprotection === 1;
|
document.querySelector(`.debugging[data-site-id="${siteId}"]`).checked =
|
||||||
document.querySelector(`.maintenance-mode[data-site-id="${siteId}"]`).checked = site.maintenanceMode === 1;
|
site.debugging === 1;
|
||||||
|
document.querySelector(`.password-protection[data-site-id="${siteId}"]`).checked =
|
||||||
|
site.passwordprotection === 1;
|
||||||
|
document.querySelector(`.maintenance-mode[data-site-id="${siteId}"]`).checked =
|
||||||
|
site.maintenanceMode === 1;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error fetching site data:', error);
|
||||||
|
document.querySelectorAll(`[data-site-id="${siteId}"]`).forEach(el => {
|
||||||
|
if (el.tagName !== 'INPUT') {
|
||||||
|
el.textContent = 'Error loading';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get CSRF token from cookies
|
||||||
|
function getCookie(name) {
|
||||||
|
let cookieValue = null;
|
||||||
|
if (document.cookie && document.cookie !== '') {
|
||||||
|
const cookies = document.cookie.split(';');
|
||||||
|
for (let i = 0; i < cookies.length; i++) {
|
||||||
|
const cookie = cookies[i].trim();
|
||||||
|
if (cookie.substring(0, name.length + 1) === (name + '=')) {
|
||||||
|
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cookieValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update data for all sites
|
// Update data for all sites
|
||||||
@@ -350,17 +443,30 @@
|
|||||||
const setting = this.className;
|
const setting = this.className;
|
||||||
const value = this.checked ? 1 : 0;
|
const value = this.checked ? 1 : 0;
|
||||||
|
|
||||||
// Send update to server (you'll need to implement these endpoints)
|
fetch('/websiteFunctions/UpdateWPSettings', {
|
||||||
fetch(`/UpdateWPSettings`, {
|
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
siteId: siteId,
|
siteId: siteId,
|
||||||
setting: setting,
|
setting: setting,
|
||||||
value: value
|
value: value
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
if (!data.status) {
|
||||||
|
// Revert toggle if update failed
|
||||||
|
this.checked = !this.checked;
|
||||||
|
alert('Failed to update setting: ' + (data.error || 'Unknown error'));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error updating setting:', error);
|
||||||
|
this.checked = !this.checked;
|
||||||
|
alert('Failed to update setting. Please try again.');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user