- Timestamp:
- 20 Sep 2012, 08:49:37 (12 years ago)
- Location:
- main/waeup.kofa/branches/uli-zc-async
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/uli-zc-async
- Property svn:mergeinfo changed
-
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/students/viewlets.py
r8736 r9209 1 ## $Id$1 3## $Id$ 2 2 ## 3 3 ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann … … 150 150 151 151 class ContactActionButton(ManageActionButton): 152 grok.order( 4)152 grok.order(5) 153 153 grok.context(IStudent) 154 154 grok.view(StudentBaseDisplayFormPage) … … 165 165 text = _('Manage') 166 166 target = 'manage_base' 167 168 class AdmissionSlipActionButton(ManageActionButton): 169 grok.order(4) 170 grok.context(IStudent) 171 grok.view(StudentBaseDisplayFormPage) 172 grok.require('waeup.viewStudent') 173 icon = 'actionicon_pdf.png' 174 text = _('Download admission letter') 175 target = 'admission_slip.pdf' 176 177 class StudentTransfernButton(ManageActionButton): 178 grok.order(6) 179 grok.context(IStudent) 180 grok.view(StudentBaseDisplayFormPage) 181 grok.require('waeup.manageStudent') 182 text = _('Transfer student') 183 target = 'transfer' 184 icon = 'actionicon_redo.png' 185 186 class StudentDeactivateActionButton(ManageActionButton): 187 grok.order(7) 188 grok.context(IStudent) 189 grok.view(StudentBaseDisplayFormPage) 190 grok.require('waeup.manageStudent') 191 text = _('Deactivate account') 192 target = 'deactivate' 193 icon = 'actionicon_traffic_lights_red.png' 194 195 @property 196 def target_url(self): 197 if self.context.suspended: 198 return '' 199 return self.view.url(self.view.context, self.target) 200 201 @property 202 def onclick(self): 203 return "return window.confirm(%s);" % _( 204 "'A history message will be added. Are you sure?'") 205 206 class StudentActivateActionButton(ManageActionButton): 207 grok.order(7) 208 grok.context(IStudent) 209 grok.view(StudentBaseDisplayFormPage) 210 grok.require('waeup.manageStudent') 211 text = _('Activate account') 212 target = 'activate' 213 icon = 'actionicon_traffic_lights_green.png' 214 215 @property 216 def target_url(self): 217 if not self.context.suspended: 218 return '' 219 return self.view.url(self.view.context, self.target) 220 221 @property 222 def onclick(self): 223 return "return window.confirm(%s);" % _( 224 "'A history message will be added. Are you sure?'") 167 225 168 226 class StudentClearanceManageActionButton(ManageActionButton): … … 231 289 target = 'view_personal' 232 290 291 class StudentPersonalManageActionButton(ManageActionButton): 292 grok.order(1) 293 grok.context(IStudent) 294 grok.view(StudentPersonalDisplayFormPage) 295 grok.require('waeup.manageStudent') 296 text = _('Manage') 297 target = 'manage_personal' 298 233 299 class StudentPersonalEditActionButton(ManageActionButton): 234 grok.order( 1)300 grok.order(2) 235 301 grok.context(IStudent) 236 302 grok.view(StudentPersonalDisplayFormPage) 237 grok.require('waeup. viewStudent')303 grok.require('waeup.handleStudent') 238 304 text = _('Edit') 239 305 target = 'edit_personal' … … 247 313 target = 'manage' 248 314 315 @property 316 def target_url(self): 317 if self.context.is_current: 318 return self.view.url(self.view.context, self.target) 319 return False 320 249 321 class StudyLevelManageActionButton(ManageActionButton): 250 322 grok.order(1) … … 254 326 text = _('Manage') 255 327 target = 'manage' 328 329 @property 330 def target_url(self): 331 is_current = self.context.__parent__.is_current 332 if not is_current: 333 return '' 334 return self.view.url(self.view.context, self.target) 256 335 257 336 class StudentValidateCoursesActionButton(ManageActionButton): … … 266 345 @property 267 346 def target_url(self): 347 is_current = self.context.__parent__.is_current 268 348 if self.context.student.state != REGISTERED or \ 269 str(self.context.__parent__.current_level) != self.context.__name__: 349 str(self.context.__parent__.current_level) != self.context.__name__ or\ 350 not is_current: 270 351 return '' 271 352 return self.view.url(self.view.context, self.target) … … 282 363 @property 283 364 def target_url(self): 365 is_current = self.context.__parent__.is_current 284 366 if self.context.student.state not in (VALIDATED, REGISTERED) or \ 285 str(self.context.__parent__.current_level) != self.context.__name__: 367 str(self.context.__parent__.current_level) != self.context.__name__ or\ 368 not is_current: 286 369 return '' 287 370 return self.view.url(self.view.context, self.target) … … 296 379 target = 'course_registration.pdf' 297 380 381 @property 382 def target_url(self): 383 is_current = self.context.__parent__.is_current 384 if not is_current: 385 return '' 386 return self.view.url(self.view.context, self.target) 387 298 388 class CourseTicketManageActionButton(ManageActionButton): 299 389 grok.order(1) … … 313 403 314 404 class PaymentReceiptActionButton(ManageActionButton): 315 grok.order( 1)405 grok.order(9) # This button should always be the last one. 316 406 grok.context(IStudentOnlinePayment) 317 407 grok.view(OnlinePaymentDisplayFormPage) … … 327 417 return self.view.url(self.view.context, self.target) 328 418 329 330 419 class ApprovePaymentActionButton(ManageActionButton): 331 grok.order( 2)420 grok.order(8) 332 421 grok.context(IStudentOnlinePayment) 333 422 grok.view(OnlinePaymentDisplayFormPage) … … 437 526 grok.require('waeup.handleStudent') 438 527 icon = 'actionicon_start.gif' 439 text = _('Start session')528 text = _('Start new session') 440 529 target = 'start_session' 441 530 442 531 @property 443 532 def target_url(self): 444 if self.context.next_session_allowed :533 if self.context.next_session_allowed and self.context.is_current: 445 534 return self.view.url(self.view.context, self.target) 446 535 return False … … 460 549 condition2 = str(student['studycourse'].current_level) in \ 461 550 self.view.context.keys() 462 if condition1 or condition2: 551 condition3 = not self.context.is_current 552 if condition1 or condition2 or condition3: 463 553 return '' 464 554 return self.view.url(self.view.context, self.target) … … 469 559 grok.view(StudyLevelDisplayFormPage) 470 560 grok.require('waeup.handleStudent') 471 text = _(' Add and remove courses')561 text = _('Edit course list') 472 562 target = 'edit' 473 563 … … 478 568 condition2 = student[ 479 569 'studycourse'].current_level != self.view.context.level 480 if condition1 or condition2: 570 is_current = self.context.__parent__.is_current 571 if condition1 or condition2 or not is_current: 481 572 return '' 482 573 return self.view.url(self.view.context, self.target) … … 542 633 @property 543 634 def targets(self): 544 student _url = self.view.application_url() + (545 '/students/%s' % self.request.principal.id)546 #app_slip = getUtility(IExtFileStore).getFileByContext(547 # self.context.student, 'application_slip')635 student = grok.getSite()['students'][self.request.principal.id] 636 student_url = self.view.url(student) 637 app_slip = getUtility(IExtFileStore).getFileByContext( 638 student, 'application_slip') 548 639 targets = [] 549 #if app_slip:550 #targets = [{'url':student_url + '/application_slip', 'title':'Application Slip'},]640 if app_slip: 641 targets = [{'url':student_url + '/application_slip', 'title':'Application Slip'},] 551 642 targets += [ 552 643 {'url':student_url, 'title':'Base Data'},
Note: See TracChangeset for help on using the changeset viewer.