Changeset 535


Ignore:
Timestamp:
19 Sep 2006, 07:53:21 (18 years ago)
Author:
joachim
Message:

student apply admission should work now
the default_view for campus is now home_index.py
for students and student student_index.py
these script redirect to the appropriate PT

Location:
WAeUP_SRP/trunk
Files:
12 added
1 deleted
24 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/ScratchCards.py

    r502 r535  
    5555        return "Pin Batch %s BatchNo %d" % (doc.prefix, doc.batch_no)
    5656
    57     security.declareProtected(ModifyPortalContent,"makePins")
     57    security.declareProtected(ModifyPortalContent,"makePins") ###(
    5858    def makePins(self):
    5959        """generate Pins"""
     
    7777                ri = r.randint(1000000000,9999999999)
    7878                pin = "%s%d%d" % (prefix,b_no,ri)
    79             pins.addRecord(pin=pin,serial=i,student="")
     79            pins.addRecord(pin=pin,serial=i,student="",prefix_batch="%s%d" % (prefix, b_no))
    8080            generated.append('"%(i)d","%(prefix)s-%(b_no)d-%(ri)d"' % vars())
    8181        print '\n'.join(generated)
    8282        current = DateTime.DateTime().strftime("%d-%m-%y_%H_%M_%S")
    8383        open("%s/import/%s-%s-%s" % (i_home,prefix,b_no,current),"w+").write('\n'.join(generated))
     84    ###)
    8485
     86    security.declareProtected(ModifyPortalContent,"getUnusedPins")
     87    def getUnusedPins(self):
     88        """return a list of unused Pins"""
     89        max_pins = 30
     90        #import pdb;pdb.set_trace()
     91        pins_cat = self.portal_pins
     92        doc = self.getContent()
     93        l = [{'pin': p.pin,
     94              'serial': p.serial,
     95              } for p in pins_cat.searchResults(prefix_batch = "%s%d"
     96                                               % (doc.prefix,doc.batch_no),
     97                                               ) if p.student == '']
     98        if len (l) <= max_pins:
     99            return l
     100        return l[:max_pins]
    85101
    86102InitializeClass(ScratchCardBatch)
  • WAeUP_SRP/trunk/Students.py

    r522 r535  
    193193            tr_count += 1
    194194        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
    195         return self.students.academics_contents()
    196195    ###)
    197196
  • WAeUP_SRP/trunk/WAeUPPermissions.py

    r532 r535  
    2323"""
    2424
    25 #from AccessControl import ModuleSecurityInfo
    2625from Products.CMFCore.permissions import setDefaultRoles
    27 #security = ModuleSecurityInfo('Products.WAeUP.WAeUPPermissions')
    2826
    29 #  - 'Certificat Course delete' : Permission you need to ..
    30 #
    31 CertificateCourseDelete = "Certificate Course Delete"
    32 setDefaultRoles(CertificateCourseDelete, ('Manager',
    33                                'CourseAdvisor',
    34                                ))
    35 
     27WAeUPModifyOwnContent = "WAeUPModify own content"
     28setDefaultRoles(WAeUPModifyOwnContent, ('Owner',))
  • WAeUP_SRP/trunk/Widgets.py

    r523 r535  
    327327                if ok == 2:
    328328                    break
    329 ##                if self.portal_workflow.getInfoFor(student,
    330 ##                                                   'review_state',
    331 ##                                                   None) == "created":
    332 ##                    student.content_status_modify(workflow_action="enter_application_pin")
    333329                student.getContent().makeStudentMember(s_id,password=pin[4:])
    334330            break
  • WAeUP_SRP/trunk/profiles/default/pins.xml

    r502 r535  
    44 <column value="student"/>
    55 <column value="serial"/>
     6 <column value="prefix_batch"/>
    67 <index name="pin" meta_type="FieldIndex">
    78  <indexed_attr value="pin"/>
     9 </index>
     10 <index name="prefix_batch" meta_type="FieldIndex">
     11  <indexed_attr value="prefix_batch" />
    812 </index>
    913 <index name="student" meta_type="FieldIndex">
  • WAeUP_SRP/trunk/profiles/default/rolemap.xml

    r511 r535  
    88  </roles>
    99  <permissions>
     10    <permission name="WAeUPModify own content" acquire="True">
     11      <role name="Owner"/>
     12      <role name="SectionManager"/>
     13    </permission>
    1014    <permission name="List folder contents" acquire="True">
    11       <role name="Owner"/>
    1215      <role name="SectionManager"/>
    1316      <role name="SectionReader"/>
  • WAeUP_SRP/trunk/profiles/default/roots.xml

    r486 r535  
    22<roots>
    33 <object name="campus" portal_type="University"/>
     4 <script script_id=".cpsskins_theme"
     5         type="Script (Python)"
     6         filename="roots/.cpsskins_theme.py"
     7         />
    48</roots>
  • WAeUP_SRP/trunk/profiles/default/roots/campus.xml

    r486 r535  
    22<object name="campus">
    33  <property name="Title">University Portal</property>
    4   <property name=".cpsskins_theme">waeup_plain_theme</property>
    54  <object name="academics" portal_type="AcademicsFolder" />
    65  <object name="accommodation" portal_type="AccoFolder" />
  • WAeUP_SRP/trunk/profiles/default/schemas/certificate.xml

    r486 r535  
    44 <field name="category" meta_type="CPS String Field"/>
    55 <field name="code" meta_type="CPS String Field">
    6   <property name="is_searchabletext">True</property>
     6  <property name="is_searchabletext">False</property>
    77 </field>
    8  <field name="department" meta_type="CPS String Field"/>
    98 <field name="end_level" meta_type="CPS String Field"/>
    10  <field name="faculty" meta_type="CPS String Field"/>
    11  <field name="heading" meta_type="CPS String Field"/>
    129 <field name="m_prefix" meta_type="CPS String Field"/>
    1310 <field name="max_elect" meta_type="CPS String Field"/>
  • WAeUP_SRP/trunk/profiles/default/schemas/course.xml

    r486 r535  
    44 <field name="category" meta_type="CPS String Field"/>
    55 <field name="code" meta_type="CPS String Field">
    6   <property name="is_searchabletext">True</property>
     6  <property name="is_searchabletext">False</property>
    77 </field>
    88 <field name="credits" meta_type="CPS Int Field"/>
    99 <field name="former_code" meta_type="CPS String Field"/>
    1010 <field name="org_code" meta_type="CPS String Field">
    11   <property name="is_searchabletext">True</property>
     11  <property name="is_searchabletext">False</property>
    1212 </field>
    1313 <field name="passmark" meta_type="CPS Int Field">
  • WAeUP_SRP/trunk/profiles/default/types/ScratchCardBatch.xml

    r488 r535  
    2626 <property name="storage_methods"/>
    2727 <property name="cps_is_portlet">False</property>
    28  <alias from="(Default)" to="academics_contents"/>
     28 <alias from="(Default)" to="batch_index_html"/>
    2929 <alias from="create_do" to="scratch_card_batch_create_do"/>
    3030 <alias from="created" to="scratch_card_batch_created"/>
    31  <alias from="view" to="academics_contents"/>
     31 <alias from="view" to="batch_index_html"/>
    3232 <action title="Standard View" action_id="view" category="object"
    33     condition_expr="" url_expr="string:${object_url}/academics_contents"
     33    condition_expr="" url_expr="string:${object_url}/batch_index_html"
    3434    visible="True">
    3535  <permission value="Modify portal content"/>
  • WAeUP_SRP/trunk/profiles/default/types/ScratchCardBatchesFolder.xml

    r516 r535  
    2525 <property name="storage_methods"/>
    2626 <property name="cps_is_portlet">False</property>
    27  <alias from="(Default)" to="academics_contents"/>
     27 <alias from="(Default)" to="pins_index_html"/>
    2828 <alias from="create_do" to=""/>
    2929 <alias from="created" to=""/>
    30  <alias from="view" to="academics_contents"/>
     30 <alias from="view" to="pins_index_html"/>
    3131 <action title="Standard View" action_id="view" category="object"
    32     condition_expr="" url_expr="string:${object_url}/academics_contents"
     32    condition_expr="" url_expr="string:${object_url}/pins_index_html"
    3333    visible="True">
    3434  <permission value="View"/>
  • WAeUP_SRP/trunk/profiles/default/types/Student.xml

    r486 r535  
    88 <property name="product">WAeUP_SRP</property>
    99 <property name="factory">addStudent</property>
    10  <property name="immediate_view">folder_view</property>
     10 <property name="immediate_view">student_index</property>
    1111 <property name="global_allow">True</property>
    1212 <property name="filter_content_types">True</property>
     
    3232 <property name="storage_methods"/>
    3333 <property name="cps_is_portlet">False</property>
    34  <alias from="(Default)" to="academics_contents"/>
    35  <alias from="view" to="academics_contents"/>
     34 <alias from="(Default)" to="student_index"/>
     35 <alias from="view" to="student_index"/>
    3636 <action title="Standard View" action_id="view" category="object"
    3737    condition_expr=""
    38     url_expr="string:${object_url}/academics_contents" visible="True">
     38    url_expr="string:${object_url}/student_index" visible="True">
    3939  <permission value="View"/>
    4040 </action>
  • WAeUP_SRP/trunk/profiles/default/types/StudentsFolder.xml

    r523 r535  
    88 <property name="product">WAeUP_SRP</property>
    99 <property name="factory">addStudentsFolder</property>
    10  <property name="immediate_view">home_student</property>
     10 <property name="immediate_view">student_index</property>
    1111 <property name="global_allow">True</property>
    1212 <property name="filter_content_types">True</property>
     
    3030 <property name="storage_methods"/>
    3131 <property name="cps_is_portlet">False</property>
    32  <alias from="(Default)" to="home_student"/>
    33  <alias from="view" to="home_student"/>
     32 <alias from="(Default)" to="student_index"/>
     33 <alias from="view" to="student_index"/>
    3434 <action title="View" action_id="view" category="object" condition_expr=""
    35     url_expr="string:${object_url}/home_student" visible="True">
     35    url_expr="string:${object_url}/student_index" visible="True">
    3636  <permission value="View"/>
    3737 </action>
  • WAeUP_SRP/trunk/profiles/default/types/University.xml

    r523 r535  
    88 <property name="product">WAeUP_SRP</property>
    99 <property name="factory">addUniversity</property>
    10  <property name="immediate_view">home_student</property>
     10 <property name="immediate_view">home_index</property>
    1111 <property name="global_allow">True</property>
    1212 <property name="filter_content_types">True</property>
     
    3434 <property name="storage_methods"/>
    3535 <property name="cps_is_portlet">False</property>
    36  <alias from="(Default)" to="home_student"/>
    37  <alias from="view" to="home_student"/>
     36 <alias from="(Default)" to="home_index"/>
     37 <alias from="view" to="home_index"/>
    3838 <action title="View" action_id="view" category="object" condition_expr=""
    39     url_expr="string:${object_url}/home_student" visible="True">
     39    url_expr="string:${object_url}/home_index" visible="True">
    4040  <permission value="Modify portal content"/>
    4141 </action>
  • WAeUP_SRP/trunk/profiles/default/workflows/waeup_student_subobject_wf/definition.xml

    r521 r535  
    55              meta_type="CPS Workflow">
    66 <permission>Modify portal content</permission>
     7 <permission>WAeUPModify own content</permission>
    78 <permission>View</permission>
    89 <state state_id="closed" title="">
     
    1516  <permission-map name="Modify portal content"
    1617                  acquired="False">
     18   <permission-role>Owner</permission-role>
    1719   <permission-role>Manager</permission-role>
    18    <permission-role>Owner</permission-role>
    1920   <permission-role>SectionManager</permission-role>
    2021  </permission-map>
    21   <permission-map name="View" acquired="True">
     22  <permission-map name="WAeUPModify own content"
     23                  acquired="False">
     24   <permission-role>Owner</permission-role>
     25  </permission-map>
     26  <permission-map name="View" acquired="False">
    2227  </permission-map>
    2328 </state>
     
    2631  <permission-map name="Modify portal content"
    2732                  acquired="True">
     33   <permission-role>SectionManager</permission-role>
     34  </permission-map>
     35  <permission-map name="WAeUPModify own content"
     36                  acquired="False">
    2837   <permission-role>Owner</permission-role>
    29    <permission-role>SectionManager</permission-role>
    3038  </permission-map>
    3139  <permission-map name="View" acquired="True">
     
    3745 
    3846  <guard>
    39    <guard-role>Manager</guard-role>
    40    <guard-role>SectionManager</guard-role>
     47    <guard-permission>WAeUPModify own content</guard-permission>
    4148  </guard>
    4249 </transition>
     
    5562 
    5663  <guard>
    57    <guard-role>Manager</guard-role>
    58    <guard-role>SectionManager</guard-role>
     64    <guard-permission>WAeUPModify own content</guard-permission>
    5965  </guard>
    6066 </transition>
  • WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py

    r524 r535  
    1313$Id: logged_in.py 34693 2006-03-23 17:44:22Z ogrisel $
    1414"""
     15import DateTime
     16current = DateTime.DateTime()
    1517
    1618from urllib import unquote
     
    2628    return to_member_home, to_workspaces
    2729
     30request = context.REQUEST
     31response = request.RESPONSE
    2832utool = context.portal_url
    2933mtool = context.portal_membership
     
    4347    if not is_anon:
    4448        if "Student" in member.getRoles():
    45             member_id = str(member)
    46             student = getattr(context.campus.students,member_id,)
    47             if context.portal_workflow.getInfoFor(student,
    48                                                'review_state',
    49                                                None) == "created":
     49            to_waeup_student_home = True
     50            info = context.getStudentInfo()
     51            student = info['student']
     52##            member_id = str(member)
     53##            student = getattr(context.campus.students,member_id,)
     54##            if context.portal_workflow.getInfoFor(student,
     55##                                               'review_state',
     56##                                               None) == "created":
     57            if info['review_state'] == "created":
    5058                student.content_status_modify(workflow_action="enter_application_pin")
    5159                da = {}
     
    5361                da['app_ac_pin'] = pin
    5462                da['app_ac_date'] = current
    55                 application.getContent().edit(mapping = da)
    56                 to_waeup_student_home = True
     63                info['app_doc'].edit(mapping = da)
    5764        elif "Manager" in member.getRoles():
    5865            pass
  • WAeUP_SRP/trunk/skins/waeup_custom/standard_error_message.pt

    r531 r535  
    1515<tal:haserror condition="error_type">
    1616  <tal:NotFound condition="python:error_type == 'NotFound'">
    17     <metal:block use-macro="here/not_found/macros/not_found" />
     17    <metal:block use-macro="here/error_not_found/macros/not_found" />
    1818  </tal:NotFound>
    1919
    20   <tal:default condition="python:0 and error_type != 'NotFound'">
    21     <metal:block use-macro="here/error_lib_other/macros/other" />
     20  <tal:default condition="python:error_type != 'NotFound'">
     21    <metal:block use-macro="here/error_other/macros/other" />
    2222  </tal:default>
    2323
    24   <tal:debugging condition="python:0 and checkPerm('Manage portal', here)">
     24  <tal:debugging condition="python:checkPerm('Manage portal', here)">
    2525    <table width="100%" cellpadding="2" cellspacing="2">
    2626      <tr>
  • WAeUP_SRP/trunk/skins/waeup_default/portlet_session_info.pt

    r486 r535  
    44           roles member/getRoles;
    55           backend python:'Manager' in roles or 'SectionManager' in roles;
    6            frontend python:'Student' in roles or isAnon;"
     6           frontend python:'Student' in roles or isAnon;
     7           info context/getStudentInfo;"
    78           >
    89  <tal:block condition="not:isAnon">
    9        <strong> <span tal:content="python:member.getProperty('fullname',None)" />
     10       <strong> <span tal:condition="info" tal:content="python:info['per_doc'].lastname" />
     11       <span tal:condition="not: info" tal:content="python:member.getProperty('fullname',None)" />
    1012       </strong>
    1113  </tal:block>
  • WAeUP_SRP/trunk/skins/waeup_student/home_student.pt

    r530 r535  
    1 <metal:html tal:define="info context/get_student_info">
     1<metal:html tal:define="info context/getStudentInfo">
    22
    3 <metal:body use-macro="here/main_template/macros/master">
     3  <metal:body use-macro="here/main_template/macros/master">
    44
    5 <metal:main fill-slot="main">
    6 <span tal:condition="isAnon">
    7   <h2>Welcome to the     
    8    
    9   <br />Student Registration Portal of the University of Benin, Nigeria</h2>
    10  
    11   <br />
    12  
    13   <p>This is the frontpage of Uniben's Student Registration Portal (SRP) which is part of the West African e-University Project.
    14   For further information see
    15   <a href="" tal:attributes="href string:http://waeup.org">waeup.org</a>.</p>
    16  
    17   <p><strong>Fresh Students</strong>, who register for the first time, proceed to the respective application
    18   entrance page (UME, DE or Local Programmes). Later they can login to check their admission status and to
    19   proceed with the admission and clearance process.</p>
    20  
    21   <p><strong>Returning Students</strong> can login to check the course results of the previous session,
    22   to register courses for the current session, to pay their school fees and to book accommodation.</p>
    23  
    24   <p>This site is best seen in Firefox browser.</p>
    25 </span>
    26 <span tal:condition="python:not isAnon and info">
    27     <h3 tal:content="info/review_state|nothing"></h3>
    28    <span tal:omit-tag="" tal:condition="python:info['review_state'] == 'admission_applied'"
    29           tal:content="structure python: info['app_doc'].render(proxy=info['app_doc'],
    30                                                                layout_mode='view',
    31                                                                layout_id='student_application_fe')" />
    32      
    33 
    34 </span> 
    35 </metal:main>
    36 </metal:body>
     5    <metal:main fill-slot="main">
     6      <span tal:condition="isAnon">
     7        <h2>Welcome to the     
     8          <br />Student Registration Portal of the University of Benin, Nigeria</h2>
     9        <br />
     10        <p>This is the frontpage of Uniben's Student Registration Portal (SRP) which is part of the West African e-University Project.
     11          For further information see
     12          <a href="" tal:attributes="href string:http://waeup.org">waeup.org</a>.</p>
     13        <p><strong>Fresh Students</strong>, who register for the first time, proceed to the respective application
     14          entrance page (UME, DE or Local Programmes). Later they can login to check their admission status and to
     15        proceed with the admission and clearance process.</p>
     16        <p><strong>Returning Students</strong> can login to check the course results of the previous session,
     17        to register courses for the current session, to pay their school fees and to book accommodation.</p>
     18        <p>This site is best seen in Firefox browser.</p>
     19      </span>
     20      <span tal:condition="python:not isAnon and info"
     21            tal:define="review_state info/review_state">
     22        <h3 tal:content="info/review_state|nothing"></h3>
     23        <span tal:omit-tag="" tal:condition="python:review_state == 'admission_applied'"
     24              tal:content="structure python: info['app_doc'].render(proxy=info['app_doc'],
     25              layout_mode='view',
     26              layout_id='student_application_fe')"
     27              />
     28        <span tal:omit-tag="" tal:condition="python: review_state == 'application_pin_entered'"
     29              tal:content="structure python: info['app_doc'].render(proxy=info['app_doc'],
     30              layout_mode='edit',
     31              layout_id='student_application_fe')"
     32              />
     33      </span> 
     34      <span tal:condition="python:not isAnon and not info">
     35        <table tal:define="students python: context.objectValues()">
     36          <tr tal:repeat="student students">
     37            <span tal:omit-tag="" tal:define="info python: context.getStudentInfo(student)">
     38            <td><span tal:replace="python: info['per_doc'].lastname" /></td>   
     39            <td><span tal:replace="python: info['app_doc'].jamb_reg_no" /></td>   
     40            <td><span tal:replace="info/review_state" /></td>   
     41            </span>
     42          </tr>
     43        </table>
     44      </span>
     45    </metal:main>
     46  </metal:body>
    3747</metal:html>
  • WAeUP_SRP/trunk/skins/waeup_student/layout_application_edit.pt

    r502 r535  
    1212  ti python:type_name and getattr(here.portal_types,type_name,None) or getattr(here.portal_types,here.portal_type,None);
    1313  cpsmcat nocall:here/translation_service;
     14  apply request/apply_button|nothing;
    1415  ">
    1516
     
    7273  <br />
    7374  <input type="submit" class="standalone" name="cpsdocument_edit_button"
    74     value="button_change" i18n:attributes="value" id="cpsdocument_edit_button"
    75     tal:condition="not:creation" />
    76   <input type="submit" class="standalone" name="cpsdocument_edit_and_view_button"
    77     value="button_change_and_view" i18n:attributes="value"
    78     id="cpsdocument_edit_and_view_button"
    79     tal:condition="python:0 and not creation" />
     75         value="button_change"
     76         id="cpsdocument_edit_button"
     77         tal:condition="not:creation" />
     78  <input type="submit" class="standalone" name="apply_admission"
     79         value="apply for admission"
     80         id="cpsdocument_edit_and_view_button"
     81         tal:condition="apply"
     82         tal:attributes="value apply"/>
    8083  <input type="submit"
    8184         class="standalone"
     
    8790</form>
    8891</metal:block>
    89 
    90 
  • WAeUP_SRP/trunk/skins/waeup_student/layout_application_view.pt

    r524 r535  
    11<!-- a layout_lib macro -->
    22<!-- $Id: layout_lib_default_view.pt 34052 2006-03-06 14:59:24Z atchertchian $ -->
    3 
    43<metal:block define-macro="default_view"
    54  tal:define="layout options/layout;
    65              dm options/datastructure/getDataModel;
    76              widgets python:context.getRenderedWidgets(layout);
    8              ">
    9              <span tal:condition="nothing" tal:replace="structure widgets" />
    10 <table width="100%" cellpadding="2" cellspacing="2" summary="layout">
    11   <tr tal:repeat="row layout/rows">
    12     <td tal:repeat="cell row" tal:attributes="colspan cell/ncols">
    13       <tal:block define="widget cell/widget">
    14       <div tal:attributes="class cell/widget_css_class|nothing;
    15                            id python:widget.getHtmlWidgetId()+'_widget';
    16                           ">
    17         <tal:block condition="widget/label">
    18           <span class="dlabel" i18n:translate="" tal:condition="widget/is_i18n"
    19                 tal:content="widget/label">label</span>
    20           <span class="dlabel" tal:condition="not:widget/is_i18n"
    21                 tal:content="widget/label">label</span>
     7              fields python:('jamb_reg_no',
     8                                 'app_ac_pin',
     9                                 'app_ac_date',
     10                                 'jamb_lastname',
     11                                 'jamb_sex',
     12                                 'jamb_first_cos',
     13                                 'jamb_second_cos',)"
     14                                 >
     15  <span tal:condition="nothing" tal:replace="structure widgets" />
     16  <table width="100%" cellpadding="2" cellspacing="2" summary="layout">
     17    <tr tal:repeat="field fields">
     18      <td tal:define="cell python: widgets[field]">
     19        <tal:block define="widget cell/widget">
     20          <div tal:attributes="class cell/widget_css_class|nothing;
     21          id python:widget.getHtmlWidgetId()+'_widget';"
     22          >
     23            <tal:block condition="widget/label">
     24              <span class="dlabel"
     25                    tal:content="widget/label">label</span>
     26            </tal:block>
     27            <tal:block replace="structure cell/widget_rendered" />
     28          </div>
    2229        </tal:block>
    23         <tal:block replace="structure cell/widget_rendered" />
    24       </div>
    25       </tal:block>
    26     </td>
    27   </tr>
    28 </table>
     30      </td>
     31    </tr>
     32    <tr>
     33      <td tal:define="cell widgets/passport">
     34        <tal:block define="widget cell/widget">
     35          <div tal:attributes="class cell/widget_css_class|nothing;
     36          id python:widget.getHtmlWidgetId()+'_widget';"
     37          >
     38            <tal:block condition="widget/label">
     39              <span class="dlabel"
     40                    tal:content="widget/label">label</span>
     41            </tal:block>
     42            <img src="img" tal:attributes="src string:${context/aq_parent/absolute_url}/passport" />
     43          </div>
     44        </tal:block>
     45      </td>
     46    </tr>   
     47  </table>
    2948</metal:block>
  • WAeUP_SRP/trunk/skins/waeup_student/portlet_student_workflow_display.pt

    r522 r535  
    55                   roles member/getRoles;
    66                   item nocall:options/context_obj;
    7                    info item/get_student_info;"
     7                   info item/getStudentInfo;"
    88           condition="python:'Student' in roles
    99           ">
  • WAeUP_SRP/trunk/skins/waeup_student/student_edit.py

    r523 r535  
    3333# Validate the document and write it if it's valid
    3434# (We don't call getEditableContent here, validate does it when needed.)
    35 doc = context.getContent()
     35info = context.getStudentInfo()
    3636
    37 if context.portal_type == "StudentApplication":
    38     student = context.aq_parent
    39     state = context.portal_workflow.getInfoFor(student,'review_state',None)
     37student = info['student']
     38app = info['app']
     39app_doc = info['app_doc']
     40state = context.getStudentInfo()['review_state']
     41
     42if context.portal_type == "Student":
    4043    if state == "application_pin_entered":
    4144        student.content_status_modify(workflow_action="apply_for_admission")
    42     if doc.passport is None:
    43         is_valid, ds = doc.validate(request=REQUEST,
    44                                     proxy=context,
     45    if app_doc.passport is None:
     46        is_valid, ds = app_doc.validate(request=REQUEST,
     47                                    proxy=app_doc,
    4548                                    layout_id = "student_application_fe",
    4649                                    layout_mode = 'edit',
    4750                                    use_session=True)
    4851   
    49         action = '/application_form'
     52        action = "/student_edit"
    5053        if is_valid:
    51             comments = REQUEST.get('comments')
    52             context.cpsdocument_notify_modification(comments=comments)
    53             if cpsdocument_edit_and_view_button is not None:
    54                 action = ''
    5554            psm = 'You successfully uploaded your passport image.'
    5655            args = {}
    57             action = "/view"
    5856        else:
    5957            psm = 'psm_content_error'
    6058            args = getFormUidUrlArg(REQUEST)
     59    elif 'apply_admission' not in REQUEST.form:
     60        is_valid, ds = app_doc.validate(request=REQUEST,
     61                                    proxy=app_doc,
     62                                    layout_id = "student_application_fe",
     63                                    layout_mode = 'edit',
     64                                    use_session=True)
     65        action = "/passport_entry_view"
     66        if is_valid:
     67            args = {}
     68            if 'apply_admission' not in REQUEST.form:
     69                args = {'apply_button': 'Save and Apply',}
     70                psm = 'You successfully uploaded your passport image.'
     71            else:
     72                psm = 'You applied for admission.'
     73        else:
     74            args = getFormUidUrlArg(REQUEST)
     75            #psm = 'psm_content_error'
     76            psm = '%s' % ds
    6177    else:
    6278        args = {}
    63         psm = "You successfully applied for admission."
    64         action = "/view"
     79        psm = 'You applied for admission.'
     80        action = "/application_view"
    6581else:
    66     is_valid, ds = doc.validate(request=REQUEST, proxy=context, cluster=cluster,
     82    is_valid, ds = app_doc.validate(request=REQUEST, proxy=context, cluster=cluster,
    6783                                use_session=True)
    6884
    6985    if action is None:
    70         ti = doc.getTypeInfo()
     86        ti = app.getTypeInfo()
    7187        action = ti.queryMethodID('edit', 'cpsdocument_edit_form')
    7288        action = '/' + action
Note: See TracChangeset for help on using the changeset viewer.