Changeset 7591 for main/waeup.sirp/trunk/src/waeup/sirp/students
- Timestamp:
- 6 Feb 2012, 16:57:37 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r7549 r7591 36 36 SIRPPage, SIRPEditFormPage, SIRPAddFormPage, SIRPDisplayFormPage, 37 37 ContactAdminForm, SIRPForm) 38 from waeup.sirp.browser.interfaces import ICaptchaManager , IBreadcrumbIgnorable38 from waeup.sirp.browser.interfaces import ICaptchaManager 39 39 from waeup.sirp.browser.breadcrumbs import Breadcrumb 40 40 from waeup.sirp.browser.resources import datepicker, datatable, tabs, warning 41 from waeup.sirp.browser.viewlets import (42 ManageActionButton, AddActionButton)43 41 from waeup.sirp.browser.layout import jsaction, action, UtilityView 44 42 from waeup.sirp.interfaces import ( … … 62 60 from waeup.sirp.students.vocabularies import StudyLevelSource 63 61 from waeup.sirp.browser.resources import toggleall 64 from waeup.sirp.applicants.interfaces import IApplicantBaseData65 62 from waeup.sirp.hostels.hostel import NOT_OCCUPIED 66 63 from waeup.sirp.utils.helpers import get_current_principal … … 248 245 return 249 246 250 class StudentsContainerManageActionButton(ManageActionButton):251 grok.order(1)252 grok.context(IStudentsContainer)253 grok.view(StudentsContainerPage)254 grok.require('waeup.manageStudent')255 text = 'Manage student section'256 257 258 247 class StudentsContainerManagePage(SIRPPage): 259 248 """The manage page for student containers. … … 304 293 return 305 294 306 class StudentsContainerAddActionButton(AddActionButton):307 grok.order(1)308 grok.context(IStudentsContainer)309 grok.view(StudentsContainerManagePage)310 grok.require('waeup.manageStudent')311 text = 'Add student'312 target = 'addstudent'313 314 295 class StudentAddFormPage(SIRPAddFormPage): 315 296 """Add-form to add a student. … … 351 332 return 'set' 352 333 return 'unset' 353 354 class ContactActionButton(ManageActionButton):355 grok.order(4)356 grok.context(IStudent)357 grok.view(StudentBaseDisplayFormPage)358 grok.require('waeup.manageStudent')359 icon = 'actionicon_mail.png'360 text = 'Send email'361 target = 'contactstudent'362 334 363 335 class ContactStudentForm(ContactAdminForm): … … 397 369 return 398 370 399 class StudentBaseManageActionButton(ManageActionButton):400 grok.order(1)401 grok.context(IStudent)402 grok.view(StudentBaseDisplayFormPage)403 grok.require('waeup.manageStudent')404 text = 'Manage'405 target = 'manage_base'406 407 371 class StudentBaseManageFormPage(SIRPEditFormPage): 408 372 """ View to manage student base data … … 484 448 return '%s: Clearance Data' % self.context.display_fullname 485 449 486 class StudentClearanceManageActionButton(ManageActionButton):487 grok.order(1)488 grok.context(IStudent)489 grok.view(StudentClearanceDisplayFormPage)490 grok.require('waeup.manageStudent')491 text = 'Manage'492 target = 'edit_clearance'493 494 class StudentClearActionButton(ManageActionButton):495 grok.order(2)496 grok.context(IStudent)497 grok.view(StudentClearanceDisplayFormPage)498 grok.require('waeup.clearStudent')499 text = 'Clear student'500 target = 'clear'501 icon = 'actionicon_accept.png'502 503 @property504 def target_url(self):505 if self.context.state != REQUESTED:506 return ''507 return self.view.url(self.view.context, self.target)508 509 class StudentRejectClearanceActionButton(ManageActionButton):510 grok.order(3)511 grok.context(IStudent)512 grok.view(StudentClearanceDisplayFormPage)513 grok.require('waeup.clearStudent')514 text = 'Reject clearance'515 target = 'reject_clearance'516 icon = 'actionicon_reject.png'517 518 @property519 def target_url(self):520 if self.context.state not in (REQUESTED, CLEARED):521 return ''522 return self.view.url(self.view.context, self.target)523 524 class ClearanceSlipActionButton(ManageActionButton):525 grok.order(4)526 grok.context(IStudent)527 grok.view(StudentClearanceDisplayFormPage)528 grok.require('waeup.viewStudent')529 icon = 'actionicon_pdf.png'530 text = 'Download clearance slip'531 target = 'clearance.pdf'532 533 450 class ExportPDFClearanceSlipPage(grok.View): 534 451 """Deliver a PDF slip of the context. … … 642 559 return '%s: Personal Data' % self.context.display_fullname 643 560 644 class StudentPersonalEditActionButton(ManageActionButton):645 grok.order(1)646 grok.context(IStudent)647 grok.view(StudentPersonalDisplayFormPage)648 grok.require('waeup.viewStudent')649 text = 'Edit'650 target = 'edit_personal'651 652 561 class StudentPersonalManageFormPage(SIRPEditFormPage): 653 562 """ Page to edit student clearance data … … 698 607 return self.context.certificate.__parent__.__parent__.__parent__ 699 608 return 700 701 class StudyCourseManageActionButton(ManageActionButton):702 grok.order(1)703 grok.context(IStudentStudyCourse)704 grok.view(StudyCourseDisplayFormPage)705 grok.require('waeup.manageStudent')706 text = 'Manage'707 target = 'manage'708 609 709 610 class StudyCourseManageFormPage(SIRPEditFormPage): … … 809 710 total_credits += val.credits 810 711 return total_credits 811 812 class CourseRegistrationSlipActionButton(ManageActionButton):813 grok.order(1)814 grok.context(IStudentStudyLevel)815 grok.view(StudyLevelDisplayFormPage)816 grok.require('waeup.viewStudent')817 icon = 'actionicon_pdf.png'818 text = 'Download course registration slip'819 target = 'course_registration.pdf'820 712 821 713 class ExportPDFCourseRegistrationSlipPage(UtilityView, grok.View): … … 852 744 tabledata=tabledata) 853 745 854 class StudyLevelManageActionButton(ManageActionButton):855 grok.order(2)856 grok.context(IStudentStudyLevel)857 grok.view(StudyLevelDisplayFormPage)858 grok.require('waeup.manageStudent')859 text = 'Manage'860 target = 'manage'861 862 class StudentValidateCoursesActionButton(ManageActionButton):863 grok.order(3)864 grok.context(IStudentStudyLevel)865 grok.view(StudyLevelDisplayFormPage)866 grok.require('waeup.validateStudent')867 text = 'Validate courses'868 target = 'validate_courses'869 icon = 'actionicon_accept.png'870 871 @property872 def target_url(self):873 if self.context.getStudent().state != REGISTERED or \874 str(self.context.__parent__.current_level) != self.context.__name__:875 return ''876 return self.view.url(self.view.context, self.target)877 878 class StudentRejectCoursesActionButton(ManageActionButton):879 grok.order(4)880 grok.context(IStudentStudyLevel)881 grok.view(StudyLevelDisplayFormPage)882 grok.require('waeup.validateStudent')883 text = 'Reject courses'884 target = 'reject_courses'885 icon = 'actionicon_reject.png'886 887 @property888 def target_url(self):889 if self.context.getStudent().state not in (VALIDATED, REGISTERED) or \890 str(self.context.__parent__.current_level) != self.context.__name__:891 return ''892 return self.view.url(self.view.context, self.target)893 894 746 class StudyLevelManageFormPage(SIRPEditFormPage): 895 747 """ Page to edit the student study level data … … 1058 910 self.context.getStudent().display_fullname,self.context.code) 1059 911 1060 class CourseTicketManageActionButton(ManageActionButton):1061 grok.order(1)1062 grok.context(ICourseTicket)1063 grok.view(CourseTicketDisplayFormPage)1064 grok.require('waeup.manageStudent')1065 text = 'Manage'1066 target = 'manage'1067 1068 912 class CourseTicketManageFormPage(SIRPEditFormPage): 1069 913 """ Page to manage course tickets … … 1162 1006 def addPaymentTicket(self, **data): 1163 1007 self.redirect(self.url(self.context, '@@addop')) 1164 1165 #class OnlinePaymentManageActionButton(ManageActionButton):1166 # grok.order(1)1167 # grok.context(IStudentPaymentsContainer)1168 # grok.view(PaymentsDisplayFormPage)1169 # grok.require('waeup.manageStudent')1170 # text = 'Manage payments'1171 # target = 'manage'1172 1008 1173 1009 class OnlinePaymentAddFormPage(SIRPAddFormPage): … … 1243 1079 return '%s: Online Payment Ticket %s' % ( 1244 1080 self.context.getStudent().display_fullname,self.context.p_id) 1245 1246 class PaymentReceiptActionButton(ManageActionButton):1247 grok.order(1)1248 grok.context(IStudentOnlinePayment)1249 grok.view(OnlinePaymentDisplayFormPage)1250 grok.require('waeup.viewStudent')1251 icon = 'actionicon_pdf.png'1252 text = 'Download payment receipt'1253 target = 'payment_receipt.pdf'1254 1255 @property1256 def target_url(self):1257 if self.context.p_state != 'paid':1258 return ''1259 return self.view.url(self.view.context, self.target)1260 1261 class RequestCallbackActionButton(ManageActionButton):1262 grok.order(2)1263 grok.context(IStudentOnlinePayment)1264 grok.view(OnlinePaymentDisplayFormPage)1265 grok.require('waeup.payStudent')1266 icon = 'actionicon_call.png'1267 text = 'Request callback'1268 target = 'callback'1269 1270 @property1271 def target_url(self):1272 if self.context.p_state != 'unpaid':1273 return ''1274 return self.view.url(self.view.context, self.target)1275 1081 1276 1082 class OnlinePaymentCallbackPage(UtilityView, grok.View): … … 1420 1226 return sa 1421 1227 1422 class AddBedTicketActionButton(ManageActionButton):1423 grok.order(1)1424 grok.context(IStudentAccommodation)1425 grok.view(AccommodationManageFormPage)1426 grok.require('waeup.handleAccommodation')1427 icon = 'actionicon_home.png'1428 text = 'Book accommodation'1429 target = 'add'1430 1431 1228 class BedTicketAddPage(SIRPPage): 1432 1229 """ Page to add an online payment ticket … … 1538 1335 return 'Bed Ticket for Session %s' % self.context.getSessionString() 1539 1336 1540 class BedTicketSlipActionButton(ManageActionButton):1541 grok.order(1)1542 grok.context(IBedTicket)1543 grok.view(BedTicketDisplayFormPage)1544 grok.require('waeup.handleAccommodation')1545 icon = 'actionicon_pdf.png'1546 text = 'Download bed allocation slip'1547 target = 'bed_allocation.pdf'1548 1549 1337 class ExportPDFBedTicketSlipPage(UtilityView, grok.View): 1550 1338 """Deliver a PDF slip of the context. … … 1569 1357 self, 'bed_allocation.pdf', 1570 1358 self.context.getStudent(), studentview) 1571 1572 class RelocateStudentActionButton(ManageActionButton):1573 grok.order(2)1574 grok.context(IBedTicket)1575 grok.view(BedTicketDisplayFormPage)1576 grok.require('waeup.manageHostels')1577 icon = 'actionicon_reload.png'1578 text = 'Relocate student'1579 target = 'relocate'1580 1359 1581 1360 class BedTicketRelocationPage(UtilityView, grok.View): … … 1661 1440 # Pages for students only 1662 1441 1663 class StudentBaseActionButton(ManageActionButton):1664 grok.order(1)1665 grok.context(IStudent)1666 grok.view(StudentBaseDisplayFormPage)1667 grok.require('waeup.handleStudent')1668 text = 'Edit base data'1669 target = 'edit_base'1670 1671 class StudentPasswordActionButton(ManageActionButton):1672 grok.order(2)1673 grok.context(IStudent)1674 grok.view(StudentBaseDisplayFormPage)1675 grok.require('waeup.handleStudent')1676 icon = 'actionicon_key.png'1677 text = 'Change password'1678 target = 'change_password'1679 1680 class StudentPassportActionButton(ManageActionButton):1681 grok.order(3)1682 grok.context(IStudent)1683 grok.view(StudentBaseDisplayFormPage)1684 grok.require('waeup.handleStudent')1685 icon = 'actionicon_portrait.png'1686 text = 'Change portrait'1687 target = 'change_portrait'1688 1689 @property1690 def target_url(self):1691 if self.context.state != 'admitted':1692 return ''1693 return self.view.url(self.view.context, self.target)1694 1695 1442 class StudentBaseEditFormPage(SIRPEditFormPage): 1696 1443 """ View to edit student base data … … 1752 1499 return 1753 1500 1754 class StudentClearanceStartActionButton(ManageActionButton):1755 grok.order(1)1756 grok.context(IStudent)1757 grok.view(StudentClearanceDisplayFormPage)1758 grok.require('waeup.handleStudent')1759 icon = 'actionicon_start.gif'1760 text = 'Start clearance'1761 target = 'start_clearance'1762 1763 @property1764 def target_url(self):1765 if self.context.state != 'admitted':1766 return ''1767 return self.view.url(self.view.context, self.target)1768 1769 1501 class StartClearancePage(SIRPPage): 1770 1502 grok.context(IStudent) … … 1832 1564 return 1833 1565 1834 class StudentClearanceEditActionButton(ManageActionButton):1835 grok.order(1)1836 grok.context(IStudent)1837 grok.view(StudentClearanceDisplayFormPage)1838 grok.require('waeup.handleStudent')1839 text = 'Edit'1840 target = 'cedit'1841 1842 @property1843 def target_url(self):1844 if self.context.clearance_locked:1845 return ''1846 return self.view.url(self.view.context, self.target)1847 1848 1566 class StudentClearanceEditFormPage(StudentClearanceManageFormPage): 1849 1567 """ View to edit student clearance data by student … … 1917 1635 self.redirect(self.url(self.context)) 1918 1636 return 1919 1920 class CourseRegistrationStartActionButton(ManageActionButton):1921 grok.order(1)1922 grok.context(IStudentStudyCourse)1923 grok.view(StudyCourseDisplayFormPage)1924 grok.require('waeup.handleStudent')1925 icon = 'actionicon_start.gif'1926 text = 'Start course registration'1927 target = 'start_course_registration'1928 1929 @property1930 def target_url(self):1931 if not self.context.getStudent().state in (CLEARED,RETURNING):1932 return ''1933 return self.view.url(self.view.context, self.target)1934 1637 1935 1638 class StartCourseRegistrationPage(SIRPPage): … … 1982 1685 return 1983 1686 1984 1985 class AddStudyLevelActionButton(AddActionButton):1986 grok.order(1)1987 grok.context(IStudentStudyCourse)1988 grok.view(StudyCourseDisplayFormPage)1989 grok.require('waeup.handleStudent')1990 text = 'Add course list'1991 target = 'add'1992 1993 @property1994 def target_url(self):1995 student = self.view.context.getStudent()1996 condition1 = student.state != 'school fee paid'1997 condition2 = str(student['studycourse'].current_level) in \1998 self.view.context.keys()1999 if condition1 or condition2:2000 return ''2001 return self.view.url(self.view.context, self.target)2002 2003 1687 class AddStudyLevelFormPage(SIRPEditFormPage): 2004 1688 """ Page for students to add current study levels … … 2037 1721 self.redirect(self.url(self.context)) 2038 1722 return 2039 2040 class StudyLevelEditActionButton(ManageActionButton):2041 grok.order(1)2042 grok.context(IStudentStudyLevel)2043 grok.view(StudyLevelDisplayFormPage)2044 grok.require('waeup.handleStudent')2045 text = 'Add and remove courses'2046 target = 'edit'2047 2048 @property2049 def target_url(self):2050 student = self.view.context.getStudent()2051 condition1 = student.state != 'school fee paid'2052 condition2 = student[2053 'studycourse'].current_level != self.view.context.level2054 if condition1 or condition2:2055 return ''2056 return self.view.url(self.view.context, self.target)2057 1723 2058 1724 class StudyLevelEditFormPage(SIRPEditFormPage): -
main/waeup.sirp/trunk/src/waeup/sirp/students/viewlets.py
r7491 r7591 24 24 from waeup.sirp.utils.helpers import string_from_bytes, file_size 25 25 from waeup.sirp.browser import DEFAULT_IMAGE_PATH 26 from waeup.sirp.browser.viewlets import PrimaryNavTab, PlainActionButton 26 from waeup.sirp.browser.viewlets import ( 27 PrimaryNavTab, ManageActionButton, AddActionButton) 27 28 from waeup.sirp.browser.layout import default_primary_nav_template 29 from waeup.sirp.students.workflow import (ADMITTED, PAID, 30 CLEARANCE, REQUESTED, RETURNING, CLEARED, REGISTERED, VALIDATED) 28 31 from waeup.sirp.students.browser import ( 29 StudentClearanceDisplayFormPage, StudentClearanceManageFormPage, 30 write_log_message, StudentBaseManageFormPage, StudentBaseDisplayFormPage, 31 StudentFilesUploadPage, ExportPDFClearanceSlipPage) 32 from waeup.sirp.students.interfaces import IStudent, IStudentClearance 32 StudentClearanceManageFormPage, 33 write_log_message, StudentBaseManageFormPage, 34 StudentFilesUploadPage, ExportPDFClearanceSlipPage, StudentsContainerPage, 35 StudentsContainerManagePage, StudentBaseDisplayFormPage, 36 StudentClearanceDisplayFormPage, StudentPersonalDisplayFormPage, 37 StudyCourseDisplayFormPage, StudyLevelDisplayFormPage, 38 CourseTicketDisplayFormPage, OnlinePaymentDisplayFormPage, 39 AccommodationManageFormPage, BedTicketDisplayFormPage,) 40 from waeup.sirp.students.interfaces import ( 41 IStudentsContainer, IStudent, IStudentClearance, 42 IStudentStudyCourse, IStudentAccommodation, IStudentStudyLevel, 43 ICourseTicket, IStudentOnlinePayment, IBedTicket, 44 ) 33 45 34 46 grok.context(ISIRPObject) # Make ISIRPObject the default context … … 110 122 link = 'history' 111 123 text = u'History' 124 125 126 class StudentsContainerManageActionButton(ManageActionButton): 127 grok.order(1) 128 grok.context(IStudentsContainer) 129 grok.view(StudentsContainerPage) 130 grok.require('waeup.manageStudent') 131 text = 'Manage student section' 132 133 class StudentsContainerAddActionButton(AddActionButton): 134 grok.order(1) 135 grok.context(IStudentsContainer) 136 grok.view(StudentsContainerManagePage) 137 grok.require('waeup.manageStudent') 138 text = 'Add student' 139 target = 'addstudent' 140 141 class ContactActionButton(ManageActionButton): 142 grok.order(4) 143 grok.context(IStudent) 144 grok.view(StudentBaseDisplayFormPage) 145 grok.require('waeup.manageStudent') 146 icon = 'actionicon_mail.png' 147 text = 'Send email' 148 target = 'contactstudent' 149 150 class StudentBaseManageActionButton(ManageActionButton): 151 grok.order(1) 152 grok.context(IStudent) 153 grok.view(StudentBaseDisplayFormPage) 154 grok.require('waeup.manageStudent') 155 text = 'Manage' 156 target = 'manage_base' 157 158 class StudentClearanceManageActionButton(ManageActionButton): 159 grok.order(1) 160 grok.context(IStudent) 161 grok.view(StudentClearanceDisplayFormPage) 162 grok.require('waeup.manageStudent') 163 text = 'Manage' 164 target = 'edit_clearance' 165 166 class StudentClearActionButton(ManageActionButton): 167 grok.order(2) 168 grok.context(IStudent) 169 grok.view(StudentClearanceDisplayFormPage) 170 grok.require('waeup.clearStudent') 171 text = 'Clear student' 172 target = 'clear' 173 icon = 'actionicon_accept.png' 174 175 @property 176 def target_url(self): 177 if self.context.state != REQUESTED: 178 return '' 179 return self.view.url(self.view.context, self.target) 180 181 class StudentRejectClearanceActionButton(ManageActionButton): 182 grok.order(3) 183 grok.context(IStudent) 184 grok.view(StudentClearanceDisplayFormPage) 185 grok.require('waeup.clearStudent') 186 text = 'Reject clearance' 187 target = 'reject_clearance' 188 icon = 'actionicon_reject.png' 189 190 @property 191 def target_url(self): 192 if self.context.state not in (REQUESTED, CLEARED): 193 return '' 194 return self.view.url(self.view.context, self.target) 195 196 class ClearanceSlipActionButton(ManageActionButton): 197 grok.order(4) 198 grok.context(IStudent) 199 grok.view(StudentClearanceDisplayFormPage) 200 grok.require('waeup.viewStudent') 201 icon = 'actionicon_pdf.png' 202 text = 'Download clearance slip' 203 target = 'clearance.pdf' 204 205 class StudentPersonalEditActionButton(ManageActionButton): 206 grok.order(1) 207 grok.context(IStudent) 208 grok.view(StudentPersonalDisplayFormPage) 209 grok.require('waeup.viewStudent') 210 text = 'Edit' 211 target = 'edit_personal' 212 213 class StudyCourseManageActionButton(ManageActionButton): 214 grok.order(1) 215 grok.context(IStudentStudyCourse) 216 grok.view(StudyCourseDisplayFormPage) 217 grok.require('waeup.manageStudent') 218 text = 'Manage' 219 target = 'manage' 220 221 class CourseRegistrationSlipActionButton(ManageActionButton): 222 grok.order(1) 223 grok.context(IStudentStudyLevel) 224 grok.view(StudyLevelDisplayFormPage) 225 grok.require('waeup.viewStudent') 226 icon = 'actionicon_pdf.png' 227 text = 'Download course registration slip' 228 target = 'course_registration.pdf' 229 230 class StudyLevelManageActionButton(ManageActionButton): 231 grok.order(2) 232 grok.context(IStudentStudyLevel) 233 grok.view(StudyLevelDisplayFormPage) 234 grok.require('waeup.manageStudent') 235 text = 'Manage' 236 target = 'manage' 237 238 class StudentValidateCoursesActionButton(ManageActionButton): 239 grok.order(3) 240 grok.context(IStudentStudyLevel) 241 grok.view(StudyLevelDisplayFormPage) 242 grok.require('waeup.validateStudent') 243 text = 'Validate courses' 244 target = 'validate_courses' 245 icon = 'actionicon_accept.png' 246 247 @property 248 def target_url(self): 249 if self.context.getStudent().state != REGISTERED or \ 250 str(self.context.__parent__.current_level) != self.context.__name__: 251 return '' 252 return self.view.url(self.view.context, self.target) 253 254 class StudentRejectCoursesActionButton(ManageActionButton): 255 grok.order(4) 256 grok.context(IStudentStudyLevel) 257 grok.view(StudyLevelDisplayFormPage) 258 grok.require('waeup.validateStudent') 259 text = 'Reject courses' 260 target = 'reject_courses' 261 icon = 'actionicon_reject.png' 262 263 @property 264 def target_url(self): 265 if self.context.getStudent().state not in (VALIDATED, REGISTERED) or \ 266 str(self.context.__parent__.current_level) != self.context.__name__: 267 return '' 268 return self.view.url(self.view.context, self.target) 269 270 class CourseTicketManageActionButton(ManageActionButton): 271 grok.order(1) 272 grok.context(ICourseTicket) 273 grok.view(CourseTicketDisplayFormPage) 274 grok.require('waeup.manageStudent') 275 text = 'Manage' 276 target = 'manage' 277 278 #class OnlinePaymentManageActionButton(ManageActionButton): 279 # grok.order(1) 280 # grok.context(IStudentPaymentsContainer) 281 # grok.view(PaymentsDisplayFormPage) 282 # grok.require('waeup.manageStudent') 283 # text = 'Manage payments' 284 # target = 'manage' 285 286 class PaymentReceiptActionButton(ManageActionButton): 287 grok.order(1) 288 grok.context(IStudentOnlinePayment) 289 grok.view(OnlinePaymentDisplayFormPage) 290 grok.require('waeup.viewStudent') 291 icon = 'actionicon_pdf.png' 292 text = 'Download payment receipt' 293 target = 'payment_receipt.pdf' 294 295 @property 296 def target_url(self): 297 if self.context.p_state != 'paid': 298 return '' 299 return self.view.url(self.view.context, self.target) 300 301 class RequestCallbackActionButton(ManageActionButton): 302 grok.order(2) 303 grok.context(IStudentOnlinePayment) 304 grok.view(OnlinePaymentDisplayFormPage) 305 grok.require('waeup.payStudent') 306 icon = 'actionicon_call.png' 307 text = 'Request callback' 308 target = 'callback' 309 310 @property 311 def target_url(self): 312 if self.context.p_state != 'unpaid': 313 return '' 314 return self.view.url(self.view.context, self.target) 315 316 class AddBedTicketActionButton(ManageActionButton): 317 grok.order(1) 318 grok.context(IStudentAccommodation) 319 grok.view(AccommodationManageFormPage) 320 grok.require('waeup.handleAccommodation') 321 icon = 'actionicon_home.png' 322 text = 'Book accommodation' 323 target = 'add' 324 325 class BedTicketSlipActionButton(ManageActionButton): 326 grok.order(1) 327 grok.context(IBedTicket) 328 grok.view(BedTicketDisplayFormPage) 329 grok.require('waeup.handleAccommodation') 330 icon = 'actionicon_pdf.png' 331 text = 'Download bed allocation slip' 332 target = 'bed_allocation.pdf' 333 334 class RelocateStudentActionButton(ManageActionButton): 335 grok.order(2) 336 grok.context(IBedTicket) 337 grok.view(BedTicketDisplayFormPage) 338 grok.require('waeup.manageHostels') 339 icon = 'actionicon_reload.png' 340 text = 'Relocate student' 341 target = 'relocate' 342 343 class StudentBaseActionButton(ManageActionButton): 344 grok.order(1) 345 grok.context(IStudent) 346 grok.view(StudentBaseDisplayFormPage) 347 grok.require('waeup.handleStudent') 348 text = 'Edit base data' 349 target = 'edit_base' 350 351 class StudentPasswordActionButton(ManageActionButton): 352 grok.order(2) 353 grok.context(IStudent) 354 grok.view(StudentBaseDisplayFormPage) 355 grok.require('waeup.handleStudent') 356 icon = 'actionicon_key.png' 357 text = 'Change password' 358 target = 'change_password' 359 360 class StudentPassportActionButton(ManageActionButton): 361 grok.order(3) 362 grok.context(IStudent) 363 grok.view(StudentBaseDisplayFormPage) 364 grok.require('waeup.handleStudent') 365 icon = 'actionicon_portrait.png' 366 text = 'Change portrait' 367 target = 'change_portrait' 368 369 @property 370 def target_url(self): 371 if self.context.state != 'admitted': 372 return '' 373 return self.view.url(self.view.context, self.target) 374 375 class StudentClearanceStartActionButton(ManageActionButton): 376 grok.order(1) 377 grok.context(IStudent) 378 grok.view(StudentClearanceDisplayFormPage) 379 grok.require('waeup.handleStudent') 380 icon = 'actionicon_start.gif' 381 text = 'Start clearance' 382 target = 'start_clearance' 383 384 @property 385 def target_url(self): 386 if self.context.state != 'admitted': 387 return '' 388 return self.view.url(self.view.context, self.target) 389 390 class StudentClearanceEditActionButton(ManageActionButton): 391 grok.order(1) 392 grok.context(IStudent) 393 grok.view(StudentClearanceDisplayFormPage) 394 grok.require('waeup.handleStudent') 395 text = 'Edit' 396 target = 'cedit' 397 398 @property 399 def target_url(self): 400 if self.context.clearance_locked: 401 return '' 402 return self.view.url(self.view.context, self.target) 403 404 class CourseRegistrationStartActionButton(ManageActionButton): 405 grok.order(1) 406 grok.context(IStudentStudyCourse) 407 grok.view(StudyCourseDisplayFormPage) 408 grok.require('waeup.handleStudent') 409 icon = 'actionicon_start.gif' 410 text = 'Start course registration' 411 target = 'start_course_registration' 412 413 @property 414 def target_url(self): 415 if not self.context.getStudent().state in (CLEARED,RETURNING): 416 return '' 417 return self.view.url(self.view.context, self.target) 418 419 class AddStudyLevelActionButton(AddActionButton): 420 grok.order(1) 421 grok.context(IStudentStudyCourse) 422 grok.view(StudyCourseDisplayFormPage) 423 grok.require('waeup.handleStudent') 424 text = 'Add course list' 425 target = 'add' 426 427 @property 428 def target_url(self): 429 student = self.view.context.getStudent() 430 condition1 = student.state != 'school fee paid' 431 condition2 = str(student['studycourse'].current_level) in \ 432 self.view.context.keys() 433 if condition1 or condition2: 434 return '' 435 return self.view.url(self.view.context, self.target) 436 437 class StudyLevelEditActionButton(ManageActionButton): 438 grok.order(1) 439 grok.context(IStudentStudyLevel) 440 grok.view(StudyLevelDisplayFormPage) 441 grok.require('waeup.handleStudent') 442 text = 'Add and remove courses' 443 target = 'edit' 444 445 @property 446 def target_url(self): 447 student = self.view.context.getStudent() 448 condition1 = student.state != 'school fee paid' 449 condition2 = student[ 450 'studycourse'].current_level != self.view.context.level 451 if condition1 or condition2: 452 return '' 453 return self.view.url(self.view.context, self.target) 112 454 113 455 class StudentsTab(PrimaryNavTab):
Note: See TracChangeset for help on using the changeset viewer.