new menu plugins: "help", "system_preferences" and "disks"

description of plugin interface extended with possible redirection to another plugin
This commit is contained in:
lars 2006-11-01 09:22:58 +00:00
parent 7fd361d8ac
commit 87d99e8173
18 changed files with 125 additions and 21 deletions

View file

@ -0,0 +1,15 @@
<?cs # $Id$ ?>
<h1><?cs var:html_escape(Lang.Plugins.disks.Title.Disks) ?></h1>
<?cs # TODO: add no-disks-available warning ?>
<?cs if:subcount(Data.Disks) == 0 ?>
NO DISKS
<?cs else ?>
<?cs # we use "loop" instead of "each" to keep the order of the disks ?>
<?cs loop: index = #0, subcount(Data.Disks)-1, #1 ?>
<?cs call:show_volume(index) ?>
<?cs /loop ?>
<?cs /if ?>

View file

@ -0,0 +1,17 @@
import CryptoBoxPlugin
class disks(CryptoBoxPlugin.CryptoBoxPlugin):
pluginCapabilities = [ "menu" ]
requestAuth = False
rank = 10
def doAction(self):
self.cbox.reReadContainerList()
return "disks"
def getStatus(self):
return "TODO"

View file

@ -0,0 +1,5 @@
Name = Disk overview
Link = Disks
Title.Disks = Available disks

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -0,0 +1,7 @@
<?cs # $Id$ ?>
<div id="doc">
<?cs include:Settings.DocDir + '/' + Settings.Language + '/' + Data.Plugins.help.Page + '.html' ?>
</div>

View file

@ -0,0 +1,25 @@
import CryptoBoxPlugin
class help(CryptoBoxPlugin.CryptoBoxPlugin):
pluginCapabilities = [ "menu" ]
requestAuth = False
rank = 50
def doAction(self, page=""):
'''prints the offline wikipage
'''
import re
## check for invalid characters
if page and not re.search(u'\W', page):
self.hdf[self.hdf_prefix + "Page"] = page
else:
## display this page as default help page
self.hdf[self.hdf_prefix + "Page"] ="CryptoBoxUser"
return "doc"
def getStatus(self):
return "TODO"

View file

@ -0,0 +1,5 @@
Name = User manual
Link = Help
Title.Help = User manual

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -21,8 +21,11 @@ Python code interface:
* generator: a generator object ("yield") - its content will replace every
occurrence of "<!-- CONTENT_DUMMY -->" in the template (useful for pages that
are displayed step by step (as for formatting of filesystems))
- an empty (e.g. None) return value can be used to go to the default page (now: the
plugin overview)
- the return value may also be a dictionary with the following elements:
* plugin: the name of a plugin
* values: a dictionary of variables that should be defined for this plugin
- an empty (e.g. None) return value can be used to go to the default page ("disks"
or "volume_mount" (for volume plugins))
- function "getStatus":
- returns a string, that describes a state connected to this plugin (e.g. the current date and
time (for the "date" plugin))

View file

@ -2,26 +2,19 @@
<h1><?cs var:html_escape(Lang.Plugins.shutdown.Title.Shutdown) ?></h1>
<!--
<p style="text-align: center">
<?cs var:html_escape(Lang.Plugins.shutdown.Text.ShutdownInfo) ?>
</p>
-->
<table style="text-align:center; width:100%">
<tr>
<td style="text-align: right">
<?cs call:print_form_header("reboot", "plugins/shutdown") ?>
<input type="hidden" name="type" value="reboot" />
<button type="submit" tabindex="2"><?cs var:html_escape(Lang.Plugins.shutdown.Button.Reboot) ?></button>
</form>
</td>
<td style="width:5%"></td>
<td style="text-align: left">
<?cs call:print_form_header("shutdown", "plugins/shutdown") ?>
<input type="hidden" name="type" value="shutdown" />
<button type="submit" tabindex="1"><?cs var:html_escape(Lang.Plugins.shutdown.Button.Shutdown) ?></button>
</form>
</td>
</tr>
</table>
<div class="plugin_system">
<a href="<?cs call:link('plugins/shutdown','type','shutdown','','') ?>">
<img src="<?cs call:link('icons/plugins/shutdown','image','gnome-shutdown.png','','')
?>" alt="icon: shutdown" /><br/><?cs var:html_escape(Lang.Plugins.shutdown.Button.Shutdown) ?></a></div>
<div class="plugin_system">
<a href="<?cs call:link('plugins/shutdown','type','reboot','','') ?>">
<img src="<?cs call:link('icons/plugins/shutdown','image','gnome-reboot.png','','')
?>" alt="icon: reboot" /><br/><?cs var:html_escape(Lang.Plugins.shutdown.Button.Reboot) ?></a></div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

@ -1,5 +1,5 @@
Name = Shutdown or reboot the computer
Link = Shutdown / Reboot
Link = Shutdown
Title.Shutdown = Shutdown computer

View file

@ -4,7 +4,7 @@ REDIRECT_DELAY = 180
class shutdown(CryptoBoxPlugin.CryptoBoxPlugin):
pluginCapabilities = [ "system" ]
pluginCapabilities = [ "system", "menu" ]
requestAuth = False
rank = 70

View file

@ -0,0 +1,5 @@
Name = System preferences
Link = Preferences
Title.Preferences = Preferences

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -0,0 +1,13 @@
<?cs # $Id$ ?>
<h1><?cs var:html_escape(Lang.Plugins.system_preferences.Title.Preferences) ?></h1>
<?cs # sort the Plugins - using the most stupid way :) ?>
<?cs loop: order = #0, #100, #1
?><?cs # plugins ?><?cs each:x = Settings.PluginList
?><?cs if:x.Enabled && x.Types.system && x.Rank == order ?>
<?cs call:show_plugin(name(x), 'system') ?><?cs /if ?><?cs
/each ?><?cs
/loop ?>

View file

@ -0,0 +1,16 @@
import CryptoBoxPlugin
class system_preferences(CryptoBoxPlugin.CryptoBoxPlugin):
pluginCapabilities = [ "menu" ]
requestAuth = False
rank = 20
def doAction(self):
return "show_plugins"
def getStatus(self):
return "TODO"