removed last hard coded texts

'EnterCurrentCryptoPassword' added to language files
'EnterAdminPassword' renamed to 'EnterCurrentAdminPassword'
language file loaded immeadiately before rendering
sort language links in web interface lexically
reordered 'find' options to avoid warnings
This commit is contained in:
lars 2005-09-20 22:29:55 +00:00
parent e1d9b1b4bf
commit 882b9d1bb7
9 changed files with 65 additions and 60 deletions

View File

@ -15,9 +15,10 @@ Lang {
Text { Text {
EnterCurrentCryptoPassword = Das Crypto-Passwort eingeben:
EnterNewCryptoPassword = Das neue Crypto-Passwort eingeben: EnterNewCryptoPassword = Das neue Crypto-Passwort eingeben:
EnterSameCryptoPassword = Das Crypto-Passwort wiederholen: EnterSameCryptoPassword = Das Crypto-Passwort wiederholen:
EnterAdminPassword = Das bisherige Admin-Passwort eingeben: EnterCurrentAdminPassword = Das aktuelle Admin-Passwort eingeben:
EnterNewAdminPassword = Das neue Admin-Passwort eingeben: EnterNewAdminPassword = Das neue Admin-Passwort eingeben:
EnterSameAdminPassword = Das neue Admin-Passwort wiederholen: EnterSameAdminPassword = Das neue Admin-Passwort wiederholen:
InitWarning = Bei der Initialisierung werden ALLE DATEN auf der Festplatte GELÖSCHT! InitWarning = Bei der Initialisierung werden ALLE DATEN auf der Festplatte GELÖSCHT!
@ -41,8 +42,8 @@ Lang {
DoInit = CryptoBox initialisieren DoInit = CryptoBox initialisieren
SaveConfig = Speichere Konfiguration SaveConfig = Speichere Konfiguration
Update = Aktualisieren Update = Aktualisieren
Mount = CryptoDaten aktivieren Mount = Crypto-Daten aktivieren
Umount = CryptoDaten deaktivieren Umount = Crypto-Daten deaktivieren
Config = Einstellungen Config = Einstellungen
PowerOff = ausschalten PowerOff = ausschalten
ReBoot = neu starten ReBoot = neu starten

View File

@ -15,9 +15,10 @@ Lang {
Text { Text {
EnterCurrentCryptoPassword = Enter the crypto password:
EnterNewCryptoPassword = Enter the new crypto password: EnterNewCryptoPassword = Enter the new crypto password:
EnterSameCryptoPassword = Repeat the new crypto password: EnterSameCryptoPassword = Repeat the new crypto password:
EnterAdminPassword = Enter the current administration password: EnterCurrentAdminPassword = Enter the current administration password:
EnterNewAdminPassword = Enter the new administration password: EnterNewAdminPassword = Enter the new administration password:
EnterSameAdminPassword = Repeat the new administration password: EnterSameAdminPassword = Repeat the new administration password:
InitWarning = During the process of initialization ALL DATA on the hard drive WILL BE DELETED! InitWarning = During the process of initialization ALL DATA on the hard drive WILL BE DELETED!
@ -30,7 +31,7 @@ Lang {
SelectLanguage = Language preferences: SelectLanguage = Language preferences:
RedirectNote = Click here if your browser does not support automatic redirection. RedirectNote = Click here if your browser does not support automatic redirection.
ProjectHomePage = Website of project ProjectHomePage = Website of project
ProjectNote = The CryptoBox is a product of ProjectNote = The CryptoBox is a project of
DoUmount = Deactivation of the encrypted filesystem DoUmount = Deactivation of the encrypted filesystem
DoMount = Activation of the encrypted filesystem DoMount = Activation of the encrypted filesystem
Configuration = Configuration Configuration = Configuration
@ -41,8 +42,8 @@ Lang {
DoInit = Initialize CryptoBox DoInit = Initialize CryptoBox
SaveConfig = Save configuration SaveConfig = Save configuration
Update = Refresh Update = Refresh
Mount = activate encrypted filesystem Mount = Activate encrypted filesystem
Umount = deactivate encrypted filesystem Umount = Deactivate encrypted filesystem
Config = Configuration Config = Configuration
PowerOff = Shutdown PowerOff = Shutdown
ReBoot = Reboot ReBoot = Reboot

View File

@ -15,9 +15,10 @@ Lang {
Text { Text {
EnterCurrentCryptoPassword = Vpišite geslo:
EnterNewCryptoPassword = Vpišite novo geslo: EnterNewCryptoPassword = Vpišite novo geslo:
EnterSameCryptoPassword = Ponovite novo geslo: EnterSameCryptoPassword = Ponovite novo geslo:
EnterAdminPassword = Vnesite trenutno obstoječe geslo administratorja/ke: EnterCurrentAdminPassword = Vnesite trenutno obstoječe geslo administratorja/ke:
EnterNewAdminPassword = Vnesite novo geslo administratorja/ke: EnterNewAdminPassword = Vnesite novo geslo administratorja/ke:
EnterSameAdminPassword = Ponovite novo geslo administratorja/ke: EnterSameAdminPassword = Ponovite novo geslo administratorja/ke:
InitWarning = Med incializacijo bodo VSI PODATKI z vašega trdega diska IZBRISANI! InitWarning = Med incializacijo bodo VSI PODATKI z vašega trdega diska IZBRISANI!

View File

@ -5,7 +5,7 @@
enctype="application/x-www-form-urlencoded"> enctype="application/x-www-form-urlencoded">
<?cs if:Data.Config.AdminPasswordIsSet ?> <?cs if:Data.Config.AdminPasswordIsSet ?>
<p><label for="current_admin_password"><?cs call:help_popUp(Lang.Text.EnterAdminPassword,"prove_admin_pw") ?></label><br/> <p><label for="current_admin_password"><?cs call:help_popUp(Lang.Text.EnterCurrentAdminPassword,"prove_admin_pw") ?></label><br/>
<input type="password" id="current_admin_password" name="current_admin_password" size="20" tabindex="1" maxlength="40" /> </p> <input type="password" id="current_admin_password" name="current_admin_password" size="20" tabindex="1" maxlength="40" /> </p>
<?cs /if ?> <?cs /if ?>

View File

@ -5,7 +5,7 @@
<p class="note"><?cs var:Lang.Text.InitWarning ?></p> <p class="note"><?cs var:Lang.Text.InitWarning ?></p>
<?cs if:Data.Config.AdminPasswordIsSet ?> <?cs if:Data.Config.AdminPasswordIsSet ?>
<p><label for="current_admin_password"><?cs call:help_popUp(Lang.Text.EnterAdminPassword,"prove_admin_pw") ?></label><br/> <p><label for="current_admin_password"><?cs call:help_popUp(Lang.Text.EnterCurrentAdminPassword,"prove_admin_pw") ?></label><br/>
<input type="password" id="current_admin_password" name="current_admin_password" size="20" tabindex="1" maxlength="40" /> </p> <input type="password" id="current_admin_password" name="current_admin_password" size="20" tabindex="1" maxlength="40" /> </p>
<?cs /if ?> <?cs /if ?>
<p><label for="admin_password"><?cs call:help_popUp(Lang.Text.EnterNewAdminPassword,"new_admin_pw") ?></label><br/> <p><label for="admin_password"><?cs call:help_popUp(Lang.Text.EnterNewAdminPassword,"new_admin_pw") ?></label><br/>

View File

@ -70,6 +70,7 @@
<?cs def:help_popUp_broken(text,filename) ?><?cs # <?cs def:help_popUp_broken(text,filename) ?><?cs #
# show a pop-up information block on the right side of the screen # show a pop-up information block on the right side of the screen
# usually good for small explanatory texts # usually good for small explanatory texts
# does not work for ie?
?><a class="popup"><?cs ?><a class="popup"><?cs
var:text ?><span><?cs var:text ?><span><?cs
linclude:Settings.DocDir + '/' + Settings.DocLang + '/hints/' + filename + '.html' ?></span></a><?cs linclude:Settings.DocDir + '/' + Settings.DocLang + '/hints/' + filename + '.html' ?></span></a><?cs

View File

@ -1,13 +1,13 @@
<h1>Aktivierung des verschl&uuml;sselten Dateisystems</h1> <h1><?cs var:Lang.Title.Mount ?></h1>
<div align="center"> <div align="center">
<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="crypto_passwort">Passwort eingeben:</label> <p><label for="crypto_passwort"><?cs var:Lang.Text.EnterCurrentCryptoPassword ?></label>
<input type="password" id="crypto_password" name="crypto_password" size="20" tabindex="0" maxlength="40" /></p> <input type="password" id="crypto_password" name="crypto_password" size="20" tabindex="0" maxlength="40" /></p>
<button type="submit" name="action" value="mount_do">Dateisystem aktivieren</button> <button type="submit" name="action" value="mount_do"><?cs var:Lang.Button.Mount ?></button>
</form> </form>
</div> </div>

View File

@ -13,7 +13,7 @@ use ConfigFile;
my ($pagedata, $pagename); my ($pagedata, $pagename);
my ($LANGUAGE_DIR, $LANGUAGE, $HTML_TEMPLATE_DIR, $DOC_DIR); my ($LANGUAGE_DIR, $DEFAULT_LANGUAGE, $HTML_TEMPLATE_DIR, $DOC_DIR);
my ($CB_SCRIPT, $LOG_FILE, $IS_DEV); my ($CB_SCRIPT, $LOG_FILE, $IS_DEV);
my $config = ConfigFile::read_config_file('/etc/cryptobox/cryptobox.conf'); my $config = ConfigFile::read_config_file('/etc/cryptobox/cryptobox.conf');
@ -21,12 +21,13 @@ my $config = ConfigFile::read_config_file('/etc/cryptobox/cryptobox.conf');
$CB_SCRIPT = $config->{CB_SCRIPT}; $CB_SCRIPT = $config->{CB_SCRIPT};
$LOG_FILE = $config->{LOG_FILE}; $LOG_FILE = $config->{LOG_FILE};
$LANGUAGE_DIR = $config->{LANGUAGE_DIR}; $LANGUAGE_DIR = $config->{LANGUAGE_DIR};
# language setting may be later overriden by "weblang" $DEFAULT_LANGUAGE = $config->{LANGUAGE};
$LANGUAGE = $config->{LANGUAGE};
$HTML_TEMPLATE_DIR = $config->{HTML_TEMPLATE_DIR}; $HTML_TEMPLATE_DIR = $config->{HTML_TEMPLATE_DIR};
$DOC_DIR = $config->{DOC_DIR}; $DOC_DIR = $config->{DOC_DIR};
$IS_DEV = ( -e $config->{DEV_FEATURES_SCRIPT}); $IS_DEV = ( -e $config->{DEV_FEATURES_SCRIPT});
my $query = new CGI;
#################### subs ###################### #################### subs ######################
@ -47,24 +48,52 @@ sub load_hdf
(my $script_url = $ENV{'SCRIPT_NAME'}) =~ m/^[^&]*/; (my $script_url = $ENV{'SCRIPT_NAME'}) =~ m/^[^&]*/;
$hdf->setValue("ScriptName", ($ENV{'SCRIPT_NAME'} eq '/')? '/cryptobox' : $script_url ); $hdf->setValue("ScriptName", ($ENV{'SCRIPT_NAME'} eq '/')? '/cryptobox' : $script_url );
&load_language_data($hdf, $LANGUAGE);
&get_available_languages($hdf); &get_available_languages($hdf);
return $hdf; return $hdf;
} }
sub load_language_data sub load_selected_language
# import the specified language data
# every call overrides previously loaded values
# it is sufficient to call it somewhere before "render"
{ {
my $data = shift; my $data = shift;
my $lang = shift; my $config_language;
my $fname = "$LANGUAGE_DIR/$lang" . '.hdf';
die ("Language file ($fname) not found!") unless (-e "$fname"); # load $DEFAULT_LANGUAGE - this is necessary, if a translation is incomplete
$data->readFile("$fname"); $data->readFile("$LANGUAGE_DIR/$DEFAULT_LANGUAGE" . ".hdf");
# load configured language, if it is valid
$config_language = `$CB_SCRIPT get_config language`;
$config_language = $DEFAULT_LANGUAGE unless (&validate_language("$config_language"));
######### 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)) {
# load the data
$config_language = "$weblang";
# add the setting to every link
$pagedata->setValue('Data.PostData.weblang', "$weblang");
} else {
$pagedata->setValue('Data.Warning', 'InvalidLanguage');
}
}
# import the configured resp. the temporarily selected language
$data->readFile("$LANGUAGE_DIR/$config_language" . ".hdf");
########## select documentation language ##########
if (&validate_doc_language($config_language)) {
# selected web interface language
$pagedata->setValue('Settings.DocLang', "$config_language");
} elsif (&validate_doc_language($DEFAULT_LANGUAGE)) {
# configured CryptoBox language
$pagedata->setValue('Settings.DocLang', "$DEFAULT_LANGUAGE");
} else {
# default hardcoded language (english)
$pagedata->setValue('Settings.DocLang', "en");
}
} }
@ -75,7 +104,7 @@ sub get_available_languages
my ($file, @files, $hdf, $lang_name); my ($file, @files, $hdf, $lang_name);
opendir(DIR, $LANGUAGE_DIR) or die ("Language directory ($LANGUAGE_DIR) not accessible!"); opendir(DIR, $LANGUAGE_DIR) or die ("Language directory ($LANGUAGE_DIR) not accessible!");
@files = grep { /.*\.hdf$/ } readdir(DIR); @files = sort grep { /.*\.hdf$/ } readdir(DIR);
close(DIR); close(DIR);
foreach $file (@files) { foreach $file (@files) {
@ -146,6 +175,8 @@ sub get_admin_pw
sub render sub render
{ {
&load_selected_language($pagedata);
$pagedata->setValue("PageName","$pagename"); $pagedata->setValue("PageName","$pagename");
my $pagefile = "$HTML_TEMPLATE_DIR/main.cs"; my $pagefile = "$HTML_TEMPLATE_DIR/main.cs";
print "Content-Type: text/html\n\n"; print "Content-Type: text/html\n\n";
@ -260,40 +291,10 @@ sub validate_doc_language
################### main ######################### ################### main #########################
my $query = new CGI;
$pagedata = load_hdf(); $pagedata = load_hdf();
######### 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)) {
# load the data
&load_language_data($pagedata, "$weblang");
# add the setting to every link
$pagedata->setValue('Data.PostData.weblang', "$weblang");
} else {
$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');

View File

@ -38,7 +38,7 @@ function do_series()
{ {
[ -d "$VALIDATE_REPORT_DIR/$1" ] && rm -r "$VALIDATE_REPORT_DIR/$1" [ -d "$VALIDATE_REPORT_DIR/$1" ] && rm -r "$VALIDATE_REPORT_DIR/$1"
mkdir -p "$VALIDATE_REPORT_DIR/$1" mkdir -p "$VALIDATE_REPORT_DIR/$1"
find "$VALIDATE_TEST_CASES_DIR/$1" -type d -maxdepth 1 -mindepth 1 | grep -v "/\.[^/]*$" | sort | while read a find "$VALIDATE_TEST_CASES_DIR/$1" -maxdepth 1 -mindepth 1 -type d | grep -v "/\.[^/]*$" | sort | while read a
do do_single "$a" "$VALIDATE_REPORT_DIR/$1" do do_single "$a" "$VALIDATE_REPORT_DIR/$1"
done done
create_summary "$1" >"$VALIDATE_REPORT_DIR/summary-$1.html" create_summary "$1" >"$VALIDATE_REPORT_DIR/summary-$1.html"
@ -49,7 +49,7 @@ function create_summary()
# parameter: name of test series # parameter: name of test series
{ {
cat "$VALIDATE_SUMMARY_TEMPLATE_DIR/header" cat "$VALIDATE_SUMMARY_TEMPLATE_DIR/header"
find "$VALIDATE_REPORT_DIR/$1" -type f -name \*.desc -maxdepth 1 | sort | while read a find "$VALIDATE_REPORT_DIR/$1" -maxdepth 1 -type f -name \*.desc | sort | while read a
do TESTNAME=$(basename ${a%.desc}) do TESTNAME=$(basename ${a%.desc})
TESTDESCRIPTION=$(cat $a) TESTDESCRIPTION=$(cat $a)
sed "s#_TESTSERIES_#$1#g; s#_TESTNAME_#$TESTNAME#g; s/_TESTDESCRIPTION_/$TESTDESCRIPTION/" "$VALIDATE_SUMMARY_TEMPLATE_DIR/single_header" sed "s#_TESTSERIES_#$1#g; s#_TESTNAME_#$TESTNAME#g; s/_TESTDESCRIPTION_/$TESTDESCRIPTION/" "$VALIDATE_SUMMARY_TEMPLATE_DIR/single_header"
@ -102,7 +102,7 @@ ACTION="--help"
case "$ACTION" in case "$ACTION" in
list ) list )
find "$VALIDATE_TEST_CASES_DIR" -type d -maxdepth 1 -mindepth 1 | grep -v "/\.[^/]*$" | sort | while read a find "$VALIDATE_TEST_CASES_DIR" -maxdepth 1 -mindepth 1 -type d | grep -v "/\.[^/]*$" | sort | while read a
do echo $(basename "$a") do echo $(basename "$a")
done done
;; ;;