Index: WAeUP_SRP/branches/regebro-noskins/WAeUPTables.py
===================================================================
--- WAeUP_SRP/branches/regebro-noskins/WAeUPTables.py	(revision 1685)
+++ WAeUP_SRP/branches/regebro-noskins/WAeUPTables.py	(revision 1686)
@@ -22,8 +22,9 @@
 from Globals import InitializeClass
 from Products.ZCatalog.ZCatalog import ZCatalog
+from Products.ZCatalog.ProgressHandler import ZLogHandler
 from AccessControl import ClassSecurityInfo
 from Products.CMFCore.permissions import ModifyPortalContent
 
-import DateTime
+import DateTime,time
 import csv,re
 import logging
@@ -48,4 +49,21 @@
     implements(IWAeUPTable)
     security = ClassSecurityInfo()
+
+    def refreshCatalog(self, clear=0, pghandler=None):
+        """ don't refresh for a normal table """
+
+        if self.REQUEST and self.REQUEST.RESPONSE:
+            self.REQUEST.RESPONSE.redirect(
+              URL1 +
+              '/manage_catalogAdvanced?manage_tabs_message=Catalog%20refresh%20not%20implemented')
+
+    def manage_catalogClear(self, REQUEST=None, RESPONSE=None, URL1=None):
+        """ clears the whole enchilada """
+        #self._catalog.clear()
+
+        if REQUEST and RESPONSE:
+            RESPONSE.redirect(
+              URL1 +
+              '/manage_catalogAdvanced?manage_tabs_message=Catalog%20Clearing%20disabled')
 
     def addRecord(self, **data):
@@ -75,7 +93,4 @@
             raise KeyError("No record for uid %s" % uid)
         record = records[0]
-        record_data = {}
-        for field in self.schema() + self.indexes():
-            record_data[field] = getattr(record, field)
         record_data = {}
         for field in self.schema() + self.indexes():
@@ -142,6 +157,6 @@
         rec = records[0]
         self.modifyRecord(bed=rec.bed,student=student_id)
-        s_logger = logging.getLogger('Accommodation.SearchAndReserveBed')
-        s_logger.info("%s reserved bed %s" % (student_id,rec.bed))
+        s_logger = logging.getLogger('WAeUPTables.AccommodationTable.searchAndReserveBed')
+        s_logger.info('%s reserved bed %s' % (student_id,rec.bed))
         return 1,rec.bed
 
@@ -210,10 +225,214 @@
 
 class StudentsCatalog(WAeUPTable): ###(
+    security = ClassSecurityInfo()
 
     meta_type = 'WAeUP Students Catalog'
     name = "students_catalog"
     key = "id"
+    interesting_types = ('Student',
+                         'StudentApplication',
+                         'StudentCLearance',
+                         'StudentPersonal',
+                         'StudentStudyCourse',
+                         )
+
     def __init__(self):
         WAeUPTable.__init__(self, 'students_catalog')
+        return
+
+    def get_review_state(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc): ###(
+        "return the students review_state from portal_catalog"
+        cat_res = self.portal_catalog(id = sid)
+        if len(cat_res) != 1:
+            return None
+        return cat_res[0].review_state
+
+    def get_course(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc):
+        "return the students study_course"
+        if study_course_doc is None:
+            return None
+        return getattr(study_course_doc,'study_course',None)
+
+    def get_department(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc):
+        "return the students department"
+        if study_course_doc is None:
+            return None
+        certificate_res = self.portal_catalog(id = study_course_doc.study_course)
+        if len(certificate_res) != 1:
+            return None
+        return certificate_res[0].getPath().split('/')[-3]
+
+    def get_email(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc):
+        "return the students email from the personal"
+        if personal_doc is None:
+            return None
+        return getattr(personal_doc,'email',None)
+
+    def get_entry_mode(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc):
+        "return the students entry_mode from the application"
+        if application_doc is None:
+            return None
+        return getattr(application_doc,'entry_mode',None)
+
+    def get_jamb_reg_no(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc):
+        "return the students jamb_reg_no from the application"
+        if application_doc is None:
+            return None
+        return getattr(application_doc,'jamb_reg_no',None)
+
+    def get_faculty(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc):
+        "return the students faculty"
+        if study_course_doc is None:
+            return None
+        certificate_res = self.portal_catalog(id = study_course_doc.study_course)
+        if len(certificate_res) != 1:
+            return None
+        return certificate_res[0].getPath().split('/')[-4]
+
+    def get_level(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc):
+        "return the students study_course"
+        if study_course_doc is None:
+            return None
+        #from pdb import set_trace;set_trace()
+        return getattr(study_course_doc,'current_level',None)
+
+    def get_matric_no(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc):
+        "return the students matric_no from the clearance "
+        if clearance_doc is None:
+            return None
+        return getattr(clearance_doc,'matric_no',None)
+
+    def get_name(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc):
+        "return the students name from the personal"
+        if personal_doc is None:
+            return None
+        doc = personal_doc
+        return "%s %s %s" % (doc.firstname,doc.middlename,doc.lastname)
+
+    def get_phone(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc):
+        "return the students phone from the personal"
+        if personal_doc is None:
+            return None
+        return getattr(personal_doc,'phone',None)
+
+    def get_sex(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc):
+        "return the students sex from the personal"
+        if personal_doc is None:
+            return None
+        return getattr(personal_doc,'sex',None)
+
+    def get_verdict(self,sid,application_doc,clearance_doc,personal_doc,study_course_doc):
+        "return the students study_course"
+        if study_course_doc is None:
+            return None
+        return getattr(study_course_doc,'current_verdict',None)
+    ###)
+
+    def refreshCatalog(self, clear=0, pghandler=None): ###(
+        """ 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()
+
+        num_objects = len(paths)
+        if pghandler:
+            pghandler.init('Refreshing catalog: %s' % self.absolute_url(1), num_objects)
+        for i in xrange(num_objects):
+            if pghandler: pghandler.report(i)
+            p = paths[i]
+            sid = p[0]
+            pcat_res = self.portal_catalog(id=sid)
+            if len(pcat_res) != 1:
+                continue
+            student_brain = pcat_res[0]
+            student_obj = student_brain.getObject()
+            if student_obj.hasObject('application'):
+                application_doc = getattr(student_obj,'application').getContent()
+            else:
+                application_doc = None
+            if student_obj.hasObject('clearance'):
+                clearance_doc = getattr(student_obj,'clearance').getContent()
+            else:
+                clearance_doc = None
+            if student_obj.hasObject('personal'):
+                personal_doc = getattr(student_obj,'personal').getContent()
+            else:
+                personal_doc = None
+            if student_obj.hasObject('study_course'):
+                study_course_doc = getattr(student_obj,'study_course').getContent()
+            else:
+                study_course_doc = None
+            data = {}
+            data['id'] = sid
+            for field in self.schema():
+                function = getattr(self,"get_%s" % field, None)
+                if function is None:
+                    continue
+                value = function(sid,application_doc,clearance_doc,personal_doc,study_course_doc)
+                if value is not None:
+                    data[field] = value
+            self.modifyRecord(**data)
+        if pghandler: pghandler.finish()
+    ###)
+
+    def manage_catalogReindex(self, REQUEST, RESPONSE, URL1):
+        """ clear the catalog, then re-index everything """
+
+        elapse = time.time()
+        c_elapse = time.clock()
+
+        pgthreshold = self._getProgressThreshold()
+        handler = (pgthreshold > 0) and ZLogHandler(pgthreshold) or None
+        self.refreshCatalog(clear=0, pghandler=handler)
+
+        elapse = time.time() - elapse
+        c_elapse = time.clock() - c_elapse
+
+        RESPONSE.redirect(
+            URL1 +
+            '/manage_catalogAdvanced?manage_tabs_message=' +
+            urllib.quote('Catalog Updated \n'
+                         'Total time: %s\n'
+                         'Total CPU time: %s' % (`elapse`, `c_elapse`)))
+
+
+    security.declarePrivate('notify_event_listener')
+    def notify_event_listener(self,event_type,object,infos):
+        "listen for events"
+        pt = object.portal_type
+        mt = object.meta_type
+        students_catalog = self.students_catalog
+        #if pt not in self.interesting_types:
+        #    return
+        #print "%(pt)s\n %(event_type)s \n %(infos)s\n" % vars()
+        if not infos.has_key('rpath'):
+            return
+        if pt == 'Student' and event_type == "workflow":
+            pass
+        elif mt == 'StudentApplication':
+            if event_type not in ('sys_modify_object'):
+                return
+            print "%(pt)s\n %(event_type)s \n %(infos)s\n" % vars()
+            from pdb import set_trace;set_trace()
+            jamb_reg_no = getattr(object,'jamb_reg_no',None)
+            if jamb_reg_no is None:
+                return
+            student_id = infos['rpath'].split('/')[2]
+            self.fixName(student_id)
+            student_entry = students_catalog(id = student_id)[0]
+            if student_entry.jamb_reg_no == jamb_reg_no:
+                return
+            students_catalog.modifyRecord(id = student_id,
+                                          jamb_reg_no = jamb_reg_no)
+        elif mt == 'StudentPersonal':
+            if event_type not in ('sys_modify_object'):
+                return
+            print "%(pt)s\n %(event_type)s \n %(infos)s\n" % vars()
+            student_id = infos['rpath'].split('/')[2]
+            self.fixName(student_id)
 
 
@@ -234,4 +453,16 @@
 ###)
 
+class OnlinePaymentsImport(WAeUPTable): ###(
+
+    meta_type = 'WAeUP Online Payment Transactions'
+    name = "online_payments_import"
+    key = "order_id"
+    def __init__(self):
+        WAeUPTable.__init__(self, self.name)
+
+
+InitializeClass(CoursesCatalog)
+###)
+
 class ReturningImport(WAeUPTable): ###(
 
Index: WAeUP_SRP/branches/regebro-noskins/skins/waeup_design/WAeUP_Backoffice/cpsskins_render.css.dtml
===================================================================
--- WAeUP_SRP/branches/regebro-noskins/skins/waeup_design/WAeUP_Backoffice/cpsskins_render.css.dtml	(revision 1685)
+++ WAeUP_SRP/branches/regebro-noskins/skins/waeup_design/WAeUP_Backoffice/cpsskins_render.css.dtml	(revision 1686)
@@ -166,6 +166,4 @@
 .shapeAreaShape10{border-style:solid;border-width:1px;text-transform:none}
 .colorSciAfrColor{border-color:#CCC;background-color:#840000;color:#000000}
-.colorStudentBarColor{border-color:#FFCE81;background-color:#FFCE81;color:#000000}
-.colorStudentBarAreaColor{border-color:#FFCE81;background-color:#FFF;color:#000000}
 .fontColornavigation h1, .fontColornavigation .h1{border-color:#666666;color:Black}
 .fontColornavigation h2, .fontColornavigation .h2{border-color:#666666;color:Black}
@@ -255,5 +253,5 @@
 .portalTabPortalTabStyleuseractions2 ul.cpsskinsMenu li{margin:0 5px 0 0}
 .portalTabPortalTabStyleuseractions2 ul.cpsskinsMenu li a{padding:1px 0px 1px 0px}
-.colorStaffBarAreaColor{border-color:#B9B9B9;background-color:#FFFFFF;color:#000000}
-.colorStaffBarColor{border-color:#B9B9B9;background-color:#B9B9B9;color:#FFFF}
+.colorBarAreaColor{border-color:#B9B9B9;background-color:#FFFFFF;color:#000000}
+.colorBarColor{border-color:#B9B9B9;background-color:#B9B9B9;color:#FFFF}
 </dtml-let>
Index: WAeUP_SRP/branches/regebro-noskins/skins/waeup_design/WAeUP_Student/cpsskins_render.css.dtml
===================================================================
--- WAeUP_SRP/branches/regebro-noskins/skins/waeup_design/WAeUP_Student/cpsskins_render.css.dtml	(revision 1685)
+++ WAeUP_SRP/branches/regebro-noskins/skins/waeup_design/WAeUP_Student/cpsskins_render.css.dtml	(revision 1686)
@@ -165,6 +165,6 @@
 .shapeAreaShape10{border-style:solid;border-width:1px;text-transform:none}
 .colorSciAfrColor{border-color:#CCC;background-color:#840000;color:#000000}
-.colorStudentBarColor{border-color:#FFCE81;background-color:#FFCE81;color:#000000}
-.colorStudentBarAreaColor{border-color:#FFCE81;background-color:#FFF;color:#000000}
+.colorBarColor{border-color:#FFCE81;background-color:#FFCE81;color:#000000}
+.colorBarAreaColor{border-color:#FFCE81;background-color:#FFF;color:#000000}
 .fontColornavigation h1, .fontColornavigation .h1{border-color:#666666;color:Black}
 .fontColornavigation h2, .fontColornavigation .h2{border-color:#666666;color:Black}
Index: WAeUP_SRP/branches/regebro-noskins/skins/waeup_design/WAeUP_Student/theme.pt
===================================================================
--- WAeUP_SRP/branches/regebro-noskins/skins/waeup_design/WAeUP_Student/theme.pt	(revision 1685)
+++ WAeUP_SRP/branches/regebro-noskins/skins/waeup_design/WAeUP_Student/theme.pt	(revision 1686)
@@ -90,4 +90,6 @@
                   <tal:block repeat="portlet python:ptool.getPortlets(context=context, slot='student_actions_slot')"
                              tal:content="structure python:portlet.render_cache(context_obj=context, portlet=portlet, boxedit=None)" />
+                  <tal:block repeat="portlet python:ptool.getPortlets(context=context, slot='student_workflow')"
+                             tal:content="structure python:portlet.render_cache(context_obj=context, portlet=portlet, boxedit=None)" />
                 </div>                        
               </div>
Index: WAeUP_SRP/branches/regebro-noskins/skins/waeup_design/main_template.pt
===================================================================
--- WAeUP_SRP/branches/regebro-noskins/skins/waeup_design/main_template.pt	(revision 1685)
+++ WAeUP_SRP/branches/regebro-noskins/skins/waeup_design/main_template.pt	(revision 1686)
@@ -57,8 +57,10 @@
       </metal:block>
       <link rel="icon"
-            href="http://uniben.waeup.org/portal_themes/WAeUP_Student/icons/ng.png"
+            href="icons/ng.png"
+            tal:attributes="href string:${base_url}icons/ng.png"
             type="image/png" />
       <link rel="shortcut icon"
-            href="http://uniben.waeup.org/portal_themes/WAeUP_Student/icons/ng.png"
+            href="icons/ng.png"
+            tal:attributes="href string:${base_url}icons/ng.png"
             type="image/png" />
       <!-- CSS1 -->
@@ -114,5 +116,5 @@
       <table summary="Page Block"
              style="margin-left: auto; margin-right: auto; width: 100%;"
-             class="shapeNoBorder colorTransparent" cellpadding="0"
+             class="shapeNoBorder colorStaffBarAreaColor" cellpadding="0"
              cellspacing="0">
         <tbody>
@@ -133,5 +135,5 @@
           <metal:block use-macro="here/?waeup_skin/theme/macros/tdactions" />
           <td style=""
-              class="shapeAreaShape5 colorStudentBarAreaColor"
+              class="shapeAreaShape5 colorBarAreaColor"
               valign="top">
             <div style="padding: 0.2em;">
@@ -140,9 +142,7 @@
                 <div style="padding: 0pt; text-align: left;">
                   <div style="padding: 0.2em;">
-                    <div id="main_slot_student">
-                      <metal:block define-slot="header" />
-                      <metal:block define-slot="main" />
-                      <metal:block define-slot="sub" />
-                    </div>
+                    <metal:block define-slot="header" />
+                    <metal:block define-slot="main" />
+                    <metal:block define-slot="sub" />
                   </div>
                 </div>
Index: WAeUP_SRP/branches/regebro-noskins/skins/waeup_student/application_slip.pt
===================================================================
--- WAeUP_SRP/branches/regebro-noskins/skins/waeup_student/application_slip.pt	(revision 1685)
+++ WAeUP_SRP/branches/regebro-noskins/skins/waeup_student/application_slip.pt	(revision 1686)
@@ -1,3 +1,3 @@
-<metal:body use-macro="here/main_template/macros/master">
+<metal:body use-macro="here/slip_template/macros/master">
     <metal:main fill-slot="main"
                 tal:define="info context/getApplicationInfo">
