Changeset 7642 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 14 Feb 2012, 09:24:10 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r7641 r7642 27 27 from zope.component import queryUtility, getUtility, createObject 28 28 from zope.formlib.textwidgets import BytesDisplayWidget 29 #from hurry.query import Eq30 #from hurry.query.query import Query31 29 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 32 30 from waeup.sirp.accesscodes import ( … … 85 83 86 84 def emit_lock_message(view): 85 """Flash a lock message. 86 """ 87 87 view.flash('The requested form is locked (read-only).') 88 88 view.redirect(view.url(view.context)) … … 94 94 grok.context(IStudentsContainer) 95 95 title = 'Students' 96 #grok.implements(IBreadcrumbIgnorable)97 96 98 97 @property 99 98 def target(self): 100 99 user = get_current_principal() 101 #import pdb; pdb.set_trace()102 100 if getattr(user, 'user_type', None) == 'student': 103 101 return None … … 226 224 return 227 225 elif student_pw: 228 self.flash('Password has already been set. You are using the wrong Access Code.') 226 self.flash( 227 'Password has already been set. You are using the ' 228 'wrong Access Code.') 229 229 return 230 230 # Mark pin as used (this also fires a pin related transition) … … 237 237 # Here we know that the ac is in state initialized so we do not 238 238 # expect an exception 239 #import pdb; pdb.set_trace()240 239 invalidate_accesscode(pin,comment) 241 240 IUserAccount(student).setPassword(self.ac_number) … … 595 594 return current_mode 596 595 return 597 596 598 597 @property 599 598 def department(self): … … 816 815 self.flash('This level does not correspond current level.') 817 816 elif self.context.getStudent().state == REGISTERED: 818 IWorkflowInfo(self.context.getStudent()).fireTransition('validate_courses') 817 IWorkflowInfo(self.context.getStudent()).fireTransition( 818 'validate_courses') 819 819 self.flash('Course list has been validated.') 820 820 else: … … 929 929 return 930 930 931 # This manage form page is for both students and students officers.932 931 class PaymentsManageFormPage(SIRPEditFormPage): 933 932 """ Page to manage the student payments 933 934 This manage form page is for both students and students officers. 934 935 """ 935 936 grok.context(IStudentPaymentsContainer) … … 997 998 label = 'Add online payment' 998 999 pnav = 4 999 1000 1000 1001 @action('Create ticket', style='primary') 1001 1002 def createTicket(self, **data): … … 1006 1007 'configuration'].accommodation_session: 1007 1008 self.flash( 1008 'Your current session does not match accommodation session.') 1009 'Your current session does not match ' 1010 'accommodation session.') 1009 1011 self.redirect(self.url(self.context)) 1010 1012 return … … 1031 1033 self.applyData(payment, **data) 1032 1034 timestamp = "%d" % int(time()*1000) 1033 #order_id = "%s%s" % (student_id[1:],timestamp)1034 1035 payment.p_id = "p%s" % timestamp 1035 1036 payment.p_item = p_item … … 1051 1052 grok.require('waeup.viewStudent') 1052 1053 form_fields = grok.AutoFields(IStudentOnlinePayment) 1053 form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 1054 form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 1054 form_fields[ 1055 'creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 1056 form_fields[ 1057 'payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 1055 1058 pnav = 4 1056 1059 … … 1136 1139 self.context.getStudent(), studentview) 1137 1140 1138 # We don't need the display form page yet 1139 #class AccommodationDisplayFormPage(SIRPDisplayFormPage): 1140 # """ Page to display the student accommodation data 1141 # """ 1142 # grok.context(IStudentAccommodation) 1143 # grok.name('xxx') 1144 # grok.require('waeup.viewStudent') 1145 # form_fields = grok.AutoFields(IStudentAccommodation) 1146 # #grok.template('accommodationpage') 1147 # pnav = 4 1148 1149 # @property 1150 # def label(self): 1151 # return '%s: Accommodation Data' % self.context.__parent__.display_fullname 1152 1153 # This manage form page is for both students and students officers. 1141 1154 1142 class AccommodationManageFormPage(SIRPEditFormPage): 1155 1143 """ Page to manage bed tickets. 1144 1145 This manage form page is for both students and students officers. 1156 1146 """ 1157 1147 grok.context(IStudentAccommodation) … … 1200 1190 @property 1201 1191 def selected_actions(self): 1202 sa = self.actions1203 1192 if getattr(self.request.principal, 'user_type', None) == 'student': 1204 sa =[action for action in self.actions1205 if not action.label in self.officers_only_actions]1206 return s a1193 return [action for action in self.actions 1194 if not action.label in self.officers_only_actions] 1195 return self.actions 1207 1196 1208 1197 class BedTicketAddPage(SIRPPage): … … 1231 1220 self.redirect(self.url(self.context)) 1232 1221 return 1233 if student['studycourse'].current_session != acc_details['booking_session']: 1222 if student['studycourse'].current_session != acc_details[ 1223 'booking_session']: 1234 1224 self.flash( 1235 1225 'Your current session does not match accommodation session.') … … 1237 1227 return 1238 1228 if str(acc_details['booking_session']) in self.context.keys(): 1239 self.flash('You already booked a bed space in current accommodation session.') 1229 self.flash( 1230 'You already booked a bed space in current ' 1231 'accommodation session.') 1240 1232 self.redirect(self.url(self.context)) 1241 1233 return … … 1275 1267 return 1276 1268 else: 1277 comment = u"AC invalidated for %s" % self.context.getStudent().student_id 1269 comment = u"AC invalidated for %s" % ( 1270 self.context.getStudent().student_id,) 1278 1271 # Here we know that the ac is in state initialized so we do not 1279 1272 # expect an exception, but the owner might be different … … 1385 1378 self.redirect(self.url(self.context)) 1386 1379 return 1387 # R lease old bed if exists1380 # Release old bed if exists 1388 1381 if self.context.bed != None: 1389 1382 self.context.bed.owner = NOT_OCCUPIED … … 1402 1395 1403 1396 def render(self): 1404 #self.redirect(self.url(self.context, '@@index'))1405 1397 return 1406 1398 … … 1567 1559 return 1568 1560 1569 # To be specified in the customisation package1570 1561 def dataNotComplete(self): 1571 #store = getUtility(IExtFileStore) 1572 #if not store.getFileByContext(self.context, attr=u'xyz.jpg'): 1573 # return 'No xyz scan uploaded.' 1562 """To be implemented in the customization package. 1563 """ 1574 1564 return False 1575 1565 … … 1577 1567 def requestClearance(self, **data): 1578 1568 self.applyData(self.context, **data) 1579 #self.context._p_changed = True1580 1569 if self.dataNotComplete(): 1581 1570 self.flash(self.dataNotComplete()) … … 1648 1637 return 1649 1638 else: 1650 comment = u"AC invalidated for %s" % self.context.getStudent().student_id 1639 comment = u"AC invalidated for %s" % ( 1640 self.context.getStudent().student_id,) 1651 1641 # Here we know that the ac is in state initialized so we do not 1652 1642 # expect an exception, but the owner might be different … … 1724 1714 @property 1725 1715 def label(self): 1726 return 'Add and remove course tickets of study level %s' % self.context.level_title 1716 return 'Add and remove course tickets of study level %s' % ( 1717 self.context.level_title,) 1727 1718 1728 1719 @property … … 1765 1756 @action('Register course list', style='primary') 1766 1757 def RegisterCourses(self, **data): 1767 IWorkflowInfo(self.context.getStudent()).fireTransition('register_courses') 1758 IWorkflowInfo(self.context.getStudent()).fireTransition( 1759 'register_courses') 1768 1760 self.flash('Course list has been registered.') 1769 1761 self.redirect(self.url(self.context)) … … 1787 1779 @action('Add course ticket') 1788 1780 def addCourseTicket(self, **data): 1789 # Double bottom ...1781 # Safety belt 1790 1782 if self.context.getStudent().state != PAID: 1791 1783 return 1792 1784 ticket = CourseTicket() 1793 1785 course = data['course'] 1786 for name in ['code', 'title', 'credits', 'passmark', 'semester']: 1787 setattr(ticket, name, getattr(course, name)) 1794 1788 ticket.automatic = False 1795 ticket.code = course.code1796 ticket.title = course.title1797 1789 ticket.faculty = course.__parent__.__parent__.__parent__.title 1798 1790 ticket.department = course.__parent__.__parent__.title 1799 ticket.credits = course.credits1800 ticket.passmark = course.passmark1801 ticket.semester = course.semester1802 1791 try: 1803 1792 self.context.addCourseTicket(ticket)
Note: See TracChangeset for help on using the changeset viewer.