Index: /main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py	(revision 6952)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/browser/viewlets.py	(revision 6953)
@@ -569,5 +569,5 @@
     """Contact tab in primary navigation.
     """
-    grok.order(4)
+    grok.order(6)
     grok.require('waeup.Anonymous')
     grok.template('primarynavtab')
Index: /main/waeup.sirp/trunk/src/waeup/sirp/hostels/browser.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/hostels/browser.py	(revision 6953)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/hostels/browser.py	(revision 6953)
@@ -0,0 +1,174 @@
+## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+"""UI components for hostels and related components.
+"""
+import grok
+from time import time
+from datetime import date, datetime
+from zope.component import createObject
+from waeup.sirp.browser import (
+    WAeUPPage, WAeUPEditFormPage, WAeUPAddFormPage, WAeUPDisplayFormPage)
+from waeup.sirp.browser.breadcrumbs import Breadcrumb
+from waeup.sirp.browser.resources import datepicker, datatable, tabs
+from waeup.sirp.browser.viewlets import (
+    ManageActionButton, PrimaryNavTab, AddActionButton)
+from waeup.sirp.interfaces import IWAeUPObject, IUserAccount
+from waeup.sirp.widgets.datewidget import (
+    FriendlyDateWidget, FriendlyDateDisplayWidget,
+    FriendlyDatetimeDisplayWidget)
+from waeup.sirp.browser.resources import toggleall
+from waeup.sirp.authentication import get_principal_role_manager
+from waeup.sirp.students.browser import msave
+from waeup.sirp.hostels.container import HostelsContainer
+from waeup.sirp.hostels.hostel import Hostel
+from waeup.sirp.hostels.interfaces import IHostelsContainer, IHostel
+
+
+class HostelsTab(PrimaryNavTab):
+    """Hostels tab in primary navigation.
+    """
+
+    grok.context(IWAeUPObject)
+    grok.order(5)
+    grok.require('waeup.viewHostels')
+    grok.template('primarynavtab')
+
+    pnav = 5
+    tab_title = u'Hostels'
+
+    @property
+    def link_target(self):
+        return self.view.application_url('hostels')
+
+class HostelsBreadcrumb(Breadcrumb):
+    """A breadcrumb for the hostels container.
+    """
+    grok.context(IHostelsContainer)
+    title = u'Hostels'
+
+class HostelBreadcrumb(Breadcrumb):
+    """A breadcrumb for the hostel container.
+    """
+    grok.context(IHostel)
+
+class HostelsContainerPage(WAeUPDisplayFormPage):
+    """The standard view for hostels containers.
+    """
+    grok.context(IHostelsContainer)
+    grok.name('index')
+    grok.require('waeup.viewHostels')
+    #grok.template('containerpage')
+    label = 'Accommodation Section'
+    title = 'Accommodation'
+    pnav = 5
+
+class HostelsContainerManageActionButton(ManageActionButton):
+    grok.order(1)
+    grok.context(IHostelsContainer)
+    grok.view(HostelsContainerPage)
+    grok.require('waeup.manageHostels')
+    text = 'Manage accommodation section'
+
+class HostelsContainerManagePage(WAeUPDisplayFormPage):
+    """The manage page for hostel containers.
+    """
+    grok.context(IHostelsContainer)
+    grok.name('manage')
+    grok.require('waeup.manageHostels')
+    #grok.template('containermanagepage')
+    pnav = 5
+    title = 'Accommodation'
+    label = 'Manage accommodation section'
+
+class HostelsContainerAddActionButton(AddActionButton):
+    grok.order(1)
+    grok.context(IHostelsContainer)
+    grok.view(HostelsContainerManagePage)
+    grok.require('waeup.manageHostels')
+    text = 'Add hostel'
+    target = 'addhostel'
+
+class HostelAddFormPage(WAeUPAddFormPage):
+    """Add-form to add a hostel.
+    """
+    grok.context(IHostelsContainer)
+    grok.require('waeup.manageHostels')
+    grok.name('addhostel')
+    grok.template('hosteladdpage')
+    form_fields = grok.AutoFields(IHostel)
+    title = 'Accommodation'
+    label = 'Add hostel'
+    pnav = 5
+
+    @grok.action('Create hostel')
+    def addHostel(self, **data):
+        #hostel = createObject(u'waeup.Hostel')
+        #self.applyData(hostel, **data)
+        hostel = Hostel(**data)
+        self.context.addHostel(hostel)
+        self.flash('Hostel created.')
+        self.redirect(self.url(self.context[hostel.hostel_id], 'index'))
+        return
+
+class HostelDisplayFormPage(WAeUPDisplayFormPage):
+    """ Page to display hostel data
+    """
+    grok.context(IHostel)
+    grok.name('index')
+    grok.require('waeup.viewHostels')
+    #grok.template('hostelpage')
+    pnav = 5
+
+    #@property
+    #def label(self):
+    #    return self.context.name
+
+    #@property
+    #def title(self):
+    #    return self.title
+
+class HostelManageActionButton(ManageActionButton):
+    grok.order(1)
+    grok.context(IHostel)
+    grok.view(HostelDisplayFormPage)
+    grok.require('waeup.manageHostels')
+    text = 'Manage'
+    target = 'edit'
+
+class HostelManageFormPage(WAeUPEditFormPage):
+    """ View to edit hostel data
+    """
+    grok.context(IHostel)
+    grok.name('edit')
+    grok.require('waeup.manageHostels')
+    form_fields = grok.AutoFields(IHostel).omit('hostel_id')
+    #grok.template('hostelmanagepage')
+    label = 'Manage hostel data'
+    pnav = 5
+
+    #@property
+    #def title(self):
+    #    return self.context.name
+
+    def update(self):
+        datepicker.need() # Enable jQuery datepicker in date fields.
+        super(HostelManageFormPage, self).update()
+        return
+
+    @grok.action('Save')
+    def save(self, **data):
+        msave(self, **data)
+        return
Index: /main/waeup.sirp/trunk/src/waeup/sirp/hostels/container.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/hostels/container.py	(revision 6952)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/hostels/container.py	(revision 6953)
@@ -19,5 +19,5 @@
 import grok
 from grok import index
-from waeup.sirp.hostels.interfaces import IHostelsContainer
+from waeup.sirp.hostels.interfaces import IHostelsContainer, IHostel
 from waeup.sirp.utils.helpers import attrs_to_fields
 from waeup.sirp.utils.logger import Logger
Index: /main/waeup.sirp/trunk/src/waeup/sirp/hostels/hostel.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/hostels/hostel.py	(revision 6952)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/hostels/hostel.py	(revision 6953)
@@ -30,7 +30,7 @@
     grok.baseclass()
 
-    def __init__(self):
+    def __init__(self, **data):
         super(Hostel, self).__init__()
-        self.hostel_id = None
+        self.hostel_id = data['hostel_id']
         return
 
Index: /main/waeup.sirp/trunk/src/waeup/sirp/hostels/interfaces.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/hostels/interfaces.py	(revision 6952)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/hostels/interfaces.py	(revision 6953)
@@ -20,5 +20,5 @@
 
     hostel_id = schema.TextLine(
-        title = u'Student ID',
+        title = u'Hostel ID',
         required = False,
         )
Index: /main/waeup.sirp/trunk/src/waeup/sirp/hostels/permissions.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/hostels/permissions.py	(revision 6953)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/hostels/permissions.py	(revision 6953)
@@ -0,0 +1,34 @@
+## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+"""
+Permissions for the accommdation section.
+"""
+import grok
+
+# Accommodation section permissions
+
+class ViewHostels(grok.Permission):
+    grok.name('waeup.viewHostels')
+
+class ManageHostels(grok.Permission):
+    grok.name('waeup.manageHostels')
+
+# Global Roles
+class AccommodationOfficer(grok.Role):
+    grok.name('waeup.AccommodationOfficer')
+    grok.title(u'Accommodation Officer')
+    grok.permissions('waeup.View', 'waeup.Public',
+                     'waeup.viewHostels', 'waeup.manageHostels')
Index: /main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 6952)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 6953)
@@ -74,5 +74,5 @@
 
     grok.context(IWAeUPObject)
-    grok.order(3)
+    grok.order(4)
     grok.require('waeup.viewStudent')
     grok.template('primarynavtab')
