Index: /WAeUP_SRP/trunk/profiles/default/layouts/course.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/layouts/course.xml	(revision 1365)
+++ /WAeUP_SRP/trunk/profiles/default/layouts/course.xml	(revision 1366)
@@ -7,5 +7,20 @@
  <property name="flexible_widgets"/>
  <property name="validate_values_expr"></property>
- <widget name="adm_status" meta_type="String Widget">
+<widget name="code" meta_type="CourseId Widget">
+ <property name="title">Course Id</property>
+ <property name="fields">
+  <element value="code"/>
+ </property>
+ <property name="is_required">True</property>
+ <property name="label">Course Id</property>
+ <property name="label_edit">Course Id</property>
+ <property name="readonly_layout_modes">
+  <element value="edit"/>
+ </property>
+ <property name="hidden_layout_modes"/>
+ <property name="hidden_readonly_layout_modes"/>
+ <property name="display_width">8</property>
+</widget>
+  <widget name="adm_status" meta_type="String Widget">
   <property name="title">Adm Status</property>
   <property name="fields">
Index: /WAeUP_SRP/trunk/profiles/default/schemas/certificate_course.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/schemas/certificate_course.xml	(revision 1365)
+++ /WAeUP_SRP/trunk/profiles/default/schemas/certificate_course.xml	(revision 1366)
@@ -10,5 +10,7 @@
  <field name="semester" meta_type="CPS String Field"/>
  <field name="department" meta_type="CPS String Field"/>
- <field name="level" meta_type="CPS String Field"/>
- <field name="session" meta_type="CPS String Field"/>
+  <field name="level" meta_type="CPS String Field">
+    <property name="is_searchabletext">True</property>
+  </field>
+  <field name="session" meta_type="CPS String Field"/>
 </object>
Index: /WAeUP_SRP/trunk/skins/waeup_academics/courses_view.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_academics/courses_view.pt	(revision 1365)
+++ /WAeUP_SRP/trunk/skins/waeup_academics/courses_view.pt	(revision 1366)
@@ -1,7 +1,8 @@
-<metal:html tal:define="info context/getCoursesInfo;
-            is_so context/isSectionOfficer;"
-            >
+<metal:html>
   <metal:body use-macro="here/waeup_content_master/macros/master">
-    <metal:block fill-slot="header">
+    <metal:block fill-slot="header"
+                 tal:define="global info context/getCoursesInfo;
+                 global is_so context/isSectionOfficer;"
+                 >
       <a href=""
          tal:attributes="href string:${here/academicsParent}">
Index: /WAeUP_SRP/trunk/skins/waeup_academics/getCoursesInfo.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_academics/getCoursesInfo.py	(revision 1365)
+++ /WAeUP_SRP/trunk/skins/waeup_academics/getCoursesInfo.py	(revision 1366)
@@ -12,4 +12,13 @@
 return Info about the Faculties
 """
+def cmpsemester(a,b):
+    if a.semester == b.semester:
+        return 0
+    if a.semester > b.semester:
+        return 1
+    return -1
+    
+
+
 request = context.REQUEST
 
@@ -33,20 +42,38 @@
 info['dep_id'] = dep_id
 
-res = context.portal_catalog(container_path="%s/courses" % cp)
-items = []
-for sem in ('1','2'):
-    for r in res:
-        row = {}
-        ro = r.getObject()
-        rd = ro.getContent()
-        if rd.semester != sem:
-            continue
-        row['id'] = r.getId
-        row['title'] = rd.Title()
-        row['semester'] = rd.semester
-        row['url'] = ro.absolute_url()
-        row['review_state'] = wf.getInfoFor(ro,'review_state','None')
-        row['is_editable'] = mtool.checkPermission('Modify portal content', ro)
-        items.append(row)
-info['courses'] = items
+res = context.courses_catalog(department=dep_id)
+items = [ brain for brain in res]
+items.sort(cmpsemester)
+rows = []
+for r in items:
+    row = {}
+    code = getattr(r,'code',None)
+    if code is None:
+        continue
+    ro = getattr(context,code)
+    row['id'] = code
+    row['title'] = r['title']
+    row['semester'] = r['semester']
+    row['url'] = "%s/%s" % (context.absolute_url(),code)
+    row['review_state'] = wf.getInfoFor(ro,'review_state','None')
+    row['is_editable'] = mtool.checkPermission('Modify portal content', ro)
+    rows.append(row)
+#from Products.zdb import set_trace;set_trace()
+##res = context.portal_catalog(container_path="%s/courses" % cp)
+##items = []
+##for sem in ('1','2'):
+##    for r in res:
+##        row = {}
+##        ro = r.getObject()
+##        rd = ro.getContent()
+##        if rd.semester != sem:
+##            continue
+##        row['id'] = r.getId
+##        row['title'] = rd.Title()
+##        row['semester'] = rd.semester
+##        row['url'] = ro.absolute_url()
+##        row['review_state'] = wf.getInfoFor(ro,'review_state','None')
+##        row['is_editable'] = mtool.checkPermission('Modify portal content', ro)
+##        items.append(row)
+info['courses'] = rows
 return info
Index: /WAeUP_SRP/trunk/skins/waeup_custom/folder_delete.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_custom/folder_delete.py	(revision 1365)
+++ /WAeUP_SRP/trunk/skins/waeup_custom/folder_delete.py	(revision 1366)
@@ -27,4 +27,6 @@
         # XXX has to be called from here since the workflow doesn't handle the
         # deletion yet
+        if context.portal_type == "CoursesFolder":
+            context.courses_catalog.deleteRecord(id)
         ob = getattr(here, id)
         from Products.CPSCore.EventServiceTool import getPublicEventService
Index: /WAeUP_SRP/trunk/skins/waeup_default/waeup_document_create_do.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_default/waeup_document_create_do.py	(revision 1365)
+++ /WAeUP_SRP/trunk/skins/waeup_default/waeup_document_create_do.py	(revision 1366)
@@ -9,5 +9,5 @@
 """
 from Products.CMFCore.utils import getToolByName
-
+request = context.REQUEST
 if type_name in ("StudyLevel","StudentStudyLevel"):
     id = datamodel.get('code')
@@ -34,5 +34,14 @@
 if new_id is not None:
     id = new_id
-
+if type_name == "Course":
+    d = {}
+    ptl = request.get('PATH_TRANSLATED').split('/')
+    ai = ptl.index('academics')
+    d['faculty'] = ptl[ai+1]
+    d['department'] = ptl[ai+2]
+    from_dm = ('code','title','semester','credits',)
+    for f in from_dm:
+        d[f] = datamodel.get(f)
+    context.courses_catalog.addRecord(**d)
 ob = getattr(context, id)
 ob.getContent().edit(mapping=datamodel)
Index: /WAeUP_SRP/trunk/skins/waeup_default/waeup_edit.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_default/waeup_edit.py	(revision 1365)
+++ /WAeUP_SRP/trunk/skins/waeup_default/waeup_edit.py	(revision 1366)
@@ -40,5 +40,4 @@
 
 action = "/" + came_from
-
 if is_valid:
     comments = REQUEST.get('comments')
@@ -74,5 +73,10 @@
                                              )
     elif context.portal_type == "Course":
-        context.courses_catalog.modifyRecord(**ds)
+        dd = {}
+        dd.update(ds) # ds is not a real dictionary
+        try:
+            context.courses_catalog.modifyRecord(**dd)
+        except KeyError:
+            context.courses_catalog.addRecord(**dd)
     if cpsdocument_edit_and_view_button is not None:
         action = ''
