Changeset 48


Ignore:
Timestamp:
16 Oct 2005, 15:47:22 (19 years ago)
Author:
joachim
Message:

=weiteres

Location:
waeup_product/trunk/skins/waeup_student
Files:
1 added
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • waeup_product/trunk/skins/waeup_student/check_admission.py

    r47 r48  
    33"""
    44process the Admission Form
    5 
    65return html renderer + psm
    76"""
     
    1312validate = REQUEST.has_key("cpsdocument_edit_button")
    1413
    15 #student = context.getContent()
    16 student = context
    17 
    18 #jamb = getattr(student,'my-jamb').getContent()
    19 jamb = getattr(student,'my-jamb')
    20 
    21 ##res = jamb.validateStoreRender(request=REQUEST,
    22 ##                               layout_mode='create',
    23 ##                               layout_mode_ok='admitted',
    24 ##                               layout_mode_err='create',
    25 ##                               layout_id='admission',
    26 ##                               )
    2714
    2815lt = context.portal_layouts
     16pr = context.portal_registration
    2917
    3018res,psm,ds = lt.renderLayout(layout_id= 'admission',
     
    3725if psm == 'invalid':
    3826    return context.check_admission_form(rendered = res,
     27                                 psm = "Please correct your input",
     28                                 ds = ds,
     29                                 )
     30elif psm == '':
     31    return context.check_admission_form(rendered = res,
     32                                 psm = None,
     33                                 ds = ds,
     34                                 )
     35elif psm == 'valid':
     36    s_id = "s%s" % ds.get('jamb_id')
     37    if not hasattr(context,s_id):
     38        return context.check_admission_form(rendered = res,
     39                                 psm = "Your not admitted yet",
     40                                 ds = ds,
     41                                 )
     42    rset = REQUEST.set
     43    sc_pin =  ds.get('sc_pin')
     44    return REQUEST.RESPONSE.redirect("%s/logged_in?__ac_name=%s&__ac_password=UnSeT&sc_pin=%s"
     45                                    % (context.absolute_url(),s_id,sc_pin))
     46    return context.student_admitted_form(rendered = res,
    3947                                 psm = psm,
    4048                                 ds = ds,
    41                                  )
    42    
    43 elif psm == 'valid':
    44     return context.student_admitted_form(rendered = res,
    45                                  psm = psm,
    4649                                 student = student,
    4750                                 jamb = jamb,
     51                                 pd = pd,
    4852                                 )
    4953   
  • waeup_product/trunk/skins/waeup_student/check_admission_form.pt

    r47 r48  
    22                   portal_status_message options/psm;
    33                   data_storage options/ds;
     4                   jamb options/jamb/getContent|nothing;
    45                   edition python:1;"
    56                   >
     
    1415
    1516    <metal:block fill-slot="main">
    16 <span tal:content="structure data_storage" />
    17       <h1>check your admission to the UniDemo !</h1>
     17        <h1>check your admission to the UniDemo !</h1>
    1818      <div tal:replace="structure rendered_main" />
    1919    </metal:block>
     20  <metal:block fill-slot="sub">
     21  </metal:block>
    2022
    2123</metal:block>
  • waeup_product/trunk/skins/waeup_student/create_jamb.py

    r45 r48  
    1 ##parameters=type_name, REQUEST=None, **kw
     1##parameters=REQUEST=None
    22# $Id$
    33"""
    4 Create an object.
     4Create an the Jamb-Record for a Student
    55
    6 FIXME: what are the parameters?
    76"""
    87
    9 from urllib import urlencode
     8type_name = 'Jamb'
     9ti = context.portal_types[type_name]
     10pr = context.portal_registration
     11pm = context.portal_membership
    1012
    11 if REQUEST is not None:
    12     kw.update(REQUEST.form)
    13     # Use creation without empty object.
    14     # XXX should find better
    15     ti = getattr(context.portal_types, type_name)
    16     # For cpsdocument
    17     if ti.meta_type == 'CPS Flexible Type Information':
    18         args = {'type_name': type_name}
    19         # XXX pass prefilled title, a bit of a hack...
    20         args['widget__Title'] = kw.get('title', '')
     13REQUEST.set('type_name',type_name)
    2114
    22         # Look for the create action on the ti
    23         create_action_form = ti.getActionById('create', 'cpsdocument_create_form')
     15validate = REQUEST.has_key("cpsdocument_edit_button")
    2416
    25         return REQUEST.RESPONSE.redirect('%s/%s?%s'
    26                                          % (context.absolute_url(),
    27                                             create_action_form,
    28                                             urlencode(args)))
     17lt = context.portal_layouts
    2918
    30 if REQUEST and not kw.get('title'):
    31     # Need a title before creating folders
    32     if type_name in ('Section', 'Workspace'):
    33         args = {'type_name': type_name}
    34         return REQUEST.RESPONSE.redirect('%s/folder_edit_form?%s' %
    35                                 (context.absolute_url(), urlencode(args)))
     19res,psm,ds = lt.renderLayout(layout_id= 'jambcreate',
     20                      schema_id= 'jamb',
     21                      context=context,
     22                      mapping=validate and REQUEST,
     23                      ob={},
     24                      layout_mode='create',
     25                      )
     26if psm == 'invalid' or psm == '':
     27    return context.create_jamb_form(rendered = res,
     28                                 psm = psm,
     29                                 ds = ds,
     30                                 )
     31   
     32elif psm == 'valid':
     33    s_id = "s%s" % ds.get('reg_nr')
     34    name = ds.get('name')
     35    skw = {'title': name}
     36    context.invokeFactory('Student',s_id)
     37    student = getattr(context,s_id)   
     38    student.edit(mapping=skw)
     39    context.notifyCPSDocumentCreation(ob=student)
     40    jamb_id = 'JAMB'
     41    student.invokeFactory('Jamb',jamb_id)
     42    jamb = getattr(student,jamb_id)   
     43    ds.set('title', name)
     44    jamb.edit(mapping=ds)
     45    context.notifyCPSDocumentCreation(ob=jamb)
     46    psm = 'Student created'
     47    pr.addMember(s_id, 'UnSeT')
     48    groups = context.portal_directories.groups
     49    gm = list(groups.getEntry('Students')['members'])
     50    gm.extend((s_id,))
     51    groups.editEntry({'group': 'Students',
     52                      'members': gm}) 
     53    return context.student_folder_view(psm=psm)
     54##    return context.create_jamb_form(rendered = res,
     55##                                 psm = psm,
     56##                                 ds = ds,
     57##                                 )
     58   
     59return res,psm,ds
    3660
    37 id = kw.get('title', 'my_' + type_name)
    38 id = context.computeId(compute_from=id)
    39 
    40 context.invokeFactory(type_name, id)
    41 ob = getattr(context, id)
    42 
    43 try:
    44     doc = ob.getEditableContent()
    45 except AttributeError:
    46     # not a proxy
    47     doc = ob
    48 else:
    49     try:
    50         doc.edit(proxy=ob, **kw)
    51     except:
    52         # CMF Compatibility.
    53         # type_name not necessarly and edit method
    54         # for CMF types is not aware about that.
    55         if kw.has_key('type_name'):
    56             del kw['type_name']
    57         doc.edit(**kw)
    58 
    59 context.portal_eventservice.notifyEvent('modify_object', context, {})
    60 context.portal_eventservice.notifyEvent('modify_object', ob, {})
    61 
    62 
    63 if REQUEST is not None:
    64     psm = 'psm_content_created'
    65     action_path = doc.getTypeInfo().immediate_view # getActionById('metadata')
    66     REQUEST.RESPONSE.redirect('%s/%s?portal_status_message=%s' %
    67                               (ob.absolute_url(), action_path,
    68                                psm))
    69 
    70 return id
  • waeup_product/trunk/skins/waeup_student/create_jamb_form.pt

    r45 r48  
    1 <html metal:use-macro="here/content_lib_master/macros/master">
     1<tal:block define="rendered_main options/rendered;
     2                   portal_status_message options/psm;"
     3                   >
     4<metal:block define-macro="edit_form">
     5<metal:block use-macro="here/content_lib_master/macros/master">
     6  <metal:block fill-slot="header"
     7    tal:define="creation creation|nothing;
     8                edition python:1;
     9                metadata metadata|nothing"
     10                >
     11    </metal:block>
    212
    3   <metal:block fill-slot="head_slot">
    4     <tal:block tal:define="student here/getContent">
    5     </tal:block>
     13    <metal:block fill-slot="main">
     14      <h1>Enter the JAMB Data for a Student </h1>
     15      <div tal:replace="structure rendered_main" />
     16    </metal:block>
     17  <metal:block fill-slot="sub">
    618  </metal:block>
    719
    8   <metal:block fill-slot="css_slot">
    9     <link rel="Stylesheet" type="text/css" href=""
    10           tal:attributes="href string:${base_url}student.css" />
    11   </metal:block>
    12 
    13   <metal:block fill-slot="main"
    14                tal:define="items here/contentValues"
    15                >
    16     <form action="content_create" tal:attributes="action string:${here_url}/content_create"
    17           method="post" class="group">
    18       <dt>
    19         <input type="hidden" name="type_name" value="Jamb" />
    20       <p>
    21         <input id="objectTitle" type="text" name="title" value="JAMB" class="focus" size="40" />
    22         <input type="submit" class="standalone searchButton" value="create" />
    23       </p>
    24     </form>
    25   </metal:block>
    26 </html>
     20</metal:block>
     21</metal:block>
     22</tal:block>
  • waeup_product/trunk/skins/waeup_student/create_personal_form.pt

    r47 r48  
    1717          method="post" class="group">
    1818      <dt>
    19         <input type="hidden" name="type_name" value="Jamb" />
     19        <input type="hidden" name="type_name" value="StudentPersonal" />
    2020      <p>
    2121        <input id="objectTitle" type="text" name="Title" value="personal" class="focus" size="40" />
  • waeup_product/trunk/skins/waeup_student/student_admitted_form.pt

    r47 r48  
    55                   edition python:1;"
    66                   >
    7 <metal:html use-macro="here/main_template/macros/master">
    8   <metal:block fill-slot="header" />
     7  <metal:html use-macro="here/main_template/macros/master">
    98    <metal:main fill-slot="main">
    10       <span tal:condition="python: 1" tal:content="jamb/reg_nr" />
    11       <span tal:condition="python: 1" tal:content="jamb/admission_sc_pin" />
    12       <span tal:content="student/title_or_id" />
     9      <a href="edits" tal:attributes="href string:${context/pd/absolute_url}/cpsdocument_edit_form"></a>
    1310    </metal:main>
    1411  </metal:html>
  • waeup_product/trunk/skins/waeup_student/student_folder_view.py

    r23 r48  
    1 ##parameters=REQUEST=None
     1##parameters=REQUEST=None,psm=None,groups=None
    22
    33# $Id$
     
    88admin = "SectionManager" in context.portal_membership.getAuthenticatedMember().getRolesInContext(context)
    99
    10 return context.student_folder_view_main(admin = admin)
     10return context.student_folder_view_main(admin = admin,psm=psm,groups=groups)
  • waeup_product/trunk/skins/waeup_student/student_folder_view_main.pt

    r26 r48  
    1010          tal:attributes="href string:${base_url}student.css" />
    1111  </metal:block>
     12  <metal:block fill-slot="header">
     13  </metal:block>
    1214
    1315  <metal:block fill-slot="main"
     
    1618               >
    1719    <span tal:condition="python: mtool.isAnonymousUser()">
    18       Please login or check you Jambadmission.
     20      Please login or <a href="" tal:attributes="href string:${context/absolute_url}/check_admission">check you Jambadmission</a>.
    1921    </span>
    20     <span tal:condition="python: 0" tal:content="python:member.getRolesInContext(here)" />
    21     <span tal:condition="python: 'SectionManager' in member.getRolesInContext(here)">
     22    <span tal:condition="python: member and 'StudentManager' in member.getGroups()">
    2223      <table cellspacing="0" cellpadding="0">
    2324        <tal:block condition="python: len(items)">
     
    3637    </span>
    3738  </metal:block>
     39  <metal:block fill-slot="sub">
     40  </metal:block>
    3841</html>
  • waeup_product/trunk/skins/waeup_student/student_index_html.py

    r47 r48  
    44
    55"""Default view for the Student."""
     6member = context.portal_membership.getAuthenticatedMember()
    67
    7 return context.student_view_main()
     8#return context.student_view_manager()
     9if 'StudentManager' in member.getGroups():
     10    return context.student_view_manager()
     11elif 'Students' in member.getGroups():
     12    return context.student_view_student()
  • waeup_product/trunk/skins/waeup_student/student_view_manager.pt

    r47 r48  
    66</metal:block>
    77
    8 <metal:block fill-slot="css_slot">
    9   <link rel="Stylesheet" type="text/css" href=""
    10     tal:attributes="href string:${base_url}student.css" />
    11 </metal:block>
     8  <metal:block fill-slot="css_slot">
     9    <link rel="Stylesheet" type="text/css" href=""
     10          tal:attributes="href string:${base_url}student.css" />
     11  </metal:block>
     12  <metal:block fill-slot="header">
     13  </metal:block>
    1214
    1315<metal:block fill-slot="main"
    14              tal:define="student here/getContent;
    15              items here/contentValues"
     16             tal:define="items here/contentValues"
    1617             >
    17     <span tal:condition="python: 0" tal:content="items" />
    18     <tal:block tal:content="structure student/jamb_where_admitted" />
     18    <h2>Data for Student <span tal:content="context/id" /></h2>
    1919    <table cellspacing="0" cellpadding="0">
    2020      <tal:block condition="python: len(items)">
     
    3434    </table>
    3535  </metal:block>
     36  <metal:block fill-slot="sub">
     37  </metal:block>
    3638</html>
  • waeup_product/trunk/skins/waeup_student/student_view_student.pt

    r47 r48  
    1010    tal:attributes="href string:${base_url}student.css" />
    1111</metal:block>
    12 
    13 <metal:block fill-slot="main"
    14              tal:define="student here/getContent;
    15              items here/contentValues"
    16              >
    17     <span tal:condition="python: 0" tal:content="items" />
    18     <tal:block tal:content="structure student/jamb_where_admitted" />
     12  <metal:block fill-slot="header">
     13  </metal:block>
     14  <metal:block fill-slot="main"
     15               tal:define="student here/getContent;
     16               items here/contentValues"
     17               >
    1918    <table cellspacing="0" cellpadding="0">
    2019      <tal:block condition="python: len(items)">
     
    3433    </table>
    3534  </metal:block>
     35  <metal:block fill-slot="sub">
     36  </metal:block>
    3637</html>
Note: See TracChangeset for help on using the changeset viewer.