Index: waeup_product/trunk/skins/waeup_student/book_accommodation.py
===================================================================
--- waeup_product/trunk/skins/waeup_student/book_accommodation.py	(revision 165)
+++ waeup_product/trunk/skins/waeup_student/book_accommodation.py	(revision 166)
@@ -4,4 +4,7 @@
 book an accomodation
 """
+import DateTime
+current = DateTime.DateTime()
+
 type_name = 'Student'
 ti = context.portal_types[type_name]
@@ -16,10 +19,11 @@
 
 res,psm,ds = lt.renderLayout(layout_id= 'accobook',
-                      schema_id= 'student',
+                      schema_id= 'student_accommodation',
                       context=context,
                       mapping=validate and REQUEST,
                       ob={},
                       layout_mode='create',
-                      create_action = 'book_accommodation',
+                      submit = "book",
+                      action = 'book_accommodation',
                       )
 if psm == 'invalid':
@@ -65,3 +69,7 @@
     #psm = "Your not admitted"
     psm = "h:%(heading)s free:%(nr_of_free)s %(beds_assigned)s" % dict
+
+    ds.set('sc_date',current)
+    sf.setScratchCardData('accommodation',ds)
+
     return context.booked_accommodation(v=dict)
Index: waeup_product/trunk/skins/waeup_student/booked_accommodation.pt
===================================================================
--- waeup_product/trunk/skins/waeup_student/booked_accommodation.pt	(revision 165)
+++ waeup_product/trunk/skins/waeup_student/booked_accommodation.pt	(revision 166)
@@ -8,4 +8,10 @@
                >
     You have successfully booked bed nr <span tal:content="acco/beds_assigned" /> in <span tal:content="acco/heading" />.
+    <br />Your next steps:
+    <ul>
+      <li>Buy a Hostel Scratch card</li>
+      <li>Login with your user_id and password </li>
+      <li>Klick on the pay Hostel Fee tab</li>
+    </ul>
   </metal:block>
   <metal:block fill-slot="sub">
Index: waeup_product/trunk/skins/waeup_student/check_admission.py
===================================================================
--- waeup_product/trunk/skins/waeup_student/check_admission.py	(revision 165)
+++ waeup_product/trunk/skins/waeup_student/check_admission.py	(revision 166)
@@ -5,4 +5,8 @@
 return html renderer + psm
 """
+import DateTime
+current = DateTime.DateTime()
+
+
 type_name = 'Jamb'
 ti = context.portal_types[type_name]
@@ -22,4 +26,6 @@
                       ob={},
                       layout_mode='create',
+                      action = "check_admission",
+                      submit = "check",
                       )
 if psm == 'invalid':
@@ -45,4 +51,6 @@
                                  ds = ds,
                                  )
+
+ds.set('sc_date',current)
 student.getContent().setScratchCardData('adm_check',ds)
 
Index: waeup_product/trunk/skins/waeup_student/clearence.py
===================================================================
--- waeup_product/trunk/skins/waeup_student/clearence.py	(revision 165)
+++ waeup_product/trunk/skins/waeup_student/clearence.py	(revision 166)
@@ -5,4 +5,8 @@
 return html renderer + psm
 """
+import DateTime
+current = DateTime.DateTime()
+
+
 type_name = 'Jamb'
 ti = context.portal_types[type_name]
@@ -22,5 +26,8 @@
                       ob={},
                       layout_mode='create',
+                      action = "clearence",
+                      submit = "submit",
                       )
+
 if psm == 'invalid':
     return context.clearence_form(rendered = res,
@@ -52,4 +59,5 @@
     rset = REQUEST.set
     student = getattr(context,s_id)
+    ds.set('sc_date',current)
     student.getContent().setScratchCardData('clearence',ds)
     sc_pin =  ds.get('sc_pin')
Index: waeup_product/trunk/skins/waeup_student/layout_accobook_create.pt
===================================================================
--- waeup_product/trunk/skins/waeup_student/layout_accobook_create.pt	(revision 165)
+++ 	(revision )
@@ -1,81 +1,0 @@
-<tal:block define="global creation python:1" />
-<metal:block define-macro="default_edit"
-             tal:define="layout options/layout;
-             ds options/datastructure;
-             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';
-             first_layout options/first_layout|python:0;
-             last_layout options/last_layout|python:0;
-             is_flexible options/is_flexible;
-             cpsmcat nocall:here/translation_service;
-             "
-             >
-  <form action='' method='post' tal:attributes="action string:${options/create_action}"
-        enctype='multipart/form-data' class='workflow'>
-    <div class='group'>
-      <div class='documentFields'>
-        <table width="100%" cellpadding="2" cellspacing="2" summary="Form layout">
-          <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;
-              dm options/datastructure/getDataModel;
-              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">
-                    <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)">
-                      <br /><em style="color: red"
-                                tal:content="msg">err</em>
-                    </tal:block>
-                  </tal:block>
-                </div>
-              </tal:block>
-            </td>
-          </tr>
-        </table>
-        <input type="submit" class="standalone" name="cpsdocument_edit_button" value="book" />
-      </div>        
-    </div>
-  </form>
-</metal:block>
Index: waeup_product/trunk/skins/waeup_student/layout_admission_create.pt
===================================================================
--- waeup_product/trunk/skins/waeup_student/layout_admission_create.pt	(revision 165)
+++ 	(revision )
@@ -1,83 +1,0 @@
-<tal:block define="global creation python:1" />
-<metal:block define-macro="default_edit"
-             tal:define="layout options/layout;
-             ds options/datastructure;
-             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 string:check_admission_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;
-             "
-             >
-  <form action='check_admission' method='post'
-        enctype='multipart/form-data' class='workflow'>
-    <div class='group'>
-      <div class='documentFields'>
-        <table width="100%" cellpadding="2" cellspacing="2" summary="Form layout">
-          <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;
-              dm options/datastructure/getDataModel;
-              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">
-                    <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)">
-                      <br /><em style="color: red"
-                                tal:content="msg">err</em>
-                    </tal:block>
-                  </tal:block>
-                </div>
-              </tal:block>
-            </td>
-          </tr>
-        </table>
-        <input type="submit" class="standalone" name="cpsdocument_edit_button" value="check" />
-      </div>        
-    </div>
-  </form>
-</metal:block>
-  
Index: waeup_product/trunk/skins/waeup_student/layout_clearence_create.pt
===================================================================
--- waeup_product/trunk/skins/waeup_student/layout_clearence_create.pt	(revision 165)
+++ 	(revision )
@@ -1,83 +1,0 @@
-<tal:block define="global creation python:1" />
-<metal:block define-macro="default_edit"
-             tal:define="layout options/layout;
-             ds options/datastructure;
-             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 string:check_admission_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;
-             "
-             >
-  <form action='clearence' method='post'
-        enctype='multipart/form-data' class='workflow'>
-    <div class='group'>
-      <div class='documentFields'>
-        <table width="100%" cellpadding="2" cellspacing="2" summary="Form layout">
-          <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;
-              dm options/datastructure/getDataModel;
-              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">
-                    <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)">
-                      <br /><em style="color: red"
-                                tal:content="msg">err</em>
-                    </tal:block>
-                  </tal:block>
-                </div>
-              </tal:block>
-            </td>
-          </tr>
-        </table>
-        <input type="submit" class="standalone" name="cpsdocument_edit_button" value="check" />
-      </div>        
-    </div>
-  </form>
-</metal:block>
-  
Index: waeup_product/trunk/skins/waeup_student/layout_sc_create.pt
===================================================================
--- waeup_product/trunk/skins/waeup_student/layout_sc_create.pt	(revision 166)
+++ waeup_product/trunk/skins/waeup_student/layout_sc_create.pt	(revision 166)
@@ -0,0 +1,85 @@
+<tal:block define="global creation python:1" />
+<metal:block define-macro="default_edit"
+             tal:define="layout options/layout;
+             ds options/datastructure;
+             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 options/action;
+             submittext options/submit;
+             first_layout options/first_layout|python:0;
+             last_layout options/last_layout|python:0;
+             is_flexible options/is_flexible;
+             cpsmcat nocall:here/translation_service;
+             "
+             >
+  <form action='check_admission' tal:attributes="action formaction" method='post'
+        enctype='multipart/form-data' class='workflow'>
+    <div class='group'>
+      <div class='documentFields'>
+        <table width="100%" cellpadding="2" cellspacing="2" summary="Form layout">
+          <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;
+              dm options/datastructure/getDataModel;
+              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">
+                    <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)">
+                      <br /><em style="color: red"
+                                tal:content="msg">err</em>
+                    </tal:block>
+                  </tal:block>
+                </div>
+              </tal:block>
+            </td>
+          </tr>
+        </table>
+        <input type="submit" class="standalone" name="cpsdocument_edit_button" 
+               value="check" tal:attributes="value submittext"/>
+      </div>        
+    </div>
+  </form>
+</metal:block>
+  
Index: waeup_product/trunk/skins/waeup_student/pay_hostel_fee.py
===================================================================
--- waeup_product/trunk/skins/waeup_student/pay_hostel_fee.py	(revision 166)
+++ waeup_product/trunk/skins/waeup_student/pay_hostel_fee.py	(revision 166)
@@ -0,0 +1,45 @@
+##parameters=REQUEST
+# $Id$
+"""
+book an accomodation
+"""
+import DateTime
+current = DateTime.DateTime()
+
+type_name = 'Student'
+ti = context.portal_types[type_name]
+pm = context.portal_membership
+REQUEST.set('type_name',type_name)
+
+validate = REQUEST.has_key("cpsdocument_edit_button")
+
+
+lt = context.portal_layouts
+pr = context.portal_registration
+
+res,psm,ds = lt.renderLayout(layout_id= 'accopay',
+                      schema_id= 'student_hostel_fee',
+                      context=context,
+                      mapping=validate and REQUEST,
+                      ob={},
+                      layout_mode='create',
+                      submit = "pay",
+                      action = 'pay_hostel_fee',
+                      )
+if psm == 'invalid':
+    return context.book_accommodation_form(rendered = res,
+                                 psm = "Please correct your input",
+                                 ds = ds,
+                                 )
+elif psm == '':
+    return context.book_accommodation_form(rendered = res,
+                                 psm = None,
+                                 ds = ds,
+                                 )
+elif psm == 'valid':
+    sf = context.getContent()
+
+    ds.set('sc_date',current)
+    sf.setScratchCardData('hostel_fee',ds)
+
+    return context.payed_hostel_fee(dict=ds)
Index: waeup_product/trunk/skins/waeup_student/payed_hostel_fee.pt
===================================================================
--- waeup_product/trunk/skins/waeup_student/payed_hostel_fee.pt	(revision 166)
+++ waeup_product/trunk/skins/waeup_student/payed_hostel_fee.pt	(revision 166)
@@ -0,0 +1,17 @@
+<html metal:use-macro="here/content_lib_master/macros/master">
+  <metal:block fill-slot="head_slot">
+  </metal:block>
+  <metal:block fill-slot="header">
+  </metal:block>
+  <metal:block fill-slot="main"
+               tal:define="student context/getContent;
+               dict options/dict"
+               >
+    You payed <span tal:content="student/accommodation" /><br /> 
+    with Scratchcard PIN <span tal:content="dict/sc_pin" /> <br />
+    on <span  tal:content="dict/sc_date"/>.
+    
+  </metal:block>
+  <metal:block fill-slot="sub">
+  </metal:block>
+</html>
Index: waeup_product/trunk/skins/waeup_student/process_waeup_login.py
===================================================================
--- waeup_product/trunk/skins/waeup_student/process_waeup_login.py	(revision 165)
+++ waeup_product/trunk/skins/waeup_student/process_waeup_login.py	(revision 166)
@@ -38,4 +38,9 @@
 context.notifyCPSDocumentCreation(ob=pd)
 
+pdid = 'DOCUMENTS'
+ma.invokeFactory('StudentDocuments', pdid)
+pd = getattr(ma,pdid)
+context.notifyCPSDocumentCreation(ob=pd)
+
 return response.redirect("%s/eligibility" % ma.absolute_url())
 return ma.eligibility(REQUEST=context.REQUEST)
Index: waeup_product/trunk/skins/waeup_student/student_documents_edit_form.pt
===================================================================
--- waeup_product/trunk/skins/waeup_student/student_documents_edit_form.pt	(revision 166)
+++ waeup_product/trunk/skins/waeup_student/student_documents_edit_form.pt	(revision 166)
@@ -0,0 +1,69 @@
+<tal:block define="res python:here.editCPSDocument(REQUEST=request);
+                   rendered_main python: res[0];
+                   portal_status_message python: res[1];
+                   edition python:1;
+  ">
+<metal:block define-macro="edit_form">
+<metal:block use-macro="here/content_lib_master/macros/master">
+  <metal:block fill-slot="css_slot">
+    <link rel="Stylesheet" type="text/css" href=""
+      tal:attributes="href string:${base_url}document.css" />
+
+    <metal:block define-macro="widgets_javascript">
+    <!-- XXX this has to move to CPSSchemas -->
+    <style type="text/css"
+      tal:content="string:@import url(${base_url}calendar-win2k-1.css);"></style>
+    <script type="text/javascript" src="calendar.js"
+      tal:attributes="src string:${base_url}calendar.js"></script>
+    <script type="text/javascript" src="lang/calendar-en.js"
+      tal:define="local cpsmcat/getSelectedLanguage"
+      tal:attributes="src string:${base_url}lang/calendar-${local}.js"></script>
+    <script type="text/javascript" src="calendar-setup.js"
+      tal:attributes="src string:${base_url}calendar-setup.js"></script>
+
+    <script type="text/javascript">
+    <!--
+     function popup_rte(input_id, label_edit) {
+       var args, value
+       value = document.getElementById(input_id).value;
+       args='?input_id='+input_id+'&label_edit='+escape(label_edit);
+       popup = window.open('popup_rte_form'+args, input_id, 'toolbar=0, scrollbars=0, location=0, statusbar=0, menubar=0, resizable=1, dependent=1, width=640, height=480')
+       if(!popup.opener)
+         popup.opener = window;
+       return false;
+   }
+   //-->
+   </script>
+   </metal:block>
+  </metal:block>
+
+  <metal:block fill-slot="header"
+    tal:define="creation creation|nothing;
+                edition edition|nothing;
+                metadata metadata|nothing">
+    <h1 tal:condition="creation" i18n:translate="">
+      Create a document of type
+      <tal:block i18n:name="type_name" i18n:translate=""
+            tal:define="type_name request/type_name;
+                        type_info python:here.portal_types[type_name]"
+            tal:content="type_info/Title">Type Title</tal:block>
+    </h1>
+    <h1 tal:condition="python: 0 and not creation">
+      <img tal:replace="structure python:here.getImgTag('/'+here.getIcon(), base_url='')">
+      <tal:block condition="edition"
+        i18n:translate="">Edit <span i18n:name="title"
+        tal:content="here/title_or_id">Page Title</span></tal:block>
+      <tal:block tal:condition="metadata"
+        i18n:translate="">heading_metadata_edit</tal:block>
+    </h1>
+  </metal:block>
+
+  <metal:block fill-slot="main">
+    <div tal:replace="structure rendered_main" />
+  </metal:block>
+  <metal:block fill-slot="sub">
+  </metal:block>
+
+</metal:block>
+</metal:block>
+</tal:block>
