Index: main/waeup.aaue/trunk/src/waeup/aaue/students/reports/raw_score_report.py
===================================================================
--- main/waeup.aaue/trunk/src/waeup/aaue/students/reports/raw_score_report.py	(revision 14380)
+++ main/waeup.aaue/trunk/src/waeup/aaue/students/reports/raw_score_report.py	(revision 14381)
@@ -29,4 +29,5 @@
 from waeup.kofa.browser.pdf import get_signature_tables
 from waeup.kofa.students.vocabularies import StudyLevelSource
+from waeup.kofa.students.reports.level_report import LevelReportGeneratorPage
 from waeup.kofa.students.reports.student_statistics import (
     StudentStatisticsReportPDFView)
@@ -283,83 +284,9 @@
 from waeup.kofa.browser.breadcrumbs import Breadcrumb
 grok.templatedir('browser_templates')
-class RawScoreReportGeneratorPage(KofaPage):
+class RawScoreReportGeneratorPage(LevelReportGeneratorPage):
 
     grok.context(RawScoreReportGenerator)
-    grok.name('index.html')
-    grok.require('waeup.handleReports')
-    grok.template('levelreportgeneratorpage')
 
     label = _('Create raw score report')
-
-    @property
-    def generator_name(self):
-        for name, gen in get_generators():
-            if gen == self.context:
-                return name
-        return None
-
-    def update(self, CREATE=None, faccode_depcode=None,
-               session=None, level=None):
-        self.parent_url = self.url(self.context.__parent__)
-        self._set_session_values()
-        self._set_level_values()
-        self._set_faccode_depcode_values()
-        if CREATE and session:
-            # create a new report job for students by session
-            faccode = faccode_depcode.split('_')[0]
-            depcode = faccode_depcode.split('_')[1]
-            container = self.context.__parent__
-            user_id = self.request.principal.id
-            if level:
-                level = int(level)
-            if session:
-                session = int(session)
-            kw = dict(
-                session=session,
-                level=level,
-                faccode=faccode,
-                depcode=depcode)
-            self.flash(_('New report is being created in background'))
-            job_id = container.start_report_job(
-                self.generator_name, user_id, kw=kw)
-            ob_class = self.__implemented__.__name__.replace('waeup.kofa.','')
-            grok.getSite().logger.info(
-                '%s - report %s created: %s (faculty=%s, department=%s, session=%s, level=%s)' % (
-                ob_class, job_id, self.context.title, faccode, depcode, session, level))
-            self.redirect(self.parent_url)
-            return
-        return
-
-    def _set_session_values(self):
-        vocab_terms = academic_sessions_vocab.by_value.values()
-        self.sessions = [(x.title, x.token) for x in vocab_terms]
-        return
-
-    #def _set_level_values(self):
-    #    vocab_terms = course_levels.by_value.values()
-    #    self.levels = sorted([(x.title, x.token) for x in vocab_terms])
-    #    return
-
-    def _set_level_values(self):
-        portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE
-        studylevelsource = StudyLevelSource().factory
-        self.levels = []
-        for code in studylevelsource.getValues(None):
-            title = translate(studylevelsource.getTitle(None, code),
-                'waeup.kofa', target_language=portal_language)
-            self.levels.append((title, code))
-        return
-
-    def _set_faccode_depcode_values(self):
-        faccode_depcodes = []
-        faculties = grok.getSite()['faculties']
-        for fac in faculties.values():
-            for dep in fac.values():
-                faccode_depcodes.append(
-                    ('%s (%s)' %(dep.longtitle, fac.longtitle),
-                     '%s_%s' %(fac.code, dep.code)))
-        self.faccode_depcodes = sorted(
-            faccode_depcodes, key=lambda value: value[0])
-        return
 
 class RawScoreReportPDFView(StudentStatisticsReportPDFView):
