Changeset 794


Ignore:
Timestamp:
8 Nov 2006, 18:32:55 (18 years ago)
Author:
joachim
Message:

added WAeUPResultsWidget used in clearance modul not fully working yet.
several fixed

Location:
WAeUP_SRP/trunk
Files:
4 edited
1 moved

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Widgets.py

    r783 r794  
    320320###)
    321321
     322class WAeUPResultsWidget(CPSStringWidget): ###(
     323    """ WAeUPResults Widget"""
     324    meta_type = "WAeUp Results Widget"
     325
     326    def prepare(self, datastructure, **kw): ###(
     327        """Prepare datastructure from datamodel."""
     328        datamodel = datastructure.getDataModel()
     329        v = datamodel[self.fields[0]]
     330        #import pdb;pdb.set_trace()
     331        clear_doc = self.getStudentInfo()['clear_doc']
     332        vd = getattr(clear_doc,self.fields[0],None)
     333        if not vd:
     334            vd = {}
     335        widget_id = self.getWidgetId()
     336        datastructure[widget_id] = vd
     337        datastructure[widget_id+'_s'] = ''
     338        datastructure[widget_id+'_g'] = ''
     339    ###)
     340
     341    def validate(self, datastructure, **kw): ###(
     342        """Validate datastructure and update datamodel."""
     343        #import pdb;pdb.set_trace()
     344        widget_id = self.getWidgetId()
     345        v = datastructure[widget_id]
     346        err = 0
     347        s = datastructure[widget_id+'_s'].strip()
     348        g = datastructure[widget_id+'_g'].strip()
     349        if not s and g:
     350            err = "no subject grad for subject %s " % s
     351        elif v.has_key(s):
     352            err = "grad for subject %s already given" % s
     353        elif s and g:
     354            v[s] = g
     355        if err:
     356            datastructure.setError(widget_id, err)
     357        else:
     358            datamodel = datastructure.getDataModel()
     359            datamodel[self.fields[0]] = v
     360            datastructure[widget_id+'_s'] = s
     361            datastructure[widget_id+'_g'] = g
     362        return not err
     363    ###)
     364
     365    def render(self, mode, datastructure, **kw): ###(
     366        """Render in mode from datastructure."""
     367        render_method = 'widget_waeup_result_render'
     368        meth = getattr(self, render_method, None)
     369        if meth is None:
     370            raise RuntimeError("Unknown Render Method %s for widget type %s"
     371                               % (render_method, self.getId()))
     372
     373        # XXX AT: datastructure has to be set again here, in case we're in edit
     374        # or create mode, because a default value has to be provided.
     375        #import pdb;pdb.set_trace()
     376        datamodel = datastructure.getDataModel()
     377        widget_id = self.getWidgetId()
     378        v = datamodel[self.fields[0]]
     379        datastructure[widget_id] = [{'subject': f,
     380                                     'grade': v[f]} for f in v.keys()]
     381        datastructure[widget_id+'_s'] = ''
     382        datastructure[widget_id+'_g'] = ''
     383        return meth(mode=mode,
     384                    datastructure=datastructure,
     385                    )
     386    ###)
     387
     388
     389InitializeClass(WAeUPResultsWidget)
     390widgetRegistry.register(WAeUPResultsWidget)
     391###)
     392
    322393class ScratchCardPin: ###(
    323394    """the ScratchCardPin"""
     
    410481                s_id = student.getId()
    411482                if ok == 2:
     483                    err = "You already used this PIN please login"
    412484                    break
    413485                student.getContent().makeStudentMember(s_id,password=pin[4:])
  • WAeUP_SRP/trunk/profiles/default/layouts/student_clearance_fe.xml

    r790 r794  
    116116  <property name="hidden_readonly_layout_modes"/>
    117117 </widget>
     118 <widget name="alr_results" meta_type="WAeUp Results Widget">
     119 <property name="title">Results</property>
     120 <property name="fields">
     121  <element value="alr_results"/>
     122 </property>
     123 <property name="label">Results</property>
     124 <property name="label_edit">Results</property>
     125 <property name="readonly_layout_modes"/>
     126 <property name="hidden_layout_modes"/>
     127 <property name="hidden_readonly_layout_modes"/>
     128</widget>
    118129 <widget name="alr_scan" meta_type="Image Widget">
    119130  <property name="title">Scan of Advanced Level Result</property>
     
    341352  <property name="hidden_readonly_layout_modes"/>
    342353 </widget>
    343  <widget name="fst_sit_scan" meta_type="Image Widget">
     354 <widget name="fst_sit_results" meta_type="WAeUp Results Widget">
     355 <property name="title">Results</property>
     356 <property name="fields">
     357  <element value="fst_sit_results"/>
     358 </property>
     359 <property name="label">Results</property>
     360 <property name="label_edit">Results</property>
     361 <property name="readonly_layout_modes"/>
     362 <property name="hidden_layout_modes"/>
     363 <property name="hidden_readonly_layout_modes"/>
     364</widget>
     365  <widget name="fst_sit_scan" meta_type="Image Widget">
    344366  <property name="title">Scan of First Sitting Result</property>
    345367  <property name="fields">
     
    654676  <property name="hidden_readonly_layout_modes"/>
    655677 </widget>
     678 <widget name="scd_sit_results" meta_type="WAeUp Results Widget">
     679 <property name="title">Results</property>
     680 <property name="fields">
     681  <element value="scd_sit_results"/>
     682 </property>
     683 <property name="label">Results</property>
     684 <property name="label_edit">Results</property>
     685 <property name="readonly_layout_modes"/>
     686 <property name="hidden_layout_modes"/>
     687 <property name="hidden_readonly_layout_modes"/>
     688</widget>
    656689 <widget name="scd_sit_scan" meta_type="Image Widget">
    657690  <property name="title">Scan of Second Sitting Result</property>
     
    765798  </row>
    766799  <row>
     800   <cell name="fst_sit_results"/>
     801  </row>
     802  <row>
    767803   <cell name="fst_sit_scan"/>
    768804  </row>
     
    780816  </row>
    781817  <row>
     818   <cell name="scd_sit_results"/>
     819  </row>
     820  <row>
    782821   <cell name="scd_sit_scan"/>
    783822  </row>
     
    790829  <row>
    791830   <cell name="alr_date"/>
     831  </row>
     832  <row>
     833   <cell name="alr_results"/>
    792834  </row>
    793835  <row>
  • WAeUP_SRP/trunk/profiles/default/schemas/student_clearance.xml

    r790 r794  
    2121 <field name="fst_sit_date" meta_type="CPS DateTime Field"/>
    2222 <field name="fst_sit_type" meta_type="CPS String Field"/>
     23 <field name="fst_sit_results" meta_type="CPS SubObjects Field"/>
    2324 <field name="fst_sit_scan" meta_type="CPS Image Field"/>
    2425
     
    2829 <field name="scd_sit_date" meta_type="CPS DateTime Field"/>
    2930 <field name="scd_sit_type" meta_type="CPS String Field"/>
     31 <field name="scd_sit_results" meta_type="CPS SubObjects Field"/>
    3032 <field name="scd_sit_scan" meta_type="CPS Image Field"/>
    3133
     
    3335 <field name="alr_no" meta_type="CPS String Field"/>
    3436 <field name="alr_date" meta_type="CPS DateTime Field"/>
     37 <field name="alr_results" meta_type="CPS SubObjects Field"/>
    3538 <field name="alr_scan" meta_type="CPS Image Field"/>
    3639
  • WAeUP_SRP/trunk/skins/waeup_student/application_edit.py

    r788 r794  
    4141psm = ""
    4242args = {}
    43 action = "/application_edit_view"
     43action = "/application_edit_form"
     44base_url = app.absolute_url()
    4445if cpsdocument_edit_button:
    4546    if is_valid:
     
    5253    if is_valid:
    5354        action = "/request_clearance"
     55        base_url = clear.absolute_url()
    5456    else:
    5557        psm = 'psm_content_error'
    5658args['portal_status_message'] = psm
    57 url = app.absolute_url() + action + '?' + urlencode(args)
     59url = base_url + action + '?' + urlencode(args)
    5860REQUEST.RESPONSE.redirect(url)
  • WAeUP_SRP/trunk/skins/waeup_student/application_edit_form.pt

    r788 r794  
    66                      request=request, proxy=info['app'],
    77                      use_session=True, no_form=True)">
    8   <metal:body use-macro="here/main_template/macros/master">
     8  <metal:body use-macro="here/waeup_content_master/macros/master">
    99    <metal:main fill-slot="main">
    1010      <span tal:condition="not: info">
Note: See TracChangeset for help on using the changeset viewer.