removed obsolete "error" (superseded by general warnings)
fixed link macro (url_escape was called twice) added new "link" feature to message macro unified "hint" and common message macro added EnvironmentWarning to header
This commit is contained in:
parent
f2c9fbefc1
commit
7905fe7051
5 changed files with 66 additions and 74 deletions
|
@ -1,3 +0,0 @@
|
||||||
<?cs # $Id$ ?>
|
|
||||||
|
|
||||||
<?cs call:error(Data.Error) ?>
|
|
|
@ -17,6 +17,7 @@
|
||||||
<!-- CBOX-STATUS-begin - used for validation - do not touch!
|
<!-- CBOX-STATUS-begin - used for validation - do not touch!
|
||||||
Settings.Language=<?cs var:html_escape(Settings.Language) ?>
|
Settings.Language=<?cs var:html_escape(Settings.Language) ?>
|
||||||
Data.Version=<?cs var:html_escape(Data.Version) ?>
|
Data.Version=<?cs var:html_escape(Data.Version) ?>
|
||||||
|
Data.ScriptURL=<?cs var:html_escape(Data.ScriptURL) ?>
|
||||||
<?cs each:x = Data.Status.Plugins ?>Data.Status.Plugins.<?cs
|
<?cs each:x = Data.Status.Plugins ?>Data.Status.Plugins.<?cs
|
||||||
var:name(x) ?>=<?cs var: html_escape(x) ?>
|
var:name(x) ?>=<?cs var: html_escape(x) ?>
|
||||||
<?cs /each
|
<?cs /each
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
<?cs # $Id$ ?>
|
|
||||||
|
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
|
||||||
|
<?cs # $Id$ ?>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>CryptoBox</title>
|
<title>CryptoBox</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
@ -25,34 +26,15 @@
|
||||||
<?cs call:show_plugin(name(x), 'menu') ?><?cs /if ?><?cs
|
<?cs call:show_plugin(name(x), 'menu') ?><?cs /if ?><?cs
|
||||||
/each ?><?cs
|
/each ?><?cs
|
||||||
/loop ?>
|
/loop ?>
|
||||||
|
|
||||||
<?cs # to avoid duplicate POST variables, we have to remove the weblang attribute
|
|
||||||
from the action destination of the language selection form header ?><?cs
|
|
||||||
if:?Settings.LinkAttrs.weblang ?><?cs
|
|
||||||
# remove the link attr before writing the form header ?><?cs
|
|
||||||
set:old_weblang = Settings.LinkAttrs.weblang ?><?cs
|
|
||||||
set:Settings.LinkAttrs.weblang = '' ?><?cs
|
|
||||||
call:print_form_header("select_language",'') ?><?cs
|
|
||||||
# restore the old setting ?><?cs
|
|
||||||
set:Settings.LinkAttrs.weblang = old_weblang ?><?cs
|
|
||||||
else ?><?cs
|
|
||||||
# otherwise: simply call it as usual ?><?cs
|
|
||||||
call:print_form_header("select_language",'') ?><?cs
|
|
||||||
/if ?>
|
|
||||||
<div id="lang">
|
|
||||||
<select name="weblang">
|
|
||||||
<?cs each:item = Data.Languages ?>
|
|
||||||
<option value="<?cs var:name(item) ?>" <?cs
|
|
||||||
if:Settings.Language == name(item) ?>selected="selected"<?cs /if
|
|
||||||
?>><?cs var:item ?></option><?cs /each ?>
|
|
||||||
</select><br/>
|
|
||||||
<button type="submit"><?cs var:html_escape(Lang.Button.SelectLanguage) ?></button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div id="main">
|
<div id="main">
|
||||||
|
|
||||||
|
<?cs if:?Data.EnvironmentWarning
|
||||||
|
?><div id="EnvironmentWarning"><?cs
|
||||||
|
call:environment_warning(Data.EnvironmentWarning) ?></div><?cs /if ?>
|
||||||
|
|
||||||
<div id="head">
|
<div id="head">
|
||||||
<table>
|
<table>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
|
@ -69,11 +51,5 @@
|
||||||
</td></tr></table>
|
</td></tr></table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?cs if:?Data.EnvironmentWarning ?>
|
|
||||||
<div id="EnvironmentWarning">
|
|
||||||
<?cs call:warning(Data.EnvironmentWarning) ?>
|
|
||||||
</div>
|
|
||||||
<?cs /if ?>
|
|
||||||
|
|
||||||
<div id="words">
|
<div id="words">
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
<?cs # $Id$ ?><?cs
|
<?cs # $Id$ ?><?cs
|
||||||
|
|
||||||
def:link(path, attr1, value1, attr2, value2)
|
def:link(path, attr1, value1, attr2, value2)
|
||||||
|
?><?cs # first: override previous content of "Temp"
|
||||||
?><?cs each:attrs = Temp
|
?><?cs each:attrs = Temp
|
||||||
?><?cs set:attrs = ""
|
?><?cs set:attrs = ""
|
||||||
?><?cs /each
|
?><?cs /each
|
||||||
?><?cs each:attrs = Settings.LinkAttrs
|
?><?cs each:attrs = Settings.LinkAttrs
|
||||||
?><?cs set:Temp[url_escape(name(attrs))] = url_escape(attrs)
|
?><?cs set:Temp[name(attrs)] = attrs
|
||||||
?><?cs /each
|
?><?cs /each
|
||||||
?><?cs if:attr1 != "" ?><?cs set:Temp[attr1] = value1 ?><?cs /if
|
?><?cs if:attr1 != "" ?><?cs set:Temp[attr1] = value1 ?><?cs /if
|
||||||
?><?cs if:attr2 != "" ?><?cs set:Temp[attr2] = value2 ?><?cs /if
|
?><?cs if:attr2 != "" ?><?cs set:Temp[attr2] = value2 ?><?cs /if
|
||||||
?><?cs var:ScriptName
|
?><?cs var:path
|
||||||
?>/<?cs var:path
|
|
||||||
?><?cs set:first_each = 1
|
?><?cs set:first_each = 1
|
||||||
?><?cs if:subcount(Temp) > 0
|
?><?cs if:subcount(Temp) > 0
|
||||||
?><?cs each:attrs = Temp
|
?><?cs each:attrs = Temp
|
||||||
|
@ -26,18 +26,33 @@ def:link(path, attr1, value1, attr2, value2)
|
||||||
/def ?><?cs
|
/def ?><?cs
|
||||||
|
|
||||||
|
|
||||||
def:show_messageNode(node) ?>
|
def:show_messageNode(node) ?><?cs
|
||||||
<h1><?cs var:html_escape(node.Title) ?></h1>
|
# expects a node of the hdf tree containing a warning/success/environment message
|
||||||
<p><?cs var:html_escape(node.Text) ?></p><?cs
|
?><td class="text"><?cs
|
||||||
if:?node.Link.Text ?>
|
if:?node.Title ?><h1><?cs var:html_escape(node.Title) ?></h1><?cs /if ?><?cs
|
||||||
<p class="message_link"><a href="<?cs var:node.Link.Link ?>" title="<?cs var:html_escape(node.Link.Text) ?>"><?cs var:html_escape(node.Link.Text) ?></a></p><?cs /if ?><?cs
|
if:?node.Text ?><?cs var:html_escape(node.Text) ?><?cs /if ?></td><?cs
|
||||||
|
if:subcount(node.Link) > 0
|
||||||
|
?><td class="link"><a href="<?cs
|
||||||
|
if:node.Link.Abs ?><?cs
|
||||||
|
var:node.Link.Abs ?><?cs
|
||||||
|
elif:node.Link.Prot ?><?cs
|
||||||
|
var:node.Link.Prot + "://" + Data.ScriptURL.Host + Data.ScriptURL.Path + node.Link.Rel ?><?cs
|
||||||
|
else ?><?cs
|
||||||
|
call:link(node.Link.Rel, node.Link.Attr1.name, node.Link.Attr1.value, node.Link.Attr2.name, node.Link.Attr2.value) ?><?cs
|
||||||
|
/if ?>" title="<?cs var:html_escape(node.Link.Text) ?>"><?cs
|
||||||
|
var:html_escape(node.Link.Text) ?></a></td><?cs /if ?><?cs
|
||||||
/def ?><?cs
|
/def ?><?cs
|
||||||
|
|
||||||
|
|
||||||
# the following macro is as ugly as possible - but somehow we have to manage
|
# the following macro is as ugly as possible - but somehow we have to manage
|
||||||
to use 'normal' and 'plugin' messages in a clean way:
|
to use 'normal' and 'plugin' messages in a clean way:
|
||||||
Lang.WarningMessage.??? - used by core functions
|
- Lang.WarningMessage.???: defined by core functions
|
||||||
Lang.Plugins.PLUGINNAME.WarningMessage.??? - used by plugins ?><?cs
|
- Lang.Plugins.PLUGINNAME.WarningMessage.???: defined by plugins
|
||||||
|
parameters:
|
||||||
|
- mname: name of the message (e.g.: "InvalidInput")
|
||||||
|
- type: choose one: { warning | success | environment_warning }
|
||||||
|
- category: choose one: { WarningMessage | SuccessMessage | EnvironmentWarning }
|
||||||
|
?><?cs
|
||||||
def:message_dispatch(mname, type, category)
|
def:message_dispatch(mname, type, category)
|
||||||
?><?cs # split the message name into a (potentially existing) plugin-name prefix and the suffix (the python equivalent of the following three lines would be:
|
?><?cs # split the message name into a (potentially existing) plugin-name prefix and the suffix (the python equivalent of the following three lines would be:
|
||||||
plugPrefix, PlugSuffix = mname[0:mname.find(".",8), mname[mname.find(".",8)+1:]
|
plugPrefix, PlugSuffix = mname[0:mname.find(".",8), mname[mname.find(".",8)+1:]
|
||||||
|
@ -45,24 +60,41 @@ def:message_dispatch(mname, type, category)
|
||||||
?><?cs set:plugPrefix = string.slice(mname,0,savedX)
|
?><?cs set:plugPrefix = string.slice(mname,0,savedX)
|
||||||
?><?cs set:plugSuffix = string.slice(mname,savedX+1,string.length(mname))
|
?><?cs set:plugSuffix = string.slice(mname,savedX+1,string.length(mname))
|
||||||
?><?cs # choose the appropriate symbol file
|
?><?cs # choose the appropriate symbol file
|
||||||
?><?cs if:type == "success" ?><?cs set:symbolFile = "dialog-information_tango.png"
|
?><?cs if:type == "success" ?><?cs
|
||||||
?><?cs elif:type == "warning" ?><?cs set:symbolFile = "dialog-error_tango.png"
|
set:symbolFile = "dialog-information_tango.png"
|
||||||
|
?><?cs elif:type == "warning" ?><?cs
|
||||||
|
set:symbolFile = "dialog-error_tango.png"
|
||||||
|
?><?cs elif type == "environment_warning" ?><?cs
|
||||||
|
set:symbolFile = "dialog-error_tango.png"
|
||||||
|
?><?cs elif type == "hint" ?><?cs
|
||||||
|
set:symbolFile = "dialog-warning_tango.png"
|
||||||
?><?cs /if
|
?><?cs /if
|
||||||
?><?cs # preparations are done - now start writing
|
?><?cs # preparations are done - now start writing
|
||||||
?><div class="message"><table><tr><td><img class="message_symbol" src="<?cs
|
?><div class="message"><table><tr><td class="message_symbol"><img src="<?cs
|
||||||
call:link('cryptobox-misc/' + symbolFile,'','','','')
|
call:link('cryptobox-misc/' + symbolFile,'','','','')
|
||||||
?>" alt="icon: info" /></td><td><?cs
|
?>" alt="icon: info" /></td><?cs
|
||||||
# check if it is a 'normal' message ?><?cs
|
# check if it is a 'normal' message ?><?cs
|
||||||
if:?Lang[category][mname].Title ?><?cs
|
if:subcount(Lang[category][mname]) > 0 ?><?cs
|
||||||
call:show_messageNode(Lang[category][mname]) ?><?cs
|
call:show_messageNode(Lang[category][mname]) ?><?cs
|
||||||
# check if the mname starts with "Plugins." ... ?><?cs
|
# check if the mname starts with "Plugins." ... ?><?cs
|
||||||
elif:(string.slice(mname,0,8) == "Plugins.") && ?Lang[plugPrefix][category][plugSuffix].Title ?><?cs
|
elif:(string.slice(mname,0,8) == "Plugins.") && subcount(Lang[plugPrefix][category][plugSuffix]) > 0 ?><?cs
|
||||||
call:show_messageNode(Lang[plugPrefix][category][plugSuffix]) ?><?cs
|
call:show_messageNode(Lang[plugPrefix][category][plugSuffix]) ?><?cs
|
||||||
# the message does not seem to exist ... ?><?cs
|
# the message does not seem to exist ... ?><?cs
|
||||||
else ?>
|
else ?>
|
||||||
<h1>unknown <?cs var:type ?> message</h1>
|
<td><h1>unknown <?cs var:type ?> message</h1>
|
||||||
<p>could not find <?cs var:type ?> message: '<?cs var:mname ?>'</p><?cs
|
could not find <?cs var:type ?> message: '<?cs var:mname ?>'</td><?cs
|
||||||
/if ?></td></tr></table></div><?cs
|
/if ?></tr></table></div><?cs
|
||||||
|
/def ?><?cs
|
||||||
|
|
||||||
|
|
||||||
|
def:environment_warning(mname)
|
||||||
|
?><?cs call:message_dispatch(mname, "environment_warning", "EnvironmentWarning") ?><?cs
|
||||||
|
/def ?><?cs
|
||||||
|
|
||||||
|
|
||||||
|
def:hint(mname) ?><?cs
|
||||||
|
# show a warning hint
|
||||||
|
?><?cs call:message_dispatch(mname, "hint", "AdviceMessage") ?><?cs
|
||||||
/def ?><?cs
|
/def ?><?cs
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,11 +103,6 @@ def:warning(mname)
|
||||||
/def ?><?cs
|
/def ?><?cs
|
||||||
|
|
||||||
|
|
||||||
def:error(mname)
|
|
||||||
?><?cs call:message_dispatch(mname, "error", "ErrorMessage") ?><?cs
|
|
||||||
/def ?><?cs
|
|
||||||
|
|
||||||
|
|
||||||
def:success(mname)
|
def:success(mname)
|
||||||
?><?cs call:message_dispatch(mname, "success", "SuccessMessage") ?><?cs
|
?><?cs call:message_dispatch(mname, "success", "SuccessMessage") ?><?cs
|
||||||
/def ?><?cs
|
/def ?><?cs
|
||||||
|
@ -90,8 +117,8 @@ def:print_form_header(form_name, action) ?><?cs #
|
||||||
def:show_plugin(plugin, type) ?><?cs
|
def:show_plugin(plugin, type) ?><?cs
|
||||||
# show the icon and the name of a plugin of a give type (system/volume/menu) ?>
|
# show the icon and the name of a plugin of a give type (system/volume/menu) ?>
|
||||||
<div class="plugin_<?cs var:html_escape(type) ?> plugin_<?cs var:html_escape(type) ?>_<?cs if:Data.ActivePlugin == plugin ?>active<?cs else ?>passive<?cs /if ?>">
|
<div class="plugin_<?cs var:html_escape(type) ?> plugin_<?cs var:html_escape(type) ?>_<?cs if:Data.ActivePlugin == plugin ?>active<?cs else ?>passive<?cs /if ?>">
|
||||||
<a href="<?cs call:link('plugins/' + plugin,'','','','') ?>" title="<?cs var:html_escape(Settings.PluginList[plugin].Link) ?>">
|
<a href="<?cs call:link(plugin,'','','','') ?>" title="<?cs var:html_escape(Settings.PluginList[plugin].Link) ?>">
|
||||||
<img src="<?cs call:link('icons/plugins/' + plugin, '','','','') ?>" alt="<?cs var:html_escape('icon: ' + plugin) ?>" /><br/><?cs
|
<img src="<?cs call:link('icons/' + plugin, '','','','') ?>" alt="<?cs var:html_escape('icon: ' + plugin) ?>" /><br/><?cs
|
||||||
var:html_escape(Settings.PluginList[plugin].Link) ?></a></div><?cs
|
var:html_escape(Settings.PluginList[plugin].Link) ?></a></div><?cs
|
||||||
/def ?><?cs
|
/def ?><?cs
|
||||||
|
|
||||||
|
@ -118,7 +145,7 @@ def:show_volume_icon(volume) ?><?cs
|
||||||
def:show_volume(volume) ?><?cs
|
def:show_volume(volume) ?><?cs
|
||||||
# show the icon of the volume ?>
|
# show the icon of the volume ?>
|
||||||
<div class="volume">
|
<div class="volume">
|
||||||
<a href="<?cs call:link('plugins/volume_mount','device',volume.device,'','') ?>" title="<?cs var:html_escape(volume.name) ?>">
|
<a href="<?cs call:link('volume_mount','device',volume.device,'','') ?>" title="<?cs var:html_escape(volume.name) ?>">
|
||||||
<?cs call:show_volume_icon(volume) ?><br/><?cs
|
<?cs call:show_volume_icon(volume) ?><br/><?cs
|
||||||
var:html_escape(volume.name) ?> (<?cs
|
var:html_escape(volume.name) ?> (<?cs
|
||||||
var:html_escape(volume.size) ?>)</a></div><?cs
|
var:html_escape(volume.size) ?>)</a></div><?cs
|
||||||
|
@ -128,25 +155,16 @@ def:show_volume(volume) ?><?cs
|
||||||
def:help_link(pagename) ?><?cs
|
def:help_link(pagename) ?><?cs
|
||||||
# show an iconed link to a specific help page for the current form ?>
|
# show an iconed link to a specific help page for the current form ?>
|
||||||
<div class="help_link">
|
<div class="help_link">
|
||||||
<a href="<?cs call:link('plugins/help','page',pagename,'','') ?>" title="<?cs var:html_escape(Lang.Button.HelpForForm) ?>">
|
<a href="<?cs call:link('help','page',pagename,'','') ?>" title="<?cs var:html_escape(Lang.Button.HelpForForm) ?>">
|
||||||
<?cs var:html_escape(Lang.Button.HelpForForm) ?>
|
<?cs var:html_escape(Lang.Button.HelpForForm) ?>
|
||||||
<img class="message_symbol" src="/icons/plugins/help" alt="icon: help" />
|
<img class="message_symbol" src="/icons/help" alt="icon: help" />
|
||||||
</a></div><?cs
|
</a></div><?cs
|
||||||
/def ?><?cs
|
/def ?><?cs
|
||||||
|
|
||||||
|
|
||||||
def:hint(text) ?><?cs
|
|
||||||
# show a warning hint ?>
|
|
||||||
<div class="message">
|
|
||||||
<table><tr><td><img class="message_symbol" src="/cryptobox-misc/dialog-warning_tango.png" alt="icon: warning" /></td>
|
|
||||||
<td><?cs var:html_escape(text) ?></td></tr></table></div><?cs
|
|
||||||
/def ?><?cs
|
|
||||||
|
|
||||||
|
|
||||||
def:handle_messages() ?><?cs
|
def:handle_messages() ?><?cs
|
||||||
# call this function once for every page - otherwise your risk to loose messages
|
# call this function once for every page - otherwise your risk to loose messages
|
||||||
?><?cs if:messages_are_handled ?>HANDLE_MESSAGE CALLED TWICE - PLEASE FIX THIS<?cs /if
|
?><?cs if:messages_are_handled ?>HANDLE_MESSAGE CALLED TWICE - PLEASE FIX THIS<?cs /if
|
||||||
?><?cs if:Data.Error ?><?cs include:Settings.TemplateDir + '/error.cs' ?><?cs /if
|
|
||||||
?><?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 set:messages_are_handled = 1 ?><?cs
|
?><?cs set:messages_are_handled = 1 ?><?cs
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<td <?cs if:Data.ActivePlugin == name(x)
|
<td <?cs if:Data.ActivePlugin == name(x)
|
||||||
?>class="volume_plugin_active"<?cs
|
?>class="volume_plugin_active"<?cs
|
||||||
else ?>class="volume_plugin_passive"<?cs
|
else ?>class="volume_plugin_passive"<?cs
|
||||||
/if ?>><a href="<?cs call:link('plugins/' + name(x),'device',Data.CurrentDisk.device,'','') ?>" title="<?cs var:html_escape(x.Link) ?>"><img src="<?cs call:link("icons/plugins/" + name(x),'','','','') ?>" alt="icon: <?cs var:html_escape(name(x)) ?>" /> <?cs var:html_escape(x.Link) ?></a></td><?cs
|
/if ?>><a href="<?cs call:link(name(x),'device',Data.CurrentDisk.device,'','') ?>" title="<?cs var:html_escape(x.Link) ?>"><img src="<?cs call:link("icons/" + name(x),'','','','') ?>" alt="icon: <?cs var:html_escape(name(x)) ?>" /> <?cs var:html_escape(x.Link) ?></a></td><?cs
|
||||||
/if ?><?cs
|
/if ?><?cs
|
||||||
/each ?><?cs
|
/each ?><?cs
|
||||||
/loop ?>
|
/loop ?>
|
||||||
|
|
Loading…
Reference in a new issue