Add a menu bar to the site theme.
[matthijs/projects/wipi.git] / plugin / theme / site.py
index e9344851be65d92f702aa69a199296f8e569cbaf..21d8aa66c017d01608a633a9b5e0cdaf3a97b65c 100644 (file)
@@ -10,6 +10,7 @@
 """
 
 from MoinMoin.theme import ThemeBase
+from MoinMoin.Page import Page
 
 class SiteTheme(ThemeBase):
 
@@ -38,19 +39,19 @@ class SiteTheme(ThemeBase):
 
             # Header
             u'<div id="header">',
+            self.menu(d),
             #self.logo(),
-            self.searchform(d),
             #self.username(d),
-            u'<div id="locationline">',
+            #u'<div id="locationline">',
             #self.interwiki(d),
-            self.title(d),
-            u'</div>',
-            self.trail(d),
-            #self.navibar(d),
+            #self.title(d),
+            #u'</div>',
+            self.navibar(d),
             #u'<hr id="pageline">',
             #u'<div id="pageline"><hr style="display:none;"></div>',
             self.msg(d),
             self.editbar(d),
+            self.trail(d),
             u'</div>',
 
             # Post header custom html (not recommended)
@@ -106,6 +107,7 @@ class SiteTheme(ThemeBase):
             # Footer
             u'<div id="footer">',
             self.username(d),
+            self.searchform(d),
             #self.editbar(d),
             #self.credits(d),
             #self.showversion(d, **keywords),
@@ -116,6 +118,25 @@ class SiteTheme(ThemeBase):
             ]
         return u'\n'.join(html)
 
+    def menu(self, d):
+        """ Assemble a "main menu
+            
+            @param d: parameter dictionary
+            @rtype:   unicode
+            @return: menu html
+        """
+        items = Page(self.request, 'Site/Menu').data.split('\n')
+        
+        html = '<ul id="menubar">'
+
+        for item in items:
+            if (not item.startswith("#")):
+                (pagename, link) = self.splitNavilink(item)
+                html = html + ("<li class=\"menulink\">%s</li>" % link)
+        
+        html = html + '</ul>'
+
+        return html
 
 def execute(request):
     """