Changeset 584


Ignore:
Timestamp:
28 Sep 2006, 19:09:45 (18 years ago)
Author:
joachim
Message:

search form for students ready for testing.

Location:
WAeUP_SRP/trunk
Files:
5 added
1 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Students.py

    r582 r584  
    321321                continue
    322322            jamb_name = jamb.get("NAME")
     323            jamb_name.replace('>','')
    323324            names = jamb_name.split()
    324325            letter = names[-1][0].upper()
     
    626627    return CPSBase_adder(container, ob, REQUEST=REQUEST)
    627628
     629###)
    628630
    629631class StudentCourseResult(CPSDocument): ###(
  • WAeUP_SRP/trunk/profiles/default/layouts.xml

    r516 r584  
    2121 <object name="student_password" meta_type="CPS Layout"/>
    2222 <object name="student_schoolresults" meta_type="CPS Layout"/>
    23  <object name="student_semester" meta_type="CPS Layout"/>
     23 <object name="student_search" meta_type="CPS Layout"/>
    2424 <object name="student_study_level" meta_type="CPS Layout"/>
    2525 <object name="study_level" meta_type="CPS Layout"/>
  • WAeUP_SRP/trunk/profiles/default/schemas.xml

    r486 r584  
    1919 <object name="student_clearance" meta_type="CPS Schema"/>
    2020 <object name="student_personal" meta_type="CPS Schema"/>
     21 <object name="student_search" meta_type="CPS Schema"/>
    2122 <object name="students" meta_type="CPS Schema"/>
    2223 <object name="student_study_level" meta_type="CPS Schema"/>
  • WAeUP_SRP/trunk/profiles/default/vocabularies.xml

    r494 r584  
    1616 <object name="exam_types" meta_type="CPS Vocabulary"/>
    1717 <object name="pin_prefixes" meta_type="CPS Vocabulary"/>
     18 <object name="search_mode_voc" meta_type="CPS Vocabulary"/>
     19 <object name="searchable_review_states_voc" meta_type="CPS Vocabulary"/>
    1820 </object>
  • WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py

    r563 r584  
    3333#info['wf_state'] = 'keiner'
    3434info['student'] = student
     35info['id'] = student.getId()
    3536info['student_doc'] = student.getContent()
    3637info['app'] = student.application
  • WAeUP_SRP/trunk/skins/waeup_student/searchStudents.py

    r572 r584  
    55##bind script=script
    66##bind subpath=traverse_subpath
    7 ##parameters=student=None
     7##parameters=
    88##title=
    99##
     
    2121info['wf_states'] = student_wf_states
    2222info['wf_states'][0] = " ----- "
    23 
    2423mtool = context.portal_membership
    2524member = mtool.getAuthenticatedMember()
     25lt = context.portal_layouts
     26pr = context.portal_registration
    2627path_info = request.get('PATH_INFO').split('/')
    2728roles = member.getRoles()
    28 info['is_manager'] = 'Manager' in roles or 'SectionManager' in roles
    29 student_id = fget('student_id')
    30 jamb_id = fget('jamb_id')
    31 matric_no = fget('matric_no')
    32 name = fget('name')
    33 state = fget('state')
     29is_manager = 'Manager' in roles or 'SectionManager' in roles
     30validate = request.has_key("cpsdocument_edit_button")
     31items = []
     32default = {'search_mode': 'name',
     33        'review_state': 'admission_applied ',
     34        'search_string': 'yy'
     35        }
     36       
     37rend,psm,ds = lt.renderLayout(layout_id= 'student_search',
     38                      schema_id= 'student_search',
     39                      context=context,
     40                      mapping=validate and request,
     41                      ob=default,
     42                      layout_mode='edit',
     43                      formaction="searchStudents"
     44                      )
     45if psm == '':
     46    return context.students_manager_view(rendered = rend,
     47                             psm = psm,
     48                             #psm = "%s, %s" % (psm,ds),
     49                             students = items,
     50                             is_manager = is_manager,
     51                             )
     52what = ds.get('search_mode')
     53state = ds.get('review_state')
     54term = ds.get('search_string')
    3455if state == " ----- ":
    3556    state = ''
    36 onlyreview = state and not (student_id or jamb_id or matric_no or name)
     57onlyreview = state and what == "review_state"
    3758items = []
    3859res = []
     
    4162    res = catalog(portal_type=portal_type_query,
    4263                  review_state=state)
    43 elif student_id:
     64elif what == "student_id":
    4465    res = catalog(portal_type='Student',
    4566                  id = student_id.strip())
    46 elif jamb_id:
     67elif what == "jamb_id":
    4768    res = catalog(portal_type='StudentApplication',
    48                   SearchableText="%s*" % jamb_id.strip().lower())
    49 elif matric_no:
     69                  SearchableText="%s*" % term.strip().lower())
     70elif what == "matric_no":
    5071    res = catalog(portal_type='StudentClearance',
    51                   SearchableText="%s*" % matric_no.strip().lower())
    52 elif name:
     72                  SearchableText="%s*" % term.strip().lower())
     73elif what == "name":
    5374    res = catalog(portal_type=portal_type_query,
    54                   SearchableText="%s*" % name.strip())
     75                  SearchableText="%s*" % term.strip())
    5576if res:
    5677    for r in res:
     
    6081        else:
    6182            items.append(r.getObject())
    62 info['state'] = state
    63 info['student_id'] = student_id
    64 info['jamb_id'] = jamb_id
    65 info['matric_no'] = matric_no
    66 info['name'] = name
    67 
    68 info['students'] = items
    69 return info
     83students = []
     84if items:
     85    for item in items:
     86        students.append(context.getStudentInfo(item))
     87return context.students_manager_view(rendered = rend,
     88                             psm = "%d matching Students found" % len(items),
     89                             #psm = "%s, %s" % (psm,ds),
     90                             students = students,
     91                             is_manager = is_manager,
     92                             )
  • WAeUP_SRP/trunk/skins/waeup_student/students_index.py

    r543 r584  
    2929
    3030if isManager:
    31     return redirect("%s/students_manager_view" % campus.students.absolute_url())
     31    return redirect("%s/searchStudents" % campus.students.absolute_url())
    3232if isStudent:
    3333    info = context.getStudentInfo()
  • WAeUP_SRP/trunk/skins/waeup_student/students_manager_view.pt

    r572 r584  
    1 <metal:html tal:define="info context/searchStudents;
    2                         students info/students;
    3                         is_manager info/is_manager;">
    4 
     1<metal:html tal:define="rendered options/rendered;
     2            portal_status_message options/psm;
     3            students options/students;
     4            is_manager options/is_manager;"
     5            >
    56  <metal:body use-macro="here/main_template/macros/master">
    6 
    7     <metal:main fill-slot="main"
    8                 tal:define="isManager python:'Manager' in member.getRoles() or 'SectionManager' in member.getRoles()">
    9       <span tal:condition="not: isManager">
     7    <metal:block fill-slot="header"
     8                 tal:define="creation creation|nothing;
     9                 edition edition|nothing;
     10                 metadata metadata|nothing"
     11                 >
     12    </metal:block>
     13   
     14    <metal:main fill-slot="main">
     15      <span tal:condition="not: is_manager">
    1016        <metal:block use-macro="here/error_not_found/macros/not_found" />
    1117      </span>
    12       <span tal:condition="isManager">
    13       <h3>Search Students by</h3>
    14       <br />
    15       <form  action="." method="post" tal:attributes="action string: ${context/absolute_url}/students_manager_view">
    16         <table>           
    17           <tr>           
    18             <td>Status</td><td><div class="field"><span tal:condition="python:0" tal:content="info/wf_states"/>
    19                 <select name="state" tal:condition="python:1">
    20                   <option value="state"
    21                           tal:repeat="state info/wf_states"
    22                           tal:attributes="value state;selected python: info['state'] == state"
    23                           tal:content="state"></option>
    24                 </select>
    25               </div>
    26             </td>
    27           </tr>
    28           <tr>           
    29               <td>StudentId</td><td><input type="text" name="student_id"
    30                                            tal:attributes="value info/student_id"/></td>
    31               <td>Student Name</td><td><input type="text" name="name"
    32                                               tal:attributes="value info/name"/></td>
     18      <span tal:condition="is_manager"
     19        tal:define="items students;
     20        columns python:3;
     21        items_per_page python:40;
     22        max_items python:300;
     23        zoom python:0;
     24        batches_all python:here.getBatchList(items,columns, items_per_page,zoom,max_items=400);
     25        batches python:batches_all[0];
     26        batch_info python:batches_all[1];
     27        zoomed python:batches_all[2];
     28        mq nocall:modules/ZTUtils/make_query;"
     29        tal:omit-tag=""
     30        >
     31        <span tal:replace="structure rendered" />
     32        <tal:block tal:condition="python: batch_info and batch_info['nb_pages'] > 1">
     33          <div class="batchLayout">
     34            <span i18n:translate="">
     35              Objects:
     36              <strong>
     37                <tal:block replace="batch_info/start"
     38                           i18n:name="batch_start" /> - <tal:block replace="batch_info/limit"
     39                                                                   i18n:name="batch_limit" />
     40              </strong>
     41              of <tal:block replace="batch_info/length"
     42                            i18n:name="batch_length" />
     43            </span>
     44          </div>
     45          <br />
     46        </tal:block>
     47        <table class="contentListing" width="100%">
     48          <span tal:repeat="rows batches" tal:omit-tag="">
     49            <tr tal:repeat="student rows"
     50                tal:attributes="class python:test(repeat['student'].even(), 'even ajaxtd', 'odd ajaxtd')">
     51              <td><a href="id" tal:attributes="href string:${student/student/absolute_url}"
     52                     tal:content="student/id"></a></td>   
     53              <td>
     54                <span tal:replace="python: student['per_doc'].firstname" />
     55                <span tal:replace="python: student['per_doc'].middlename" />
     56                <span tal:replace="python: student['per_doc'].lastname" />
     57              </td>   
     58              <td><span tal:replace="python: student['app_doc'].jamb_reg_no" /></td>   
     59              <td><span tal:replace="student/review_state" /></td>   
    3360            </tr>
    34             <tr>
    35               <td>Matric No</td><td><input type="text" name="matric_no"
    36                                            tal:attributes="value info/matric_no"/></td>
    37               <td>JAMB Id</td><td><input type="text" name="jamb_id"
    38                                          tal:attributes="value info/jamb_id"/></td>
    39             </tr>
    40           <tr><td><input type="submit" class="context" name="search" value="search" /></td></tr>
    41             </table>
    42       </form>
    43         <table tal:condition="students">
    44           <tr tal:repeat="student students">
    45             <td><a href="id" tal:attributes="href string:${student/absolute_url}"
    46                    tal:content="student/getId"></a></td>   
    47             <span tal:omit-tag="" tal:define="info python: context.getStudentInfo(student)">
    48             <td><span tal:replace="python: info['per_doc'].lastname" /></td>   
    49             <td><span tal:replace="python: info['app_doc'].jamb_reg_no" /></td>   
    50             <td><span tal:replace="info/review_state" /></td>   
    51             </span>
    52           </tr>
     61          </span>
    5362        </table>
     63        <tal:block condition="python:batch_info and batch_info['nb_pages'] > 1">
     64          <div class="pageNavigationLayout">
     65            <a tal:define="previous batch_info/previous"
     66               tal:condition="python:previous is not None"
     67               tal:attributes="href python:'%s?%s'%(request['URL'],
     68               mq(request.form, b_start=0))"
     69               >
     70            (&lt;&lt;)</a>
     71            <a tal:define="previous batch_info/previous"
     72               tal:condition="python:previous is not None"
     73               tal:attributes="href python:'%s?%s'%(request['URL'],
     74               mq(request.form, b_start=previous))"
     75               i18n:translate="batch_previous">Previous</a>
     76            <tal:block repeat="page batch_info/pages">
     77              <tal:block condition="python:page != batch_info['start'] - 1">
     78                <a tal:attributes="href python:'%s?%s'%(request['URL'],
     79                mq(request.form, b_start=page))"
     80                tal:content="repeat/page/number">1</a>&nbsp;
     81              </tal:block>
     82              <tal:block condition="python:page == batch_info['start'] - 1">
     83                <span tal:content="string:${repeat/page/number}" />&nbsp;
     84              </tal:block>
     85            </tal:block>
     86            <a tal:define="next batch_info/next"
     87               tal:condition="python:next is not None"
     88               tal:attributes="href python:'%s?%s'%(request['URL'],
     89               mq(request.form, b_start=next))"
     90               i18n:translate="batch_next">Next</a>
     91            <a tal:define="next batch_info/next;
     92            last_page python:batch_info['pages'][-1]"
     93            tal:condition="python:next is not None"
     94            tal:attributes="href python:'%s?%s'%(request['URL'],
     95            mq(request.form, b_start=last_page))"
     96            >
     97            (&gt;&gt;)</a>
     98          </div>
     99        </tal:block>
    54100      </span>
    55101    </metal:main>
    56102  </metal:body>
    57103</metal:html>
     104 
Note: See TracChangeset for help on using the changeset viewer.