Changeset 238
- Timestamp:
- 1 Jun 2006, 16:57:18 (19 years ago)
- Location:
- waeup_product/trunk
- Files:
-
- 8 added
- 12 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
waeup_product/trunk/Academics.py
r223 r238 17 17 #registerDirectory('skins/waeup_faculty', globals()) 18 18 19 class Faculty(CPSDocument): ###(19 class SCFolder(CPSDocument): ###( 20 20 """ 21 WAeUP Faculty containing Departments21 WAeUP StudyCourseFolder containing StudyCourses 22 22 """ 23 meta_type = ' Faculty'23 meta_type = 'SCFolder' 24 24 portal_type = meta_type 25 25 security = ClassSecurityInfo() … … 31 31 def Title(self): 32 32 """compose title""" 33 return "Faculty of %s" % (self.title) 33 return "SCFolder of %s" % (self.title) 34 35 InitializeClass(SCFolder) 36 37 def addSCFolder(container, id, REQUEST=None, **kw): 38 """Add a SCFolder.""" 39 ob = SCFolder(id, **kw) 40 return CPSBase_adder(container, ob, REQUEST=REQUEST) 41 42 ###) 43 44 class StudyCourse(CPSDocument): ###( 45 """ 46 WAeUP StudyCourse 47 """ 48 meta_type = 'StudyCourse' 49 portal_type = meta_type 50 security = ClassSecurityInfo() 51 52 def __init__(self, id, **kw): 53 CPSDocument.__init__(self, id, **kw) 54 55 ## security.declareProtected(View,"Title") 56 ## def Title(self): 57 ## """compose title""" 58 ## return "StudyCourse of %s" % (self.title) 59 60 InitializeClass(StudyCourse) 61 62 def addStudyCourse(container, id, REQUEST=None, **kw): 63 """Add a StudyCourse.""" 64 ob = StudyCourse(id, **kw) 65 return CPSBase_adder(container, ob, REQUEST=REQUEST) 66 67 ###) 68 69 class Faculty(CPSDocument): ###( 70 """ 71 WAeUP Faculty containing Departments 72 """ 73 meta_type = 'Faculty' 74 portal_type = meta_type 75 security = ClassSecurityInfo() 76 77 ## def __init__(self, id, **kw): 78 ## CPSDocument.__init__(self, id, **kw) 79 80 security.declareProtected(View,"Title") 81 def Title(self): 82 """compose title""" 83 return "%s" % (self.title) 34 84 35 85 InitializeClass(Faculty) … … 41 91 42 92 ###) 43 44 93 45 94 class Department(CPSDocument): ###( … … 65 114 ###) 66 115 67 ##course_fti = { ###(68 ## 'title': 'WAeUP Course',69 ## 'description': '',70 ## 'content_icon': '',71 ## 'content_meta_type': 'Course',72 ## 'factory': 'addCourse',73 ## 'immediate_view': 'cpsdocument_view',74 ## 'global_allow': True,75 ## 'filter_content_types': True,76 ## 'allowed_content_types': (),77 ## 'allow_discussion': False,78 ##}79 #####)80 81 116 class Course(CPSDocument): ###( 82 117 """ … … 90 125 def Title(self): 91 126 """compose title""" 92 content = self.getContent() 93 heading = getattr(content,'heading',None) 94 if heading is None: 95 return self.title 96 return heading 127 return self.title 97 128 98 129 InitializeClass(Course) -
waeup_product/trunk/__init__.py
r206 r238 14 14 from Products.WAeUP.Accommodation import AccoFolder, addAccoFolder 15 15 from Products.WAeUP.Accommodation import Accommodation, addAccommodation 16 from Products.WAeUP.Faculty import Faculty, addFaculty 17 from Products.WAeUP.Faculty import Department, addDepartment 18 from Products.WAeUP.Faculty import Course, addCourse 19 from Products.WAeUP.Faculty import CourseTicket, addCourseTicket 16 from Products.WAeUP.Academics import SCFolder, addSCFolder 17 from Products.WAeUP.Academics import StudyCourse, addStudyCourse 18 from Products.WAeUP.Academics import Faculty, addFaculty 19 from Products.WAeUP.Academics import Department, addDepartment 20 from Products.WAeUP.Academics import Course, addCourse 21 from Products.WAeUP.Academics import CourseTicket, addCourseTicket 20 22 from Products.WAeUP.Students import Student, addStudent 21 23 from Products.WAeUP.Students import StudentPersonal, addStudentPersonal … … 31 33 contentClasses = ( 32 34 University, 35 SCFolder, 36 StudyCourse, 33 37 Faculty, 34 38 Department, … … 48 52 contentConstructors = ( 49 53 addUniversity, 54 addSCFolder, 55 addStudyCourse, 50 56 addFaculty, 51 57 addDepartment, … … 65 71 fti = ( 66 72 {}, # University 73 {}, #SCFolder 74 {}, #StudyCourse 67 75 {}, # Faculty 68 76 {}, # Department -
waeup_product/trunk/exportimport.py
r211 r238 12 12 association in the `configure.zcml` file. 13 13 """ 14 import csv,re 14 15 15 16 # Zope3 component architecture … … 30 31 from Products.GenericSetup.interfaces import ISetupEnviron 31 32 from Products.WAeUP.interfaces import IWAeUPTool 33 import Globals 34 p_home = Globals.package_home(globals()) 35 i_home = Globals.INSTANCE_HOME 32 36 33 37 TOOL = 'portal_waeup' … … 37 41 # im- / export steps defined in the corresponding XML files in the 38 42 # WAeUP/profiles/default/ directory. 39 40 41 def setupStructure(context): ###(42 sections = getattr(context,'sections')43 portal = getattr(sections,'uniportal',None)44 if portal is None:45 sections.invokeFactory('University','uniportal')46 portal = getattr(context,'uniportal',None)47 portal.getContent().edit(mapping={'Title':SRPP_TITLE})48 students = getattr(portal,'students',None)49 if students is None:50 portal.invokeFactory('StudentsFolder','students')51 students = getattr(portal,'students').getContent()52 students.edit(mapping={'Title':'Students'})53 academics = getattr(portal,'academics',None)54 if academics is None:55 portal.invokeFactory('AcademicsFolder','academics')56 academics = getattr(portal,'academics')57 academics.getContent().edit(mapping={'Title':'Academics'})58 installFaculties(academics)59 if not hasattr(portal,'accommodation'):60 portal.invokeFactory('AccoFolder','accommodation')61 accommodation = getattr(portal,'accommodation').getContent()62 accommodation.edit(mapping={'Title':'Accommodation'})63 ###)64 65 43 66 44 def installFaculties( academics): ###( … … 152 130 ###) 153 131 132 def loadFacultiesFromCSV(academics,site,context): ###( 133 """install Universityspecific Faculies from CSV values""" 134 logger = context.getLogger('loadfaculties') 135 faculties = csv.DictReader(open("%s/import/faculty.csv" % i_home,"rb")) 136 for faculty in faculties: 137 fid = faculty['FacultyKey'] 138 f = getattr(academics,fid,None) 139 if f is None: 140 #self.log('Creating Faculty %(id)s = %(Title)s' % faculty) 141 logger.info('Creating Faculty %(FacultyKey)s = %(Description)s' % faculty) 142 academics.invokeFactory('Faculty', fid) 143 f = getattr(academics,fid) 144 d = {'Title': faculty['Description']} 145 f.getContent().edit(mapping=d) 146 ###) 147 148 def loadDepartmentsFromCSV(academics,site,context): ###( 149 """install Universityspecific Faculies from CSV values""" 150 logger = context.getLogger('loaddepartments') 151 deps = csv.DictReader(open("%s/import/departments.csv" % i_home,"rb")) 152 for dep in deps: 153 fid = dep['FacultyCode'] 154 f = getattr(academics,fid,None) 155 if f is None: 156 logger.info( "No Faculty with ID: %s" % fid) 157 else: 158 did = dep.get('DeptCode') 159 d = getattr(f,did,None) 160 if d is None: 161 #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep) 162 logger.info('Creating Department %(DeptCode)s = %(Description)s' % dep) 163 f.invokeFactory('Department', did) 164 d = getattr(f,did) 165 dict = {'Title': dep['Description']} 166 d.getContent().edit(mapping=dict) 167 ###) 168 169 def loadCoursesFromCSV(academics,site,context): ###( 170 """install Universityspecific Faculies from CSV values""" 171 logger = context.getLogger('loadcourses') 172 courses = csv.DictReader(open("%s/import/courses.csv" % i_home,"rb")) 173 for course in courses: 174 if course.get("FORMERCODE") != '': 175 continue 176 depid = course['Dept'] 177 res = site.portal_catalog({'meta_type': "Department", 178 'id': depid}) 179 if not res: 180 continue 181 dept=res[0].getObject() 182 course_id = ''.join(re.split('\W+',course.get('CourseCode'))) 183 if len(course_id) != 6: 184 logger.info("invalid course_code %(CourseCode)s" % course) 185 #print course_id,course.get('CourseCode'),course.get('Description') 186 continue 187 c = getattr(dept,course_id,None) 188 if c is None: 189 #self.log('Creating Department %(DeptCode)s = %(Description)s' % dep) 190 logger.info('Creating Course %(CourseCode)s %(Description)s in Department %(Dept)s' % course) 191 dept.invokeFactory('Course', course_id) 192 c = getattr(dept,course_id) 193 dict = {'Title': course['Description']} 194 dict['code'] = course_id 195 dict['credit'] = course.get('Credits') 196 #dict['level'] = course.get('CourseCode').split()[1][0] 197 dict['level'] = "%c00" % course_id[3] 198 dict['semester'] = "%(Semester)s" % course 199 dict['passmark'] = course.get('PassMark') 200 c.getContent().edit(mapping=dict) 201 ###) 202 203 def setupStructure(site,context): ###( 204 sections = getattr(site,'sections') 205 portal = getattr(sections,'uniportal',None) 206 if portal is None: 207 sections.invokeFactory('University','uniportal') 208 portal = getattr(site,'uniportal',None) 209 portal.getContent().edit(mapping={'Title':SRPP_TITLE}) 210 students = getattr(portal,'students',None) 211 if students is None: 212 portal.invokeFactory('StudentsFolder','students') 213 students = getattr(portal,'students').getContent() 214 students.edit(mapping={'Title':'Students'}) 215 academics = getattr(portal,'academics',None) 216 if academics is None: 217 portal.invokeFactory('AcademicsFolder','academics') 218 academics = getattr(portal,'academics') 219 academics.getContent().edit(mapping={'Title':'Academics'}) 220 loadFacultiesFromCSV(academics,site,context) 221 loadDepartmentsFromCSV(academics,site,context) 222 loadCoursesFromCSV(academics,site,context) 223 studycourses = getattr(academics,'studycourses',None) 224 if studycourses is None: 225 academics.invokeFactory('SCFolder','studycourses') 226 studycourses = getattr(academics,'studycourses') 227 studycourses.getContent().edit(mapping={'Title':'Studycourses'}) 228 installFaculties(academics) 229 if not hasattr(portal,'accommodation'): 230 portal.invokeFactory('AccoFolder','accommodation') 231 accommodation = getattr(portal,'accommodation').getContent() 232 accommodation.edit(mapping={'Title':'Accommodation'}) 233 ###) 234 154 235 155 236 def exportWAeUP(context): … … 168 249 """ 169 250 site = context.getSite() 251 setupStructure(site,context) 170 252 #import pdb; pdb.set_trace() 171 setupStructure(site)253 print ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>p_home: ",p_home,i_home 172 254 pass 173 255 #site = context.getSite() -
waeup_product/trunk/profiles/default/layouts.xml
r199 r238 24 24 <object name="student_semester" meta_type="CPS Layout"/> 25 25 <object name="study_level" meta_type="CPS Layout"/> 26 <object name="studycourse" meta_type="CPS Layout"/> 26 27 <object name="university" meta_type="CPS Layout"/> 27 28 <object name="waeup_common" meta_type="CPS Layout"/> -
waeup_product/trunk/profiles/default/layouts/course.xml
r199 r238 35 35 <property name="label_edit">Credit</property> 36 36 </widget> 37 <widget name="heading" meta_type="String Widget">38 <property name="fields">39 <element value="heading"/>40 </property>41 <property name="is_required">True</property>42 <property name="label">Title</property>43 <property name="label_edit">Title</property>44 <property name="help">Course Title</property>45 <property name="display_width">40</property>46 <property name="size_max">40</property>47 </widget>48 37 <widget name="level" meta_type="Select Widget"> 49 38 <property name="fields"> … … 55 44 <property name="vocabulary">courselevel</property> 56 45 </widget> 57 <widget name=" nr_of_seats" meta_type="Int Widget">46 <widget name="passmark" meta_type="Int Widget"> 58 47 <property name="fields"> 59 <element value=" nr_of_seats"/>48 <element value="passmark"/> 60 49 </property> 61 50 <property name="is_required">True</property> 62 <property name="label">Nr. of seats</property> 63 <property name="label_edit">Nr. of seats</property> 51 <property name="label">Passmark</property> 52 <property name="label_edit">Passmark</property> 53 <property name="readonly_layout_modes"/> 54 <property name="hidden_layout_modes"/> 55 <property name="hidden_readonly_layout_modes"/> 64 56 </widget> 65 <widget name="semester" meta_type="Boolean Widget"> 57 <widget name="semester" meta_type="Select Widget"> 58 <property name="title">Semester</property> 66 59 <property name="fields"> 67 60 <element value="semester"/> 68 61 </property> 69 <property name="is_required">True</property>70 62 <property name="label">Semester</property> 71 63 <property name="label_edit">Semester</property> 72 <property name="label_false">Second Semester</property> 73 <property name="label_true">First Semester</property> 64 <property name="readonly_layout_modes"/> 65 <property name="hidden_layout_modes"/> 66 <property name="hidden_readonly_layout_modes"/> 67 <property name="vocabulary">semester_voc</property> 74 68 </widget> 75 69 <widget name="text" meta_type="Text Widget"> … … 108 102 </row> 109 103 <row> 110 <cell name=" nr_of_seats"/>104 <cell name="passmark"/> 111 105 </row> 112 106 </table> -
waeup_product/trunk/profiles/default/schemas.xml
r199 r238 21 21 <object name="student_schoolresults" meta_type="CPS Schema"/> 22 22 <object name="students" meta_type="CPS Schema"/> 23 <object name="studycourse" meta_type="CPS Schema"/> 23 24 <object name="study_level" meta_type="CPS Schema"/> 24 25 <object name="university" meta_type="CPS Schema"/> -
waeup_product/trunk/profiles/default/schemas/course.xml
r199 r238 10 10 <property name="default_expr">string:</property> 11 11 </field> 12 <field name="heading" meta_type="CPS String Field">13 <property name="is_searchabletext">True</property>14 </field>15 12 <field name="level" meta_type="CPS String Field"> 16 13 <property name="is_searchabletext">True</property> 17 14 </field> 18 <field name="nr_of_seats" meta_type="CPS Int Field"/> 19 <field name="semester" meta_type="CPS Boolean Field"> 20 <property name="default_expr">python:True</property> 15 <field name="passmark" meta_type="CPS Int Field"> 16 <property name="default_expr">python:40</property> 21 17 </field> 18 <field name="semester" meta_type="CPS String Field"/> 22 19 <field name="text" meta_type="CPS String Field"> 23 20 <property name="is_searchabletext">True</property> 24 21 </field> 25 22 </object> 23 -
waeup_product/trunk/profiles/default/types.xml
r200 r238 12 12 <object name="ScratchCard" meta_type="CPS Flexible Type Information"/> 13 13 <object name="Semester" meta_type="CPS Flexible Type Information"/> 14 <object name="SCFolder" meta_type="CPS Flexible Type Information"/> 15 <object name="StudyCourse" meta_type="CPS Flexible Type Information"/> 14 16 <object name="Student" meta_type="CPS Flexible Type Information"/> 15 17 <object name="StudentDocuments" meta_type="CPS Flexible Type Information"/> -
waeup_product/trunk/profiles/default/types/AcademicsFolder.xml
r200 r238 13 13 <property name="allowed_content_types"> 14 14 <element value="Faculty"/> 15 <element value="SCFolder"/> 15 16 </property> 16 17 <property name="allow_discussion">False</property> -
waeup_product/trunk/profiles/default/types/Department.xml
r200 r238 12 12 <property name="filter_content_types">True</property> 13 13 <property name="allowed_content_types"> 14 <element value="Course"/> 14 15 <element value="Student"/> 15 <element value="Course"/>16 16 </property> 17 17 <property name="allow_discussion">False</property> 18 18 <property name="cps_is_searchable">True</property> 19 <property name="cps_proxy_type"> folder</property>19 <property name="cps_proxy_type">btreefolderishdocument</property> 20 20 <property name="cps_display_as_document_in_listing">True</property> 21 21 <property name="schemas"> -
waeup_product/trunk/profiles/default/vocabularies.xml
r205 r238 12 12 <object name="range5" meta_type="CPS Vocabulary"/> 13 13 <object name="range50" meta_type="CPS Vocabulary"/> 14 <object name="semester_voc" meta_type="CPS Vocabulary"/> 14 15 </object> -
waeup_product/trunk/profiles/default/workflows.xml
r209 r238 4 4 <object name="waeup_base_wf" meta_type="CPS Workflow"/> 5 5 <object name="waeup_faculty_wf" meta_type="CPS Workflow"/> 6 <object name="waeup_studycourse_wf" meta_type="CPS Workflow"/> 6 7 <object name="waeup_department_wf" meta_type="CPS Workflow"/> 7 8 <object name="waeup_course_wf" meta_type="CPS Workflow"/> … … 22 23 <bound-workflow workflow_id="section_folder_wf"/> 23 24 </type> 25 <type type_id="SCFolder"> 26 <bound-workflow workflow_id="section_folder_wf"/> 27 </type> 24 28 <type type_id="Faculty"> 25 29 <bound-workflow workflow_id="waeup_faculty_wf"/> … … 30 34 <type type_id="Course"> 31 35 <bound-workflow workflow_id="waeup_course_wf"/> 36 </type> 37 <type type_id="StudyCourse"> 38 <bound-workflow workflow_id="waeup_studycourse_wf"/> 32 39 </type> 33 40 <type type_id="StudentsFolder"> -
waeup_product/trunk/skins/waeup_default/temporary_view_all_form.pt
r200 r238 24 24 25 25 <br /> 26 <span tal:condition="python:context.portal_type != 'University' " tal:omit-tag="">26 <span tal:condition="python:context.portal_type != 'University' and doc.render()" tal:omit-tag=""> 27 27 <p>Exemplary view of the <strong>object's data fields</strong>: </p> 28 <tal:block tal:content="structure rendered_main|python:doc.render()" /> 28 <tal:block 29 tal:content="structure python:doc.render()" /> 29 30 </span> 30 31 <br />
Note: See TracChangeset for help on using the changeset viewer.