Changeset 290 for WAeUP_SRP


Ignore:
Timestamp:
10 Jul 2006, 20:04:08 (18 years ago)
Author:
joachim
Message:

=add actions changed

Location:
WAeUP_SRP/trunk
Files:
1 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Academics.py

    r288 r290  
    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.getContent().temporary_view_all()
    7374    ###)
    7475
     
    8990            logger.info('dumping %s %s ' % (faculty.id, faculty.title))
    9091            print yaml.dump(faculty)
     92        return self.academics.temporary_view_all()
     93        return self.temporary_view_all()
    9194           
    9295    ###)
     
    129132                dict = {'Title': dep['Description']}
    130133                d.getContent().edit(mapping=dict)
     134        return self.academics.temporary_view_all()
     135        return self.temporary_view_all()
    131136    ###)
    132137   
     
    215220                dict['passmark'] = 0
    216221            c.getContent().edit(mapping=dict)
     222        return self.academics.temporary_view_all()
     223        return self.temporary_view_all()
    217224    ###)
    218225
    219226    security.declareProtected(ModifyPortalContent,"loadCertificatesFromCSV")###(
     227
    220228    def loadCertificatesFromCSV(self):
    221229        """install Universityspecific Certificates from CSV values"""
     
    290298            dict['probation_credits'] = certificate.get('ProbationCredits')
    291299            c.getContent().edit(mapping=dict)
     300        return self.academics.temporary_view_all()
     301        return self.temporary_view_all()
    292302    ###)
    293303
     
    297307        #return
    298308        logger = logging.getLogger('loadcertificatecourses')
     309        name = 'certificate_courses'
     310        no_import = False
    299311        try:
    300312            cert_courses = csv.DictReader(open("%s/import/course_level_courses.csv" % i_home,"rb"))
     
    303315            return
    304316        d_ids = [d.id for d in self.portal_catalog({'meta_type': "Department"})]
     317        c_ids = [c.id for c in self.portal_catalog({'meta_type': "Course"})]
    305318        for cert_course in cert_courses:
    306319            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)
    307320            depid = cert_course.get('Dept')
     321            course_code = cert_course.get('CosCode')
    308322            code = cert_course.get('CertCode')
    309323            code = code.replace('.','')
     
    313327            code = code.replace(' ','')
    314328            code = code.replace('_','')
    315             if cert_course.get('Session') != '2002/2003':
    316                 continue
     329##            if cert_course.get('Session') != '2002/2003':
     330##                continue
    317331            certificate = self.portal_catalog({'meta_type': "Certificate",
    318332                                               'SearchableText': code})
    319333            if not certificate:
    320                 print code
    321                 logger.info('CertCode %(CertCode)s for %(CosCode)s not found' % cert_course)
     334                #print code
     335                em = 'CertCode %(CertCode)s for %(CosCode)s not found\n' % cert_course
     336                logger.info(em)
     337                if not no_import:
     338                    no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
     339                    no_import.write('"CosCode","CertCode","CoreKey","Session","Level","Core","Elective","Mandatory","AdmStatus","Dept","Semester"\n')
     340                no_import.write(em)
     341                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)
    322342                continue
    323343            certificate = certificate[-1].getObject()
    324344            certificate_code = certificate.getId()
     345            if course_code not in c_ids:
     346                em = 'CorseCode %(CosCode)s for %(CertCode)s not found in Courses\n' % cert_course
     347                logger.info(em)
     348                if not no_import:
     349                    no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
     350                    no_import.write('"CosCode","CertCode","CoreKey","Session","Level","Core","Elective","Mandatory","AdmStatus","Dept","Semester"\n')
     351                no_import.write(em)
     352                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                continue
    325354            if depid not in d_ids:
    326                 logger.info('Department %(Dept)s for %(CertCode)s not found' % cert_course)
    327                 continue
    328             course_code = cert_course.get('CosCode')
     355                em = 'Department %(Dept)s for %(CertCode)s not found\n' % cert_course
     356                logger.info(em)
     357                if not no_import:
     358                    no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
     359                    no_import.write('"CosCode","CertCode","CoreKey","Session","Level","Core","Elective","Mandatory","AdmStatus","Dept","Semester"\n')
     360                no_import.write(em)
     361                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)
     362                continue
    329363            level = cert_course.get('Level')
    330364            l = getattr(certificate,level,None)
     
    336370                l.invokeFactory('Semester','first')
    337371                l.invokeFactory('Semester','second')
     372            certificate.orderObjects('id')
    338373            first_s = getattr(l,'first')
    339374            second_s = getattr(l,'second')
     
    344379            if hasattr(semester,course_code):
    345380                logger.info('Duplicate %(CosCode)s in Level %(Level)s' % cert_course)
    346                 continue
    347                
     381                if not no_import:
     382                    no_import = open("%s/import/%s_not_imported.csv" % (i_home,name),"w")
     383                    no_import.write('"CosCode","CertCode","CoreKey","Session","Level","Core","Elective","Mandatory","AdmStatus","Dept","Semester"\n')
     384                no_import.write('Duplicate %(CosCode)s in Level %(Level)s' % cert_course)
     385                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)
     386                continue
    348387            semester.invokeFactory('CertificateCourse',course_code)
    349388            cc = getattr(semester,course_code)
     
    360399                dict['core_or_elective'] = False
    361400            dict['level'] = cert_course.get('Level')
    362             cc.getContent().edit(mapping=dict)
     401            cc.academics.edit(mapping=dict)
    363402    ###)
    364403
     
    433472        """passmark from course"""
    434473        ce = self.getCourseEntry(self.id)
    435         if ce:
    436             return "%s" % ce.passmark.split(',')[0]
    437         return "0"
    438 
     474        return ce.passmark
     475   
    439476    security.declareProtected(View,"coursepath")
    440477    def coursepath(self):
  • WAeUP_SRP/trunk/profiles/default/layouts/faculty.xml

    r199 r290  
    2828  <property name="size_max">200</property>
    2929 </widget>
     30 <widget name="institution_type" meta_type="Select Widget">
     31  <property name="title">Type of Institution</property>
     32  <property name="fields">
     33   <element value="institution_type"/>
     34  </property>
     35  <property name="label">Type of Institution</property>
     36  <property name="label_edit">Type of Institution</property>
     37  <property name="readonly_layout_modes"/>
     38  <property name="hidden_layout_modes"/>
     39  <property name="hidden_readonly_layout_modes"/>
     40  <property name="vocabulary">institution_types_voc</property>
     41 </widget>
    3042 <table>
    3143  <row>
    3244   <cell name="Title"/>
     45  </row>
     46  <row>
     47   <cell name="institution_type"/>
    3348  </row>
    3449  <row>
  • WAeUP_SRP/trunk/profiles/default/schemas/faculty.xml

    r199 r290  
    11<?xml version="1.0"?>
    2 <object name="faculty" meta_type="CPS Schema"/>
     2<object name="faculty" meta_type="CPS Schema">
     3 <field name="institution_type" meta_type="CPS String Field"/>
     4</object>
  • WAeUP_SRP/trunk/profiles/default/types/AcademicsFolder.xml

    r279 r290  
    4343 <action title="Add Faculty" action_id="add_faculty" category="object"
    4444    condition_expr="python:True or member and 'UniversityManager'in member.getRoles()"
    45     url_expr="string:${object/absolute_url}/create_common?type_name=Faculty"
     45    url_expr="string:${object/absolute_url}/content_create?type_name=Faculty"
    4646    visible="True"/>
    4747 <action title="action_folder_contents" action_id="contents" category="object"
  • WAeUP_SRP/trunk/profiles/default/types/Department.xml

    r274 r290  
    4343    condition_expr="python:member and 'Manager' in member.getRoles()"
    4444    url_expr="string:${object_url}/cpsdocument_edit_form" visible="True">
    45   <permission value="Modify portal content"/>
     45  <permission value=""/>
    4646 </action>
    4747 <action title="Add Course" action_id="create_course" category="object"
    48     condition_expr="" url_expr="string:${object/absolute_url}/create_course"
     48    condition_expr="" url_expr="string:${object/absolute_url}/content_create?type_name=Course"
    4949    visible="True">
    50   <permission value="University Manage"/>
     50  <permission value=""/>
     51 </action>
     52 <action title="Add Certificate" action_id="create_certificate" category="object"
     53    condition_expr="" url_expr="string:${object/absolute_url}/content_create?type_name=Certificate"
     54    visible="True">
    5155 </action>
    5256 <action title="action_folder_contents" action_id="contents" category="object"
    5357    condition_expr="python:member and 'Manager' in member.getRoles()"
    5458    url_expr="string:${object_url}/folder_contents" visible="True">
    55   <permission value="Modify portal content"/>
     59  <permission value=""/>
    5660 </action>
    5761 <action title="action_metadata" action_id="metadata" category="object"
  • WAeUP_SRP/trunk/profiles/default/types/Faculty.xml

    r274 r290  
    4545 </action>
    4646 <action title="Add Department" action_id="add_department" category="object"
     47    url_expr="string:${object/absolute_url}/content_create?type_name=Department"
    4748    condition_expr=""
    48     url_expr="string:${object/absolute_url}/create_common?type_name=Department"
    4949    visible="True">
    50   <permission value="University Manage"/>
     50  <permission value=""/>
    5151 </action>
    5252 <action title="action_folder_contents" action_id="contents" category="object"
    5353    condition_expr="" url_expr="string:${object_url}/folder_contents"
    5454    visible="False">
    55   <permission value="University Manage"/>
     55  <permission value=""/>
    5656 </action>
    5757 <action title="action_metadata" action_id="metadata" category="object"
     
    6565  <permission value="Modify portal content"/>
    6666 </action>
    67  <action title="Add Faculty" action_id="add_faculty" category="object"
    68     condition_expr="python:member and 'UniversityManager'in member.getRoles()"
    69     url_expr="string:${object/absolute_url}/create_common?type_name=Faculty"
    70     visible="True">
    71   <permission value="University Manage"/>
    72  </action>
    7367</object>
  • WAeUP_SRP/trunk/profiles/default/vocabularies.xml

    r238 r290  
    44 <object name="courselevel" meta_type="CPS Vocabulary"/>
    55 <object name="faculties" meta_type="CPS Vocabulary"/>
     6 <object name="institution_types_voc" meta_type="CPS Vocabulary"/>
    67 <object name="get_departments_voc" meta_type="CPS Method Vocabulary"/>
    78 <object name="get_faculties_voc" meta_type="CPS Method Vocabulary"/>
  • WAeUP_SRP/trunk/profiles/default/workflows.xml

    r282 r290  
    5656  </type>
    5757  <type type_id="CourseTicket">
    58    <bound-workflow workflow_id="waeup_student_wf"/>
     58   <bound-workflow workflow_id="waeup_base_wf"/>
    5959  </type>
    6060  <type type_id="Department">
     
    7777  </type>
    7878  <type type_id="Semester">
    79    <bound-workflow workflow_id="waeup_student_wf"/>
     79   <bound-workflow workflow_id="waeup_base_wf"/>
    8080  </type>
    8181  <type type_id="Student">
  • WAeUP_SRP/trunk/skins/waeup_academics/certificate_view.py

    r280 r290  
    1111request = context.REQUEST
    1212url0 = request.get('URL0')
    13 cc = context.contentValues()
    14 
    15 cc.sort()
    16 return context.certificate_view_form(cc=cc)
     13return context.certificate_view_form()
  • WAeUP_SRP/trunk/skins/waeup_academics/certificate_view_form.pt

    r280 r290  
    1515               frontend python:'Student' in roles or isAnon;
    1616               folder here/getContent;
    17                items options/cc;"
     17               items here/contentValues"
    1818               >
    1919    <h1> <span tal:content="context/title_or_id" /></h1>     
  • WAeUP_SRP/trunk/skins/waeup_default/create_common.py

    r103 r290  
    1616
    1717res,psm,ds = lt.renderLayout(layout_id= type_name.lower(),
    18                       schema_id= 'metadata',
     18                      schema_id= type_name.lower(),
    1919                      context=context,
    2020                      mapping=validate and REQUEST,
  • WAeUP_SRP/trunk/skins/waeup_default/getCreatableItems.py

    r288 r290  
    1212base_url = utool.getBaseUrl()
    1313
    14 if context.getPortalTypeName() == 'Portal':
    15     return items
     14##if context.getPortalTypeName() == 'Portal':
     15##    return items
    1616
    1717content_types = context.getSortedContentTypes(allowed=1)
  • WAeUP_SRP/trunk/skins/waeup_default/layout_waeup_create.pt

    r96 r290  
    11<tal:block define="global creation python:1" />
    2 <metal:block use-macro="here/waeup_layout_lib/macros/common_edit" />
     2<metal:block use-macro="here/layout_lib_default_edit/macros/default_edit" />
  • WAeUP_SRP/trunk/skins/waeup_default/layout_waeup_edit.pt

    r86 r290  
    1 <metal:block use-macro="here/waeup_layout_lib/macros/default_edit" />
     1<metal:block use-macro="here/layout_lib_default_edit/macros/default_edit" />
  • WAeUP_SRP/trunk/skins/waeup_default/temporary_view_all.py

    r289 r290  
    55"""
    66
    7 member = context.portal_membership.getAuthenticatedMember()
    8 uname = str(member)
    9 roles = member.getRoles()
    10 cat = context.portal_catalog
    11 request = context.REQUEST
    12 url0 = request.get('URL0')
    13 #return context.temporary_view_all_form(psm=psm)
    14 if context.portal_membership.isAnonymousUser():
    15     if not url0.endswith('chat'):
    16         return context.students.student_view_all_form(psm=psm)
    17     return context.Chat()
    18 else:
    19     return context.temporary_view_all_form(psm=psm)
    20     if url0.find(uname) > 0 or 'DepartmentManager' in roles or 'Manager' in roles:
    21         return context.temporary_view_all_form(psm=psm)
    22     elif 'Student' in roles and 'StudentManager' not in roles:
    23         res = cat(pathindex="/portal/sections/students/%s" % uname)
    24         for r in res:
    25             if r.getPath().endswith("students/%s" % uname):
    26                 return r.getObject().student_view_student_form(psm=psm)
    27         return context.students.student_view_all_form(psm=psm)
     7return context.temporary_view_all_form(psm=psm)
     8##member = context.portal_membership.getAuthenticatedMember()
     9##uname = str(member)
     10##roles = member.getRoles()
     11##cat = context.portal_catalog
     12##request = context.REQUEST
     13##url0 = request.get('URL0')
     14##if context.portal_membership.isAnonymousUser():
     15##    if not url0.endswith('chat'):
     16##        return context.students.student_view_all_form(psm=psm)
     17##    return context.Chat()
     18##else:
     19##    if url0.find(uname) > 0 or 'DepartmentManager' in roles or 'Manager' in roles:
     20##        return context.temporary_view_all_form(psm=psm)
     21##    elif 'Student' in roles and 'StudentManager' not in roles:
     22##        res = cat(pathindex="/portal/sections/students/%s" % uname)
     23##        for r in res:
     24##            if r.getPath().endswith("students/%s" % uname):
     25##                return r.getObject().student_view_student_form(psm=psm)
     26##        return context.students.student_view_all_form(psm=psm)
Note: See TracChangeset for help on using the changeset viewer.