Changeset 8314 for main/waeup.kofa/trunk
- Timestamp:
- 30 Apr 2012, 06:00:27 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/applicants
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py
r8286 r8314 42 42 from waeup.kofa.browser.interfaces import ICaptchaManager 43 43 from waeup.kofa.browser.breadcrumbs import Breadcrumb 44 from waeup.kofa.browser.resources import toggleall 44 45 from waeup.kofa.browser.layout import ( 45 46 NullValidator, jsaction, action, UtilityView) … … 253 254 form_fields = grok.AutoFields(IApplicantsContainer).omit('title') 254 255 taboneactions = [_('Save'),_('Cancel')] 255 tabtwoactions = [_('Add applicant'), _('Remove selected'),_('Cancel')] 256 tabtwoactions = [_('Add applicant'), _('Remove selected'),_('Cancel'), 257 _('Create students from selected')] 256 258 tabthreeactions1 = [_('Remove selected local roles')] 257 259 tabthreeactions2 = [_('Add local role')] … … 268 270 datepicker.need() # Enable jQuery datepicker in date fields. 269 271 tabs.need() 272 toggleall.need() 270 273 self.tab1 = self.tab2 = self.tab3 = '' 271 274 qs = self.request.get('QUERY_STRING', '') … … 334 337 return 335 338 339 @action(_('Create students from selected')) 340 def createStudents(self, **data): 341 form = self.request.form 342 if form.has_key('val_id'): 343 child_id = form['val_id'] 344 else: 345 self.flash(_('No applicant selected!')) 346 self.redirect(self.url(self.context, '@@manage')+'?tab2') 347 return 348 if not isinstance(child_id, list): 349 child_id = [child_id] 350 created = [] 351 for id in child_id: 352 success, msg = self.context[id].createStudent(view=self) 353 if success: 354 created.append(id) 355 if len(created): 356 self.flash(_('${a} students successfully created.', 357 mapping = {'a': len(created)})) 358 else: 359 self.flash(_('No student could be created.')) 360 self.redirect(self.url(self.context, u'@@manage')+'?tab2') 361 return 362 336 363 @action(_('Cancel'), validator=NullValidator) 337 364 def cancel(self, **data): … … 434 461 435 462 def update(self): 436 msg = self.context.createStudent( )[1]463 msg = self.context.createStudent(view=self)[1] 437 464 self.flash(msg) 438 465 self.redirect(self.url(self.context)) -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser_templates/applicantscontainermanagepage.pt
r7811 r8314 34 34 </div> 35 35 <div id="tab-2" tal:attributes="class view/tab2"> 36 <h3 i18n:translate="">Applicants</h3> 36 37 <input type="checkbox" onClick="toggle(this, 'val_id')" /> 38 <span i18n:translate="">Select all</span> 39 <br /><br /> 40 37 41 <table class="display dataTableManage"> 38 42 <thead> -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/sample_container_data.csv
r8033 r8314 1 code,title,prefix, entry_level,year,application_category,description,startdate,enddate,strict_deadline,mode2 app2012,General Studies 2012/2013,app, 100,2012,basic,"This text can been seen by anonymous users.1 code,title,prefix,year,application_category,description,startdate,enddate,strict_deadline,mode 2 app2012,General Studies 2012/2013,app,2012,basic,"This text can been seen by anonymous users. 3 3 >>de<< 4 4 Dieser Text kann von anonymen Benutzern gelesen werden.",2012-03-01,2012-04-25,1,create 5 app2013,General Studies 2013/2014,app, 100,2012,basic,"This text can been seen by anonymous users.5 app2013,General Studies 2013/2014,app,2012,basic,"This text can been seen by anonymous users. 6 6 >>de<< 7 7 Dieser Text kann von anonymen Benutzern gelesen werden.",2013-03-01,2013-04-25,1,create -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_applicantcopier.py
r7811 r8314 20 20 """ 21 21 import os 22 from hurry.workflow.interfaces import IWorkflowInfo 22 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 23 23 from zope.component import getUtility 24 24 from waeup.kofa.testing import FunctionalLayer … … 54 54 (success, msg) = self.applicant.createStudent() 55 55 self.assertTrue(msg == 'Applicant has not yet been admitted.') 56 IWorkflowInfo(self.applicant).fireTransition('start') 57 IWorkflowInfo(self.applicant).fireTransition('pay') 58 IWorkflowInfo(self.applicant).fireTransition('submit') 59 IWorkflowInfo(self.applicant).fireTransition('admit') 56 IWorkflowState(self.applicant).setState('admitted') 60 57 (success, msg) = self.applicant.createStudent() 61 58 self.assertTrue(msg == 'No course admitted provided.') … … 99 96 self.assertMatches('...John Tester...', self.browser.contents) 100 97 98 def test_batch_copying(self): 99 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 100 self.browser.open(self.manage_path) 101 self.fill_correct_values() 102 self.browser.getControl("Save").click() 103 # Upload a passport picture 104 ctrl = self.browser.getControl(name='form.passport') 105 file_obj = open( 106 os.path.join(os.path.dirname(__file__), 'test_image.jpg'),'rb') 107 file_ctrl = ctrl.mech_control 108 file_ctrl.add_file(file_obj, filename='my_photo.jpg') 109 self.browser.getControl("Save").click() # submit form 110 IWorkflowState(self.applicant).setState('admitted') 111 self.browser.getControl(name="form.course_admitted").value = ['CERT1'] 112 self.browser.getControl("Save").click() 113 self.browser.open(self.manage_container_path) 114 self.browser.getControl("Create students from selected", index=0).click() 115 self.assertTrue('No applicant selected' in self.browser.contents) 116 ctrl = self.browser.getControl(name='val_id') 117 ctrl.getControl(value=self.applicant.application_number).selected = True 118 self.browser.getControl("Create students from selected", index=0).click() 119 self.assertTrue('1 students successfully created' in self.browser.contents) 120 101 121 def test_copier_wo_passport(self): 102 122 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') … … 104 124 self.fill_correct_values() 105 125 # Let's try to create the student 106 IWorkflowInfo(self.applicant).fireTransition('start') 107 IWorkflowInfo(self.applicant).fireTransition('pay') 108 IWorkflowInfo(self.applicant).fireTransition('submit') 109 IWorkflowInfo(self.applicant).fireTransition('admit') 126 IWorkflowState(self.applicant).setState('admitted') 110 127 self.browser.getControl(name="form.course_admitted").value = ['CERT1'] 111 128 self.browser.getControl("Save").click()
Note: See TracChangeset for help on using the changeset viewer.