images moved to /var/www/cryptobox-img

doc pages served by the CGI again (as until rev 164)
URLs of images in stylesheet are absolute now
moved 'partition_info' layout to stylesheet file
CGI: file handling now done with perl instead of shell utilities
CGI: removed warning for 'crypto not mounted' after 'poweroff' or 'reboot'
CGI: warning, if unmount-crypto failed
CGI: warning, if configuration of any value failed silently
texts for 'ConfigTimeOutFailed', 'ConfigLanguageFailed' and 'ConfigIPFailed' added to language file
cbox-manage.sh: syntax info updated
cbox-manage.sh: action 'crypto-(u)mount' renamed to 'crypto-up/down'
This commit is contained in:
lars 2005-09-01 15:00:54 +00:00
parent 66c5d1955e
commit 16b5e2f07b
18 changed files with 131 additions and 79 deletions

View file

@ -90,8 +90,9 @@ sub get_available_languages()
sub log_msg()
{
my $text = shift;
# TODO: improve or remove!
system("echo $text >>$LOG_FILE");
open(LOGFILE,">> $LOG_FILE");
print LOGFILE "$text";
close(LOGFILE);
}
@ -153,29 +154,22 @@ sub mount_vol
my $pw = shift;
if (&check_mounted) {
$pagedata->setValue('Data.Warning', 'Das Dateisystem war bereits aktiv!');
return 0;
$pagedata->setValue('Data.Warning', 'IsMounted');
} else {
open(PW_INPUT, "| $CB_SCRIPT crypto-up");
print PW_INPUT $pw;
close(PW_INPUT);
}
# TODO: the output is always empty?
my $output = open(PW_INPUT, "| $CB_SCRIPT crypto-mount");
print PW_INPUT $pw;
close(PW_INPUT);
$pagedata->setValue('Data.ProgOutput',"$output") if ($output);
}
sub umount_vol
{
unless (&check_mounted) {
$pagedata->setValue('Data.Warning', 'Das Dateisystem war bereits inaktiv!');
return 0;
if (&check_mounted) {
system("$CB_SCRIPT", "crypto-down");
} else {
$pagedata->setValue('Data.Warning', 'NotMounted');
}
# TODO: check if "system" returns output
my $output = `$CB_SCRIPT crypto-umount`;
$pagedata->setValue('Data.ProgOutput',"$output") if ($output);
}
@ -195,14 +189,14 @@ sub box_init
sub system_poweroff()
{
&umount_vol();
&umount_vol() if (&check_mounted());
system("$CB_SCRIPT", "poweroff");
}
sub system_reboot()
{
&umount_vol();
&umount_vol() if (&check_mounted());
system("$CB_SCRIPT", "reboot");
}
@ -246,8 +240,6 @@ my $query = new CGI;
$pagedata = load_hdf();
#TODO: check result of actions and set Data.Error for failures
######### temporary language setting? ############
# the default language can be overriden by the language links in the
# upper right of the page
@ -292,9 +284,10 @@ if ( ! &check_ssl()) {
if (&check_mounted()) {
$pagedata->setValue('Data.Warning', 'UmountFailed');
$pagedata->setValue('Data.Action', 'umount_form');
}
$pagedata->setValue('Data.Success', 'UmountDone');
$pagedata->setValue('Data.Action', 'mount_form');
} else {
$pagedata->setValue('Data.Success', 'UmountDone');
$pagedata->setValue('Data.Action', 'mount_form');
}
}
################ mount_do ########################
} elsif ($action eq 'mount_do') {
@ -423,15 +416,31 @@ if ( ! &check_ssl()) {
$pagedata->setValue('Data.Warning', 'IPAddressChanged');
}
# TODO: check for success by comparing with new config and report success
$pagedata->setValue('Data.Success', 'ConfigSaved');
# TODO: maybe the intro page does not fit here ...
# check for success
if (`$CB_SCRIPT get_config timeout` ne $query->param('timeout')) {
$pagedata->setValue('Data.Warning', 'ConfigTimeOutFailed');
} elsif (`$CB_SCRIPT get_config ip` ne $query->param('ip')) {
$pagedata->setValue('Data.Warning', 'ConfigIPFailed');
} elsif (`$CB_SCRIPT get_config language` ne $query->param('language')) {
$pagedata->setValue('Data.Warning', 'ConfigLanguageFailed');
} else {
$pagedata->setValue('Data.Success', 'ConfigSaved');
}
$pagedata->setValue('Data.Action', 'intro');
}
}
#################### show_log #######################
} elsif ($action eq 'show_log') {
$pagedata->setValue('Data.Action', 'show_log');
##################### doc ############################
} elsif ($action eq 'doc') {
if ($query->param('page')) {
$pagedata->setValue('Data.Doc.Page', $query->param('page'));
$pagedata->setValue('Data.Action', 'doc');
} else {
$pagedata->setValue('Data.Doc.Page', 'CryptoBox');
$pagedata->setValue('Data.Action', 'doc');
}
##################### poweroff ######################
} elsif ($action eq 'shutdown_ask') {
$pagedata->setValue('Data.Action', 'shutdown_form');
@ -461,7 +470,7 @@ $pagedata->setValue('Data.Status.Mounted', &check_mounted() ? 1 : 0);
my $output = &get_current_ip();
$pagedata->setValue('Data.Status.IP', "$output");
$output = `$CB_SCRIPT diskinfo 2>&1 | sed 's/^/<br>/'`;
($output = `$CB_SCRIPT diskinfo 2>&1`) =~ s#\Z#<br/>#;
$pagedata->setValue('Data.PartitionInfo',"$output");
# preset config settings for clearsilver
@ -469,8 +478,13 @@ $pagedata->setValue('Data.Config.IP', `$CB_SCRIPT get_config ip`);
$pagedata->setValue('Data.Config.TimeOut', `$CB_SCRIPT get_config timeout`);
$pagedata->setValue('Data.Config.Language', `$CB_SCRIPT get_config language`);
# read log - TODO: use perl filtering
$output = (-e "$LOG_FILE") ? `cat '$LOG_FILE' | sed 's/^/<br>/'` : '';
# read log and add html linebreaks
$output = '';
if (-e "$LOG_FILE") {
open(LOGFILE, "< $LOG_FILE");
while (<LOGFILE>) { $output .= "$_<br/>" }
close(LOGFILE);
}
$pagedata->setValue('Data.Log',"$output");
$pagedata->setValue('Data.Status.DevelopmentMode', 1) if ($IS_DEV);

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 51 B

After

Width:  |  Height:  |  Size: 51 B

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -1,5 +1,5 @@
body {
background-image: url(img/backg.gif);
background-image: url(/cryptobox-img/backg.gif);
background-position: top center;
background-attachment: fixed;
background-repeat: no-repeat;
@ -40,7 +40,7 @@ body {
height: 120px;
margin: 0;
padding: 0;
background-image: url(img/evil_small.png);
background-image: url(/cryptobox-img/evil_small.png);
background-position: top right;
background-attachment: scroll;
background-repeat: no-repeat;
@ -123,7 +123,7 @@ body {
padding: 0 1em;
line-height: 1.7em;
list-style: none;
background: url(img/list.gif) center left no-repeat;
background: url(/cryptobox-img/list.gif) center left no-repeat;
}
#footer {
@ -155,7 +155,7 @@ body {
}
/* --------------------=-=-=- Spezialkram -=-=-=------------------- */
/* -------=-=-=- warnings, errors and success messages-=-=-=-------- */
#words div.warning,div.error,div.success {
margin-top: 20px;
@ -193,7 +193,7 @@ body {
}
#words .warning,.error,.success a {
// WHY line-height???
// TODO: WHY line-height???
// line-height: 5em;
color: #5e5e5e;
text-decoration: none;
@ -208,7 +208,7 @@ body {
}
/* ----------------------=-=-=- Forms -=-=-=--------------------- */
/* nachfolgend die Sachen fuer schoene Formulare und Buttons */
/* pretty forms and buttons */
input {
border: 1px solid #BFBFBF;
color: #949494;
@ -284,3 +284,16 @@ button:hover {
#lang a:hover {
color: #707070;
}
/* ------------=-=-=- documentation -=-=-=------------- */
// #doc { }
/* ------------=-=-=- special things -=-=-=------------- */
#partition_info p {
margin-left:10%;
margin-right:10%;
font-family:monospace
}