* added a template to make plugin writing more simpler

This commit is contained in:
age 2007-08-12 01:00:18 +00:00
parent bab09231d7
commit e3b3bc5b94
5 changed files with 117 additions and 0 deletions

View File

@ -0,0 +1,16 @@
<?cs call:handle_messages() ?>
<?cs call:show_help(Lang.Plugins.plugin_template.Help.Example) ?>
<fieldset>
<legend>
<?cs call:show_plugin_icon() ?>
<?cs var:html_escape(Lang.Plugins.plugin_template.Title) ?>
</legend>
<p><?cs var:html_escape(Lang.Plugins.plugin_template.Text.Example) ?></p>
<p><?cs var:html_escape(Lang.Plugins.plugin_template.Text.SecondExample) ?></p>
</fieldset>

View File

@ -0,0 +1,31 @@
Name = Plugin template
Link = Template
Title = This is a plugin template
Text.Example = Think before you code.
Text.SecondExample = And while probably won't hurt!
Help.Example = This template should help you with starting to write your own plugins. Please take a look in plugin-interfaces.txt for further assistance.
SuccessMessage {
TemplateLaunched {
Title = You see ...
Text = an empty example for a plugin.
}
}
WarningMessage {
SomeError {
Title = Invalid value
Text = This message will never appear.
}
}
EnvironmentWarning {
MissingFoo {
Title = Plugin template warning example
Text = Use this to print some important warnings.
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -0,0 +1,70 @@
#
# Copyright 2006 sense.lab e.V.
#
# This file is part of the CryptoBox.
#
# The CryptoBox is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# The CryptoBox is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the CryptoBox; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""This is a template for CryptoBox plugins
requires:
- no extra software
"""
__revision__ = ""
import cryptobox.plugins.base
class plugin_template(cryptobox.plugins.base.CryptoBoxPlugin):
"""a template for CryptoBox plugins
"""
plugin_capabilities = [ "system" ]
plugin_visibility = [ "preferences" ]
request_auth = False
rank = 99
def do_action(self):
"""The action handler.
"""
self.cbox.log.info("This is a log entry generated by the plugin_template.")
if True:
self.hdf["Data.Success"] = "Plugins.plugin_template.TemplateLaunched"
else:
self.hdf["Data.Warning"] = "Plugins.plugin_template.SomeError"
self.__prepare_form_data()
return "form_plugin_template"
def get_status(self):
"""Retrieve the status of the feature.
"""
return
def get_warnings(self):
warnings = []
## uncomment this to see the environment warning message
#warnings.append((48, "Plugins.%s.MissingFoo" % self.get_name()))
return warnings
def __prepare_form_data(self):
"""Set some hdf values.
"""