cryptonas-branches/pythonrewrite/templates/macros.cs
2006-08-14 15:40:12 +00:00

82 lines
2.5 KiB
C#

<?cs # $Id$ ?><?cs
def:warning(warnname)
?><div class="warning"><?cs
if:?Lang.WarningMessage[warnname].Title
?>
<h1><?cs var:html_escape(Lang.WarningMessage[warnname].Title) ?></h1>
<p><?cs var:html_escape(Lang.WarningMessage[warnname].Text) ?></p>
<?cs else ?>
<h1>unknown warning message</h1>
<p>could not find warning message: '<?cs var:warnname ?>'</p>
<?cs /if ?></div><?cs
/def ?><?cs
def:error(errname)
?><div class="error"><?cs
if:?Lang.ErrorMessage[errname].Title
?>
<h1><?cs var:html_escape(Lang.ErrorMessage[errname].Title) ?></h1>
<p><?cs var:html_escape(Lang.ErrorMessage[errname].Text) ?></p>
<?cs else ?>
<h1>unknown error message</h1>
<p>could not find error message: '<?cs var:errname ?>'</p>
<?cs /if ?></div><?cs
/def ?><?cs
def:success(succname)
?><div class="success"><?cs
if:?Lang.SuccessMessage[succname].Title
?>
<h1><?cs var:html_escape(Lang.SuccessMessage[succname].Title) ?></h1>
<p><?cs var:html_escape(Lang.SuccessMessage[succname].Text) ?></p>
<?cs else ?>
<h1>unknown success message</h1>
<p>could not find success message: '<?cs var:succname ?>'</p>
<?cs /if ?></div><?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:link(attr1, value1, attr2, value2, attr3, value3)
?><?cs each:attrs = Temp
?><?cs set:attrs = ""
?><?cs /each
?><?cs each:attrs = Settings.LinkAttrs
?><?cs set:Temp[url_escape(name(attrs))] = url_escape(attrs)
?><?cs /each
?><?cs if:attr1 != "" ?><?cs set:Temp[attr1] = value1 ?><?cs /if
?><?cs if:attr2 != "" ?><?cs set:Temp[attr2] = value2 ?><?cs /if
?><?cs if:attr3 != "" ?><?cs set:Temp[attr3] = value3 ?><?cs /if
?><?cs var:ScriptName
?><?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
?>&amp;<?cs /if
?><?cs var:url_escape(name(attrs)) ?>=<?cs var:url_escape(attrs)
?><?cs /if
?><?cs /each
?><?cs /if ?><?cs
/def ?><?cs
def:print_form_header() ?><?cs #
# the header of a form - including Setting.LinkAttrs
?><form action="<?cs call:link("","","","","","") ?>" method="post" enctype="application/x-www-from-urlencoded" accept-charset="utf-8"><?cs
/def ?>