Index: /WAeUP_SRP/trunk/WAeUPTool.py
===================================================================
--- /WAeUP_SRP/trunk/WAeUPTool.py	(revision 1755)
+++ /WAeUP_SRP/trunk/WAeUPTool.py	(revision 1756)
@@ -67,61 +67,4 @@
                      )
 
-    student_field2types = {   ###(
-                      'StudentApplication':
-                          {'id': 'application',
-                           'title': 'Application Data',
-                           'fields':
-                             ('jamb_reg_no',
-                              'entry_mode',
-                              #'entry_level',
-                              'entry_session',
-                              'jamb_score',
-                              'email',
-                              'phone',
-                              )
-                              },
-                      'StudentPume':
-                          {'id': 'pume',
-                           'title': 'Pume Data',
-                           'fields':
-                             ('pume_score',
-                              )
-                              },
-                      'StudentClearance':
-                          {'id': 'clearance',
-                           'title': 'Clearance Data',
-                           'fields':
-                             ('matric_no',
-                              #'entry_level',
-                              'entry_session',
-                              'nationality',
-                              'lga',
-                              )
-                              },
-                         'StudentPersonal':
-                          {'id': 'personal',
-                           'title': 'Personal Data',
-                           'fields':
-                             ('firstname',
-                              'middlename',
-                              'lastname',
-                              'sex',
-                              'email',
-                              'phone',
-                              )
-                              },
-                         'StudentStudyCourse':
-                          {'id': 'study_course',
-                           'title': 'Study Course',
-                           'fields':
-                             ('study_course',
-                              'current_level',
-                              'current_session',
-                              'current_verdict',
-                              )
-                              },
-                         }
-    ###)
-
     def rwrite(self,s):
         response = self.REQUEST.RESPONSE
@@ -292,4 +235,12 @@
             return res[0]
         return None
+    ###)
+
+    security.declareProtected(ModifyPortalContent,'get_csv_filenames') ###(
+    def get_csv_filenames(self):
+        "do it"
+        files = [file for file in os.listdir("%s/import/" % (i_home)) 
+                 if file.endswith('.csv') and file.find('imported') == -1]
+        return files
     ###)
 
@@ -696,4 +647,67 @@
     ###)
 
+    student_field2types = {   ###(
+                      'StudentApplication':
+                          {'id': 'application',
+                           'title': 'Application Data',
+                           'wf_state': 'close',
+                           'fields':
+                             ('jamb_reg_no',
+                              'entry_mode',
+                              #'entry_level',
+                              'entry_session',
+                              'jamb_score',
+                              'email',
+                              'phone',
+                              )
+                              },
+                      'StudentPume':
+                          {'id': 'pume',
+                           'title': 'Pume Data',
+                           'wf_state': 'close',
+                           'fields':
+                             ('pume_score',
+                              )
+                              },
+                      'StudentClearance':
+                          {'id': 'clearance',
+                           'title': 'Clearance Data',
+                           'wf_state': 'close',
+                           'fields':
+                             ('matric_no',
+                              'nationality',
+                              'lga',
+                              )
+                              },
+                         'StudentPersonal':
+                          {'id': 'personal',
+                           'title': 'Personal Data',
+                           'wf_state': 'close',
+                           'fields':
+                             ('firstname',
+                              'middlename',
+                              'lastname',
+                              'sex',
+                              'email',
+                              'phone',
+                              'perm_address',
+                              )
+                              },
+                         'StudentStudyCourse':
+                          {'id': 'study_course',
+                           'title': 'Study Course',
+                           'wf_state': 'close',
+                           'fields':
+                             ('study_course',
+                              'current_level',
+                              'current_session',
+                              'current_mode',
+                              'current_verdict',
+                              )
+                              },
+                         }
+    ###)
+
+
     security.declareProtected(ModifyPortalContent,'import_student') ###(
     def import_student(self,dict):
@@ -714,6 +728,4 @@
         students_folder.invokeFactory('Student', sid)
         student_obj = getattr(students_folder,sid)
-        #password = self.generatePassword()
-        #self.makeStudentMember(sid,password)
         f2t = self.student_field2types
         for pt in f2t.keys():
@@ -728,5 +740,5 @@
                 d['sex'] = dict.get('sex') == 'F'
             sub_doc.edit(mapping = d)
-            self.portal_workflow.doActionFor(sub_obj,'close',dest_container=sub_obj)
+            self.portal_workflow.doActionFor(sub_obj,f2t[pt]['wf_state'],dest_container=sub_obj)
         wfaction = 'return'
         self.portal_workflow.doActionFor(student_obj,wfaction)
@@ -745,4 +757,6 @@
         start = True
         tr_count = 1
+        total_imported = 0
+        total_not_imported = 0
         total = 0
         iname = "import_%s" % name
@@ -751,10 +765,12 @@
         schema = stool._getOb(iname)
         if schema is None:
+            em = 'No such schema import_%s' % iname
             logger.error('No such schema import_%s' % iname)
-            return
+            return em
         layout = ltool._getOb(iname)
         if layout is None:
-            logger.error('No such layout import_%s' % iname)
-            return
+            em = 'No such layout import_%s' % iname
+            logger.error(em)
+            return em
         validators = {}
         for widget in layout.keys():
@@ -762,6 +778,7 @@
         creator = getattr(self, 'import_%s' % name,None)
         if creator is None:
-            logger.error('No creator function create_%s' % name)
-            return
+            em = 'No creator function create_%s' % name
+            logger.error(em)
+            return em
         not_imported = []
         imported = []
@@ -769,6 +786,7 @@
             items = csv.DictReader(open("%s/import/%s.csv" % (i_home,filename),"rb"))
         except:
-            logger.error('Error reading %s.csv' % filename)
-            return
+            em = 'Error reading %s.csv' % filename
+            logger.error(em)
+            return em
         for item in items:
             tr_count += 1
@@ -788,8 +806,10 @@
                     return
                 s = ','.join(['"%s"' % fn for fn in import_keys])
-                imported.append(s)
-                not_imported.append('%s,"Error"' % s)
+                open("%s/import/%s_imported%s.csv" % (i_home,filename,current),"a").write(s + '\n')
+                open("%s/import/%s_not_imported%s.csv" % (i_home,filename,current),"a").write('%s,"Error"' %s + '\n')
                 format = ','.join(['"%%(%s)s"' % fn for fn in import_keys])
                 format_error = format + ',"%(Error)s"'
+                #from pdb import set_trace; set_trace()
+                format = '"%(id)s",'+ format
             ds = DataStructure(data=item,datamodel=dm)
             error_string = ""
@@ -798,5 +818,6 @@
                     error_string += " %s : %s" % (k,ds.getError(k))
             if not error_string:
-                item['id'],error = creator(dm)
+                item.update(dm)
+                item['id'],error = creator(item)
                 if error:
                     error_string += error
@@ -804,6 +825,9 @@
                 item['Error'] = error_string
                 not_imported.append(format_error % item)
+                total_not_imported += 1
             else:
-                imported.append(format % dm)
+                imported.append(format % item)
+                total_imported += 1
+            total += 1
             if tr_count > 1000:
                 if len(not_imported) > 0:
@@ -819,13 +843,14 @@
                 regs = []
                 logger.info(em)
-                total += tr_count
                 tr_count = 0
-        if len(imported) > 1:
+        if len(imported) > 0:
             open("%s/import/%s_imported%s.csv" % (i_home,filename,current),"a").write(
                                                 '\n'.join(imported))
-        if len(not_imported) > 1:
+        if len(not_imported) > 0:
             open("%s/import/%s_not_imported%s.csv" % (i_home,filename,current),"a").write(
                                                 '\n'.join(not_imported))
-        return self.REQUEST.RESPONSE.redirect("%s" % self.REQUEST.get('URL1'))
+        em = "Imported: %d, not imported: %d of total %d" % (total_imported,total_not_imported,total) 
+        logger.info(em)
+        return em
     ###)
 
Index: /WAeUP_SRP/trunk/profiles/default/layouts.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/layouts.xml	(revision 1755)
+++ /WAeUP_SRP/trunk/profiles/default/layouts.xml	(revision 1756)
@@ -11,4 +11,5 @@
   <object name="department" meta_type="CPS Layout"/>
   <object name="faculty" meta_type="CPS Layout"/>
+  <object name="import" meta_type="CPS Layout"/>
   <object name="import_student" meta_type="CPS Layout"/>
   <object name="members" meta_type="CPS Layout"/>
Index: /WAeUP_SRP/trunk/profiles/default/layouts/import.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/layouts/import.xml	(revision 1756)
+++ /WAeUP_SRP/trunk/profiles/default/layouts/import.xml	(revision 1756)
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<object name="import_data" meta_type="CPS Layout">
+ <property name="layout_create_method"></property>
+ <property name="layout_edit_method"></property>
+ <property name="layout_view_method"></property>
+ <property name="style_prefix">layout_default_</property>
+ <property name="flexible_widgets"/>
+ <property name="validate_values_expr"></property>
+ <widget name="filename" meta_type="Select Widget">
+  <property name="title">Filename</property>
+  <property name="fields">
+   <element value="filename"/>
+  </property>
+  <property name="is_required">True</property>
+  <property name="label">Filename</property>
+  <property name="label_edit">Filename</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+  <property name="vocabulary">csv_names</property>
+ </widget>
+ <widget name="name" meta_type="Select Widget">
+  <property name="title">Import Name</property>
+  <property name="fields">
+   <element value="name"/>
+  </property>
+  <property name="is_required">True</property>
+  <property name="label">Import Layout</property>
+  <property name="label_edit">Import Layout</property>
+  <property name="readonly_layout_modes"/>
+  <property name="hidden_layout_modes"/>
+  <property name="hidden_readonly_layout_modes"/>
+  <property name="vocabulary">import_names</property>
+ </widget>
+ <table>
+  <row>
+   <cell name="filename"/>
+  </row>
+  <row>
+   <cell name="name"/>
+  </row>
+ </table>
+  
+</object>
Index: /WAeUP_SRP/trunk/profiles/default/schemas.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/schemas.xml	(revision 1755)
+++ /WAeUP_SRP/trunk/profiles/default/schemas.xml	(revision 1756)
@@ -16,4 +16,5 @@
  <object name="student" meta_type="CPS Schema"/>
  <object name="scratch_card_batch" meta_type="CPS Schema"/>
+ <object name="import" meta_type="CPS Schema"/>
  <object name="import_student" meta_type="CPS Schema"/>
  <object name="import_student_level_data" meta_type="CPS Schema"/>
Index: /WAeUP_SRP/trunk/profiles/default/schemas/import.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/schemas/import.xml	(revision 1756)
+++ /WAeUP_SRP/trunk/profiles/default/schemas/import.xml	(revision 1756)
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<object name="import" meta_type="CPS Schema">
+ <field name="filename" meta_type="CPS String Field"/>
+ <field name="name" meta_type="CPS String Field"/>
+</object>
Index: /WAeUP_SRP/trunk/profiles/default/vocabularies.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/vocabularies.xml	(revision 1755)
+++ /WAeUP_SRP/trunk/profiles/default/vocabularies.xml	(revision 1756)
@@ -6,8 +6,10 @@
  <object name="acco_hall_reserved_rooms" meta_type="CPS Method Vocabulary"/>
  <object name="courselevel" meta_type="CPS Vocabulary"/>
+ <object name="csv_names" meta_type="CPS Method Vocabulary"/>
  <object name="entry_modes" meta_type="CPS Vocabulary"/>
  <object name="exam_subjects" meta_type="CPS Vocabulary"/>
  <object name="exam_types" meta_type="CPS Vocabulary"/>
  <object name="exam_grades" meta_type="CPS Vocabulary"/>
+ <object name="import_names" meta_type="CPS Vocabulary"/>
  <object name="institution_types_voc" meta_type="CPS Vocabulary"/>
  <object name="get_departments_voc" meta_type="CPS Method Vocabulary"/>
Index: /WAeUP_SRP/trunk/profiles/default/vocabularies/csv_names.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/vocabularies/csv_names.xml	(revision 1756)
+++ /WAeUP_SRP/trunk/profiles/default/vocabularies/csv_names.xml	(revision 1756)
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="vocabulary.xsl"?>
+<object name="csv_names" meta_type="CPS Method Vocabulary">
+ <property name="title"></property>
+ <property name="title_msgid"></property>
+ <property name="description"></property>
+ <property name="get_vocabulary_method">get_csv_names</property>
+ <property name="add_empty_key">False</property>
+ <property name="empty_key_pos">first</property>
+ <property name="empty_key_value"></property>
+ <property name="empty_key_value_i18n"></property>
+</object>
Index: /WAeUP_SRP/trunk/profiles/default/vocabularies/import_names.xml
===================================================================
--- /WAeUP_SRP/trunk/profiles/default/vocabularies/import_names.xml	(revision 1756)
+++ /WAeUP_SRP/trunk/profiles/default/vocabularies/import_names.xml	(revision 1756)
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="vocabulary.xsl"?>
+<object name="entry_modes" meta_type="CPS Vocabulary">
+ <property name="title"></property>
+ <property name="title_msgid"></property>
+ <property name="description"></property>
+ <property name="acl_write_roles">Manager</property>
+ <item key="student" msgid="">Student Data</item>
+</object>
Index: /WAeUP_SRP/trunk/skins/waeup_default/get_csv_names.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_default/get_csv_names.py	(revision 1756)
+++ /WAeUP_SRP/trunk/skins/waeup_default/get_csv_names.py	(revision 1756)
@@ -0,0 +1,12 @@
+##parameters=key=None
+# $Id$
+"""
+Return the sessions as an vocabulary
+
+"""
+files = context.waeup_tool.get_csv_filenames()
+if key is None:
+    return [(f[:-4],f) for f in files]
+
+return files[files.index("%s.csv" % key)]
+
Index: /WAeUP_SRP/trunk/skins/waeup_default/import.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_default/import.py	(revision 1756)
+++ /WAeUP_SRP/trunk/skins/waeup_default/import.py	(revision 1756)
@@ -0,0 +1,41 @@
+##parameters=REQUEST
+# $Id$
+"""
+process the Application Form
+return html renderer + psm
+"""
+import DateTime
+from urllib import urlencode
+current = DateTime.DateTime()
+pr = context.portal_registration
+
+validate = REQUEST.has_key("import")
+
+lt = context.portal_layouts
+#pr = context.portal_registration
+
+res,psm,ds = lt.renderLayout(layout_id= 'import',
+                      schema_id= 'import',
+                      context=context,
+                      mapping=validate and REQUEST,
+                      ob={},
+                      layout_mode='create',
+                      commit=False,
+                      )
+if psm == 'invalid':
+    return context.import_form(rendered = res,
+                                 psm = "Please correct your input!",
+                                 ds = ds,
+                                 )
+elif psm == '':
+    return context.import_form(rendered = res,
+                                 psm = None,
+                                 ds = ds,
+                                 )
+elif psm == 'valid':
+    pass
+psm = context.waeup_tool.importData(ds.get('filename'),ds.get('name'))
+return context.import_form(rendered = res,
+                                 psm = psm,
+                                 ds = ds,
+                                 )
Index: /WAeUP_SRP/trunk/skins/waeup_default/import_form.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_default/import_form.pt	(revision 1756)
+++ /WAeUP_SRP/trunk/skins/waeup_default/import_form.pt	(revision 1756)
@@ -0,0 +1,29 @@
+<tal:block define="rendered_main options/rendered;
+           portal_status_message options/psm;
+           data_storage options/ds;
+           formaction options/formaction|string:import;
+           button options/button|string:import;
+           creation creation|nothing;"
+           >
+  <metal:block define-macro="edit_form">
+    <metal:block use-macro="here/waeup_content_master/macros/master">
+      <metal:block fill-slot="main">
+      <h3>Import Data</h3>
+      <br />      
+        <form action="" id="editForm" method="post" 
+              enctype="multipart/form-data" class="workflow"
+              tal:attributes="action formaction"
+              >
+          <div tal:replace="structure rendered_main" />
+          <br />
+          <input type="submit" class="standalone" 
+                 name="import" value="import"
+                 tal:attributes="value button"
+                 tal:condition="not:creation" />
+        </form>
+      </metal:block>
+      <metal:block fill-slot="sub">
+      </metal:block>
+    </metal:block>
+  </metal:block>
+</tal:block>
Index: /WAeUP_SRP/trunk/skins/waeup_default/sessions_voc.py
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_default/sessions_voc.py	(revision 1755)
+++ /WAeUP_SRP/trunk/skins/waeup_default/sessions_voc.py	(revision 1756)
@@ -11,10 +11,10 @@
     return l
 
-if len(key) != 2:
-    return 'unknown'
 try:
     y = int(key)
 except:
     return 'unknown'
+##if len(key) != 2:
+##    return 'unknown'
 if y < 90:
     cent = 2000
Index: /WAeUP_SRP/trunk/skins/waeup_design/main_template.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_design/main_template.pt	(revision 1755)
+++ /WAeUP_SRP/trunk/skins/waeup_design/main_template.pt	(revision 1756)
@@ -183,7 +183,8 @@
           <td style="" class="shapeAreaShape5 colorBarAreaColor" valign="top">
             <div style="padding: 0.5em; text-align: left;" class="fontColordefaultfontcolors fontShapeaverage">
-                    <metal:block define-slot="header" />
-                    <metal:block define-slot="main" />
-                    <metal:block define-slot="sub" />
+              <metal:block use-macro="here/generic_lib_portal_message/macros/portal_message" />
+              <metal:block define-slot="header" />
+              <metal:block define-slot="main" />
+              <metal:block define-slot="sub" />
             </div>
           </td>
Index: /WAeUP_SRP/trunk/skins/waeup_student/study_course_view.pt
===================================================================
--- /WAeUP_SRP/trunk/skins/waeup_student/study_course_view.pt	(revision 1755)
+++ /WAeUP_SRP/trunk/skins/waeup_student/study_course_view.pt	(revision 1756)
@@ -25,4 +25,8 @@
           <td width="220px">Certificate Code:</td> 
           <td><span tal:content="info/doc/study_course" /></td>
+        </tr>
+        <tr>
+          <td width="220px">Current Session:</td> 
+          <td><span tal:content="python:context.portal_vocabularies.sessions.get(info['doc'].current_session)" /></td>
         </tr>
         <tr>
