From 2463d8674feb5ca9d24dc87bbef0334851619dda Mon Sep 17 00:00:00 2001 From: usmannasir Date: Thu, 3 Apr 2025 16:23:53 +0500 Subject: [PATCH] improved wp display --- .../websiteFunctions/websiteFunctions.js | 55 +++++++++++++++++- .../websiteFunctions/listWebsites.html | 58 ++++++++++++++----- 2 files changed, 98 insertions(+), 15 deletions(-) diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index 1447bb10c..082cd5f03 100755 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -2641,8 +2641,59 @@ app.controller('listWebsites', function ($scope, $http) { $scope.recordsToShow = 10; $scope.showWPSites = function(index) { - // Toggle the showWPSites flag for the clicked website - $scope.WebSitesList[index].showWPSites = !$scope.WebSitesList[index].showWPSites; + // If details are already loaded, just toggle visibility + if ($scope.WebSitesList[index].wp_sites) { + $scope.WebSitesList[index].showWPSites = !$scope.WebSitesList[index].showWPSites; + return; + } + + // Otherwise fetch the details + var url = "/websites/fetchWPDetails"; + var data = {domain: $scope.WebSitesList[index].domain}; + + $http({ + method: 'POST', + url: url, + data: data, + }).then(function(response) { + if (response.data.status === 1) { + $scope.WebSitesList[index].wp_sites = response.data.data; + $scope.WebSitesList[index].showWPSites = true; + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + }, function(response) { + new PNotify({ + title: 'Operation Failed!', + text: 'Could not connect to server, please refresh this page.', + type: 'error' + }); + }); + }; + + $scope.wpLogin = function(wpID) { + var url = "/websites/wpLogin"; + var data = {wpID: wpID}; + + $http({ + method: 'POST', + url: url, + data: data, + }).then(function(response) { + if (response.data.status === 1) { + window.open(response.data.loginURL, '_blank'); + } else { + new PNotify({ + title: 'Operation Failed!', + text: response.data.error_message, + type: 'error' + }); + } + }); }; $scope.getFurtherWebsitesFromDB = function () { diff --git a/websiteFunctions/templates/websiteFunctions/listWebsites.html b/websiteFunctions/templates/websiteFunctions/listWebsites.html index 8809a28f3..b1add22b8 100755 --- a/websiteFunctions/templates/websiteFunctions/listWebsites.html +++ b/websiteFunctions/templates/websiteFunctions/listWebsites.html @@ -111,22 +111,54 @@
-
-

WordPress Sites

-
+
+
-
-
{$ wp.title $}
- {$ wp.url $} + -
-
Version: {$ wp.version || 'Unknown' $}
-
PHP: {$ wp.phpVersion || 'Unknown' $}
+
+ +
+
+
+ + {$ wp.version || 'Unknown' $} +
+
+ + {$ wp.phpVersion || 'Unknown' $} +
+
+ + {$ wp.theme || 'Unknown' $} +
+
+ + {$ wp.activePlugins || '0' $} active +
- + +
+
+
+ + {$ wp.searchEngineIndexing ? 'Enabled' : 'Disabled' $} +
+
+ + {$ wp.maintenanceMode ? 'Enabled' : 'Disabled' $} +