source: indico/indico/MaKaC/plugins/EPayment/yellowPay/webinterface/pages/ePayments.py @ 2da594

burotelhello-world-walkthroughipv6v0.98-seriesv0.98.2v0.98.3v0.98b1v0.98b2v0.99v1.0v1.1
Last change on this file since 2da594 was 2da594, checked in by Pedro Ferreira <jose.pedro.ferreira@…>, 2 years ago

[FIX] EPayment plugins - use ids instead of names

  • Cleaned it up a little bit;
  • Got rid of try: except: pass;
  • Hopefully it's testable now;
  • Property mode set to 100644
File size: 7.1 KB
Line 
1# -*- coding: utf-8 -*-
2##
3##
4## This file is part of CDS Indico.
5## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN.
6##
7## CDS 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 2 of the
10## License, or (at your option) any later version.
11##
12## CDS 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.
16##
17## You should have received a copy of the GNU General Public License
18## along with CDS Indico; if not, write to the Free Software Foundation, Inc.,
19## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
20
21import MaKaC.webinterface.pages.conferences as conferences
22import MaKaC.webinterface.pages.registrationForm as registrationForm
23from MaKaC.webinterface import wcomponents
24from xml.sax.saxutils import quoteattr
25from MaKaC.common import Configuration
26from MaKaC.webinterface import urlHandlers
27import MaKaC
28
29from MaKaC.plugins.EPayment.yellowPay.webinterface.wcomponents import WTemplated
30from MaKaC.plugins.EPayment.yellowPay.webinterface import urlHandlers as localUrlHandlers
31from MaKaC.plugins.EPayment.yellowPay import MODULE_ID
32
33
34
35class WPConfModifEPaymentYellowPayBase(registrationForm.WPConfModifRegFormBase):
36
37    def _createTabCtrl( self ):
38        self._tabCtrl = wcomponents.TabControl()
39        self._tabMain = self._tabCtrl.newTab( "main", "Main", \
40                localUrlHandlers.UHConfModifEPaymentYellowPay.getURL( self._conf ) )
41        wf = self._rh.getWebFactory()
42        if wf:
43            wf.customiseTabCtrl( self._tabCtrl )
44        self._setActiveTab()
45
46    def _setActiveTab( self ):
47        pass
48
49    def _setActiveSideMenuItem(self):
50        self._regFormMenuItem.setActive(True)
51
52    def _getPageContent( self, params ):
53        self._createTabCtrl()
54        banner = wcomponents.WEpaymentBannerModif(self._conf.getModPay().getPayModByTag(MODULE_ID), self._conf).getHTML()
55        html = wcomponents.WTabControl( self._tabCtrl, self._getAW() ).getHTML( self._getTabContent( params ) )
56        return banner+html
57
58    def _getTabContent( self, params ):
59        return "nothing"
60
61class WPConfModifEPaymentYellowPay( WPConfModifEPaymentYellowPayBase ):
62   
63    def _getTabContent( self, params ):
64        wc = WConfModifEPaymentYellowPay(self._conf)
65        p = {
66             'dataModificationURL': quoteattr(str(localUrlHandlers.UHConfModifEPaymentYellowPayDataModif.getURL( self._conf )))
67            }
68        return wc.getHTML(p)
69
70class WConfModifEPaymentYellowPay( WTemplated ):
71   
72    def __init__( self, conference ):
73        self._conf = conference
74
75    def getVars( self ):
76        vars = WTemplated.getVars(self)
77        modYellowPay = self._conf.getModPay().getPayModByTag(MODULE_ID)
78        vars["title"] = modYellowPay.getTitle()
79        vars["url"] = modYellowPay.getUrl()
80        vars["shopid"] =  modYellowPay.getShopID()
81        vars["mastershopid"] =  modYellowPay.getMasterShopID()
82        vars["hashseed"] =  modYellowPay.getHashSeed()
83        return vars
84
85class WPConfModifEPaymentYellowPayDataModif( WPConfModifEPaymentYellowPayBase ):
86   
87    def _getTabContent( self, params ):
88        wc = WConfModifEPaymentYellowPayDataModif(self._conf)
89        p = {'postURL': quoteattr(str(localUrlHandlers.UHConfModifEPaymentYellowPayPerformDataModif.getURL( self._conf )))
90            }
91        return wc.getHTML(p)
92
93class WConfModifEPaymentYellowPayDataModif( WTemplated ):
94   
95    def __init__( self, conference ):
96        self._conf = conference
97
98    def getVars( self ):
99        vars = WTemplated.getVars(self)
100        modYellowPay = self._conf.getModPay().getPayModByTag(MODULE_ID)
101        vars["title"] = modYellowPay.getTitle()
102        vars["url"] = modYellowPay.getUrl()
103        vars["shopid"] =  modYellowPay.getShopID()
104        vars["mastershopid"] =  modYellowPay.getMasterShopID()
105        vars["hashseed"] =  modYellowPay.getHashSeed()
106        return vars
107
108class WPconfirmEPaymentYellowPay( conferences.WPConferenceDefaultDisplayBase ):
109    #navigationEntry = navigation.NERegistrationFormDisplay
110
111    def __init__(self, rh, conf, reg):
112        conferences.WPConferenceDefaultDisplayBase.__init__(self, rh, conf)
113        self._registrant=reg
114       
115       
116    def _getBody( self, params ):
117        wc = WconfirmEPaymentYellowPay(self._conf, self._registrant)
118        return wc.getHTML()
119
120    def _defineSectionMenu( self ): 
121        conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self)
122        self._sectionMenu.setCurrentItem(self._regFormOpt)
123       
124       
125class WconfirmEPaymentYellowPay( WTemplated ):
126    def __init__( self,configuration, registrant):
127        self._registrant = registrant
128        self._conf = configuration
129       
130    def getVars( self ):
131        vars = WTemplated.getVars(self)
132        vars["message"] = "Thank you, your payment has been accepted by Yellowpay"
133        vars["trinfo"]="%s:%s"%(self._registrant.getFirstName(),self._registrant.getSurName())
134        return vars
135 
136class WPCancelEPaymentYellowPay( conferences.WPConferenceDefaultDisplayBase ):
137    #navigationEntry = navigation.NERegistrationFormDisplay
138
139    def __init__(self, rh, conf, reg):
140        conferences.WPConferenceDefaultDisplayBase.__init__(self, rh, conf)
141        self._registrant=reg
142       
143    def _getBody( self, params ):
144        wc = WCancelEPaymentYellowPay( self._conf,self._registrant )
145        return wc.getHTML()
146
147    def _defineSectionMenu( self ): 
148        conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self)
149        self._sectionMenu.setCurrentItem(self._regFormOpt)   
150       
151class WCancelEPaymentYellowPay( WTemplated ):
152    def __init__( self, conference,reg ):
153        self._conf = conference
154        self._registrant=reg
155
156    def getVars( self ):
157        vars = WTemplated.getVars(self)
158        vars["message"] = "The payment was cancelled (using YellowPay)"
159        vars["messagedetailPayment"]="%s:%s"%(self._registrant.getFirstName(),self._registrant.getSurName())
160        return vars
161 
162class WPNotconfirmEPaymentYellowPay( conferences.WPConferenceDefaultDisplayBase ):
163    #navigationEntry = navigation.NERegistrationFormDisplay
164
165    def __init__(self, rh, conf, reg):
166        conferences.WPConferenceDefaultDisplayBase.__init__(self, rh, conf)
167        self._registrant=reg
168       
169    def _getBody( self, params ):
170        wc = WNotconfirmEPaymentYellowPay(  self._conf,self._registrant )
171        return wc.getHTML()
172
173    def _defineSectionMenu( self ): 
174        conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self)
175        self._sectionMenu.setCurrentItem(self._regFormOpt)   
176     
177class WNotconfirmEPaymentYellowPay( WTemplated ):
178    def __init__( self, conference,reg ):
179        self._conf = conference
180        self._registrant=reg
181
182    def getVars( self ):
183        vars = WTemplated.getVars(self)
184        vars["message"] = "You have not confirmed!\n (using YellowPay)"
185        vars["messagedetailPayment"]="%s:%s"%(self._registrant.getFirstName(),self._registrant.getSurName())
186        return vars
Note: See TracBrowser for help on using the repository browser.