Add cPanel chrome (sidebar/topbar) to plugin pages
Use $cpanel->header() and $cpanel->footer() from LiveAPI to wrap plugin content in cPanel's standard layout with sidebar navigation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -19,16 +19,19 @@ use Cpanel::AdminBin::Call ();
|
||||
use GnizaCPanel::UI;
|
||||
|
||||
my $cpanel = Cpanel::LiveAPI->new();
|
||||
print "Content-Type: text/html\r\n\r\n";
|
||||
print $cpanel->header('GNIZA Backups');
|
||||
|
||||
# Get allowed remotes via AdminBin
|
||||
my $remotes_raw = eval { Cpanel::AdminBin::Call::call('Gniza', 'Restore', 'LIST_ALLOWED_REMOTES') } // '';
|
||||
my @remotes = grep { $_ ne '' } split /\n/, $remotes_raw;
|
||||
|
||||
print GnizaCPanel::UI::page_header('gniza Restore');
|
||||
print GnizaCPanel::UI::page_header('GNIZA Backups');
|
||||
|
||||
if (!@remotes) {
|
||||
print qq{<div class="alert alert-info mb-4">No backup remotes are available for restore. Please contact your server administrator.</div>\n};
|
||||
print GnizaCPanel::UI::page_footer();
|
||||
print $cpanel->footer();
|
||||
$cpanel->end();
|
||||
exit;
|
||||
}
|
||||
@@ -105,4 +108,5 @@ for my $cat (@categories) {
|
||||
print qq{</div>\n};
|
||||
|
||||
print GnizaCPanel::UI::page_footer();
|
||||
print $cpanel->footer();
|
||||
$cpanel->end();
|
||||
|
||||
@@ -170,6 +170,7 @@ sub handle_step1 {
|
||||
}
|
||||
|
||||
print "Content-Type: text/html\r\n\r\n";
|
||||
print $cpanel->header('GNIZA Backups');
|
||||
print GnizaCPanel::UI::page_header('Restore: ' . ($TYPE_LABELS{$type} // $type));
|
||||
print GnizaCPanel::UI::render_flash();
|
||||
|
||||
@@ -181,6 +182,7 @@ sub handle_step1 {
|
||||
print qq{<div class="alert alert-info mb-4">No backup remotes are available. Please contact your server administrator.</div>\n};
|
||||
print qq{<a href="index.live.cgi" class="btn btn-info btn-sm">Back</a>\n};
|
||||
print GnizaCPanel::UI::page_footer();
|
||||
print $cpanel->footer();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -225,6 +227,7 @@ sub handle_step1 {
|
||||
_print_step1_js($esc_type, $next_step);
|
||||
|
||||
print GnizaCPanel::UI::page_footer();
|
||||
print $cpanel->footer();
|
||||
}
|
||||
|
||||
sub _print_step1_js {
|
||||
@@ -325,6 +328,7 @@ sub handle_step2 {
|
||||
}
|
||||
|
||||
print "Content-Type: text/html\r\n\r\n";
|
||||
print $cpanel->header('GNIZA Backups');
|
||||
print GnizaCPanel::UI::page_header('Restore: ' . ($TYPE_LABELS{$type} // $type));
|
||||
print GnizaCPanel::UI::render_flash();
|
||||
|
||||
@@ -371,6 +375,7 @@ sub handle_step2 {
|
||||
_print_step2_js($esc_type, $esc_remote, $esc_timestamp);
|
||||
|
||||
print GnizaCPanel::UI::page_footer();
|
||||
print $cpanel->footer();
|
||||
}
|
||||
|
||||
sub _render_file_picker {
|
||||
@@ -699,6 +704,7 @@ sub handle_step3 {
|
||||
}
|
||||
|
||||
print "Content-Type: text/html\r\n\r\n";
|
||||
print $cpanel->header('GNIZA Backups');
|
||||
print GnizaCPanel::UI::page_header('Restore: Confirm');
|
||||
print GnizaCPanel::UI::render_flash();
|
||||
|
||||
@@ -744,6 +750,7 @@ sub handle_step3 {
|
||||
print qq{</form>\n};
|
||||
|
||||
print GnizaCPanel::UI::page_footer();
|
||||
print $cpanel->footer();
|
||||
}
|
||||
|
||||
# ── Step 4: Execute ───────────────────────────────────────────
|
||||
@@ -765,6 +772,7 @@ sub handle_step4 {
|
||||
$type = 'account' unless exists $TYPE_LABELS{$type};
|
||||
|
||||
print "Content-Type: text/html\r\n\r\n";
|
||||
print $cpanel->header('GNIZA Backups');
|
||||
print GnizaCPanel::UI::page_header('Restore: Results');
|
||||
|
||||
my $type_label = GnizaCPanel::UI::esc($TYPE_LABELS{$type});
|
||||
@@ -792,6 +800,7 @@ sub handle_step4 {
|
||||
print qq{</div>\n</div>\n};
|
||||
print qq{<a href="index.live.cgi" class="btn btn-info btn-sm">Back to Categories</a>\n};
|
||||
print GnizaCPanel::UI::page_footer();
|
||||
print $cpanel->footer();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -827,6 +836,7 @@ sub handle_step4 {
|
||||
print qq{<a href="index.live.cgi" class="btn btn-info btn-sm">Back to Categories</a>\n};
|
||||
|
||||
print GnizaCPanel::UI::page_footer();
|
||||
print $cpanel->footer();
|
||||
}
|
||||
|
||||
sub _render_results {
|
||||
|
||||
Reference in New Issue
Block a user