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

71 lines
1.9 KiB
Smalltalk

<?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: there is a bug (?) in clearsilver, that occours, if
# only one of the arguments is set (none or both are fine)
?><?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 ?>