Changeset 2614 for WAeUP_SRP/base


Ignore:
Timestamp:
9 Nov 2007, 21:30:03 (17 years ago)
Author:
Henrik Bettermann
Message:

display semesters seperately: first, second and combined

Location:
WAeUP_SRP/base
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/WAeUPTables.py

    r2606 r2614  
    13701370            id = code = d['id'] = brain.code
    13711371            d['code'] = code
    1372             d['title'] = self.courses_catalog.evalAdvancedQuery(Eq('code',code))[0].title
     1372            course = self.courses_catalog.evalAdvancedQuery(Eq('code',code))[0]
     1373            d['title'] = course.title
     1374
     1375            # The courses_catalog contains strings and integers in its semester field.
     1376            # Maybe this can be fixed by reindexing the catalog. The schema of course says 'CPS Int Field'.
     1377            d['semester'] = str(course.semester)
    13731378            if brain.carry_over:
    13741379                d['coe'] = 'Carry-Over'
    13751380                carry_overs.append(d)
    13761381            else:
    1377                 if brain.semester == '1':
     1382                if d['semester'] == '1':
    13781383                    normal1.append(d)
    1379                 elif brain.semester == '2':
     1384
     1385                elif d['semester'] == '2':
    13801386                    normal2.append(d)
    13811387                else:
  • WAeUP_SRP/base/skins/waeup_academics/getLevelInfo.py

    r2609 r2614  
    3232info['choosen_ids'] = request.get('ids',[])
    3333info['doc'] = context.getContent()
    34 # brain = context.portal_catalog(meta_type="Certificate",id = cert_id)[-1]
    35 # cp = brain.getPath()
    36 # info['container_path'] = cp
    3734info['dep_id'] = dep_id
    3835info['cert_id'] = cert_id
    3936
    40 # res = context.portal_catalog(meta_type="CertificateCourse", container_path="%s/%s" % (cp,level_id))
    41 # first = []
    42 # second = []
    43 # for r in res:
    44 #     row = {}
    45 #     ro = r.getObject()
    46 #     rd = ro.getContent()
    47 #     course_id = r.getId
    48 #     row = context.getCourseInfo(course_id)
    49 #     row['id'] = course_id
    50 #     # row['title'] = rd.Title()
    51 #     # row['semester'] = rd.semester
    52 #     row['core'] = rd.core_or_elective
    53 #     row['url'] = ro.absolute_url()
    54 #     row['review_state'] = wf.getInfoFor(ro,'review_state','None')
    55 #     editable = row['is_editable'] = mtool.checkPermission('Modify portal content', ro)
    56 #     if editable:
    57 #         row['real_course_path'] = "%s/%s/%s/courses/%s" % (academics_path,
    58 #                                                            row['faculty'],
    59 #                                                            row['department'],
    60 #                                                            course_id)
    61 #     if row['semester'] == 1:
    62 #         first.append(row)
    63 #     else:
    64 #         second.append(row)
     37
    6538first = []
    6639second = []
     40combined = []
    6741for course_id,course in context.objectItems():
    6842    row = {}
    69     # ro = r.getObject()
    7043    course_doc = course.getContent()
    71     # course_id = r.getId
    7244    row = context.getCourseInfo(course_id)
    7345    row['id'] = course_id
    74     # row['title'] = course_doc.Title()
    75     # row['semester'] = course_doc.semester
    7646    row['core'] = course_doc.core_or_elective
    7747    row['url'] = course.absolute_url()
     
    8353                                                           row['department'],
    8454                                                           course_id)
    85     if row['semester'] == 1:
     55
     56    # The course objects contain strings (old schema) and integers (new schema) as semester values
     57    row['semester'] = str(row['semester'])
     58    if row['semester'] == '1':
    8659        first.append(row)
     60    elif row['semester'] == '2':
     61        second.append(row)       
    8762    else:
    88         second.append(row)
     63        combined.append(row)
    8964first.sort()
    9065second.sort()
     66combined.sort()
    9167info['first'] = first
    9268info['second'] = second
     69info['combined'] = combined
     70
    9371return info
  • WAeUP_SRP/base/skins/waeup_academics/level_view.pt

    r2606 r2614  
    2323        <table tal:condition="python: 1" class="contentListing" width="100%" summary="content layout" id="folder_content">     
    2424          <span tal:repeat="sem python:('first','second')">
    25             <th colspan="3" tal:content="python: test(sem == 'first','First Semester', 'Second Semester')" />
     25            <tr><th colspan="3" tal:content="python: test(sem == 'first','First Semester', 'Second Semester')" /></tr>
    2626            <tr tal:repeat="row python: info[sem]"
    2727                tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')">
     
    4949                    </a>
    5050                <a tal:condition="row/real_course_path|nothing"
    51                    href="edit" tal:attributes="href string:${row/real_course_path}">
    52                     [goto course]
     51                   href="edit" tal:attributes="href string:${row/real_course_path}/external_edit_form"
     52                   target="edit"
     53                   onclick="javascript:window.open('','edit','width=600, height=700, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, status=no, resizable=no, dependent=no')">
     54                   [edit course]
    5355                    </a>
    5456                </td>
    55               </tr>
     57            </tr>
     58             
    5659            </span>
     60             
     61            <tr><th colspan="3" tal:condition="info/combined"> Combined</th></tr>
     62            <tr tal:condition="info/combined" tal:repeat="row info/combined"
     63                tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')">
     64              <td align="left" valign="middle" style="width: 5px;"
     65                  tal:condition="is_so">
     66                <input type="checkbox" name="ids:list" value="" id="" class="noborder"
     67                       tal:condition="is_so"
     68                       tal:define="id row/id"
     69                       tal:attributes="value id;
     70                       id python:'cb_' + id;
     71                       checked python:id in info['choosen_ids'];"
     72                       />
     73                </td>
     74                <td><a href="view" tal:attributes="href string:${row/url}">
     75                    <strong tal:content="row/title" /></a> </td>
     76                <td tal:content="row/id"></td>
     77                <td tal:content="python: test(row['core'],'core','elective')"></td>
     78                <td tal:condition="row/is_editable" tal:content="row/review_state"> </td>
     79                <td>
     80                <a tal:condition="row/is_editable"
     81                    href="edit" tal:attributes="href string:${row/url}/external_edit_form"
     82                    target="edit"
     83                    onclick="javascript:window.open('','edit','width=600, height=700, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, status=no, resizable=no, dependent=no')">
     84                    [edit]
     85                    </a>
     86                <a tal:condition="row/real_course_path|nothing"
     87                   href="edit" tal:attributes="href string:${row/real_course_path}/external_edit_form"
     88                   target="edit"
     89                   onclick="javascript:window.open('','edit','width=600, height=700, directories=no, toolbar=no, location=no, menubar=no, scrollbars=yes, status=no, resizable=no, dependent=no')">
     90                   [edit course]
     91                   </a>
     92                </td>
     93             </tr>
     94             
     95
    5796          </table>
    5897        <table width="100%" cellspacing="0" cellpadding="2"
  • WAeUP_SRP/base/skins/waeup_student/getStudyLevelInfo.py

    r2606 r2614  
    3737import logging
    3838logger = logging.getLogger('Skins.getStudyLevelInfo')
    39 
    40 #def calculateGPA():
    41 #    """calculate the gpa"""
    42 #    sum = 0
    43 #    course_count = 0
    44 #    for sc in context.objectValues():
    45 #        result = sc.getContent()
    46 #        if not result.grade:
    47 #            continue
    48 #        res = context.portal_catalog({'meta_type': 'Course',
    49 #                                      'id': sc.aq_parent.id})
    50 #        if len(res) < 1:
    51 #            continue
    52 #        course = res[0].getObject().getContent()
    53 #    if course_count:
    54 #        return sum/course_count
    55 #    return 0.0
    56 
    57 #def cmp_semester_id(a,b):
    58 #    s1 = "%(semester)s%(id)s" % a
    59 #    s2 = "%(semester)s%(id)s" % b
    60 #    if s1 == s2:
    61 #        return 0
    62 #    if s1 > s2:
    63 #        return 1
    64 #    return -1
    6539
    6640student_id = context.getStudentId()
  • WAeUP_SRP/base/skins/waeup_student/study_level_view.pt

    r2606 r2614  
    7777        <span tal:repeat="sem python:('1','2')">       
    7878                   
    79         <th colspan="3" tal:content="python: test(sem == '1','First Semester', 'Second Semester')" />               
     79        <tr><th colspan="3" tal:content="python: test(sem == '1','First Semester', 'Second Semester')" /></tr>               
    8080        <tr tal:repeat="row python: test(sem == '1',info['normal1'],info['normal2'])"
    8181            tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')">
     
    103103          </td>         
    104104        </tr>
    105        
    106        
    107         <th colspan="3" tal:condition="info/normal3"> Combined</th>               
     105
     106        </span>       
     107       
     108        <tr><th colspan="3" tal:condition="info/normal3"> Combined</th></tr>               
    108109        <tr tal:condition="info/normal3" tal:repeat="row info/normal3"
    109110            tal:attributes="class python:test(repeat['row'].even(), 'even ajaxtd', 'odd ajaxtd')">
     
    134135       
    135136       
    136         </span>
     137
    137138
    138139        <tr>
Note: See TracChangeset for help on using the changeset viewer.