Browse Source

user-specific temporary language selection implemented

obsolete validation links removed
master
lars 17 years ago
parent
commit
44056467fa
  1. 2
      cbox-tree.d/usr/share/cryptobox/templates/config_form.cs
  2. 2
      cbox-tree.d/usr/share/cryptobox/templates/header.cs
  3. 2
      cbox-tree.d/usr/share/cryptobox/templates/init_form.cs
  4. 31
      cbox-tree.d/usr/share/cryptobox/templates/macros.cs
  5. 2
      cbox-tree.d/usr/share/cryptobox/templates/mount_form.cs
  6. 20
      cbox-tree.d/usr/share/cryptobox/templates/nav.cs
  7. 2
      cbox-tree.d/usr/share/cryptobox/templates/shutdown_form.cs
  8. 2
      cbox-tree.d/usr/share/cryptobox/templates/umount_form.cs
  9. 36
      cbox-tree.d/var/www/cgi-bin/cryptobox.pl

2
cbox-tree.d/usr/share/cryptobox/templates/config_form.cs

@ -1,7 +1,7 @@
<div id="config">
<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">
<p><label for="ip"><?cs var:Lang.Text.IPAddress ?></label><br/>

2
cbox-tree.d/usr/share/cryptobox/templates/header.cs

@ -14,7 +14,7 @@
<div id="lang">
<?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 ?>
</div>

2
cbox-tree.d/usr/share/cryptobox/templates/init_form.cs

@ -1,7 +1,7 @@
<h1><?cs var:Lang.Title.Init ?></h1>
<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><label for="password"><?cs var:Lang.Text.EnterNewPassword ?></label><br/>

31
cbox-tree.d/usr/share/cryptobox/templates/macros.cs

@ -34,12 +34,37 @@
/def ?>
<?cs def:parseTree(root) ?>
<!-- the output looks quite ugly and is not very helpful as there are only a few values -->
<!-- data tree
<?cs def:parseTree(root) ?><?cs #
# the output looks quite ugly and is not very helpful as there are
# only a few values
?><!-- data tree
<?cs each:item = root ?><?cs
name:item ?>: <?cs var:item ?><?cs
each:subitem = item ?> / <?cs name:subitem ?>=<?cs var:subitem ?><?cs /each ?>
<?cs /each ?>
-->
<?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 ?>

2
cbox-tree.d/usr/share/cryptobox/templates/mount_form.cs

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

20
cbox-tree.d/usr/share/cryptobox/templates/nav.cs

@ -1,25 +1,19 @@
<!-- mounting possible? -->
<?cs if:((Data.Status.Config == 1) && (Data.Status.InitRunning == 0)) ?>
<?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 ?>
<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 ?>
<!-- already initialized (or at least in progress)? -->
<?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 ?>
<a href="<?cs var:ScriptName ?>?action=init_ask" title="Ersteinrichtung">Initialisierung</a>
<a href="<?cs var:ScriptName ?>?action=show_log" title="Ereignis-Protokoll">Protokoll</a>
<a href="<?cs var:ScriptName ?>?action=doc" title="Nutzer-Handbuch">Hilfe</a>
<a href="<?cs var:ScriptName ?>?action=shutdown_ask" title="Herunterfahren">Herunterfahren</a>
<a href="<?cs call:getSelfURL('action=init_ask','action') ?>" title="Ersteinrichtung">Initialisierung</a>
<a href="<?cs call:getSelfURL('action=show_log','action') ?>" title="Ereignis-Protokoll">Protokoll</a>
<a href="<?cs call:getSelfURL('action=doc','action') ?>" title="Nutzer-Handbuch">Hilfe</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 ?>

2
cbox-tree.d/usr/share/cryptobox/templates/shutdown_form.cs

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

2
cbox-tree.d/usr/share/cryptobox/templates/umount_form.cs

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

36
cbox-tree.d/var/www/cgi-bin/cryptobox.pl

@ -42,7 +42,9 @@ sub load_hdf()
# 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
$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);
@ -246,6 +248,24 @@ $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
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!
if ( ! &check_ssl()) {
$pagedata->setValue('Data.Error', 'NoSSL');
@ -253,7 +273,7 @@ if ( ! &check_ssl()) {
$pagedata->setValue('Data.Redirect.Delay', "3");
} elsif ( ! &is_harddisk_available()) {
$pagedata->setValue('Data.Error', 'NoHardDisk');
} elsif ($query->param) {
} elsif ($query->param('action')) {
my $action = $query->param('action');
################ umount_do #######################
if ($action eq 'umount_do') {
@ -371,18 +391,6 @@ if ( ! &check_ssl()) {
} else {
$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 #######################
} elsif ($action eq 'config_do') {
if ( ! &check_config()) {

Loading…
Cancel
Save