- Timestamp:
- 10 Sep 2012, 11:05:07 (12 years ago)
- Location:
- main/waeup.kofa/branches/uli-async-update
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/uli-async-update
- Property svn:mergeinfo changed
-
main/waeup.kofa/branches/uli-async-update/src/waeup/kofa/students/viewlets.py
r8736 r9169 1 ## $Id$1 3## $Id$ 2 2 ## 3 3 ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann … … 166 166 target = 'manage_base' 167 167 168 class StudentTransfernButton(ManageActionButton): 169 grok.order(5) 170 grok.context(IStudent) 171 grok.view(StudentBaseDisplayFormPage) 172 grok.require('waeup.manageStudent') 173 text = _('Transfer student') 174 target = 'transfer' 175 icon = 'actionicon_redo.png' 176 177 class StudentDeactivateActionButton(ManageActionButton): 178 grok.order(6) 179 grok.context(IStudent) 180 grok.view(StudentBaseDisplayFormPage) 181 grok.require('waeup.manageStudent') 182 text = _('Deactivate account') 183 target = 'deactivate' 184 icon = 'actionicon_traffic_lights_red.png' 185 186 @property 187 def target_url(self): 188 if self.context.suspended: 189 return '' 190 return self.view.url(self.view.context, self.target) 191 192 @property 193 def onclick(self): 194 return "return window.confirm(%s);" % _( 195 "'A history message will be added. Are you sure?'") 196 197 class StudentActivateActionButton(ManageActionButton): 198 grok.order(6) 199 grok.context(IStudent) 200 grok.view(StudentBaseDisplayFormPage) 201 grok.require('waeup.manageStudent') 202 text = _('Activate account') 203 target = 'activate' 204 icon = 'actionicon_traffic_lights_green.png' 205 206 @property 207 def target_url(self): 208 if not self.context.suspended: 209 return '' 210 return self.view.url(self.view.context, self.target) 211 212 @property 213 def onclick(self): 214 return "return window.confirm(%s);" % _( 215 "'A history message will be added. Are you sure?'") 216 168 217 class StudentClearanceManageActionButton(ManageActionButton): 169 218 grok.order(1) … … 231 280 target = 'view_personal' 232 281 282 class StudentPersonalManageActionButton(ManageActionButton): 283 grok.order(1) 284 grok.context(IStudent) 285 grok.view(StudentPersonalDisplayFormPage) 286 grok.require('waeup.manageStudent') 287 text = _('Manage') 288 target = 'manage_personal' 289 233 290 class StudentPersonalEditActionButton(ManageActionButton): 234 grok.order( 1)291 grok.order(2) 235 292 grok.context(IStudent) 236 293 grok.view(StudentPersonalDisplayFormPage) 237 grok.require('waeup. viewStudent')294 grok.require('waeup.handleStudent') 238 295 text = _('Edit') 239 296 target = 'edit_personal' … … 247 304 target = 'manage' 248 305 306 @property 307 def target_url(self): 308 if self.context.is_current: 309 return self.view.url(self.view.context, self.target) 310 return False 311 249 312 class StudyLevelManageActionButton(ManageActionButton): 250 313 grok.order(1) … … 254 317 text = _('Manage') 255 318 target = 'manage' 319 320 @property 321 def target_url(self): 322 is_current = self.context.__parent__.is_current 323 if not is_current: 324 return '' 325 return self.view.url(self.view.context, self.target) 256 326 257 327 class StudentValidateCoursesActionButton(ManageActionButton): … … 266 336 @property 267 337 def target_url(self): 338 is_current = self.context.__parent__.is_current 268 339 if self.context.student.state != REGISTERED or \ 269 str(self.context.__parent__.current_level) != self.context.__name__: 340 str(self.context.__parent__.current_level) != self.context.__name__ or\ 341 not is_current: 270 342 return '' 271 343 return self.view.url(self.view.context, self.target) … … 282 354 @property 283 355 def target_url(self): 356 is_current = self.context.__parent__.is_current 284 357 if self.context.student.state not in (VALIDATED, REGISTERED) or \ 285 str(self.context.__parent__.current_level) != self.context.__name__: 358 str(self.context.__parent__.current_level) != self.context.__name__ or\ 359 not is_current: 286 360 return '' 287 361 return self.view.url(self.view.context, self.target) … … 296 370 target = 'course_registration.pdf' 297 371 372 @property 373 def target_url(self): 374 is_current = self.context.__parent__.is_current 375 if not is_current: 376 return '' 377 return self.view.url(self.view.context, self.target) 378 298 379 class CourseTicketManageActionButton(ManageActionButton): 299 380 grok.order(1) … … 313 394 314 395 class PaymentReceiptActionButton(ManageActionButton): 315 grok.order( 1)396 grok.order(9) # This button should always be the last one. 316 397 grok.context(IStudentOnlinePayment) 317 398 grok.view(OnlinePaymentDisplayFormPage) … … 327 408 return self.view.url(self.view.context, self.target) 328 409 329 330 410 class ApprovePaymentActionButton(ManageActionButton): 331 grok.order( 2)411 grok.order(8) 332 412 grok.context(IStudentOnlinePayment) 333 413 grok.view(OnlinePaymentDisplayFormPage) … … 437 517 grok.require('waeup.handleStudent') 438 518 icon = 'actionicon_start.gif' 439 text = _('Start session')519 text = _('Start new session') 440 520 target = 'start_session' 441 521 442 522 @property 443 523 def target_url(self): 444 if self.context.next_session_allowed :524 if self.context.next_session_allowed and self.context.is_current: 445 525 return self.view.url(self.view.context, self.target) 446 526 return False … … 460 540 condition2 = str(student['studycourse'].current_level) in \ 461 541 self.view.context.keys() 462 if condition1 or condition2: 542 condition3 = not self.context.is_current 543 if condition1 or condition2 or condition3: 463 544 return '' 464 545 return self.view.url(self.view.context, self.target) … … 469 550 grok.view(StudyLevelDisplayFormPage) 470 551 grok.require('waeup.handleStudent') 471 text = _(' Add and remove courses')552 text = _('Edit course list') 472 553 target = 'edit' 473 554 … … 478 559 condition2 = student[ 479 560 'studycourse'].current_level != self.view.context.level 480 if condition1 or condition2: 561 is_current = self.context.__parent__.is_current 562 if condition1 or condition2 or not is_current: 481 563 return '' 482 564 return self.view.url(self.view.context, self.target)
Note: See TracChangeset for help on using the changeset viewer.