Index: /waeup/branches/ulif-layout/src/waeup/browser/viewlets.py
===================================================================
--- /waeup/branches/ulif-layout/src/waeup/browser/viewlets.py	(revision 4655)
+++ /waeup/branches/ulif-layout/src/waeup/browser/viewlets.py	(revision 4656)
@@ -15,4 +15,5 @@
 
 grok.templatedir('templates')
+grok.context(IWAeUPObject) # Make IWAeUPObject the default context
 
 #grok.context(zope.interface.Interface)
@@ -78,4 +79,7 @@
         return u'<div class="portlet"><a href="datacenter">Data Center</a></div>'
 
+#
+# Manage ("Edit settings") actions...
+#    
 class ManageUniversityAction(grok.Viewlet):
     grok.viewletmanager(ActionBar)
@@ -174,2 +178,79 @@
     addlink_text = 'Add faculty'
 
+
+#
+# Primary navigation tabs (in upper left navigation bar)...
+#
+class PrimaryNavManager(grok.ViewletManager):
+    """Viewlet manager for the primary navigation tab.
+    """
+    grok.name('primary_nav')
+
+class PrimaryNavTab(grok.Viewlet):
+    """Base for primary nav tabs.
+    """
+    grok.baseclass()
+    grok.viewletmanager(PrimaryNavManager)
+    grok.order(1)
+    grok.require('waeup.manageUniversity')
+
+    pnav = 0 # This is a kind of id of a tab. If some page provides
+             # also a 'pnav' attribute with the same value (here: 0),
+             # then the tab will be rendered as 'active' when the page
+             # gets rendered.
+             #
+             # This way you can assign certain pages to certain
+             # primary nav tabs. Each primary tab should therefore set
+             # the 'pnav' attribute to a different value (or several
+             # tabs might be rendered as active simultanously when the
+             # page gets rendered.
+    tab_title = u'Some Text'
+    
+    @property
+    def link_target(self):
+        return self.view.application_url()
+
+    @property
+    def active(self):
+        view_pnav = getattr(self.view, 'pnav', 0)
+        if view_pnav == self.pnav:
+            return 'active'
+        return ''
+
+class HomeTab(PrimaryNavTab):
+    """Home-tab in primary navigation.
+    """
+    grok.order(1)
+    grok.require('waeup.Public')
+    grok.template('primarynavtab')
+
+    pnav = 0
+    tab_title = u'Home'
+
+class FacultiesTab(PrimaryNavTab):
+    """Faculties-tab in primary navigation.
+    """
+    grok.order(2)
+    grok.require('waeup.manageUniversity')
+    grok.template('primarynavtab')
+
+    pnav = 1
+    tab_title = u'Faculties'
+
+    @property
+    def link_target(self):
+        return self.view.application_url('faculties')
+
+class SearchTab(PrimaryNavTab):
+    """Search tab in primary navigation.
+    """
+    grok.order(3)
+    grok.require('waeup.manageUniversity')
+    grok.template('primarynavtab')
+
+    pnav = 2
+    tab_title = u'Search'
+
+    @property
+    def link_target(self):
+        return self.view.application_url('@@search')
