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
|
@ -26,7 +26,7 @@ Data.Status.Config=<?cs var:html_escape(Data.Status.Config) ?>
|
|||
Data.Status.InitRunning=<?cs var:html_escape(Data.Status.InitRunning) ?>
|
||||
Data.Status.IP=<?cs var:html_escape(Data.Status.IP) ?>
|
||||
Data.Status.Mounted=<?cs var:html_escape(Data.Status.Mounted) ?>
|
||||
<?cs each:x = Data.Status.Modules ?>Data.Status.Modules.<?cs
|
||||
<?cs each:x = Data.Status.Plugins ?>Data.Status.Plugins.<?cs
|
||||
var:name(x) ?>=<?cs var: html_escape(x) ?>
|
||||
<?cs /each
|
||||
?>CBOX-STATUS-end -->
|
||||
|
|
|
@ -6,18 +6,18 @@
|
|||
|
||||
<?cs # sort the Plugins - using the most stupid way :) ?>
|
||||
<?cs loop: order = #0, #100, #1
|
||||
?><?cs # plugins ?><?cs each:x = Lang.Modules
|
||||
?><?cs # plugins ?><?cs each:x = Lang.Plugins
|
||||
?><?cs if:x.Rank == order ?>
|
||||
<li><a href="<?cs call:link('module_' + name(x),'','','','') ?>" title="<?cs
|
||||
<li><a href="<?cs call:link('plugins/' + name(x),'','','','') ?>" title="<?cs
|
||||
var:html_escape(x.Link) ?>"><?cs var:html_escape(x.Link) ?></a></li><?cs
|
||||
/if ?><?cs
|
||||
/each ?><?cs
|
||||
/loop ?>
|
||||
<?cs # maybe someone forgot to set the rank of a module: we try to catch them ?>
|
||||
<?cs # maybe someone forgot to set the rank of a plugin: we try to catch them ?>
|
||||
|
||||
<?cs # plugins ?><?cs each:x = Lang.Modules ?><?cs
|
||||
<?cs # plugins ?><?cs each:x = Lang.Plugins ?><?cs
|
||||
if:!x.Rank || !(x.Rank >= 0 && x.Rank <= 100) ?>
|
||||
<li><a href="<?cs call:link('module_' + name(x),'','','','') ?>" title="<?cs
|
||||
<li><a href="<?cs call:link('plugins/' + name(x),'','','','') ?>" title="<?cs
|
||||
var:html_escape(x.Link) ?>"><?cs var:html_escape(x.Link) ?></a></li><?cs
|
||||
/if ?><?cs
|
||||
/each ?>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
<?cs # $Id$ ?>
|
||||
|
||||
<!-- TODO: completely useless for now - do something about it :) -->
|
||||
<?cs # we use "loop" instead of "each" to keep the order of the disks ?>
|
||||
<?cs loop: index = #0, subcount(Data.Disks)-1, #1 ?>
|
||||
|
||||
<?cs each:volume = Data.Disks ?>
|
||||
|
||||
<a href="<?cs call:link('show_volume','device',volume.device,'','') ?>" title="<?cs
|
||||
var:volume.name ?>">
|
||||
<a href="<?cs call:link('show_volume','device',Data.Disks[index].device,'','') ?>" title="<?cs
|
||||
var:Data.Disks[index].name ?>">
|
||||
<?cs # the "div" is the container for the background image ?>
|
||||
<div class="<?cs if:volume.isActive ?>active<?cs else ?>passive<?cs /if ?><?cs
|
||||
if:volume.device == Data.CurrentDisk.device ?> current<?cs /if ?>">
|
||||
<p><?cs var:volume.name ?></p>
|
||||
<div class="<?cs if:Data.Disks[index].active ?>active<?cs else ?>passive<?cs /if ?><?cs
|
||||
if:Data.Disks[index].device == Data.CurrentDisk.device ?> current<?cs /if ?>">
|
||||
<p><?cs var:Data.Disks[index].name ?></p>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<?cs /each ?>
|
||||
<?cs /loop ?>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue