Index: /WAeUP_SRP/trunk/WAeUPTables.py
===================================================================
--- /WAeUP_SRP/trunk/WAeUPTables.py	(revision 671)
+++ /WAeUP_SRP/trunk/WAeUPTables.py	(revision 672)
@@ -85,5 +85,5 @@
             return -1,"Student with Id %s already booked bed %s" % (student_id,records[0].bed)
             
-        records = [r for r in self.searchResults({'bed_type' : bed_type, "student": ''})]
+        records = [r for r in self.searchResults({'bed_type' : bed_type}) if not r]
         if len(records) == 0:
             return -1,"no bed of this type available"
Index: /WAeUP_SRP/trunk/profiles/default/layouts/student_accommodation.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/layouts/student_accommodation.xml	(revision 671)
+++ /WAeUP_SRP/trunk/profiles/default/layouts/student_accommodation.xml	(revision 672)
@@ -2,5 +2,5 @@
 <object name="student_accommodation" meta_type="CPS Layout">
  <property name="layout_create_method"></property>
- <property name="layout_edit_method"></property>
+ <property name="layout_edit_method">layout_waeup_edit</property>
  <property name="layout_view_method"></property>
  <property name="style_prefix">layout_accommodation_</property>
@@ -8,10 +8,10 @@
  <property name="validate_values_expr"></property>
  <widget name="acco_maint_date" meta_type="DateTime Widget">
-  <property name="title">Maintainance Fee Date</property>
+  <property name="title">Accommodation Maintainance Date</property>
   <property name="fields">
    <element value="acco_maint_date"/>
   </property>
-  <property name="label">Maintainance Fee Date</property>
-  <property name="label_edit">Maintainance Fee Date</property>
+  <property name="label">Accommodation Maintainance Date</property>
+  <property name="label_edit">Accommodation Maintainance Date</property>
   <property name="readonly_layout_modes"/>
   <property name="hidden_layout_modes"/>
@@ -21,10 +21,10 @@
  </widget>
  <widget name="acco_maint_sc_pin" meta_type="String Widget">
-  <property name="title">Maintainance Fee Access Code</property>
+  <property name="title">Accommodation Maintainance SC-Pin</property>
   <property name="fields">
    <element value="acco_maint_sc_pin"/>
   </property>
-  <property name="label">Maintainance Fee Access Code</property>
-  <property name="label_edit">Maintainance Fee Access Code</property>
+  <property name="label">Accommodation Maintainance SC-Pin</property>
+  <property name="label_edit">Accommodation Maintainance SC-Pin</property>
   <property name="readonly_layout_modes"/>
   <property name="hidden_layout_modes"/>
@@ -33,10 +33,10 @@
  </widget>
  <widget name="acco_res_date" meta_type="DateTime Widget">
-  <property name="title">Reservation Date</property>
+  <property name="title">Accommodation Reservation Date</property>
   <property name="fields">
    <element value="acco_res_date"/>
   </property>
-  <property name="label">Reservation Date</property>
-  <property name="label_edit">Reservation Date</property>
+  <property name="label">Accommodation Reservation Date</property>
+  <property name="label_edit">Accommodation Reservation Date</property>
   <property name="readonly_layout_modes"/>
   <property name="hidden_layout_modes"/>
@@ -45,10 +45,10 @@
  </widget>
  <widget name="acco_res_sc_pin" meta_type="String Widget">
-  <property name="title">Reservation Access Code</property>
+  <property name="title">Accommodation Reservation SC-Pin</property>
   <property name="fields">
    <element value="acco_res_sc_pin"/>
   </property>
-  <property name="label">Reservation Access Code</property>
-  <property name="label_edit">Reservation Access Code</property>
+  <property name="label">Accommodation Reservation SC-Pin</property>
+  <property name="label_edit">Accommodation Reservation SC-Pin</property>
   <property name="readonly_layout_modes"/>
   <property name="hidden_layout_modes"/>
Index: /WAeUP_SRP/trunk/skins/waeup_default/layout_waeup_edit.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_default/layout_waeup_edit.pt	(revision 671)
+++ /WAeUP_SRP/trunk/skins/waeup_default/layout_waeup_edit.pt	(revision 672)
@@ -1,179 +1,136 @@
 <!-- a layout_lib macro -->
 <!-- $Id$ -->
+
 <metal:block define-macro="default_edit"
   tal:define="layout options/layout;
-              ds options/datastructure;
-              dm ds/getDataModel;
-              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);
-              creation_form python:ti and ti.getActionById('create', 'cpsdocument_create_form') or 'cpsdocument_create_form' ;
-              edit_form     python:ti and ti.getActionById('edit',   'cpsdocument_edit_form') or  'cpsdocument_edit_form';
-              metadata_form python:ti and ti.getActionById('metadata', 'cpsdocument_metadata') or 'cpsdocument_metadata';
-              formaction formaction|python: test(creation, creation_form,
-                                 test(metadata, metadata_form,
-                                                edit_form));
-              first_layout options/first_layout|python:0;
-              last_layout options/last_layout|python:0;
-              is_flexible options/is_flexible;
-              cpsmcat nocall:here/translation_service;
-              ">
-<tal:block condition="python:first_layout">
-  <tal:block
-  content="structure string:<form id='editForm' action='${formaction}' method='post'
-  enctype='multipart/form-data' class='workflow'>
-  <div class='group'><div class='documentFields'>" />
-  <input type="hidden" name="type_name" value="."
-    tal:condition="creation" tal:attributes="value request/type_name" />
-</tal:block>
-
-<table width="100%" cellpadding="2" cellspacing="2" summary="Form layout"
-       tal:condition="layout/rows">
-  <tr tal:repeat="row layout/rows" valign="top">
-    <td tal:repeat="cell row"
-      tal:attributes="colspan cell/ncols">
-      <tal:block define="widget cell/widget;
-                         wid widget/getWidgetId;
-                         err python:ds.getError(wid);
-                         err_mapping python:ds.getErrorMapping(wid);
-                         is_required widget/is_required|nothing;
-                         tooltip_id python:wid + '_help';
-                         widget_css_class cell/widget_css_class|nothing;
-                         widget_css_class python:test(is_flexible, 'group', widget_css_class);
-                         css_class python:test(err, 'row error',
-                                               test(is_flexible, 'group', 'row'))">
-        <div tal:attributes="class widget_css_class;
-                             id python:widget.getHtmlWidgetId()+'_widget';
-                            ">
-          <div class="label" tal:condition="widget/label_edit"
-            tal:attributes="class python:test(is_required, 'label required',
-                                              'label')">
-            <label i18n:translate="" tal:condition="widget/is_i18n"
-              tal:content="widget/label_edit"
-              tal:attributes="for cell/widget_input_area_id|nothing;">label</label>
-            <label tal:condition="not:widget/is_i18n"
-              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>
-          <div class="field">
-            <div tal:replace="structure cell/widget_rendered"/>
-          </div>
-          <div class="tooltipArea" style="visibility: hidden;"
-               tal:condition="widget/help"
-               tal:attributes="id tooltip_id;
-                               onclick python:'showElement(false, \'%s\')' % tooltip_id;">
-            <tal:block i18n:translate="" tal:condition="widget/is_i18n"
-              tal:content="widget/help">i18_key-help_for_this_field</tal:block>
-            <tal:block tal:condition="not:widget/is_i18n"
-              tal:content="widget/help">This is the help for this field</tal:block>
-          </div>
-          <tal:block condition="err">
+  ds options/datastructure;
+  dm ds/getDataModel;
+  formaction options/formaction|string:student_edit;
+  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;
+  widgets python:context.getRenderedWidgets(layout);
+  ">
+  <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:content="msg">err</em>
               </tal:block>
-          </tal:block>
-          <div style="float: right;" tal:condition="is_flexible">
-            <input type="button" value="button_move_up"
-              tal:condition="not:repeat/row/start"
-              tal:attributes="name string:uprow_${repeat/row/index};
-                              onclick python:'CPSFlexibleEdit.buttonClick(this, \'\')'"
-              class="context moveUp" i18n:attributes="value" />
-            <input type="button" value="button_move_down"
-              tal:condition="not:repeat/row/end"
-              tal:attributes="name string:downrow_${repeat/row/index};
-                              onclick python:'CPSFlexibleEdit.buttonClick(this, \'\')'"
-              class="context moveDown" i18n:attributes="value" />
-            <input type="button" value="button_delete"
-              class="destructive" i18n:attributes="value"
-              tal:attributes="name string:deleterow_${repeat/row/index};
-                              onclick python:'CPSFlexibleEdit.buttonClick(this, \'%s\')' %
-                                (cpsmcat('description_confirm_delete'), )" />
+            </tal:block>
+            </td>
           </div>
+        </tr>
+      </span>
+    </span>
+    <tr tal:condition="widgets/passport|nothing" 
+        tal:define="cell widgets/passport|nothing;">
+      <tal:block 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 widget/widget_css_class|nothing;
+      css_class python:test(err, 'row error','row')"
+      >
+        <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>
       </tal:block>
-    </td>
-  </tr>
-</table>
+    </tr>
+  </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" />
 
-<tal:block condition="is_flexible">
-<div tal:define="flexible_widgets options/flexible_widgets">
-  <input type="hidden" name="layout_id" value="."
-    tal:attributes="value layout/layout_id" />
-  <tal:select condition="python:len(flexible_widgets)>1">
-    <select name="widget_type">
-      <tal:block repeat="widget options/flexible_widgets">
-      <option value="."
-        tal:condition="widget/is_i18n"
-        i18n:translate=""
-        tal:attributes="value widget/getWidgetId"
-        tal:content="widget/title_or_id">Type</option>
-      <option value="."
-        tal:condition="not:widget/is_i18n"
-        tal:attributes="value widget/getWidgetId"
-        tal:content="widget/title_or_id">Type</option>
-      </tal:block>
-    </select>
-    <input type="button" id="addwidget_button"
-           name="addwidget_button" value="button_add"
-           class="context"
-           i18n:attributes="value"
-           tal:attributes="onclick python:'CPSFlexibleEdit.buttonClick(this, \'\')'" />
-  </tal:select>
-  <tal:button condition="python:len(flexible_widgets) == 1">
-    <tal:block define="widget python:flexible_widgets[0]">
-      <input type="hidden" name="widget_type"
-        tal:attributes="value widget/getWidgetId">
-      <input type="submit" name="addwidget_button"
-        id="addwidget_button"
-        tal:define="button_add python:cpsmcat('button_add');
-          widget_title python:cpsmcat(widget.title_or_id())"
-        tal:attributes="value string:${button_add} ${widget_title}"
-        class="context" />
-    </tal:block>
-  </tal:button>
-</div>
-</tal:block>
-
-<tal:block condition="python: last_layout">
-  <tal:block content="structure string:</div>" />
-  <metal:block define-slot="additional_content" />
-
-  <tal:block condition="not:creation">
-    <div class="tooltipArea" style="visibility: hidden;"
-      id="transition_comments_help"
-      onclick="showElement(false, 'transition_comments_help')"
-      i18n:translate="help_transition_comments_modification">
-      In this filed you can give the reason of the modification that you are doing on this document.
-      Your comments may be used to notify other users.
-    </div>
-    <dl>
-      <dt><label for="comments"
-          i18n:translate="transition_comments_modification">Reason of the modification</label>
-        <button type="button" class="tooltipControl"
-          onclick="toggleElementVisibility('transition_comments_help')"> ? </button>
-      </dt>
-      <dd>
-        <textarea name="comments" id="comments" cols="60" rows="3"
-          tal:content="nothing">
-        </textarea>
-      </dd>
-    </dl>
-  </tal:block>
-  <input type="submit" class="standalone" name="cpsdocument_edit_button"
-    value="button_change" i18n:attributes="value" id="cpsdocument_edit_button"
-    tal:condition="not:creation" />
-  <input type="submit" class="standalone" name="cpsdocument_edit_and_view_button"
-    value="button_change_and_view" i18n:attributes="value"
-    id="cpsdocument_edit_and_view_button"
-    tal:condition="not:creation" />
-  <input type="submit" class="standalone" name="cpsdocument_create_button"
-    value="button_create" i18n:attributes="value" tal:condition="creation" />
-  <tal:block content="structure string:</div></form>" />
-</tal:block>
-
+</form>
 </metal:block>
Index: /WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py	(revision 671)
+++ /WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py	(revision 672)
@@ -62,4 +62,8 @@
 
 items = []
+s_edit_links = {'StudentApplication': 'student_edit',
+              'StudentAccommodation': '',
+              'StudentPersonal': '',
+              }
 sos = context.portal_catalog(container_path=student_path)
 for so in sos:
@@ -72,5 +76,7 @@
     row['type'] = so.portal_type
     row['is_editable'] = mtool.checkPermission('Modify portal content', soo)
+    row['s_edit_link'] = "%s/%s" % (student.absolute_url(),s_edit_links[so.portal_type])
     row['review_state'] = so.review_state
+    row['display'] = so.review_state in ('opened','closed')
     items.append(row)
 info['items'] = items
Index: /WAeUP_SRP/trunk/skins/waeup_student/layout_application_edit.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/layout_application_edit.pt	(revision 671)
+++ /WAeUP_SRP/trunk/skins/waeup_student/layout_application_edit.pt	(revision 672)
@@ -15,9 +15,7 @@
   widgets python:context.getRenderedWidgets(layout);
   ">
-  <span tal:condition="python: 0" tal:replace="structure widgets" />
   <form action="" id="editForm" method="post" 
         enctype="multipart/form-data" class="workflow"
         tal:attributes="action formaction"
-        
         >
   <table class="layoutDefault" summary="Form layout"
@@ -71,5 +69,6 @@
       </span>
     </span>
-    <tr tal:condition="widgets/passport|nothing" tal:define="cell widgets/passport|nothing;">
+    <tr tal:condition="widgets/passport|nothing" 
+        tal:define="cell widgets/passport|nothing;">
       <tal:block tal:define="widget cell/widget;
       wid widget/getWidgetId;
Index: /WAeUP_SRP/trunk/skins/waeup_student/passport_entry_view.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/passport_entry_view.pt	(revision 671)
+++ /WAeUP_SRP/trunk/skins/waeup_student/passport_entry_view.pt	(revision 672)
@@ -15,5 +15,6 @@
               tal:content="structure python: info['app_doc'].render(proxy=info['app_doc'],
               layout_mode='edit', 
-              layout_id='student_application_fe')" 
+              layout_id='student_application_fe',
+              )" 
               />
       </span>
Index: /WAeUP_SRP/trunk/skins/waeup_student/student_view.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/student_view.pt	(revision 671)
+++ /WAeUP_SRP/trunk/skins/waeup_student/student_view.pt	(revision 672)
@@ -38,5 +38,5 @@
         <table tal:condition="is_student" class="contentListing" width="100%" summary="content layout" id="folder_content">      
           <span tal:repeat="row rows">
-          <tr tal:condition="python:row['type'] == 'StudentApplication' and row['review_state'] in ['opened', 'closed']"
+          <tr tal:condition="row/display"
             tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')">
             <td><a href="view" tal:attributes="href string:${row/url}/application_view">
@@ -44,5 +44,5 @@
             <td> 
             <a tal:condition="row/is_editable"
-                href="edit" tal:attributes="href string:${info/url}/passport_entry_view">
+                href="edit" tal:attributes="href string:${row/s_edit_link}">
                 [edit]
             </a> 
