Changeset 2920 for WAeUP_SRP


Ignore:
Timestamp:
11 Dec 2007, 15:40:35 (17 years ago)
Author:
Henrik Bettermann
Message:

upload missing passport before starting clearance (logic in application_edit.py completely changed)

fix Title for student_accommodation object

Location:
WAeUP_SRP/base
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/Students.py

    r2912 r2920  
    594594        """compose title"""
    595595        content = self.getContent()
    596         session_str = self.portal_vocabularies.sessions.get(content.session)
     596        session_id = content.session
     597        try:
     598            y = int(session_id[2:])
     599        except:
     600            return "Accommodation Data for Session %s" % session_id
     601        session_str = self.portal_vocabularies.sessions.get(y)
    597602        #return "Accommodation Data for %s %s" % (content.firstname,content.lastname)
    598603        return "Accommodation Data for Session %s" % session_str
  • WAeUP_SRP/base/skins/cps_custom/main_template_popup.pt

    r2918 r2920  
    1 <metal:block define-macro="master" tal:define="
    2   showthirdcol showthirdcol|python:1;
     1<metal:block define-macro="master"
     2  tal:define="showthirdcol showthirdcol|python:1;
    33  emptybody emptybody|request/emptybody|nothing;
     4  mtool here/portal_membership;
     5 
    46  utool nocall:here/portal_url;
    57  atool here/portal_actions;
    6   mtool here/portal_membership;
    78  ttool here/portal_trees;
    89  wtool here/portal_workflow;
     10  ptool here/portal_cpsportlets;
    911  context_url python:here.getContextUrl(utool=utool);
    10   base_url python:utool.getBaseUrl();
    11  
     12  here_url here/absolute_url;
     13  base_url here/getBaseUrl;
    1214  static_dir here/portal_properties/static_dir;
    1315  static_base_url string:${here/getBaseUrl}${static_dir};
    14  
    15  
    16   here_url python:here.absolute_url();
    1716  member mtool/getAuthenticatedMember;
    1817  isAnon mtool/isAnonymousUser;
     18  isHomeless python:isAnon or member.getProperty('homeless', 0);
     19  isHomeless python:(isHomeless == '0' and [0] or [isHomeless])[0];
    1920  actions python:atool.listFilteredActionsFor(here);
    2021  wf_state python:wtool.getInfoFor(here,'review_state','');
    21   uname python:isAnon and 'Guest' or member.getUserName();
    22   checkPerm nocall:mtool/checkPermission;
     22  uname python: isAnon and 'Guest' or member.getUserName();
     23  checkPerm nocall: mtool/checkPermission;
    2324  cpsmcat nocall:here/translation_service;
    2425  locale here/translation_service/getSelectedLanguage;
    2526  in_ws here/isInWorkspace;
    26   "><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
     27  waeup_skin here/get_waeup_skin;
     28  student_theme python:test(waeup_skin == 'WAeUP_Student',1,0);
     29  navigation_slot python:test(student_theme,'student_navigation_slot','navigation_slot');
     30  object_tabs python:test(student_theme,'student_object_slot','staff_object_slot');
     31 
     32  ">
     33 
     34<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    2735<html xmlns="http://www.w3.org/1999/xhtml"
    2836  tal:attributes="lang locale; xml:lang locale">
     
    3442  <metal:block fill-slot="head_slot"><metal:block define-slot="head_slot"
    3543    /></metal:block>
    36   <metal:block fill-slot="style_slot"><metal:block define-slot="style_slot"
    37     /></metal:block>
     44
    3845  <metal:block fill-slot="javascript_head_slot"><metal:block
    3946    define-slot="javascript_head_slot"
  • WAeUP_SRP/base/skins/waeup_layout/layout_application_edit.pt

    r2581 r2920  
    22                          isStudent context/isStudent;
    33                          info context/getApplicationInfo;
    4                           app_email info/app_doc/app_email">
     4                          app_email info/app_doc/app_email|nothing;
     5                          app_passport info/has_passport;
     6                          ">
    57
    68<metal:block tal:condition="isStaff">             
     
    1012
    1113<metal:block define-macro="application_student_edit"
    12   tal:condition="python:isStudent and not app_email"
     14  tal:condition="python:isStudent"
    1315  tal:define="layout options/layout;
    1416  ds options/datastructure;
     
    1921  proceed options/proceed|nothing;
    2022  widgets python:context.getRenderedWidgets(layout);
    21   fields python:( 'app_email',
    22                   'app_mobile',)">
     23  widget_email widgets/app_email|nothing;
     24  widget_passport widgets/passport|nothing;
     25  ">
    2326  <table class="layoutDefault" summary="Form layout"
    24          tal:condition="layout/rows">
     27         >
    2528
    26     <tr tal:condition="widgets/app_email|nothing"
    27         tal:define="cell widgets/app_email|nothing;">
     29    <tr tal:condition="python: widget_email and not app_email"
     30        tal:define="cell widget_email">
    2831      <tal:block tal:define="widget cell/widget;
    2932      wid widget/getWidgetId;
     
    5659      </tal:block>
    5760    </tr>
     61    <tr tal:condition="python: widget_passport and not app_passport"
     62        tal:define="cell widget_passport">
     63      <tal:block tal:define="widget cell/widget;
     64      wid widget/getWidgetId;
     65      err python:ds.getError(wid);
     66      err_mapping python:ds.getErrorMapping(wid);
     67      is_required python: widget.is_required and creation and ('create' not in widget.readonly_layout_modes);
     68      tooltip_id python:wid + '_help';
     69      widget_css_class widget/widget_css_class|nothing;
     70      css_class python:test(err, 'row error','row')"
     71      >
     72        <div tal:attributes="class widget_css_class;
     73        id python:widget.getHtmlWidgetId()+'_widget';"
     74        >
     75          <td>
     76            <div class="label" tal:condition="widget/label_edit"
     77                 tal:attributes="class python:test(is_required, 'label required','label')">
     78              <label tal:content="widget/label_edit"
     79                     tal:attributes="for cell/widget_input_area_id|nothing;">label</label>:
     80           
     81            <button type="button" class="tooltipControl"
     82                    tal:condition="widget/help"
     83                    tal:attributes="onclick python:'toggleElementVisibility(\'%s\')' % tooltip_id;"> ? </button>
     84            </div>
     85          </td>
     86          <td>
     87            <span class="field">
     88              <div tal:replace="structure cell/widget_rendered"/>
     89            </span>
     90            <div class="tooltipArea" style="visibility: hidden;"
     91                 tal:condition="widget/help"
     92                 tal:attributes="id tooltip_id;
     93                 onclick python:'showElement(false, \'%s\')' % tooltip_id;"
     94                 >
     95              <tal:block tal:content="widget/help">This is the help for this field
     96              </tal:block>
     97            </div>
     98            <tal:block condition="err">
     99              <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)">
     100                <br /><em style="color: red"
     101                          tal:content="msg">err</em>
     102              </tal:block>
     103            </tal:block>
     104          </td>
     105        </div>
     106      </tal:block>
     107    </tr>   
    58108  </table>
    59109</metal:block>
  • WAeUP_SRP/base/skins/waeup_student/admission_form.pt

    r2692 r2920  
    11<metal:html tal:define="info context/getStudentInfo;
    2                         app_email info/app_doc/app_email|nothing">
     2                        app_email info/app_doc/app_email|nothing;
     3                        app_passport info/has_passport;
     4                        data_complete python:app_passport and app_email;
     5                        ">
    36  <span tal:condition="not: info">
    47    <span tal:content="here/illegal_view" />
     
    7780                       (cpsmcat('Confirm that you want to raise an objection.'), )"
    7881                       />
    79                 <input tal:condition="python:review_state in ('admitted', 'objection_raised',) and not app_email" type="submit" name="application_edit:method"
     82                <input tal:condition="python:review_state in ('admitted', 'objection_raised',) and not data_complete" type="submit" name="application_edit:method"
    8083                       class="context" value="Continue"
    8184                       />
    82                 <input tal:condition="python:review_state in ('admitted', 'objection_raised',) and app_email" type="submit" name="start_clearance:method"
     85                <input tal:condition="python:review_state in ('admitted', 'objection_raised',) and data_complete" type="submit" name="start_clearance:method"
    8386                       class="context" value="Continue"
    8487                       />                       
  • WAeUP_SRP/base/skins/waeup_student/application_edit.py

    r2579 r2920  
    55##bind script=script
    66##bind subpath=traverse_subpath
    7 ##parameters=REQUEST, cpsdocument_edit_button=None, cpsdocument_edit_and_view_button=None, action=None
     7##parameters=REQUEST, cpsdocument_edit_and_view_button=None, action=None, portal_status_message=''
    88##title=
    99# $Id$
     
    1818logger = logging.getLogger('Skins.application_edit')
    1919
    20 # Until ajax posts directly to its own script...
    21 ##if 'ajax_edit' in REQUEST.form:
    22 ##    return context.cpsdocument_edit_ajax(REQUEST, cluster=cluster)
     20psm = ""
     21args = {}
    2322
    24 # Check flexible controls
    25 #context.editLayouts(REQUEST=REQUEST)
     23info = context.getApplicationInfo()
    2624
    27 # Validate the document and write it if it's valid
    28 # (We don't call getEditableContent here, validate does it when needed.)
    29 info = context.getApplicationInfo()
     25student = info['student']
    3026
    3127if info is None:
     
    3329    return REQUEST.RESPONSE.redirect("%s/srp_anonymous_view" % context.portal_url())
    3430
    35 student = info['student']
     31if info['has_passport'] and info['app_doc'].app_email:
     32    logger.info('%s proceeded to start clearance' % (info['id']))
     33    action = "/start_clearance"
     34    base_url = student.absolute_url()
     35    url = base_url + action
     36    return REQUEST.RESPONSE.redirect(url)
     37elif not cpsdocument_edit_and_view_button:
     38    action = "/application_edit_form"
     39    base_url = student.absolute_url()
     40    #url = base_url + action
     41    if portal_status_message:
     42        args['portal_status_message'] = portal_status_message
     43        url = base_url + action + '?' + urlencode(args)
     44    else:
     45        url = base_url + action
     46    return REQUEST.RESPONSE.redirect(url)
     47
     48
     49
    3650app = info['app']
    3751app_doc = info['app_doc']
     
    4357                                use_session=False)
    4458
    45 psm = ""
    46 args = {}
    47 action = "/application_edit_form"
     59
     60action = "/application_edit"
    4861base_url = app.absolute_url()
    4962
    5063if is_valid:
    51     if cpsdocument_edit_button:
    52         if app_doc.passport is not None:
    53             args['portal_status_message'] = 'You successfully uploaded your passport picture!'
    54         else:
    55             args['portal_status_message'] = "You didn't upload a passport picture!"
    56     elif cpsdocument_edit_and_view_button:
    57         if 1: ## app_doc.passport is not None:
    58             logger.info('%s proceeded to start clearance' % (info['id']))
    59             action = "/start_clearance"
    60             base_url = student.absolute_url()
    61             url = base_url + action
    62             return REQUEST.RESPONSE.redirect(url)
    63         else:
    64             args['portal_status_message'] = "You didn't upload a passport picture!"
    65 if args:
    66   url = base_url + action + '?' + urlencode(args)
     64    args['portal_status_message'] = "You didn't upload all required data!"
     65
    6766else:
    68   url = base_url + action
    69 REQUEST.RESPONSE.redirect(url)
     67    args['portal_status_message'] = "Please correct your error!"
     68
     69url = base_url + action + '?' + urlencode(args)
     70
     71
     72 
     73return REQUEST.RESPONSE.redirect(url)
  • WAeUP_SRP/base/skins/waeup_student/application_edit_form.pt

    r2581 r2920  
    1212           form_action string:application_edit;
    1313           edition python:True;
    14            session2006 python:True;
     14           app_email info/app_doc/app_email|nothing;
     15           app_passport info/has_passport;
     16           data_complete python:app_passport and app_email;
    1517           metadata nothing;
    1618            ">
     
    3335      <br />
    3436      <input type="submit" class="standalone"
    35              name="cpsdocument_edit_button"
    36              value="Save & Return Later"
    37              id="cpsdocument_edit_button"
    38              tal:condition="not:session2006" />
    39       <input type="submit" class="standalone"
    40              name="cpsdocument_edit_and_view_button"
    41              value="Save & Apply"
    42              id="cpsdocument_edit_and_view_button"
    43              tal:condition="not:session2006" />
    44       <input type="submit" class="standalone"
    4537             name="cpsdocument_edit_and_view_button"
    4638             value="Save & Continue"
    4739             id="cpsdocument_edit_and_view_button"
    48              tal:condition="session2006" />             
     40             />             
    4941    </form>
    5042    </metal:main>
  • WAeUP_SRP/base/skins/waeup_student/getApplicationInfo.py

    r2335 r2920  
    3636    student_id = member_id
    3737
     38info['has_passport'] = context.waeup_tool.picturesExist(('passport',), student_id)
    3839
    3940students_object = context.portal_url.getPortalObject().campus.students
  • WAeUP_SRP/base/skins/waeup_student/getStudentInfo.py

    r2407 r2920  
    6565info['app'] = student.application
    6666info['app_doc'] = student.application.getContent()
     67info['has_passport'] = context.waeup_tool.picturesExist(('passport',), student_id)
    6768
    6869course = getattr(student,'study_course',None)
Note: See TracChangeset for help on using the changeset viewer.