language namespace for plugins separated
plugin interface changed ("prepareForm" removed) plugins do not raise exceptions anymore first part of the partitioning plugin device-specific stuff moved to CryptoBoxTools
This commit is contained in:
parent
f2a7ceb61c
commit
de3280806f
26 changed files with 622 additions and 309 deletions
|
@ -1,41 +1,45 @@
|
|||
<?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>
|
||||
# the following macro is as ugly as possible - but somehow we have to manage
|
||||
to use 'normal' and 'plugin' messages in a clean way:
|
||||
Lang.WarningMessage.??? - used by core functions
|
||||
Lang.Plugins.PLUGINNAME.WarningMessage.??? - used by plugins ?><?cs
|
||||
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))
|
||||
?><?cs # preparations are done - now start writing
|
||||
?><div class="<?cs var:type ?>"><?cs
|
||||
# check if it is a 'normal' message ?><?cs
|
||||
if:?Lang[category][mname].Title ?>
|
||||
<h1><?cs var:html_escape(Lang[category][mname].Title) ?></h1>
|
||||
<p><?cs var:html_escape(Lang[category][mname].Text) ?></p>
|
||||
<?cs # check if the mname starts with "Plugins." ... ?><?cs
|
||||
elif:(string.slice(mname,0,8) == "Plugins.") && ?Lang[plugPrefix][category][plugSuffix].Title ?>
|
||||
<h1><?cs var:html_escape(Lang[plugPrefix][category][plugSuffix].Title) ?></h1>
|
||||
<p><?cs var:html_escape(Lang[plugPrefix][category][plugSuffix].Text) ?></p>
|
||||
<?cs # the message does not seem to exist ... ?><?cs
|
||||
else ?>
|
||||
<h1>unknown <?cs var:type ?> message</h1>
|
||||
<p>could not find <?cs var:type ?> message: '<?cs var:mname ?>'</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:warning(mname)
|
||||
?><?cs call:message_dispatch(mname, "warning", "WarningMessage") ?><?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:error(mname)
|
||||
?><?cs call:message_dispatch(mname, "error", "ErrorMessage") ?><?cs
|
||||
/def ?><?cs
|
||||
|
||||
|
||||
def:success(mname)
|
||||
?><?cs call:message_dispatch(mname, "success", "SuccessMessage") ?><?cs
|
||||
/def ?><?cs
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue