some more macros for a unified design

new volume properties design
This commit is contained in:
lars 2006-11-02 14:00:28 +00:00
parent edae23cbfd
commit 29d2e442f2
9 changed files with 132 additions and 114 deletions

View file

@ -1,4 +1,6 @@
<h1><?cs var:html_escape(Lang.Title.AccessDenied) ?></h2> <h1><?cs var:html_escape(Lang.Title.AccessDenied) ?></h1>
<div class="unavailable_action"><?cs var:html_escape(Lang.Text.AccessDenied) ?></div> <?cs call:hint(Lang.Text.AccessDenied) ?>
<?cs call:handle_messages() ?>

View file

@ -1,3 +1,6 @@
<?cs # $Id$ ?> <?cs # $Id$ ?>
<?cs # what else would you expect here? ?> <?cs # what else would you expect here? ?>
<?cs call:handle_messages() ?>

View file

@ -7,10 +7,7 @@
</div><!-- end of 'words' --> </div><!-- end of 'words' -->
<div id="footer"> <div id="footer">
<?cs # Development or not ?><?cs v<?cs var:Data.Version ?>&nbsp;&nbsp;
if:(Data.Status.DevelopmentMode == 1) ?>
<div id="development">!Development Mode!</div><?cs /if ?>
<?cs var:Data.Version ?>&nbsp;&nbsp;
<a href="http://cryptobox.org" title="<?cs var:html_escape(Lang.Text.ProjectHomePage) ?>">CryptoBox-Home</a>&nbsp;&nbsp;&nbsp;<?cs var:html_escape(Lang.Text.ProjectNote) ?>&nbsp;<a href="https://systemausfall.org/senselab" title="systemausfall.org">sense.lab</a> <a href="http://cryptobox.org" title="<?cs var:html_escape(Lang.Text.ProjectHomePage) ?>">CryptoBox-Home</a>&nbsp;&nbsp;&nbsp;<?cs var:html_escape(Lang.Text.ProjectNote) ?>&nbsp;<a href="https://systemausfall.org/senselab" title="systemausfall.org">sense.lab</a>
</div> </div>
@ -18,13 +15,8 @@
<?cs # TODO: update these status settings - most are outdated ... ?> <?cs # TODO: update these status settings - most are outdated ... ?>
<!-- CBOX-STATUS-begin - used for validation - do not touch! <!-- CBOX-STATUS-begin - used for validation - do not touch!
Data.Config.IP=<?cs var:html_escape(Data.Config.IP) ?> Settings.Language=<?cs var:html_escape(Settings.Language) ?>
Data.Config.Language=<?cs var:html_escape(Data.Config.Language) ?> Data.Version=<?cs var:html_escape(Data.Version) ?>
Data.Config.TimeOut=<?cs var:html_escape(Data.Config.TimeOut) ?>
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.Plugins ?>Data.Status.Plugins.<?cs <?cs each:x = Data.Status.Plugins ?>Data.Status.Plugins.<?cs
var:name(x) ?>=<?cs var: html_escape(x) ?> var:name(x) ?>=<?cs var: html_escape(x) ?>
<?cs /each <?cs /each
@ -32,6 +24,9 @@ Data.Status.Mounted=<?cs var:html_escape(Data.Status.Mounted) ?>
<!-- $Revision$ --> <!-- $Revision$ -->
<?cs # check, if the macro 'handle_messages' was called before - otherwise place a warning ?>
<?cs if:!messages_are_handled ?>MESSAGES WERE NOT HANDLED PROPERLY - PLEASE FIX THIS!<?cs /if ?>
</body> </body>
</html> </html>

View file

@ -26,14 +26,26 @@
/each ?><?cs /each ?><?cs
/loop ?> /loop ?>
<?cs call:print_form_header("select_language",'') ?> <?cs # to avoid duplicate POST variables, we have to remove the weblang attribute
from the action destination of the language selection form header ?><?cs
if:?Settings.LinkAttrs.weblang ?><?cs
# remove the link attr before writing the form header ?><?cs
set:old_weblang = Settings.LinkAttrs.weblang ?><?cs
set:Settings.LinkAttrs.weblang = '' ?><?cs
call:print_form_header("select_language",'') ?><?cs
# restore the old setting ?><?cs
set:Settings.LinkAttrs.weblang = old_weblang ?><?cs
else ?><?cs
# otherwise: simply call it as usual ?><?cs
call:print_form_header("select_language",'') ?><?cs
/if ?>
<div id="lang"> <div id="lang">
<select name="weblang"> <select name="weblang">
<?cs each:item = Data.Languages ?> <?cs each:item = Data.Languages ?>
<option value="<?cs var:name(item) ?>" <?cs <option value="<?cs var:name(item) ?>" <?cs
if:Settings.Language == name(item) ?>selected="selected"<?cs /if if:Settings.Language == name(item) ?>selected="selected"<?cs /if
?>><?cs var:item ?></option><?cs /each ?> ?>><?cs var:item ?></option><?cs /each ?>
</select> </select><br/>
<button type="submit"><?cs var:html_escape(Lang.Button.SelectLanguage) ?></button> <button type="submit"><?cs var:html_escape(Lang.Button.SelectLanguage) ?></button>
</div> </div>
</form> </form>
@ -41,18 +53,21 @@
<div id="main"> <div id="main">
<?cs if:Data.activeDisksCount > 0 ?> <div id="head">
<div id="head_red"> <table>
<?cs else ?> <tr><td>
<div id="head_green"> <h1><?cs var:html_escape(Lang.Title.Top) ?></h1>
<?cs /if ?> <h2><?cs var:html_escape(Lang.Title.Slogan) ?></h2>
<h1><?cs var:html_escape(Lang.Title.Top) ?></h1> </td>
<h2><?cs var:html_escape(Lang.Title.Slogan) ?></h2> <td>
</div> <?cs if:Data.activeDisksCount > 0 ?><?cs
set:logoFile = "antlogo100px_red.png" ?><?cs
else ?><?cs
set:logoFile = "antlogo100px_green.png" ?><?cs
/if ?>
<img src="/cryptobox-misc/<?cs var:logoFile ?>" alt="icon: logo" />
</td></tr></table>
</div>
<div id="menu">
&nbsp;
</div>
<div id="words"> <div id="words">

View file

@ -1,59 +1,5 @@
<?cs # $Id$ ?><?cs <?cs # $Id$ ?><?cs
# 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:warning(mname)
?><?cs call:message_dispatch(mname, "warning", "WarningMessage") ?><?cs
/def ?><?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
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(path, attr1, value1, attr2, value2) def:link(path, attr1, value1, attr2, value2)
?><?cs each:attrs = Temp ?><?cs each:attrs = Temp
?><?cs set:attrs = "" ?><?cs set:attrs = ""
@ -80,6 +26,55 @@ def:link(path, attr1, value1, attr2, value2)
/def ?><?cs /def ?><?cs
# 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 # choose the appropriate symbol file
?><?cs if:type == "success" ?><?cs set:symbolFile = "dialog-information_tango.png"
?><?cs elif:type == "warning" ?><?cs set:symbolFile = "dialog-error_tango.png"
?><?cs /if
?><?cs # preparations are done - now start writing
?><div class="message"><table><tr><td><img class="message_symbol" src="<?cs
call:link('cryptobox-misc/' + symbolFile,'','','','')
?>" alt="icon: info" /></td><td><?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 ?></td></tr></table></div><?cs
/def ?><?cs
def:warning(mname)
?><?cs call:message_dispatch(mname, "warning", "WarningMessage") ?><?cs
/def ?><?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
def:print_form_header(form_name, action) ?><?cs # def:print_form_header(form_name, action) ?><?cs #
# the header of a form - including Setting.LinkAttrs # the header of a form - including Setting.LinkAttrs
?><form name="<?cs var:html_escape(form_name) ?>" action="<?cs call:link(action,"","","","") ?>" method="post" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"><?cs ?><form name="<?cs var:html_escape(form_name) ?>" action="<?cs call:link(action,"","","","") ?>" method="post" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"><?cs
@ -88,7 +83,7 @@ def:print_form_header(form_name, action) ?><?cs #
def:show_plugin(plugin, type) ?><?cs def:show_plugin(plugin, type) ?><?cs
# show the icon and the name of a plugin of a give type (system/volume/menu) ?> # show the icon and the name of a plugin of a give type (system/volume/menu) ?>
<div class="plugin_<?cs var:html_escape(type) ?>"> <div class="plugin_<?cs var:html_escape(type) ?> plugin_<?cs var:html_escape(type) ?>_<?cs if:Data.ActivePlugin == plugin ?>active<?cs else ?>passive<?cs /if ?>">
<a href="<?cs call:link('plugins/' + plugin,'','','','') ?>" title="<?cs var:html_escape(Settings.PluginList[plugin].Link) ?>"> <a href="<?cs call:link('plugins/' + plugin,'','','','') ?>" title="<?cs var:html_escape(Settings.PluginList[plugin].Link) ?>">
<img src="<?cs call:link('icons/plugins/' + plugin, '','','','') ?>" alt="<?cs var:html_escape('icon: ' + plugin) ?>" /><br/><?cs <img src="<?cs call:link('icons/plugins/' + plugin, '','','','') ?>" alt="<?cs var:html_escape('icon: ' + plugin) ?>" /><br/><?cs
var:html_escape(Settings.PluginList[plugin].Link) ?></a></div><?cs var:html_escape(Settings.PluginList[plugin].Link) ?></a></div><?cs
@ -113,7 +108,37 @@ def:show_volume(index) ?><?cs
<div class="volume"> <div class="volume">
<a href="<?cs call:link('plugins/volume_mount','device',Data.Disks[index].device,'','') ?>" title="<?cs var:html_escape(Data.Disks[index].name) ?>"> <a href="<?cs call:link('plugins/volume_mount','device',Data.Disks[index].device,'','') ?>" title="<?cs var:html_escape(Data.Disks[index].name) ?>">
<img src="<?cs call:link('cryptobox-misc/' + filename,'','','','') ?>" alt="icon: volume" /><br/><?cs <img src="<?cs call:link('cryptobox-misc/' + filename,'','','','') ?>" alt="icon: volume" /><br/><?cs
var:html_escape(Data.Disks[index].name) ?></a></div><?cs var:html_escape(Data.Disks[index].name) ?> (<?cs
var:html_escape(Data.Disks[index].size) ?>)</a></div><?cs
/def ?><?cs
def:help_link(pagename) ?><?cs
# show an iconed link to a specific help page for the current form ?>
<div class="help_link">
<a href="<?cs call:link('plugins/help','page',pagename,'','') ?>" title="<?cs var:html_escape(Lang.Button.HelpForForm) ?>">
<?cs var:html_escape(Lang.Button.HelpForForm) ?>
<img class="message_symbol" src="/icons/plugins/help" alt="icon: help" />
</a></div><?cs
/def ?><?cs
def:hint(text) ?><?cs
# show a warning hint ?>
<div class="message">
<table><tr><td><img class="message_symbol" src="/cryptobox-misc/dialog-warning_tango.png" alt="icon: warning" /></td>
<td><?cs var:html_escape(text) ?></td></tr></table></div><?cs
/def ?><?cs
def:handle_messages() ?><?cs
# call this function once for every page - otherwise your risk to loose messages
?><?cs if:messages_are_handled ?>HANDLE_MESSAGE CALLED TWICE - PLEASE FIX THIS<?cs /if
?><?cs if:Data.Error ?><?cs include:Settings.TemplateDir + '/error.cs' ?><?cs /if
?><?cs if:Data.Warning ?><?cs call:warning(Data.Warning) ?><?cs /if
?><?cs if:Data.Success ?><?cs call:success(Data.Success) ?><?cs /if
?><?cs set:messages_are_handled = 1 ?><?cs
/def ?> /def ?>

View file

@ -5,10 +5,6 @@
<!-- chosen cryptobox template: <?cs var:Settings.TemplateFile ?> --> <!-- chosen cryptobox template: <?cs var:Settings.TemplateFile ?> -->
<?cs if:Data.Error ?><?cs include:Settings.TemplateDir + '/error.cs' ?><?cs /if ?>
<?cs if:Data.Warning ?><?cs call:warning(Data.Warning) ?><?cs /if ?>
<?cs if:Data.Success ?><?cs call:success(Data.Success) ?><?cs /if ?>
<?cs include:Settings.TemplateFile ?> <?cs include:Settings.TemplateFile ?>
<?cs include:Settings.TemplateDir + '/footer.cs' ?> <?cs include:Settings.TemplateDir + '/footer.cs' ?>

View file

@ -1,13 +1,3 @@
<!-- end of plugin pane --> <!-- end of plugin pane -->
</div></td> </div>
<td class="pane_right"></td>
</tr>
<?cs # bottom line of the pane ?>
<tr>
<td class="pane_bottom_left"></td>
<td class="pane_bottom" colspan="<?cs var:volume_plugin_count ?>"></td>
<td class="pane_bottom_right"></td>
</tr>
</table>

View file

@ -4,21 +4,12 @@
<h1><?cs var:html_escape(Lang.Title.Volume) ?> <i><?cs var:html_escape(Data.CurrentDisk.name) ?></i></h1> <h1><?cs var:html_escape(Lang.Title.Volume) ?> <i><?cs var:html_escape(Data.CurrentDisk.name) ?></i></h1>
<table id="volume_pane"> <table id="volume_area">
<tr> <tr>
<td class="pane_top_left"></td> <td>&nbsp;</td>
<?cs include:Settings.TemplateDir + '/volume_plugins.cs' ?>
</tr>
</table>
<?cs include:Settings.TemplateDir + '/volume_plugins.cs' ?> <div id="volume_area_inner">
<?cs # this case should never happen, but we have to have at least three rows ?>
<?cs if:volume_plugin_count == 0 ?><td class="pane_side_top"></td><?cs /if ?>
<td class="pane_top_right"></td>
</tr>
<tr>
<td class="pane_left" style="background-image: url(../cryptobox-misc/pane_side_left.png);"></td>
<!-- beginning of the plugin pane -->
<td colspan="<?cs var:volume_plugin_count ?>"><div>

View file

@ -22,3 +22,4 @@
/each ?><?cs /each ?><?cs
/loop ?> /loop ?>
<?cs /if ?> <?cs /if ?>