feat: cpanel module display options - toggle each section (#130)
Added module params to show/hide individual sections: - Collapsed by default (toggle) - Health status - Stats cards (articles, users, updates) - Disk usage bar - Current IP display - Feature plugin badges - Quick action buttons - Joomla/PHP versions Each section respects its toggle. Plugin badges link to config pages. Authored-by: Moko Consulting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,8 +5,22 @@
|
||||
MOD_MOKOWAAS_CPANEL="MokoWaaS"
|
||||
MOD_MOKOWAAS_CPANEL_DESC="Displays MokoWaaS feature plugin status and site health on the admin dashboard."
|
||||
|
||||
MOD_MOKOWAAS_CPANEL_SHOW_HEALTH_LABEL="Show Health Status"
|
||||
MOD_MOKOWAAS_CPANEL_SHOW_PLUGINS_LABEL="Show Feature Plugins"
|
||||
MOD_MOKOWAAS_CPANEL_FIELDSET_DISPLAY="Display Options"
|
||||
MOD_MOKOWAAS_CPANEL_FIELDSET_DISPLAY_DESC="Choose which sections to show in the module."
|
||||
|
||||
MOD_MOKOWAAS_CPANEL_COLLAPSED_LABEL="Collapsed by Default"
|
||||
MOD_MOKOWAAS_CPANEL_COLLAPSED_DESC="Start the module body collapsed. Click the header to expand."
|
||||
MOD_MOKOWAAS_CPANEL_SHOW_HEALTH_LABEL="Health Status"
|
||||
MOD_MOKOWAAS_CPANEL_SHOW_STATS_LABEL="Stats Cards"
|
||||
MOD_MOKOWAAS_CPANEL_SHOW_STATS_DESC="Article count, user count, and pending updates."
|
||||
MOD_MOKOWAAS_CPANEL_SHOW_DISK_LABEL="Disk Usage"
|
||||
MOD_MOKOWAAS_CPANEL_SHOW_IP_LABEL="Current IP"
|
||||
MOD_MOKOWAAS_CPANEL_SHOW_PLUGINS_LABEL="Feature Plugins"
|
||||
MOD_MOKOWAAS_CPANEL_SHOW_ACTIONS_LABEL="Quick Actions"
|
||||
MOD_MOKOWAAS_CPANEL_SHOW_ACTIONS_DESC="Clear cache, check updates buttons."
|
||||
MOD_MOKOWAAS_CPANEL_SHOW_VERSIONS_LABEL="Joomla/PHP Versions"
|
||||
MOD_MOKOWAAS_CPANEL_SHOW_VERSIONS_DESC="Show Joomla and PHP version numbers."
|
||||
|
||||
MOD_MOKOWAAS_CPANEL_OPEN_DASHBOARD="Control Panel"
|
||||
MOD_MOKOWAAS_CPANEL_DEBUG="Debug ON"
|
||||
MOD_MOKOWAAS_CPANEL_OFFLINE="Offline"
|
||||
|
||||
@@ -24,19 +24,69 @@
|
||||
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<fieldset name="basic"
|
||||
label="MOD_MOKOWAAS_CPANEL_FIELDSET_DISPLAY"
|
||||
description="MOD_MOKOWAAS_CPANEL_FIELDSET_DISPLAY_DESC">
|
||||
|
||||
<field name="collapsed" type="radio" default="1"
|
||||
label="MOD_MOKOWAAS_CPANEL_COLLAPSED_LABEL"
|
||||
description="MOD_MOKOWAAS_CPANEL_COLLAPSED_DESC"
|
||||
layout="joomla.form.field.radio.switcher">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
|
||||
<field name="show_health" type="radio" default="1"
|
||||
label="MOD_MOKOWAAS_CPANEL_SHOW_HEALTH_LABEL"
|
||||
layout="joomla.form.field.radio.switcher">
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_stats" type="radio" default="1"
|
||||
label="MOD_MOKOWAAS_CPANEL_SHOW_STATS_LABEL"
|
||||
description="MOD_MOKOWAAS_CPANEL_SHOW_STATS_DESC"
|
||||
layout="joomla.form.field.radio.switcher">
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_disk" type="radio" default="1"
|
||||
label="MOD_MOKOWAAS_CPANEL_SHOW_DISK_LABEL"
|
||||
layout="joomla.form.field.radio.switcher">
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_ip" type="radio" default="1"
|
||||
label="MOD_MOKOWAAS_CPANEL_SHOW_IP_LABEL"
|
||||
layout="joomla.form.field.radio.switcher">
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_plugins" type="radio" default="1"
|
||||
label="MOD_MOKOWAAS_CPANEL_SHOW_PLUGINS_LABEL"
|
||||
layout="joomla.form.field.radio.switcher">
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_actions" type="radio" default="1"
|
||||
label="MOD_MOKOWAAS_CPANEL_SHOW_ACTIONS_LABEL"
|
||||
description="MOD_MOKOWAAS_CPANEL_SHOW_ACTIONS_DESC"
|
||||
layout="joomla.form.field.radio.switcher">
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
|
||||
<field name="show_versions" type="radio" default="1"
|
||||
label="MOD_MOKOWAAS_CPANEL_SHOW_VERSIONS_LABEL"
|
||||
description="MOD_MOKOWAAS_CPANEL_SHOW_VERSIONS_DESC"
|
||||
layout="joomla.form.field.radio.switcher">
|
||||
<option value="0">JHIDE</option>
|
||||
<option value="1">JSHOW</option>
|
||||
</field>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
|
||||
@@ -19,9 +19,15 @@ $healthOk = $healthOk ?? true;
|
||||
$counts = $counts ?? (object) ['articles' => 0, 'users' => 0, 'extensions' => 0, 'updates' => 0];
|
||||
$disk = $disk ?? (object) ['free_mb' => null, 'total_mb' => null];
|
||||
$currentIp = $currentIp ?? '';
|
||||
$showHealth = $params->get('show_health', 1);
|
||||
$showPlugins = $params->get('show_plugins', 1);
|
||||
$token = Session::getFormToken();
|
||||
$collapsed = $params->get('collapsed', 1);
|
||||
$showHealth = $params->get('show_health', 1);
|
||||
$showStats = $params->get('show_stats', 1);
|
||||
$showDisk = $params->get('show_disk', 1);
|
||||
$showIp = $params->get('show_ip', 1);
|
||||
$showPlugins = $params->get('show_plugins', 1);
|
||||
$showActions = $params->get('show_actions', 1);
|
||||
$showVersions = $params->get('show_versions', 1);
|
||||
$token = Session::getFormToken();
|
||||
|
||||
$enabledCount = 0;
|
||||
$totalCount = count($plugins);
|
||||
@@ -51,7 +57,7 @@ $diskColor = ($diskPct !== null && $diskPct > 90) ? 'bg-danger' : (($diskPct !==
|
||||
<div class="mod-mokowaas-cpanel p-3">
|
||||
<!-- Header row (always visible, acts as collapse toggle) -->
|
||||
<div class="d-flex align-items-center justify-content-between">
|
||||
<a class="d-flex align-items-center gap-2 text-decoration-none text-reset" data-bs-toggle="collapse" href="#mokowaas-cpanel-body" role="button" aria-expanded="false" aria-controls="mokowaas-cpanel-body">
|
||||
<a class="d-flex align-items-center gap-2 text-decoration-none text-reset" data-bs-toggle="collapse" href="#mokowaas-cpanel-body" role="button" aria-expanded="<?php echo $collapsed ? 'false' : 'true'; ?>" aria-controls="mokowaas-cpanel-body">
|
||||
<span class="icon-shield-alt" aria-hidden="true" style="font-size:1.25rem;color:#1a2744"></span>
|
||||
<strong>MokoWaaS</strong>
|
||||
<span class="badge bg-primary"><?php echo htmlspecialchars($siteInfo->mokowaas_version ?? ''); ?></span>
|
||||
@@ -69,10 +75,10 @@ $diskColor = ($diskPct !== null && $diskPct > 90) ? 'bg-danger' : (($diskPct !==
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Collapsible body (collapsed by default) -->
|
||||
<div class="collapse mt-3" id="mokowaas-cpanel-body">
|
||||
<!-- Collapsible body -->
|
||||
<div class="collapse<?php echo $collapsed ? '' : ' show'; ?> mt-3" id="mokowaas-cpanel-body">
|
||||
|
||||
<?php if ($showHealth): ?>
|
||||
<?php if ($showHealth && $showStats): ?>
|
||||
<!-- Health + stats row -->
|
||||
<div class="row g-2 mb-3">
|
||||
<div class="col-6 col-md-3">
|
||||
@@ -111,9 +117,9 @@ $diskColor = ($diskPct !== null && $diskPct > 90) ? 'bg-danger' : (($diskPct !==
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Disk + IP row -->
|
||||
<!-- Disk + IP + Versions row -->
|
||||
<div class="d-flex flex-wrap align-items-center gap-3 mb-3 small text-muted">
|
||||
<?php if ($diskPct !== null): ?>
|
||||
<?php if ($showDisk && $diskPct !== null): ?>
|
||||
<div class="d-flex align-items-center gap-1">
|
||||
<span class="icon-hdd" aria-hidden="true"></span>
|
||||
<span>Disk <?php echo $diskPct; ?>%</span>
|
||||
@@ -123,15 +129,17 @@ $diskColor = ($diskPct !== null && $diskPct > 90) ? 'bg-danger' : (($diskPct !==
|
||||
<span><?php echo number_format(($disk->free_mb ?? 0) / 1024, 1); ?> GB free</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($currentIp): ?>
|
||||
<?php if ($showIp && $currentIp): ?>
|
||||
<div>
|
||||
<span class="icon-globe" aria-hidden="true"></span>
|
||||
Your IP: <code><?php echo htmlspecialchars($currentIp); ?></code>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($showVersions): ?>
|
||||
<div class="ms-auto">
|
||||
Joomla <?php echo htmlspecialchars($siteInfo->joomla_version ?? ''); ?> / PHP <?php echo htmlspecialchars($siteInfo->php_version ?? ''); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -156,6 +164,7 @@ $diskColor = ($diskPct !== null && $diskPct > 90) ? 'bg-danger' : (($diskPct !==
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($showActions): ?>
|
||||
<!-- Quick action buttons -->
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<button type="button" class="btn btn-sm btn-outline-secondary" id="mokowaas-cpanel-cache"
|
||||
@@ -172,6 +181,7 @@ $diskColor = ($diskPct !== null && $diskPct > 90) ? 'bg-danger' : (($diskPct !==
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div><!-- /.collapse -->
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user