- Timestamp:
- 27 Sep 2007, 16:52:41 (17 years ago)
- Location:
- WAeUP_SRP
- Files:
-
- 4 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/Academics.py
r2190 r2282 687 687 export = [] 688 688 heading = '"code","review_state","faculty_code","department_code",' 689 heading += '"certificate_code","level"," semester","core_or_elective"'689 heading += '"certificate_code","level","core_or_elective"' 690 690 dataline = '"%(code)s","%(review_state)s","%(faculty_code)s","%(department_code)s",' 691 dataline += '"%(certificate_code)s","%(level)s","%( semester)s","%(core_or_elective)s"'691 dataline += '"%(certificate_code)s","%(level)s","%(core_or_elective)s"' 692 692 export.append(heading) 693 693 #import pdb;pdb.set_trace() … … 702 702 for level in certificate.objectValues(): 703 703 di['level'] = level.id 704 for sem in semesters: 705 semester = getattr(level,sem,None) 706 if semester is not None: 707 di['semester'] = semesters.index(sem) + 1 708 for course in semester.objectValues(): 709 di['code'] = course.getId() 710 course_d = course.getContent() 711 di['core_or_elective'] = getattr(course_d,'core_or_elective',None) 712 di['review_state'] = self.portal_workflow.getInfoFor(course,'review_state','no_state') 713 try: 714 export.append(dataline % di) 715 logger.info('Exporting %s %s ' % (certificate.id, certificate.title)) 716 except: 717 logger.info('Could not export %s %s ' % (certificate.id, certificate.title)) 718 continue 704 for course in level.objectValues(): 705 di['code'] = course.getId() 706 course_d = course.getContent() 707 di['core_or_elective'] = getattr(course_d,'core_or_elective',None) 708 di['review_state'] = self.portal_workflow.getInfoFor(course,'review_state','no_state') 709 try: 710 export.append(dataline % di) 711 logger.info('Exporting %s %s ' % (certificate.id, certificate.title)) 712 except: 713 logger.info('Could not export %s %s ' % (certificate.id, certificate.title)) 714 continue 719 715 open("%s/export/%s-%s.csv" % (i_home,name,current),"w+").write('\n'.join(export)) 720 716 return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1')) -
WAeUP_SRP/base/WAeUPTool.py
r2268 r2282 998 998 self._v_departments = {} 999 999 for d in res: 1000 self._v_departments[d.getId] = d.getObject()1000 self._v_departments[d.getId] = getattr(d.getObject(),"courses",None) 1001 1001 did = mapping['department_code'] 1002 1002 d = self._v_departments.get(did,None) 1003 1003 if d is None: 1004 return '', "No Department with ID: %s" % fid1004 return '', "No Department with ID: %s" % did 1005 1005 course_id = mapping.get('code') 1006 1006 if course_id in self._v_course_list: … … 1014 1014 c.getContent().edit(mapping=mapping) 1015 1015 return course_id,'' 1016 ###) 1017 1018 security.declareProtected(ModifyPortalContent,'mass_edit_course') ###( 1019 def mass_edit_course(self,mapping): 1020 #import pdb;pdb.set_trace() 1021 course_id = mapping.get('code') 1022 res = self.portal_catalog(id=course_id) 1023 if not res: 1024 return '', "No Course with ID: %s" % did 1025 c = res[0].getObject() 1026 c.getContent().edit(mapping=mapping) 1027 return course_id,'' 1028 ###) 1029 1030 security.declareProtected(ModifyPortalContent,'mass_create_certificate') ###( 1031 def mass_create_certificate(self,mapping): 1032 if getattr(self,'_v_certificate_list',None) is None: 1033 self._v_certificate_list = [] 1034 if getattr(self,'_v_departments',None) is None: 1035 res = self.portal_catalog(portal_type = "Department") 1036 self._v_departments = {} 1037 for d in res: 1038 self._v_departments[d.getId] = getattr(d.getObject(),"certificates",None) 1039 did = mapping['department_code'] 1040 d = self._v_departments.get(did,None) 1041 if d is None: 1042 return '', "No Department with ID: %s" % did 1043 certificate_id = mapping.get('code') 1044 if certificate_id in self._v_certificate_list: 1045 return '', "Duplicate Department ID: %s" % did 1046 c = getattr(d,certificate_id,None) 1047 if c is not None: 1048 return '', "Duplicate Department ID: %s" % did 1049 d.invokeFactory('Certificate', certificate_id) 1050 self._v_certificate_list.append(certificate_id) 1051 c = getattr(d,certificate_id) 1052 c.getContent().edit(mapping=mapping) 1053 return certificate_id,'' 1054 ###) 1055 1056 security.declareProtected(ModifyPortalContent,'mass_edit_certificate') ###( 1057 def mass_edit_certificate(self,mapping): 1058 #import pdb;pdb.set_trace() 1059 certificate_id = mapping.get('code') 1060 res = self.portal_catalog(id=certificate_id) 1061 if not res: 1062 return '', "No Certificate with ID: %s" % did 1063 c = res[0].getObject() 1064 c.getContent().edit(mapping=mapping) 1065 return certificate_id,'' 1066 ###) 1067 1068 security.declareProtected(ModifyPortalContent,'mass_create_certificate_course') ###( 1069 def mass_create_certificate_course(self,mapping): 1070 if getattr(self,'_v_certificate_course_list',None) is None: 1071 self._v_certificate_course_list = [] 1072 if getattr(self,'_v_ceritficates',None) is None: 1073 res = self.portal_catalog(portal_type = "Certificate") 1074 self._v_certificates = {} 1075 for cert in res: 1076 self._v_certificates[cert.getId] = cert.getObject() 1077 cert_id = mapping['certificate_code'] 1078 cert = self._v_certificates.get(cert_id,None) 1079 if cert is None: 1080 return '', "No Certificate with ID: %s" % did 1081 certificate_course_id = mapping.get('code') 1082 if certificate_course_id in self._v_certificate_course_list: 1083 return '', "Duplicate CertificateCourse ID: %s" % certificate_course_id 1084 level_id = mapping.get('level') 1085 level = getattr(cert,level_id,None) 1086 if level is None: 1087 cert.invokeFactory('StudyLevel', level_id) 1088 level = getattr(cert,level_id,None) 1089 elif hasattr(level,certificate_course_id): 1090 return '', "Duplicate CertificateCourse ID: %s in %s/ %s" %\ 1091 (certificate_course_id,cert_id,level_id) 1092 level.invokeFactory('CertificateCourse', certificate_course_id) 1093 self._v_certificate_course_list.append(certificate_course_id) 1094 c = getattr(level,certificate_course_id) 1095 c.getContent().edit(mapping=mapping) 1096 return certificate_course_id,'' 1016 1097 ###) 1017 1098 … … 1300 1381 diff2layout = set(import_keys).difference(set(layout.keys())) 1301 1382 if diff2schema: 1302 em = "not ignorable key(s) %s found in heading" % diff2schema1383 em = 'not ignorable key(s): "%s" found in heading' % ", ".join(diff2schema) 1303 1384 return em 1304 1385 s = ','.join(['"%s"' % fn for fn in import_keys]) -
WAeUP_SRP/base/Widgets.py
r2271 r2282 165 165 value = datastructure[widget_id].upper() 166 166 err = 0 167 res = self. portal_catalog(meta_type= "Course",id= value)167 res = self.courses_catalog(code = value) 168 168 if len(res) > 0: 169 169 err = 'Course already exists' -
WAeUP_SRP/base/skins/waeup_academics/getFacultiesInfo.py
r2273 r2282 43 43 except AttributeError: 44 44 continue 45 46 45 items.sort(cmp_id) 47 46 info['items'] = items -
WAeUP_SRP/base/skins/waeup_default/get_csv_names.py
r1756 r2282 7 7 files = context.waeup_tool.get_csv_filenames() 8 8 if key is None: 9 return [(f[:-4],f) for f in files] 9 l = [(f[:-4],f) for f in files] 10 l.sort(cmp=lambda x,y: cmp(x[0].lower(), y[0].lower())) 11 return l 10 12 11 13 return files[files.index("%s.csv" % key)] -
WAeUP_SRP/fceokene/profiles/default/layouts.xml
r2265 r2282 9 9 <object name="application_manage" meta_type="CPS Layout"/> 10 10 <object name="certificate" meta_type="CPS Layout"/> 11 <object name="import_certificate" meta_type="CPS Layout"/> 11 12 <object name="certificate_course" meta_type="CPS Layout"/> 13 <object name="import_certificate_course" meta_type="CPS Layout"/> 12 14 <object name="course" meta_type="CPS Layout"/> 13 15 <object name="import_course" meta_type="CPS Layout"/> -
WAeUP_SRP/fceokene/profiles/default/layouts/course.xml
r1449 r2282 44 44 <property name="hidden_layout_modes"/> 45 45 <property name="hidden_readonly_layout_modes"/> 46 </widget> 47 <widget name="level" meta_type="String Widget"> 48 <property name="title">Level</property> 49 <property name="fields"> 50 <element value="level"/> 51 </property> 52 <property name="label">Level</property> 53 <property name="label_edit">Level</property> 54 <property name="readonly_layout_modes"/> 55 <property name="hidden_layout_modes"/> 56 <property name="hidden_readonly_layout_modes"/> 57 <property name="display_width">60</property> 46 58 </widget> 47 59 <widget name="credits" meta_type="Int Widget"> … … 121 133 </row> 122 134 <row> 135 <cell name="level"/> 136 </row> 137 <row> 123 138 <cell name="semester"/> 124 139 </row> -
WAeUP_SRP/fceokene/profiles/default/layouts/import_course.xml
r2265 r2282 8 8 <property name="flexible_widgets"/> 9 9 <property name="validate_values_expr"></property> 10 <widget name="code" meta_type=" CourseIdWidget">10 <widget name="code" meta_type="String Widget"> 11 11 <property name="title">Course Id</property> 12 12 <property name="fields"> … … 69 69 <property name="display_width">60</property> 70 70 </widget> 71 <widget name="department_code" meta_type="String Widget">71 <widget name="department_code" meta_type="String Widget"> 72 72 <property name="title">Department Code</property> 73 73 <property name="fields"> … … 76 76 <property name="label">Department Code</property> 77 77 <property name="label_edit">Department Code</property> 78 <property name="readonly_layout_modes"/> 79 <property name="hidden_layout_modes"/> 80 <property name="hidden_readonly_layout_modes"/> 81 <property name="display_width">60</property> 82 </widget> 83 <widget name="level" meta_type="String Widget"> 84 <property name="title">Level</property> 85 <property name="fields"> 86 <element value="level"/> 87 </property> 88 <property name="label">Level</property> 89 <property name="label_edit">Level</property> 78 90 <property name="readonly_layout_modes"/> 79 91 <property name="hidden_layout_modes"/> -
WAeUP_SRP/fceokene/profiles/default/schemas.xml
r2265 r2282 9 9 <object name="application" meta_type="CPS Schema"/> 10 10 <object name="certificate" meta_type="CPS Schema"/> 11 <object name="import_certificate" meta_type="CPS Schema"/> 11 12 <object name="certificate_course" meta_type="CPS Schema"/> 13 <object name="import_certificate_course" meta_type="CPS Schema"/> 12 14 <object name="import_course" meta_type="CPS Schema"/> 13 15 <object name="course" meta_type="CPS Schema"/> -
WAeUP_SRP/fceokene/profiles/default/schemas/import_course.xml
r2265 r2282 6 6 <field name="code" meta_type="CPS String Field"/> 7 7 <field name="credits" meta_type="CPS Int Field"/> 8 <field name="org_code" meta_type="CPS String Field"/>9 8 <field name="passmark" meta_type="CPS Int Field"> 10 9 <property name="default_expr">python:40</property> -
WAeUP_SRP/fceokene/profiles/default/vocabularies/import_names.xml
r2264 r2282 9 9 <item key="faculty" msgid="">Faculty Data</item> 10 10 <item key="department" msgid="">Department Data</item> 11 <item key="course" msgid="">Course Data</item> 12 <item key="certificate" msgid="">Certificate Data</item> 13 <item key="certificate_course" msgid="">Certificate Course Data</item> 11 14 </object>
Note: See TracChangeset for help on using the changeset viewer.