Index: WAeUP_SRP/trunk/WAeUPTables.py
===================================================================
--- WAeUP_SRP/trunk/WAeUPTables.py	(revision 1723)
+++ WAeUP_SRP/trunk/WAeUPTables.py	(revision 1724)
@@ -475,10 +475,6 @@
         """ re-index everything we can find """
         students_folder = self.portal_url.getPortalObject().campus.students
-
-        cat = self._catalog
-        paths = self._catalog.uids.items()
         if clear:
-            paths = tuple(paths)
-            cat.clear()
+            self._catalog.clear()
         students = self.portal_catalog(portal_type="Student")
         num_objects = len(students)
@@ -518,27 +514,4 @@
                                              import_record.Lastname)
                 data['matric_no'] = import_record.Entryregno
-##            sub_brains = self.portal_catalog(path = spath)
-##            if len(sub_brains) > 1:
-##                for sub_brain in sub_brains:
-##                    if not sub_brain.portal_type in self.affected_types.keys():
-##                        continue
-##                    doc = sub_brain.getObject().getContent()
-##                    for field in self.affected_types[sub_brain.portal_type]:
-##                        if hasattr(self,'get_from_doc_%s' % field):
-##                            data[field] = getattr(self,'get_from_doc_%s' % field)(doc)
-##                        else:
-##                            data[field] = getattr(doc,field)
-##            elif len(sub_brains) == 1:
-##                #import pdb;pdb.set_trace()
-##                import_res = self.returning_import(id = sid)
-##                if not import_res:
-##                    continue
-##                import_record = import_res[0]
-##                data['matric_no'] = import_record.matric_no
-##                data['sex'] = import_record.Sex == 'F'
-##                data['name'] = "%s %s %s" % (import_record.Firstname,
-##                                             import_record.Middlename,
-##                                             import_record.Lastname)
-##                data['matric_no'] = import_record.Entryregno
             study_course = getattr(student_obj,'study_course',None)
             current_level = data.get('level',None)
@@ -571,5 +544,4 @@
             data['id'] = object.getId()
             data['review_state'] = self.portal_workflow.getInfoFor(object,'review_state',None)
-            #from pdb import set_trace;set_trace()
             students_catalog.modifyRecord(**data)
             return
@@ -676,19 +648,27 @@
     def refreshCatalog(self, clear=0, pghandler=None): ###(
         """ re-index everything we can find """
+        if clear:
+            self._catalog.clear()
         courses = self.portal_catalog(portal_type="Course")
         num_objects = len(courses)
         if pghandler:
             pghandler.init('Refreshing catalog: %s' % self.absolute_url(1), num_objects)
+        #from pdb import set_trace;set_trace()
         for i in xrange(num_objects):
             if pghandler: pghandler.report(i)
             course_brain = courses[i]
-            course_object = course_brain.getObject()
+            course_doc = course_brain.getObject().getContent()
             pl = course_brain.getPath().split('/')
             data = {}
+            for field in self.schema():
+                data[field] = getattr(course_doc,field,None) 
             data[self.key] = course_brain.getId
-            data['faculty'] = pl[-4]
-            data['department'] = pl[-3]
-            doc = course_object.getContent()
-            self.modifyRecord(**data)
+            ai = pl.index('academics')
+            data['faculty'] = pl[ai +1]
+            data['department'] = pl[ai +2]
+            if clear:
+                self.addRecord(**data)
+            else:
+                self.modifyRecord(**data)
         if pghandler: pghandler.finish()
     ###)
@@ -709,22 +689,33 @@
         course_id = object.getId()
         data[self.key] = course_id
-        if event_type == "sys_add_object":
-            doc = object.getContent()
-            #from pdb import set_trace;set_trace()
-            for field in self.schema():
-                if field != self.key:
-                    data[field] = getattr(doc,field,None) 
+        if event_type == "sys_add_object" and mt == 'CPS Proxy Folder':
             try:
                 self.addRecord(**data)
             except ValueError:
-                pass
+                return
+            course_id = object.getId()
+            doc = object.getContent()
+            if doc is None:
+                return
+            for field in self.schema():
+                data[field] = getattr(doc,field,None) 
+            data[self.key] = course_id
+            ai = rpl.index('academics')
+            data['faculty'] = rpl[ai +1]
+            data['department'] = rpl[ai +2]
+            self.modifyRecord(**data)
+            return
         if event_type == "sys_del_object":
             self.deleteRecord(course_id)
+            return
         if event_type == "sys_modify_object" and mt == 'Course':
+            #from pdb import set_trace;set_trace()
             for field in self.schema():
-                if field != self.key:
-                    data[field] = getattr(object,field,None) 
+                data[field] = getattr(object,field,None) 
             course_id = object.aq_parent.getId()
             data[self.key] = course_id
+            ai = rpl.index('academics')
+            data['faculty'] = rpl[ai +1]
+            data['department'] = rpl[ai +2]
             self.modifyRecord(**data)
     ###)
Index: WAeUP_SRP/trunk/skins/waeup_academics/getFacultiesInfo.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_academics/getFacultiesInfo.py	(revision 1723)
+++ WAeUP_SRP/trunk/skins/waeup_academics/getFacultiesInfo.py	(revision 1724)
@@ -13,4 +13,12 @@
 """
 request = context.REQUEST
+def cmp_id(a,b):
+    s1 = "%(id)s" % a
+    s2 = "%(id)s" % b
+    if s1 == s2:
+        return 0
+    if s1 > s2:
+        return 1
+    return -1
 
 wf = context.portal_workflow
@@ -32,4 +40,5 @@
     row['is_editable'] = mtool.checkPermission('Modify portal content', fo)
     items.append(row)
+items.sort(cmp_id)
 info['items'] = items
 return info
Index: WAeUP_SRP/trunk/skins/waeup_default/id_rename.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_default/id_rename.py	(revision 1723)
+++ WAeUP_SRP/trunk/skins/waeup_default/id_rename.py	(revision 1724)
@@ -6,4 +6,13 @@
 Used within the folder_contents template.
 """
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+import logging
+logger = logging.getLogger('Skins.id_rename')
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
 
 REQUEST = context.REQUEST
@@ -14,4 +23,5 @@
                                 % ('Courses cannot be renamed',)))
 
+old_ids = REQUEST['ids']
 new_ids = REQUEST['new_ids']
 new_ids = [id.upper() for id in REQUEST['new_ids']]
@@ -20,7 +30,40 @@
 if context.portal_type == "University":
     here = context.academics
-
+pt = context.portal_type
+mt = context.meta_type
+logger.info('%s starting renaming %s to %s' % (member,old_ids,new_ids))
 
 here.manage_renameObjects(REQUEST['ids'], new_ids, REQUEST)
+if pt == 'University':
+    for faculty in old_ids:
+        students = context.students_catalog(faculty=faculty)
+        student_ids = [s.id for s in students]
+        data = {}
+        new_fid = new_ids[old_ids.index(faculty)]
+        data['faculty'] = new_fid 
+        for sid in student_ids:
+            data['id'] = sid
+            context.students_catalog.modifyRecord(**data)
+        courses = context.courses_catalog(faculty=faculty)
+        courses_ids = [c.code for c in courses]
+        for cid in courses_ids:
+            data['code'] = cid
+            context.courses_catalogModify(**data)
+elif pt == 'Faculty':
+    for department in old_ids:
+        students = context.students_catalog(department=department)
+        student_ids = [s.id for s in students]
+        data = {}
+        new_did = new_ids[old_ids.index(department)]
+        data['department'] = new_did
+        for sid in student_ids:
+            data['id'] = sid
+            context.students_catalog.modifyRecord(**data)
+        courses = context.courses_catalog(department=department)
+        courses_ids = [c.code for c in courses]
+        for cid in courses_ids:
+            data['code'] = cid
+            context.courses_catalogModify(**data)
+logger.info('%s finished renaming %s to %s' % (member,old_ids,new_ids))
 
 return REQUEST.RESPONSE.redirect(here.absolute_url() + \
Index: WAeUP_SRP/trunk/skins/waeup_default/id_rename_form.pt
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_default/id_rename_form.pt	(revision 1723)
+++ WAeUP_SRP/trunk/skins/waeup_default/id_rename_form.pt	(revision 1724)
@@ -46,5 +46,5 @@
 </div><!-- tal:condition="here/folder_rename_items" -->
 
-<div tal:condition="not: here/folder_rename_items">
+<div tal:condition="not: here/academics_rename_items">
 
   <p i18n:translate="help_no_items_to_rename">
Index: WAeUP_SRP/trunk/skins/waeup_default/waeup_document_create_do.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_default/waeup_document_create_do.py	(revision 1723)
+++ WAeUP_SRP/trunk/skins/waeup_default/waeup_document_create_do.py	(revision 1724)
@@ -34,5 +34,5 @@
 if new_id is not None:
     id = new_id
-if type_name == "Course": # disable if  handled by event
+if type_name == "xxxCourse": # disabled handled by event
     d = {}
     ptl = request.get('PATH_TRANSLATED').split('/')
Index: WAeUP_SRP/trunk/skins/waeup_default/waeup_edit.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_default/waeup_edit.py	(revision 1723)
+++ WAeUP_SRP/trunk/skins/waeup_default/waeup_edit.py	(revision 1724)
@@ -102,5 +102,5 @@
                                              )
         logger.info('%s edited %s of %s' % (member,context.id,student_id))
-    elif context.portal_type == "Course": # disable if handled by events
+    elif context.portal_type == "xxxxCourse": # disabled handled by events
         dd = {}
         dd.update(ds) # ds is not a real dictionary
