Ignore:
Timestamp:
8 Mar 2012, 19:00:51 (13 years ago)
Author:
uli
Message:

Rename all non-locales stuff from sirp to kofa.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r7745 r7811  
    2929from zope.formlib.textwidgets import BytesDisplayWidget
    3030from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
    31 from waeup.sirp.accesscodes import (
     31from waeup.kofa.accesscodes import (
    3232    invalidate_accesscode, get_access_code, create_accesscode)
    33 from waeup.sirp.accesscodes.workflow import USED
    34 from waeup.sirp.browser import (
    35     SIRPPage, SIRPEditFormPage, SIRPAddFormPage, SIRPDisplayFormPage,
    36     ContactAdminForm, SIRPForm)
    37 from waeup.sirp.browser.interfaces import ICaptchaManager
    38 from waeup.sirp.browser.breadcrumbs import Breadcrumb
    39 from waeup.sirp.browser.resources import datepicker, datatable, tabs, warning
    40 from waeup.sirp.browser.layout import jsaction, action, UtilityView
    41 from waeup.sirp.interfaces import (
    42     ISIRPObject, IUserAccount, IExtFileStore, IPasswordValidator, IContactForm,
    43     ISIRPUtils, IUniversity)
    44 from waeup.sirp.interfaces import MessageFactory as _
    45 from waeup.sirp.widgets.datewidget import (
     33from waeup.kofa.accesscodes.workflow import USED
     34from waeup.kofa.browser import (
     35    KOFAPage, KOFAEditFormPage, KOFAAddFormPage, KOFADisplayFormPage,
     36    ContactAdminForm, KOFAForm)
     37from waeup.kofa.browser.interfaces import ICaptchaManager
     38from waeup.kofa.browser.breadcrumbs import Breadcrumb
     39from waeup.kofa.browser.resources import datepicker, datatable, tabs, warning
     40from waeup.kofa.browser.layout import jsaction, action, UtilityView
     41from waeup.kofa.interfaces import (
     42    IKOFAObject, IUserAccount, IExtFileStore, IPasswordValidator, IContactForm,
     43    IKOFAUtils, IUniversity)
     44from waeup.kofa.interfaces import MessageFactory as _
     45from waeup.kofa.widgets.datewidget import (
    4646    FriendlyDateWidget, FriendlyDateDisplayWidget,
    4747    FriendlyDatetimeDisplayWidget)
    48 from waeup.sirp.students.interfaces import (
     48from waeup.kofa.students.interfaces import (
    4949    IStudentsContainer, IStudent, IStudentClearance,
    5050    IStudentPersonal, IStudentBase, IStudentStudyCourse,
     
    5353    IStudentOnlinePayment, IBedTicket, IStudentsUtils, IStudentChangePassword
    5454    )
    55 from waeup.sirp.students.catalog import search
    56 from waeup.sirp.students.workflow import (ADMITTED, PAID,
     55from waeup.kofa.students.catalog import search
     56from waeup.kofa.students.workflow import (ADMITTED, PAID,
    5757    CLEARANCE, REQUESTED, RETURNING, CLEARED, REGISTERED, VALIDATED)
    58 from waeup.sirp.students.studylevel import StudentStudyLevel, CourseTicket
    59 from waeup.sirp.students.vocabularies import StudyLevelSource
    60 from waeup.sirp.browser.resources import toggleall
    61 from waeup.sirp.hostels.hostel import NOT_OCCUPIED
    62 from waeup.sirp.utils.helpers import get_current_principal
     58from waeup.kofa.students.studylevel import StudentStudyLevel, CourseTicket
     59from waeup.kofa.students.vocabularies import StudyLevelSource
     60from waeup.kofa.browser.resources import toggleall
     61from waeup.kofa.hostels.hostel import NOT_OCCUPIED
     62from waeup.kofa.utils.helpers import get_current_principal
    6363
    6464def write_log_message(view, message):
    65     ob_class = view.__implemented__.__name__.replace('waeup.sirp.','')
     65    ob_class = view.__implemented__.__name__.replace('waeup.kofa.','')
    6666    view.context.getStudent().loggerInfo(ob_class, message)
    6767    return
     
    155155    @property
    156156    def title(self):
    157         portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     157        portal_language = getUtility(IKOFAUtils).PORTAL_LANGUAGE
    158158        # There is no request attribute, thus we can only translate
    159159        # to the default (portal) language
    160         return translate(self.context.level_title, 'waeup.sirp',
     160        return translate(self.context.level_title, 'waeup.kofa',
    161161            target_language=portal_language)
    162162
    163 class StudentsContainerPage(SIRPPage):
     163class StudentsContainerPage(KOFAPage):
    164164    """The standard view for student containers.
    165165    """
     
    194194        return
    195195
    196 class StudentsContainerManagePage(SIRPPage):
     196class StudentsContainerManagePage(KOFAPage):
    197197    """The manage page for student containers.
    198198    """
     
    245245        return
    246246
    247 class StudentAddFormPage(SIRPAddFormPage):
     247class StudentAddFormPage(KOFAAddFormPage):
    248248    """Add-form to add a student.
    249249    """
     
    265265        return
    266266
    267 class StudentBaseDisplayFormPage(SIRPDisplayFormPage):
     267class StudentBaseDisplayFormPage(KOFADisplayFormPage):
    268268    """ Page to display student base data
    269269    """
     
    310310        usertype = getattr(self.request.principal,
    311311                           'user_type', 'system').title()
    312         sirp_utils = getUtility(ISIRPUtils)
    313         success = sirp_utils.sendContactForm(
     312        kofa_utils = getUtility(IKOFAUtils)
     313        success = kofa_utils.sendContactForm(
    314314                self.request.principal.title,email,
    315315                self.context.display_fullname,self.context.email,
     
    323323        return
    324324
    325 class StudentBaseManageFormPage(SIRPEditFormPage):
     325class StudentBaseManageFormPage(KOFAEditFormPage):
    326326    """ View to manage student base data
    327327    """
     
    388388        return
    389389
    390 class StudentClearanceDisplayFormPage(SIRPDisplayFormPage):
     390class StudentClearanceDisplayFormPage(KOFADisplayFormPage):
    391391    """ Page to display student clearance data
    392392    """
     
    415415    @property
    416416    def title(self):
    417         portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
    418         return translate(_('Clearance Data'), 'waeup.sirp',
     417        portal_language = getUtility(IKOFAUtils).PORTAL_LANGUAGE
     418        return translate(_('Clearance Data'), 'waeup.kofa',
    419419            target_language=portal_language)
    420420
    421421    @property
    422422    def label(self):
    423         portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     423        portal_language = getUtility(IKOFAUtils).PORTAL_LANGUAGE
    424424        return translate(_('Clearance Slip of '),
    425             'waeup.sirp', target_language=portal_language) \
     425            'waeup.kofa', target_language=portal_language) \
    426426            + ' %s' % self.context.display_fullname
    427427
     
    434434            self.context.getStudent(), studentview)
    435435
    436 class StudentClearanceManageFormPage(SIRPEditFormPage):
     436class StudentClearanceManageFormPage(KOFAEditFormPage):
    437437    """ Page to edit student clearance data
    438438    """
     
    508508        return
    509509
    510 class StudentPersonalDisplayFormPage(SIRPDisplayFormPage):
     510class StudentPersonalDisplayFormPage(KOFADisplayFormPage):
    511511    """ Page to display student personal data
    512512    """
     
    523523            mapping = {'a':self.context.display_fullname})
    524524
    525 class StudentPersonalManageFormPage(SIRPEditFormPage):
     525class StudentPersonalManageFormPage(KOFAEditFormPage):
    526526    """ Page to edit student clearance data
    527527    """
     
    538538        return
    539539
    540 class StudyCourseDisplayFormPage(SIRPDisplayFormPage):
     540class StudyCourseDisplayFormPage(KOFADisplayFormPage):
    541541    """ Page to display the student study course data
    542542    """
     
    556556    def current_mode(self):
    557557        if self.context.certificate is not None:
    558             studymodes_dict = getUtility(ISIRPUtils).getStudyModesDict()
     558            studymodes_dict = getUtility(IKOFAUtils).getStudyModesDict()
    559559            return studymodes_dict[self.context.certificate.study_mode]
    560560        return
     
    572572        return
    573573
    574 class StudyCourseManageFormPage(SIRPEditFormPage):
     574class StudyCourseManageFormPage(KOFAEditFormPage):
    575575    """ Page to edit the student study course data
    576576    """
     
    645645        return
    646646
    647 class StudyLevelDisplayFormPage(SIRPDisplayFormPage):
     647class StudyLevelDisplayFormPage(KOFADisplayFormPage):
    648648    """ Page to display student study levels
    649649    """
     
    662662    @property
    663663    def label(self):
    664         portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
    665         lang = self.request.cookies.get('sirp.language', portal_language)
    666         level_title = translate(self.context.level_title, 'waeup.sirp',
     664        portal_language = getUtility(IKOFAUtils).PORTAL_LANGUAGE
     665        lang = self.request.cookies.get('kofa.language', portal_language)
     666        level_title = translate(self.context.level_title, 'waeup.kofa',
    667667            target_language=lang)
    668668        return _('${a}: Study Level ${b}', mapping = {
     
    688688    @property
    689689    def title(self):
    690         portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
    691         return translate(_('Level Data'), 'waeup.sirp',
     690        portal_language = getUtility(IKOFAUtils).PORTAL_LANGUAGE
     691        return translate(_('Level Data'), 'waeup.kofa',
    692692            target_language=portal_language)
    693693
    694694    @property
    695695    def content_title(self):
    696         portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
    697         return translate(_('Course List'), 'waeup.sirp',
     696        portal_language = getUtility(IKOFAUtils).PORTAL_LANGUAGE
     697        return translate(_('Course List'), 'waeup.kofa',
    698698            target_language=portal_language)
    699699
    700700    @property
    701701    def label(self):
    702         portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
    703         lang = self.request.cookies.get('sirp.language', portal_language)
    704         level_title = translate(self.context.level_title, 'waeup.sirp',
     702        portal_language = getUtility(IKOFAUtils).PORTAL_LANGUAGE
     703        lang = self.request.cookies.get('kofa.language', portal_language)
     704        level_title = translate(self.context.level_title, 'waeup.kofa',
    705705            target_language=lang)
    706706        return translate(_('Course Registration Slip  '),
    707             'waeup.sirp', target_language=portal_language) \
     707            'waeup.kofa', target_language=portal_language) \
    708708            + ' %s' % level_title
    709709
    710710    def render(self):
    711         portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
    712         Sem = translate(_('Sem.'), 'waeup.sirp', target_language=portal_language)
    713         Code = translate(_('Code'), 'waeup.sirp', target_language=portal_language)
    714         Title = translate(_('Title'), 'waeup.sirp', target_language=portal_language)
    715         Dept = translate(_('Dept.'), 'waeup.sirp', target_language=portal_language)
    716         Faculty = translate(_('Faculty'), 'waeup.sirp', target_language=portal_language)
    717         Cred = translate(_('Cred.'), 'waeup.sirp', target_language=portal_language)
    718         Mand = translate(_('Mand.'), 'waeup.sirp', target_language=portal_language)
    719         Score = translate(_('Score'), 'waeup.sirp', target_language=portal_language)
     711        portal_language = getUtility(IKOFAUtils).PORTAL_LANGUAGE
     712        Sem = translate(_('Sem.'), 'waeup.kofa', target_language=portal_language)
     713        Code = translate(_('Code'), 'waeup.kofa', target_language=portal_language)
     714        Title = translate(_('Title'), 'waeup.kofa', target_language=portal_language)
     715        Dept = translate(_('Dept.'), 'waeup.kofa', target_language=portal_language)
     716        Faculty = translate(_('Faculty'), 'waeup.kofa', target_language=portal_language)
     717        Cred = translate(_('Cred.'), 'waeup.kofa', target_language=portal_language)
     718        Mand = translate(_('Mand.'), 'waeup.kofa', target_language=portal_language)
     719        Score = translate(_('Score'), 'waeup.kofa', target_language=portal_language)
    720720        studentview = StudentBaseDisplayFormPage(self.context.getStudent(),
    721721            self.request)
     
    735735            tabledata=tabledata)
    736736
    737 class StudyLevelManageFormPage(SIRPEditFormPage):
     737class StudyLevelManageFormPage(KOFAEditFormPage):
    738738    """ Page to edit the student study level data
    739739    """
     
    762762    @property
    763763    def label(self):
    764         portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
    765         lang = self.request.cookies.get('sirp.language', portal_language)
    766         level_title = translate(self.context.level_title, 'waeup.sirp',
     764        portal_language = getUtility(IKOFAUtils).PORTAL_LANGUAGE
     765        lang = self.request.cookies.get('kofa.language', portal_language)
     766        level_title = translate(self.context.level_title, 'waeup.kofa',
    767767            target_language=lang)
    768768        return _('Manage study level ${a}',
     
    853853        return
    854854
    855 class CourseTicketAddFormPage(SIRPAddFormPage):
     855class CourseTicketAddFormPage(KOFAAddFormPage):
    856856    """Add a course ticket.
    857857    """
     
    890890        self.redirect(self.url(self.context))
    891891
    892 class CourseTicketDisplayFormPage(SIRPDisplayFormPage):
     892class CourseTicketDisplayFormPage(KOFADisplayFormPage):
    893893    """ Page to display course tickets
    894894    """
     
    906906            'b':self.context.code})
    907907
    908 class CourseTicketManageFormPage(SIRPEditFormPage):
     908class CourseTicketManageFormPage(KOFAEditFormPage):
    909909    """ Page to manage course tickets
    910910    """
     
    925925        return
    926926
    927 class PaymentsManageFormPage(SIRPEditFormPage):
     927class PaymentsManageFormPage(KOFAEditFormPage):
    928928    """ Page to manage the student payments
    929929
     
    982982        self.redirect(self.url(self.context, '@@addop'))
    983983
    984 class OnlinePaymentAddFormPage(SIRPAddFormPage):
     984class OnlinePaymentAddFormPage(KOFAAddFormPage):
    985985    """ Page to add an online payment ticket
    986986    """
     
    10391039        return
    10401040
    1041 class OnlinePaymentDisplayFormPage(SIRPDisplayFormPage):
     1041class OnlinePaymentDisplayFormPage(KOFADisplayFormPage):
    10421042    """ Page to view an online payment ticket
    10431043    """
     
    11381138
    11391139
    1140 class AccommodationManageFormPage(SIRPEditFormPage):
     1140class AccommodationManageFormPage(KOFAEditFormPage):
    11411141    """ Page to manage bed tickets.
    11421142
     
    11951195        return self.actions
    11961196
    1197 class BedTicketAddPage(SIRPPage):
     1197class BedTicketAddPage(KOFAPage):
    11981198    """ Page to add an online payment ticket
    11991199    """
     
    12871287            'c':room_nr, 'd':bed_nr,
    12881288            'e':bed.bed_type})
    1289         portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     1289        portal_language = getUtility(IKOFAUtils).PORTAL_LANGUAGE
    12901290        bedticket.bed_coordinates = translate(
    1291             bc, 'waeup.sirp',target_language=portal_language)
     1291            bc, 'waeup.kofa',target_language=portal_language)
    12921292        key = str(acc_details['booking_session'])
    12931293        self.context[key] = bedticket
     
    12971297        return
    12981298
    1299 class BedTicketDisplayFormPage(SIRPDisplayFormPage):
     1299class BedTicketDisplayFormPage(KOFADisplayFormPage):
    13001300    """ Page to display bed tickets
    13011301    """
     
    13251325    @property
    13261326    def title(self):
    1327         portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
    1328         return translate(_('Bed Allocation Data'), 'waeup.sirp',
     1327        portal_language = getUtility(IKOFAUtils).PORTAL_LANGUAGE
     1328        return translate(_('Bed Allocation Data'), 'waeup.kofa',
    13291329            target_language=portal_language)
    13301330
    13311331    @property
    13321332    def label(self):
    1333         portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     1333        portal_language = getUtility(IKOFAUtils).PORTAL_LANGUAGE
    13341334        return translate(_('Bed Allocation: '),
    1335             'waeup.sirp', target_language=portal_language) \
     1335            'waeup.kofa', target_language=portal_language) \
    13361336            + ' %s' % self.context.bed_coordinates
    13371337
     
    14051405            'c':room_nr, 'd':bed_nr,
    14061406            'e':new_bed.bed_type})
    1407         portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
     1407        portal_language = getUtility(IKOFAUtils).PORTAL_LANGUAGE
    14081408        self.context.bed_coordinates = translate(
    1409             bc, 'waeup.sirp',target_language=portal_language)
     1409            bc, 'waeup.kofa',target_language=portal_language)
    14101410        self.flash(_('Student relocated: ${a}',
    14111411            mapping = {'a':self.context.bed_coordinates}))
     
    14161416        return
    14171417
    1418 class StudentHistoryPage(SIRPPage):
     1418class StudentHistoryPage(KOFAPage):
    14191419    """ Page to display student clearance data
    14201420    """
     
    14311431# Pages for students only
    14321432
    1433 class StudentBaseEditFormPage(SIRPEditFormPage):
     1433class StudentBaseEditFormPage(KOFAEditFormPage):
    14341434    """ View to edit student base data
    14351435    """
     
    14471447        return
    14481448
    1449 class StudentChangePasswordPage(SIRPEditFormPage):
     1449class StudentChangePasswordPage(KOFAEditFormPage):
    14501450    """ View to manage student base data
    14511451    """
     
    14731473        return
    14741474
    1475 class StudentFilesUploadPage(SIRPPage):
     1475class StudentFilesUploadPage(KOFAPage):
    14761476    """ View to upload files by student
    14771477    """
     
    14901490        return
    14911491
    1492 class StartClearancePage(SIRPPage):
     1492class StartClearancePage(KOFAPage):
    14931493    grok.context(IStudent)
    14941494    grok.name('start_clearance')
     
    15931593        return
    15941594
    1595 class RequestClearancePage(SIRPPage):
     1595class RequestClearancePage(KOFAPage):
    15961596    grok.context(IStudent)
    15971597    grok.name('request_clearance')
     
    16241624        return
    16251625
    1626 class StartCourseRegistrationPage(SIRPPage):
     1626class StartCourseRegistrationPage(KOFAPage):
    16271627    grok.context(IStudentStudyCourse)
    16281628    grok.name('start_course_registration')
     
    16731673        return
    16741674
    1675 class AddStudyLevelFormPage(SIRPEditFormPage):
     1675class AddStudyLevelFormPage(KOFAEditFormPage):
    16761676    """ Page for students to add current study levels
    16771677    """
     
    17101710        return
    17111711
    1712 class StudyLevelEditFormPage(SIRPEditFormPage):
     1712class StudyLevelEditFormPage(KOFAEditFormPage):
    17131713    """ Page to edit the student study level data by students
    17141714    """
     
    17321732    @property
    17331733    def label(self):
    1734         portal_language = getUtility(ISIRPUtils).PORTAL_LANGUAGE
    1735         lang = self.request.cookies.get('sirp.language', portal_language)
    1736         level_title = translate(self.context.level_title, 'waeup.sirp',
     1734        portal_language = getUtility(IKOFAUtils).PORTAL_LANGUAGE
     1735        lang = self.request.cookies.get('kofa.language', portal_language)
     1736        level_title = translate(self.context.level_title, 'waeup.kofa',
    17371737            target_language=lang)
    17381738        return _('Add and remove course tickets of study level ${a}',
     
    18161816        return
    18171817
    1818 class ChangePasswordRequestPage(SIRPForm):
     1818class ChangePasswordRequestPage(KOFAForm):
    18191819    """Captcha'd page for students to request a password change.
    18201820    """
     
    18511851        student = list(results)[0]
    18521852        # Change password
    1853         sirp_utils = getUtility(ISIRPUtils)
    1854         pwd = sirp_utils.genPassword()
     1853        kofa_utils = getUtility(IKOFAUtils)
     1854        pwd = kofa_utils.genPassword()
    18551855        IUserAccount(student).setPassword(pwd)
    18561856        # Send email with new redentials
    18571857        msg = _('You have successfully changed your password for the')
    18581858        login_url = self.url(grok.getSite(), 'login')
    1859         success = sirp_utils.sendCredentials(
     1859        success = kofa_utils.sendCredentials(
    18601860            IUserAccount(student),pwd,login_url,msg)
    18611861        if success:
     
    18661866        return
    18671867
    1868 class SetPasswordPage(SIRPPage):
    1869     grok.context(ISIRPObject)
     1868class SetPasswordPage(KOFAPage):
     1869    grok.context(IKOFAObject)
    18701870    grok.name('setpassword')
    18711871    grok.require('waeup.Anonymous')
Note: See TracChangeset for help on using the changeset viewer.