Ejemplo n.º 1
0
    def get_editable_icon(self, filename, name):
        if has_file(self.request, self.images_pagename, filename):
            if not self.request.config.logo_sizes.has_key(filename):
                wikiutil.init_logo_sizes(self.request)
            if not self.request.config.theme_files_last_modified.has_key(
                filename):
                wikiutil.init_theme_files_last_modified(self.request)

            width, height = self.request.config.logo_sizes[filename]
            last_modified = self.request.config.theme_files_last_modified[
                filename]
            if self.request.isSSL():
                icon = (
                    '<img class="borderless" src="%s" alt="%s" style="%s" '
                         'height="%s" width="%s"/><span>%s</span>' %
                    (self.request.getQualifiedURL(
                        uri=getAttachUrl(
                            self.images_pagename, filename, self.request,
                            ts=last_modified),
                        ),
                     name, self.png_behavior, height, width, name))
            else:
                icon = (
                    '<img class="borderless" src="%s" alt="%s" style="%s" '
                         'height="%s" width="%s"/><span>%s</span>' %
                    (getAttachUrl(self.images_pagename, filename, self.request,
                                  ts=last_modified),
                     name, self.png_behavior, height, width, name))
        else:
            # we just show text when we don't have an icon to show
            icon = name

        return icon
Ejemplo n.º 2
0
    def banner(self,d):
        """
        Assemble the banner

        @rtype: string
        @return: banner html
        """
        if d['script_name']:
            html = ['<a class="nostyle" href="%(script_name)s">' % d]
        else:
            html = ['<a class="nostyle" href="%s/Front_Page">' %
                    self.request.getScriptname()]

        if has_file(self.request, self.images_pagename, 'logo.png'):
            if not self.request.config.logo_sizes.has_key('logo.png'):
                wikiutil.init_logo_sizes(self.request)
            if not self.request.config.theme_files_last_modified.has_key(
                'logo.png'):
                wikiutil.init_theme_files_last_modified(self.request)
            width, height = self.request.config.logo_sizes['logo.png']
            last_modified = self.request.config.theme_files_last_modified[
                'logo.png']
            if self.request.isSSL():
                html.append(
                    '<img align="middle" src="%s" alt="wiki logo" style="%s" '
                         'height="%s" width="%s"></a>' %
                    (self.request.getQualifiedURL(
                        uri=getAttachUrl(
                            self.images_pagename, 'logo.png', self.request,
                            ts=last_modified),
                        ),
                     self.png_behavior, height, width))
            else:
                html.append(
                    '<img align="middle" src="%s" alt="wiki logo" style="%s" '
                         'height="%s" width="%s"></a>' %
                    (getAttachUrl(self.images_pagename, 'logo.png',
                                  self.request, ts=last_modified),
                     self.png_behavior, height, width))
        else:
            html.append('<div id="logo_text">%s</div></a>' %
                        wikiutil.escape(self.request.config.sitename))

        return ''.join(html)