Short description

It should be possible to setup different logos with different urls

Sometimes I want to have the possibility to use the logo of a wiki to link to a main page of the webserver. I would like to use this page element because sometimes it is used to show in addition to the wiki logo the company logo. People don't understand by clicking on the company logo that they got the FrontPage. I have included a patch to show the simple changes. (changed to the whole logo routine)

If you like to have logos directed to urls add e.g. the following entry.

    logo_string = [u'<img src="/wiki/mywiki.png">',u'<img src="/wiki/mycompany.png">']
    logo_url = [u'http://mywiki.domain.de',u'http://mycompany.domain.de']

    def logo(self):
        """ Assemble logo with link to front page

        The logo contain an image and or text or any html markup the
        admin inserted in the config file. Everything it enclosed inside
        a div with id="logo".
        
        ReimarBauer 2005-11-15,16
        optionaly a logo_url could be used to link to a different page as the wiki front_page
        if different logos are used you could setup different urls too
        
        @param d: parameter dictionary
        @rtype: unicode
        @return: logo html
        """
        html = u''
        if self.cfg.logo_string:
            pagename = wikiutil.getFrontPage(self.request).page_name
            pagename = wikiutil.quoteWikinameURL(pagename)
            #ReimarBauer 2005-11-15
            logo = u''
            i = 0
            if hasattr(self.cfg,'logo_url'): 
                from MoinMoin.formatter.text_html import Formatter
                formatter = Formatter(self.request)

                for txt in self.cfg.logo_string:
                    if txt == "" :
                        logo += wikiutil.link_tag(self.request, pagename, self.cfg.logo_string[i])
                        
                    else:
                        kw ={}
                        kw['src']=self.cfg.logo_url[i]
                        image_link=self.cfg.logo_string[i]
                        logo +=  formatter.url(1,kw['src'] )+image_link +formatter.url(0)
                    
                    i += 1  
            else:
                for txt in self.cfg.logo_string:
                    logo += wikiutil.link_tag(self.request, pagename, self.cfg.logo_string[i])
                    i += 1
                    
            html = u'''<div id="logo">%s</div>''' % logo
        return html

I think this would be a simple extension to the current configurations. -- ReimarBauer 2005-11-15 07:21:37

This is very bad for usability - most users expect to see a logo which leads to the home page in the top left corner. Different location or logo that leads to a another page will confuse users.

They don't need to change anything in the configuration. But if you use a wiki in corporation with other web tools it is useful to have. In this case we have setup the wikis frontpage in the navibar. In our case the logo is not exclusive the wiki logo. -- ReimarBauer 2005-11-15 12:23:20

Changed the routine again to an hasattr test of logo_url. By this the changed code do not affect existing wiki setups. -- ReimarBauer 2005-11-16 19:40:15

what if we simply allow variable substitution in the logo URL (I do not understand the Python code)?


patches for 1.8

logo_string = [u'<img src="/wiki/mywiki.png">',u'<img src="/wiki/mycompany.png">']
logo_url = [u'http://mywiki.domain.de',u'http://mycompany.domain.de']

patch -p1 < logo_rss_rc_patch.patch

diff -r 550373665133 MoinMoin/action/rss_rc.py
--- a/MoinMoin/action/rss_rc.py Sun Apr 20 21:39:50 2008 +0200
+++ b/MoinMoin/action/rss_rc.py Fri Apr 25 09:16:27 2008 +0200
@@ -112,7 +112,7 @@
         if not baseurl.endswith('/'):
             baseurl += '/'
 
-        logo = re.search(r'src="([^"]*)"', cfg.logo_string)
+        logo = re.search(r'src="([^"]*)"', cfg.logo_string[0])
         if logo:
             logo = request.getQualifiedURL(logo.group(1))

patch -p1 < logo_theme_patch.patch

diff -r 550373665133 MoinMoin/theme/__init__.py
--- a/MoinMoin/theme/__init__.py    Sun Apr 20 21:39:50 2008 +0200
+++ b/MoinMoin/theme/__init__.py    Fri Apr 25 09:24:31 2008 +0200
@@ -181,6 +181,51 @@
         return html
 
     def logo(self):
+        """ Assemble logo with link to front page
+
+        The logo contain an image and or text or any html markup the
+        admin inserted in the config file. Everything it enclosed inside
+        a div with id="logo".
+
+        ReimarBauer 2005-11-15,16
+        optionaly a logo_url could be used to link to a different page as the wiki front_page
+        if different logos are used you could setup different urls too
+
+        @param d: parameter dictionary
+        @rtype: unicode
+        @return: logo html
+        """
+        html = u''
+        if self.cfg.logo_string:
+            pagename = wikiutil.getFrontPage(self.request).page_name
+            pagename = wikiutil.quoteWikinameURL(pagename)
+            #ReimarBauer 2005-11-15
+            logo = u''
+            i = 0
+            if hasattr(self.cfg, 'logo_url'):
+                from MoinMoin.formatter.text_html import Formatter
+                formatter = Formatter(self.request)
+
+                for txt in self.cfg.logo_string:
+                    if txt == "":
+                        logo += wikiutil.link_tag(self.request, pagename, self.cfg.logo_string[i])
+
+                    else:
+                        kw = {}
+                        kw['src'] = self.cfg.logo_url[i]
+                        image_link = self.cfg.logo_string[i]
+                        logo += formatter.url(1, kw['src'] )+image_link +formatter.url(0)
+
+                    i += 1
+            else:
+                for txt in self.cfg.logo_string:
+                    logo += wikiutil.link_tag(self.request, pagename, self.cfg.logo_string[i])
+                    i += 1
+
+            html = u'''<div id="logo">%s</div>''' % logo
+        return html
+
+    def logo_old(self):
         """ Assemble logo with link to front page
 
         The logo contain an image and or text or any html markup the


MoinMoin: FeatureRequests/LinkLogoToUrl (last edited 2009-08-10 19:39:40 by ReimarBauer)