Index: WAeUP_SRP/trunk/skins/waeup_default/layout_waeup_edit.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_default/layout_waeup_edit.pt	(revision 661)
+++ 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>
