1 # -*- coding: utf-8 -*-
4 ## This file is part of Indico.
5 ## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
7 ## Indico is free software; you can redistribute it and/or
8 ## modify it under the terms of the GNU General Public License as
9 ## published by the Free Software Foundation; either version 3 of the
10 ## License, or (at your option) any later version.
12 ## Indico is distributed in the hope that it will be useful, but
13 ## WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ## General Public License for more details.
17 ## You should have received a copy of the GNU General Public License
18 ## along with Indico;if not, see <http://www.gnu.org/licenses/>.
20 import MaKaC.webinterface.pages.conferences as conferences
21 import MaKaC.webinterface.pages.registrationForm as registrationForm
22 from MaKaC.webinterface import wcomponents
23 from xml.sax.saxutils import quoteattr
24 from indico.core import config as Configuration
25 from MaKaC.webinterface import urlHandlers
27 from MaKaC.i18n import _
30 from MaKaC.plugins.EPayment.payPal import MODULE_ID
31 from MaKaC.plugins.EPayment.payPal.webinterface.wcomponents import WTemplated
32 from MaKaC.plugins.EPayment.payPal.webinterface import urlHandlers as localUrlHandlers
36 class WPConfModifEPaymentPayPalBase(registrationForm.WPConfModifRegFormBase):
38 def _createTabCtrl( self ):
39 self._tabCtrl = wcomponents.TabControl()
40 self._tabMain = self._tabCtrl.newTab( "main", _("Main"), \
41 localUrlHandlers.UHConfModifEPaymentPayPal.getURL( self._conf ) )
42 wf = self._rh.getWebFactory()
44 wf.customiseTabCtrl( self._tabCtrl )
47 def _setActiveTab( self ):
50 def _setActiveSideMenuItem(self):
51 self._regFormMenuItem.setActive(True)
53 def _getPageContent( self, params ):
55 banner = wcomponents.WEpaymentBannerModif(self._conf.getModPay().getPayModByTag(MODULE_ID), self._conf).getHTML()
56 html = wcomponents.WTabControl( self._tabCtrl, self._getAW() ).getHTML( self._getTabContent( params ) )
59 def _getTabContent( self, params ):
62 class WPConfModifEPaymentPayPal( WPConfModifEPaymentPayPalBase ):
64 def _getTabContent( self, params ):
65 wc = WConfModifEPaymentPayPal(self._conf)
67 'dataModificationURL': quoteattr(str(localUrlHandlers.UHConfModifEPaymentPayPalDataModif.getURL( self._conf )))
71 class WConfModifEPaymentPayPal( WTemplated ):
73 def __init__( self, conference ):
74 self._conf = conference
77 vars = WTemplated.getVars(self)
78 modPayPal = self._conf.getModPay().getPayModByTag(MODULE_ID)
79 vars["title"] = modPayPal.getTitle()
80 vars["url"] = modPayPal.getUrl()
81 vars["business"] = modPayPal.getBusiness()
84 class WPConfModifEPaymentPayPalDataModif( WPConfModifEPaymentPayPalBase ):
86 def _getTabContent( self, params ):
87 wc = WConfModifEPaymentPayPalDataModif(self._conf)
88 p = {'postURL': quoteattr(str(localUrlHandlers.UHConfModifEPaymentPayPalPerformDataModif.getURL( self._conf )))
92 class WConfModifEPaymentPayPalDataModif( WTemplated ):
94 def __init__( self, conference ):
95 self._conf = conference
98 vars = WTemplated.getVars(self)
99 modPayPal = self._conf.getModPay().getPayModByTag(MODULE_ID)
100 vars["title"] = modPayPal.getTitle()
101 vars["url"] = modPayPal.getUrl()
102 vars["business"] = modPayPal.getBusiness()
105 class WPconfirmEPaymentPayPal( conferences.WPConferenceDefaultDisplayBase ):
106 #navigationEntry = navigation.NERegistrationFormDisplay
108 def __init__(self, rh, conf, reg):
109 conferences.WPConferenceDefaultDisplayBase.__init__(self, rh, conf)
113 def _getBody( self, params ):
114 wc = WconfirmEPaymentPayPal(self._conf, self._registrant)
117 def _defineSectionMenu( self ):
118 conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self)
119 self._sectionMenu.setCurrentItem(self._regFormOpt)
122 class WconfirmEPaymentPayPal( WTemplated ):
123 def __init__( self,configuration, registrant):
124 self._registrant = registrant
125 self._conf = configuration
128 vars = WTemplated.getVars(self)
129 vars["message"] = "Thank you for the payment!<br/> You have used PayPal"
130 vars["trinfo"]="%s:%s"%(self._registrant.getFirstName(),self._registrant.getSurName())
133 class WPCancelEPaymentPayPal( conferences.WPConferenceDefaultDisplayBase ):
134 #navigationEntry = navigation.NERegistrationFormDisplay
136 def __init__(self, rh, conf, reg):
137 conferences.WPConferenceDefaultDisplayBase.__init__(self, rh, conf)
140 def _getBody( self, params ):
141 wc = WCancelEPaymentPayPal( self._conf,self._registrant )
144 def _defineSectionMenu( self ):
145 conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self)
146 self._sectionMenu.setCurrentItem(self._regFormOpt)
148 class WCancelEPaymentPayPal( WTemplated ):
149 def __init__( self, conference,reg ):
150 self._conf = conference
154 vars = WTemplated.getVars(self)
155 vars["message"] = "You have cancelled your transaction.\nPlease check your email in order to complete your PayPal transaction."
156 vars["messagedetailPayment"]="%s:%s"%(self._registrant.getFirstName(),self._registrant.getSurName())