cryptonas/plugins/help/help.py

46 lines
1.2 KiB
Python

import cryptobox.plugins.base
class help(cryptobox.plugins.base.CryptoBoxPlugin):
pluginCapabilities = [ "system" ]
pluginVisibility = [ "menu" ]
requestAuth = False
rank = 80
default_lang = 'en'
default_page = "CryptoBoxUser"
def doAction(self, page=""):
'''prints the offline wikipage
'''
import re,os
## check for invalid characters and if the page exists in the default language
if page and \
not re.search(u'\W', page) and \
os.path.isfile(os.path.join(self.cbox.prefs["Locations"]["DocDir"], self.efault_lang, page + '.html')):
## everything is ok
pass
else:
## display this page as default help page
page = self.default_page
if page:
## issue warning
self.cbox.log.info("could not find the selected documentation page: %s" % str(page))
## store the name of the page
self.hdf[self.hdf_prefix + "Page"] = page
## choose the right language
for l in self.site.langOrder:
if os.path.isfile(os.path.join(self.cbox.prefs["Locations"]["DocDir"], l, page + '.html')):
lang = l
break
else:
lang = self.default_lang
self.hdf[self.hdf_prefix + "Language"] = lang
return "doc"
def getStatus(self):
return "TODO"