Changeset 1724 for WAeUP_SRP/trunk/skins/waeup_default
- Timestamp:
- 30 Apr 2007, 15:37:48 (18 years ago)
- Location:
- WAeUP_SRP/trunk/skins/waeup_default
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/trunk/skins/waeup_default/id_rename.py
r681 r1724 6 6 Used within the folder_contents template. 7 7 """ 8 try: 9 from Products.zdb import set_trace 10 except: 11 def set_trace(): 12 pass 13 import logging 14 logger = logging.getLogger('Skins.id_rename') 15 mtool = context.portal_membership 16 member = mtool.getAuthenticatedMember() 8 17 9 18 REQUEST = context.REQUEST … … 14 23 % ('Courses cannot be renamed',))) 15 24 25 old_ids = REQUEST['ids'] 16 26 new_ids = REQUEST['new_ids'] 17 27 new_ids = [id.upper() for id in REQUEST['new_ids']] … … 20 30 if context.portal_type == "University": 21 31 here = context.academics 22 32 pt = context.portal_type 33 mt = context.meta_type 34 logger.info('%s starting renaming %s to %s' % (member,old_ids,new_ids)) 23 35 24 36 here.manage_renameObjects(REQUEST['ids'], new_ids, REQUEST) 37 if pt == 'University': 38 for faculty in old_ids: 39 students = context.students_catalog(faculty=faculty) 40 student_ids = [s.id for s in students] 41 data = {} 42 new_fid = new_ids[old_ids.index(faculty)] 43 data['faculty'] = new_fid 44 for sid in student_ids: 45 data['id'] = sid 46 context.students_catalog.modifyRecord(**data) 47 courses = context.courses_catalog(faculty=faculty) 48 courses_ids = [c.code for c in courses] 49 for cid in courses_ids: 50 data['code'] = cid 51 context.courses_catalogModify(**data) 52 elif pt == 'Faculty': 53 for department in old_ids: 54 students = context.students_catalog(department=department) 55 student_ids = [s.id for s in students] 56 data = {} 57 new_did = new_ids[old_ids.index(department)] 58 data['department'] = new_did 59 for sid in student_ids: 60 data['id'] = sid 61 context.students_catalog.modifyRecord(**data) 62 courses = context.courses_catalog(department=department) 63 courses_ids = [c.code for c in courses] 64 for cid in courses_ids: 65 data['code'] = cid 66 context.courses_catalogModify(**data) 67 logger.info('%s finished renaming %s to %s' % (member,old_ids,new_ids)) 25 68 26 69 return REQUEST.RESPONSE.redirect(here.absolute_url() + \ -
WAeUP_SRP/trunk/skins/waeup_default/id_rename_form.pt
r586 r1724 46 46 </div><!-- tal:condition="here/folder_rename_items" --> 47 47 48 <div tal:condition="not: here/ folder_rename_items">48 <div tal:condition="not: here/academics_rename_items"> 49 49 50 50 <p i18n:translate="help_no_items_to_rename"> -
WAeUP_SRP/trunk/skins/waeup_default/waeup_document_create_do.py
r1716 r1724 34 34 if new_id is not None: 35 35 id = new_id 36 if type_name == " Course": # disable ifhandled by event36 if type_name == "xxxCourse": # disabled handled by event 37 37 d = {} 38 38 ptl = request.get('PATH_TRANSLATED').split('/') -
WAeUP_SRP/trunk/skins/waeup_default/waeup_edit.py
r1716 r1724 102 102 ) 103 103 logger.info('%s edited %s of %s' % (member,context.id,student_id)) 104 elif context.portal_type == " Course": # disable ifhandled by events104 elif context.portal_type == "xxxxCourse": # disabled handled by events 105 105 dd = {} 106 106 dd.update(ds) # ds is not a real dictionary
Note: See TracChangeset for help on using the changeset viewer.