Changeset 686 for WAeUP_SRP


Ignore:
Timestamp:
13 Oct 2006, 11:27:44 (18 years ago)
Author:
joachim
Message:

accommodation reservation works again, reverted layout_waeup_edit to old version

Location:
WAeUP_SRP/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/ScratchCards.py

    r682 r686  
    9191        pins_cat = self.portal_pins
    9292        doc = self.getContent()
    93         l = [{'pin': p.pin,
     93        unused = [{'pin': p.pin,
    9494              'serial': p.serial,
    9595              } for p in pins_cat.searchResults(prefix_batch = "%s%d"
    9696                                               % (doc.prefix,doc.batch_no),
    97                                                ) if p.student == '']
    98         if len (l) <= max_pins:
    99             return l
    100         return l[:max_pins]
     97                                               ) if not p.student]
     98        used = [{'pin': p.pin,
     99              'serial': p.serial,
     100              'student': p.student,
     101              } for p in pins_cat.searchResults(prefix_batch = "%s%d"
     102                                               % (doc.prefix,doc.batch_no),
     103                                               ) if p.student]
     104        if len (unused) <= max_pins:
     105            return unused,used
     106        return unused[:max_pins],used
    101107
    102108InitializeClass(ScratchCardBatch)
  • WAeUP_SRP/trunk/WAeUPTables.py

    r673 r686  
    8080
    8181    def searchAndReserveBed(self, student_id,bed_type):
    82         #import pdb;pdb.set_trace()
    8382        records = self.searchResults({'student' : student_id})
    8483        if len(records) > 0:
     
    8685           
    8786        records = [r for r in self.searchResults({'bed_type' : bed_type}) if not r.student]
     87        #import pdb;pdb.set_trace()
    8888        if len(records) == 0:
    8989            return -1,"no bed of this type available"
  • WAeUP_SRP/trunk/profiles/default/layouts/student_accommodation.xml

    r680 r686  
    11<?xml version="1.0"?>
    22<object name="student_accommodation" meta_type="CPS Layout">
    3  <property name="layout_create_method"></property>
    4  <property name="layout_edit_method"></property>
     3 <property name="layout_create_method">layout_application_create</property>
     4 <property name="layout_edit_method">layout_application_edit</property>
    55 <property name="layout_view_method"></property>
    6  <property name="style_prefix">layout_waeup_</property>
     6 <property name="style_prefix">layout_accommodation_</property>
    77 <property name="flexible_widgets"/>
    88 <property name="validate_values_expr"></property>
     
    1515  <property name="label_edit">Maintainance Fee Date</property>
    1616  <property name="readonly_layout_modes"/>
    17   <property name="hidden_layout_modes"/>
     17  <property name="hidden_layout_modes">
     18    <element value="create"/>
     19  </property>
    1820  <property name="hidden_readonly_layout_modes"/>
    1921  <property name="view_format">iso8601_medium_easy</property>
    2022  <property name="hidden_empty"></property>
    2123 </widget>
    22  <widget name="acco_maint_sc_pin" meta_type="String Widget">
     24 <widget name="acco_maint_sc_pin" meta_type="Scratchcard Pin Widget">
    2325  <property name="title">Maintainance Fee Access Code</property>
    2426  <property name="fields">
     
    2729  <property name="label">Maintainance Fee Access Code</property>
    2830  <property name="label_edit">Maintainance Fee Access Code</property>
     31  <property name="hidden_layout_modes">
     32    <element value="create"/>
     33  </property>
    2934  <property name="readonly_layout_modes"/>
    30   <property name="hidden_layout_modes"/>
    3135  <property name="hidden_readonly_layout_modes"/>
    3236<property name="hidden_empty"></property>
    33  </widget>
    34  <widget name="acco_res_date" meta_type="DateTime Widget">
     37  <property name="prefix">HMU</property>
     38  </widget>
     39<widget name="student_status" meta_type="Select Widget">
     40 <property name="title">Status</property>
     41 <property name="fields">
     42  <element value="student_status"/>
     43 </property>
     44 <property name="label">Status</property>
     45 <property name="label_edit">Status</property>
     46 <property name="readonly_layout_modes"/>
     47 <property name="hidden_layout_modes"/>
     48 <property name="hidden_readonly_layout_modes"/>
     49 <property name="vocabulary">student_status_voc</property>
     50</widget>
     51  <widget name="acco_res_date" meta_type="DateTime Widget">
    3552  <property name="title">Reservation Date</property>
    3653  <property name="fields">
     
    4057  <property name="label_edit">Reservation Date</property>
    4158  <property name="readonly_layout_modes"/>
    42   <property name="hidden_layout_modes"/>
     59  <property name="hidden_layout_modes">
     60    <element value="create"/>
     61  </property>
    4362  <property name="hidden_readonly_layout_modes"/>
    4463  <property name="view_format">iso8601_medium_easy</property>
    4564 </widget>
    46  <widget name="acco_res_sc_pin" meta_type="String Widget">
     65 <widget name="acco_res_sc_pin" meta_type="Scratchcard Pin Widget">
    4766  <property name="title">Reservation Access Code</property>
    4867  <property name="fields">
     
    5170  <property name="label">Reservation Access Code</property>
    5271  <property name="label_edit">Reservation Access Code</property>
     72  <property name="prefix">HOS</property>
    5373  <property name="readonly_layout_modes"/>
    5474  <property name="hidden_layout_modes"/>
     
    6383 <property name="label_edit">Bed</property>
    6484 <property name="readonly_layout_modes"/>
    65  <property name="hidden_layout_modes"/>
     85  <property name="hidden_layout_modes">
     86    <element value="create"/>
     87  </property>
    6688 <property name="hidden_readonly_layout_modes"/>
    6789 <property name="render_method">formatBed</property>
     
    7597  <property name="label_edit">Session</property>
    7698  <property name="readonly_layout_modes">edit</property>
    77   <property name="hidden_layout_modes"/>
     99  <property name="hidden_layout_modes">
     100    <element value="create"/>
     101  </property>
    78102  <property name="hidden_readonly_layout_modes"/>
    79103 </widget>
     
    84108  <row>
    85109   <cell name="bed"/>
     110  </row>
     111  <row>
     112   <cell name="student_status"/>
    86113  </row>
    87114  <row>
  • WAeUP_SRP/trunk/skins/waeup_accommodation/formatBed.py

    r669 r686  
    77if datastructure is not None:
    88    bed = datastructure.get('bed')
     9if not bed:
     10    return ''
    911hall,block,room,letter = bed.split('_')
    1012res = context.portal_catalog(portal_type="AccoHall",id=hall)
  • WAeUP_SRP/trunk/skins/waeup_default/layout_waeup_edit.pt

    r679 r686  
    11<!-- a layout_lib macro -->
    22<!-- $Id$ -->
    3 
    43<metal:block define-macro="default_edit"
    54  tal:define="layout options/layout;
    6   ds options/datastructure;
    7   dm ds/getDataModel;
    8   formaction options/formaction|string:student_edit;
    9   creation creation|nothing;
    10   external python:request.URL0.endswith('external_edit_form');
    11   save_button python:not (creation or external);
    12   metadata metadata|nothing;
    13   type_name request/type_name|nothing;
    14   ti python:type_name and getattr(here.portal_types,type_name,None) or getattr(here.portal_types,here.portal_type,None);
    15   cpsmcat nocall:here/translation_service;
    16   apply request/apply_button|nothing;
    17   widgets python:context.getRenderedWidgets(layout);
    18   ">
    19   <form action="" id="editForm" method="post"
    20         enctype="multipart/form-data" class="workflow"
    21         tal:attributes="action formaction"
    22         >
    23   <table class="layoutDefault" summary="Form layout"
    24          tal:condition="layout/rows">
    25     <span tal:repeat="row python: layout['rows']" valign="top" >
    26       <span tal:repeat="cell row">
    27         <tr tal:define="widget cell/widget;
    28               wid widget/getWidgetId;
    29               err python:ds.getError(wid);
    30               err_mapping python:ds.getErrorMapping(wid);
    31               is_required python: widget.is_required and creation and ('create' not in widget.readonly_layout_modes);
    32               tooltip_id python:wid + '_help';
    33               widget_css_class cell/widget_css_class|nothing;
    34               css_class python:test(err, 'row error','row')"
    35               tal:condition="python: wid != 'passport'"
    36               >
    37           <div tal:attributes="class widget_css_class;
    38           id python:widget.getHtmlWidgetId()+'_widget';"
    39           >
    40             <td>
    41             <div class="label" tal:condition="widget/label_edit"
    42                  tal:attributes="class python:test(is_required, 'label required','label')">
    43               <label tal:content="widget/label_edit"
    44                      tal:attributes="for cell/widget_input_area_id|nothing;">label</label>:
    45             </div>
    46             <button type="button" class="tooltipControl"
    47                     tal:condition="widget/help"
    48                     tal:attributes="onclick python:'toggleElementVisibility(\'%s\')' % tooltip_id;"> ? </button>
    49             </td>
    50             <td>
    51             <span class="field">
    52               <div tal:replace="structure cell/widget_rendered"/>
    53             </span>
    54             <div class="tooltipArea" style="visibility: hidden;"
    55                  tal:condition="widget/help"
    56                  tal:attributes="id tooltip_id;
    57                  onclick python:'showElement(false, \'%s\')' % tooltip_id;"
    58                  >
    59               <tal:block tal:content="widget/help">This is the help for this field
    60               </tal:block>
    61             </div>
    62             <tal:block condition="err">
     5              ds options/datastructure;
     6              dm ds/getDataModel;
     7              creation creation|nothing;
     8              metadata metadata|nothing;
     9              type_name request/type_name|nothing;
     10              ti python:type_name and getattr(here.portal_types,type_name,None) or getattr(here.portal_types,here.portal_type,None);
     11              creation_form python:ti and ti.getActionById('create', 'cpsdocument_create_form') or 'cpsdocument_create_form' ;
     12              edit_form     python:ti and ti.getActionById('edit',   'cpsdocument_edit_form') or  'cpsdocument_edit_form';
     13              metadata_form python:ti and ti.getActionById('metadata', 'cpsdocument_metadata') or 'cpsdocument_metadata';
     14              formaction formaction|python: test(creation, creation_form,
     15                                 test(metadata, metadata_form,
     16                                                edit_form));
     17              first_layout options/first_layout|python:0;
     18              last_layout options/last_layout|python:0;
     19              is_flexible options/is_flexible;
     20              cpsmcat nocall:here/translation_service;
     21              ">
     22<tal:block condition="python:first_layout">
     23  <tal:block
     24  content="structure string:<form id='editForm' action='${formaction}' method='post'
     25  enctype='multipart/form-data' class='workflow'>
     26  <div class='group'><div class='documentFields'>" />
     27  <input type="hidden" name="type_name" value="."
     28    tal:condition="creation" tal:attributes="value request/type_name" />
     29</tal:block>
     30
     31<table width="100%" cellpadding="2" cellspacing="2" summary="Form layout"
     32       tal:condition="layout/rows">
     33  <tr tal:repeat="row layout/rows" valign="top">
     34    <td tal:repeat="cell row"
     35      tal:attributes="colspan cell/ncols">
     36      <tal:block define="widget cell/widget;
     37                         wid widget/getWidgetId;
     38                         err python:ds.getError(wid);
     39                         err_mapping python:ds.getErrorMapping(wid);
     40                         is_required widget/is_required|nothing;
     41                         tooltip_id python:wid + '_help';
     42                         widget_css_class cell/widget_css_class|nothing;
     43                         widget_css_class python:test(is_flexible, 'group', widget_css_class);
     44                         css_class python:test(err, 'row error',
     45                                               test(is_flexible, 'group', 'row'))">
     46        <div tal:attributes="class widget_css_class;
     47                             id python:widget.getHtmlWidgetId()+'_widget';
     48                            ">
     49          <div class="label" tal:condition="widget/label_edit"
     50            tal:attributes="class python:test(is_required, 'label required',
     51                                              'label')">
     52            <label i18n:translate="" tal:condition="widget/is_i18n"
     53              tal:content="widget/label_edit"
     54              tal:attributes="for cell/widget_input_area_id|nothing;">label</label>
     55            <label tal:condition="not:widget/is_i18n"
     56              tal:content="widget/label_edit"
     57              tal:attributes="for cell/widget_input_area_id|nothing;">label</label>
     58          </div>
     59          <button type="button" class="tooltipControl"
     60                  tal:condition="widget/help"
     61                  tal:attributes="onclick python:'toggleElementVisibility(\'%s\')' % tooltip_id;"> ? </button>
     62          <div class="field">
     63            <div tal:replace="structure cell/widget_rendered"/>
     64          </div>
     65          <div class="tooltipArea" style="visibility: hidden;"
     66               tal:condition="widget/help"
     67               tal:attributes="id tooltip_id;
     68                               onclick python:'showElement(false, \'%s\')' % tooltip_id;">
     69            <tal:block i18n:translate="" tal:condition="widget/is_i18n"
     70              tal:content="widget/help">i18_key-help_for_this_field</tal:block>
     71            <tal:block tal:condition="not:widget/is_i18n"
     72              tal:content="widget/help">This is the help for this field</tal:block>
     73          </div>
     74          <tal:block condition="err">
    6375              <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)">
    6476                <br /><em style="color: red"
    65                           tal:content="msg">err</em>
     77                  tal:content="msg">err</em>
    6678              </tal:block>
    67             </tal:block>
    68             </td>
     79          </tal:block>
     80          <div style="float: right;" tal:condition="is_flexible">
     81            <input type="button" value="button_move_up"
     82              tal:condition="not:repeat/row/start"
     83              tal:attributes="name string:uprow_${repeat/row/index};
     84                              onclick python:'CPSFlexibleEdit.buttonClick(this, \'\')'"
     85              class="context moveUp" i18n:attributes="value" />
     86            <input type="button" value="button_move_down"
     87              tal:condition="not:repeat/row/end"
     88              tal:attributes="name string:downrow_${repeat/row/index};
     89                              onclick python:'CPSFlexibleEdit.buttonClick(this, \'\')'"
     90              class="context moveDown" i18n:attributes="value" />
     91            <input type="button" value="button_delete"
     92              class="destructive" i18n:attributes="value"
     93              tal:attributes="name string:deleterow_${repeat/row/index};
     94                              onclick python:'CPSFlexibleEdit.buttonClick(this, \'%s\')' %
     95                                (cpsmcat('description_confirm_delete'), )" />
    6996          </div>
    70         </tr>
    71       </span>
    72     </span>
    73     <tr tal:condition="widgets/passport|nothing"
    74         tal:define="cell widgets/passport|nothing;">
    75       <tal:block tal:define="widget cell/widget;
    76       wid widget/getWidgetId;
    77       err python:ds.getError(wid);
    78       err_mapping python:ds.getErrorMapping(wid);
    79       is_required python: widget.is_required and creation and ('create' not in widget.readonly_layout_modes);
    80       tooltip_id python:wid + '_help';
    81       widget_css_class widget/widget_css_class|nothing;
    82       css_class python:test(err, 'row error','row')"
    83       >
    84         <div tal:attributes="class widget_css_class;
    85         id python:widget.getHtmlWidgetId()+'_widget';"
    86         >
    87           <td>
    88             <div class="label" tal:condition="widget/label_edit"
    89                  tal:attributes="class python:test(is_required, 'label required','label')">
    90               <label tal:content="widget/label_edit"
    91                      tal:attributes="for cell/widget_input_area_id|nothing;">label</label>:
    92             </div>
    93             <button type="button" class="tooltipControl"
    94                     tal:condition="widget/help"
    95                     tal:attributes="onclick python:'toggleElementVisibility(\'%s\')' % tooltip_id;"> ? </button>
    96           </td>
    97           <td>
    98             <span class="field">
    99               <div tal:replace="structure cell/widget_rendered"/>
    100             </span>
    101             <div class="tooltipArea" style="visibility: hidden;"
    102                  tal:condition="widget/help"
    103                  tal:attributes="id tooltip_id;
    104                  onclick python:'showElement(false, \'%s\')' % tooltip_id;"
    105                  >
    106               <tal:block tal:content="widget/help">This is the help for this field
    107               </tal:block>
    108             </div>
    109             <tal:block condition="err">
    110               <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)">
    111                 <br /><em style="color: red"
    112                           tal:content="msg">err</em>
    113               </tal:block>
    114             </tal:block>
    115           </td>
    11697        </div>
    11798      </tal:block>
    118     </tr>
    119   </table>
    120   <br />
     99    </td>
     100  </tr>
     101</table>
     102
     103<tal:block condition="is_flexible">
     104<div tal:define="flexible_widgets options/flexible_widgets">
     105  <input type="hidden" name="layout_id" value="."
     106    tal:attributes="value layout/layout_id" />
     107  <tal:select condition="python:len(flexible_widgets)>1">
     108    <select name="widget_type">
     109      <tal:block repeat="widget options/flexible_widgets">
     110      <option value="."
     111        tal:condition="widget/is_i18n"
     112        i18n:translate=""
     113        tal:attributes="value widget/getWidgetId"
     114        tal:content="widget/title_or_id">Type</option>
     115      <option value="."
     116        tal:condition="not:widget/is_i18n"
     117        tal:attributes="value widget/getWidgetId"
     118        tal:content="widget/title_or_id">Type</option>
     119      </tal:block>
     120    </select>
     121    <input type="button" id="addwidget_button"
     122           name="addwidget_button" value="button_add"
     123           class="context"
     124           i18n:attributes="value"
     125           tal:attributes="onclick python:'CPSFlexibleEdit.buttonClick(this, \'\')'" />
     126  </tal:select>
     127  <tal:button condition="python:len(flexible_widgets) == 1">
     128    <tal:block define="widget python:flexible_widgets[0]">
     129      <input type="hidden" name="widget_type"
     130        tal:attributes="value widget/getWidgetId">
     131      <input type="submit" name="addwidget_button"
     132        id="addwidget_button"
     133        tal:define="button_add python:cpsmcat('button_add');
     134          widget_title python:cpsmcat(widget.title_or_id())"
     135        tal:attributes="value string:${button_add} ${widget_title}"
     136        class="context" />
     137    </tal:block>
     138  </tal:button>
     139</div>
     140</tal:block>
     141
     142<tal:block condition="python: last_layout">
     143  <tal:block content="structure string:</div>" />
     144  <metal:block define-slot="additional_content" />
     145
     146  <tal:block condition="not:creation">
     147    <div class="tooltipArea" style="visibility: hidden;"
     148      id="transition_comments_help"
     149      onclick="showElement(false, 'transition_comments_help')"
     150      i18n:translate="help_transition_comments_modification">
     151      In this filed you can give the reason of the modification that you are doing on this document.
     152      Your comments may be used to notify other users.
     153    </div>
     154    <dl>
     155      <dt><label for="comments"
     156          i18n:translate="transition_comments_modification">Reason of the modification</label>
     157        <button type="button" class="tooltipControl"
     158          onclick="toggleElementVisibility('transition_comments_help')"> ? </button>
     159      </dt>
     160      <dd>
     161        <textarea name="comments" id="comments" cols="60" rows="3"
     162          tal:content="nothing">
     163        </textarea>
     164      </dd>
     165    </dl>
     166  </tal:block>
    121167  <input type="submit" class="standalone" name="cpsdocument_edit_button"
    122          value="Save"
    123          id="cpsdocument_edit_button"
    124          tal:condition="save_button" />
    125   <input type="submit" class="standalone" name="apply_admission"
    126          value="apply for admission"
    127          id="cpsdocument_edit_and_view_button"
    128          tal:condition="apply"
    129          tal:attributes="value apply"/>
    130   <input type="submit"
    131          class="standalone"
    132          name="cpsdocument_create_button"
    133          value="apply"
    134          tal:attributes="value options/button"
    135          tal:condition="creation" />
     168    value="button_change" i18n:attributes="value" id="cpsdocument_edit_button"
     169    tal:condition="not:creation" />
     170  <input type="submit" class="standalone" name="cpsdocument_edit_and_view_button"
     171    value="button_change_and_view" i18n:attributes="value"
     172    id="cpsdocument_edit_and_view_button"
     173    tal:condition="not:creation" />
     174  <input type="submit" class="standalone" name="cpsdocument_create_button"
     175    value="button_create" i18n:attributes="value" tal:condition="creation" />
     176  <tal:block content="structure string:</div></form>" />
     177</tal:block>
    136178
    137 </form>
    138179</metal:block>
  • WAeUP_SRP/trunk/skins/waeup_student/reserve_accommodation.py

    r668 r686  
    2121if info['acco']:
    2222    return context.REQUEST.RESPONSE.redirect("%s/accommodation_view" % info['acco'].absolute_url())
    23 res,psm,ds = lt.renderLayout(layout_id= 'student_accommodation_fe',
    24                       schema_id= 'student_accommodation_fe',
     23res,psm,ds = lt.renderLayout(layout_id= 'student_accommodation',
     24                      schema_id= 'student_accommodation',
    2525                      context=context,
    2626                      mapping=validate and REQUEST,
Note: See TracChangeset for help on using the changeset viewer.