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()
82 vars["shopid"] = modPayWay.getShopID()
85 class WPConfModifEPaymentPayWayDataModif( WPConfModifEPaymentPayWayBase ):
87 def _getTabContent( self, params ):
88 wc = WConfModifEPaymentPayWayDataModif(self._conf)
89 p = {'postURL': quoteattr(str(localUrlHandlers.UHConfModifEPaymentPayWayPerformDataModif.getURL( self._conf )))
93 class WConfModifEPaymentPayWayDataModif( WTemplated ):
95 def __init__( self, conference ):
96 self._conf = conference
99 vars = WTemplated.getVars(self)
100 modPayWay = self._conf.getModPay().getPayModByTag(MODULE_ID)
101 vars["title"] = modPayWay.getTitle()
102 vars["url"] = modPayWay.getUrl()
103 vars["business"] = modPayWay.getBusiness()
104 vars["shopid"] = modPayWay.getShopID()
107 class WPconfirmEPaymentPayWay( conferences.WPConferenceDefaultDisplayBase ):
108 #navigationEntry = navigation.NERegistrationFormDisplay
110 def __init__(self, rh, conf, reg):
111 conferences.WPConferenceDefaultDisplayBase.__init__(self, rh, conf)
115 def _getBody( self, params ):
116 wc = WconfirmEPaymentPayWay(self._conf, self._registrant)
119 def _defineSectionMenu( self ):
120 conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self)
121 self._sectionMenu.setCurrentItem(self._regFormOpt)
124 class WconfirmEPaymentPayWay( WTemplated ):
125 def __init__( self,configuration, registrant):
126 self._registrant = registrant
127 self._conf = configuration
130 vars = WTemplated.getVars(self)
131 vars["message"] = "Thank you for the payment!<br/> You have used PayWay"
132 vars["trinfo"]="%s:%s"%(self._registrant.getFirstName(),self._registrant.getSurName())
135 class WPCancelEPaymentPayWay( conferences.WPConferenceDefaultDisplayBase ):
136 #navigationEntry = navigation.NERegistrationFormDisplay
138 def __init__(self, rh, conf, reg):
139 conferences.WPConferenceDefaultDisplayBase.__init__(self, rh, conf)
142 def _getBody( self, params ):
143 wc = WCancelEPaymentPayWay( self._conf,self._registrant )
146 def _defineSectionMenu( self ):
147 conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self)
148 self._sectionMenu.setCurrentItem(self._regFormOpt)
150 class WCancelEPaymentPayWay( WTemplated ):
151 def __init__( self, conference,reg ):
152 self._conf = conference
156 vars = WTemplated.getVars(self)
157 vars["message"] = "You have cancelled your transaction.\nPlease check your email in order to complete your PayWay transaction."
158 vars["messagedetailPayment"]="%s:%s"%(self._registrant.getFirstName(),self._registrant.getSurName())