removed setting "DocLanguage" (replaced by general "Language")

plugins are now classes inherited from CryptoBoxPlugin
language detection added (via request header "Accept-Language")
This commit is contained in:
lars 2006-09-25 12:22:41 +00:00
parent 56e954d1c4
commit 90efd72b8b
11 changed files with 287 additions and 164 deletions

View file

@ -9,17 +9,12 @@ class WebInterfaceDataset(dict):
templates
"""
def __init__(self, cbox, prefs):
def __init__(self, cbox, prefs, plugins):
self.prefs = prefs
self.cbox = cbox
self.__setConfigValues()
self.__setCryptoBoxState()
def setPluginState(self, plugins):
for pl in plugins.allPlugins():
self["Data.Status.Plugins." + pl] = plugins.getPlugin(pl).getStatus(self.cbox)
self.__setPluginList(plugins)
def setCurrentDiskState(self, device):
@ -46,6 +41,8 @@ class WebInterfaceDataset(dict):
avail_counter = 0
active_counter = 0
for container in self.cbox.getContainerList():
## useful if the container was changed during an action
container.resetObject()
isEncrypted = (container.getType() == CONT_TYPES["luks"]) and 1 or 0
isPlain = (container.getType() == CONT_TYPES["plain"]) and 1 or 0
isMounted = container.isMounted() and 1 or 0
@ -65,7 +62,6 @@ class WebInterfaceDataset(dict):
self["Settings.DocDir"] = os.path.abspath(self.prefs["Locations"]["DocDir"])
self["Settings.Stylesheet"] = self.prefs["WebSettings"]["Stylesheet"]
self["Settings.Language"] = self.prefs["WebSettings"]["Language"]
self["Settings.DocLang"] = self.prefs["WebSettings"]["DocLanguage"]
self["Settings.PluginDir"] = self.prefs["Locations"]["PluginDir"]
@ -81,5 +77,15 @@ class WebInterfaceDataset(dict):
hdf_path = os.path.join(self.prefs["Locations"]["LangDir"], lang + ".hdf")
hdf = neo_util.HDF()
hdf.readFile(hdf_path)
return hdf.getValue("Lang.Name",lang)
return hdf.getValue("Name",lang)
def __setPluginList(self, plugins):
for p in plugins:
lang_data = p.getLanguageData()
entryName = "Settings.PluginList." + p.getName()
self[entryName] = p.getName()
self[entryName + ".Rank"] = lang_data.getValue("Rank", "100")
self[entryName + ".Link"] = lang_data.getValue("Link", p.getName())