Changeset 3301
- Timestamp:
- 9 Mar 2008, 22:30:59 (17 years ago)
- Location:
- WAeUP_SRP
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/skins/waeup_default/waeup_edit.py
r2042 r3301 2 2 # $Id: external_edit.py 805 2006-11-09 09:38:29Z joachim $ 3 3 """ 4 Called when a document form is posted.5 6 Validates data, then:7 8 - if there's no error, updates the object and redirects to it,9 10 - if there's an error, puts data in session and redirects to edit form.11 12 A form uid is propagated during the redirect to uniquely identify the13 form in the session.14 4 """ 15 5 … … 24 14 mtool = context.portal_membership 25 15 member = mtool.getAuthenticatedMember() 16 doc = context.getContent() 26 17 27 # Check flexible controls 28 #context.editLayouts(REQUEST=REQUEST) 29 30 # Validate the document and write it if it's valid 31 # (We don't call getEditableContent here, validate does it when needed.) 32 doc = context.getContent() 33 if context.portal_type == "StudentStudyCourse": 34 if len(context.objectIds()) > 0: 35 psm = 'Edit of StudentStudyCourse is only possible if there are no levels inside!' 36 args = getFormUidUrlArg(REQUEST) 37 args['portal_status_message'] = psm 38 url = context.absolute_url() + '?' + urlencode(args) 39 REQUEST.RESPONSE.redirect(url) 18 #if context.portal_type == "StudentStudyCourse": 19 # if len(context.objectIds()) > 0: 20 # psm = 'Edit of StudentStudyCourse is only possible if there are no levels inside!' 21 # args = getFormUidUrlArg(REQUEST) 22 # args['portal_status_message'] = psm 23 # url = context.absolute_url() + '?' + urlencode(args) 24 # return REQUEST.RESPONSE.redirect(url) 40 25 41 26 is_valid, ds = doc.validate(request=REQUEST, proxy=context, cluster=cluster, … … 44 29 student_id = context.getStudentId() 45 30 46 ##if action is None:47 ## ti = doc.getTypeInfo()48 ## action = ti.queryMethodID('edit', 'external_edit_form')49 ## action = '/' + action50 51 31 action = "/" + came_from 52 32 if is_valid: … … 54 34 context.cpsdocument_notify_modification(comments=comments) 55 35 56 ###################################################57 if False:58 if context.portal_type == "StudentStudyCourse":59 course = ds.get('study_course')60 #student_id = context.getStudentId()61 res = context.portal_catalog(portal_type='Certificate',id = course)62 if res:63 c_brain = res[0]64 c_path = c_brain.getPath().split('/')65 #student_id = context.getStudentId()66 context.students_catalog.modifyRecord(id = student_id,67 course = course,68 level = ds.get('current_level'),69 verdict = ds.get('current_verdict'),70 faculty = c_path[-4],71 department = c_path[-3],72 )73 logger.info('%s edited %s (%s) of %s' % (member,context.id,course,student_id))74 75 elif context.portal_type == "StudentApplication": # disabled76 entry_mode = ds.get('entry_mode')77 #student_id = context.getStudentId()78 context.students_catalog.modifyRecord(id = student_id,79 entry_mode = entry_mode,80 )81 logger.info('%s edited %s of %s' % (member,context.id,student_id))82 elif context.portal_type == "StudentClearance":83 matric_no = ds.get('matric_no')84 #student_id = context.getStudentId()85 context.students_catalog.modifyRecord(id = student_id,86 matric_no = matric_no,87 )88 logger.info('%s edited %s of %s' % (member,context.id,student_id))89 elif context.portal_type in ("StudentPersonal",):90 name = "%(firstname)s %(middlename)s %(lastname)s" % ds91 name = name.strip()92 name = name.replace(' ',' ')93 email = ds.get('email')94 phone = ds.get('phone')95 #student_id = context.getStudentId()96 #app_doc = context.application.getContent()97 #jamb_sex = 'M'98 #if ds.get('sex'):99 # jamb_sex = 'F'100 # originally imported data must be kept; app_doc should not be changed here101 #app_doc.edit(mapping={'jamb_lastname': name,102 # 'jamb_sex': jamb_sex103 # })104 context.students_catalog.modifyRecord(id = student_id,105 name = name,106 email = email,107 phone = phone,108 sex = ds.get('sex'),109 )110 logger.info('%s edited %s of %s' % (member,context.id,student_id))111 elif context.portal_type == "xxxxCourse": # disabled handled by events112 dd = {}113 dd.update(ds) # ds is not a real dictionary114 try:115 context.courses_catalog.modifyRecord(**dd)116 except KeyError:117 context.courses_catalog.addRecord(**dd)118 ###################################################119 36 120 37 -
WAeUP_SRP/base/skins/waeup_upload/uploads_index.py
r3297 r3301 35 35 info['doc'] = context.getContent() 36 36 37 logger.info('%s views upload section' % member) 38 37 39 edit = request.form.has_key('edit') 38 40 ids = request.get('ids',[]) … … 57 59 for key in new_keys: 58 60 logger.info('%s changed column heading in file %s from %s to %s' % (member,long_id,key[0],key[1])) 59 request.RESPONSE.redirect(context.absolute_url()) 60 61 61 62 wrong = [] 62 63 imported = [] … … 138 139 d['url'] = upload.absolute_url() 139 140 upload.getContent().edit(mapping=d) 140 logger.info('%s uploaded file %s in layout mode%s' % (member,filename,d['import_layout']))141 logger.info('%s uploaded file %s with import layout %s' % (member,filename,d['import_layout'])) 141 142 142 re quest.RESPONSE.redirect(context.absolute_url())143 return request.RESPONSE.redirect(context.absolute_url()) 143 144 -
WAeUP_SRP/uniben/profiles/default/workflows/waeup_document_wf/definition.xml
r2036 r3301 10 10 <permission-map name="View" acquired="True"> 11 11 <permission-role>Anonymous</permission-role> 12 <<permission-role>Authenticated</permission-role> 12 13 <permission-role>Manager</permission-role> 13 14 <permission-role>SectionManager</permission-role> … … 20 21 new_state="static" trigger="USER" 21 22 before_script="" after_script=""> 22 23 23 24 <guard> 24 25 <guard-role>Manager</guard-role> … … 31 32 title="Create content" new_state="" 32 33 trigger="USER" before_script="" after_script=""> 33 34 34 35 <guard> 35 36 <guard-role>Manager</guard-role> … … 45 46 title="Cut/Copy/Paste" new_state="" 46 47 trigger="USER" before_script="" after_script=""> 47 48 48 49 <guard> 49 50 <guard-role>Manager</guard-role>
Note: See TracChangeset for help on using the changeset viewer.