## $Id: viewlets.py 10818 2013-11-29 11:35:34Z 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 zope.component import getUtility
from waeup.kofa.interfaces import IExtFileStore

from waeup.kofa.students.viewlets import (
    StudentsTab, AdmissionSlipActionButton, StudentManageClearanceLink,
    StudentManagePersonalLink, StudentManageAccommodationLink,
    AddBalancePaymentActionButton,
    AddPreviousPaymentActionButton,
    MyStudentDataTab)

from kofacustom.ekodisco.interfaces import MessageFactory as _


class AdmissionSlipActionButton(AdmissionSlipActionButton):
    target = ''

class StudentManageClearanceLink(StudentManageClearanceLink):
    link = ''

class CustomStudentManagePersonalLink(StudentManagePersonalLink):
    link = ''

class CustomStudentManageAccommodationLink(StudentManageAccommodationLink):
    link = ''

class CustomAddBalancePaymentActionButton(AddBalancePaymentActionButton):
    target = ''

class CustomAddPreviousPaymentActionButton(AddPreviousPaymentActionButton):
    target = ''

class CustomMyStudentDataTab(MyStudentDataTab):
    """MyData dropdown tab in primary navigation.
    """

    @property
    def targets(self):
        student = grok.getSite()['students'][self.request.principal.id]
        student_url = self.view.url(student)
        app_slip = getUtility(IExtFileStore).getFileByContext(
            student, 'application_slip')
        targets = []
        if app_slip:
            targets = [{'url':student_url + '/application_slip',
                        'title':_('Subscription Slip')},]
        targets += [
            {'url':student_url, 'title':'Base Data'},
            {'url':student_url + '/studycourse', 'title':_('Main Contract')},
            {'url':student_url + '/payments', 'title':_('Payments')},
            {'url':student_url + '/history', 'title':_('History')},
            ]
        return targets