Changeset 48 for waeup_product/trunk/skins/waeup_student
- Timestamp:
- 16 Oct 2005, 15:47:22 (19 years ago)
- 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 3 3 """ 4 4 process the Admission Form 5 6 5 return html renderer + psm 7 6 """ … … 13 12 validate = REQUEST.has_key("cpsdocument_edit_button") 14 13 15 #student = context.getContent()16 student = context17 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 ## )27 14 28 15 lt = context.portal_layouts 16 pr = context.portal_registration 29 17 30 18 res,psm,ds = lt.renderLayout(layout_id= 'admission', … … 37 25 if psm == 'invalid': 38 26 return context.check_admission_form(rendered = res, 27 psm = "Please correct your input", 28 ds = ds, 29 ) 30 elif psm == '': 31 return context.check_admission_form(rendered = res, 32 psm = None, 33 ds = ds, 34 ) 35 elif 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, 39 47 psm = psm, 40 48 ds = ds, 41 )42 43 elif psm == 'valid':44 return context.student_admitted_form(rendered = res,45 psm = psm,46 49 student = student, 47 50 jamb = jamb, 51 pd = pd, 48 52 ) 49 53 -
waeup_product/trunk/skins/waeup_student/check_admission_form.pt
r47 r48 2 2 portal_status_message options/psm; 3 3 data_storage options/ds; 4 jamb options/jamb/getContent|nothing; 4 5 edition python:1;" 5 6 > … … 14 15 15 16 <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> 18 18 <div tal:replace="structure rendered_main" /> 19 19 </metal:block> 20 <metal:block fill-slot="sub"> 21 </metal:block> 20 22 21 23 </metal:block> -
waeup_product/trunk/skins/waeup_student/create_jamb.py
r45 r48 1 ##parameters= type_name, REQUEST=None, **kw1 ##parameters=REQUEST=None 2 2 # $Id$ 3 3 """ 4 Create an object.4 Create an the Jamb-Record for a Student 5 5 6 FIXME: what are the parameters?7 6 """ 8 7 9 from urllib import urlencode 8 type_name = 'Jamb' 9 ti = context.portal_types[type_name] 10 pr = context.portal_registration 11 pm = context.portal_membership 10 12 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', '') 13 REQUEST.set('type_name',type_name) 21 14 22 # Look for the create action on the ti 23 create_action_form = ti.getActionById('create', 'cpsdocument_create_form') 15 validate = REQUEST.has_key("cpsdocument_edit_button") 24 16 25 return REQUEST.RESPONSE.redirect('%s/%s?%s' 26 % (context.absolute_url(), 27 create_action_form, 28 urlencode(args))) 17 lt = context.portal_layouts 29 18 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))) 19 res,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 ) 26 if psm == 'invalid' or psm == '': 27 return context.create_jamb_form(rendered = res, 28 psm = psm, 29 ds = ds, 30 ) 31 32 elif 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 59 return res,psm,ds 36 60 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 proxy47 doc = ob48 else:49 try:50 doc.edit(proxy=ob, **kw)51 except:52 # CMF Compatibility.53 # type_name not necessarly and edit method54 # 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> 2 12 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"> 6 18 </metal:block> 7 19 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 17 17 method="post" class="group"> 18 18 <dt> 19 <input type="hidden" name="type_name" value=" Jamb" />19 <input type="hidden" name="type_name" value="StudentPersonal" /> 20 20 <p> 21 21 <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 5 5 edition python:1;" 6 6 > 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"> 9 8 <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> 13 10 </metal:main> 14 11 </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 2 2 3 3 # $Id$ … … 8 8 admin = "SectionManager" in context.portal_membership.getAuthenticatedMember().getRolesInContext(context) 9 9 10 return context.student_folder_view_main(admin = admin )10 return context.student_folder_view_main(admin = admin,psm=psm,groups=groups) -
waeup_product/trunk/skins/waeup_student/student_folder_view_main.pt
r26 r48 10 10 tal:attributes="href string:${base_url}student.css" /> 11 11 </metal:block> 12 <metal:block fill-slot="header"> 13 </metal:block> 12 14 13 15 <metal:block fill-slot="main" … … 16 18 > 17 19 <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>. 19 21 </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()"> 22 23 <table cellspacing="0" cellpadding="0"> 23 24 <tal:block condition="python: len(items)"> … … 36 37 </span> 37 38 </metal:block> 39 <metal:block fill-slot="sub"> 40 </metal:block> 38 41 </html> -
waeup_product/trunk/skins/waeup_student/student_index_html.py
r47 r48 4 4 5 5 """Default view for the Student.""" 6 member = context.portal_membership.getAuthenticatedMember() 6 7 7 return context.student_view_main() 8 #return context.student_view_manager() 9 if 'StudentManager' in member.getGroups(): 10 return context.student_view_manager() 11 elif 'Students' in member.getGroups(): 12 return context.student_view_student() -
waeup_product/trunk/skins/waeup_student/student_view_manager.pt
r47 r48 6 6 </metal:block> 7 7 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> 12 14 13 15 <metal:block fill-slot="main" 14 tal:define="student here/getContent; 15 items here/contentValues" 16 tal:define="items here/contentValues" 16 17 > 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> 19 19 <table cellspacing="0" cellpadding="0"> 20 20 <tal:block condition="python: len(items)"> … … 34 34 </table> 35 35 </metal:block> 36 <metal:block fill-slot="sub"> 37 </metal:block> 36 38 </html> -
waeup_product/trunk/skins/waeup_student/student_view_student.pt
r47 r48 10 10 tal:attributes="href string:${base_url}student.css" /> 11 11 </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 > 19 18 <table cellspacing="0" cellpadding="0"> 20 19 <tal:block condition="python: len(items)"> … … 34 33 </table> 35 34 </metal:block> 35 <metal:block fill-slot="sub"> 36 </metal:block> 36 37 </html>
Note: See TracChangeset for help on using the changeset viewer.