Changeset 296


Ignore:
Timestamp:
14 Jul 2006, 13:52:50 (18 years ago)
Author:
joachim
Message:

=backoffice enhencements

Location:
WAeUP_SRP/trunk
Files:
5 added
9 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Academics.py

    r295 r296  
    7171                logger.info('Faculty with ID %(FacultyCode)s %(Description)s already exists' % faculty)
    7272                no_import.write('"%(Session)s","%(FacultyCode)s","%(Description)s","%(CollegeCode)s","%(FacultyKey)s","%(Status)s","%(degree_grade)s","%(Bankcode)s"\n' % faculty)
    73         return self.academics.temporary_view_all()
    74         return self.getContent().temporary_view_all()
     73        return self.academics.academics_contents()
    7574    ###)
    7675
     
    140139                    dict = {'Title': 'Certificates'}
    141140                    certificates.getContent().edit(mapping=dict)
    142         return self.academics.temporary_view_all()
    143         return self.temporary_view_all()
     141        return self.academics.academics_contents()
    144142    ###)
    145143   
     
    167165        course_list = [ c.id for c in cl]
    168166        for course in courses:
    169             logger.info('Processing %(CourseCode)s %(Description)s %(Credits)s %(Dept)s %(Semester)s %(Session)s %(PassMark)s %(CourseKey)s %(Category)s %(AdmStatus)s' % course)
     167            logger.info('Processing %(CourseCode)s %(Description)s %(Credits)s %(Dept)s %(Semester)s %(Session)s %(PassMark)s %(Category)s %(AdmStatus)s' % course)
    170168##            if course.get("FORMERCODE").endswith('BITS'):
    171169##                continue
     
    179177                if not no_import:
    180178                    no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
    181                     no_import.write('"CourseCode","Description","Credits","Dept","Semester","Session","PassMark","CourseKey","Category","AdmStatus"\n')
     179                    no_import.write('"CourseCode","Description","Credits","Dept","Semester","Session","PassMark","Category","AdmStatus"\n')
    182180                no_import.write("Dep %(Dept)s for Course %(CourseCode)s not found\n" % course)
    183                 no_import.write('"%(CourseCode)s","%(Description)s","%(Credits)s","%(Dept)s","%(Semester)s","%(Session)s","%(PassMark)s","%(CourseKey)s","%(Category)s","%(AdmStatus)s"\n' % course)
     181                no_import.write('"%(CourseCode)s","%(Description)s","%(Credits)s","%(Dept)s","%(Semester)s","%(Session)s","%(PassMark)s","%(Category)s","%(AdmStatus)s"\n' % course)
    184182                continue
    185183            course_id = ''.join(re.split('\W+',course.get('CourseCode')))
     
    198196##                logger.info("invalid course_code %(course_id)s renaming to %(tid)s" % vars())
    199197##                course_id = tid
    200             elif len(course_id) > 7:
     198            elif len(course_id) > 10:
    201199                logger.info("invalid course_code %(CourseCode)s" % course)
    202200                if not no_import:
    203201                    no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
    204                     no_import.write('"CourseCode","Description","Credits","Dept","Semester","Session","PassMark","CourseKey","Category","AdmStatus"\n')
     202                    no_import.write('"CourseCode","Description","Credits","Dept","Semester","Session","PassMark","Category","AdmStatus"\n')
    205203                no_import.write("invalid course_code %(CourseCode)s\n" % course)
    206                 no_import.write('"%(CourseCode)s","%(Description)s","%(Credits)s","%(Dept)s","%(Semester)s","%(Session)s","%(PassMark)s","%(CourseKey)s","%(Category)s","%(AdmStatus)s"\n' % course)
     204                no_import.write('"%(CourseCode)s","%(Description)s","%(Credits)s","%(Dept)s","%(Semester)s","%(Session)s","%(PassMark)s","%(Category)s","%(AdmStatus)s"\n' % course)
    207205                continue
    208206            courses = dept.Courses
     
    229227                dict['passmark'] = 0
    230228            c.getContent().edit(mapping=dict)
    231         return self.academics.temporary_view_all()
    232         return self.temporary_view_all()
     229        return self.academics.academics_contents()
    233230    ###)
    234231
     
    272269                no_import.write('"%(CertCode)s","%(Description)s","%(Faculty)s","%(MaxPass)s","%(MaxLoad)s","%(session)s","%(PromotionCredits)s","%(Probationcredits)s","%(StartLevel)s","%(endLevel)s","%(Nyears)s","%(Ncore)s","%(MaxElect)s","%(MPREFIX)s","%(Dept)s","%(Admstatus)s","%(category)s"\n' % certificate)
    273270                continue
    274             certificate_id = "%(category)s_%(Admstatus)s_%(Dept)s" % certificate
     271            #certificate_id = "%(category)s_%(Admstatus)s_%(Dept)s" % certificate
    275272            dep = deps[depid]
    276273            certificates = dep.Certificates
     274            code = certificate.get('CertCode')
     275            code = code.replace('.','')
     276            code = code.replace('(','')
     277            code = code.replace(')','')
     278            code = code.replace('/','')
     279            code = code.replace(' ','')
     280            code = code.replace('_','')
     281            certificate_id = code
    277282            c = getattr(certificates,certificate_id,None)
    278283            if c is None:
     
    282287                c = getattr(certificates,certificate_id)
    283288            dict = {'Title': certificate['Description']}
    284             code = certificate.get('CertCode')
    285             code = code.replace('.','')
    286             code = code.replace('(','')
    287             code = code.replace(')','')
    288             code = code.replace('/','')
    289             code = code.replace(' ','')
    290             code = code.replace('_','')
    291289            dict['code'] = code
    292290            dict['faculty'] = certificate.get('Faculty')
     
    308306            dict['probation_credits'] = certificate.get('ProbationCredits')
    309307            c.getContent().edit(mapping=dict)
    310         return self.academics.temporary_view_all()
    311         return self.temporary_view_all()
     308        return self.academics.academics_contents()
    312309    ###)
    313310
     
    326323        d_ids = [d.id for d in self.portal_catalog({'meta_type': "Department"})]
    327324        c_ids = [c.id for c in self.portal_catalog({'meta_type': "Course"})]
     325        l = self.portal_catalog({'meta_type': "Certificate"})
     326        certs = {}
     327        for f in l:
     328            certs[f.id] = f.getObject()
    328329        for cert_course in cert_courses:
    329             logger.info('Processing %(CosCode)s %(CertCode)s %(CoreKey)s %(Session)s %(Level)s %(Core)s %(Elective)s %(Mandatory)s %(AdmStatus)s %(Dept)s %(Semester)s' % cert_course)
     330            logger.info('Processing %(CosCode)s %(CertCode)s %(Session)s %(Level)s %(Core)s %(Elective)s %(Mandatory)s %(AdmStatus)s %(Dept)s %(Semester)s' % cert_course)
    330331            depid = cert_course.get('Dept')
    331332            course_code = cert_course.get('CosCode')
     
    339340##            if cert_course.get('Session') != '2002/2003':
    340341##                continue
    341             certificate = self.portal_catalog({'meta_type': "Certificate",
    342                                                'SearchableText': code})
    343             if not certificate:
     342##            certificate = self.portal_catalog({'meta_type': "Certificate",
     343##                                               'SearchableText': code})
     344##            if not certificate:
     345            if not code in certs.keys():
    344346                #print code
    345347                em = 'CertCode %(CertCode)s for %(CosCode)s not found\n' % cert_course
     
    347349                if not no_import:
    348350                    no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
    349                     no_import.write('"CosCode","CertCode","CoreKey","Session","Level","Core","Elective","Mandatory","AdmStatus","Dept","Semester"\n')
     351                    no_import.write('"CosCode","CertCode","Session","Level","Core","Elective","Mandatory","AdmStatus","Dept","Semester"\n')
    350352                no_import.write(em)
    351                 no_import.write('"%(CosCode)s","%(CertCode)s","%(CoreKey)s","%(Session)s","%(Level)s","%(Core)s","%(Elective)s","%(Mandatory)s","%(AdmStatus)s","%(Dept)s","%(Semester)s"\n' % cert_course)
     353                no_import.write('"%(CosCode)s","%(CertCode)s","%(Session)s","%(Level)s","%(Core)s","%(Elective)s","%(Mandatory)s","%(AdmStatus)s","%(Dept)s","%(Semester)s"\n' % cert_course)
    352354                continue
    353355            certificate = certificate[-1].getObject()
     
    358360                if not no_import:
    359361                    no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
    360                     no_import.write('"CosCode","CertCode","CoreKey","Session","Level","Core","Elective","Mandatory","AdmStatus","Dept","Semester"\n')
     362                    no_import.write('"CosCode","CertCode","Session","Level","Core","Elective","Mandatory","AdmStatus","Dept","Semester"\n')
    361363                no_import.write(em)
    362                 no_import.write('"%(CosCode)s","%(CertCode)s","%(CoreKey)s","%(Session)s","%(Level)s","%(Core)s","%(Elective)s","%(Mandatory)s","%(AdmStatus)s","%(Dept)s","%(Semester)s"\n' % cert_course)
     364                no_import.write('"%(CosCode)s","%(CertCode)s","%(Session)s","%(Level)s","%(Core)s","%(Elective)s","%(Mandatory)s","%(AdmStatus)s","%(Dept)s","%(Semester)s"\n' % cert_course)
    363365                continue
    364366            if depid not in d_ids:
     
    367369                if not no_import:
    368370                    no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
    369                     no_import.write('"CosCode","CertCode","CoreKey","Session","Level","Core","Elective","Mandatory","AdmStatus","Dept","Semester"\n')
     371                    no_import.write('"CosCode","CertCode","Session","Level","Core","Elective","Mandatory","AdmStatus","Dept","Semester"\n')
    370372                no_import.write(em)
    371                 no_import.write('"%(CosCode)s","%(CertCode)s","%(CoreKey)s","%(Session)s","%(Level)s","%(Core)s","%(Elective)s","%(Mandatory)s","%(AdmStatus)s","%(Dept)s","%(Semester)s"\n' % cert_course)
     373                no_import.write('"%(CosCode)s","%(CertCode)s","%(Session)s","%(Level)s","%(Core)s","%(Elective)s","%(Mandatory)s","%(AdmStatus)s","%(Dept)s","%(Semester)s"\n' % cert_course)
    372374                continue
    373375            level = cert_course.get('Level')
     
    391393                if not no_import:
    392394                    no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
    393                     no_import.write('"CosCode","CertCode","CoreKey","Session","Level","Core","Elective","Mandatory","AdmStatus","Dept","Semester"\n')
     395                    no_import.write('"CosCode","CertCode","Session","Level","Core","Elective","Mandatory","AdmStatus","Dept","Semester"\n')
    394396##                no_import.write('Duplicate %(CosCode)s in Level %(Level)s' % cert_course)
    395 ##                no_import.write('"%(CosCode)s","%(CertCode)s","%(CoreKey)s","%(Session)s","%(Level)s","%(Core)s","%(Elective)s","%(Mandatory)s","%(AdmStatus)s","%(Dept)s","%(Semester)s"\n' % cert_course)
     397##                no_import.write('"%(CosCode)s","%(CertCode)s","%(Session)s","%(Level)s","%(Core)s","%(Elective)s","%(Mandatory)s","%(AdmStatus)s","%(Dept)s","%(Semester)s"\n' % cert_course)
    396398                continue
    397399            semester.invokeFactory('CertificateCourse',course_code)
     
    410412            dict['level'] = cert_course.get('Level')
    411413            cc.getContent().edit(mapping=dict)
    412         return self.academics.temporary_view_all()
     414        return self.academics.academics_contents()
    413415    ###)
    414416
     
    483485        """passmark from course"""
    484486        ce = self.getCourseEntry(self.id)
    485         return ce.passmark
     487        if ce is not None and hasattr(ce,"passmark"):
     488            return ce.passmark
     489       
    486490   
    487491    security.declareProtected(View,"coursepath")
     
    517521        """compose title"""
    518522        return "%s" % (self.title)
     523   
     524    security.declareProtected(View,"LongTitle")
     525    def LongTitle(self):
     526        """compose long_title"""
     527        itype = self.portal_vocabularies.institution_types_voc.get(self.institution_type,default="Faculty of")
     528       
     529        return "%s %s" % (itype,self.title)
    519530
    520531InitializeClass(Faculty)
     
    541552##        return "Department of %s" % (self.title)
    542553
     554    security.declareProtected(View,"LongTitle")
     555    def LongTitle(self):
     556        """compose long_title"""
     557        if not hasattr(self,'institution_type'):
     558            self.institution_type = "department"
     559        itype = self.portal_vocabularies.institution_types_voc.get(self.institution_type,default="Department of")
     560       
     561        return "%s %s" % (itype,self.title)
     562
    543563InitializeClass(Department)
    544564
    545565def addDepartment(container, id, REQUEST=None, **kw):
    546566    """Add a Department."""
    547     ob = Department(id, **kw)
     567    object = Department(id, **kw)
    548568    id = object.getId()
    549569    container._setObject(id, object)
    550     dep = getattr(container,id)
     570    dep = getattr(container,id).getContent()
    551571    dep.invokeFactory('CoursesFolder','Courses')
     572    o = getattr(dep,'Courses')
     573    dict = {'Title': 'Courses'}
     574    o.getContent().edit(mapping=dict)
    552575    dep.invokeFactory('CertificatesFolder','Certificates')
     576    o = getattr(dep,'Certificates')
     577    dict = {'Title': 'Certificates'}
     578    o.getContent().edit(mapping=dict)
    553579    if REQUEST is not None:
    554580        url = container.absolute_url()
  • WAeUP_SRP/trunk/profiles/default/schemas.xml

    r256 r296  
    1010 <object name="department" meta_type="CPS Schema"/>
    1111 <object name="faculty" meta_type="CPS Schema"/>
     12 <object name="faculty_row" meta_type="CPS Schema"/>
    1213 <object name="jamb" meta_type="CPS Schema"/>
    1314 <object name="semester" meta_type="CPS Schema"/>
  • WAeUP_SRP/trunk/profiles/default/types/AcademicsFolder.xml

    r290 r296  
    88 <property name="product">WAeUP_SRP</property>
    99 <property name="factory">addAcademicsFolder</property>
    10  <property name="immediate_view">folder_view</property>
     10 <property name="immediate_view">academics_contents</property>
    1111 <property name="global_allow">True</property>
    1212 <property name="filter_content_types">True</property>
     
    3434 <property name="storage_methods"/>
    3535 <property name="cps_is_portlet">False</property>
    36  <alias from="(Default)" to="temporary_view_all"/>
    37  <alias from="view" to="temporary_view_all"/>
    38  <action title="Standard View" action_id="view" category="object"
    39     condition_expr="" url_expr="string:${object_url}/temporary_view_all"
     36 <alias from="(Default)" to="academics_contents"/>
     37 <alias from="view" to="academics_contents"/>
     38 <action title="View" action_id="academics_view" category="object"
     39    condition_expr="" url_expr="string:${object_url}/academics_contents"
    4040    visible="True">
    4141  <permission value="View"/>
     
    4747 <action title="action_folder_contents" action_id="contents" category="object"
    4848    condition_expr="" url_expr="string:${object/absolute_url}/folder_contents"
    49     visible="True"/>
     49    visible="False"/>
    5050 <action title="delegate" action_id="localroles" category="object"
    5151    condition_expr="" url_expr="string:${object_url}/folder_localrole_form"
  • WAeUP_SRP/trunk/profiles/default/types/Department.xml

    r295 r296  
    88 <property name="product">WAeUP_SRP</property>
    99 <property name="factory">addDepartment</property>
    10  <property name="immediate_view">folder_view</property>
     10 <property name="immediate_view">academics_contents</property>
    1111 <property name="global_allow">True</property>
    1212 <property name="filter_content_types">True</property>
     
    3333 <property name="storage_methods"/>
    3434 <property name="cps_is_portlet">False</property>
    35  <alias from="(Default)" to="temporary_view_all"/>
    36  <alias from="view" to="temporary_view_all"/>
    37  <action title="Standard View" action_id="view" category="object"
    38     condition_expr="" url_expr="string:${object_url}/temporary_view_all"
    39     visible="True">
     35 <alias from="(Default)" to="academics_contents"/>
     36 <alias from="view" to="academics_contents"/>
     37 <action title="View" action_id="view" category="object" condition_expr=""
     38    url_expr="string:${object_url}/academics_contents" visible="True">
    4039  <permission value="View"/>
    4140 </action>
     
    5352 <action title="action_folder_contents" action_id="contents" category="object"
    5453    condition_expr="python:member and 'Manager' in member.getRoles()"
    55     url_expr="string:${object_url}/folder_contents" visible="True"/>
     54    url_expr="string:${object_url}/folder_contents" visible="False"/>
    5655 <action title="action_metadata" action_id="metadata" category="object"
    5756    condition_expr="python:member and 'Manager' in member.getRoles()"
    58     url_expr="string:${object_url}/cpsdocument_metadata" visible="True">
     57    url_expr="string:${object_url}/cpsdocument_metadata" visible="False">
    5958  <permission value="Modify portal content"/>
    6059 </action>
    6160 <action title="delegate" action_id="localroles" category="object"
    6261    condition_expr="" url_expr="string:${object_url}/folder_localrole_form"
    63     visible="False">
     62    visible="True">
    6463  <permission value="Modify portal content"/>
    6564 </action>
  • WAeUP_SRP/trunk/profiles/default/types/Faculty.xml

    r290 r296  
    1 <?xml version="1.0"?>
    2 <object name="Faculty" meta_type="CPS Flexible Type Information"
    3    xmlns:i18n="http://xml.zope.org/namespaces/i18n">
    4  <property name="title">WAeUP Faculty</property>
    5  <property name="description"></property>
    6  <property name="content_icon"></property>
    7  <property name="content_meta_type">Faculty</property>
    8  <property name="product">WAeUP_SRP</property>
    9  <property name="factory">addFaculty</property>
    10  <property name="immediate_view">folder_view</property>
    11  <property name="global_allow">True</property>
    12  <property name="filter_content_types">True</property>
    13  <property name="allowed_content_types">
    14   <element value="Department"/>
    15  </property>
    16  <property name="allow_discussion">False</property>
    17  <property name="cps_is_searchable">True</property>
    18  <property name="cps_proxy_type">btreefolderishdocument</property>
    19  <property name="cps_display_as_document_in_listing">True</property>
    20  <property name="schemas">
    21   <element value="metadata"/>
    22   <element value="common"/>
    23   <element value="faculty"/>
    24  </property>
    25  <property name="layouts">
    26   <element value="faculty"/>
    27  </property>
    28  <property name="layout_clusters">
    29   <element value="metadata:metadata"/>
    30  </property>
    31  <property name="flexible_layouts"/>
    32  <property name="storage_methods"/>
    33  <property name="cps_is_portlet">False</property>
    34  <alias from="(Default)" to="temporary_view_all"/>
    35  <alias from="view" to="temporary_view_all"/>
    36  <action title="Standard View" action_id="view" category="object"
    37     condition_expr="" url_expr="string:${object_url}/temporary_view_all"
    38     visible="True">
    39   <permission value="View"/>
    40  </action>
    41  <action title="action_edit" action_id="edit" category="object"
    42     condition_expr="python:member and 'Manager' in member.getRoles()"
    43     url_expr="string:${object_url}/cpsdocument_edit_form" visible="True">
    44   <permission value="Modify portal content"/>
    45  </action>
    46  <action title="Add Department" action_id="add_department" category="object"
    47     url_expr="string:${object/absolute_url}/content_create?type_name=Department"
    48     condition_expr=""
    49     visible="True">
    50   <permission value=""/>
    51  </action>
    52  <action title="action_folder_contents" action_id="contents" category="object"
    53     condition_expr="" url_expr="string:${object_url}/folder_contents"
    54     visible="False">
    55   <permission value=""/>
    56  </action>
    57  <action title="action_metadata" action_id="metadata" category="object"
    58     condition_expr="python:member and 'Manager' in member.getRoles()"
    59     url_expr="string:${object_url}/cpsdocument_metadata" visible="True">
    60   <permission value="Modify portal content"/>
    61  </action>
    62  <action title="delegate" action_id="localroles" category="object"
    63     condition_expr="" url_expr="string:${object_url}/folder_localrole_form"
    64     visible="False">
    65   <permission value="Modify portal content"/>
    66  </action>
    67 </object>
  • WAeUP_SRP/trunk/profiles/default/types/StudentsFolder.xml

    r200 r296  
    66 <property name="content_icon">students_folder.gif</property>
    77 <property name="content_meta_type">StudentsFolder</property>
    8  <property name="product">CPSDefault</property>
    9  <property name="factory">addFolder</property>
     8 <property name="product">WAeUP_SRP</property>
     9 <property name="factory">addStudentsFolder</property>
    1010 <property name="immediate_view">folder_view</property>
    1111 <property name="global_allow">True</property>
  • WAeUP_SRP/trunk/skins/waeup_academics/academics_view.py

    r295 r296  
    2828#return res
    2929
    30 if 1 or psm == 'invalid':
     30if True:# or psm == 'invalid':
    3131    return context.academics_view_form(rendered = res,
    3232                                 psm = 'Please correct your errors',
  • WAeUP_SRP/trunk/skins/waeup_academics/academics_view_form.pt

    r295 r296  
    1212  <metal:block fill-slot="main"
    1313               tal:define="roles member/getRoles;
    14                backend python:'UniversityManager' in roles or 'StudentManager' in roles;
    15                frontend python:'Student' in roles or isAnon;
    1614               folder here/getContent;
    1715               items here/contentValues;
    18                rendered options;"
     16               rend options/rendered;"
    1917               >
    2018    <h1> <span tal:content="context/title_or_id" /></h1>     
     
    2321 
    2422    <p>The Faculties:</p>
    25 <span tal:replace="structure rendered" /> 
     23<span tal:replace="structure rend" /> 
    2624  </metal:block>
    2725  <metal:block fill-slot="sub">
  • WAeUP_SRP/trunk/skins/waeup_default/layout_row_edit.pt

    r295 r296  
    2828        <table width="100%" cellpadding="2" cellspacing="2" summary="Form layout">
    2929          <tr tal:repeat="row layout/rows" valign="top">
    30             <td tal:repeat="cell row"
     30            <td tal:repeat="cell row" 
    3131                tal:attributes="colspan cell/ncols">
    3232              <tal:block define="widget cell/widget;
Note: See TracChangeset for help on using the changeset viewer.