diff --git a/src/cryptobox/plugins/base.py b/src/cryptobox/plugins/base.py index 73a6c79..83f1c6b 100644 --- a/src/cryptobox/plugins/base.py +++ b/src/cryptobox/plugins/base.py @@ -49,10 +49,10 @@ class CryptoBoxPlugin: ## default icon of this plugin (relative path) - default_icon_filename = "plugin_icon.gif" + default_icon_filename = "plugin_icon" ## fallback icon file (in the common plugin directory) - fallback_icon_filename = "plugin_icon_unknown.gif" + fallback_icon_filename = "plugin_icon_unknown" def __init__(self, cbox, plugin_dir, site_class=None): @@ -156,16 +156,36 @@ class CryptoBoxPlugin: '**kargs' is necessary, as a 'weblang' attribute may be specified (and ignored) """ import re + icon_ext = self.__get_default_icon_extension() if (image is None) or (not re.match(r'[\w\-\.]*$', image)): - plugin_icon_file = os.path.join(self.plugin_dir, self.default_icon_filename) + plugin_icon_file = os.path.join(self.plugin_dir, + "%s.%s" % (self.default_icon_filename, icon_ext)) else: plugin_icon_file = os.path.join(self.plugin_dir, image) + ## check if we can find the fallback plugin icon in one of the + ## plugin directories if not os.access(plugin_icon_file, os.R_OK): for ppath in self.cbox.prefs["Locations"]["PluginDir"]: - plugin_icon_file = os.path.join(ppath, self.fallback_icon_filename) + plugin_icon_file = os.path.join(ppath, + "%s.%s" % (self.fallback_icon_filename, icon_ext)) if plugin_icon_file: break return cherrypy.lib.cptools.serveFile(plugin_icon_file) + + + def __get_default_icon_extension(self): + """Return 'png' or 'gif' depending on the 'User-Agent' request header + + This is useful, as IE 5.5/6.0 does not render transparent png graphics properly + Internet Explorer 5.5/6.0: return 'gif' + everything else: return 'png' + """ + if ("User-Agent" in cherrypy.request.headers) and \ + ((cherrypy.request.headers["User-Agent"].find("MSIE 5.5;") != -1) or \ + (cherrypy.request.headers["User-Agent"].find("MSIE 6.0;") != -1)): + return "gif" + else: + return "png" def get_template_filename(self, template_name): diff --git a/src/cryptobox/web/sites.py b/src/cryptobox/web/sites.py index 8e5595f..9f665ec 100644 --- a/src/cryptobox/web/sites.py +++ b/src/cryptobox/web/sites.py @@ -395,7 +395,11 @@ class WebInterfaceSites: self.__reset_dataset() self.__set_web_lang(weblang) self.__check_environment() - return "test passed" + result = "Test" + return result @cherrypy.expose