cryptonas-archive/v0.2.1/cbox-tree.d/usr/share/cryptobox/templates/macros.cs

94 lines
2.7 KiB
C#
Raw Normal View History

2005-10-24 12:19:17 +02:00
<!-- $Id: macros.cs 295 2005-10-11 23:21:32Z lars $ -->
<?cs def:warning(warnname) ?><?cs
each:item = Lang.WarningMessage ?><?cs
if:(name(item) == warnname)
?><div class="warning">
<h1><?cs var:item.Title ?></h1>
<p><?cs var:item.Text ?></p></div>
<?cs
/if ?><?cs
/each ?><?cs
/def ?>
<?cs def:error(errname) ?><?cs
each:item = Lang.ErrorMessage ?><?cs
if:(name(item) == errname)
?><div class="error">
<h1><?cs var:item.Title ?></h1>
<p><?cs var:item.Text ?></p></div>
<?cs
/if ?><?cs
/each ?><?cs
/def ?>
<?cs def:success(succname) ?><?cs
each:item = Lang.SuccessMessage ?><?cs
if:(name(item) == succname)
?><div class="success">
<h1><?cs var:item.Title ?></h1>
<p><?cs var:item.Text ?></p></div>
<?cs
/if ?><?cs
/each ?><?cs
/def ?>
<?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: both parameters have to be defined!
?><?cs 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 ?>
<?cs def:help_popUp_broken(text,filename) ?><?cs #
# show a pop-up information block on the right side of the screen
# usually good for small explanatory texts
# does not work for ie?
?><a class="popup"><?cs
var:text ?><span><?cs
linclude:Settings.DocDir + '/' + Settings.DocLang + '/hints/' + filename + '.html' ?></span></a><?cs
/def ?>
<?cs def:help_popUp(text,filename) ?><?cs #
# TODO: remove this, if on-screen help will die :)
?><?cs var:text ?><?cs
/def ?>
<?cs def:print_form_header() ?><?cs #
# the header of a form - including Data.PostData values as hidden fields
?><form action="<?cs var:ScriptName ?>" method="post" enctype="application/x-www-from-urlencoded" accept-charset="utf-8">
<?cs each:item = Data.PostData
?><input type="hidden" name="<?cs name:item ?>" value="<?cs var:item ?>" /><?cs
/each ?><?cs
/def ?>