2006-08-14 17:40:12 +02:00
|
|
|
<?cs # $Id$ ?><?cs
|
|
|
|
|
2006-11-02 15:00:28 +01:00
|
|
|
def:link(path, attr1, value1, attr2, value2)
|
2006-11-06 07:17:13 +01:00
|
|
|
?><?cs # first: override previous content of "Temp"
|
2006-11-02 15:00:28 +01:00
|
|
|
?><?cs each:attrs = Temp
|
|
|
|
?><?cs set:attrs = ""
|
|
|
|
?><?cs /each
|
|
|
|
?><?cs each:attrs = Settings.LinkAttrs
|
2006-11-06 07:17:13 +01:00
|
|
|
?><?cs set:Temp[name(attrs)] = attrs
|
2006-11-02 15:00:28 +01:00
|
|
|
?><?cs /each
|
|
|
|
?><?cs if:attr1 != "" ?><?cs set:Temp[attr1] = value1 ?><?cs /if
|
|
|
|
?><?cs if:attr2 != "" ?><?cs set:Temp[attr2] = value2 ?><?cs /if
|
2006-11-06 07:17:13 +01:00
|
|
|
?><?cs var:path
|
2006-11-02 15:00:28 +01:00
|
|
|
?><?cs set:first_each = 1
|
|
|
|
?><?cs if:subcount(Temp) > 0
|
|
|
|
?><?cs each:attrs = Temp
|
|
|
|
?><?cs if:(name(attrs) != "") && (attrs != "")
|
|
|
|
?><?cs if:first_each == 1 ?><?cs
|
|
|
|
set:first_each = 0 ?>?<?cs
|
|
|
|
else
|
|
|
|
?>&<?cs /if
|
|
|
|
?><?cs var:url_escape(name(attrs)) ?>=<?cs var:url_escape(attrs)
|
|
|
|
?><?cs /if
|
|
|
|
?><?cs /each
|
|
|
|
?><?cs /if ?><?cs
|
|
|
|
/def ?><?cs
|
|
|
|
|
|
|
|
|
2006-11-06 07:17:13 +01:00
|
|
|
def:show_messageNode(node) ?><?cs
|
|
|
|
# expects a node of the hdf tree containing a warning/success/environment message
|
|
|
|
?><td class="text"><?cs
|
|
|
|
if:?node.Title ?><h1><?cs var:html_escape(node.Title) ?></h1><?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
|
2006-11-03 15:27:48 +01:00
|
|
|
/def ?><?cs
|
|
|
|
|
|
|
|
|
2006-09-14 14:33:01 +02:00
|
|
|
# the following macro is as ugly as possible - but somehow we have to manage
|
|
|
|
to use 'normal' and 'plugin' messages in a clean way:
|
2006-11-06 07:17:13 +01:00
|
|
|
- Lang.WarningMessage.???: defined by core functions
|
|
|
|
- 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
|
2006-09-14 14:33:01 +02:00
|
|
|
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:
|
|
|
|
plugPrefix, PlugSuffix = mname[0:mname.find(".",8), mname[mname.find(".",8)+1:]
|
|
|
|
?><?cs loop:x = #8, #40, #1 ?><?cs if:(string.slice(mname,x,x+1) == ".") && !(?savedX) ?><?cs set:savedX = x ?><?cs /if ?><?cs /loop
|
|
|
|
?><?cs set:plugPrefix = string.slice(mname,0,savedX)
|
|
|
|
?><?cs set:plugSuffix = string.slice(mname,savedX+1,string.length(mname))
|
2006-11-02 15:00:28 +01:00
|
|
|
?><?cs # choose the appropriate symbol file
|
2006-11-06 07:17:13 +01:00
|
|
|
?><?cs if:type == "success" ?><?cs
|
|
|
|
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"
|
2006-11-02 15:00:28 +01:00
|
|
|
?><?cs /if
|
2006-09-14 14:33:01 +02:00
|
|
|
?><?cs # preparations are done - now start writing
|
2006-11-06 07:17:13 +01:00
|
|
|
?><div class="message"><table><tr><td class="message_symbol"><img src="<?cs
|
2006-11-02 15:00:28 +01:00
|
|
|
call:link('cryptobox-misc/' + symbolFile,'','','','')
|
2006-11-06 07:17:13 +01:00
|
|
|
?>" alt="icon: info" /></td><?cs
|
2006-09-14 14:33:01 +02:00
|
|
|
# check if it is a 'normal' message ?><?cs
|
2006-11-06 07:17:13 +01:00
|
|
|
if:subcount(Lang[category][mname]) > 0 ?><?cs
|
2006-11-03 15:27:48 +01:00
|
|
|
call:show_messageNode(Lang[category][mname]) ?><?cs
|
|
|
|
# check if the mname starts with "Plugins." ... ?><?cs
|
2006-11-06 07:17:13 +01:00
|
|
|
elif:(string.slice(mname,0,8) == "Plugins.") && subcount(Lang[plugPrefix][category][plugSuffix]) > 0 ?><?cs
|
2006-11-03 15:27:48 +01:00
|
|
|
call:show_messageNode(Lang[plugPrefix][category][plugSuffix]) ?><?cs
|
|
|
|
# the message does not seem to exist ... ?><?cs
|
2006-09-14 14:33:01 +02:00
|
|
|
else ?>
|
2006-11-06 07:17:13 +01:00
|
|
|
<td><h1>unknown <?cs var:type ?> message</h1>
|
|
|
|
could not find <?cs var:type ?> message: '<?cs var:mname ?>'</td><?cs
|
|
|
|
/if ?></tr></table></div><?cs
|
2006-08-14 17:40:12 +02:00
|
|
|
/def ?><?cs
|
|
|
|
|
|
|
|
|
2006-11-06 07:17:13 +01:00
|
|
|
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
|
2006-08-14 17:40:12 +02:00
|
|
|
/def ?><?cs
|
|
|
|
|
|
|
|
|
2006-11-06 07:17:13 +01:00
|
|
|
def:warning(mname)
|
|
|
|
?><?cs call:message_dispatch(mname, "warning", "WarningMessage") ?><?cs
|
2006-09-14 14:33:01 +02:00
|
|
|
/def ?><?cs
|
|
|
|
|
|
|
|
|
|
|
|
def:success(mname)
|
|
|
|
?><?cs call:message_dispatch(mname, "success", "SuccessMessage") ?><?cs
|
2006-08-14 17:40:12 +02:00
|
|
|
/def ?><?cs
|
|
|
|
|
|
|
|
|
2006-10-26 14:26:52 +02:00
|
|
|
def:print_form_header(form_name, action) ?><?cs #
|
2006-08-14 17:40:12 +02:00
|
|
|
# the header of a form - including Setting.LinkAttrs
|
2006-10-26 14:26:52 +02:00
|
|
|
?><form name="<?cs var:html_escape(form_name) ?>" action="<?cs call:link(action,"","","","") ?>" method="post" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"><?cs
|
2006-10-31 03:50:29 +01:00
|
|
|
/def ?><?cs
|
|
|
|
|
|
|
|
|
2006-11-01 10:28:48 +01:00
|
|
|
def:show_plugin(plugin, type) ?><?cs
|
|
|
|
# show the icon and the name of a plugin of a give type (system/volume/menu) ?>
|
2006-11-02 15:00:28 +01:00
|
|
|
<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 ?>">
|
2006-11-06 07:17:13 +01:00
|
|
|
<a href="<?cs call:link(plugin,'','','','') ?>" title="<?cs var:html_escape(Settings.PluginList[plugin].Link) ?>">
|
|
|
|
<img src="<?cs call:link('icons/' + plugin, '','','','') ?>" alt="<?cs var:html_escape('icon: ' + plugin) ?>" /><br/><?cs
|
2006-11-01 10:28:48 +01:00
|
|
|
var:html_escape(Settings.PluginList[plugin].Link) ?></a></div><?cs
|
|
|
|
/def ?><?cs
|
|
|
|
|
|
|
|
|
2006-11-03 15:27:48 +01:00
|
|
|
def:show_volume_icon(volume) ?><?cs
|
|
|
|
# show the appropriate icon for the current state of the volume ?>
|
|
|
|
<?cs if:volume.active ?><?cs
|
|
|
|
if:volume.encryption ?><?cs
|
2006-11-01 10:28:48 +01:00
|
|
|
set:filename='volume_active_crypto.png' ?><?cs
|
|
|
|
else ?><?cs
|
|
|
|
set:filename='volume_active_plain.png' ?><?cs
|
|
|
|
/if ?><?cs
|
|
|
|
else ?><?cs
|
2006-11-03 15:27:48 +01:00
|
|
|
if:volume.encryption ?><?cs
|
2006-11-01 10:28:48 +01:00
|
|
|
set:filename='volume_passive_crypto.png' ?><?cs
|
|
|
|
else ?><?cs
|
|
|
|
set:filename='volume_passive_plain.png' ?><?cs
|
|
|
|
/if ?><?cs
|
|
|
|
/if ?>
|
2006-11-03 15:27:48 +01:00
|
|
|
<img src="<?cs call:link('cryptobox-misc/' + filename,'','','','') ?>" alt="icon: volume" /><?cs
|
|
|
|
/def ?><?cs
|
|
|
|
|
|
|
|
|
|
|
|
def:show_volume(volume) ?><?cs
|
|
|
|
# show the icon of the volume ?>
|
2006-11-01 10:28:48 +01:00
|
|
|
<div class="volume">
|
2006-11-06 07:17:13 +01:00
|
|
|
<a href="<?cs call:link('volume_mount','device',volume.device,'','') ?>" title="<?cs var:html_escape(volume.name) ?>">
|
2006-11-03 15:27:48 +01:00
|
|
|
<?cs call:show_volume_icon(volume) ?><br/><?cs
|
|
|
|
var:html_escape(volume.name) ?> (<?cs
|
|
|
|
var:html_escape(volume.size) ?>)</a></div><?cs
|
2006-11-02 15:00:28 +01:00
|
|
|
/def ?><?cs
|
|
|
|
|
|
|
|
|
|
|
|
def:help_link(pagename) ?><?cs
|
|
|
|
# show an iconed link to a specific help page for the current form ?>
|
|
|
|
<div class="help_link">
|
2006-11-06 07:17:13 +01:00
|
|
|
<a href="<?cs call:link('help','page',pagename,'','') ?>" title="<?cs var:html_escape(Lang.Button.HelpForForm) ?>">
|
2006-11-02 15:00:28 +01:00
|
|
|
<?cs var:html_escape(Lang.Button.HelpForForm) ?>
|
2006-11-06 07:17:13 +01:00
|
|
|
<img class="message_symbol" src="/icons/help" alt="icon: help" />
|
2006-11-02 15:00:28 +01:00
|
|
|
</a></div><?cs
|
|
|
|
/def ?><?cs
|
|
|
|
|
|
|
|
|
|
|
|
def:handle_messages() ?><?cs
|
|
|
|
# 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:Data.Warning ?><?cs call:warning(Data.Warning) ?><?cs /if
|
|
|
|
?><?cs if:Data.Success ?><?cs call:success(Data.Success) ?><?cs /if
|
|
|
|
?><?cs set:messages_are_handled = 1 ?><?cs
|
2006-08-14 17:40:12 +02:00
|
|
|
/def ?>
|
|
|
|
|
2006-11-01 10:28:48 +01:00
|
|
|
|
2006-11-02 15:00:28 +01:00
|
|
|
|