Changeset 152
- Timestamp:
- 4 Nov 2005, 17:07:18 (19 years ago)
- Location:
- waeup_product/trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup_product/trunk/Accommodation.py
r146 r152 33 33 security = ClassSecurityInfo() 34 34 35 35 36 InitializeClass(AccoFolder) 36 37 … … 63 64 security = ClassSecurityInfo() 64 65 65 ## security.declareProtected(View,"Title") 66 ## def Title(self): 67 ## """ the Title """ 68 ## return self.heading 69 66 security.declareProtected(View,"Title") 67 def Title(self): 68 """compose title""" 69 content = self.getContent() 70 heading = getattr(content,'heading',None) 71 if heading is None: 72 return self.title 73 return heading 70 74 71 75 InitializeClass(Accommodation) -
waeup_product/trunk/Extensions/install.py
r143 r152 110 110 waeup_ptypes = "'University','StudentsFolder','Student','Jamb','Faculty','Department','Course'" 111 111 waeup_ptypes += ",'AccoFolder','Accommodation','StudentPersonal','AcademicsFolder'" 112 waeup_ptypes += ",'StudyLevel','Semester','CourseTicket'" 112 113 if CPSSubscriptions: ###( 113 114 … … 349 350 350 351 351 def installCustomWorkflows(self): 352 def verifyPortlets(self, portlets=(), object=None): ###( 353 """Verify the existence of given portet in the object's portlet 354 container. If not found, a portlet is instantiated. 355 Existing portlets are not affected. 356 357 'portlets' is a tuple with the dictionaries given by the export tab 358 as entries. 359 The default object is the portal itself. 360 361 return the list a new portlet ids. 362 """ 363 364 if object is None: 365 object = self.portal 366 367 self.log('Verifying portlets on %s' % object.absolute_url(relative=1)) 368 369 portlet_container = self.getPortletContainer(object, create=1) 370 371 ttool = self.getTool('portal_types') 372 373 returned = [] 374 for new_portlet in portlets: 375 existing_portlets = portlet_container.listPortlets() 376 updated = 0 377 378 # Check if the portlet needs an update 379 identifier = new_portlet.get('identifier') 380 if identifier: 381 for portlet in existing_portlets: 382 if identifier == portlet.identifier: 383 self.log(" Update of portlet: %s" % portlet) 384 portlet.edit(**new_portlet) 385 portlet_id = portlet.getId() 386 updated = 1 387 continue 388 slot = new_portlet.get('slot') 389 if slot: 390 for portlet in existing_portlets: 391 if slot == portlet.slot: 392 self.log(" Update of portlet: %s" % portlet) 393 portlet.edit(**new_portlet) 394 portlet_id = portlet.getId() 395 updated = 1 396 continue 397 398 if not updated: 399 self.log(" Creation of portlet: %s" % new_portlet) 400 portlet_id = self.portal.portal_cpsportlets.createPortlet( 401 ptype_id=new_portlet['type'], 402 context=object, 403 **new_portlet) 404 if portlet_id not in returned: 405 returned.append(portlet_id) 406 return returned 407 408 ###) 409 410 def installCustomWorkflows(self): ###( 352 411 """Installs custom workflows 353 412 """ … … 357 416 waeupWorkflowsInstall(self.context) 358 417 359 360 def verifyWorkflowAssociation(self): 418 ###) 419 420 def verifyWorkflowAssociation(self): ###( 361 421 """Verify workflow association 362 422 """ … … 368 428 se_chains = { 'University': 'waeup_section_wf', 369 429 'AcademicsFolder': 'waeup_section_wf', 370 'StudentsFolder': 'waeup_s ection_wf',371 'Student': 'waeup_s ection_wf',372 'StudentPersonal': 'waeup_s ection_wf',430 'StudentsFolder': 'waeup_student_wf', 431 'Student': 'waeup_student_wf', 432 'StudentPersonal': 'waeup_student_wf', 373 433 'Jamb': 'waeup_section_wf', 374 434 'ScratchCard': 'waeup_section_wf', … … 376 436 'Department': 'waeup_section_wf', 377 437 'Course': 'waeup_section_wf', 438 'StudyLevel': 'waeup_student_wf', 439 'Semester': 'waeup_student_wf', 440 'CourseTicket': 'waeup_student_wf', 378 441 'AccoFolder': 'waeup_section_wf', 379 442 'Accommodation': 'waeup_section_wf', … … 387 450 destructive=1) 388 451 389 390 def install(self): 452 ###) 453 454 455 def install(self): ###( 391 456 installer = WAeUPInstaller(self) 392 457 installer.install(self) … … 447 512 ## 'Title': 'main tabs', 448 513 ## }, 449 { 'identifier': 'waeup_breadcrumbs',514 {#'identifier': 'waeup_breadcrumbs', 450 515 'type': 'Breadcrumbs Portlet', 451 516 'slot': 'waeup_breadcrumbs', 452 'first_item': 2,517 'first_item': 0, 453 518 'display_site_root': 0, 454 519 'Title': 'waeup_breadcrumbs', … … 457 522 'order': 0, 458 523 }, 459 { 'identifier': 'waeup_main_tab_actions',524 {#'identifier': 'waeup_main_tab_actions', 460 525 'type': 'Actions Portlet', 461 526 'slot': 'main_tabs', … … 464 529 'Title': 'waep_main_tab_actions', 465 530 }, 466 { 'identifier': 'waeup_object_actions',531 {#'identifier': 'waeup_object_actions', 467 532 'type': 'Actions Portlet', 468 533 'slot': 'waeup_object_actions', … … 471 536 'Title': 'waep_manager_actions', 472 537 }, 473 { 'identifier': 'waeup_left_top',538 {#'identifier': 'waeup_left_top', 474 539 'type': 'Custom Portlet', 475 540 'slot': 'left_top', … … 483 548 484 549 ###) 485 486 550 return installer.logResult() 487 488 def migrate(self): 551 ###) 552 553 def migrate(self): ###( 489 554 "update data" 490 555 log = [] … … 519 584 return '\n'.join(log) 520 585 586 ###) 587 -
waeup_product/trunk/Faculty.py
r139 r152 141 141 portal_type = meta_type 142 142 security = ClassSecurityInfo() 143 144 security.declareProtected(View,"Title") 145 def Title(self): 146 """compose title""" 147 content = self.getContent() 148 heading = getattr(content,'heading',None) 149 if heading is None: 150 return self.title 151 return heading 143 152 144 153 InitializeClass(Course) -
waeup_product/trunk/Students.py
r146 r152 10 10 from Products.CPSDocument.CPSDocument import CPSDocument 11 11 from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder 12 13 12 class StudentsFolder(BaseBTreeFolder): ###( 14 13 """ … … 51 50 security = ClassSecurityInfo() 52 51 53 ## security.declareProtected(View,"Title") 54 ## def Title(self): 55 ## """compose title""" 56 ## content = self.PERSONAL.getContent() 57 ## return "%s %s" % (content.firstname,content.lastname) 52 security.declareProtected(View,"Title") 53 def Title(self): 54 """compose title""" 55 56 data = getattr(self,'PERSONAL',None) 57 if data is None: 58 data = getattr(self,'JAMB',None) 59 if data: 60 content = data.getContent() 61 return "%s %s" % (content.firstname,content.lastname) 62 return self.title 63 64 security.declareProtected(View,"setOwnership") 65 def setOwnership(self,member_id): 66 """set ownership""" 67 pm = getattr(self,'portal_membership') 68 member = pm.getMemberById(member_id) 69 self.changeOwnership(member) 58 70 59 71 InitializeClass(Student) … … 88 100 portal_type = meta_type 89 101 security = ClassSecurityInfo() 102 103 security.declareProtected(View,"Title") 104 def Title(self): 105 """compose title""" 106 content = self.getContent() 107 return "Personal Data for %s %s" % (content.firstname,content.lastname) 108 90 109 91 110 InitializeClass(StudentPersonal) … … 120 139 security = ClassSecurityInfo() 121 140 141 security.declareProtected(View,"Title") 142 def Title(self): 143 """compose title""" 144 content = self.getContent() 145 return "JAMB Data for %s %s" % (content.firstname,content.lastname) 146 147 security.declareProtected(View,"setOwnership") 148 def setOwnership(self,member_id): 149 """set ownership""" 150 pm = getattr(self,'portal_membership') 151 member = pm.getMemberById(member_id) 152 self.changeOwnership(member) 153 122 154 InitializeClass(Jamb) 123 155 -
waeup_product/trunk/WAeUPPermissions.py
r84 r152 38 38 StudentManage = "Student Manage" 39 39 setDefaultRoles(StudentManage, ('Manager', 40 'UniversityManager', 41 'StudentManager', 40 42 'FacultyManager', 41 43 'Owner',)) … … 45 47 FacultyManage = "Faculty Manage" 46 48 setDefaultRoles(FacultyManage, ('Manager', 49 'UniversityManager', 47 50 'FacultyManager', 48 'Owner',))51 )) 49 52 # - 'Department Manage' : Permission you need to manage a Department 50 53 # … … 52 55 DepartmentManage = "Department Manage" 53 56 setDefaultRoles(DepartmentManage, ('Manager', 57 'UniversityManager', 54 58 'FacultyManager', 55 'Department ',56 'Owner',))59 'DepartmentManager', 60 )) 57 61 # - 'Course Manage' : Permission you need to manage a Department 58 62 # … … 60 64 CourseManage = "Course Manage" 61 65 setDefaultRoles(CourseManage, ('Manager', 62 'FacultyManager', 63 'DepartmentManager', 64 'CourseManager', 65 'Owner',)) 66 'UniversityManager', 67 'FacultyManager', 68 'DepartmentManager', 69 'CourseManager', 70 )) 66 71 -
waeup_product/trunk/Workflows/WAeUPWorkflow.py
r114 r152 1 #-*- mode: python; mode: fold -*- 1 2 """ WAeUP Workflfow 2 3 """ … … 29 30 30 31 wfids = wftool.objectIds() 31 wfid = 'waeup_section_wf' 32 wfid = 'waeup_section_wf' ###( 32 33 33 34 if wfid in wfids: … … 41 42 for p in (View, 42 43 ModifyPortalContent, 43 44 44 ): 45 45 wf.addManagedPermission(p) … … 63 63 s = wf.states.get('work') 64 64 65 s.setPermission(View, 1, ('Student s',))65 s.setPermission(View, 1, ('Student',)) 66 66 s.setPermission(ModifyPortalContent, 1, ('StudentManager','UniversityManager',)) 67 67 … … 74 74 75 75 ########################################################################## 76 # CLOSED 76 # CLOSED ###( 77 77 ########################################################################## 78 78 … … 92 92 ########################################################################### 93 93 ########################################################################### 94 ###) 94 95 95 96 # TRANSITIONS … … 117 118 actbox_name='', actbox_category='workflow', actbox_url='', 118 119 props={'guard_permissions':'', 119 'guard_roles':'Manager; StudentManager 120 'guard_roles':'Manager; StudentManager; UniversityManager', 120 121 'guard_expr':''},) 121 122 … … 158 159 159 160 ########################################################################## 160 # CLOSE 161 # CLOSE ###( 161 162 ########################################################################## 162 163 … … 191 192 ## 'guard_expr':''},) 192 193 194 ###) 195 193 196 ################################################################ 194 197 # VARIABLES … … 243 246 ###################################################################################### 244 247 ###################################################################################### 245 wfid = 'waeup_workspace_wf' 248 ###) 249 250 wfid = 'waeup_student_wf' ###( 251 252 if wfid in wfids: 253 wftool.manage_delObjects([wfid]) 254 255 wftool.manage_addWorkflow(id=wfid, 256 workflow_type='cps_workflow (Web-configurable workflow for CPS)') 257 258 wf = wftool[wfid] 259 260 for p in (View, 261 ModifyPortalContent, 262 ): 263 wf.addManagedPermission(p) 264 265 ########################################################################### 266 ########################################################################### 267 268 # STATES 269 270 ########################################################################### 271 ########################################################################### 272 273 for s in ('work', 274 ): 275 wf.states.addState(s) 276 277 ########################################################################## 278 # WORK 279 ########################################################################## 280 281 s = wf.states.get('work') 282 283 s.setPermission(View, 1, ('Student',)) 284 s.setPermission(ModifyPortalContent, 1, ('StudentManager','UniversityManager','Student')) 285 286 s.setInitialState('work') 287 s.setProperties(title='Work', 288 description='', 289 transitions=('create_content', 290 'cut_copy_paste', 291 'close',),) 292 293 ########################################################################## 294 # CLOSED ###( 295 ########################################################################## 296 297 ## s = wf.states.get('closed') 298 ## 299 ## s.setPermission(View, 1, ('ChatPoster',)) 300 ## s.setPermission(ModifyPortalContent, 1, ('ChatModerator',)) 301 ## s.setPermission(chatReply, 1, ('ChatModerator',)) 302 ## s.setPermission(chatPost, 1, ('ChatModerator',)) 303 ## s.setPermission(chatModerate, 1, ('ChatModerator',)) 304 305 ## s.setProperties(title='Closed', 306 ## description='', 307 ## transitions=('unclose', 308 ## 'cut_copy_paste',),) 309 ## 310 ########################################################################### 311 ########################################################################### 312 ###) 313 314 315 # TRANSITIONS 316 317 ########################################################################### 318 ########################################################################### 319 320 for t in ('create', 321 'create_content', 322 'cut_copy_paste', 323 ): 324 wf.transitions.addTransition(t) 325 326 327 ########################################################################### 328 # CREATE 329 ########################################################################### 330 331 t = wf.transitions.get('create') 332 t.setProperties(title='Initial creation', 333 description='Intial transition like', 334 new_state_id='work', 335 transition_behavior=(TRANSITION_INITIAL_CREATE, ), 336 clone_allowed_transitions=None, 337 actbox_name='', actbox_category='workflow', actbox_url='', 338 props={'guard_permissions':'', 339 'guard_roles':'Manager; StudentManager; UniversityManager; Student', 340 'guard_expr':''},) 341 342 ########################################################################### 343 # CREATE CONTENT 344 ########################################################################### 345 346 t = wf.transitions.get('create_content') 347 t.setProperties(title='Create content', 348 description='Allow sub Object Create', 349 new_state_id='work', 350 transition_behavior=(TRANSITION_ALLOWSUB_CREATE, 351 TRANSITION_ALLOWSUB_CHECKOUT,), 352 trigger_type=TRIGGER_USER_ACTION, 353 actbox_name='New', 354 actbox_category='', 355 actbox_url='', 356 props={'guard_permissions':'', 357 'guard_roles':'Manager; StudentManager ; UniversityManager; Student', 358 'guard_expr':''},) 359 360 ########################################################################## 361 # CUT/COPY/PASTE 362 ########################################################################## 363 364 t = wf.transitions.get('cut_copy_paste') 365 t.setProperties(title='Cut/Copy/Paste', 366 new_state_id='work', 367 transition_behavior=(TRANSITION_ALLOWSUB_DELETE, 368 TRANSITION_ALLOWSUB_MOVE, 369 TRANSITION_ALLOWSUB_COPY), 370 clone_allowed_transitions=None, 371 trigger_type=TRIGGER_USER_ACTION, 372 actbox_name='New', 373 actbox_category='', 374 actbox_url='', 375 props={'guard_permissions':'', 376 'guard_roles':'Manager; StudentManager ; UniversityManager', 377 'guard_expr':''},) 378 379 ########################################################################## 380 # CLOSE ###( 381 ########################################################################## 382 383 ## t = wf.transitions.get('close') 384 ## t.setProperties(title='close', 385 ## new_state_id='closed', 386 ## transition_behavior=(), 387 ## clone_allowed_transitions=None, 388 ## trigger_type=TRIGGER_USER_ACTION, 389 ## actbox_name='label_chat_close', 390 ## actbox_category='workflow', 391 ## actbox_url='%(content_url)s/cps_chat_close', 392 ## props={'guard_permissions':'', 393 ## 'guard_roles':'Manager; SectionManager; SectionReviewer', 394 ## 'guard_expr':''},) 395 ## 396 ## ########################################################################## 397 ## # UNCLOSE 398 ## ########################################################################## 399 ## 400 ## t = wf.transitions.get('unclose') 401 ## t.setProperties(title='unclose', 402 ## new_state_id='work', 403 ## transition_behavior=(), 404 ## clone_allowed_transitions=None, 405 ## trigger_type=TRIGGER_USER_ACTION, 406 ## actbox_name='label_chat_unclose', 407 ## actbox_category='workflow', 408 ## actbox_url='%(content_url)s/cps_chat_unclose', 409 ## props={'guard_permissions':'', 410 ## 'guard_roles':'Manager; SectionManager; SectionReviewer', 411 ## 'guard_expr':''},) 412 413 ###) 414 415 ################################################################ 416 # VARIABLES 417 ################################################################ 418 419 for v in ('action', 420 'actor', 421 'comments', 422 'review_history', 423 'time', 424 'dest_container', 425 ): 426 wf.variables.addVariable(v) 427 428 429 wf.variables.setStateVar('review_state') 430 431 vdef = wf.variables['action'] 432 vdef.setProperties(description='The last transition', 433 default_expr='transition/getId|nothing', 434 for_status=1, update_always=1) 435 436 vdef = wf.variables['actor'] 437 vdef.setProperties(description='The ID of the user who performed ' 438 'the last transition', 439 default_expr='user/getId', 440 for_status=1, update_always=1) 441 442 vdef = wf.variables['comments'] 443 vdef.setProperties(description='Comments about the last transition', 444 default_expr="python:state_change.kwargs.get('comment', '')", 445 for_status=1, update_always=1) 446 447 vdef = wf.variables['review_history'] 448 vdef.setProperties(description='Provides access to workflow history', 449 default_expr="state_change/getHistory", 450 props={'guard_permissions':'', 451 'guard_roles':'Manager; WorkspaceManager; WorkspaceMember; WorkspaceReader; Member', 452 'guard_expr':''}) 453 454 vdef = wf.variables['time'] 455 vdef.setProperties(description='Time of the last transition', 456 default_expr="state_change/getDateTime", 457 for_status=1, update_always=1) 458 459 vdef = wf.variables['dest_container'] 460 vdef.setProperties(description='Destination container for the last paste/publish', 461 default_expr="python:state_change.kwargs.get('dest_container', '')", 462 for_status=1, update_always=1) 463 464 465 ###################################################################################### 466 ###################################################################################### 467 ###) 468 469 wfid = 'waeup_workspace_wf' ###( 246 470 247 471 if wfid in wfids: … … 457 681 default_expr="python:state_change.kwargs.get('dest_container', '')", 458 682 for_status=1, update_always=1) 683 684 ###) -
waeup_product/trunk/skins/waeup_default/getWAeUPLayouts.py
r151 r152 1021 1021 'rows': [ 1022 1022 [{'widget_id': 'Title', 'ncols': 1},], 1023 #[{'widget_id': 'Year', 'ncols': 1},], 1023 1024 ] 1024 1025 }, -
waeup_product/trunk/skins/waeup_default/getWAeUPSchemas.py
r144 r152 105 105 }, 106 106 }, 107 } 108 # 109 ###) 110 111 studylevel = { ###( 107 112 } 108 113 # … … 486 491 schemas['students'] = students_folder_schema 487 492 schemas['student'] = student_schema 493 schemas['studylevel'] = studylevel 488 494 schemas['course_results'] = course_results_schema 489 495 schemas['student_personal'] = student_personal_schema -
waeup_product/trunk/skins/waeup_default/getWAeUPTypes.py
r139 r152 131 131 'name': 'delegate', 132 132 'action': 'folder_localrole_form', 133 'permissions': (ModifyPortalContent ),134 'visible' : 0,133 'permissions': (ModifyPortalContent,UniversityManage), 134 'visible' : 1, 135 135 }, 136 136 ## {'id': 'contents', … … 319 319 'description': 'The data from JAMB', 320 320 'content_icon': '', 321 'content_meta_type': ' CPS Document',322 'product': ' CPSDocument',323 'factory': 'add CPSDocument',321 'content_meta_type': 'Jamb', 322 'product': 'WAeUP', 323 'factory': 'addJamb', 324 324 'immediate_view': 'cpsdocument_view', 325 325 'global_allow': True, … … 426 426 'content_meta_type': 'Level', 427 427 'product': 'WAeUP', 428 'factory': 'add LevelFolder',428 'factory': 'addStudyLevel', 429 429 'immediate_view': 'folder_view', 430 430 'global_allow': True, … … 477 477 'content_meta_type': 'Semester', 478 478 'product': 'WAeUP', 479 'factory': 'add LevelFolder',479 'factory': 'addSemester', 480 480 'immediate_view': 'folder_view', 481 481 'global_allow': True, … … 505 505 {'id': 'add_course_ticket', 506 506 'name': 'Add Course Ticket', 507 'condition': "python:member and 'Student'in member.getRoles()",508 507 'action' : 'add_course_ticket', 509 508 #'action': 'folder_factories', 510 'permissions': ( StudentManage,)},509 'permissions': (ModifyPortalContent,UniversityManage,StudentManage)}, 511 510 {'id': 'metadata', 512 511 'name': 'action_metadata', 513 512 'action': 'cpsdocument_metadata', 514 'condition': "python:member and 'Manager' in member.getRoles()", 515 'permissions': (UniversityManage,)}, 513 'permissions': (ModifyPortalContent,UniversityManage,)}, 516 514 {'id': 'localroles', 517 515 'name': 'delegate', 518 516 'action': 'folder_localrole_form', 519 'permissions': ( UniversityManage,),517 'permissions': (ModifyPortalContent,UniversityManage,StudentManage), 520 518 'visible': 0, 521 519 }, … … 531 529 'product': 'WAeUP', 532 530 'factory': 'addCourseTicket', 533 'immediate_view': ' folder_view',531 'immediate_view': 'cpsdocument_view', 534 532 'global_allow': True, 535 533 'filter_content_types': True, … … 791 789 {'id': 'add_accommodation', 792 790 'name': 'Add Accommodation Hall', 793 'condition': "python:member and 'UniversityManager'in member.getRoles()",791 #'condition': "python:member and 'UniversityManager'in member.getRoles()", 794 792 'action' : 'add_accommodation', 795 793 #'action': 'folder_factories', -
waeup_product/trunk/skins/waeup_student/create_jamb.py
r112 r152 37 37 elif psm == 'valid': 38 38 s_id = "s%s" % ds.get('reg_nr') 39 name = ds.get('name') 40 skw = {'title': name} 39 skw = {'title': "%(firstname)s %(lastname)s" % ds} 41 40 context.invokeFactory('Student',s_id) 42 41 student = getattr(context,s_id) … … 46 45 student.invokeFactory('Jamb',jamb_id) 47 46 jamb = getattr(student,jamb_id) 48 ds.set('title', name)47 ds.set('title', "%(reg_nr)s (%(lastname)s)" % ds) 49 48 jamb.getContent().edit(mapping=ds) 50 49 context.notifyCPSDocumentCreation(ob=jamb) … … 57 56 if noCPSMember: 58 57 pr.addMember(s_id, 'UnSeT',roles=('Member','Student','Contributor')) 58 student.manage_setLocalRoles(s_id, ['Owner']) 59 jamb.manage_setLocalRoles(s_id, ['Owner']) 60 ## student.getContent().setOwnership(s_id) 61 ## jamb.getContent().setOwnership(s_id) 59 62 ## groups = context.portal_directories.groups 60 63 ## gm = list(groups.getEntry('Students')['members']) … … 63 66 ## 'members': gm}) 64 67 return context.students_folder_view_manager(psm=psm) 65 ## return context.create_jamb_form(rendered = res,66 ## psm = psm,67 ## ds = ds,68 ## )69 70 return res,psm,ds71 68 -
waeup_product/trunk/skins/waeup_student/process_waeup_login.py
r137 r152 25 25 pd = getattr(ma,pdid) 26 26 pkw = {} 27 pkw['sex'] = getattr(jamb,'sex') 28 pkw['firstname'] = getattr(jamb,'firstname') 29 pkw['middlename'] = getattr(jamb,'middlename') 30 pkw['lastname'] = getattr(jamb,'lastname') 31 pkw['aggregate'] = getattr(jamb,'aggregate') 32 pkw['faculty'] = getattr(jamb,'faculty') 33 pkw['age'] = getattr(jamb,'age') 34 pkw['state'] = getattr(jamb,'state') 27 jc = jamb.getContent() 28 pkw['sex'] = getattr(jc,'sex') 29 pkw['firstname'] = getattr(jc,'firstname') 30 pkw['middlename'] = getattr(jc,'middlename') 31 pkw['lastname'] = getattr(jc,'lastname') 32 pkw['aggregate'] = getattr(jc,'aggregate') 33 pkw['faculty'] = getattr(jc,'faculty') 34 pkw['age'] = getattr(jc,'age') 35 pkw['state'] = getattr(jc,'state') 35 36 36 pd. edit(mapping=pkw)37 pd.getContent().edit(mapping=pkw) 37 38 context.notifyCPSDocumentCreation(ob=pd) 38 39 return response.redirect(ma.absolute_url()) -
waeup_product/trunk/skins/waeup_student/register_level.py
r142 r152 28 28 create = 1, 29 29 type_name = type_name, 30 psm = 'Not yet active',31 #psm = 'Please correct your errors',30 #psm = 'Not yet active', 31 psm = 'Please correct your errors', 32 32 ) 33 33 elif psm == '': … … 42 42 psm = (ds) 43 43 oid = ds.get('Title') 44 return context.common_edit_form(rendered = res, 44 if hasattr(context,oid): 45 return context.common_edit_form(rendered = res, 45 46 create = 1, 46 47 type_name = type_name, 47 psm = 'Not yet active', 48 #psm = 'Please correct your errors', 48 psm = 'You already registered for that level', 49 49 ) 50 51 halls = getattr(context,'accommodation').contentValues() 52 beds = [] 53 student = context.PERSONAL.getContent() 54 sf = context.getContent() 55 for hall in halls: 56 h = hall.getContent() 57 ba = int(getattr(h,'beds_assigned',0)) 58 bal = getattr(h,'beds_assigned_list',[]) 59 nr_of_beds = int(h.nr_of_blocks) * int(h.nr_of_floors) * int(h.rooms_per_floor) * int(h.beds_per_room) 60 if h.which_sex == student.sex and nr_of_beds > len(bal): 61 break 62 dict = {'heading': h.heading, 63 'text': h.text, 64 'which_sex': h.which_sex, 65 'nr_of_blocks': h.nr_of_blocks, 66 'nr_of_floors': h.nr_of_floors, 67 'rooms_per_floor': h.rooms_per_floor, 68 'beds_per_room': h.beds_per_room, 69 'nr_of_free': nr_of_beds, 70 'beds_assigned': ba, 71 } 72 ba += 1 73 dict['beds_assigned'] = ba 74 bal.append(('%s:%d' % (pm.getAuthenticatedMember(),ba))) 75 dict['beds_assigned_list'] = bal 76 psm = "h:%(heading)s free:%(nr_of_free)s %(beds_assigned)s" % dict 77 sf.edit(mapping = ds) 78 h.edit(mapping = dict) 79 #psm = "Your not admitted" 80 return context.booked_accommodation(v=dict) 50 context.invokeFactory(type_name,oid) 51 object = getattr(context,oid) 52 voc = pv.courselevel 53 ds.set('Title',voc.get(oid)) 54 object.getContent().edit(mapping=ds,proxy=object) 55 context.notifyCPSDocumentCreation(ob=object) 56 psm = 'new %s created' % oid 57 semester_id = 'Semester_1_%s_%s' % (oid,context.getId()) 58 object.invokeFactory('Semester',semester_id) 59 semester = getattr(object,semester_id) 60 semester.getContent().edit(mapping={'Title': 'First Semester'}) 61 semester_id = 'Semester_2_%s_%s' % (oid,context.getId()) 62 object.invokeFactory('Semester',semester_id) 63 semester = getattr(object,semester_id) 64 semester.getContent().edit(mapping={'Title': 'Second Semester'}) 65 context_ti = context.portal_types[context.portal_type] 66 index = context_ti.getActionById('view','university_view') 67 return getattr(context,index)(psm=psm)
Note: See TracChangeset for help on using the changeset viewer.