[1/2] shutdown.cgi: Add "reboot with filesystem check" button

Message ID 2453D58E-29AD-46E9-8EA3-B186B31E3C2E@gmail.com
State Not Applicable
Headers show
Series [1/2] shutdown.cgi: Add "reboot with filesystem check" button | expand

Commit Message

Jon Murphy Oct. 4, 2021, 6:56 p.m. UTC
Leo,

I just saw this as part of CU 160 testing.  Is it possible/easy to go back to the rounded buttons (like the originals?)

I personally think those are a much nicer look.


Best regards,
Jon
(Self-proclaimed "king" of picky items!)


=======
[PATCH 1/2] shutdown.cgi: Add "reboot with filesystem check" button

Leo-Andres Hofmann hofmann at leo-andres.de  <mailto:development%40lists.ipfire.org?Subject=Re%3A%20%5BPATCH%201/2%5D%20shutdown.cgi%3A%20Add%20%22reboot%20with%20filesystem%20check%22%20button&In-Reply-To=%3C20210713190629.91-1-hofmann%40leo-andres.de%3E>
Tue Jul 13 19:06:28 UTC 2021

Previous message (by thread): [PATCH] firewalllog.dat: Proper display protocol names. <https://lists.ipfire.org/pipermail/development/2021-July/010833.html>
Next message (by thread): [PATCH 1/2] shutdown.cgi: Add "reboot with filesystem check" button <https://lists.ipfire.org/pipermail/development/2021-July/010802.html>
Messages sorted by: [ date ] <https://lists.ipfire.org/pipermail/development/2021-July/date.html#10792> [ thread ] <https://lists.ipfire.org/pipermail/development/2021-July/thread.html#10792> [ subject ] <https://lists.ipfire.org/pipermail/development/2021-July/subject.html#10792> [ author ] <https://lists.ipfire.org/pipermail/development/2021-July/author.html#10792>
ipfirereboot.c is able to force a file system check during reboot.
This patch makes this function available in the shutdown GUI.

Signed-off-by: Leo-Andres Hofmann <hofmann at leo-andres.de <https://lists.ipfire.org/mailman/listinfo/development>>
---
 html/cgi-bin/shutdown.cgi | 79 +++++++++++++++++++++++++++++----------
 langs/de/cgi-bin/de.pl    |  2 +
 langs/en/cgi-bin/en.pl    |  2 +
 3 files changed, 63 insertions(+), 20 deletions(-)

Comments

Leo-Andres Hofmann Oct. 5, 2021, 8:19 a.m. UTC | #1
Hi Jon,

At the moment, the buttons have no further styling, so they depend the default design of your browser. I have attached a screenshot from my Firefox.

I can add a CSS "border-radius", but then we should do this for all buttons in IPFire. I think most buttons could use a little padding too. What do you think?
(Actually, style.css contains a button design in line 203, but that doesn't seem to work anymore)

Regards,
Leo

Am 04.10.2021 um 20:56 schrieb Jon Murphy:
>
>
>   Leo,
>
> I just saw this as part of CU 160 testing.  Is it possible/easy to go back to the rounded buttons (like the originals?)
>
> I personally think those are a much nicer look.
>
>
> Best regards,
> Jon
> (Self-proclaimed "king" of picky items!)
>
>
> =======
>
>
>   [PATCH 1/2] shutdown.cgi: Add "reboot with filesystem check" button
>
> *Leo-Andres Hofmann*hofmann at leo-andres.de <mailto:development%40lists.ipfire.org?Subject=Re%3A%20%5BPATCH%201/2%5D%20shutdown.cgi%3A%20Add%20%22reboot%20with%20filesystem%20check%22%20button&In-Reply-To=%3C20210713190629.91-1-hofmann%40leo-andres.de%3E>
> /Tue Jul 13 19:06:28 UTC 2021/
>
>   * Previous message (by thread): [PATCH] firewalllog.dat: Proper display protocol names. <https://lists.ipfire.org/pipermail/development/2021-July/010833.html>
>   * Next message (by thread): [PATCH 1/2] shutdown.cgi: Add "reboot with filesystem check" button <https://lists.ipfire.org/pipermail/development/2021-July/010802.html>
>   * *Messages sorted by:* [ date ] <https://lists.ipfire.org/pipermail/development/2021-July/date.html#10792> [ thread ] <https://lists.ipfire.org/pipermail/development/2021-July/thread.html#10792> [ subject ] <https://lists.ipfire.org/pipermail/development/2021-July/subject.html#10792> [ author ] <https://lists.ipfire.org/pipermail/development/2021-July/author.html#10792>
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> ipfirereboot.c is able to force a file system check during reboot.
> This patch makes this function available in the shutdown GUI.
>
> Signed-off-by: Leo-Andres Hofmann <hofmann at leo-andres.de  <https://lists.ipfire.org/mailman/listinfo/development>>
> ---
>   html/cgi-bin/shutdown.cgi | 79 +++++++++++++++++++++++++++++----------
>   langs/de/cgi-bin/de.pl    |  2 +
>   langs/en/cgi-bin/en.pl    |  2 +
>   3 files changed, 63 insertions(+), 20 deletions(-)
>
> diff --git a/html/cgi-bin/shutdown.cgi b/html/cgi-bin/shutdown.cgi
> index e0a2c9da0..1321e158b 100644
> --- a/html/cgi-bin/shutdown.cgi
> +++ b/html/cgi-bin/shutdown.cgi
> @@ -1,11 +1,23 @@
>   #!/usr/bin/perl
> -#
> -# SmoothWall CGIs
> -#
> -# This code is distributed under the terms of the GPL
> -#
> -# (c) The SmoothWall Team
> -#
> +###############################################################################
> +#                                                                             #
> +#IPFire.org  <http://ipfire.org/>  - A linux based firewall                                         #
> +# Copyright (C) 2021  IPFire Development Team                                 #
> +#                                                                             #
> +# This program is free software: you can redistribute it and/or modify        #
> +# it under the terms of the GNU General Public License as published by        #
> +# the Free Software Foundation, either version 3 of the License, or           #
> +# (at your option) any later version.                                         #
> +#                                                                             #
> +# This program is distributed in the hope that it will be useful,             #
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
> +# GNU General Public License for more details.                                #
> +#                                                                             #
> +# You should have received a copy of the GNU General Public License           #
> +# along with this program.  If not, see <http://www.gnu.org/licenses/  <http://www.gnu.org/licenses/>>.       #
> +#                                                                             #
> +###############################################################################
>   
>   use strict;
>   
> @@ -17,6 +29,27 @@ require '/var/ipfire/general-functions.pl';
>   require "${General::swroot}/lang.pl";
>   require "${General::swroot}/header.pl";
>   
> +###--- HTML HEAD ---###
> +my $extraHead = <<END
> +<style>
> +	table#controls {
> +		width: 100%;
> +		border: none;
> +		table-layout: fixed;
> +	}
> +	#controls td {
> +		text-align: center;
> +	}
> +	#controls button {
> +		font-weight: bold;
> +		padding: 0.7em;
> +		min-width: 65%;
> +	}
> +</style>
> +END
> +;
> +###--- END HTML HEAD ---###
> +
>   my %cgiparams=();
>   my $death = 0;
>   my $rebirth = 0;
> @@ -26,33 +59,39 @@ my $rebirth = 0;
>   $cgiparams{'ACTION'} = '';
>   &Header::getcgihash(\%cgiparams);
>   
> -if ($cgiparams{'ACTION'} eq $Lang::tr{'shutdown'}) {
> +if ($cgiparams{'ACTION'} eq "SHUTDOWN") {
>   	$death = 1;
>   	&General::log($Lang::tr{'shutting down ipfire'});
>   	&General::system('/usr/local/bin/ipfirereboot', 'down');
> -} elsif ($cgiparams{'ACTION'} eq $Lang::tr{'reboot'}) {
> +} elsif ($cgiparams{'ACTION'} eq "REBOOT") {
>   	$rebirth = 1;
>   	&General::log($Lang::tr{'rebooting ipfire'});
>   	&General::system('/usr/local/bin/ipfirereboot', 'boot');
> +} elsif ($cgiparams{'ACTION'} eq "REBOOT_FSCK") {
> +	$rebirth = 1;
> +	&General::log($Lang::tr{'rebooting ipfire fsck'});
> +	&General::system('/usr/local/bin/ipfirereboot', 'bootfs');
>   }
> +
>   if ($death == 0 && $rebirth == 0) {
>   
> -	&Header::openpage($Lang::tr{'shutdown control'}, 1, '');
> +	&Header::openpage($Lang::tr{'shutdown control'}, 1, $extraHead);
>   
>   	&Header::openbigbox('100%', 'left');
> +	&Header::openbox('100%', 'left');
>   
> -	print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
> -
> -	&Header::openbox('100%', 'left', );
>   	print <<END
> -<table width='100%'>
> -<tr>
> -	<td width='50%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'reboot'}' /></td>
> -	<td width='50%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'shutdown'}' /></td>
> -</tr>
> -</table>
> +<form method="post" action="$ENV{'SCRIPT_NAME'}">
> +	<table id="controls">
> +	<tr>
> +		<td><button type="submit" name="ACTION" value="SHUTDOWN">$Lang::tr{'shutdown'}</button></td>
> +		<td><button type="submit" name="ACTION" value="REBOOT">$Lang::tr{'reboot'}</button></td>
> +		<td><button type="submit" name="ACTION" value="REBOOT_FSCK">$Lang::tr{'reboot fsck'}</button></td>
> +	</tr>
> +	</table>
> +</form>
>   END
> -	;
> +;
>   	&Header::closebox();
>   
>   } else {
> diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl
> index 0d2228ede..76bf0469d 100644
> --- a/langs/de/cgi-bin/de.pl
> +++ b/langs/de/cgi-bin/de.pl
> @@ -2085,11 +2085,13 @@
>   'real address' => 'Reale Addresse',
>   'reboot' => 'Neustart',
>   'reboot ask' => 'Neustart?',
> +'reboot fsck' => 'Neustart & Dateisystem-Test',
>   'reboot question' => 'Extra Abfrage bei neustart und herunterfahren einschalten',
>   'reboot schedule' => 'Zeitsteuerung für IPFire Neustarts',
>   'reboot sure' => 'Sind Sie sicher, dass Sie neustarten wollen?',
>   'rebooting' => 'Starte neu ...',
>   'rebooting ipfire' => 'Starte IPFire neu',
> +'rebooting ipfire fsck' => 'Starte IPFire neu, Dateisystem-Test erzwingen',
>   'received' => 'Empfangen',
>   'reconnect' => 'Neu Verbinden',
>   'reconnection' => 'Wiederverbindung',
> diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl
> index 2ba6961f3..181dc80b0 100644
> --- a/langs/en/cgi-bin/en.pl
> +++ b/langs/en/cgi-bin/en.pl
> @@ -2120,11 +2120,13 @@
>   'real address' => 'Real Address',
>   'reboot' => 'Reboot',
>   'reboot ask' => 'Reboot?',
> +'reboot fsck' => 'Reboot & check filesystem',
>   'reboot question' => 'Extra query for restart and shutdown',
>   'reboot schedule' => 'Schedule IPFire reboots',
>   'reboot sure' => 'Are you sure that you want to reboot?',
>   'rebooting' => 'Rebooting',
>   'rebooting ipfire' => 'Rebooting IPFire',
> +'rebooting ipfire fsck' => 'Rebooting IPFire, forcing filesystem check',
>   'received' => 'Received',
>   'reconnect' => 'Reconnect',
>   'reconnection' => 'Reconnection',
> -- 
> 2.27.0.windows.1
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>   * Previous message (by thread): [PATCH] firewalllog.dat: Proper display protocol names. <https://lists.ipfire.org/pipermail/development/2021-July/010833.html>
>   * Next message (by thread): [PATCH 1/2] shutdown.cgi: Add "reboot with filesystem check" button <https://lists.ipfire.org/pipermail/development/2021-July/010802.html>
>   * *Messages sorted by:* [ date ] <https://lists.ipfire.org/pipermail/development/2021-July/date.html#10792> [ thread ] <https://lists.ipfire.org/pipermail/development/2021-July/thread.html#10792> [ subject ] <https://lists.ipfire.org/pipermail/development/2021-July/subject.html#10792> [ author ] <https://lists.ipfire.org/pipermail/development/2021-July/author.html#10792>
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> More information about the Development mailing list <https://lists.ipfire.org/mailman/listinfo/development>

Patch

diff --git a/html/cgi-bin/shutdown.cgi b/html/cgi-bin/shutdown.cgi
index e0a2c9da0..1321e158b 100644
--- a/html/cgi-bin/shutdown.cgi
+++ b/html/cgi-bin/shutdown.cgi
@@ -1,11 +1,23 @@ 
 #!/usr/bin/perl
-#
-# SmoothWall CGIs
-#
-# This code is distributed under the terms of the GPL
-#
-# (c) The SmoothWall Team
-#
+###############################################################################
+#                                                                             #
+# IPFire.org <http://ipfire.org/> - A linux based firewall                                         #
+# Copyright (C) 2021  IPFire Development Team                                 #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/ <http://www.gnu.org/licenses/>>.       #
+#                                                                             #
+###############################################################################
 
 use strict;
 
@@ -17,6 +29,27 @@  require '/var/ipfire/general-functions.pl';
 require "${General::swroot}/lang.pl";
 require "${General::swroot}/header.pl";
 
+###--- HTML HEAD ---###
+my $extraHead = <<END
+<style>
+	table#controls {
+		width: 100%;
+		border: none;
+		table-layout: fixed;
+	}
+	#controls td {
+		text-align: center;
+	}
+	#controls button {
+		font-weight: bold;
+		padding: 0.7em;
+		min-width: 65%;
+	}
+</style>
+END
+;
+###--- END HTML HEAD ---###
+
 my %cgiparams=();
 my $death = 0;
 my $rebirth = 0;
@@ -26,33 +59,39 @@  my $rebirth = 0;
 $cgiparams{'ACTION'} = '';
 &Header::getcgihash(\%cgiparams);
 
-if ($cgiparams{'ACTION'} eq $Lang::tr{'shutdown'}) {
+if ($cgiparams{'ACTION'} eq "SHUTDOWN") {
 	$death = 1;
 	&General::log($Lang::tr{'shutting down ipfire'});
 	&General::system('/usr/local/bin/ipfirereboot', 'down');
-} elsif ($cgiparams{'ACTION'} eq $Lang::tr{'reboot'}) {
+} elsif ($cgiparams{'ACTION'} eq "REBOOT") {
 	$rebirth = 1;
 	&General::log($Lang::tr{'rebooting ipfire'});
 	&General::system('/usr/local/bin/ipfirereboot', 'boot');
+} elsif ($cgiparams{'ACTION'} eq "REBOOT_FSCK") {
+	$rebirth = 1;
+	&General::log($Lang::tr{'rebooting ipfire fsck'});
+	&General::system('/usr/local/bin/ipfirereboot', 'bootfs');
 }
+
 if ($death == 0 && $rebirth == 0) {
 
-	&Header::openpage($Lang::tr{'shutdown control'}, 1, '');
+	&Header::openpage($Lang::tr{'shutdown control'}, 1, $extraHead);
 
 	&Header::openbigbox('100%', 'left');
+	&Header::openbox('100%', 'left');
 
-	print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>\n";
-
-	&Header::openbox('100%', 'left', );
 	print <<END
-<table width='100%'>
-<tr>
-	<td width='50%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'reboot'}' /></td>
-	<td width='50%' align='center'><input type='submit' name='ACTION' value='$Lang::tr{'shutdown'}' /></td>
-</tr>
-</table>
+<form method="post" action="$ENV{'SCRIPT_NAME'}">
+	<table id="controls">
+	<tr>
+		<td><button type="submit" name="ACTION" value="SHUTDOWN">$Lang::tr{'shutdown'}</button></td>
+		<td><button type="submit" name="ACTION" value="REBOOT">$Lang::tr{'reboot'}</button></td>
+		<td><button type="submit" name="ACTION" value="REBOOT_FSCK">$Lang::tr{'reboot fsck'}</button></td>
+	</tr>
+	</table>
+</form>
 END
-	;
+;
 	&Header::closebox();
 
 } else {
diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl
index 0d2228ede..76bf0469d 100644
--- a/langs/de/cgi-bin/de.pl
+++ b/langs/de/cgi-bin/de.pl
@@ -2085,11 +2085,13 @@ 
 'real address' => 'Reale Addresse',
 'reboot' => 'Neustart',
 'reboot ask' => 'Neustart?',
+'reboot fsck' => 'Neustart & Dateisystem-Test',
 'reboot question' => 'Extra Abfrage bei neustart und herunterfahren einschalten',
 'reboot schedule' => 'Zeitsteuerung für IPFire Neustarts',
 'reboot sure' => 'Sind Sie sicher, dass Sie neustarten wollen?',
 'rebooting' => 'Starte neu ...',
 'rebooting ipfire' => 'Starte IPFire neu',
+'rebooting ipfire fsck' => 'Starte IPFire neu, Dateisystem-Test erzwingen',
 'received' => 'Empfangen',
 'reconnect' => 'Neu Verbinden',
 'reconnection' => 'Wiederverbindung',
diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl
index 2ba6961f3..181dc80b0 100644
--- a/langs/en/cgi-bin/en.pl
+++ b/langs/en/cgi-bin/en.pl
@@ -2120,11 +2120,13 @@ 
 'real address' => 'Real Address',
 'reboot' => 'Reboot',
 'reboot ask' => 'Reboot?',
+'reboot fsck' => 'Reboot & check filesystem',
 'reboot question' => 'Extra query for restart and shutdown',
 'reboot schedule' => 'Schedule IPFire reboots',
 'reboot sure' => 'Are you sure that you want to reboot?',
 'rebooting' => 'Rebooting',
 'rebooting ipfire' => 'Rebooting IPFire',
+'rebooting ipfire fsck' => 'Rebooting IPFire, forcing filesystem check',
 'received' => 'Received',
 'reconnect' => 'Reconnect',
 'reconnection' => 'Reconnection',