Index: WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed.py	(revision 1393)
+++ WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed.py	(revision 1393)
@@ -0,0 +1,90 @@
+##parameters=REQUEST
+# $Id$
+"""
+process the the accommodation reservation
+"""
+import DateTime
+current = DateTime.DateTime()
+pr = context.portal_registration
+wftool = context.portal_workflow
+lt = context.portal_layouts
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+acco_cat = context.portal_accommodation
+import logging
+logger = logging.getLogger('Accommodation')
+
+mode = 'create'
+validate = REQUEST.has_key("cpsdocument_edit_button")
+d = {}
+res,psm,ds = lt.renderLayout(layout_id= 'acco_bed_booking',
+                      schema_id= 'acco_bed_booking',
+                      context=context,
+                      mapping=validate and REQUEST,
+                      ob=d,
+                      layout_mode='edit',
+                      commit = False
+                      )
+if psm == 'invalid':
+    psm = "Please correct your input."
+    return context.book_reserved_bed_form(rendered = res,
+                                 psm = psm,
+                                 #psm = "%s, %s" % (psm,ds),
+                                 mode = mode,
+                                 formaction = "book_reserved_bed",
+                                 button = "reserve bed",
+                                 ds = ds,
+                                 )
+elif psm == '':
+    return context.book_reserved_bed_form(rendered = res,
+                                 psm = psm,
+                                 mode = mode,
+                                 formaction = "book_reserved_bed",
+                                 button = "reserve bed",
+                                 ds = ds,
+                                 )
+elif psm == 'valid':
+    pass
+hall_id = context.getId()
+doc = context.getContent()
+student = ds.get('student')
+sid = ds.get('student_id')
+br = ds.get('block_room')
+block = br[0]
+bl = ds.get('bed_letter')
+bid = "%s_%s_%s" % (hall_id,br,bl)
+res = acco_cat(bed = bed)
+psm = ''
+while True:
+    if not res:
+        psm = "No bed with id %s" % bid
+        break
+    bed_brain = res[0]
+    if not bed_brain.bed_type.endswith("reserved"):
+        psm = "Not a reserved bed %s" % bid
+        break
+    if bed_brain.student:
+        psm = "Bed %s already reserved for %s" % (bid,bed_brain.student)
+        break
+    if student.sex and not block in doc.blocks_for_female:
+        psm = "Sex does not match %s" % bid
+        break
+    break
+if psm != '':
+    return context.book_reserved_bed_form(rendered = res,
+                                 psm = psm,
+                                 mode = mode,
+                                 ds = ds,
+                                 formaction = "book_reserved_bed",
+                                 button = "reserve bed",
+                                 )
+acco_cat.modifyRecord(bed = bed, student = sid)
+logger.info('"%s","booked reserved bed %s for","%s"' % (member,bed,sid))
+return context.book_reserved_bed_form(rendered = res,
+                                 psm = "Bed reserved for %s %s" % (sid,student.name),
+                                 mode = mode,
+                                 formaction = "book_reserved_bed",
+                                 button = "reserve bed",
+                                 ds = ds,
+                                 )
+
Index: WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed_form.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed_form.pt	(revision 1393)
+++ WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed_form.pt	(revision 1393)
@@ -0,0 +1,39 @@
+<tal:block define="rendered_main options/rendered;
+           portal_status_message options/psm;
+           data_storage options/ds;
+           mode options/mode;
+           formaction options/formaction;
+           matric_no options/matric_no|nothing;
+           name options/name|nothing;
+           creation creation|nothing;"
+           >
+  <metal:block define-macro="edit_form">
+    <metal:block use-macro="here/content_lib_master/macros/master">
+      <metal:block fill-slot="header">
+      </metal:block>
+      <metal:block fill-slot="main">
+        <form action="" id="editForm" method="post" 
+              enctype="multipart/form-data" class="workflow"
+              tal:attributes="action options/formaction"
+              >
+          <div tal:replace="structure rendered_main" />
+          <br />
+          <input type="submit" class="standalone" name="cpsdocument_edit_button"
+                 value="Save" 
+                 id="cpsdocument_edit_button"
+                 tal:attributes="value options/button"
+                 tal:condition="not:creation" />
+          <input type="submit" 
+                 class="standalone" 
+                 name="cpsdocument_create_button"
+                 value="apply"
+                 tal:attributes="value options/button"
+                 tal:condition="creation" />
+          
+        </form>
+      </metal:block>
+      <metal:block fill-slot="sub">
+      </metal:block>
+    </metal:block>
+  </metal:block>
+</tal:block>
Index: WAeUP_SRP/trunk/skins/waeup_accommodation/getAccoHallBeds.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_accommodation/getAccoHallBeds.py	(revision 1393)
+++ WAeUP_SRP/trunk/skins/waeup_accommodation/getAccoHallBeds.py	(revision 1393)
@@ -0,0 +1,10 @@
+##parameters=key=None 
+# $Id$
+"""
+Return the bedletters as an vocabulary
+
+"""
+doc = context.getContent()
+if key is None:
+    return [(l,l) for l in 'ABCDEFGH'[:doc.beds_per_room]]
+return key
Index: WAeUP_SRP/trunk/skins/waeup_accommodation/reservedRoomsVoc.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_accommodation/reservedRoomsVoc.py	(revision 1393)
+++ WAeUP_SRP/trunk/skins/waeup_accommodation/reservedRoomsVoc.py	(revision 1393)
@@ -0,0 +1,15 @@
+##parameters=key=None 
+# $Id$
+"""
+Return the reservedrooms as an vocabulary
+
+"""
+doc = context.getContent()
+voc = [("_".join((r.split('/')[0],r.split('/')[1])),r) 
+                      for r in doc.reserved_rooms.split(',') if r]
+#from Products.zdb import set_trace;set_trace()
+if not key:
+    return voc
+for k,v in voc:
+    if k == key:
+        return v
Index: WAeUP_SRP/trunk/skins/waeup_default/layout_wo_object_create.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_default/layout_wo_object_create.pt	(revision 1393)
+++ WAeUP_SRP/trunk/skins/waeup_default/layout_wo_object_create.pt	(revision 1393)
@@ -0,0 +1,91 @@
+<tal:block define="global creation python:1;
+                   global formaction string:display_pume_result" />
+<!-- a layout_lib macro -->
+<!-- $Id$ -->
+
+<metal:block define-macro="default_edit"
+  tal:define="layout options/layout;
+  ds options/datastructure;
+  dm ds/getDataModel;
+  formaction options/formaction;
+  creation creation|nothing;
+  metadata metadata|nothing;
+  type_name request/type_name|nothing;
+  ti python:type_name and getattr(here.portal_types,type_name,None) or getattr(here.portal_types,here.portal_type,None);
+  cpsmcat nocall:here/translation_service;
+  apply request/apply_button|nothing;
+  ">
+  <form action="" id="editForm" method="post" 
+        enctype="multipart/form-data" class="workflow"
+        tal:attributes="action formaction"
+        >
+  <table class="layoutDefault" summary="Form layout"
+         tal:condition="layout/rows">
+    <span tal:repeat="row python: layout['rows']" valign="top" >
+      <span tal:repeat="cell row">
+        <tr tal:define="widget cell/widget;
+              wid widget/getWidgetId;
+              err python:ds.getError(wid);
+              err_mapping python:ds.getErrorMapping(wid);
+              is_required python: widget.is_required and creation and ('create' not in widget.readonly_layout_modes);
+              tooltip_id python:wid + '_help';
+              widget_css_class cell/widget_css_class|nothing;
+              css_class python:test(err, 'row error','row')"
+              tal:condition="python: wid != 'passport'"
+              >
+          <div tal:attributes="class widget_css_class;
+          id python:widget.getHtmlWidgetId()+'_widget';"
+          >
+            <td>
+            <div class="label" tal:condition="widget/label_edit"
+                 tal:attributes="class python:test(is_required, 'label required','label')">
+              <label tal:content="widget/label_edit"
+                     tal:attributes="for cell/widget_input_area_id|nothing;">label</label>:
+            </div>
+            <button type="button" class="tooltipControl"
+                    tal:condition="widget/help"
+                    tal:attributes="onclick python:'toggleElementVisibility(\'%s\')' % tooltip_id;"> ? </button>
+            </td>
+            <td>
+            <span class="field">
+              <div tal:replace="structure cell/widget_rendered"/>
+            </span>
+            <div class="tooltipArea" style="visibility: hidden;"
+                 tal:condition="widget/help"
+                 tal:attributes="id tooltip_id;
+                 onclick python:'showElement(false, \'%s\')' % tooltip_id;"
+                 >
+              <tal:block tal:content="widget/help">This is the help for this field
+              </tal:block>
+            </div>
+            <tal:block condition="err">
+              <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)">
+                <br /><em style="color: red"
+                          tal:content="msg">err</em>
+              </tal:block>
+            </tal:block>
+            </td>
+          </div>
+        </tr>
+      </span>
+    </span>
+  </table>
+  <br />
+  <input type="submit" class="standalone" name="cpsdocument_edit_button"
+         value="Save" 
+         id="cpsdocument_edit_button"
+         tal:condition="not:creation" />
+  <input type="submit" class="standalone" name="apply_admission"
+         value="apply for admission"
+         id="cpsdocument_edit_and_view_button"
+         tal:condition="apply" 
+         tal:attributes="value apply"/>
+  <input type="submit" 
+         class="standalone" 
+         name="cpsdocument_create_button"
+         value="apply"
+         tal:attributes="value options/button"
+         tal:condition="creation" />
+
+</form>
+</metal:block>
Index: WAeUP_SRP/trunk/skins/waeup_default/layout_wo_object_edit.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_default/layout_wo_object_edit.pt	(revision 1393)
+++ WAeUP_SRP/trunk/skins/waeup_default/layout_wo_object_edit.pt	(revision 1393)
@@ -0,0 +1,63 @@
+<tal:block define="global creation python:0;
+                   global formaction string:set_access_data" />
+<!-- a layout_lib macro -->
+<!-- $Id$ -->
+
+<metal:block define-macro="default_edit"
+  tal:define="layout options/layout;
+  ds options/datastructure;
+  dm ds/getDataModel;
+  cpsmcat nocall:here/translation_service;
+  ">
+  <table class="layoutDefault" summary="Form layout"
+         tal:condition="layout/rows">
+    <span tal:repeat="row python: layout['rows']" valign="top" >
+      <span tal:repeat="cell row">
+        <tr tal:define="widget cell/widget;
+              wid widget/getWidgetId;
+              err python:ds.getError(wid);
+              err_mapping python:ds.getErrorMapping(wid);
+              is_required python: widget.is_required and creation and ('create' not in widget.readonly_layout_modes);
+              tooltip_id python:wid + '_help';
+              widget_css_class cell/widget_css_class|nothing;
+              css_class python:test(err, 'row error','row')"
+              tal:condition="python: wid != 'passport'"
+              >
+          <div tal:attributes="class widget_css_class;
+          id python:widget.getHtmlWidgetId()+'_widget';"
+          >
+            <td>
+            <div class="label" tal:condition="widget/label_edit"
+                 tal:attributes="class python:test(is_required, 'label required','label')">
+              <label tal:content="widget/label_edit"
+                     tal:attributes="for cell/widget_input_area_id|nothing;">label</label>:
+            </div>
+            <button type="button" class="tooltipControl"
+                    tal:condition="widget/help"
+                    tal:attributes="onclick python:'toggleElementVisibility(\'%s\')' % tooltip_id;"> ? </button>
+            </td>
+            <td>
+            <span class="field">
+              <div tal:replace="structure cell/widget_rendered"/>
+            </span>
+            <div class="tooltipArea" style="visibility: hidden;"
+                 tal:condition="widget/help"
+                 tal:attributes="id tooltip_id;
+                 onclick python:'showElement(false, \'%s\')' % tooltip_id;"
+                 >
+              <tal:block tal:content="widget/help">This is the help for this field
+              </tal:block>
+            </div>
+            <tal:block condition="err">
+              <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)">
+                <br /><em style="color: red"
+                          tal:content="msg">err</em>
+              </tal:block>
+            </tal:block>
+            </td>
+          </div>
+        </tr>
+      </span>
+    </span>
+  </table>
+</metal:block>
Index: WAeUP_SRP/trunk/skins/waeup_utilities/fixLevel.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_utilities/fixLevel.py	(revision 1392)
+++ WAeUP_SRP/trunk/skins/waeup_utilities/fixLevel.py	(revision 1393)
@@ -30,6 +30,6 @@
 values = scat.uniqueValuesFor('level')
 #query = ~ In("level",('100', '200', '300', '400', '500', '600'))
-query = In("level",('',))
-res = aq_students(query)
+#query = In("level",('',))
+#res = aq_students(query)
 #from Products.zdb import set_trace;set_trace()
 modified = []
Index: WAeUP_SRP/trunk/skins/waeup_utilities/increaseReturningLevels.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_utilities/increaseReturningLevels.py	(revision 1392)
+++ WAeUP_SRP/trunk/skins/waeup_utilities/increaseReturningLevels.py	(revision 1393)
@@ -10,5 +10,5 @@
 # $Id$
 """
-list Students for ClearanceOfficers
+increase the Level for returning Students
 """
 
