Changeset 596 for WAeUP_SRP


Ignore:
Timestamp:
29 Sep 2006, 14:14:40 (18 years ago)
Author:
joachim
Message:

student search should work now as follows:

if All States is selected a search string must be specified.
if another review state is specified, the searchstring can be empty.
if it is not empty, both are ANDed.

Location:
WAeUP_SRP/trunk
Files:
3 edited
2 moved

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/profiles/default/layouts/student_search.xml

    r587 r596  
    1717  <property name="hidden_layout_modes"/>
    1818  <property name="hidden_readonly_layout_modes"/>
    19   <property name="vocabulary">searchable_review_states_voc</property>
     19  <property name="vocabulary">searchable_student_states</property>
    2020 </widget>
    2121 <widget name="search_mode" meta_type="Generic Select Widget">
     
    2424   <element value="search_mode"/>
    2525  </property>
     26  <property name="is_required">True</property>
    2627  <property name="label">Search for</property>
    2728  <property name="label_edit">Search for</property>
     
    2930  <property name="hidden_layout_modes"/>
    3031  <property name="hidden_readonly_layout_modes"/>
    31   <property name="vocabulary">search_mode_voc</property>
     32  <property name="vocabulary">student_search_mode</property>
    3233  <property name="render_format">radio</property>
    3334 </widget>
  • WAeUP_SRP/trunk/profiles/default/vocabularies.xml

    r584 r596  
    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"/>
     18 <object name="student_search_mode" meta_type="CPS Vocabulary"/>
     19 <object name="searchable_student_states" meta_type="CPS Vocabulary"/>
     20 <object name="academics_search_mode" meta_type="CPS Vocabulary"/>
     21 <object name="searchable_academics_states" meta_type="CPS Vocabulary"/>
    2022 </object>
  • WAeUP_SRP/trunk/profiles/default/vocabularies/searchable_student_states.xml

    r585 r596  
    55 <property name="description"></property>
    66 <property name="acl_write_roles">Manager</property>
     7 <item key="all" msgid="">All States</item>
    78 <item key="admission_applied " msgid="">Applied for Admission</item>
    89 <item key="created" msgid="">Data Imported</item>
  • WAeUP_SRP/trunk/profiles/default/vocabularies/student_search_mode.xml

    r587 r596  
    99 <item key="matric_no" msgid="">Matriculation Number</item>
    1010 <item key="jamb_id" msgid="">Jamb Id</item>
    11  <item key="review_state" msgid="">Review State</item>
    1211</object>
  • WAeUP_SRP/trunk/skins/waeup_student/searchStudents.py

    r589 r596  
    5454state = ds.get('review_state')
    5555term = ds.get('search_string')
    56 if state == " ----- ":
    57     state = ''
    5856err = False
    5957if not term and what in ('student_edit','jamb_id','name','matric_no'):
    60     psm = "You must specify a search string"
     58    psm = "You must specify a search string when searching in 'All States'"
    6159    err = True
    6260elif '*' in term:
    63     psm = "You cannot use '*'"
     61    psm = "you cannot use the '*' alone"
    6462    err = True
    6563if err:
     
    7068                             is_manager = is_manager,
    7169                             )
    72 onlyreview = state and what == "review_state"
     70with_review = state != "all"
    7371items = []
    7472res = []
    7573portal_type_query = {'query':['Student','StudentApplication','StudentPersonal']}
    7674st_queries = ('jamb_id','matric_no','name')
     75onlyreview = with_review and not what
    7776if onlyreview:
    7877    res = catalog(portal_type=portal_type_query,
    7978                  review_state=state)
    8079elif what == "student_id":
    81     res = catalog(portal_type='Student',
    82                   id = term.strip())
     80    if with_review:
     81        res = catalog(portal_type='Student',
     82                      id = term.strip(),
     83                      review_state=state)
     84    else:
     85        res = catalog(portal_type='Student',
     86                      id = term.strip())
    8387elif what in st_queries:
    8488    if what == "jamb_id":
     
    9195        pt = portal_type_query
    9296        st = "%s*" % term.strip()
    93     try:
    94         res = catalog(portal_type=pt,SearchableText=st,)
    95     except:
    96         return context.students_manager_view(rendered = rend,
    97                              psm = 'Searchstring "%s" not allowed' % term,
    98                              #psm = "%s, %s" % (psm,ds),
    99                              students = items,
    100                              is_manager = is_manager,
    101                              )
     97    if with_review:
     98        try:
     99            res = catalog(portal_type=pt,SearchableText=st,
     100                          review_state=state)
     101        except:
     102            return context.students_manager_view(rendered = rend,
     103                                 psm = 'Searchstring "%s" not allowed' % term,
     104                                 #psm = "%s, %s" % (psm,ds),
     105                                 students = items,
     106                                 is_manager = is_manager,
     107                                 )
     108    else:
     109        try:
     110            res = catalog(portal_type=pt,SearchableText=st,)
     111        except:
     112            return context.students_manager_view(rendered = rend,
     113                                 psm = 'Searchstring "%s" not allowed' % term,
     114                                 #psm = "%s, %s" % (psm,ds),
     115                                 students = items,
     116                                 is_manager = is_manager,
     117                                 )
    102118           
    103119if res:
Note: See TracChangeset for help on using the changeset viewer.