css: language selection position is now 'fixed' instead of 'absolute'

added context sensitive help (hover)
css: changed hovered color of buttons to light green
hdf: renamed some elements of the data tree
cgi: language validation fixed
cgi: documentation language setting fixed
cgi: diskinfo rendering fixed
This commit is contained in:
lars 2005-09-06 23:28:12 +00:00
parent 36c46b8ece
commit 2cec33cd2c
14 changed files with 155 additions and 69 deletions

View file

@ -4,15 +4,15 @@
<form action="<?cs call:getSelfURL('','') ?>" 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 call:help_popUp(Lang.Text.IPAddress,'set_ip_address') ?></label><br/>
<input type="text" id="ip" size="16" maxsize="15" name="ip" <input type="text" id="ip" size="16" maxsize="15" name="ip"
value="<?cs var:Data.Config.IP ?>" /><p> value="<?cs var:Data.Config.IP ?>" /><p>
<p><label for="timeout"><?cs var:Lang.Text.TimeOut ?></label><br/> <p><label for="timeout"><?cs call:help_popUp(Lang.Text.TimeOut,'set_timeout') ?></label><br/>
<input type="text" id="timeout" size="5" maxsize="5" name="timeout" <input type="text" id="timeout" size="5" maxsize="5" name="timeout"
value="<?cs var:Data.Config.TimeOut ?>" /></p> value="<?cs var:Data.Config.TimeOut ?>" /></p>
<p><label for="language"><?cs var:Lang.Text.SelectLanguage ?></label><br/> <p><label for="language"><?cs call:help_popUp(Lang.Text.SelectLanguage,'set_language') ?></label><br/>
<select name="language"> <select name="language">
<?cs each:item = Data.Languages ?> <?cs each:item = Data.Languages ?>
<option value="<?cs name:item ?>" <?cs if:(name(item) == Data.Config.Language) ?>selected="selected"<?cs /if ?>><?cs var:item ?></option> <option value="<?cs name:item ?>" <?cs if:(name(item) == Data.Config.Language) ?>selected="selected"<?cs /if ?>><?cs var:item ?></option>

View file

@ -1,5 +1,5 @@
<div id="doc"> <div id="doc">
<?cs include:DocDir + '/' + DocLang + '/' + Data.Doc.Page + '.html' ?> <?cs include:Settings.DocDir + '/' + Settings.DocLang + '/' + Data.Doc.Page + '.html' ?>
</div> </div>

View file

@ -29,7 +29,7 @@
<!-- the menu bar is disabled if redirection has been suggested --> <!-- the menu bar is disabled if redirection has been suggested -->
<?cs else ?> <?cs else ?>
<div id="menu"> <div id="menu">
<?cs include:TemplateDir + '/nav.cs' ?> <?cs include:Settings.TemplateDir + '/nav.cs' ?>
</div> </div>
<?cs /if ?> <?cs /if ?>

View file

@ -4,11 +4,11 @@
<form action="<?cs call:getSelfURL('','') ?>" 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 call:help_popUp(Lang.Text.EnterNewPassword,"crypto_pw") ?></label><br/>
<input type="password" id="password" name="password" size="20" tabindex="1" maxlength="40" /></p> <input type="password" id="password" name="password" size="20" tabindex="1" maxlength="40" /></p>
<p><label for="password2"><?cs var:Lang.Text.EnterSamePassword ?></label><br/> <p><label for="password2"><?cs call:help_popUp(Lang.Text.EnterSamePassword,'crypto_pw_repeat') ?></label><br/>
<input type="password" id="password2" name="password2" size="20" tabindex="2" maxlength="40" /></p> <input type="password" id="password2" name="password2" size="20" tabindex="2" maxlength="40" /></p>
<p><label for="confirm"><?cs var:Lang.Text.ConfirmInitHint ?><br/> <p><label for="confirm"><?cs call:help_popUp(Lang.Text.ConfirmInitHint,'confirm_text') ?><br/>
<span class="note" id="confirmtext"><?cs var:Lang.Text.ConfirmInit ?></span></label><br/> <span class="note" id="confirmtext"><?cs var:Lang.Text.ConfirmInit ?></span></label><br/>
<input type="text" id="confirm" name="confirm" size="30" tabindex="3" maxlength="50" /></p> <input type="text" id="confirm" name="confirm" size="30" tabindex="3" maxlength="50" /></p>
<button type="submit" name="action" value="init_do" tabindex="4"><?cs var:Lang.Button.DoInit ?></button> <button type="submit" name="action" value="init_do" tabindex="4"><?cs var:Lang.Button.DoInit ?></button>

View file

@ -53,8 +53,7 @@
# e.g.: # e.g.:
# - 'append' is 'weblang=de' # - 'append' is 'weblang=de'
# - 'exclude' is 'weblang' # - 'exclude' is 'weblang'
# BEWARE: there is a bug (?) in clearsilver, that occours, if # BEWARE: both parameters have to be defined!
# only one of the arguments is set (none or both are fine)
?><?cs set:PostSuffix='' ?><?cs ?><?cs set:PostSuffix='' ?><?cs
set:tmp_concat='?' ?><?cs set:tmp_concat='?' ?><?cs
each:item = Data.PostData ?><?cs each:item = Data.PostData ?><?cs
@ -68,3 +67,12 @@
var:ScriptName ?><?cs var:PostSuffix ?><?cs var:ScriptName ?><?cs var:PostSuffix ?><?cs
/def ?> /def ?>
<?cs def:help_popUp(text,filename) ?><?cs #
# show a pop-up information block on the right side of the screen
# usually good for small explanatory texts
?><a class="popup"><?cs
var:text ?><span><?cs
linclude:Settings.DocDir + '/' + Settings.DocLang + '/hints/' + filename + '.html' ?></span></a><?cs
/def ?>

View file

@ -1,14 +1,14 @@
<?cs include:TemplateDir + '/macros.cs' ?> <?cs include:Settings.TemplateDir + '/macros.cs' ?>
<?cs include:TemplateDir + '/header.cs' ?> <?cs include:Settings.TemplateDir + '/header.cs' ?>
<!-- this cryptobox template follows: <?cs var:Data.Action ?> --> <!-- this cryptobox template follows: <?cs var:Data.Action ?> -->
<?cs if:Data.Error ?> <?cs if:Data.Error ?>
<?cs include:TemplateDir + '/error.cs' ?> <?cs include:Settings.TemplateDir + '/error.cs' ?>
<?cs else ?> <?cs else ?>
<?cs if:Data.Warning ?><?cs call:warning(Data.Warning) ?><?cs /if ?> <?cs if:Data.Warning ?><?cs call:warning(Data.Warning) ?><?cs /if ?>
<?cs if:Data.Success ?><?cs call:success(Data.Success) ?><?cs /if ?> <?cs if:Data.Success ?><?cs call:success(Data.Success) ?><?cs /if ?>
<?cs include:TemplateDir + '/' + Data.Action + '.cs' ?> <?cs include:Settings.TemplateDir + '/' + Data.Action + '.cs' ?>
<?cs /if ?> <?cs /if ?>
<?cs include:TemplateDir + '/footer.cs' ?> <?cs include:Settings.TemplateDir + '/footer.cs' ?>

View file

@ -0,0 +1,2 @@
<h3>Confirmation text</h3>
<p>Type the confirmation text exactly the way, it is said. This confirms, that you know, what you are doing.</p>

View file

@ -0,0 +1,10 @@
<h3>Password of encrypted filesystem</h3>
<p>This password is the final protection for your sensible data. You should
choose a complicated password, that fullfills at least the following requirements:</p>
<ul>
<li>more than 20 characters</li>
<li>contain lowercase, uppercase, numbers, special characters</li>
<li>may not be written anywhere in cleartext</li>
</ul>
<p>Do not forget your encryption password! There is no way to recover your data
without it (of course, there should be none).</p>

View file

@ -0,0 +1,2 @@
<h3>Repeat the crypto password</h3>
<p>This ensures, that you do not mistype your password.</p>

View file

@ -0,0 +1,2 @@
<h3>Change the network address (IP)</h3>
<p>Maybe you will have to reconfigure the network address of your local computer, too.</p>

View file

@ -0,0 +1,3 @@
<h3>Change the default language</h3>
<p>This will set the default language of the web interface of this CryptoBox. Every user may change this temporarily
by selecting a language of choice in the upper right corner of the screen.</p>

View file

@ -0,0 +1,3 @@
<h3>Change the idle timeout</h3>
<p>This value specifies, when the encrypted filesystem will be automatically unmounted.
The last access of the encrypted data starts this timer.</p>

View file

@ -36,10 +36,10 @@ sub load_hdf()
my $fname = "$TEMPLATE_DIR/main.cs"; my $fname = "$TEMPLATE_DIR/main.cs";
die ("Template directory is invalid ($fname not found)!") unless (-e "$fname"); die ("Template directory is invalid ($fname not found)!") unless (-e "$fname");
$hdf->setValue("TemplateDir","$TEMPLATE_DIR"); $hdf->setValue("Settings.TemplateDir","$TEMPLATE_DIR");
die ("Documentation directory ($DOC_DIR) not found!") unless (-d "$DOC_DIR"); die ("Documentation directory ($DOC_DIR) not found!") unless (-d "$DOC_DIR");
$hdf->setValue("DocDir","$DOC_DIR"); $hdf->setValue("Settings.DocDir","$DOC_DIR");
# 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
@ -224,16 +224,30 @@ sub validate_timeout()
} }
# check for a valid interface language
sub validate_language() sub validate_language()
{ {
my $language = shift; my $language = shift;
# check for non-alphanumeric character # check for non-alphanumeric character
return 0 if ($language =~ /\W/); return 0 if ($language =~ /\W/);
return 0 if ($language eq "");
return 0 if ( ! -e "$LANGUAGE_DIR/$language" . '.hdf'); return 0 if ( ! -e "$LANGUAGE_DIR/$language" . '.hdf');
return 1; return 1;
} }
# check for a valid documentation language
sub validate_doc_language()
{
my $language = shift;
# check for non-alphanumeric character
return 0 if ($language =~ /\W/);
return 0 if ($language eq "");
return 0 if ( ! -e "$DOC_DIR/$language" . '.hdf');
return 1;
}
################### main ######################### ################### main #########################
my $query = new CGI; my $query = new CGI;
@ -251,22 +265,25 @@ if ($query->param('weblang')) {
&load_language_data($pagedata, "$weblang"); &load_language_data($pagedata, "$weblang");
# add the setting to every link # add the setting to every link
$pagedata->setValue('Data.PostData.weblang', "$weblang"); $pagedata->setValue('Data.PostData.weblang', "$weblang");
# select documentation
if (-e "$DOC_DIR/$weblang") {
# selected web interface language
$pagedata->setValue('Data.DocLang', "$weblang");
} elseif (-e "$DOC_DIR/$LANGUAGE") {
# default CryptoBox language
$pagedata->setValue('Data.DocLang', "$LANGUAGE");
} else {
# default hardcoded language (english)
$pagedata->setValue('Data.DocLang', "en");
}
} else { } else {
$pagedata->setValue('Data.Warning', 'InvalidLanguage'); $pagedata->setValue('Data.Warning', 'InvalidLanguage');
} }
} }
########## select documentation language ##########
if ($query->param('weblang') && &validate_doc_language($query->param('weblang'))) {
# selected web interface language
$pagedata->setValue('Settings.DocLang', "$query->param('weblang')");
} elsif (&validate_doc_language($LANGUAGE)) {
# configured CryptoBox language
$pagedata->setValue('Settings.DocLang', "$LANGUAGE");
} else {
# default hardcoded language (english)
$pagedata->setValue('Settings.DocLang', "en");
}
# first: check for ssl! # first: check for ssl!
if ( ! &check_ssl()) { if ( ! &check_ssl()) {
$pagedata->setValue('Data.Error', 'NoSSL'); $pagedata->setValue('Data.Error', 'NoSSL');
@ -479,7 +496,7 @@ $pagedata->setValue('Data.Status.Mounted', &check_mounted() ? 1 : 0);
my $output = &get_current_ip(); my $output = &get_current_ip();
$pagedata->setValue('Data.Status.IP', "$output"); $pagedata->setValue('Data.Status.IP', "$output");
($output = `$CB_SCRIPT diskinfo 2>&1`) =~ s#\Z#<br/>#; $output = `$CB_SCRIPT diskinfo 2>&1 | sed 's#\$#<br/>#'`;
$pagedata->setValue('Data.PartitionInfo',"$output"); $pagedata->setValue('Data.PartitionInfo',"$output");
# preset config settings for clearsilver # preset config settings for clearsilver

View file

@ -252,7 +252,7 @@ button {
} }
button:hover { button:hover {
background-color: #fff; background-color: #D0F0A0;
border: 1px solid #ACE149; border: 1px solid #ACE149;
color: #5e5e5e; color: #5e5e5e;
font-size: 0.8em; font-size: 0.8em;
@ -271,7 +271,7 @@ button:hover {
/* ------------=-=-=- language selection -=-=-=------------- */ /* ------------=-=-=- language selection -=-=-=------------- */
#lang { #lang {
position: absolute; position: fixed;
float: right; float: right;
right: 5px; right: 5px;
top: 5px; top: 5px;
@ -321,3 +321,42 @@ button:hover {
margin-right: 10%; margin-right: 10%;
font-family: monospace font-family: monospace
} }
#words a.popup {
line-height: inherit;
color: inherit;
text-decoration: inherit;
font-weight: inherit;
font-size: inherit;
}
#words a.popup:hover {
text-decoration: inherit;
}
#words a.popup span {
display: none;
position: fixed;
bottom: 10px;
left: 9%;
width: 80%;
background: #f0f0f0;
padding: 10px;
border-color: #e0e0e0;
border-width: 2px;
border-style: solid;
margin: 0;
}
#words a.popup:hover span {
display: inline;
}
#words a.popup span p {
text-align: left;
}
#words a.popup span h3 {
color: #909090;
margin-top: 0px;
}