Changeset 611 for WAeUP_SRP/trunk


Ignore:
Timestamp:
2 Oct 2006, 12:24:04 (18 years ago)
Author:
joachim
Message:

academisSearch can now be used for searching Courses,
the context is not yet taken into account,
the delete button does not work correctly yet.
pleade edit layout academics_search and the vocabularies to fit your needs

Location:
WAeUP_SRP/trunk/skins/waeup_academics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/skins/waeup_academics/academics_search_view.pt

    r600 r611  
    22            portal_status_message options/psm;
    33            objects options/objects;
    4             is_manager options/is_manager;"
     4            is_manager options/is_manager;
     5            "
    56            >
    67  <metal:body use-macro="here/main_template/macros/master">
     
    3031        >
    3132        <span tal:replace="structure rendered" />
     33          <form action="search" method="post" class="group"
     34                tal:attributes="action context/absolute_url"
     35                >
    3236        <tal:block tal:condition="python: batch_info and batch_info['nb_pages'] > 1">
    3337          <div class="batchLayout">
     
    4751        <table class="contentListing" width="100%">
    4852          <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            <tr tal:repeat="object rows"
     54                tal:attributes="class python:test(repeat['object'].even(), 'even ajaxtd', 'odd ajaxtd')">
     55                <td align="left" valign="middle" style="width: 5px;"
     56                    tal:condition="is_manager">
     57                  <input type="checkbox" name="ids:list" value="" id="" class="noborder"
     58                         tal:condition="is_manager"
     59                         tal:define="id object/id"
     60                         tal:attributes="value id;
     61                         id python:'cb_' + id;
     62                         checked python:id in options['choosen_ids'];"
     63                         />
     64                </td>
     65              <td><a href="id" tal:attributes="href string:${object/url}"
     66                     tal:content="object/title"></a></td>   
    5367              <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" />
     68                <span tal:replace="object/review_state" />
    5769              </td>   
    58               <td><span tal:replace="python: student['app_doc'].jamb_reg_no" /></td>   
    59               <td><span tal:replace="student/review_state" /></td>   
     70              <td>
     71                <a tal:condition="object/is_editable"
     72                    href="edit" tal:attributes="href string:${object/url}/external_edit_form"
     73                    target="edit"
     74                    onclick="javascript:window.open('','edit','width=600, height=700, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, status=no, resizable=no, dependent=no')">
     75                    [edit]
     76                    </a>
     77                </td>               
    6078            </tr>
    6179          </span>
     80        </table>
     81        <table width="100%" cellspacing="0" cellpadding="2"
     82               summary="buttons"
     83               class="folderButtons">
     84          <tr>
     85            <td align="left" valign="top" rowspan="3"></td>
     86            <td align="left" valign="top">
     87              <span tal:condition="is_manager">
     88                <input type="button" value="button_select_all" class="context"
     89                       onclick="someJavaScriptFunctionThatWillBeReplaced"
     90                       i18n:attributes="value"
     91                       tal:attributes="onclick python:'toggleSelect(this, \'%s\', \'%s\')'
     92                       % (cpsmcat('button_select_all'), cpsmcat('button_deselect_all'))"
     93                       />
     94                <input type="submit" name="folder_delete:method" value="button_delete"
     95                       class="destructive" i18n:attributes="value"
     96                       tal:attributes="onclick python:'return window.confirm(\'%s\')' %
     97                       (cpsmcat('description_confirm_delete'), )"
     98                       />
     99              </span>
     100            </td>
     101          </tr>
    62102        </table>
    63103        <tal:block condition="python:batch_info and batch_info['nb_pages'] > 1">
     
    98138          </div>
    99139        </tal:block>
     140        </form>
    100141      </span>
    101142    </metal:main>
  • WAeUP_SRP/trunk/skins/waeup_academics/searchAcademics.py

    r603 r611  
    2020lt = context.portal_layouts
    2121pr = context.portal_registration
     22mtool = context.portal_membership
    2223path_info = request.get('PATH_INFO').split('/')
    2324is_manager = context.isManager
     
    4748state = ds.get('review_state')
    4849term = ds.get('search_string')
    49 if state == " ----- ":
    50     state = ''
    51 if not term and what in ('student_edit','jamb_reg_no','name','matric_no'):
     50if not term and not with_review:
    5251    return context.academics_search_view(rendered = rend,
    5352                             psm = "You must specify a search string",
     
    5655                             is_manager = is_manager,
    5756                             )
    58 onlyreview = state and what == "review_state"
     57with_review = state != "all"
     58what = ds.get('search_mode')
     59state = ds.get('review_state')
     60term = ds.get('search_string')
     61err = False
     62with_review = state != "all"
     63if not term and not with_review:
     64    psm = "You must specify a search string when searching 'all states'."
     65    err = True
     66elif '*' in term:
     67    psm = "you cannot use the '*' alone"
     68    err = True
     69if err:
     70    return context.academics_search_view(rendered = rend,
     71                             psm = psm,
     72                             #psm = "%s, %s" % (psm,ds),
     73                             students = items,
     74                             is_manager = is_manager,
     75                             )
     76with_review = state != "all"
    5977items = []
    6078res = []
    61 portal_type_query = {'query':['Department','Course','CertificateCourse']}
     79portal_type_query = {'query':['Course','CertificateCourse']}
     80onlyreview = with_review and not term
    6281if onlyreview:
    6382    res = catalog(portal_type=portal_type_query,
    6483                  review_state=state)
    65 elif what == "student_id":
    66     res = catalog(portal_type='Student',
    67                   id = term.strip())
    68 elif what == "jamb_reg_no":
    69     res = catalog(portal_type='StudentApplication',
     84elif what == "course":
     85    res = catalog(portal_type='Course',
    7086                  SearchableText="%s*" % term.strip().lower())
    71 elif what == "matric_no":
    72     res = catalog(portal_type='StudentClearance',
     87elif what == "certificate_course":
     88    res = catalog(portal_type='CertificateCourse',
    7389                  SearchableText="%s*" % term.strip().lower())
    74 elif what == "name":
    75     res = catalog(portal_type=portal_type_query,
    76                   SearchableText="%s*" % term.strip())
     90objects = []
    7791if res:
    7892    for r in res:
    7993        row = {}
    80         if r.portal_type in ("StudentApplication","StudentPersonal"):
    81             items.append(r.getObject().aq_parent)
    82         else:
    83             items.append(r.getObject())
    84 objects = []
    85 if items:
    86     for item in items:
    87         objects.append(context.getStudentInfo(item))
     94        ro = r.getObject()
     95        rd = ro.getContent()
     96        row['id'] = r.getId
     97        row['title'] = rd.Title()
     98        row['url'] = ro.absolute_url()
     99        row['review_state'] = wf.getInfoFor(ro,'review_state','None')
     100        row['is_editable'] = mtool.checkPermission('Modify portal content', ro)
     101        objects.append(row)
     102        #objects.append(context.getStudentInfo(item))
    88103return context.academics_search_view(rendered = rend,
    89                              psm = "%d matching objects found" % len(items),
     104                             psm = "%d matching objects found" % len(objects),
    90105                             #psm = "%s, %s" % (psm,ds),
    91106                             objects = objects,
    92107                             is_manager = is_manager,
     108                             choosen_ids = []
    93109                             )
Note: See TracChangeset for help on using the changeset viewer.