user-specific temporary language selection implemented

obsolete validation links removed
This commit is contained in:
lars 2005-08-30 15:18:50 +00:00
parent 4930d1d3fe
commit 44056467fa
9 changed files with 63 additions and 36 deletions

View File

@ -1,7 +1,7 @@
<div id="config"> <div id="config">
<h1><?cs var:Lang.Title.Config ?></h1> <h1><?cs var:Lang.Title.Config ?></h1>
<form action="<?cs var:ScriptName ?>" method="post" <form action="<?cs call:getSelfURL() ?>" method="post"
enctype="application/x-www-form-urlencoded"> enctype="application/x-www-form-urlencoded">
<p><label for="ip"><?cs var:Lang.Text.IPAddress ?></label><br/> <p><label for="ip"><?cs var:Lang.Text.IPAddress ?></label><br/>

View File

@ -14,7 +14,7 @@
<div id="lang"> <div id="lang">
<?cs each:item = Data.Languages ?> <?cs each:item = Data.Languages ?>
<a href="<?cs var:ScriptName ?>?action=set_lang&language=<?cs name:item ?>"><?cs var:item ?></a><br/> <a href="<?cs call:getSelfURL('weblang=' + name(item),'weblang') ?>"><?cs var:item ?></a><br/>
<?cs /each ?> <?cs /each ?>
</div> </div>

View File

@ -1,7 +1,7 @@
<h1><?cs var:Lang.Title.Init ?></h1> <h1><?cs var:Lang.Title.Init ?></h1>
<div class="init"> <div class="init">
<form action="<?cs var:ScriptName ?>" method="post" enctype="application/x-www-form-urlencoded"> <form action="<?cs call:getSelfURL() ?>" method="post" enctype="application/x-www-form-urlencoded">
<p class="note"><?cs var:Lang.Text.InitWarning ?></p> <p class="note"><?cs var:Lang.Text.InitWarning ?></p>
<p><label for="password"><?cs var:Lang.Text.EnterNewPassword ?></label><br/> <p><label for="password"><?cs var:Lang.Text.EnterNewPassword ?></label><br/>

View File

@ -34,12 +34,37 @@
/def ?> /def ?>
<?cs def:parseTree(root) ?> <?cs def:parseTree(root) ?><?cs #
<!-- the output looks quite ugly and is not very helpful as there are only a few values --> # the output looks quite ugly and is not very helpful as there are
<!-- data tree # only a few values
?><!-- data tree
<?cs each:item = root ?><?cs <?cs each:item = root ?><?cs
name:item ?>: <?cs var:item ?><?cs name:item ?>: <?cs var:item ?><?cs
each:subitem = item ?> / <?cs name:subitem ?>=<?cs var:subitem ?><?cs /each ?> each:subitem = item ?> / <?cs name:subitem ?>=<?cs var:subitem ?><?cs /each ?>
<?cs /each ?> <?cs /each ?>
--> -->
<?cs /def ?> <?cs /def ?>
<?cs def:getSelfURL(append,exclude) ?><?cs #
# construct the URL of the script out of the ScriptName, Data.PostData
# (except for the value mentioned in 'exclude') and a possible
# suffix (append)
# e.g.:
# - 'append' is 'weblang=de'
# - 'exclude' is 'weblang'
# BEWARE: there is a bug (?) in clearsilver, that occours, if
# only one of the arguments is set (none or both are fine)
?> set:PostSuffix='' ?><?cs
set:tmp_concat='?' ?><?cs
each:item = Data.PostData ?><?cs
if:(name(item) != exclude) ?><?cs
set:PostSuffix=PostSuffix + tmp_concat + name(item) + '=' + item ?><?cs
set:tmp_concat='&' ?><?cs
/if ?><?cs
/each ?><?cs
if:?append ?><?cs set:PostSuffix=PostSuffix + tmp_concat + append ?><?cs
/if ?><?cs
var:ScriptName ?><?cs var:PostSuffix ?><?cs
/def ?>

View File

@ -1,7 +1,7 @@
<h1>Aktivierung des verschl&uuml;sselten Dateisystems</h1> <h1>Aktivierung des verschl&uuml;sselten Dateisystems</h1>
<div align="center"> <div align="center">
<form action="<?cs var:ScriptName ?>" method="post" <form action="<?cs call:getSelfURL() ?>" method="post"
enctype="application/x-www-form-urlencoded"> enctype="application/x-www-form-urlencoded">
<p><label for="passwort">Passwort eingeben:</label> <p><label for="passwort">Passwort eingeben:</label>

View File

@ -1,25 +1,19 @@
<!-- mounting possible? --> <!-- mounting possible? -->
<?cs if:((Data.Status.Config == 1) && (Data.Status.InitRunning == 0)) ?> <?cs if:((Data.Status.Config == 1) && (Data.Status.InitRunning == 0)) ?>
<?cs if:(Data.Status.Mounted == 1) ?> <?cs if:(Data.Status.Mounted == 1) ?>
<a href="<?cs var:ScriptName ?>?action=umount_do" title="Deaktivierung des verschl&uuml;sselten Dateisystems">Deaktivierung</a> <a href="<?cs call:getSelfURL('action=umount_do','action') ?>" title="Deaktivierung des verschl&uuml;sselten Dateisystems">Deaktivierung</a>
<?cs else ?> <?cs else ?>
<a href="<?cs var:ScriptName ?>?action=mount_ask" title="Aktivierung des verschl&uuml;sselten Dateisystems">Aktivierung</a> <a href="<?cs call:getSelfURL('action=mount_ask','action') ?>" title="Aktivierung des verschl&uuml;sselten Dateisystems">Aktivierung</a>
<?cs /if ?> <?cs /if ?>
<?cs /if ?> <?cs /if ?>
<!-- already initialized (or at least in progress)? --> <!-- already initialized (or at least in progress)? -->
<?cs if:(Data.Status.Config == 1) ?> <?cs if:(Data.Status.Config == 1) ?>
<a href="<?cs var:ScriptName ?>?action=config_ask" title="Einstellungen">Einstellungen</a> <a href="<?cs call:getSelfURL('action=config_ask','action') ?>" title="Einstellungen">Einstellungen</a>
<?cs /if ?> <?cs /if ?>
<a href="<?cs var:ScriptName ?>?action=init_ask" title="Ersteinrichtung">Initialisierung</a> <a href="<?cs call:getSelfURL('action=init_ask','action') ?>" title="Ersteinrichtung">Initialisierung</a>
<a href="<?cs var:ScriptName ?>?action=show_log" title="Ereignis-Protokoll">Protokoll</a> <a href="<?cs call:getSelfURL('action=show_log','action') ?>" title="Ereignis-Protokoll">Protokoll</a>
<a href="<?cs var:ScriptName ?>?action=doc" title="Nutzer-Handbuch">Hilfe</a> <a href="<?cs call:getSelfURL('action=doc','action') ?>" title="Nutzer-Handbuch">Hilfe</a>
<a href="<?cs var:ScriptName ?>?action=shutdown_ask" title="Herunterfahren">Herunterfahren</a> <a href="<?cs call:getSelfURL('action=shutdown_ask','action') ?>" title="Herunterfahren">Herunterfahren</a>
<?cs if:Data.Status.DevelopmentMode ?>
<!-- no longer used
<a href="/cgi-bin/validate.sh" title="Validation">Test-Sequenzen</a>
<a href="/report/" title="Validierungsergebnisse">Test-Report</a>
-->
<?cs /if ?>

View File

@ -1,7 +1,7 @@
<h1><?cs var:Lang.Title.ShutDown ?></h1> <h1><?cs var:Lang.Title.ShutDown ?></h1>
<div align="center"> <div align="center">
<form action="<?cs var:ScriptName ?>" method="post" <form action="<?cs call:getSelfURL() ?>" method="post"
enctype="application/x-www-form-urlencoded"> enctype="application/x-www-form-urlencoded">
<input type="hidden" name="action" value="shutdown_do" /> <input type="hidden" name="action" value="shutdown_do" />

View File

@ -1,7 +1,7 @@
<h1><?cs var:Lang.Title.Umount ?></h1> <h1><?cs var:Lang.Title.Umount ?></h1>
<div align="center"> <div align="center">
<form action="<?cs var:ScriptName ?>" method="post" <form action="<?cs call:getSelfURL() ?>" method="post"
enctype="application/x-www-form-urlencoded"> enctype="application/x-www-form-urlencoded">
<button type="submit" name="action" <button type="submit" name="action"

View File

@ -42,7 +42,9 @@ sub load_hdf()
# if it was requested as directory index (link from index.html), we should # if it was requested as directory index (link from index.html), we should
# set a real script name - otherwise links with a query string will break # set a real script name - otherwise links with a query string will break
$hdf->setValue("ScriptName", ($ENV{'SCRIPT_NAME'} eq '/')? '/cryptobox' : $ENV{'SCRIPT_NAME'}); # ignore POST part of the SCRIPT_NAME (after "&")
(my $script_url = $ENV{'SCRIPT_NAME'}) =~ m/^[^&]*/;
$hdf->setValue("ScriptName", ($ENV{'SCRIPT_NAME'} eq '/')? '/cryptobox' : $script_url );
&load_language_data($hdf, $LANGUAGE); &load_language_data($hdf, $LANGUAGE);
@ -246,6 +248,24 @@ $pagedata = load_hdf();
#TODO: check result of actions and set Data.Error for failures #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
if ($query->param('weblang')) {
my $weblang = $query->param('weblang');
if (&validate_language($weblang)) {
&log_msg("lang: $weblang");
# load the data
&load_language_data($pagedata, "$weblang");
&log_msg("loaded: $weblang");
# add the setting to every link
$pagedata->setValue('Data.PostData.weblang', "$weblang");
&log_msg("set: $weblang");
} else {
$pagedata->setValue('Data.Warning', 'InvalidLanguage');
}
}
# first: check for ssl! # first: check for ssl!
if ( ! &check_ssl()) { if ( ! &check_ssl()) {
$pagedata->setValue('Data.Error', 'NoSSL'); $pagedata->setValue('Data.Error', 'NoSSL');
@ -253,7 +273,7 @@ if ( ! &check_ssl()) {
$pagedata->setValue('Data.Redirect.Delay', "3"); $pagedata->setValue('Data.Redirect.Delay', "3");
} elsif ( ! &is_harddisk_available()) { } elsif ( ! &is_harddisk_available()) {
$pagedata->setValue('Data.Error', 'NoHardDisk'); $pagedata->setValue('Data.Error', 'NoHardDisk');
} elsif ($query->param) { } elsif ($query->param('action')) {
my $action = $query->param('action'); my $action = $query->param('action');
################ umount_do ####################### ################ umount_do #######################
if ($action eq 'umount_do') { if ($action eq 'umount_do') {
@ -371,18 +391,6 @@ if ( ! &check_ssl()) {
} else { } else {
$pagedata->setValue('Data.Action', 'config_form'); $pagedata->setValue('Data.Action', 'config_form');
} }
#################### set_lang ########################
# this action is called by the language links in the upper left of the web interface
} elsif ($action eq 'set_lang') {
# TODO: ugly problem: can't save the setting, as long as the box is unconfigured
my $language = $query->param('language');
if (&validate_language($language)) {
system("$CB_SCRIPT", "set_config", "language", "$language");
&load_language_data($pagedata, $language);
} else {
$pagedata->setValue('Data.Warning', 'InvalidLanguage');
}
$pagedata->setValue('Data.Action', 'intro');
#################### config_do ####################### #################### config_do #######################
} elsif ($action eq 'config_do') { } elsif ($action eq 'config_do') {
if ( ! &check_config()) { if ( ! &check_config()) {