Changeset 452 for WAeUP_SRP/trunk


Ignore:
Timestamp:
30 Aug 2006, 12:31:46 (18 years ago)
Author:
joachim
Message:

fixed course result import,
and semester default_view for students

Location:
WAeUP_SRP/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Students.py

    r446 r452  
    198198            logger.error('Error reading %s.csv' % name)
    199199            return
    200         l = self.portal_catalog({'meta_type': "Student"})
    201         students = {}
    202         for s in l:
    203             students[s.id] = s.getObject()
     200##        l = self.portal_catalog({'meta_type': "Student"})
     201##        students = {}
     202##        for s in l:
     203##            students[s.id] = s.getObject()
    204204        l = self.portal_catalog({'meta_type': "Course"})
    205205        courses = {}
     
    208208        for result in results:
    209209            sid = result.get('Matnumber')
    210             if sid not in students.keys():
     210            res = self.portal_catalog({'meta_type': "StudentClearance",
     211                                     'matric_no': sid })
     212            if not res:
    211213                em = 'Student with ID %(Matnumber)s not found\n' % result
    212214                logger.info(em)
     
    214216                no_import.write('"%(Matnumber)s","%(CosCode)s","%(Ansbook)s","%(CosStuatus)s","%(Session)s","%(Mat_Cos)s","%(Score)s","%(CarryLevel)s","%(Grade)s","%(Weight)s","%(Semster)s","%(Verdict)s","%(Level)s","%(id)s","%(GPA)s"\n' % result)
    215217                continue
     218            sf = res[0].getObject().aq_parent
     219            print sf
    216220            course = result.get('CosCode')
    217221            if course not in courses.keys():
     
    230234                no_import.write('"%(Matnumber)s","%(CosCode)s","%(Ansbook)s","%(CosStuatus)s","%(Session)s","%(Mat_Cos)s","%(Score)s","%(CarryLevel)s","%(Grade)s","%(Weight)s","%(Semster)s","%(Verdict)s","%(Level)s","%(id)s","%(GPA)s"\n' % result)
    231235                continue
    232             sf = students.get(sid)
    233236            sc = getattr(sf,'study_course')
    234237            l = getattr(sc,level,None)
     
    238241                sc.invokeFactory('StudyLevel', level)
    239242                l = getattr(sc, level)
    240                 l.getContent().edit(mapping={'Title': "Level %s" % level})
     243                #l.getContent().edit(mapping={'Title': "Level %s" % level})
    241244                l.invokeFactory('Semester','first')
    242245                l.invokeFactory('Semester','second')
     
    249252            if snr == "2":
    250253                semester = getattr(l,'second')
    251             logger.info('Creating CourseTicket %(CourseTicket)s in Level %(Level)s for %(Matnumber)s' % result)
     254                logger.info('Creating CourseTicket %(CosCode)s in Level %(Level)s for %(Matnumber)s' % result)
    252255            semester.invokeFactory('CourseTicket',course)
    253256            ct = getattr(semester,course)
  • WAeUP_SRP/trunk/__init__.py

    r445 r452  
    44from Products.CMFCore.DirectoryView import registerDirectory
    55from Products.CMFCore import utils as cmfutils
    6 from Products.CMFCore.CMFCorePermissions import AddPortalContent
     6from Products.CMFCore.permissions import AddPortalContent
    77
    88from Products.GenericSetup import profile_registry
     
    1616
    1717import Products.WAeUP_SRP.WAeUPPermissions
    18 from Products.WAeUP_SRP.Academics import AcademicsFolder, addAcademicsFolder
    19 from Products.WAeUP_SRP.University import University, addUniversity
    20 from Products.WAeUP_SRP.Accommodation import AccoFolder, addAccoFolder
    21 from Products.WAeUP_SRP.Accommodation import Accommodation, addAccommodation
    22 from Products.WAeUP_SRP.Academics import Certificate, addCertificate
    23 from Products.WAeUP_SRP.Academics import CertificateCourse, addCertificateCourse
    24 from Products.WAeUP_SRP.Academics import Faculty, addFaculty
    25 from Products.WAeUP_SRP.Academics import Department, addDepartment
    26 from Products.WAeUP_SRP.Academics import Course, addCourse
    27 from Products.WAeUP_SRP.Academics import CourseTicket, addCourseTicket
    28 from Products.WAeUP_SRP.Academics import CertificateCourse, addCertificateCourse
    29 from Products.WAeUP_SRP.Students import StudentsFolder, addStudentsFolder
    30 from Products.WAeUP_SRP.Students import Student, addStudent
    31 from Products.WAeUP_SRP.Students import StudentStudyCourse, addStudentStudyCourse
    32 from Products.WAeUP_SRP.Students import StudentAdmission, addStudentAdmission
    33 from Products.WAeUP_SRP.Students import StudentClearance, addStudentClearance
    34 from Products.WAeUP_SRP.Students import StudentPersonal, addStudentPersonal
    35 from Products.WAeUP_SRP.Students import ScratchCardBatch, addScratchCardBatch
    36 from Products.WAeUP_SRP.Students import ScratchCardBatchesFolder, addScratchCardBatchesFolder
    37 from Products.WAeUP_SRP.Students import StudyLevel, addStudyLevel
    38 from Products.WAeUP_SRP.Students import Semester, addSemester
    39 
    4018
    4119import Widgets
    4220
    43 contentClasses = (
    44     University,
    45     AcademicsFolder,
    46     Certificate,
    47     CertificateCourse,
    48     Faculty,
    49     Department,
    50     Course,
    51     CourseTicket,
    52     CertificateCourse,
    53     AccoFolder,
    54     Accommodation,
    55     StudentsFolder,
    56     Student,
    57     StudentStudyCourse,
    58     StudentAdmission,
    59     StudentClearance,
    60     StudentPersonal,
    61     ScratchCardBatch,
    62     ScratchCardBatchesFolder,
    63     StudyLevel,
    64     Semester,
     21waeup_types = (
     22    "University.University",
     23    "Academics.AcademicsFolder",
     24    "Academics.Certificate",
     25    "Academics.CertificateCourse",
     26    "Academics.Faculty",
     27    "Academics.Department",
     28    "Academics.Course",
     29    "Academics.CourseTicket",
     30    "Academics.CertificateCourse",
     31    "Accommodation.AccoFolder",
     32    "Accommodation.Accommodation",
     33    "Students.StudentsFolder",
     34    "Students.Student",
     35    "Students.StudentStudyCourse",
     36    "Students.StudentAdmission",
     37    "Students.StudentClearance",
     38    "Students.StudentPersonal",
     39    "Students.ScratchCardBatch",
     40    "Students.ScratchCardBatchesFolder",
     41    "Students.StudyLevel",
     42    "Students.Semester",
    6543    )
    6644
    67 contentConstructors = (
    68     addUniversity,
    69     addAcademicsFolder,
    70     addCertificate,
    71     addCertificateCourse,
    72     addFaculty,
    73     addDepartment,
    74     addCourse,
    75     addCourseTicket,
    76     addCertificateCourse,
    77     addAccoFolder,
    78     addAccommodation,
    79     addStudentsFolder,
    80     addStudent,
    81     addStudentStudyCourse,
    82     addStudentAdmission,
    83     addStudentClearance,
    84     addStudentPersonal,
    85     addScratchCardBatch,
    86     addScratchCardBatchesFolder,
    87     addStudyLevel,
    88     addSemester,
    89     )
     45contentClasses = []
     46cc = []
     47for t in waeup_types:
     48    module,name = t.split('.')
     49    mod = __import__('Products.WAeUP_SRP.%(module)s' % vars(),
     50                globals(),
     51                locals(),
     52                ["%(name)s" % vars(),"add%(name)s" % vars()]
     53                )
     54    contentClasses.append(getattr(mod,name))
     55    cc.append(getattr(mod,"add%(name)s" % vars()))
     56    contentConstructors = tuple(cc)
    9057
    9158fti = [{} for t in range(len(contentConstructors))]
    92 ##fti = (
    93 ##    {}, # University
    94 ##    {}, #AcademicsFolder
    95 ##    {}, #Certificate
    96 ##    {}, #CertificateCourse
    97 ##    {}, # Faculty
    98 ##    {}, # Department
    99 ##    {}, # Course
    100 ##    {}, # CourseTicket
    101 ##    {}, # CertificateCourse
    102 ##    {}, # AccoFolder
    103 ##    {}, # Accommodation
    104 ##    {}, # StudentsFolder,
    105 ##    {}, # Student,
    106 ##    {}, # StudentStudyCourse,
    107 ##    {}, # StudentAdmission,
    108 ##    {}, # StudentClearance,
    109 ##    {}, # StudentAdmission,
    110 ##    {}, # StudentClearance,
    111 ##    {}, # StudentPersonal,
    112 ##    {}, # ScratchCardBatch,
    113 ##    {}, # ScratchCardBatchesFolder,
    114 ##    {}, # StudyLevel,
    115 ##    {}, # Semester,
    116 ##    )
    11759
    11860registerDirectory('skins', globals())
  • WAeUP_SRP/trunk/profiles/default/types/CourseTicket.xml

    r396 r452  
    1414 <property name="allow_discussion">False</property>
    1515 <property name="cps_is_searchable">True</property>
    16  <property name="cps_proxy_type">cpsdocument</property>
     16 <property name="cps_proxy_type"></property>
    1717 <property name="cps_display_as_document_in_listing">True</property>
    1818 <property name="schemas">
    19   <element value="metadata"/>
    20   <element value="common"/>
    2119  <element value="course"/>
    2220  <element value="course_results"/>
    2321 </property>
    2422 <property name="layouts">
    25   <element value="waeup_common"/>
    26   <element value="course"/>
    2723  <element value="course_results"/>
    2824 </property>
    29  <property name="layout_clusters">
    30   <element value="metadata:metadata"/>
    31  </property>
     25 <property name="layout_clusters"/>
    3226 <property name="flexible_layouts"/>
    3327 <property name="storage_methods"/>
     
    4034  <permission value="View"/>
    4135 </action>
    42  <action title="action_metadata" action_id="metadata" category="object"
    43     condition_expr="python:member and 'Manager' in member.getRoles()"
    44     url_expr="string:${object_url}/cpsdocument_metadata" visible="True"/>
    45  <action title="Delegate" action_id="localroles" category="object"
    46     condition_expr="" url_expr="string:${object_url}/folder_localrole_form"
    47     visible="False"/>
     36 <action title="action_edit" action_id="edit" category="object"
     37    condition_expr="" url_expr="string:${object_url}/cpsdocument_edit_form"
     38    visible="True">
     39  <permission value="Modify portal content"/>
     40 </action>
    4841</object>
  • WAeUP_SRP/trunk/skins/waeup_academics/academics_content_lib_info_detail_tab.pt

    r435 r452  
    130130      </td>
    131131    </span>
    132     <span tal:condition="python: context.portal_type == 'Semester'">
     132    <span tal:condition="python: info['doc'].portal_type == 'CertificateCourse'">
    133133      <td>
    134134        <span tal:content="info/core_or_elective">ID</span>
Note: See TracChangeset for help on using the changeset viewer.