Changeset 1366 for WAeUP_SRP/trunk


Ignore:
Timestamp:
27 Jan 2007, 15:40:19 (18 years ago)
Author:
joachim
Message:

M profiles/default/schemas/certificate_course.xml
make level searchable
M profiles/default/layouts/course.xml
add code to course layout to allow creation
M skins/waeup_default/waeup_edit.py
M skins/waeup_default/waeup_document_create_do.py
M skins/waeup_custom/folder_delete.py
fix that courses_catalog also get updated
M skins/waeup_academics/courses_view.pt
M skins/waeup_academics/getCoursesInfo.py
use courses catalog.

Location:
WAeUP_SRP/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/profiles/default/layouts/course.xml

    r853 r1366  
    77 <property name="flexible_widgets"/>
    88 <property name="validate_values_expr"></property>
    9  <widget name="adm_status" meta_type="String Widget">
     9<widget name="code" meta_type="CourseId Widget">
     10 <property name="title">Course Id</property>
     11 <property name="fields">
     12  <element value="code"/>
     13 </property>
     14 <property name="is_required">True</property>
     15 <property name="label">Course Id</property>
     16 <property name="label_edit">Course Id</property>
     17 <property name="readonly_layout_modes">
     18  <element value="edit"/>
     19 </property>
     20 <property name="hidden_layout_modes"/>
     21 <property name="hidden_readonly_layout_modes"/>
     22 <property name="display_width">8</property>
     23</widget>
     24  <widget name="adm_status" meta_type="String Widget">
    1025  <property name="title">Adm Status</property>
    1126  <property name="fields">
  • WAeUP_SRP/trunk/profiles/default/schemas/certificate_course.xml

    r556 r1366  
    1010 <field name="semester" meta_type="CPS String Field"/>
    1111 <field name="department" meta_type="CPS String Field"/>
    12  <field name="level" meta_type="CPS String Field"/>
    13  <field name="session" meta_type="CPS String Field"/>
     12  <field name="level" meta_type="CPS String Field">
     13    <property name="is_searchabletext">True</property>
     14  </field>
     15  <field name="session" meta_type="CPS String Field"/>
    1416</object>
  • WAeUP_SRP/trunk/skins/waeup_academics/courses_view.pt

    r913 r1366  
    1 <metal:html tal:define="info context/getCoursesInfo;
    2             is_so context/isSectionOfficer;"
    3             >
     1<metal:html>
    42  <metal:body use-macro="here/waeup_content_master/macros/master">
    5     <metal:block fill-slot="header">
     3    <metal:block fill-slot="header"
     4                 tal:define="global info context/getCoursesInfo;
     5                 global is_so context/isSectionOfficer;"
     6                 >
    67      <a href=""
    78         tal:attributes="href string:${here/academicsParent}">
  • WAeUP_SRP/trunk/skins/waeup_academics/getCoursesInfo.py

    r913 r1366  
    1212return Info about the Faculties
    1313"""
     14def cmpsemester(a,b):
     15    if a.semester == b.semester:
     16        return 0
     17    if a.semester > b.semester:
     18        return 1
     19    return -1
     20   
     21
     22
    1423request = context.REQUEST
    1524
     
    3342info['dep_id'] = dep_id
    3443
    35 res = context.portal_catalog(container_path="%s/courses" % cp)
    36 items = []
    37 for sem in ('1','2'):
    38     for r in res:
    39         row = {}
    40         ro = r.getObject()
    41         rd = ro.getContent()
    42         if rd.semester != sem:
    43             continue
    44         row['id'] = r.getId
    45         row['title'] = rd.Title()
    46         row['semester'] = rd.semester
    47         row['url'] = ro.absolute_url()
    48         row['review_state'] = wf.getInfoFor(ro,'review_state','None')
    49         row['is_editable'] = mtool.checkPermission('Modify portal content', ro)
    50         items.append(row)
    51 info['courses'] = items
     44res = context.courses_catalog(department=dep_id)
     45items = [ brain for brain in res]
     46items.sort(cmpsemester)
     47rows = []
     48for r in items:
     49    row = {}
     50    code = getattr(r,'code',None)
     51    if code is None:
     52        continue
     53    ro = getattr(context,code)
     54    row['id'] = code
     55    row['title'] = r['title']
     56    row['semester'] = r['semester']
     57    row['url'] = "%s/%s" % (context.absolute_url(),code)
     58    row['review_state'] = wf.getInfoFor(ro,'review_state','None')
     59    row['is_editable'] = mtool.checkPermission('Modify portal content', ro)
     60    rows.append(row)
     61#from Products.zdb import set_trace;set_trace()
     62##res = context.portal_catalog(container_path="%s/courses" % cp)
     63##items = []
     64##for sem in ('1','2'):
     65##    for r in res:
     66##        row = {}
     67##        ro = r.getObject()
     68##        rd = ro.getContent()
     69##        if rd.semester != sem:
     70##            continue
     71##        row['id'] = r.getId
     72##        row['title'] = rd.Title()
     73##        row['semester'] = rd.semester
     74##        row['url'] = ro.absolute_url()
     75##        row['review_state'] = wf.getInfoFor(ro,'review_state','None')
     76##        row['is_editable'] = mtool.checkPermission('Modify portal content', ro)
     77##        items.append(row)
     78info['courses'] = rows
    5279return info
  • WAeUP_SRP/trunk/skins/waeup_custom/folder_delete.py

    r586 r1366  
    2727        # XXX has to be called from here since the workflow doesn't handle the
    2828        # deletion yet
     29        if context.portal_type == "CoursesFolder":
     30            context.courses_catalog.deleteRecord(id)
    2931        ob = getattr(here, id)
    3032        from Products.CPSCore.EventServiceTool import getPublicEventService
  • WAeUP_SRP/trunk/skins/waeup_default/waeup_document_create_do.py

    r731 r1366  
    99"""
    1010from Products.CMFCore.utils import getToolByName
    11 
     11request = context.REQUEST
    1212if type_name in ("StudyLevel","StudentStudyLevel"):
    1313    id = datamodel.get('code')
     
    3434if new_id is not None:
    3535    id = new_id
    36 
     36if type_name == "Course":
     37    d = {}
     38    ptl = request.get('PATH_TRANSLATED').split('/')
     39    ai = ptl.index('academics')
     40    d['faculty'] = ptl[ai+1]
     41    d['department'] = ptl[ai+2]
     42    from_dm = ('code','title','semester','credits',)
     43    for f in from_dm:
     44        d[f] = datamodel.get(f)
     45    context.courses_catalog.addRecord(**d)
    3746ob = getattr(context, id)
    3847ob.getContent().edit(mapping=datamodel)
  • WAeUP_SRP/trunk/skins/waeup_default/waeup_edit.py

    r1350 r1366  
    4040
    4141action = "/" + came_from
    42 
    4342if is_valid:
    4443    comments = REQUEST.get('comments')
     
    7473                                             )
    7574    elif context.portal_type == "Course":
    76         context.courses_catalog.modifyRecord(**ds)
     75        dd = {}
     76        dd.update(ds) # ds is not a real dictionary
     77        try:
     78            context.courses_catalog.modifyRecord(**dd)
     79        except KeyError:
     80            context.courses_catalog.addRecord(**dd)
    7781    if cpsdocument_edit_and_view_button is not None:
    7882        action = ''
Note: See TracChangeset for help on using the changeset viewer.