Changeset 635
- Timestamp:
- 10 Oct 2006, 08:23:10 (18 years ago)
- Location:
- WAeUP_SRP/trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/WAeUPTables.py
r502 r635 48 48 49 49 def deleteRecord(self, uid): 50 #import pdb;pdb.set_trace() 50 51 self.uncatalog_object(uid) 51 52 … … 78 79 WAeUPTable.__init__(self, 'portal_accommodation') 79 80 81 def searchAndReserveBed(self, student_id,bed_type): 82 import pdb;pdb.set_trace() 83 records = self.searchResults({'student' : student_id}) 84 if len(records) > 0: 85 return -1,"Student with Id %s already booked bed %s" % (student_id,records[0].bed) 86 87 records = self.searchResults({'bed_type' : bed_type, "student": ''}) 88 if len(records) == 0: 89 return -1,"no bed of this type available" 90 rec = records[0] 91 self.modifyRecord(bed=rec.bed,student=student_id) 92 return 1,rec.bed 93 80 94 81 95 InitializeClass(AccommodationTable) … … 90 104 91 105 92 def searchAndSetRecord(self, uid, jamb_reg_no):106 def searchAndSetRecord(self, uid, student_id): 93 107 #records = self.searchResults(uid=uid) 94 108 records = self.searchResults({"%s" % self.key : uid}) … … 104 118 record_data[field] = getattr(record, field) 105 119 # Add the updated data: 106 record_data['student'] = jamb_reg_no120 record_data['student'] = student_id 107 121 self.catalog_object(dict2ob(record_data), uid) 108 122 return 1 109 if record.student != jamb_reg_no:123 if record.student != student_id: 110 124 return 0 111 if record.student == jamb_reg_no:125 if record.student == student_id: 112 126 return 2 113 127 -
WAeUP_SRP/trunk/Widgets.py
r586 r635 345 345 pins = self.portal_pins 346 346 pin = "%(p)s%(b)s%(n)s" % vars() 347 ref = datastructure[self.reference] 348 #import pdb;pdb.set_trace() 347 if self.reference == "": 348 ref = str(self.portal_membership.getAuthenticatedMember()) 349 else: 350 ref = datastructure[self.reference] 351 import pdb;pdb.set_trace() 349 352 ok = pins.searchAndSetRecord(pin,ref) 350 353 while 1: … … 356 359 break 357 360 if ok >= 1: 358 student = getStudentByRegNo(self,ref) 361 if self.isStudent(): 362 student = self.getStudentInfo()['student'] 363 else: 364 student = getStudentByRegNo(self,ref) 359 365 if student is None: 360 366 err = "Student not Found in validate SC" -
WAeUP_SRP/trunk/profiles/default/schemas/acco_hall.xml
r622 r635 14 14 </field> 15 15 <field name="reserved_rooms" meta_type="CPS String List Field"> 16 <property name="default_expr"> </property>16 <property name="default_expr">string:101 102</property> 17 17 </field> 18 18 <field name="rooms_per_floor" meta_type="CPS Int Field"> -
WAeUP_SRP/trunk/profiles/default/types/AccoHall.xml
r622 r635 8 8 <property name="product">WAeUP_SRP</property> 9 9 <property name="factory">addAccoHall</property> 10 <property name="immediate_view">ac ademics_contents</property>10 <property name="immediate_view">accommodation_index</property> 11 11 <property name="global_allow">True</property> 12 12 <property name="filter_content_types">True</property> -
WAeUP_SRP/trunk/skins/waeup_accommodation/accommodation_view.pt
r630 r635 93 93 % (cpsmcat('button_select_all'), cpsmcat('button_deselect_all'))" 94 94 /> 95 <input type="submit" name=" folder_delete:method" value="button_delete"95 <input type="submit" name="hall_delete:method" value="button_delete" 96 96 class="destructive" i18n:attributes="value" 97 97 tal:attributes="onclick python:'return window.confirm(\'%s\')' % 98 98 (cpsmcat('description_confirm_delete'), )" 99 99 /> 100 <input tal:condition="python: context.portal_type not in ('Semester','Certificate')"100 <input tal:condition="python: 0 and context.portal_type not in ('Semester','Certificate')" 101 101 type="submit" name="id_rename_form:method" 102 102 class="context" value="Change Object ID" i18n:attributes="value" -
WAeUP_SRP/trunk/skins/waeup_accommodation/getAccoHallsInfo.py
r627 r635 21 21 info['is_manager'] = context.isManager() 22 22 info['is_student'] = context.isStudent() 23 info['action'] = "%s" % context. campus.absolute_url()23 info['action'] = "%s" % context.absolute_url() 24 24 info['choosen_ids'] = request.get('ids',[]) 25 25 items = [] … … 49 49 if st: 50 50 res = pa(student=st) 51 bt_list.append({'student': st, 'bed': res[0].bed })51 res_list.append({'student': st, 'bed': res[0].bed }) 52 52 info['reserved'] = res_list 53 53 -
WAeUP_SRP/trunk/skins/waeup_accommodation/reserve_acco.py
r629 r635 9 9 pr = context.portal_registration 10 10 11 12 type_name = 'StudentApplication' 13 ti = context.portal_types[type_name] 14 REQUEST.set('type_name',type_name) 15 11 info = context.getStudentInfo() 16 12 validate = REQUEST.has_key("cpsdocument_create_button") 17 13 … … 25 21 ob={}, 26 22 layout_mode='create', 27 formaction = " acco_reserve",23 formaction = "reserve_acco", 28 24 button = "book Bed", 29 25 ) 30 26 if psm == 'invalid': 31 27 return context.acco_reserve_form(rendered = res, 32 psm = "Please correct your input.",33 #psm = "%s, %s" % (psm,ds),28 #psm = "Please correct your input.", 29 psm = "%s, %s" % (psm,ds), 34 30 firstlayout = True, 35 31 lastlayout = True, … … 45 41 elif psm == 'valid': 46 42 s_id = ds.get('s_id') 47 pin = str(ds.get('app_ac_pin')) 48 return context.REQUEST.RESPONSE.redirect("%s/logged_in?__ac_name=%s&__ac_password=%s&pin=%s" 49 % (context.absolute_url(),s_id,pin.split('-')[2],pin)) 43 pin = str(ds.get('acco_res_ac_pin')) 44 pa = context.portal_accommodation 45 code,bed = pa.searchAndReserveBed(s_id,"%s_%s" % (info['sex'],ds.get('student_status'))) 46 if code < 0: 47 return context.acco_reserve_form(rendered = res, 48 psm = bed, 49 firstlayout = True, 50 lastlayout = True, 51 ds = ds, 52 ) 53 else: 54 return context.acco_reserve_form(rendered = res, 55 psm = "successfully reserved bed %s" % bed, 56 firstlayout = True, 57 lastlayout = True, 58 ds = ds, 59 ) 50 60 51 61 52 return53 54 -
WAeUP_SRP/trunk/skins/waeup_student/getStudentInfo.py
r603 r635 39 39 info['per'] = student.personal 40 40 info['per_doc'] = student.personal.getContent() 41 info['sex'] = 'male' 42 if info['per_doc'].sex: 43 info['sex'] = 'female' 41 44 return info -
WAeUP_SRP/trunk/skins/waeup_student/layout_application_edit.pt
r537 r635 6 6 ds options/datastructure; 7 7 dm ds/getDataModel; 8 formaction formaction|string:student_edit;8 formaction options/formaction|string:student_edit; 9 9 creation creation|nothing; 10 10 metadata metadata|nothing;
Note: See TracChangeset for help on using the changeset viewer.