Changeset 8404
- Timestamp:
- 9 May 2012, 22:34:42 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/applicant.py
r8383 r8404 20 20 from cStringIO import StringIO 21 21 from grok import index 22 from hurry.query import Eq, Text 23 from hurry.query.query import Query 22 24 from zope.component import getUtility, createObject, getAdapter 23 25 from zope.component.interfaces import IFactory … … 37 39 from waeup.kofa.applicants.interfaces import IApplicant, IApplicantEdit 38 40 from waeup.kofa.applicants.workflow import application_states_dict 41 42 def search(query=None, searchtype=None, view=None): 43 if searchtype in ('fullname',): 44 results = Query().searchResults( 45 Text(('applicants_catalog', searchtype), query)) 46 else: 47 results = Query().searchResults( 48 Eq(('applicants_catalog', searchtype), query)) 49 return results 39 50 40 51 class Applicant(grok.Container): … … 157 168 Applicant = attrs_to_fields(Applicant) 158 169 159 class Applicant Catalog(grok.Indexes):170 class ApplicantsCatalog(grok.Indexes): 160 171 """A catalog indexing :class:`Applicant` instances in the ZODB. 161 172 """ … … 164 175 grok.context(IApplicant) 165 176 166 #access_code = index.Field(attribute='access_code')177 fullname = index.Text(attribute='display_fullname') 167 178 applicant_id = index.Field(attribute='applicant_id') 168 179 reg_number = index.Field(attribute='reg_number') -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py
r8390 r8404 36 36 IApplicantRegisterUpdate 37 37 ) 38 from waeup.kofa.applicants.applicant import search 38 39 from waeup.kofa.applicants.workflow import INITIALIZED, STARTED, PAID, SUBMITTED 39 40 from waeup.kofa.browser import ( … … 68 69 form_fields['description'].custom_widget = HTMLDisplayWidget 69 70 label = _('Application Section') 71 search_button = _('Search') 70 72 pnav = 3 71 73 … … 83 85 html = self.context.description_dict.get(portal_language,'') 84 86 return html 87 88 class ApplicantsSearchPage(KofaPage): 89 grok.context(IApplicantsRoot) 90 grok.name('search') 91 grok.require('waeup.viewApplication') 92 label = _('Search applicants') 93 search_button = _('Search') 94 pnav = 3 95 96 def update(self, *args, **kw): 97 datatable.need() 98 form = self.request.form 99 self.results = [] 100 if 'searchterm' in form and form['searchterm']: 101 self.searchterm = form['searchterm'] 102 self.searchtype = form['searchtype'] 103 elif 'old_searchterm' in form: 104 self.searchterm = form['old_searchterm'] 105 self.searchtype = form['old_searchtype'] 106 else: 107 if 'search' in form: 108 self.flash(_('Empty search string')) 109 return 110 self.results = search(query=self.searchterm, 111 searchtype=self.searchtype, view=self) 112 if not self.results: 113 self.flash(_('No applicant found.')) 114 return 85 115 86 116 class ApplicantsRootManageFormPage(KofaEditFormPage): -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/viewlets.py
r8262 r8404 82 82 return self.view.application_url() + rel_link 83 83 84 class SearchApplicantsActionButton(ManageActionButton): 85 grok.order(1) 86 grok.context(IApplicantsRoot) 87 grok.view(ApplicantsRootPage) 88 grok.require('waeup.viewApplication') 89 text = _('Search applicants') 90 icon = 'actionicon_search.png' 91 target = '@@search' 92 84 93 class ManageApplicantsRootActionButton(ManageActionButton): 94 grok.order(2) 85 95 grok.context(IApplicantsRoot) 86 96 grok.view(ApplicantsRootPage) -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r8346 r8404 189 189 self.searchterm = int(self.searchterm) 190 190 except ValueError: 191 self.flash( 'Only year dates allowed (e.g. 2011).')191 self.flash(_('Only year dates allowed (e.g. 2011).')) 192 192 return 193 193 self.hitlist = search(query=self.searchterm, 194 194 searchtype=self.searchtype, view=self) 195 195 if not self.hitlist: 196 self.flash( 'No student found.')196 self.flash(_('No student found.')) 197 197 return 198 198 -
main/waeup.kofa/trunk/src/waeup/kofa/students/catalog.py
r8244 r8404 30 30 from waeup.kofa.university.vocabularies import course_levels 31 31 32 class Student Indexes(grok.Indexes):32 class StudentsCatalog(grok.Indexes): 33 33 """A catalog for students. 34 34 """
Note: See TracChangeset for help on using the changeset viewer.