Index: WAeUP_SRP/trunk/skins/waeup_utilities/fixLevelFromResults.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_utilities/fixLevelFromResults.py	(revision 1389)
+++ WAeUP_SRP/trunk/skins/waeup_utilities/fixLevelFromResults.py	(revision 1391)
@@ -5,5 +5,5 @@
 ##bind script=script
 ##bind subpath=traverse_subpath
-##parameters=REQUEST
+##parameters=
 ##title=
 ##
@@ -13,13 +13,13 @@
 """
 
-request = REQUEST
 request = context.REQUEST
 session = request.SESSION
 response = request.RESPONSE
-def rwrite(s):
-    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
-    #response.setHeader('Content-length','%d' % (len(s)))
-    #response.setStatus('OK')
-    response.write(s)
+setheader = request.RESPONSE.setHeader
+
+#def rwrite(s):
+#    response.setHeader('Content-type','text/html; charset=ISO-8859-15')
+#    response.write(s)
+    
 wftool = context.portal_workflow
 mtool = context.portal_membership
@@ -33,12 +33,19 @@
 students = context.portal_url.getPortalObject().campus.students
 
+
+
+
 if str(member) not in ('admin','joachim'):
-    return 
+    return
 count = 0
 lc = 1
+lines = []
 #from Products.zdb import set_trace;set_trace()
 res = scat()
 for sbrain in res:
-    ec = "nor"
+    if str(sbrain.level) == '100':
+        ec = "new"
+    else:
+        ec = "nor"
     erg = context.results_import(matric_no=sbrain.matric_no)
     if erg and erg[0].Level:
@@ -48,10 +55,10 @@
             ec = "E"
             if level != e.Level:
-                ec = "%s:%s!=%s<br />\n" % (sbrain.matric_no,level,e.Level) 
+                ec = "%s:%s!=%s<br />\n" % (sbrain.matric_no,level,e.Level)
         level = "%d" % (int(level) + 100)
-        
+
         # würde ich an dieser Stelle nicht machen (siehe unten)
-        #context.students_catalog.modifyRecord(id = sbrain.id, level=level) 
-        
+        #context.students_catalog.modifyRecord(id = sbrain.id, level=level)
+
         while True:
             student = getattr(students,sbrain.id,None)
@@ -63,9 +70,10 @@
             if study_course is None:
                 break
-            study_course.getContent().edit(mapping = {'current_level':level})
-            
+            # zum Testen auskommentiert    
+            #study_course.getContent().edit(mapping = {'current_level':level})
+
             #dies ist der richtige Platz
-            context.students_catalog.modifyRecord(id = sbrain.id, level=level)  
-            
+            context.students_catalog.modifyRecord(id = sbrain.id, level=level)
+
             ec = "reg"
             break
@@ -74,8 +82,13 @@
         else:
             old_level = 'non'
-        rwrite(ec +"--"+ sbrain.id +"--"+ sbrain.matric_no +"--"+ old_level +"--"+ level +"<br />")
+#        rwrite(ec +"--"+ sbrain.id +"--"+ sbrain.matric_no +"--"+ old_level +"--"+ level +"<br />")
+
+        lines.append('"%s","%s","%s","%s","%s"' % (ec,sbrain.id,sbrain.matric_no,old_level,level))
         
+
     else:
-        rwrite(ec +"--"+ sbrain.id +"--"+ sbrain.matric_no + "<br />")
+#        rwrite(ec +"--"+ sbrain.id +"--"+ sbrain.matric_no + "<br />")
+        lines.append('"%s","%s","%s","",""' % (ec,sbrain.id,sbrain.matric_no))
+        
 #    count += 1
 #    if count > 60:
@@ -83,4 +96,13 @@
 #        rwrite("<br />\n%3d " % lc)
 #        count = 0
-rwrite("<br />\n Done" )
 
+#rwrite("<br />\n Done" )
+
+setheader('Content-type','text/semicolon-seperated-values')
+setheader('Content-Disposition:', 'attachment; filename="fixLevelExport.csv"')
+setheader('Expires',  'Mon, 26 Jul 1997 05:00:00GMT') # Date in the past
+setheader('Cache-Control', 'no-store, no-cache,must-revalidate') # HTTP/1.1
+setheader('Cache-Control', 'post-check=0,pre-check=0')
+setheader('Pragma', 'no-cache') # HTTP/1.0
+return '\n'.join(lines)
+
Index: WAeUP_SRP/trunk/skins/waeup_utilities/removeResults.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_utilities/removeResults.py	(revision 1389)
+++ WAeUP_SRP/trunk/skins/waeup_utilities/removeResults.py	(revision 1391)
@@ -22,4 +22,41 @@
     response.write(s)
 
+res_to_del = ('ART0206832', 
+    'ART0206156',
+    'ART0206812',
+    'ART0206841',
+    'ART0206813',
+    'ART0206816',
+    'ART0206614',
+    'ART0206817',
+    'ART0206830',
+    'ART0205970',
+    'ART0206158',
+    'ART0206811',
+    'ART0206815',
+    'ART0301351',
+    'ART0301319',
+    'ART0301310',
+    'ART0308340',
+    'ART0206157',
+    'ART0206833',
+    'ART0206831',
+    'ART0206964',
+    'ART0206838',
+    'ART0206821',
+    'ART0206844',
+    'ART0206828',
+    'ART0206820',
+    'ART0206842',
+    'ART0206834',
+    'ART0206839',
+    'ART0206819',
+    'ART0206825',
+    'ART0206818',
+    'ART0206840',
+    'ART0206836',
+    'ART0206829')
+
+
 wftool = context.portal_workflow
 mtool = context.portal_membership
@@ -31,18 +68,17 @@
 if str(member) not in ('admin','joachim'):
     return
-rwrite("start <br />")
-for m in rcat.uniqueValuesFor('matric_no'):
+rwrite("start")
+#for m in rcat.uniqueValuesFor('matric_no'):
+for m in res_to_del:
     #if m.startswith('ART'):
     res_r = rcat(matric_no = m)
-    res_s = scat(matric_no = m)
-    if res_s and res_s[0].course == 'BARTTHR' and res_s[0].level =="500":
-        to_del = []
-        for r in res_r:
-            to_del.append(r.key)
-            
-        #zum Testen auskommentiert    
-        #for uid in to_del:
-            #rcat.deleteRecord(uid)
-            
-        rwrite(m+" "+res_s[0].course+" "+res_s[0].level + " " + str(len(to_del)) +"<br />")
-rwrite("<br />\n Done" )        
+    #res_s = scat(matric_no = m)
+    #if res_s and res_s[0].course == 'BARTTHR' and res_s[0].level =="500":
+    to_del = []
+    for r in res_r:
+        to_del.append(r.key)
+        rwrite(m+" "+r.Level +"  " + r.CosCode + "<br />")
+    #for uid in to_del:
+        #rcat.deleteRecord(uid)
+rwrite("Done")
+
