Index: /WAeUP_SRP/trunk/profiles/default/actionicons.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/actionicons.xml	(revision 1476)
+++ /WAeUP_SRP/trunk/profiles/default/actionicons.xml	(revision 1477)
@@ -54,4 +54,8 @@
               title="Change Bed" priority="90"
               icon_expr="bed_list_refresh.gif"/>
+ <action-icon category="object"
+              action_id="allocate_reserved_bed"
+              title="Allocate Reserved Bed" priority="100"
+              icon_expr="bed_list_refresh.gif"/>              
  <action-icon category="folder" action_id="portlets"
               title="Manage portlets" priority="270"
@@ -280,5 +284,5 @@
  <action-icon category="student" action_id="change_password"
               title="Change Password" priority="7"
-              icon_expr="actionicon_user_preferences.png"/>              
+              icon_expr="actionicon_user_preferences.png"/>
 
  <action-icon category="global" action_id="members"
Index: /WAeUP_SRP/trunk/profiles/default/types/AccoHall.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/types/AccoHall.xml	(revision 1476)
+++ /WAeUP_SRP/trunk/profiles/default/types/AccoHall.xml	(revision 1477)
@@ -42,3 +42,8 @@
   <permission value="Modify portal content"/>
  </action>
+ <action title="Allocate/Release Reserved Bed" action_id="allocate_reserved_bed" category="object"
+    condition_expr="" url_expr="string:${object_url}/allocate_reserved_bed"
+    visible="True">
+  <permission value="Modify portal content"/>
+ </action>
 </object>
Index: /WAeUP_SRP/trunk/skins/waeup_accommodation/allocate_reserved_bed.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_accommodation/allocate_reserved_bed.py	(revision 1477)
+++ /WAeUP_SRP/trunk/skins/waeup_accommodation/allocate_reserved_bed.py	(revision 1477)
@@ -0,0 +1,145 @@
+##parameters=REQUEST
+# $Id: allocate_reserved_bed.py 1451 2007-02-20 22:17:41Z joachim $
+"""
+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.AllocateReservedBed')
+
+#change = REQUEST.has_key("allocate_and_change")
+change = False
+release = REQUEST.has_key("release")
+allocate = REQUEST.has_key("allocate")
+validate = release or change or (allocate and
+           REQUEST.get("allocate").startswith('Allocate'))
+mode = 'create'
+d = {}
+rendered,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.allocate_reserved_bed_form(rendered = rendered,
+                                 psm = psm,
+                                 #psm = "%s, %s" % (psm,ds),
+                                 mode = mode,
+                                 formaction = "allocate_reserved_bed",
+                                 button = "Allocate Bed",
+                                 ds = ds,
+                                 )
+elif psm == '':
+    return context.allocate_reserved_bed_form(rendered = rendered,
+                                 psm = psm,
+                                 mode = mode,
+                                 formaction = "allocate_reserved_bed",
+                                 button = "Allocate Bed",
+                                 ds = ds,
+                                 )
+elif psm == 'valid':
+    pass
+#from Products.zdb import set_trace;set_trace()
+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 = bid)
+psm = ''
+students = context.portal_url.getPortalObject().campus.students
+student_obj = getattr(students,sid)
+acco_id = "accommodation_%s" % context.getSessionId()
+while True:
+    if not res:
+        psm = "No bed with id %s" % bid
+        break
+    bed_brain = res[0]
+    already = acco_cat(student=sid)
+    if allocate or change:
+        if already and not change:
+            psm = "Student %s already reserved bed %s" % (sid, already[0].bed)
+            break
+        if not bed_brain.bed_type.endswith("reserved"):
+            psm = "Not a reserved bed: %s" % bid
+            break
+        if bed_brain.student and not change:
+            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
+    if release:
+        if acco_id in student_obj.objectIds():
+            acco_doc = getattr(student_obj, acco_id).getContent()
+            if acco_doc.bed == bid:
+                psm = "Student %s has already booked (paid) bed %s" % (sid, bid)
+                break
+        if not already:
+            psm = "Student %s has no reserved bed" % (sid)
+            break
+        if not bed_brain.bed_type.endswith("reserved"):
+            psm = "Not a reserved bed: %s" % bid
+            break
+        if not bed_brain.student:
+            psm = "Bed %s not allocated" % (bid)
+            break
+    break
+
+if psm != '':
+    return context.allocate_reserved_bed_form(rendered = rendered,
+                                 psm = psm,
+                                 mode = mode,
+                                 ds = ds,
+                                 formaction = "allocate_reserved_bed",
+                                 button = "Allocate Bed",
+                                 )
+if change:
+    for bed in already:
+        acco_cat.modifyRecord(bed=bed.bed,student='')
+
+if allocate or change:
+    acco_cat.modifyRecord(bed = bid, student = sid)
+    if acco_id in student_obj.objectIds():
+        acco_doc = getattr(student_obj, acco_id).getContent()
+        acco_doc.edit(mapping={'bed': bid})
+    logger.info('"%s","booked reserved bed %s for","%s"' % (member,bid,sid))
+    psm = "Bed %s reserved for %s %s" % (bid,sid,student.name)
+elif release:
+    modify = False
+    if acco_id in student_obj.objectIds():
+        #acco_doc = getattr(student_obj, acco_id).getContent()
+        if acco_doc.bed != bid:
+            modify = True
+    else:
+        modify = True
+    if modify:
+        acco_cat.modifyRecord(bed=bid,student='')
+        logger.info('"%s","cancelled reservation %s by","%s"' % (member,bid,sid))
+        psm = "%s removed from %s" % (student.name,bid)
+    else:
+        psm = "%s removing failed from %s" % (student.name,bid)
+
+mode = 'view'
+return context.allocate_reserved_bed_form(rendered = "",
+                                 psm = psm,
+                                 mode = mode,
+                                 formaction = "allocate_reserved_bed",
+                                 button = "Next Reservation",
+                                 ds = ds,
+                                 )
+
Index: /WAeUP_SRP/trunk/skins/waeup_accommodation/allocate_reserved_bed_form.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_accommodation/allocate_reserved_bed_form.pt	(revision 1477)
+++ /WAeUP_SRP/trunk/skins/waeup_accommodation/allocate_reserved_bed_form.pt	(revision 1477)
@@ -0,0 +1,46 @@
+<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">
+      
+      
+        <h3>Allocate or Release Reserved Bed! </h3>
+        <br />      
+      
+        <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="allocate"
+                 tal:attributes="value options/button"
+                 tal:condition="not:creation" />
+          <input type="submit" tal:condition="python:0 and mode !='view'"
+                 class="standalone" 
+                 name="allocate_and_change"
+                 value="Allocate and Change Bed"
+                 />
+          <input type="submit" tal:condition="python:mode !='view'"
+                 class="standalone" 
+                 name="release"
+                 value="Release Bed"
+                 />
+        </form>
+      </metal:block>
+      <metal:block fill-slot="sub">
+      </metal:block>
+    </metal:block>
+  </metal:block>
+</tal:block>
Index: eUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed.py	(revision 1476)
+++ 	(revision )
@@ -1,145 +1,0 @@
-##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.BookReservedBed')
-
-#change = REQUEST.has_key("reserve_and_change")
-change = False
-release = REQUEST.has_key("release")
-reserve = REQUEST.has_key("reserve")
-validate = release or change or (reserve and
-           REQUEST.get("reserve").startswith('Reserve'))
-mode = 'create'
-d = {}
-rendered,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 = rendered,
-                                 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 = rendered,
-                                 psm = psm,
-                                 mode = mode,
-                                 formaction = "book_reserved_bed",
-                                 button = "Reserve Bed",
-                                 ds = ds,
-                                 )
-elif psm == 'valid':
-    pass
-#from Products.zdb import set_trace;set_trace()
-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 = bid)
-psm = ''
-students = context.portal_url.getPortalObject().campus.students
-student_obj = getattr(students,sid)
-acco_id = "accommodation_%s" % context.getSessionId()
-while True:
-    if not res:
-        psm = "No bed with id %s" % bid
-        break
-    bed_brain = res[0]
-    already = acco_cat(student=sid)
-    if reserve or change:
-        if already and not change:
-            psm = "Student %s already reserved bed %s" % (sid, already[0].bed)
-            break
-        if not bed_brain.bed_type.endswith("reserved"):
-            psm = "Not a reserved bed: %s" % bid
-            break
-        if bed_brain.student and not change:
-            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
-    if release:
-        if acco_id in student_obj.objectIds():
-            acco_doc = getattr(student_obj, acco_id).getContent()
-            if acco_doc.bed != bid:
-                psm = "Student %s has not reserved bed %s" % (sid, bid)
-                break
-        if not already:
-            psm = "Student %s already has no reserved beds" % (sid, already[0].bed)
-            break
-        if not bed_brain.bed_type.endswith("reserved"):
-            psm = "Not a reserved bed: %s" % bid
-            break
-        if not bed_brain.student:
-            psm = "Bed %s not reserved for %s" % (bid,bed_brain.student)
-            break
-    break
-
-if psm != '':
-    return context.book_reserved_bed_form(rendered = rendered,
-                                 psm = psm,
-                                 mode = mode,
-                                 ds = ds,
-                                 formaction = "book_reserved_bed",
-                                 button = "Reserve Bed",
-                                 )
-if change:
-    for bed in already:
-        acco_cat.modifyRecord(bed=bed.bed,student='')
-
-if reserve or change:
-    acco_cat.modifyRecord(bed = bid, student = sid)
-    if acco_id in student_obj.objectIds():
-        acco_doc = getattr(student_obj, acco_id).getContent()
-        acco_doc.edit(mapping={'bed': bid})
-    logger.info('"%s","booked reserved bed %s for","%s"' % (member,bid,sid))
-    psm = "Bed %s reserved for %s %s" % (bid,sid,student.name)
-elif release:
-    modify = False
-    if acco_id in student_obj.objectIds():
-        acco_doc = getattr(student_obj, acco_id).getContent()
-        if acco_doc.bed != bid:
-            modify = True
-    else:
-        modify = True
-    if modify:
-        acco_cat.modifyRecord(bed=bid,student='')
-        logger.info('"%s","cancelled reservation %s by","%s"' % (member,bid,sid))
-        psm = "%s removed from %s" % (student.name,bid)
-    else:
-        psm = "%s removing failed for %s" % (student.name,bid)
-        
-mode = 'view'
-return context.book_reserved_bed_form(rendered = "",
-                                 psm = psm,
-                                 mode = mode,
-                                 formaction = "book_reserved_bed",
-                                 button = "Next Reservation",
-                                 ds = ds,
-                                 )
-
Index: eUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed_form.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_accommodation/book_reserved_bed_form.pt	(revision 1476)
+++ 	(revision )
@@ -1,41 +1,0 @@
-<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="reserve"
-                 tal:attributes="value options/button"
-                 tal:condition="not:creation" />
-          <input type="submit" tal:condition="python:0 and mode !='view'"
-                 class="standalone" 
-                 name="reserve_and_change"
-                 value="Reserve and Change Bed"
-                 />
-          <input type="submit" tal:condition="python:mode !='view'"
-                 class="standalone" 
-                 name="release"
-                 value="Release Bed"
-                 />
-        </form>
-      </metal:block>
-      <metal:block fill-slot="sub">
-      </metal:block>
-    </metal:block>
-  </metal:block>
-</tal:block>
