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.payWay import MODULE_ID
31 from MaKaC.plugins.EPayment.payWay.webinterface.wcomponents import WTemplated
32 from MaKaC.plugins.EPayment.payWay.webinterface import urlHandlers as localUrlHandlers
36 class WPConfModifEPaymentPayWayBase(registrationForm.WPConfModifRegFormBase):
38 def _createTabCtrl( self ):
39 self._tabCtrl = wcomponents.TabControl()
40 self._tabMain = self._tabCtrl.newTab( "main", _("Main"), \
41 localUrlHandlers.UHConfModifEPaymentPayWay.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 WPConfModifEPaymentPayWay( WPConfModifEPaymentPayWayBase ):
64 def _getTabContent( self, params ):
65 wc = WConfModifEPaymentPayWay(self._conf)
67 'dataModificationURL': quoteattr(str(localUrlHandlers.UHConfModifEPaymentPayWayDataModif.getURL( self._conf )))
71 class WConfModifEPaymentPayWay( WTemplated ):
73 def __init__( self, conference ):
74 self._conf = conference
77 vars = WTemplated.getVars(self)
78 modPayWay = self._conf.getModPay().getPayModByTag(MODULE_ID)
79 vars["title"] = modPayWay.getTitle()
80 vars["url"] = modPayWay.getUrl()
81 vars["business"] = modPayWay.getBusiness()
84 class WPConfModifEPaymentPayWayDataModif( WPConfModifEPaymentPayWayBase ):
86 def _getTabContent( self, params ):
87 wc = WConfModifEPaymentPayWayDataModif(self._conf)
88 p = {'postURL': quoteattr(str(localUrlHandlers.UHConfModifEPaymentPayWayPerformDataModif.getURL( self._conf )))
92 class WConfModifEPaymentPayWayDataModif( WTemplated ):
94 def __init__( self, conference ):
95 self._conf = conference
98 vars = WTemplated.getVars(self)
99 modPayWay = self._conf.getModPay().getPayModByTag(MODULE_ID)
100 vars["title"] = modPayWay.getTitle()
101 vars["url"] = modPayWay.getUrl()
102 vars["business"] = modPayWay.getBusiness()
105 class WPconfirmEPaymentPayWay( 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 = WconfirmEPaymentPayWay(self._conf, self._registrant)
117 def _defineSectionMenu( self ):
118 conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self)
119 self._sectionMenu.setCurrentItem(self._regFormOpt)
122 class WconfirmEPaymentPayWay( 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 PayWay"
130 vars["trinfo"]="%s:%s"%(self._registrant.getFirstName(),self._registrant.getSurName())
133 class WPCancelEPaymentPayWay( 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 = WCancelEPaymentPayWay( self._conf,self._registrant )
144 def _defineSectionMenu( self ):
145 conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self)
146 self._sectionMenu.setCurrentItem(self._regFormOpt)
148 class WCancelEPaymentPayWay( 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 PayWay transaction."
156 vars["messagedetailPayment"]="%s:%s"%(self._registrant.getFirstName(),self._registrant.getSurName())