## $Id: viewlets.py 8460 2012-05-16 13:10:04Z henrik $
##
## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##

import grok
from waeup.kofa.students.viewlets import (
    FileDisplay, FileUpload, Image)
from waeup.kofa.students.browser import ExportPDFClearanceSlipPage

from waeup.fceokene.interfaces import MessageFactory as _

# LGA Identification

class LGAIdentificationDisplay(FileDisplay):
    """LGA Identification display viewlet.
    """
    grok.order(1)
    label = _(u'LGA Identification')
    title = _(u'LGA Identification Scan')
    download_name = u'lga_ident'

class LGAIdentificationSlip(LGAIdentificationDisplay):
    grok.view(ExportPDFClearanceSlipPage)

class LGAIdentificationUpload(FileUpload):
    """LGA Identification upload viewlet.
    """
    grok.order(2)
    label = _(u'LGA Identification')
    title = _(u'LGA Identification Scan')
    mus = 1024 * 150
    download_name = u'lga_ident'

class LGAIdentificationImage(Image):
    """Renders LGA Identification scan.
    """
    grok.name('lga_ident')
    download_name = u'lga_ident'

# First Sitting Result

class FirstSittingResultDisplay(FileDisplay):
    """First Sitting Result display viewlet.
    """
    grok.order(1)
    label = _(u'First Sitting Result')
    title = _(u'First Sitting Result')
    download_name = u'fst_sit_scan'

class FirstSittingResultSlip(FirstSittingResultDisplay):
    grok.view(ExportPDFClearanceSlipPage)

class FirstSittingResultUpload(FileUpload):
    """First Sitting Result upload viewlet.
    """
    grok.order(2)
    label = _(u'First Sitting Result')
    title = _(u'First Sitting Result Scan')
    mus = 1024 * 150
    download_name = u'fst_sit_scan'

class FirstSittingResultImage(Image):
    """Renders First Sitting Result scan.
    """
    grok.name('fst_sit_scan')
    download_name = u'fst_sit_scan'

# Second Sitting Result

class SecondSittingResultDisplay(FileDisplay):
    """Second Sitting Result display viewlet.
    """
    grok.order(1)
    label = _(u'Second Sitting Result')
    title = _(u'Second Sitting Result')
    download_name = u'scd_sit_scan'

class SecondSittingResultSlip(SecondSittingResultDisplay):
    grok.view(ExportPDFClearanceSlipPage)

class SecondSittingResultUpload(FileUpload):
    """Second Sitting Result upload viewlet.
    """
    grok.order(2)
    label = _(u'Second Sitting Result')
    title = _(u'Second Sitting Result Scan')
    mus = 1024 * 150
    download_name = u'scd_sit_scan'

class SecondSittingResultImage(Image):
    """Renders Second Sitting Result scan.
    """
    grok.name('scd_sit_scan')
    download_name = u'scd_sit_scan'

# Higher Qualification Result

class HigherQualificationResultDisplay(FileDisplay):
    """Higher Qualification Result display viewlet.
    """
    grok.order(1)
    label = _(u'Higher Qualification Result')
    title = _(u'Higher Qualification Result')
    download_name = u'hq_scan'

class HigherQualificationResultSlip(HigherQualificationResultDisplay):
    grok.view(ExportPDFClearanceSlipPage)

class HigherQualificationResultUpload(FileUpload):
    """Higher Qualification Result upload viewlet.
    """
    grok.order(2)
    label = _(u'Higher Qualification Result')
    title = _(u'Higher Qualification Result Scan')
    mus = 1024 * 150
    download_name = u'hq_scan'

class HigherQualificationResultImage(Image):
    """Renders Higher Qualification Result scan.
    """
    grok.name('hq_scan')
    download_name = u'hq_scan'

# 2nd Higher Qualification Result (PG Students only)

class SecondHigherQualificationResultDisplay(FileDisplay):
    """Second Higher Qualification Result display viewlet.
    """
    grok.order(1)
    label = _(u'Second Higher Qualification Result')
    title = _(u'Second Higher Qualification Result')
    download_name = u'hq_scan2'

class SecondHigherQualificationResultSlip(SecondHigherQualificationResultDisplay):
    grok.view(ExportPDFClearanceSlipPage)

class SecondHigherQualificationResultUpload(FileUpload):
    """Second Higher Qualification Result upload viewlet.
    """
    grok.order(2)
    label = _(u'Second Higher Qualification Result')
    title = _(u'Second Higher Qualification Result Scan')
    mus = 1024 * 150
    download_name = u'hq_scan2'

    @property
    def show_viewlet(self):
        cm = getattr(self.context,'current_mode', None)
        if cm is not None and cm.startswith('pg'):
            return True
        return False

class SecondHigherQualificationResultImage(Image):
    """Renders Second Higher Qualification Result scan.
    """
    grok.name('hq_scan2')
    download_name = u'hq_scan2'

# Advanced Level Result

class AdvancedLevelResultDisplay(FileDisplay):
    """Advanced Level Result display viewlet.
    """
    grok.order(1)
    label = _(u'Advanced Level Result')
    title = _(u'Advanced Level Result')
    download_name = u'alr_scan'

class AdvancedLevelResultSlip(AdvancedLevelResultDisplay):
    grok.view(ExportPDFClearanceSlipPage)

class AdvancedLevelResultUpload(FileUpload):
    """Advanced Level Result upload viewlet.
    """
    grok.order(2)
    label = _(u'Advanced Level Result')
    title = _(u'Advanced Level Result Scan')
    mus = 1024 * 150
    download_name = u'alr_scan'

class AdvancedLevelResultImage(Image):
    """Renders Advanced Level Result scan.
    """
    grok.name('alr_scan')
    download_name = u'alr_scan'

# Certificate 

class CertificateDisplay(FileDisplay):
    """Certificate display viewlet.
    """
    grok.order(1)
    label = _(u'Certificate')
    title = _(u'Certificate')
    download_name = u'certificate'

class CertificateSlip(CertificateDisplay):
    grok.view(ExportPDFClearanceSlipPage)

class CertificateUpload(FileUpload):
    """Certificate upload viewlet.
    """
    grok.order(2)
    label = _(u'Certificate')
    title = _(u'Certificate Scan')
    mus = 1024 * 150
    download_name = u'certificate'

class CertificateImage(Image):
    """Renders Certificate scan.
    """
    grok.name('certificate')
    download_name = u'certificate'

# Second Certificate (PG Students only)

class SecondCertificateDisplay(FileDisplay):
    """ Second Certificate display viewlet.
    """
    grok.order(1)
    label = _(u'Second Certificate')
    title = _(u'Second Certificate')
    download_name = u'certificate2'

class SecondCertificateSlip(SecondCertificateDisplay):
    grok.view(ExportPDFClearanceSlipPage)

class SecondCertificateUpload(FileUpload):
    """Second Certificate upload viewlet.
    """
    grok.order(2)
    label = _(u'Second Certificate')
    title = _(u'Second Certificate Scan')
    mus = 1024 * 150
    download_name = u'certificate2'

    @property
    def show_viewlet(self):
        cm = getattr(self.context,'current_mode', None)
        if cm is not None and cm.startswith('pg'):
            return True
        return False

class CertificateImage(Image):
    """Renders Second Certificate scan.
    """
    grok.name('certificate2')
    download_name = u'certificate2'

# Third Certificate (PG Students only)

class ThirdCertificateDisplay(FileDisplay):
    """ Third Certificate display viewlet.
    """
    grok.order(1)
    label = _(u'Third Certificate')
    title = _(u'Third Certificate')
    download_name = u'certificate3'

class ThirdCertificateSlip(ThirdCertificateDisplay):
    grok.view(ExportPDFClearanceSlipPage)

class ThirdCertificateUpload(FileUpload):
    """Third Certificate upload viewlet.
    """
    grok.order(2)
    label = _(u'Third Certificate')
    title = _(u'Third Certificate Scan')
    mus = 1024 * 150
    download_name = u'certificate3'

    @property
    def show_viewlet(self):
        cm = getattr(self.context,'current_mode', None)
        if cm is not None and cm.startswith('pg'):
            return True
        return False

class CertificateImage(Image):
    """Renders Third Certificate scan.
    """
    grok.name('certificate3')
    download_name = u'certificate3'

# Evidence of Name

class EvidenceNameDisplay(FileDisplay):
    """Evidence of Name display viewlet.
    """
    grok.order(1)
    label = _(u'Evidence of Name')
    title = _(u'Evidence of Name')
    download_name = u'evid'

class EvidenceNameSlip(EvidenceNameDisplay):
    grok.view(ExportPDFClearanceSlipPage)

class EvidenceNameUpload(FileUpload):
    """Evidence of Name upload viewlet.
    """
    grok.order(2)
    label = _(u'Evidence of Name')
    title = _(u'Evidence of Name Scan')
    mus = 1024 * 150
    download_name = u'evid'

class EvidenceNameImage(Image):
    """Renders Evidence of Name scan.
    """
    grok.name('evid')
    download_name = u'evid'

# Result Statement

class ResultStatementDisplay(FileDisplay):
    """Result Statement display viewlet.
    """
    grok.order(1)
    label = _(u'Result Statement')
    title = _(u'Result Statement')
    download_name = u'res_stat'

class ResultStatementSlip(ResultStatementDisplay):
    grok.view(ExportPDFClearanceSlipPage)

class ResultStatementUpload(FileUpload):
    """Result Statement upload viewlet.
    """
    grok.order(2)
    label = _(u'Result Statement')
    title = _(u'Result Statement Scan')
    mus = 1024 * 150
    download_name = u'res_stat'

class ResultStatementImage(Image):
    """Renders Result Statement scan.
    """
    grok.name('res_stat')
    download_name = u'res_stat'

# Referee Letter

class RefereeLetterDisplay(FileDisplay):
    """Referee Letter display viewlet.
    """
    grok.order(1)
    label = _(u'Referee Letter')
    title = _(u'Referee Letter')
    download_name = u'ref_let'

class RefereeLetterSlip(RefereeLetterDisplay):
    grok.view(ExportPDFClearanceSlipPage)

class RefereeLetterUpload(FileUpload):
    """Referee Letter upload viewlet.
    """
    grok.order(2)
    label = _(u'Referee Letter')
    title = _(u'Referee Letter Scan')
    mus = 1024 * 150
    download_name = u'ref_let'

class RefereeLetterImage(Image):
    """Renders Referee Letter scan.
    """
    grok.name('ref_let')
    download_name = u'ref_let'

# Second Referee Letter (PG Students only)

class SecondRefereeLetterDisplay(FileDisplay):
    """Second Referee Letter display viewlet.
    """
    grok.order(1)
    label = _(u'Second Referee Letter')
    title = _(u'Second Referee Letter')
    download_name = u'ref_let2'

class SecondRefereeLetterSlip(SecondRefereeLetterDisplay):
    grok.view(ExportPDFClearanceSlipPage)

class SecondRefereeLetterUpload(FileUpload):
    """Referee Letter upload viewlet.
    """
    grok.order(2)
    label = _(u'Second Referee Letter')
    title = _(u'Second Referee Letter Scan')
    mus = 1024 * 150
    download_name = u'ref_let2'

    @property
    def show_viewlet(self):
        cm = getattr(self.context,'current_mode', None)
        if cm is not None and cm.startswith('pg'):
            return True
        return False

class SecondRefereeLetterImage(Image):
    """Renders Referee Letter scan.
    """
    grok.name('ref_let2')
    download_name = u'ref_let2'

# Third Referee Letter (PG Students only)

class ThirdRefereeLetterDisplay(FileDisplay):
    """Third Referee Letter display viewlet.
    """
    grok.order(1)
    label = _(u'Third Referee Letter')
    title = _(u'Third Referee Letter')
    download_name = u'ref_let3'

class ThirdRefereeLetterSlip(ThirdRefereeLetterDisplay):
    grok.view(ExportPDFClearanceSlipPage)

class ThirdRefereeLetterUpload(FileUpload):
    """Referee Letter upload viewlet.
    """
    grok.order(2)
    label = _(u'Third Referee Letter')
    title = _(u'Third Referee Letter Scan')
    mus = 1024 * 150
    download_name = u'ref_let3'

    @property
    def show_viewlet(self):
        cm = getattr(self.context,'current_mode', None)
        if cm is not None and cm.startswith('pg'):
            return True
        return False

class ThirdRefereeLetterImage(Image):
    """Renders Referee Letter scan.
    """
    grok.name('ref_let3')
    download_name = u'ref_let3'

# Statutory Declaration of Good Conduct

class StatutoryDeclarationDisplay(FileDisplay):
    """Statutory Declaration of Good Conduct display viewlet.
    """
    grok.order(1)
    label = _(u'Statutory Declaration of Good Conduct')
    title = _(u'Statutory Declaration of Good Conduct')
    download_name = u'stat_dec'

class StatutoryDeclarationSlip(StatutoryDeclarationDisplay):
    grok.view(ExportPDFClearanceSlipPage)

class StatutoryDeclarationUpload(FileUpload):
    """Statutory Declaration of Good Conduct upload viewlet.
    """
    grok.order(2)
    label = _(u'Statutory Declaration of Good Conduct')
    title = _(u'Statutory Declaration of Good Conduct Scan')
    mus = 1024 * 150
    download_name = u'stat_dec'

class StatutoryDeclarationImage(Image):
    """Renders Statutory Declaration of Good Conduct scan.
    """
    grok.name('stat_dec')
    download_name = u'stat_dec'

# Letter of Admission (PG Students only)

class LetterAdmissionDisplay(FileDisplay):
    """Letter of Admission display viewlet.
    """
    grok.order(1)
    label = _(u'Letter of Admission')
    title = _(u'Letter of Admission')
    download_name = u'admission_let'

class LetterAdmissionSlip(LetterAdmissionDisplay):
    grok.view(ExportPDFClearanceSlipPage)

class LetterAdmissionUpload(FileUpload):
    """Letter of Admission upload viewlet.
    """
    grok.order(2)
    label = _(u'Letter of Admission')
    title = _(u'Letter of Admission Scan')
    mus = 1024 * 150
    download_name = u'admission_let'

    @property
    def show_viewlet(self):
        cm = getattr(self.context,'current_mode', None)
        if cm is not None and cm.startswith('pg'):
            return True
        return False

class LetterAdmissionImage(Image):
    """Renders Letter of Admission scan.
    """
    grok.name('admission_let')
    download_name = u'admission_let'