| 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 | |
|---|
| 21 | import MaKaC.webinterface.pages.conferences as conferences |
|---|
| 22 | import MaKaC.webinterface.urlHandlers as urlHandlers |
|---|
| 23 | import MaKaC.webinterface.navigation as navigation |
|---|
| 24 | from MaKaC.registration import LabelInput |
|---|
| 25 | import string |
|---|
| 26 | from MaKaC import registration |
|---|
| 27 | from MaKaC.webinterface import wcomponents |
|---|
| 28 | from xml.sax.saxutils import quoteattr |
|---|
| 29 | from MaKaC.webinterface.common.person_titles import TitlesRegistry |
|---|
| 30 | from MaKaC.webinterface.common.currency import CurrencyRegistry |
|---|
| 31 | from MaKaC.common import Configuration |
|---|
| 32 | from datetime import timedelta |
|---|
| 33 | from MaKaC.common.timezoneUtils import nowutc |
|---|
| 34 | from MaKaC.webinterface.common.countries import CountryHolder |
|---|
| 35 | from MaKaC.webinterface.pages.base import WPBase |
|---|
| 36 | from MaKaC.common import Config |
|---|
| 37 | from MaKaC.i18n import _ |
|---|
| 38 | from indico.util.i18n import i18nformat |
|---|
| 39 | |
|---|
| 40 | #### |
|---|
| 41 | # ----------------- MANAGEMENT AREA --------------------------- |
|---|
| 42 | class WPConfModifRegFormBase( conferences.WPConferenceModifBase ): |
|---|
| 43 | |
|---|
| 44 | def _createTabCtrl(self): |
|---|
| 45 | self._tabCtrl = wcomponents.TabControl() |
|---|
| 46 | |
|---|
| 47 | self._tabRegFormSetup = self._tabCtrl.newTab( "regformsetup", _("Setup"), \ |
|---|
| 48 | urlHandlers.UHConfModifRegForm.getURL( self._conf ) ) |
|---|
| 49 | self._tabRegistrants = self._tabCtrl.newTab( "registrants", _("Registrants"), \ |
|---|
| 50 | urlHandlers.UHConfModifRegistrantList.getURL( self._conf ) ) |
|---|
| 51 | self._tabRegistrationPreview = self._tabCtrl.newTab( "preview", _("Preview"), \ |
|---|
| 52 | urlHandlers.UHConfModifRegistrationPreview.getURL( self._conf ) ) |
|---|
| 53 | self._tabEPay = self._tabCtrl.newTab( "epay", _("e-payment"), \ |
|---|
| 54 | urlHandlers.UHConfModifEPayment.getURL( self._conf ) ) |
|---|
| 55 | |
|---|
| 56 | self._setActiveTab() |
|---|
| 57 | |
|---|
| 58 | if not self._conf.hasEnabledSection("regForm"): |
|---|
| 59 | self._tabRegFormSetup.disable() |
|---|
| 60 | self._tabRegistrants.disable() |
|---|
| 61 | self._tabEPay.disable() |
|---|
| 62 | self._tabRegistrationPreview.disable() |
|---|
| 63 | |
|---|
| 64 | def _getPageContent(self, params): |
|---|
| 65 | self._createTabCtrl() |
|---|
| 66 | return wcomponents.WTabControl( self._tabCtrl, self._getAW() ).getHTML( self._getTabContent( params ) ) |
|---|
| 67 | |
|---|
| 68 | def _getTabContent(self, params): |
|---|
| 69 | return "nothing" |
|---|
| 70 | |
|---|
| 71 | def _setActiveSideMenuItem(self): |
|---|
| 72 | self._regFormMenuItem.setActive() |
|---|
| 73 | |
|---|
| 74 | def _setActiveTab(self): |
|---|
| 75 | pass |
|---|
| 76 | |
|---|
| 77 | class WPConfModifRegFormPreview( WPConfModifRegFormBase ): |
|---|
| 78 | def _setActiveTab( self ): |
|---|
| 79 | self._tabRegistrationPreview.setActive() |
|---|
| 80 | |
|---|
| 81 | def _getTabContent( self, params ): |
|---|
| 82 | wc = WConfRegistrationFormPreview(self._conf, self._rh._getUser()) |
|---|
| 83 | return wc.getHTML() |
|---|
| 84 | |
|---|
| 85 | class WPConfModifRegForm( WPConfModifRegFormBase ): |
|---|
| 86 | def _setActiveTab( self ): |
|---|
| 87 | self._tabRegFormSetup.setActive() |
|---|
| 88 | |
|---|
| 89 | def _getTabContent( self, params ): |
|---|
| 90 | wc = WConfModifRegForm(self._conf) |
|---|
| 91 | return wc.getHTML() |
|---|
| 92 | |
|---|
| 93 | class WConfModifRegForm( wcomponents.WTemplated ): |
|---|
| 94 | |
|---|
| 95 | def __init__( self, conference ): |
|---|
| 96 | self._conf = conference |
|---|
| 97 | |
|---|
| 98 | def _getURL(self, sect): |
|---|
| 99 | if sect.getId()=="sessions": |
|---|
| 100 | return urlHandlers.UHConfModifRegFormSessions.getURL(self._conf) |
|---|
| 101 | if sect.getId()=="accommodation": |
|---|
| 102 | return urlHandlers.UHConfModifRegFormAccommodation.getURL(self._conf) |
|---|
| 103 | if sect.getId()=="reasonParticipation": |
|---|
| 104 | return urlHandlers.UHConfModifRegFormReasonParticipation.getURL(self._conf) |
|---|
| 105 | if sect.getId()=="furtherInformation": |
|---|
| 106 | return urlHandlers.UHConfModifRegFormFurtherInformation.getURL(self._conf) |
|---|
| 107 | if sect.getId()=="socialEvents": |
|---|
| 108 | return urlHandlers.UHConfModifRegFormSocialEvent.getURL(self._conf) |
|---|
| 109 | return urlHandlers.UHConfModifRegFormGeneralSection.getURL(sect) |
|---|
| 110 | |
|---|
| 111 | def _getSectionsHTML(self): |
|---|
| 112 | regForm=self._conf.getRegistrationForm() |
|---|
| 113 | html=[] |
|---|
| 114 | enabledBulb = Configuration.Config.getInstance().getSystemIconURL( "enabledSection" ) |
|---|
| 115 | notEnabledBulb = Configuration.Config.getInstance().getSystemIconURL( "disabledSection" ) |
|---|
| 116 | enabledText = _("Click to disable") |
|---|
| 117 | disabledText = _("Click to enable") |
|---|
| 118 | for gs in regForm.getSortedForms(): |
|---|
| 119 | urlStatus = urlHandlers.UHConfModifRegFormEnableSection.getURL(self._conf) |
|---|
| 120 | urlStatus.addParam("section", gs.getId()) |
|---|
| 121 | urlModif=self._getURL(gs) |
|---|
| 122 | img = enabledBulb |
|---|
| 123 | text = enabledText |
|---|
| 124 | if not gs.isEnabled(): |
|---|
| 125 | img = notEnabledBulb |
|---|
| 126 | text = disabledText |
|---|
| 127 | checkbox=" " |
|---|
| 128 | if isinstance(gs, registration.GeneralSectionForm) and not gs.isRequired(): |
|---|
| 129 | checkbox=""" |
|---|
| 130 | <input type="checkbox" name="sectionsIds" value="%s"> |
|---|
| 131 | """%gs.getId() |
|---|
| 132 | selbox = """<select name="newpos%s" onChange="this.form.oldpos.value='%s';this.form.submit();">""" % (regForm.getSortedForms().index(gs),regForm.getSortedForms().index(gs)) |
|---|
| 133 | for i in range(1,len(regForm.getSortedForms())+1): |
|---|
| 134 | if i== regForm.getSortedForms().index(gs)+1: |
|---|
| 135 | selbox += "<option selected value='%s'>%s" % (i-1,i) |
|---|
| 136 | else: |
|---|
| 137 | selbox += "<option value='%s'>%s" % (i-1,i) |
|---|
| 138 | selbox += """ |
|---|
| 139 | </select>""" |
|---|
| 140 | if not isinstance(gs, registration.GeneralSectionForm) or not gs.isRequired(): |
|---|
| 141 | toggleLink = """<a href=%s><img src="%s" alt="%s" class="imglink"></a>""" % (quoteattr(str(urlStatus)), img, text) |
|---|
| 142 | else: |
|---|
| 143 | toggleLink = "" |
|---|
| 144 | html.append(""" |
|---|
| 145 | <tr> |
|---|
| 146 | <td>%s</td> |
|---|
| 147 | <td>%s %s<a href=%s>%s</a></td> |
|---|
| 148 | </tr> |
|---|
| 149 | """%(toggleLink, selbox, checkbox, quoteattr(str(urlModif)), gs.getTitle()) ) |
|---|
| 150 | html.insert(0, """<input type="hidden" name="oldpos"><table>""") |
|---|
| 151 | html.append("</table>") |
|---|
| 152 | return "".join(html) |
|---|
| 153 | |
|---|
| 154 | def _getStatusesHTML(self): |
|---|
| 155 | regForm=self._conf.getRegistrationForm() |
|---|
| 156 | html=[] |
|---|
| 157 | for st in regForm.getStatusesList(): |
|---|
| 158 | urlStatus = urlHandlers.UHConfModifRegFormStatusModif.getURL(self._conf) |
|---|
| 159 | urlStatus.addParam("statusId", st.getId()) |
|---|
| 160 | html.append(""" |
|---|
| 161 | <tr> |
|---|
| 162 | <td> |
|---|
| 163 | <input type="checkbox" name="statusesIds" value="%s"> <a href=%s>%s</a> |
|---|
| 164 | </td> |
|---|
| 165 | </tr> |
|---|
| 166 | """%(st.getId(), quoteattr(str(urlStatus)), st.getCaption().strip() or i18nformat("""-- [%s] _("status with no name") --""")%st.getId()) ) |
|---|
| 167 | if html == []: |
|---|
| 168 | html.append( i18nformat("""<tr><td style="padding-left:20px"><ul><li> _("No statuses defined yet").</li></ul><br> _("You can use this option in order to create general statuses you will be able to use afterwards in the list of registrants. For instance, you can create a status "paid" in order to check if someone has paid or not").</td></tr>""")) |
|---|
| 169 | html.insert(0, """<a href="" name="statuses"></a><table style="padding-top:20px">""") |
|---|
| 170 | html.append("</table>") |
|---|
| 171 | return "".join(html) |
|---|
| 172 | |
|---|
| 173 | def getVars( self ): |
|---|
| 174 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 175 | regForm = self._conf.getRegistrationForm() |
|---|
| 176 | vars["setStatusURL"]=urlHandlers.UHConfModifRegFormChangeStatus.getURL(self._conf) |
|---|
| 177 | vars["dataModificationURL"]=urlHandlers.UHConfModifRegFormDataModification.getURL(self._conf) |
|---|
| 178 | vars["enablePic"]=quoteattr(str(Configuration.Config.getInstance().getSystemIconURL( "enabledSection" ))) |
|---|
| 179 | vars["disablePic"]=quoteattr(str(Configuration.Config.getInstance().getSystemIconURL( "disabledSection" ))) |
|---|
| 180 | if regForm.isActivated(): |
|---|
| 181 | vars["activated"] = True |
|---|
| 182 | vars["changeTo"] = "False" |
|---|
| 183 | vars["status"] = _("ENABLED") |
|---|
| 184 | vars["changeStatus"] = _("DISABLE") |
|---|
| 185 | d = "" |
|---|
| 186 | if regForm.getStartRegistrationDate() is not None: |
|---|
| 187 | d = regForm.getStartRegistrationDate().strftime("%A %d %B %Y") |
|---|
| 188 | vars["startDate"]=d |
|---|
| 189 | d = "" |
|---|
| 190 | if regForm.getEndRegistrationDate() is not None: |
|---|
| 191 | d = regForm.getEndRegistrationDate().strftime("%A %d %B %Y") |
|---|
| 192 | vars["endDate"]=d |
|---|
| 193 | vars["extraTimeAmount"] = regForm.getEndExtraTimeAmount() |
|---|
| 194 | vars["extraTimeUnit"] = regForm.getEndExtraTimeUnit() |
|---|
| 195 | d = "" |
|---|
| 196 | if regForm.getModificationEndDate() is not None: |
|---|
| 197 | d = regForm.getModificationEndDate().strftime("%A %d %B %Y") |
|---|
| 198 | vars["modificationEndDate"]=d |
|---|
| 199 | vars["announcement"] = regForm.getAnnouncement() |
|---|
| 200 | vars["disabled"] = "" |
|---|
| 201 | vars["contactInfo"] = regForm.getContactInfo() |
|---|
| 202 | vars["usersLimit"] = i18nformat("""--_("No limit")--""") |
|---|
| 203 | if regForm.getUsersLimit() > 0: |
|---|
| 204 | vars["usersLimit"] = regForm.getUsersLimit() |
|---|
| 205 | vars["title"] = regForm.getTitle() |
|---|
| 206 | vars["notification"] = i18nformat(""" |
|---|
| 207 | <table> |
|---|
| 208 | <tr> |
|---|
| 209 | <td align="right"><b> _("To List"):</b></td> |
|---|
| 210 | <td align="left">%s</td> |
|---|
| 211 | </tr> |
|---|
| 212 | <tr> |
|---|
| 213 | <td align="right"><b> _("Cc List"):</b></td> |
|---|
| 214 | <td align="left">%s</td> |
|---|
| 215 | </tr> |
|---|
| 216 | </table> |
|---|
| 217 | """)%(", ".join(regForm.getNotification().getToList()) or i18nformat("""--_("no TO list")--"""), ", ".join(regForm.getNotification().getCCList()) or i18nformat("""--_("no CC list")--""")) |
|---|
| 218 | vars["mandatoryAccount"] = _("Yes") |
|---|
| 219 | if not regForm.isMandatoryAccount(): |
|---|
| 220 | vars["mandatoryAccount"] = _("No") |
|---|
| 221 | vars["notificationSender"] = regForm.getNotificationSender() |
|---|
| 222 | vars["sendRegEmail"] = _("Yes") |
|---|
| 223 | if not regForm.isSendRegEmail(): |
|---|
| 224 | vars["sendRegEmail"] = _("No") |
|---|
| 225 | vars["sendReceiptEmail"] = _("Yes") |
|---|
| 226 | if not regForm.isSendReceiptEmail(): |
|---|
| 227 | vars["sendReceiptEmail"] = _("No") |
|---|
| 228 | vars["sendPaidEmail"] = _("Yes") |
|---|
| 229 | if not regForm.isSendPaidEmail(): |
|---|
| 230 | vars["sendPaidEmail"] = _("No") |
|---|
| 231 | vars["Currency"]=regForm.getCurrency() |
|---|
| 232 | else: |
|---|
| 233 | vars["activated"] = False |
|---|
| 234 | vars["changeTo"] = "True" |
|---|
| 235 | vars["status"] =_("DISABLED") |
|---|
| 236 | vars["changeStatus"] = _("ENABLE") |
|---|
| 237 | vars["startDate"] = "" |
|---|
| 238 | vars["endDate"] = "" |
|---|
| 239 | vars["extraTimeAmount"] = "" |
|---|
| 240 | vars["extraTimeUnit"] = "" |
|---|
| 241 | vars["modificationEndDate"]="" |
|---|
| 242 | vars["announcement"] = "" |
|---|
| 243 | vars["disabled"] = 'disabled = "disabled"' |
|---|
| 244 | vars["contactInfo"] = "" |
|---|
| 245 | vars["usersLimit"] = "" |
|---|
| 246 | vars["title"] = "" |
|---|
| 247 | vars["notification"] = "" |
|---|
| 248 | vars["mandatoryAccount"] = "" |
|---|
| 249 | vars["notificationSender"] = "" |
|---|
| 250 | vars["sendRegEmail"] = "" |
|---|
| 251 | vars["sendReceiptEmail"] = "" |
|---|
| 252 | vars["sendPaidEmail"] = "" |
|---|
| 253 | vars["Currency"]="" |
|---|
| 254 | vars["sections"] = self._getSectionsHTML() |
|---|
| 255 | vars["actionSectionURL"]=quoteattr(str(urlHandlers.UHConfModifRegFormActionSection.getURL(self._conf))) |
|---|
| 256 | vars["statuses"] = self._getStatusesHTML() |
|---|
| 257 | vars["actionStatusesURL"]=quoteattr(str(urlHandlers.UHConfModifRegFormActionStatuses.getURL(self._conf))) |
|---|
| 258 | return vars |
|---|
| 259 | |
|---|
| 260 | class WPConfModifRegFormDataModification( WPConfModifRegFormBase ): |
|---|
| 261 | |
|---|
| 262 | def _getTabContent( self, params ): |
|---|
| 263 | wc = WConfModifRegFormDataModification(self._conf) |
|---|
| 264 | return wc.getHTML() |
|---|
| 265 | |
|---|
| 266 | class WConfModifRegFormDataModification( wcomponents.WTemplated ): |
|---|
| 267 | |
|---|
| 268 | def __init__( self, conference ): |
|---|
| 269 | self._conf = conference |
|---|
| 270 | |
|---|
| 271 | def getVars( self ): |
|---|
| 272 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 273 | regForm = self._conf.getRegistrationForm() |
|---|
| 274 | vars["postURL"]=urlHandlers.UHConfModifRegFormPerformDataModification.getURL(self._conf) |
|---|
| 275 | vars["sDay"]="" |
|---|
| 276 | vars["sMonth"]="" |
|---|
| 277 | vars["sYear"]="" |
|---|
| 278 | if regForm.getStartRegistrationDate() is not None: |
|---|
| 279 | d = regForm.getStartRegistrationDate() |
|---|
| 280 | vars["sDay"]=d.day |
|---|
| 281 | vars["sMonth"]=d.month |
|---|
| 282 | vars["sYear"]=d.year |
|---|
| 283 | vars["eDay"]="" |
|---|
| 284 | vars["eMonth"]="" |
|---|
| 285 | vars["eYear"]="" |
|---|
| 286 | if regForm.getEndRegistrationDate() is not None: |
|---|
| 287 | d = regForm.getEndRegistrationDate() |
|---|
| 288 | vars["eDay"]=d.day |
|---|
| 289 | vars["eMonth"]=d.month |
|---|
| 290 | vars["eYear"]=d.year |
|---|
| 291 | vars["meDay"]="" |
|---|
| 292 | vars["meMonth"]="" |
|---|
| 293 | vars["meYear"]="" |
|---|
| 294 | if regForm.getModificationEndDate() is not None: |
|---|
| 295 | d = regForm.getModificationEndDate() |
|---|
| 296 | vars["meDay"]=d.day |
|---|
| 297 | vars["meMonth"]=d.month |
|---|
| 298 | vars["meYear"]=d.year |
|---|
| 299 | vars["calendarIconURL"] = Config.getInstance().getSystemIconURL("calendar") |
|---|
| 300 | vars["calendarSelectURL"] = urlHandlers.UHSimpleCalendar.getURL() |
|---|
| 301 | vars["announcement"] = regForm.getAnnouncement() |
|---|
| 302 | vars["contactInfo"] = regForm.getContactInfo() |
|---|
| 303 | vars["usersLimit"] = regForm.getUsersLimit() |
|---|
| 304 | vars["title"] = regForm.getTitle() |
|---|
| 305 | vars["toList"] = ", ".join(regForm.getNotification().getToList()) |
|---|
| 306 | vars["ccList"] = ", ".join(regForm.getNotification().getCCList()) |
|---|
| 307 | vars["mandatoryAccount"]="" |
|---|
| 308 | if regForm.isMandatoryAccount(): |
|---|
| 309 | vars["mandatoryAccount"]= "CHECKED" |
|---|
| 310 | vars["notificationSender"] = regForm.getNotificationSender() |
|---|
| 311 | vars["sendRegEmail"] = "" |
|---|
| 312 | vars["sendReceiptEmail"] = "" |
|---|
| 313 | vars["sendPaidEmail"] = "" |
|---|
| 314 | if regForm.isSendRegEmail(): |
|---|
| 315 | vars["sendRegEmail"] = "CHECKED" |
|---|
| 316 | if regForm.isSendReceiptEmail(): |
|---|
| 317 | vars["sendReceiptEmail"] = "CHECKED" |
|---|
| 318 | if regForm.isSendPaidEmail(): |
|---|
| 319 | vars["sendPaidEmail"] = "CHECKED" |
|---|
| 320 | vars["Currency"]="""<select name="%s">%s</select>"""%("Currency", CurrencyRegistry.getSelectItemsHTML(regForm.getCurrency())) |
|---|
| 321 | vars["extraTimeAmount"] = regForm.getEndExtraTimeAmount() |
|---|
| 322 | vars["extraTimeUnit"] = regForm.getEndExtraTimeUnit() |
|---|
| 323 | return vars |
|---|
| 324 | |
|---|
| 325 | class WPConfModifRegFormSectionsBase(WPConfModifRegFormBase): |
|---|
| 326 | |
|---|
| 327 | def _setActiveSideMenuItem(self): |
|---|
| 328 | self._regFormMenuItem.setActive(True) |
|---|
| 329 | |
|---|
| 330 | def _getPageContent( self, params ): |
|---|
| 331 | self._createTabCtrl() |
|---|
| 332 | banner = wcomponents.WRegFormSectionBannerModif(self._targetSection, self._conf).getHTML() |
|---|
| 333 | html = wcomponents.WTabControl( self._tabCtrl, self._getAW() ).getHTML( self._getTabContent( params ) ) |
|---|
| 334 | return banner+html |
|---|
| 335 | |
|---|
| 336 | class WPConfModifRegFormSessionsBase(WPConfModifRegFormSectionsBase): |
|---|
| 337 | |
|---|
| 338 | def __init__( self, rh, conference ): |
|---|
| 339 | WPConfModifRegFormSectionsBase.__init__(self, rh, conference) |
|---|
| 340 | self._targetSection = self._conf.getRegistrationForm().getSessionsForm() |
|---|
| 341 | |
|---|
| 342 | def _createTabCtrl( self ): |
|---|
| 343 | self._tabCtrl = wcomponents.TabControl() |
|---|
| 344 | self._tabMain = self._tabCtrl.newTab( "main", _("Main"), \ |
|---|
| 345 | urlHandlers.UHConfModifRegFormSessions.getURL( self._conf ) ) |
|---|
| 346 | # wf = self._rh.getWebFactory() |
|---|
| 347 | # if wf: |
|---|
| 348 | # wf.customiseTabCtrl( self._tabCtrl ) |
|---|
| 349 | self._setActiveTab() |
|---|
| 350 | |
|---|
| 351 | # def _applyFrame( self, body ): |
|---|
| 352 | # frame = WRegFormSessionsModifFrame( self._conf, self._getAW() ) |
|---|
| 353 | # p = { "categDisplayURLGen": urlHandlers.UHCategoryDisplay.getURL, \ |
|---|
| 354 | # "confDisplayURLGen": urlHandlers.UHConferenceDisplay.getURL, \ |
|---|
| 355 | # "confModifURLGen": urlHandlers.UHConfModifRegForm.getURL} |
|---|
| 356 | # return frame.getHTML( body, **p ) |
|---|
| 357 | |
|---|
| 358 | def _setActiveTab( self ): |
|---|
| 359 | pass |
|---|
| 360 | |
|---|
| 361 | def _getTabContent( self, params ): |
|---|
| 362 | return "nothing" |
|---|
| 363 | |
|---|
| 364 | #class WRegFormSessionsModifFrame(wcomponents.WTemplated): |
|---|
| 365 | # |
|---|
| 366 | # def __init__(self, conf, aw): |
|---|
| 367 | # self._conf = conf |
|---|
| 368 | # self._aw = aw |
|---|
| 369 | # self._sessions = self._conf.getRegistrationForm().getSessionsForm() |
|---|
| 370 | # |
|---|
| 371 | # def getHTML( self, body, **params ): |
|---|
| 372 | # params["body"] = body |
|---|
| 373 | # return wcomponents.WTemplated.getHTML( self, params ) |
|---|
| 374 | # |
|---|
| 375 | # def getVars( self ): |
|---|
| 376 | # vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 377 | # vars["context"] = wcomponents.WConfModifHeader( self._conf, self._aw ).getHTML(vars) |
|---|
| 378 | # vars["title"] = self._sessions.getTitle() |
|---|
| 379 | # vars["titleTabPixels"] = self.getTitleTabPixels() |
|---|
| 380 | # vars["intermediateVTabPixels"] = self.getIntermediateVTabPixels() |
|---|
| 381 | # vars["closeHeaderTags"] = self.getCloseHeaderTags() |
|---|
| 382 | # return vars |
|---|
| 383 | # |
|---|
| 384 | # def getOwnerComponent( self ): |
|---|
| 385 | # wc = wcomponents.WConferenceModifFrame(self._conf, self._aw) |
|---|
| 386 | # return wc |
|---|
| 387 | # |
|---|
| 388 | # def getIntermediateVTabPixels( self ): |
|---|
| 389 | # wc = self.getOwnerComponent() |
|---|
| 390 | # return 7 + wc.getIntermediateVTabPixels() |
|---|
| 391 | # |
|---|
| 392 | # def getTitleTabPixels( self ): |
|---|
| 393 | # wc = self.getOwnerComponent() |
|---|
| 394 | # return wc.getTitleTabPixels() - 7 |
|---|
| 395 | # |
|---|
| 396 | # def getCloseHeaderTags( self ): |
|---|
| 397 | # wc = self.getOwnerComponent() |
|---|
| 398 | # return "</table></td></tr>" + wc.getCloseHeaderTags() |
|---|
| 399 | |
|---|
| 400 | class WPConfModifRegFormSessions( WPConfModifRegFormSessionsBase ): |
|---|
| 401 | |
|---|
| 402 | def _getTabContent( self, params ): |
|---|
| 403 | wc = WConfModifRegFormSessions(self._conf) |
|---|
| 404 | p = {'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormSessionsRemove.getURL( self._conf ))), |
|---|
| 405 | 'postAddURL': quoteattr(str(urlHandlers.UHConfModifRegFormSessionsAdd.getURL( self._conf ))), |
|---|
| 406 | 'dataModificationURL': quoteattr(str(urlHandlers.UHConfModifRegFormSessionsDataModif.getURL( self._conf ))) |
|---|
| 407 | } |
|---|
| 408 | return wc.getHTML(p) |
|---|
| 409 | |
|---|
| 410 | class WConfModifRegFormSessions( wcomponents.WTemplated ): |
|---|
| 411 | |
|---|
| 412 | def __init__( self, conference ): |
|---|
| 413 | self._conf = conference |
|---|
| 414 | |
|---|
| 415 | def _getSessionsHTML(self, sessions): |
|---|
| 416 | if sessions.getSessionList() == []: |
|---|
| 417 | html = i18nformat("""--_("None selected")--""") |
|---|
| 418 | else: |
|---|
| 419 | html = [] |
|---|
| 420 | for ses in sessions.getSessionList(True): |
|---|
| 421 | billable = "" |
|---|
| 422 | if ses.isBillable(): |
|---|
| 423 | billable = " <i>[billable: %s]</i>" % ses.getPrice() |
|---|
| 424 | cancelled = "" |
|---|
| 425 | if ses.isCancelled(): |
|---|
| 426 | cancelled = " <font color=\"red\">(cancelled)</font>" |
|---|
| 427 | url = urlHandlers.UHConfModifRegFormSessionItemModify.getURL(ses) |
|---|
| 428 | html.append(""" |
|---|
| 429 | <input type="checkbox" name="sessionIds" value="%s"><a href=%s>%s</a>%s%s |
|---|
| 430 | """%(ses.getId(), quoteattr(str(url)), ses.getTitle(), billable, cancelled) ) |
|---|
| 431 | html = "<br>".join(html) |
|---|
| 432 | return html |
|---|
| 433 | |
|---|
| 434 | def _getSessionFormTypeHTML(self, sessions): |
|---|
| 435 | if sessions.getType()=="all": |
|---|
| 436 | return _("multiple") |
|---|
| 437 | return _("""2 choices <span style="color:red;">(session billing not possible)</span>""") |
|---|
| 438 | |
|---|
| 439 | def getVars( self ): |
|---|
| 440 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 441 | regForm = self._conf.getRegistrationForm() |
|---|
| 442 | sessions = regForm.getSessionsForm() |
|---|
| 443 | vars["title"] = sessions.getTitle() |
|---|
| 444 | vars["description"] = sessions.getDescription() |
|---|
| 445 | vars["type"] = self._getSessionFormTypeHTML(sessions) |
|---|
| 446 | vars["sessions"] = self._getSessionsHTML(sessions) |
|---|
| 447 | return vars |
|---|
| 448 | |
|---|
| 449 | class WPConfModifRegFormSessionsDataModif( WPConfModifRegFormSessionsBase ): |
|---|
| 450 | |
|---|
| 451 | def _getTabContent( self, params ): |
|---|
| 452 | wc = WConfModifRegFormSessionsDataModif(self._conf) |
|---|
| 453 | p = {'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormSessionsPerformDataModif.getURL( self._conf ))) |
|---|
| 454 | } |
|---|
| 455 | return wc.getHTML(p) |
|---|
| 456 | |
|---|
| 457 | class WConfModifRegFormSessionsDataModif( wcomponents.WTemplated ): |
|---|
| 458 | |
|---|
| 459 | def __init__( self, conference ): |
|---|
| 460 | self._conf = conference |
|---|
| 461 | |
|---|
| 462 | def _getSessionFormTypesHTML(self, sessions): |
|---|
| 463 | html=["""<select name="sessionFormType">"""] |
|---|
| 464 | selected="" |
|---|
| 465 | if sessions.getType()=="2priorities": |
|---|
| 466 | selected=" selected" |
|---|
| 467 | html.append( i18nformat("""<option value="2priorities"%s> _("2 choices")</option>""")%selected) |
|---|
| 468 | selected="" |
|---|
| 469 | if sessions.getType()=="all": |
|---|
| 470 | selected=" selected" |
|---|
| 471 | html.append( i18nformat("""<option value="all"%s> _("multiple")</option>""")%selected) |
|---|
| 472 | html.append("""</select>""") |
|---|
| 473 | return "".join(html) |
|---|
| 474 | |
|---|
| 475 | def getVars( self ): |
|---|
| 476 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 477 | regForm = self._conf.getRegistrationForm() |
|---|
| 478 | sessions = regForm.getSessionsForm() |
|---|
| 479 | vars["title"] = sessions.getTitle() |
|---|
| 480 | vars["description"] = sessions.getDescription() |
|---|
| 481 | vars["types"] = self._getSessionFormTypesHTML(sessions) |
|---|
| 482 | return vars |
|---|
| 483 | |
|---|
| 484 | class WPConfModifRegFormSessionsAdd( WPConfModifRegFormSessionsBase ): |
|---|
| 485 | |
|---|
| 486 | def _getTabContent( self, params ): |
|---|
| 487 | wc = WConfModifRegFormSessionsAdd(self._conf) |
|---|
| 488 | p = {'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormSessionsPerformAdd.getURL( self._conf ))) |
|---|
| 489 | } |
|---|
| 490 | return wc.getHTML(p) |
|---|
| 491 | |
|---|
| 492 | class WConfModifRegFormSessionsAdd( wcomponents.WTemplated ): |
|---|
| 493 | |
|---|
| 494 | def __init__( self, conference ): |
|---|
| 495 | self._conf = conference |
|---|
| 496 | |
|---|
| 497 | def _getSessionsHTML(self, sessions): |
|---|
| 498 | html = [] |
|---|
| 499 | for ses in self._conf.getSessionList(): |
|---|
| 500 | if not sessions.hasSession(ses.getId()): |
|---|
| 501 | html.append(""" |
|---|
| 502 | <input type="checkbox" name="sessionIds" value="%s" >%s |
|---|
| 503 | """%(ses.getId(), ses.getTitle()) ) |
|---|
| 504 | if html == []: |
|---|
| 505 | html = i18nformat("""-- _("No sessions to add") --""") |
|---|
| 506 | else: |
|---|
| 507 | html = "<br>".join(html) |
|---|
| 508 | return html |
|---|
| 509 | |
|---|
| 510 | def getVars( self ): |
|---|
| 511 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 512 | regForm = self._conf.getRegistrationForm() |
|---|
| 513 | sessions = regForm.getSessionsForm() |
|---|
| 514 | vars["title"] = sessions.getTitle() |
|---|
| 515 | vars["sessions"] = self._getSessionsHTML(sessions) |
|---|
| 516 | return vars |
|---|
| 517 | |
|---|
| 518 | class WPConfModifRegFormSessionItemModify( WPConfModifRegFormSessionsBase ): |
|---|
| 519 | |
|---|
| 520 | def __init__(self, rh, conf, sessionItem): |
|---|
| 521 | WPConfModifRegFormSessionsBase.__init__(self, rh, conf) |
|---|
| 522 | self._sessionItem = sessionItem |
|---|
| 523 | |
|---|
| 524 | def _getTabContent( self, params ): |
|---|
| 525 | wc = WConfModifRegFormSessionItemModify(self._sessionItem) |
|---|
| 526 | p = {'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormSessionItemPerformModify.getURL( self._sessionItem ))) |
|---|
| 527 | } |
|---|
| 528 | return wc.getHTML(p) |
|---|
| 529 | |
|---|
| 530 | class WConfModifRegFormSessionItemModify( wcomponents.WTemplated ): |
|---|
| 531 | |
|---|
| 532 | def __init__(self, sessionItem): |
|---|
| 533 | self._sessionItem = sessionItem |
|---|
| 534 | |
|---|
| 535 | def getVars( self ): |
|---|
| 536 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 537 | vars["caption"] = quoteattr(self._sessionItem.getCaption()) |
|---|
| 538 | vars["billable"] = "" |
|---|
| 539 | if self._sessionItem.isBillable(): |
|---|
| 540 | vars["billable"] = """ checked="checked" """ |
|---|
| 541 | vars["price"] = self._sessionItem.getPrice() |
|---|
| 542 | return vars |
|---|
| 543 | |
|---|
| 544 | class WPConfModifRegFormAccommodationBase(WPConfModifRegFormSectionsBase): |
|---|
| 545 | |
|---|
| 546 | def __init__( self, rh, conference ): |
|---|
| 547 | WPConfModifRegFormSectionsBase.__init__(self, rh, conference) |
|---|
| 548 | self._targetSection = self._conf.getRegistrationForm().getAccommodationForm() |
|---|
| 549 | |
|---|
| 550 | def _createTabCtrl( self ): |
|---|
| 551 | self._tabCtrl = wcomponents.TabControl() |
|---|
| 552 | self._tabMain = self._tabCtrl.newTab( "main", "Main", \ |
|---|
| 553 | urlHandlers.UHConfModifRegFormAccommodation.getURL( self._conf ) ) |
|---|
| 554 | # wf = self._rh.getWebFactory() |
|---|
| 555 | # if wf: |
|---|
| 556 | # wf.customiseTabCtrl( self._tabCtrl ) |
|---|
| 557 | self._setActiveTab() |
|---|
| 558 | |
|---|
| 559 | def _setActiveTab( self ): |
|---|
| 560 | pass |
|---|
| 561 | |
|---|
| 562 | def _getTabContent( self, params ): |
|---|
| 563 | return _("nothing") |
|---|
| 564 | |
|---|
| 565 | #class WRegFormAccommodationModifFrame(wcomponents.WTemplated): |
|---|
| 566 | # |
|---|
| 567 | # def __init__(self, conf, aw): |
|---|
| 568 | # self._conf = conf |
|---|
| 569 | # self._aw = aw |
|---|
| 570 | # self._accommodation = self._conf.getRegistrationForm().getAccommodationForm() |
|---|
| 571 | # |
|---|
| 572 | # def getHTML( self, body, **params ): |
|---|
| 573 | # params["body"] = body |
|---|
| 574 | # return wcomponents.WTemplated.getHTML( self, params ) |
|---|
| 575 | # |
|---|
| 576 | # def getVars( self ): |
|---|
| 577 | # vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 578 | # vars["context"] = wcomponents.WConfModifHeader( self._conf, self._aw ).getHTML(vars) |
|---|
| 579 | # vars["title"] = self._accommodation.getTitle() |
|---|
| 580 | # vars["titleTabPixels"] = self.getTitleTabPixels() |
|---|
| 581 | # vars["intermediateVTabPixels"] = self.getIntermediateVTabPixels() |
|---|
| 582 | # vars["closeHeaderTags"] = self.getCloseHeaderTags() |
|---|
| 583 | # return vars |
|---|
| 584 | # |
|---|
| 585 | # def getOwnerComponent( self ): |
|---|
| 586 | # wc = wcomponents.WConferenceModifFrame(self._conf, self._aw) |
|---|
| 587 | # return wc |
|---|
| 588 | # |
|---|
| 589 | # def getIntermediateVTabPixels( self ): |
|---|
| 590 | # wc = self.getOwnerComponent() |
|---|
| 591 | # return 7 + wc.getIntermediateVTabPixels() |
|---|
| 592 | # |
|---|
| 593 | # def getTitleTabPixels( self ): |
|---|
| 594 | # wc = self.getOwnerComponent() |
|---|
| 595 | # return wc.getTitleTabPixels() - 7 |
|---|
| 596 | # |
|---|
| 597 | # def getCloseHeaderTags( self ): |
|---|
| 598 | # wc = self.getOwnerComponent() |
|---|
| 599 | # return "</table></td></tr>" + wc.getCloseHeaderTags() |
|---|
| 600 | |
|---|
| 601 | class WPConfModifRegFormAccommodation( WPConfModifRegFormAccommodationBase ): |
|---|
| 602 | |
|---|
| 603 | def _getTabContent( self, params ): |
|---|
| 604 | wc = WConfModifRegFormAccommodation(self._conf) |
|---|
| 605 | p = { |
|---|
| 606 | 'dataModificationURL': quoteattr(str(urlHandlers.UHConfModifRegFormAccommodationDataModif.getURL( self._conf ))), |
|---|
| 607 | 'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormAccommodationTypeRemove.getURL( self._conf ))), |
|---|
| 608 | 'postNewURL': quoteattr(str(urlHandlers.UHConfModifRegFormAccommodationTypeAdd.getURL( self._conf ))) |
|---|
| 609 | } |
|---|
| 610 | return wc.getHTML(p) |
|---|
| 611 | |
|---|
| 612 | class WConfModifRegFormAccommodation( wcomponents.WTemplated ): |
|---|
| 613 | |
|---|
| 614 | def __init__( self, conference ): |
|---|
| 615 | self._conf = conference |
|---|
| 616 | |
|---|
| 617 | def _getAccommodationTypesHTML(self, accommodation): |
|---|
| 618 | html=[] |
|---|
| 619 | for atype in accommodation.getAccommodationTypesList(): |
|---|
| 620 | cancelled = "" |
|---|
| 621 | if atype.isCancelled(): |
|---|
| 622 | cancelled = i18nformat(""" <font color=\"red\">( _("disabled") )</font>""") |
|---|
| 623 | url = urlHandlers.UHConfModifRegFormAccommodationTypeModify.getURL(atype) |
|---|
| 624 | limit = i18nformat(""" <i>[ _("unlimited places") ]</i>""") |
|---|
| 625 | if atype.getPlacesLimit() > 0: |
|---|
| 626 | limit = " <i>[%s/%s place(s)]</i>"%(atype.getCurrentNoPlaces(), atype.getPlacesLimit()) |
|---|
| 627 | billable = "" |
|---|
| 628 | if atype.isBillable(): |
|---|
| 629 | billable = " <i>[billable: %s]</i>" % atype.getPrice() |
|---|
| 630 | html.append("""<tr> |
|---|
| 631 | <td align="left" style="padding-left:10px"><input type="checkbox" name="accommodationType" value="%s"><a href=%s>%s</a>%s%s%s</td> |
|---|
| 632 | </tr> |
|---|
| 633 | """%(atype.getId(), url, self.htmlText(atype.getCaption()), limit, billable, cancelled ) ) |
|---|
| 634 | return "".join(html) |
|---|
| 635 | |
|---|
| 636 | def getVars( self ): |
|---|
| 637 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 638 | regForm = self._conf.getRegistrationForm() |
|---|
| 639 | accommodation = regForm.getAccommodationForm() |
|---|
| 640 | vars["title"] = accommodation.getTitle() |
|---|
| 641 | vars["description"] = accommodation.getDescription() |
|---|
| 642 | aDates = accommodation.getArrivalDates() |
|---|
| 643 | vars["arrivalDates"] = "%s -> %s" % (aDates[0].strftime("%d %B %Y"),aDates[-1].strftime("%d %B %Y")) |
|---|
| 644 | dDates = accommodation.getDepartureDates() |
|---|
| 645 | vars["departureDates"] = "%s -> %s" % (dDates[0].strftime("%d %B %Y"),dDates[-1].strftime("%d %B %Y")) |
|---|
| 646 | vars["accommodationTypes"] = self._getAccommodationTypesHTML(accommodation) |
|---|
| 647 | return vars |
|---|
| 648 | |
|---|
| 649 | class WPConfModifRegFormAccommodationDataModif( WPConfModifRegFormAccommodationBase ): |
|---|
| 650 | |
|---|
| 651 | def _getTabContent( self, params ): |
|---|
| 652 | wc = WConfModifRegFormAccommodationDataModif(self._conf) |
|---|
| 653 | p = {'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormAccommodationPerformDataModif.getURL( self._conf ))) |
|---|
| 654 | } |
|---|
| 655 | return wc.getHTML(p) |
|---|
| 656 | |
|---|
| 657 | class WConfModifRegFormAccommodationDataModif( wcomponents.WTemplated ): |
|---|
| 658 | |
|---|
| 659 | def __init__( self, conference ): |
|---|
| 660 | self._conf = conference |
|---|
| 661 | |
|---|
| 662 | def getVars( self ): |
|---|
| 663 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 664 | regForm = self._conf.getRegistrationForm() |
|---|
| 665 | accommodation = regForm.getAccommodationForm() |
|---|
| 666 | vars["title"] = accommodation.getTitle() |
|---|
| 667 | vars["description"] = accommodation.getDescription() |
|---|
| 668 | vars["aoffset1"] = accommodation.getArrivalOffsetDates()[0] |
|---|
| 669 | vars["aoffset2"] = accommodation.getArrivalOffsetDates()[1] |
|---|
| 670 | vars["doffset1"] = accommodation.getDepartureOffsetDates()[0] |
|---|
| 671 | vars["doffset2"] = accommodation.getDepartureOffsetDates()[1] |
|---|
| 672 | return vars |
|---|
| 673 | |
|---|
| 674 | class WPConfModifRegFormAccommodationTypeAdd( WPConfModifRegFormAccommodationBase ): |
|---|
| 675 | |
|---|
| 676 | def _getTabContent( self, params ): |
|---|
| 677 | wc = WConfModifRegFormAccommodationTypeAdd() |
|---|
| 678 | p = {'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormAccommodationTypePerformAdd.getURL( self._conf ))) |
|---|
| 679 | } |
|---|
| 680 | return wc.getHTML(p) |
|---|
| 681 | |
|---|
| 682 | class WConfModifRegFormAccommodationTypeAdd( wcomponents.WTemplated ): |
|---|
| 683 | pass |
|---|
| 684 | |
|---|
| 685 | class WPConfModifRegFormAccommodationTypeModify( WPConfModifRegFormAccommodationBase ): |
|---|
| 686 | |
|---|
| 687 | def __init__(self, rh, conf, accoType): |
|---|
| 688 | WPConfModifRegFormAccommodationBase.__init__(self, rh, conf) |
|---|
| 689 | self._accoType = accoType |
|---|
| 690 | |
|---|
| 691 | def _getTabContent( self, params ): |
|---|
| 692 | wc = WConfModifRegFormAccommodationTypeModify(self._accoType) |
|---|
| 693 | p = {'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormAccommodationTypePerformModify.getURL( self._accoType ))) |
|---|
| 694 | } |
|---|
| 695 | return wc.getHTML(p) |
|---|
| 696 | |
|---|
| 697 | class WConfModifRegFormAccommodationTypeModify( wcomponents.WTemplated ): |
|---|
| 698 | |
|---|
| 699 | def __init__(self, accoType): |
|---|
| 700 | self._accoType = accoType |
|---|
| 701 | |
|---|
| 702 | def getVars( self ): |
|---|
| 703 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 704 | vars["caption"] = quoteattr(self._accoType.getCaption()) |
|---|
| 705 | vars["placesLimit"] = self._accoType.getPlacesLimit() |
|---|
| 706 | vars["checked"] = "" |
|---|
| 707 | if self._accoType.isCancelled(): |
|---|
| 708 | vars["checked"] = """ checked="checked" """ |
|---|
| 709 | vars["billable"] = "" |
|---|
| 710 | if self._accoType.isBillable(): |
|---|
| 711 | vars["billable"] = """ checked="checked" """ |
|---|
| 712 | vars["price"] = self._accoType.getPrice() |
|---|
| 713 | return vars |
|---|
| 714 | |
|---|
| 715 | class WPConfRemoveAccommodationType(WPConfModifRegFormAccommodationBase): |
|---|
| 716 | |
|---|
| 717 | def __init__(self, rh, conf, accoTypeIds, accommodationTypes): |
|---|
| 718 | WPConfModifRegFormAccommodationBase.__init__(self, rh, conf) |
|---|
| 719 | self._eventType="conference" |
|---|
| 720 | if self._rh.getWebFactory() is not None: |
|---|
| 721 | self._eventType=self._rh.getWebFactory().getId() |
|---|
| 722 | |
|---|
| 723 | self._accoTypeIds = accoTypeIds |
|---|
| 724 | self._accommodationTypes = [] |
|---|
| 725 | counter = 0 |
|---|
| 726 | for at in accommodationTypes : |
|---|
| 727 | self._accommodationTypes.append("<li>%s</li>"%at) |
|---|
| 728 | |
|---|
| 729 | def _setActiveTab( self ): |
|---|
| 730 | self._tabMain.setActive() |
|---|
| 731 | |
|---|
| 732 | def _getTabContent( self, params ): |
|---|
| 733 | msg = i18nformat(""" |
|---|
| 734 | <font size="+2"> _("Are you sure that you want to DELETE this accomodation")? <br><table><tr><td align="left"><ul>%s</ul></td></tr></table></font><br> |
|---|
| 735 | ( _("Note that if you delete this accomodation, registrants who applied for it |
|---|
| 736 | will lose their accomodation info") ) |
|---|
| 737 | """)%("".join(self._accommodationTypes)) |
|---|
| 738 | wc = wcomponents.WConfirmation() |
|---|
| 739 | return wc.getHTML( msg, \ |
|---|
| 740 | urlHandlers.UHConfModifRegFormAccommodationTypeRemove.getURL(self._conf),\ |
|---|
| 741 | {"accommodationType":self._accoTypeIds} , \ |
|---|
| 742 | confirmButtonCaption= _("Yes"), cancelButtonCaption= _("No")) |
|---|
| 743 | |
|---|
| 744 | class WPConfModifRegFormFurtherInformationBase(WPConfModifRegFormSectionsBase): |
|---|
| 745 | |
|---|
| 746 | def __init__( self, rh, conference ): |
|---|
| 747 | WPConfModifRegFormSectionsBase.__init__(self, rh, conference) |
|---|
| 748 | self._targetSection = self._conf.getRegistrationForm().getFurtherInformationForm() |
|---|
| 749 | |
|---|
| 750 | def _createTabCtrl( self ): |
|---|
| 751 | self._tabCtrl = wcomponents.TabControl() |
|---|
| 752 | self._tabMain = self._tabCtrl.newTab( "main", _("Main"), \ |
|---|
| 753 | urlHandlers.UHConfModifRegFormFurtherInformation.getURL( self._conf ) ) |
|---|
| 754 | # wf = self._rh.getWebFactory() |
|---|
| 755 | # if wf: |
|---|
| 756 | # wf.customiseTabCtrl( self._tabCtrl ) |
|---|
| 757 | self._setActiveTab() |
|---|
| 758 | |
|---|
| 759 | def _setActiveTab( self ): |
|---|
| 760 | pass |
|---|
| 761 | |
|---|
| 762 | def _getTabContent( self, params ): |
|---|
| 763 | return _("nothing") |
|---|
| 764 | |
|---|
| 765 | #class WRegFormFurtherInformationModifFrame(wcomponents.WTemplated): |
|---|
| 766 | # |
|---|
| 767 | # def __init__(self, conf, aw): |
|---|
| 768 | # self._conf = conf |
|---|
| 769 | # self._aw = aw |
|---|
| 770 | # self._furtherInformation = self._conf.getRegistrationForm().getFurtherInformationForm() |
|---|
| 771 | # |
|---|
| 772 | # def getHTML( self, body, **params ): |
|---|
| 773 | # params["body"] = body |
|---|
| 774 | # return wcomponents.WTemplated.getHTML( self, params ) |
|---|
| 775 | # |
|---|
| 776 | # def getVars( self ): |
|---|
| 777 | # vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 778 | # vars["context"] = wcomponents.WConfModifHeader( self._conf, self._aw ).getHTML(vars) |
|---|
| 779 | # vars["title"] = self._furtherInformation.getTitle() |
|---|
| 780 | # vars["titleTabPixels"] = self.getTitleTabPixels() |
|---|
| 781 | # vars["intermediateVTabPixels"] = self.getIntermediateVTabPixels() |
|---|
| 782 | # vars["closeHeaderTags"] = self.getCloseHeaderTags() |
|---|
| 783 | # return vars |
|---|
| 784 | # |
|---|
| 785 | # def getOwnerComponent( self ): |
|---|
| 786 | # wc = wcomponents.WConferenceModifFrame(self._conf, self._aw) |
|---|
| 787 | # return wc |
|---|
| 788 | # |
|---|
| 789 | # def getIntermediateVTabPixels( self ): |
|---|
| 790 | # wc = self.getOwnerComponent() |
|---|
| 791 | # return 7 + wc.getIntermediateVTabPixels() |
|---|
| 792 | # |
|---|
| 793 | # def getTitleTabPixels( self ): |
|---|
| 794 | # wc = self.getOwnerComponent() |
|---|
| 795 | # return wc.getTitleTabPixels() - 7 |
|---|
| 796 | # |
|---|
| 797 | # def getCloseHeaderTags( self ): |
|---|
| 798 | # wc = self.getOwnerComponent() |
|---|
| 799 | # return "</table></td></tr>" + wc.getCloseHeaderTags() |
|---|
| 800 | |
|---|
| 801 | class WPConfModifRegFormFurtherInformation( WPConfModifRegFormFurtherInformationBase ): |
|---|
| 802 | |
|---|
| 803 | def _getTabContent( self, params ): |
|---|
| 804 | wc = WConfModifRegFormFurtherInformation(self._conf) |
|---|
| 805 | p = { |
|---|
| 806 | 'dataModificationURL': quoteattr(str(urlHandlers.UHConfModifRegFormFurtherInformationDataModif.getURL( self._conf ))) |
|---|
| 807 | } |
|---|
| 808 | return wc.getHTML(p) |
|---|
| 809 | |
|---|
| 810 | class WConfModifRegFormFurtherInformation( wcomponents.WTemplated ): |
|---|
| 811 | |
|---|
| 812 | def __init__( self, conference ): |
|---|
| 813 | self._conf = conference |
|---|
| 814 | |
|---|
| 815 | def getVars( self ): |
|---|
| 816 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 817 | regForm = self._conf.getRegistrationForm() |
|---|
| 818 | fi = regForm.getFurtherInformationForm() |
|---|
| 819 | vars["title"] = fi.getTitle() |
|---|
| 820 | vars["content"] = fi.getContent() |
|---|
| 821 | return vars |
|---|
| 822 | |
|---|
| 823 | class WPConfModifRegFormFurtherInformationDataModif( WPConfModifRegFormFurtherInformationBase ): |
|---|
| 824 | |
|---|
| 825 | def _getTabContent( self, params ): |
|---|
| 826 | wc = WConfModifRegFormFurtherInformationDataModif(self._conf) |
|---|
| 827 | p = {'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormFurtherInformationPerformDataModif.getURL( self._conf ))) |
|---|
| 828 | } |
|---|
| 829 | return wc.getHTML(p) |
|---|
| 830 | |
|---|
| 831 | class WConfModifRegFormFurtherInformationDataModif( wcomponents.WTemplated ): |
|---|
| 832 | |
|---|
| 833 | def __init__( self, conference ): |
|---|
| 834 | self._conf = conference |
|---|
| 835 | |
|---|
| 836 | def getVars( self ): |
|---|
| 837 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 838 | regForm = self._conf.getRegistrationForm() |
|---|
| 839 | fi = regForm.getFurtherInformationForm() |
|---|
| 840 | vars["title"] = fi.getTitle() |
|---|
| 841 | vars["content"] = fi.getContent() |
|---|
| 842 | return vars |
|---|
| 843 | |
|---|
| 844 | class WPConfModifRegFormReasonParticipationBase(WPConfModifRegFormSectionsBase): |
|---|
| 845 | |
|---|
| 846 | def __init__( self, rh, conference ): |
|---|
| 847 | WPConfModifRegFormSectionsBase.__init__(self, rh, conference) |
|---|
| 848 | self._targetSection = self._conf.getRegistrationForm().getReasonParticipationForm() |
|---|
| 849 | |
|---|
| 850 | def _createTabCtrl( self ): |
|---|
| 851 | self._tabCtrl = wcomponents.TabControl() |
|---|
| 852 | self._tabMain = self._tabCtrl.newTab( "main", "Main", \ |
|---|
| 853 | urlHandlers.UHConfModifRegFormReasonParticipation.getURL( self._conf ) ) |
|---|
| 854 | # wf = self._rh.getWebFactory() |
|---|
| 855 | # if wf: |
|---|
| 856 | # wf.customiseTabCtrl( self._tabCtrl ) |
|---|
| 857 | self._setActiveTab() |
|---|
| 858 | |
|---|
| 859 | def _setActiveTab( self ): |
|---|
| 860 | pass |
|---|
| 861 | |
|---|
| 862 | def _getTabContent( self, params ): |
|---|
| 863 | return _("nothing") |
|---|
| 864 | |
|---|
| 865 | #class WRegFormReasonParticipationModifFrame(wcomponents.WTemplated): |
|---|
| 866 | # |
|---|
| 867 | # def __init__(self, conf, aw): |
|---|
| 868 | # self._conf = conf |
|---|
| 869 | # self._aw = aw |
|---|
| 870 | # self._reasonParticipation = self._conf.getRegistrationForm().getReasonParticipationForm() |
|---|
| 871 | # |
|---|
| 872 | # def getHTML( self, body, **params ): |
|---|
| 873 | # params["body"] = body |
|---|
| 874 | # return wcomponents.WTemplated.getHTML( self, params ) |
|---|
| 875 | # |
|---|
| 876 | # def getVars( self ): |
|---|
| 877 | # vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 878 | # vars["context"] = wcomponents.WConfModifHeader( self._conf, self._aw ).getHTML(vars) |
|---|
| 879 | # vars["title"] = self._reasonParticipation.getTitle() |
|---|
| 880 | # vars["titleTabPixels"] = self.getTitleTabPixels() |
|---|
| 881 | # vars["intermediateVTabPixels"] = self.getIntermediateVTabPixels() |
|---|
| 882 | # vars["closeHeaderTags"] = self.getCloseHeaderTags() |
|---|
| 883 | # return vars |
|---|
| 884 | # |
|---|
| 885 | # def getOwnerComponent( self ): |
|---|
| 886 | # wc = wcomponents.WConferenceModifFrame(self._conf, self._aw) |
|---|
| 887 | # return wc |
|---|
| 888 | # |
|---|
| 889 | # def getIntermediateVTabPixels( self ): |
|---|
| 890 | # wc = self.getOwnerComponent() |
|---|
| 891 | # return 7 + wc.getIntermediateVTabPixels() |
|---|
| 892 | # |
|---|
| 893 | # def getTitleTabPixels( self ): |
|---|
| 894 | # wc = self.getOwnerComponent() |
|---|
| 895 | # return wc.getTitleTabPixels() - 7 |
|---|
| 896 | # |
|---|
| 897 | # def getCloseHeaderTags( self ): |
|---|
| 898 | # wc = self.getOwnerComponent() |
|---|
| 899 | # return "</table></td></tr>" + wc.getCloseHeaderTags() |
|---|
| 900 | |
|---|
| 901 | class WPConfModifRegFormReasonParticipation( WPConfModifRegFormReasonParticipationBase ): |
|---|
| 902 | |
|---|
| 903 | def _getTabContent( self, params ): |
|---|
| 904 | wc = WConfModifRegFormReasonParticipation(self._conf) |
|---|
| 905 | p = { |
|---|
| 906 | 'dataModificationURL': quoteattr(str(urlHandlers.UHConfModifRegFormReasonParticipationDataModif.getURL( self._conf ))) |
|---|
| 907 | } |
|---|
| 908 | return wc.getHTML(p) |
|---|
| 909 | |
|---|
| 910 | class WConfModifRegFormReasonParticipation( wcomponents.WTemplated ): |
|---|
| 911 | |
|---|
| 912 | def __init__( self, conference ): |
|---|
| 913 | self._conf = conference |
|---|
| 914 | |
|---|
| 915 | def getVars( self ): |
|---|
| 916 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 917 | regForm = self._conf.getRegistrationForm() |
|---|
| 918 | rp = regForm.getReasonParticipationForm() |
|---|
| 919 | vars["title"] = rp.getTitle() |
|---|
| 920 | vars["description"] = rp.getDescription() |
|---|
| 921 | return vars |
|---|
| 922 | |
|---|
| 923 | class WPConfModifRegFormReasonParticipationDataModif( WPConfModifRegFormReasonParticipationBase ): |
|---|
| 924 | |
|---|
| 925 | def _getTabContent( self, params ): |
|---|
| 926 | wc = WConfModifRegFormReasonParticipationDataModif(self._conf) |
|---|
| 927 | p = {'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormReasonParticipationPerformDataModif.getURL( self._conf ))) |
|---|
| 928 | } |
|---|
| 929 | return wc.getHTML(p) |
|---|
| 930 | |
|---|
| 931 | class WConfModifRegFormReasonParticipationDataModif( wcomponents.WTemplated ): |
|---|
| 932 | |
|---|
| 933 | def __init__( self, conference ): |
|---|
| 934 | self._conf = conference |
|---|
| 935 | |
|---|
| 936 | def getVars( self ): |
|---|
| 937 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 938 | regForm = self._conf.getRegistrationForm() |
|---|
| 939 | rp = regForm.getReasonParticipationForm() |
|---|
| 940 | vars["title"] = rp.getTitle() |
|---|
| 941 | vars["description"] = rp.getDescription() |
|---|
| 942 | return vars |
|---|
| 943 | |
|---|
| 944 | class WPConfModifRegFormSocialEventBase(WPConfModifRegFormSectionsBase): |
|---|
| 945 | |
|---|
| 946 | def __init__( self, rh, conference ): |
|---|
| 947 | WPConfModifRegFormSectionsBase.__init__(self, rh, conference) |
|---|
| 948 | self._targetSection = self._conf.getRegistrationForm().getSocialEventForm() |
|---|
| 949 | |
|---|
| 950 | def _createTabCtrl( self ): |
|---|
| 951 | self._tabCtrl = wcomponents.TabControl() |
|---|
| 952 | self._tabMain = self._tabCtrl.newTab( "main", "Main", \ |
|---|
| 953 | urlHandlers.UHConfModifRegFormSocialEvent.getURL( self._conf ) ) |
|---|
| 954 | # wf = self._rh.getWebFactory() |
|---|
| 955 | # if wf: |
|---|
| 956 | # wf.customiseTabCtrl( self._tabCtrl ) |
|---|
| 957 | self._setActiveTab() |
|---|
| 958 | |
|---|
| 959 | def _setActiveTab( self ): |
|---|
| 960 | pass |
|---|
| 961 | |
|---|
| 962 | def _getTabContent( self, params ): |
|---|
| 963 | return _("nothing") |
|---|
| 964 | |
|---|
| 965 | #class WRegFormSocialEventModifFrame(wcomponents.WTemplated): |
|---|
| 966 | # |
|---|
| 967 | # def __init__(self, conf, aw): |
|---|
| 968 | # self._conf = conf |
|---|
| 969 | # self._aw = aw |
|---|
| 970 | # self._socialEvent = self._conf.getRegistrationForm().getSocialEventForm() |
|---|
| 971 | # |
|---|
| 972 | # def getHTML( self, body, **params ): |
|---|
| 973 | # params["body"] = body |
|---|
| 974 | # return wcomponents.WTemplated.getHTML( self, params ) |
|---|
| 975 | # |
|---|
| 976 | # def getVars( self ): |
|---|
| 977 | # vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 978 | # vars["context"] = wcomponents.WConfModifHeader( self._conf, self._aw ).getHTML(vars) |
|---|
| 979 | # vars["title"] = self._socialEvent.getTitle() |
|---|
| 980 | # vars["titleTabPixels"] = self.getTitleTabPixels() |
|---|
| 981 | # vars["intermediateVTabPixels"] = self.getIntermediateVTabPixels() |
|---|
| 982 | # vars["closeHeaderTags"] = self.getCloseHeaderTags() |
|---|
| 983 | # return vars |
|---|
| 984 | # |
|---|
| 985 | # def getOwnerComponent( self ): |
|---|
| 986 | # wc = wcomponents.WConferenceModifFrame(self._conf, self._aw) |
|---|
| 987 | # return wc |
|---|
| 988 | # |
|---|
| 989 | # def getIntermediateVTabPixels( self ): |
|---|
| 990 | # wc = self.getOwnerComponent() |
|---|
| 991 | # return 7 + wc.getIntermediateVTabPixels() |
|---|
| 992 | # |
|---|
| 993 | # def getTitleTabPixels( self ): |
|---|
| 994 | # wc = self.getOwnerComponent() |
|---|
| 995 | # return wc.getTitleTabPixels() - 7 |
|---|
| 996 | # |
|---|
| 997 | # def getCloseHeaderTags( self ): |
|---|
| 998 | # wc = self.getOwnerComponent() |
|---|
| 999 | # return "</table></td></tr>" + wc.getCloseHeaderTags() |
|---|
| 1000 | |
|---|
| 1001 | class WPConfModifRegFormSocialEvent( WPConfModifRegFormSocialEventBase ): |
|---|
| 1002 | |
|---|
| 1003 | def _getTabContent( self, params ): |
|---|
| 1004 | wc = WConfModifRegFormSocialEvent(self._conf) |
|---|
| 1005 | p = { |
|---|
| 1006 | 'dataModificationURL': quoteattr(str(urlHandlers.UHConfModifRegFormSocialEventDataModif.getURL( self._conf ))), |
|---|
| 1007 | 'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormSocialEventRemove.getURL( self._conf ))), |
|---|
| 1008 | 'postNewURL': quoteattr(str(urlHandlers.UHConfModifRegFormSocialEventAdd.getURL( self._conf ))) |
|---|
| 1009 | } |
|---|
| 1010 | return wc.getHTML(p) |
|---|
| 1011 | |
|---|
| 1012 | class WConfModifRegFormSocialEvent( wcomponents.WTemplated ): |
|---|
| 1013 | |
|---|
| 1014 | def __init__( self, conference ): |
|---|
| 1015 | self._conf = conference |
|---|
| 1016 | |
|---|
| 1017 | def _getSocialEventsHTML(self, socialEvent): |
|---|
| 1018 | html=[] |
|---|
| 1019 | for se in socialEvent.getSocialEventList(True): |
|---|
| 1020 | cancelled = "" |
|---|
| 1021 | if se.isCancelled(): |
|---|
| 1022 | cancelled = i18nformat("""<font color=\"red\">( _("cancelled") )</font>""") |
|---|
| 1023 | if se.getCancelledReason().strip(): |
|---|
| 1024 | cancelled = i18nformat("""<font color=\"red\">( _("disabled"): %s)</font>""")%se.getCancelledReason().strip() |
|---|
| 1025 | limit = " <i>[unlimited places]</i>" |
|---|
| 1026 | if se.getPlacesLimit() > 0: |
|---|
| 1027 | limit = " <i>[%s/%s place(s)]</i>"%(se.getCurrentNoPlaces(), se.getPlacesLimit()) |
|---|
| 1028 | billable = "" |
|---|
| 1029 | if se.isBillable(): |
|---|
| 1030 | perPlace = "" |
|---|
| 1031 | if se.isPricePerPlace(): |
|---|
| 1032 | perPlace = ' <acronym title="per place">pp</acronym>' |
|---|
| 1033 | billable = " <i>[billable: %s%s]</i>" % (se.getPrice(), perPlace) |
|---|
| 1034 | url = urlHandlers.UHConfModifRegFormSocialEventItemModify.getURL(se) |
|---|
| 1035 | html.append("""<tr> |
|---|
| 1036 | <td align="left" style="padding-left:10px"><input type="checkbox" name="socialEvents" value="%s"><a href=%s>%s</a>%s%s%s</td> |
|---|
| 1037 | </tr> |
|---|
| 1038 | """%(se.getId(), quoteattr(str(url)), self.htmlText(se.getCaption()), limit, billable, cancelled ) ) |
|---|
| 1039 | return "".join(html) |
|---|
| 1040 | |
|---|
| 1041 | def getVars( self ): |
|---|
| 1042 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 1043 | regForm = self._conf.getRegistrationForm() |
|---|
| 1044 | socialEvent = regForm.getSocialEventForm() |
|---|
| 1045 | vars["title"] = socialEvent.getTitle() |
|---|
| 1046 | vars["description"] = socialEvent.getDescription() |
|---|
| 1047 | vars["intro"] = socialEvent.getIntroSentence() |
|---|
| 1048 | vars["selectionType"] = socialEvent.getSelectionTypeCaption() |
|---|
| 1049 | vars["socialEvents"] = self._getSocialEventsHTML(socialEvent) |
|---|
| 1050 | return vars |
|---|
| 1051 | |
|---|
| 1052 | class WPConfModifRegFormSocialEventDataModif( WPConfModifRegFormSocialEventBase ): |
|---|
| 1053 | |
|---|
| 1054 | def _getTabContent( self, params ): |
|---|
| 1055 | wc = WConfModifRegFormSocialEventDataModif(self._conf) |
|---|
| 1056 | p = {'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormSocialEventPerformDataModif.getURL( self._conf ))) |
|---|
| 1057 | } |
|---|
| 1058 | return wc.getHTML(p) |
|---|
| 1059 | |
|---|
| 1060 | class WConfModifRegFormSocialEventDataModif( wcomponents.WTemplated ): |
|---|
| 1061 | |
|---|
| 1062 | def __init__( self, conference ): |
|---|
| 1063 | self._conf = conference |
|---|
| 1064 | |
|---|
| 1065 | def getVars( self ): |
|---|
| 1066 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 1067 | regForm = self._conf.getRegistrationForm() |
|---|
| 1068 | socialEvent = regForm.getSocialEventForm() |
|---|
| 1069 | vars["title"] = socialEvent.getTitle() |
|---|
| 1070 | vars["description"] = socialEvent.getDescription() |
|---|
| 1071 | vars["intro"] = socialEvent.getIntroSentence() |
|---|
| 1072 | vars["socEvent"] = socialEvent |
|---|
| 1073 | return vars |
|---|
| 1074 | |
|---|
| 1075 | class WPConfModifRegFormSocialEventAdd( WPConfModifRegFormSocialEventBase ): |
|---|
| 1076 | |
|---|
| 1077 | def _getTabContent( self, params ): |
|---|
| 1078 | wc = WConfModifRegFormSocialEventAdd() |
|---|
| 1079 | p = {'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormSocialEventPerformAdd.getURL( self._conf ))) |
|---|
| 1080 | } |
|---|
| 1081 | return wc.getHTML(p) |
|---|
| 1082 | |
|---|
| 1083 | class WConfModifRegFormSocialEventAdd( wcomponents.WTemplated ): |
|---|
| 1084 | pass |
|---|
| 1085 | |
|---|
| 1086 | class WPConfModifRegFormSocialEventItemModify( WPConfModifRegFormSocialEventBase ): |
|---|
| 1087 | |
|---|
| 1088 | def __init__(self, rh, conf, socialEventItem): |
|---|
| 1089 | WPConfModifRegFormSocialEventBase.__init__(self, rh, conf) |
|---|
| 1090 | self._socialEventItem = socialEventItem |
|---|
| 1091 | |
|---|
| 1092 | def _getTabContent( self, params ): |
|---|
| 1093 | wc = WConfModifRegFormSocialEventItemModify(self._socialEventItem) |
|---|
| 1094 | p = {'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormSocialEventItemPerformModify.getURL( self._socialEventItem ))) |
|---|
| 1095 | } |
|---|
| 1096 | return wc.getHTML(p) |
|---|
| 1097 | |
|---|
| 1098 | class WConfModifRegFormSocialEventItemModify( wcomponents.WTemplated ): |
|---|
| 1099 | |
|---|
| 1100 | def __init__(self, socialEventItem): |
|---|
| 1101 | self._socialEventItem = socialEventItem |
|---|
| 1102 | |
|---|
| 1103 | def getVars( self ): |
|---|
| 1104 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 1105 | vars["caption"] = quoteattr(self._socialEventItem.getCaption()) |
|---|
| 1106 | vars["checked"] = "" |
|---|
| 1107 | if self._socialEventItem.isCancelled(): |
|---|
| 1108 | vars["checked"] = """ checked="checked" """ |
|---|
| 1109 | vars["reason"] = "" |
|---|
| 1110 | if self._socialEventItem.getCancelledReason().strip() != "": |
|---|
| 1111 | vars["reason"] = self._socialEventItem.getCancelledReason() |
|---|
| 1112 | vars["maxPlace"] = self._socialEventItem.getMaxPlacePerRegistrant() |
|---|
| 1113 | vars["placesLimit"] = self._socialEventItem.getPlacesLimit() |
|---|
| 1114 | vars["billable"] = "" |
|---|
| 1115 | if self._socialEventItem.isBillable(): |
|---|
| 1116 | vars["billable"] = """ checked="checked" """ |
|---|
| 1117 | vars["pricePerPlace"] = "" |
|---|
| 1118 | if self._socialEventItem.isPricePerPlace(): |
|---|
| 1119 | vars["pricePerPlace"] = """ checked="checked" """ |
|---|
| 1120 | vars["price"] = self._socialEventItem.getPrice() |
|---|
| 1121 | return vars |
|---|
| 1122 | |
|---|
| 1123 | class WPConfRemoveSocialEvent(WPConfModifRegFormSocialEventBase): |
|---|
| 1124 | |
|---|
| 1125 | def __init__(self, rh, conf, socialEventIds, eventNames): |
|---|
| 1126 | WPConfModifRegFormSocialEventBase.__init__(self, rh, conf) |
|---|
| 1127 | self._eventType="conference" |
|---|
| 1128 | self._socialEventIds = socialEventIds |
|---|
| 1129 | self._eventNames = [] |
|---|
| 1130 | for n in eventNames : |
|---|
| 1131 | self._eventNames.append("<li>%s</li>"%n) |
|---|
| 1132 | if self._rh.getWebFactory() is not None: |
|---|
| 1133 | self._eventType=self._rh.getWebFactory().getId() |
|---|
| 1134 | |
|---|
| 1135 | def _setActiveTab( self ): |
|---|
| 1136 | self._tabMain.setActive() |
|---|
| 1137 | |
|---|
| 1138 | def _getTabContent( self, params ): |
|---|
| 1139 | msg = i18nformat(""" |
|---|
| 1140 | <font size="+2"> _("Are you sure that you want to DELETE this social event")? <br><table><tr><td align="left"><ul>%s</ul></td></tr></table></font><br> |
|---|
| 1141 | ( _("Note that if you delete this social event, registrants who applied for it |
|---|
| 1142 | will lose their social event info") ) |
|---|
| 1143 | """)%("".join(self._eventNames)) |
|---|
| 1144 | wc = wcomponents.WConfirmation() |
|---|
| 1145 | return wc.getHTML( msg, \ |
|---|
| 1146 | urlHandlers.UHConfModifRegFormSocialEventRemove.getURL( self._conf ),\ |
|---|
| 1147 | {"socialEvents":self._socialEventIds}, \ |
|---|
| 1148 | confirmButtonCaption= _("Yes"), cancelButtonCaption= _("No") ) |
|---|
| 1149 | |
|---|
| 1150 | class WPConfModifRegFormStatusesRemConfirm(WPConfModifRegFormBase): |
|---|
| 1151 | |
|---|
| 1152 | def __init__(self,rh,target, stids): |
|---|
| 1153 | WPConfModifRegFormBase.__init__(self, rh, target) |
|---|
| 1154 | self._statusesIds=stids |
|---|
| 1155 | |
|---|
| 1156 | def _getTabContent(self,params): |
|---|
| 1157 | wc=wcomponents.WConfirmation() |
|---|
| 1158 | ssHTML=["<ul>"] |
|---|
| 1159 | for id in self._statusesIds: |
|---|
| 1160 | s=self._conf.getRegistrationForm().getStatusById(id) |
|---|
| 1161 | ssHTML.append(""" |
|---|
| 1162 | <li>%s</li> |
|---|
| 1163 | """%(s.getCaption().strip() or i18nformat("""-- [%s] _("status with no name") --""")%s.getId())) |
|---|
| 1164 | ssHTML.append("</ul>") |
|---|
| 1165 | msg= i18nformat(""" _("Are you sure you want to delete the following statuses |
|---|
| 1166 | linked to the registration form module")? |
|---|
| 1167 | %s |
|---|
| 1168 | <font color="red">( _("note that current registrants will lose this info") )</font>""")%("".join(ssHTML)) |
|---|
| 1169 | url=urlHandlers.UHConfModifRegFormActionStatuses.getURL(self._conf) |
|---|
| 1170 | return wc.getHTML(msg,url,{"statusesIds":self._statusesIds, "removeStatuses":"1"}) |
|---|
| 1171 | |
|---|
| 1172 | class WPConfModifRegFormGeneralSectionRemConfirm(WPConfModifRegFormBase): |
|---|
| 1173 | |
|---|
| 1174 | def __init__(self,rh,target, gss): |
|---|
| 1175 | WPConfModifRegFormBase.__init__(self, rh, target) |
|---|
| 1176 | self._generalSections=gss |
|---|
| 1177 | |
|---|
| 1178 | def _getTabContent(self,params): |
|---|
| 1179 | wc=wcomponents.WConfirmation() |
|---|
| 1180 | ssHTML=["<ul>"] |
|---|
| 1181 | for id in self._generalSections: |
|---|
| 1182 | s=self._conf.getRegistrationForm().getGeneralSectionFormById(id) |
|---|
| 1183 | ssHTML.append(""" |
|---|
| 1184 | <li>%s</li> |
|---|
| 1185 | """%(s.getTitle())) |
|---|
| 1186 | ssHTML.append("</ul>") |
|---|
| 1187 | msg= i18nformat(""" _("Are you sure you want to delete the following sections |
|---|
| 1188 | of the registration form")? |
|---|
| 1189 | %s |
|---|
| 1190 | <font color="red">( _("note that current registrants will lose this info"))</font>""")%("".join(ssHTML)) |
|---|
| 1191 | url=urlHandlers.UHConfModifRegFormActionSection.getURL(self._conf) |
|---|
| 1192 | return wc.getHTML(msg,url,{"sectionsIds":self._generalSections, "removeSection":"1"}) |
|---|
| 1193 | |
|---|
| 1194 | class WPConfModifRegFormGeneralSectionBase(WPConfModifRegFormSectionsBase): |
|---|
| 1195 | |
|---|
| 1196 | def __init__(self, rh, gs): |
|---|
| 1197 | WPConfModifRegFormSectionsBase.__init__(self, rh, gs.getConference()) |
|---|
| 1198 | self._targetSection=self._generalSectionForm=gs |
|---|
| 1199 | |
|---|
| 1200 | def _createTabCtrl( self ): |
|---|
| 1201 | self._tabCtrl = wcomponents.TabControl() |
|---|
| 1202 | self._tabMain = self._tabCtrl.newTab( "main", _("Main"), \ |
|---|
| 1203 | urlHandlers.UHConfModifRegFormGeneralSection.getURL( self._conf ) ) |
|---|
| 1204 | # wf = self._rh.getWebFactory() |
|---|
| 1205 | # if wf: |
|---|
| 1206 | # wf.customiseTabCtrl( self._tabCtrl ) |
|---|
| 1207 | self._setActiveTab() |
|---|
| 1208 | |
|---|
| 1209 | def _setActiveTab( self ): |
|---|
| 1210 | pass |
|---|
| 1211 | |
|---|
| 1212 | def _getTabContent( self, params ): |
|---|
| 1213 | return "nothing" |
|---|
| 1214 | |
|---|
| 1215 | class WRegFormGeneralSectionModifFrame(wcomponents.WTemplated): |
|---|
| 1216 | |
|---|
| 1217 | def __init__(self, gs, aw): |
|---|
| 1218 | self._conf = gs.getConference() |
|---|
| 1219 | self._aw = aw |
|---|
| 1220 | self._generalSection = gs |
|---|
| 1221 | |
|---|
| 1222 | def getHTML( self, body, **params ): |
|---|
| 1223 | params["body"] = body |
|---|
| 1224 | return wcomponents.WTemplated.getHTML( self, params ) |
|---|
| 1225 | |
|---|
| 1226 | def getVars( self ): |
|---|
| 1227 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 1228 | vars["context"] = wcomponents.WConfModifHeader( self._conf, self._aw ).getHTML(vars) |
|---|
| 1229 | vars["title"] = self._generalSection.getTitle() |
|---|
| 1230 | vars["titleTabPixels"] = self.getTitleTabPixels() |
|---|
| 1231 | vars["intermediateVTabPixels"] = self.getIntermediateVTabPixels() |
|---|
| 1232 | vars["closeHeaderTags"] = self.getCloseHeaderTags() |
|---|
| 1233 | return vars |
|---|
| 1234 | |
|---|
| 1235 | def getOwnerComponent( self ): |
|---|
| 1236 | wc = wcomponents.WConferenceModifFrame(self._conf, self._aw) |
|---|
| 1237 | return wc |
|---|
| 1238 | |
|---|
| 1239 | def getIntermediateVTabPixels( self ): |
|---|
| 1240 | wc = self.getOwnerComponent() |
|---|
| 1241 | return 7 + wc.getIntermediateVTabPixels() |
|---|
| 1242 | |
|---|
| 1243 | def getTitleTabPixels( self ): |
|---|
| 1244 | wc = self.getOwnerComponent() |
|---|
| 1245 | return wc.getTitleTabPixels() - 7 |
|---|
| 1246 | |
|---|
| 1247 | def getCloseHeaderTags( self ): |
|---|
| 1248 | wc = self.getOwnerComponent() |
|---|
| 1249 | return "</table></td></tr>" + wc.getCloseHeaderTags() |
|---|
| 1250 | |
|---|
| 1251 | class WPConfModifRegFormGeneralSection( WPConfModifRegFormGeneralSectionBase ): |
|---|
| 1252 | |
|---|
| 1253 | def _getTabContent( self, params ): |
|---|
| 1254 | wc = WConfModifRegFormGeneralSection(self._generalSectionForm) |
|---|
| 1255 | p = { |
|---|
| 1256 | 'dataModificationURL': quoteattr(str(urlHandlers.UHConfModifRegFormGeneralSectionDataModif.getURL( self._generalSectionForm ))), |
|---|
| 1257 | 'postActionURL': quoteattr(str(urlHandlers.UHConfModifRegFormGeneralSectionFieldRemove.getURL( self._generalSectionForm ))), |
|---|
| 1258 | 'postNewURL': quoteattr(str(urlHandlers.UHConfModifRegFormGeneralSectionFieldAdd.getURL( self._generalSectionForm ))) |
|---|
| 1259 | } |
|---|
| 1260 | return wc.getHTML(p) |
|---|
| 1261 | |
|---|
| 1262 | class WConfModifRegFormGeneralSection( wcomponents.WTemplated ): |
|---|
| 1263 | |
|---|
| 1264 | def __init__( self, gs ): |
|---|
| 1265 | self._conf = gs.getConference() |
|---|
| 1266 | self._generalSection=gs |
|---|
| 1267 | |
|---|
| 1268 | def _getGeneralFieldsHTML(self): |
|---|
| 1269 | html=[] |
|---|
| 1270 | enabledBulb = Configuration.Config.getInstance().getSystemIconURL("enabledSection") |
|---|
| 1271 | notEnabledBulb = Configuration.Config.getInstance().getSystemIconURL("disabledSection") |
|---|
| 1272 | enabledText = "Click to disable" |
|---|
| 1273 | disabledText = "Click to enable" |
|---|
| 1274 | ############## |
|---|
| 1275 | #jmf-start |
|---|
| 1276 | #for f in self._generalSection.getFields(): |
|---|
| 1277 | for f in self._generalSection.getSortedFields(): |
|---|
| 1278 | #jmf-end |
|---|
| 1279 | ############## |
|---|
| 1280 | url = urlHandlers.UHConfModifRegFormGeneralSectionFieldModif.getURL(f) |
|---|
| 1281 | spec = " <b>(%s"%f.getInput().getName() |
|---|
| 1282 | if f.isMandatory(): |
|---|
| 1283 | spec = i18nformat(""" %s, _("mandatory")""")%spec |
|---|
| 1284 | if f.isBillable(): |
|---|
| 1285 | spec = i18nformat(""" %s, _("Billable") = %s""")%(spec,self.htmlText(f.getPrice())) |
|---|
| 1286 | if f.getPlacesLimit(): |
|---|
| 1287 | spec = i18nformat(""" %s, _("Places") = %s/%s""")%(spec,f.getNoPlacesLeft(),f.getPlacesLimit()) |
|---|
| 1288 | |
|---|
| 1289 | spec = " %s)</b>"%spec |
|---|
| 1290 | |
|---|
| 1291 | # |
|---|
| 1292 | # add the selection box here for sorting... |
|---|
| 1293 | # |
|---|
| 1294 | |
|---|
| 1295 | selbox = """<select name="newpos%s" onChange="this.form.oldpos.value='%s';this.form.submit();">""" % (self._generalSection.getSortedFields().index(f),self._generalSection.getSortedFields().index(f)) |
|---|
| 1296 | for i in range(1,len(self._generalSection.getSortedFields()) + 1): |
|---|
| 1297 | if i == self._generalSection.getSortedFields().index(f)+1: |
|---|
| 1298 | selbox += "<option selected value='%s'>%s" % (i-1,i) |
|---|
| 1299 | else: |
|---|
| 1300 | selbox += "<option value='%s'>%s" % (i-1,i) |
|---|
| 1301 | selbox += """ |
|---|
| 1302 | </select>""" |
|---|
| 1303 | |
|---|
| 1304 | chkbox = "" |
|---|
| 1305 | if not f.isLocked('delete'): |
|---|
| 1306 | chkbox = """<input type="checkbox" name="fieldsIds" value="%s">""" % f.getId() |
|---|
| 1307 | |
|---|
| 1308 | urlStatus = urlHandlers.UHConfModifRegFormEnablePersonalField.getURL(self._conf) |
|---|
| 1309 | urlStatus.addParam("personalfield", f.getId()) |
|---|
| 1310 | img = enabledBulb |
|---|
| 1311 | imgAlt = enabledText |
|---|
| 1312 | if f.isDisabled(): |
|---|
| 1313 | img = notEnabledBulb |
|---|
| 1314 | imgAlt = disabledText |
|---|
| 1315 | |
|---|
| 1316 | toggle = "" |
|---|
| 1317 | if not f.isLocked('disable') and self._generalSection is self._generalSection.getRegistrationForm().getPersonalDataNew(): |
|---|
| 1318 | toggle = """<a href=%s><img src="%s" alt="%s" class="imglink"></a>""" % (quoteattr(str(urlStatus)), img, imgAlt) |
|---|
| 1319 | |
|---|
| 1320 | html.append("""<tr> |
|---|
| 1321 | <td align="left" style="padding-left:10px">%s</td><td>%s</td><td>%s</td><td><a href=%s>%s</a>%s</td> |
|---|
| 1322 | </tr> |
|---|
| 1323 | """%(toggle, selbox, chkbox, url, self.htmlText(f.getCaption()),spec) ) |
|---|
| 1324 | #"""%(f.getId(), url, f.getCaption(),spec) ) |
|---|
| 1325 | html.insert(0,"""<a href="" name="sections"></a><input type="hidden" name="oldpos"><table align="left">""") |
|---|
| 1326 | html.append("</table>") |
|---|
| 1327 | return "".join(html) |
|---|
| 1328 | |
|---|
| 1329 | def getVars( self ): |
|---|
| 1330 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 1331 | vars["title"] = self._generalSection.getTitle() |
|---|
| 1332 | vars["description"] = self._generalSection.getDescription() |
|---|
| 1333 | vars["generalFields"] = self._getGeneralFieldsHTML() |
|---|
| 1334 | return vars |
|---|
| 1335 | |
|---|
| 1336 | class WPConfModifRegFormGeneralSectionDataModif( WPConfModifRegFormGeneralSectionBase ): |
|---|
| 1337 | |
|---|
| 1338 | def _getTabContent( self, params ): |
|---|
| 1339 | wc = WConfModifRegFormGeneralSectionDataModif(self._generalSectionForm) |
|---|
| 1340 | p = {'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormGeneralSectionPerformDataModif.getURL( self._generalSectionForm ))) |
|---|
| 1341 | } |
|---|
| 1342 | return wc.getHTML(p) |
|---|
| 1343 | |
|---|
| 1344 | class WConfModifRegFormGeneralSectionDataModif( wcomponents.WTemplated ): |
|---|
| 1345 | |
|---|
| 1346 | def __init__( self, generalSectionForm ): |
|---|
| 1347 | self._generalSectionForm = generalSectionForm |
|---|
| 1348 | |
|---|
| 1349 | def getVars( self ): |
|---|
| 1350 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 1351 | vars["title"] = quoteattr(self._generalSectionForm.getTitle()) |
|---|
| 1352 | vars["description"] = self._generalSectionForm.getDescription() |
|---|
| 1353 | return vars |
|---|
| 1354 | |
|---|
| 1355 | class WPConfModifRegFormGeneralSectionFieldAdd( WPConfModifRegFormGeneralSectionBase ): |
|---|
| 1356 | |
|---|
| 1357 | def __init__(self, rh, section, tmpField): |
|---|
| 1358 | WPConfModifRegFormGeneralSectionBase.__init__(self, rh, section) |
|---|
| 1359 | self._tmpField=tmpField |
|---|
| 1360 | |
|---|
| 1361 | def _getTabContent( self, params ): |
|---|
| 1362 | wc = WConfModifRegFormGeneralSectionFieldEdit(self._tmpField) |
|---|
| 1363 | p = {'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormGeneralSectionFieldPerformAdd.getURL( self._generalSectionForm ))) |
|---|
| 1364 | } |
|---|
| 1365 | return wc.getHTML(p) |
|---|
| 1366 | |
|---|
| 1367 | class WConfModifRegFormGeneralSectionFieldEdit( wcomponents.WTemplated ): |
|---|
| 1368 | |
|---|
| 1369 | def __init__( self, generalField=None): |
|---|
| 1370 | self._generalField = generalField |
|---|
| 1371 | |
|---|
| 1372 | def _getFieldTypesHTML(self): |
|---|
| 1373 | disabled = "" |
|---|
| 1374 | if self._generalField and self._generalField.isLocked('input'): |
|---|
| 1375 | disabled = """ disabled="disabled""" |
|---|
| 1376 | html=["""<select name="input" onchange="javascript:$E('WConfModifRegFormGeneralSectionFieldEdit').dom.submit(); $E('submitButton').dom.disabled=true; $E('cancelButton').dom.disabled=true;"%s>""" % disabled] |
|---|
| 1377 | keylist=registration.FieldInputs.getAvailableInputKeys() |
|---|
| 1378 | keylist.sort() |
|---|
| 1379 | for key in keylist: |
|---|
| 1380 | selec="" |
|---|
| 1381 | if self._generalField is not None: |
|---|
| 1382 | if self._generalField.getInput().getId() == key: |
|---|
| 1383 | selec="selected" |
|---|
| 1384 | html.append(""" |
|---|
| 1385 | <option value="%s" %s>%s</option> |
|---|
| 1386 | """%(key, selec, registration.FieldInputs.getAvailableInputKlassById(key).getName())) |
|---|
| 1387 | html.append("""</select>""") |
|---|
| 1388 | return "".join(html) |
|---|
| 1389 | |
|---|
| 1390 | def getVars( self ): |
|---|
| 1391 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 1392 | vars["caption"] = "" |
|---|
| 1393 | vars["description"] = "" |
|---|
| 1394 | vars["mandatory"] = """ checked="checked" """ |
|---|
| 1395 | vars["mandatoryLocked"] = False |
|---|
| 1396 | #vars["billable"]= """ checked="checked" """ |
|---|
| 1397 | #vars["price"]="" |
|---|
| 1398 | if self._generalField is not None: |
|---|
| 1399 | vars["caption"] = quoteattr(self._generalField.getCaption()) |
|---|
| 1400 | vars["description"] = self._generalField.getDescription() |
|---|
| 1401 | #vars["price"]= quoteattr(self._generalField.getPrice()) |
|---|
| 1402 | if not self._generalField.isMandatory(): |
|---|
| 1403 | vars["mandatory"] = "" |
|---|
| 1404 | vars["mandatoryLocked"] = self._generalField.isLocked('mandatory') |
|---|
| 1405 | #if not self._generalField.isBillable(): |
|---|
| 1406 | # vars["billable"] = "" |
|---|
| 1407 | vars["inputtypes"]=self._getFieldTypesHTML() |
|---|
| 1408 | vars["specialOptions"]="" |
|---|
| 1409 | if self._generalField is not None: |
|---|
| 1410 | vars["specialOptions"]=self._generalField.getInput()._getSpecialOptionsHTML() |
|---|
| 1411 | return vars |
|---|
| 1412 | |
|---|
| 1413 | class WPConfModifRegFormGeneralSectionFieldModif( WPConfModifRegFormGeneralSectionBase ): |
|---|
| 1414 | |
|---|
| 1415 | def __init__(self, rh, field, tmpField): |
|---|
| 1416 | WPConfModifRegFormGeneralSectionBase.__init__(self, rh, field.getParent()) |
|---|
| 1417 | self._sectionField=field |
|---|
| 1418 | self._tmpField=tmpField |
|---|
| 1419 | |
|---|
| 1420 | def _getTabContent( self, params ): |
|---|
| 1421 | wc = WConfModifRegFormGeneralSectionFieldEdit(self._tmpField) |
|---|
| 1422 | p = {'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormGeneralSectionFieldPerformModif.getURL( self._sectionField ))) |
|---|
| 1423 | } |
|---|
| 1424 | return wc.getHTML(p) |
|---|
| 1425 | |
|---|
| 1426 | class WPConfModifRegFormGeneralSectionFieldRemConfirm(WPConfModifRegFormGeneralSectionBase): |
|---|
| 1427 | |
|---|
| 1428 | def __init__(self,rh,gs, fields): |
|---|
| 1429 | WPConfModifRegFormGeneralSectionBase.__init__(self, rh, gs) |
|---|
| 1430 | self._fields=fields |
|---|
| 1431 | |
|---|
| 1432 | def _getTabContent(self,params): |
|---|
| 1433 | wc=wcomponents.WConfirmation() |
|---|
| 1434 | fieldsHTML=["<ul>"] |
|---|
| 1435 | for id in self._fields: |
|---|
| 1436 | f=self._generalSectionForm.getFieldById(id) |
|---|
| 1437 | fieldsHTML.append(""" |
|---|
| 1438 | <li>%s</li> |
|---|
| 1439 | """%(f.getCaption())) |
|---|
| 1440 | fieldsHTML.append("</ul>") |
|---|
| 1441 | msg= i18nformat(""" _("Are you sure you want to delete the following fields |
|---|
| 1442 | of the section '%s'")? |
|---|
| 1443 | %s |
|---|
| 1444 | <font color="red">( _("note that current registrants will lose this info"))</font>""")%(self._generalSectionForm.getTitle(), |
|---|
| 1445 | "".join(fieldsHTML)) |
|---|
| 1446 | url=urlHandlers.UHConfModifRegFormGeneralSectionFieldRemove.getURL(self._generalSectionForm) |
|---|
| 1447 | return wc.getHTML(msg,url,{"fieldsIds":self._fields}) |
|---|
| 1448 | |
|---|
| 1449 | class WPConfModifRegFormStatusModif( WPConfModifRegFormBase ): |
|---|
| 1450 | |
|---|
| 1451 | def __init__(self, rh, st, tmpst): |
|---|
| 1452 | WPConfModifRegFormBase.__init__(self, rh, st.getConference()) |
|---|
| 1453 | self._status=st |
|---|
| 1454 | self._tempStatus=tmpst |
|---|
| 1455 | |
|---|
| 1456 | def _getTabContent( self, params ): |
|---|
| 1457 | wc = WConfModifRegFormStatusModif(self._status, self._tempStatus) |
|---|
| 1458 | p = { |
|---|
| 1459 | |
|---|
| 1460 | 'postURL': quoteattr(str(urlHandlers.UHConfModifRegFormStatusPerformModif.getURL( self._status ))) |
|---|
| 1461 | } |
|---|
| 1462 | return wc.getHTML(p) |
|---|
| 1463 | |
|---|
| 1464 | class WConfModifRegFormStatusModif( wcomponents.WTemplated ): |
|---|
| 1465 | |
|---|
| 1466 | def __init__( self, st, tmpst ): |
|---|
| 1467 | self._conf = st.getConference() |
|---|
| 1468 | self._status=st |
|---|
| 1469 | self._tempStatus=tmpst |
|---|
| 1470 | |
|---|
| 1471 | def _getStatusValuesHTML(self): |
|---|
| 1472 | html=["""<table>"""] |
|---|
| 1473 | for v in self._tempStatus.getStatusValuesList(True): |
|---|
| 1474 | default="" |
|---|
| 1475 | if self._tempStatus.getDefaultValue() is not None and self._tempStatus.getDefaultValue().getId() == v.getId(): |
|---|
| 1476 | default="""<i><b> (default)</b></i>""" |
|---|
| 1477 | html.append("""<tr> |
|---|
| 1478 | <td align="left" style="padding-left:10px"><input type="checkbox" name="valuesIds" value="%s">%s%s</td> |
|---|
| 1479 | </tr> |
|---|
| 1480 | """%(v.getId(), self.htmlText(v.getCaption()), default) ) |
|---|
| 1481 | html.append("""</table>""") |
|---|
| 1482 | return "".join(html) |
|---|
| 1483 | |
|---|
| 1484 | def getVars( self ): |
|---|
| 1485 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 1486 | vars["caption"] = self._tempStatus.getCaption() |
|---|
| 1487 | vars["values"] = self._getStatusValuesHTML() |
|---|
| 1488 | return vars |
|---|
| 1489 | |
|---|
| 1490 | # ---------------------------------------------------------- |
|---|
| 1491 | |
|---|
| 1492 | # ----------------- DISPLAY AREA --------------------------- |
|---|
| 1493 | |
|---|
| 1494 | class WPRegistrationForm( conferences.WPConferenceDefaultDisplayBase ): |
|---|
| 1495 | navigationEntry = navigation.NERegistrationForm |
|---|
| 1496 | |
|---|
| 1497 | def _getBody( self, params ): |
|---|
| 1498 | wc = WConfRegistrationForm( self._conf, self._getAW().getUser() ) |
|---|
| 1499 | pars = {"menuStatus":self._rh._getSession().getVar("menuStatus") or "open"} |
|---|
| 1500 | return wc.getHTML(pars) |
|---|
| 1501 | |
|---|
| 1502 | def _defineSectionMenu( self ): |
|---|
| 1503 | conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self) |
|---|
| 1504 | self._sectionMenu.setCurrentItem(self._regFormOpt) |
|---|
| 1505 | |
|---|
| 1506 | class WConfRegistrationForm(wcomponents.WTemplated): |
|---|
| 1507 | |
|---|
| 1508 | def __init__(self, conf, av): |
|---|
| 1509 | self._conf = conf |
|---|
| 1510 | self._avatar = av |
|---|
| 1511 | |
|---|
| 1512 | def _getActionsHTML( self, showActions = False ): |
|---|
| 1513 | html = "" |
|---|
| 1514 | if showActions: |
|---|
| 1515 | regForm = self._conf.getRegistrationForm() |
|---|
| 1516 | if nowutc() < regForm.getStartRegistrationDate(): |
|---|
| 1517 | return html |
|---|
| 1518 | else: |
|---|
| 1519 | submitOpt = "" |
|---|
| 1520 | registered = False |
|---|
| 1521 | if self._avatar is not None: |
|---|
| 1522 | registered = self._avatar.isRegisteredInConf(self._conf) |
|---|
| 1523 | if regForm.inRegistrationPeriod() and not registered: |
|---|
| 1524 | submitOpt = i18nformat("""<li><a href=%s> _("Show registration form")</a></li>""")%(quoteattr(str(urlHandlers.UHConfRegistrationFormDisplay.getURL( self._conf )))) |
|---|
| 1525 | if registered: |
|---|
| 1526 | submitOpt = i18nformat("""%s<li><a href=%s> _("View or modify your already registration")</a></li>""")%(submitOpt, quoteattr(str(""))) |
|---|
| 1527 | html = i18nformat(""" |
|---|
| 1528 | <b> _("Possible actions you can carry out"):</b> |
|---|
| 1529 | <ul> |
|---|
| 1530 | %s |
|---|
| 1531 | </ul> |
|---|
| 1532 | """)%( submitOpt ) |
|---|
| 1533 | return html |
|---|
| 1534 | |
|---|
| 1535 | def getVars(self): |
|---|
| 1536 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 1537 | regForm = self._conf.getRegistrationForm() |
|---|
| 1538 | vars["startDate"] = regForm.getStartRegistrationDate().strftime("%d %B %Y") |
|---|
| 1539 | vars["endDate"] = regForm.getEndRegistrationDate().strftime("%d %B %Y") |
|---|
| 1540 | vars["actions"] = self._getActionsHTML(vars["menuStatus"] == "close") |
|---|
| 1541 | vars["announcement"] = regForm.getAnnouncement() |
|---|
| 1542 | vars["title"] = regForm.getTitle() |
|---|
| 1543 | vars["usersLimit"] = "" |
|---|
| 1544 | if regForm.getUsersLimit() > 0: |
|---|
| 1545 | vars["usersLimit"] = i18nformat(""" |
|---|
| 1546 | <tr> |
|---|
| 1547 | <td nowrap class="displayField"><b> _("Max No. of registrants"):</b></td> |
|---|
| 1548 | <td width="100%%" align="left">%s</td> |
|---|
| 1549 | </tr> |
|---|
| 1550 | """)%regForm.getUsersLimit() |
|---|
| 1551 | vars["contactInfo"] = "" |
|---|
| 1552 | if regForm.getContactInfo().strip()!="": |
|---|
| 1553 | vars["contactInfo"] = i18nformat(""" |
|---|
| 1554 | <tr> |
|---|
| 1555 | <td nowrap class="displayField"><b> _("Contact info"):</b></td> |
|---|
| 1556 | <td width="100%%" align="left">%s</td> |
|---|
| 1557 | </tr> |
|---|
| 1558 | """ )%regForm.getContactInfo() |
|---|
| 1559 | return vars |
|---|
| 1560 | |
|---|
| 1561 | class WPRegistrationFormDisplay( conferences.WPConferenceDefaultDisplayBase ): |
|---|
| 1562 | navigationEntry = navigation.NERegistrationFormDisplay |
|---|
| 1563 | |
|---|
| 1564 | def _getBody( self, params ): |
|---|
| 1565 | wc = WConfRegistrationFormDisplay( self._conf, self._rh._getUser() ) |
|---|
| 1566 | pars = {"menuStatus":self._rh._getSession().getVar("menuStatus") or "open"} |
|---|
| 1567 | return wc.getHTML(pars) |
|---|
| 1568 | |
|---|
| 1569 | def _defineSectionMenu( self ): |
|---|
| 1570 | conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self) |
|---|
| 1571 | self._sectionMenu.setCurrentItem(self._newRegFormOpt) |
|---|
| 1572 | |
|---|
| 1573 | class WConfRegistrationFormDisplay(wcomponents.WTemplated): |
|---|
| 1574 | |
|---|
| 1575 | def __init__(self, conf, user): |
|---|
| 1576 | self._currentUser = user |
|---|
| 1577 | self._conf = conf |
|---|
| 1578 | |
|---|
| 1579 | def _getWComp(self, sect, pdFormValues): |
|---|
| 1580 | if sect == self._conf.getRegistrationForm().getReasonParticipationForm(): |
|---|
| 1581 | return WConfRegFormReasonParticipationDisplay(self._conf, self._currentUser) |
|---|
| 1582 | if sect == self._conf.getRegistrationForm().getSessionsForm(): |
|---|
| 1583 | if self._conf.getRegistrationForm().getSessionsForm().getType()=="all": |
|---|
| 1584 | return WConfRegFormSessionsAllDisplay(self._conf, self._currentUser) |
|---|
| 1585 | else: |
|---|
| 1586 | return WConfRegFormSessions2PrioritiesDisplay(self._conf, self._currentUser) |
|---|
| 1587 | if sect == self._conf.getRegistrationForm().getAccommodationForm(): |
|---|
| 1588 | return WConfRegFormAccommodationDisplay(self._conf, self._currentUser) |
|---|
| 1589 | if sect == self._conf.getRegistrationForm().getFurtherInformationForm(): |
|---|
| 1590 | return WConfRegFormFurtherInformationDisplay(self._conf) |
|---|
| 1591 | if sect == self._conf.getRegistrationForm().getSocialEventForm(): |
|---|
| 1592 | return WConfRegFormSocialEventDisplay(self._conf, self._currentUser) |
|---|
| 1593 | return WConfRegFormGeneralSectionDisplay(sect, self._currentUser, pdFormValues) |
|---|
| 1594 | |
|---|
| 1595 | def _getOtherSectionsHTML(self): |
|---|
| 1596 | regForm = self._conf.getRegistrationForm() |
|---|
| 1597 | personalDataNew = regForm.getPersonalDataNew() |
|---|
| 1598 | if self._currentUser is not None and self._currentUser.isRegisteredInConf(self._conf): |
|---|
| 1599 | pdFormValues = personalDataNew.getValuesFromRegistrant(self._currentUser.getRegistrantById(self._conf.getId())) |
|---|
| 1600 | else: |
|---|
| 1601 | pdFormValues = personalDataNew.getValuesFromAvatar(self._currentUser) |
|---|
| 1602 | |
|---|
| 1603 | html=[] |
|---|
| 1604 | for gs in regForm.getSortedForms(): |
|---|
| 1605 | wcomp=self._getWComp(gs, pdFormValues) |
|---|
| 1606 | if gs.isEnabled(): |
|---|
| 1607 | html.append( """ |
|---|
| 1608 | <tr> |
|---|
| 1609 | <td><br></td> |
|---|
| 1610 | </tr> |
|---|
| 1611 | <tr> |
|---|
| 1612 | <td align="left"> |
|---|
| 1613 | %s |
|---|
| 1614 | </td> |
|---|
| 1615 | </tr> |
|---|
| 1616 | """%wcomp.getHTML()) |
|---|
| 1617 | return "".join(html) |
|---|
| 1618 | |
|---|
| 1619 | def getVars(self): |
|---|
| 1620 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 1621 | regForm = self._conf.getRegistrationForm() |
|---|
| 1622 | vars["title"] = regForm.getTitle() |
|---|
| 1623 | vars["postURL"] = quoteattr(str(urlHandlers.UHConfRegistrationFormCreation.getURL(self._conf))) |
|---|
| 1624 | vars["otherSections"]=self._getOtherSectionsHTML() |
|---|
| 1625 | return vars |
|---|
| 1626 | |
|---|
| 1627 | class WConfRegistrationFormPreview( WConfRegistrationFormDisplay ): |
|---|
| 1628 | |
|---|
| 1629 | def getVars(self): |
|---|
| 1630 | vars = WConfRegistrationFormDisplay.getVars(self) |
|---|
| 1631 | return vars |
|---|
| 1632 | |
|---|
| 1633 | def getHTML(self): |
|---|
| 1634 | return WConfRegistrationFormDisplay.getHTML(self) |
|---|
| 1635 | |
|---|
| 1636 | class WConfRegFormGeneralSectionDisplay(wcomponents.WTemplated): |
|---|
| 1637 | |
|---|
| 1638 | def __init__(self, gs, currentUser, pdFormValues=None): |
|---|
| 1639 | self._generalSection = gs |
|---|
| 1640 | self._currentUser = currentUser |
|---|
| 1641 | self._pdFormValues = pdFormValues |
|---|
| 1642 | |
|---|
| 1643 | def _getFieldsHTML(self, miscGroup=None): |
|---|
| 1644 | html=[] |
|---|
| 1645 | registrant=None |
|---|
| 1646 | if self._currentUser is not None and self._currentUser.isRegisteredInConf(self._generalSection.getConference()): |
|---|
| 1647 | registrant = self._currentUser.getRegistrantById(self._generalSection.getConference().getId()) |
|---|
| 1648 | #jmf |
|---|
| 1649 | for f in self._generalSection.getSortedFields(): |
|---|
| 1650 | if f.isDisabled(): |
|---|
| 1651 | continue |
|---|
| 1652 | miscItem=None |
|---|
| 1653 | if miscGroup is not None and miscGroup.getResponseItemById(f.getId()) is not None: |
|---|
| 1654 | miscItem=miscGroup.getResponseItemById(f.getId()) |
|---|
| 1655 | default = "" |
|---|
| 1656 | if self._generalSection is self._generalSection.getRegistrationForm().getPersonalDataNew(): |
|---|
| 1657 | default = self._pdFormValues.get(f.getPDField(), "") |
|---|
| 1658 | html.append(""" |
|---|
| 1659 | <tr> |
|---|
| 1660 | <td> |
|---|
| 1661 | %s |
|---|
| 1662 | </td> |
|---|
| 1663 | </tr> |
|---|
| 1664 | """%(f.getInput().getModifHTML(miscItem, registrant, default)) ) |
|---|
| 1665 | return "".join(html) |
|---|
| 1666 | |
|---|
| 1667 | def getVars(self): |
|---|
| 1668 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 1669 | vars["title"] = self._generalSection.getTitle() |
|---|
| 1670 | vars["description"] = self._generalSection.getDescription() |
|---|
| 1671 | miscGroup=None |
|---|
| 1672 | if self._currentUser is not None and self._currentUser.isRegisteredInConf(self._generalSection.getConference()): |
|---|
| 1673 | registrant = self._currentUser.getRegistrantById(self._generalSection.getConference().getId()) |
|---|
| 1674 | miscGroup = registrant.getMiscellaneousGroupById(self._generalSection.getId()) |
|---|
| 1675 | vars["fields"]=self._getFieldsHTML(miscGroup) |
|---|
| 1676 | return vars |
|---|
| 1677 | |
|---|
| 1678 | |
|---|
| 1679 | class WConfRegFormPersonalDataDisplay(wcomponents.WTemplated): |
|---|
| 1680 | |
|---|
| 1681 | def __init__(self, conf, user): |
|---|
| 1682 | self._conf = conf |
|---|
| 1683 | self._currentUser = user |
|---|
| 1684 | |
|---|
| 1685 | def _getItemHTML(self, item, value): |
|---|
| 1686 | inputHTML = "" |
|---|
| 1687 | if item.getId() == "email": |
|---|
| 1688 | if self._currentUser is None or self._conf.canManageRegistration(self._currentUser): |
|---|
| 1689 | inputHTML = """<input type="text" id="%s" name="%s" value="%s" size="40">"""%(item.getId(), item.getId(), value) |
|---|
| 1690 | else: |
|---|
| 1691 | inputHTML = """<input type="hidden" name="%s" value="%s">%s"""%(item.getId(), value, value) |
|---|
| 1692 | elif item.getInput() == "hidden": |
|---|
| 1693 | inputHTML = """<input type="%s" name="%s" value="%s">%s"""%(item.getInput(), item.getId(), value, value) |
|---|
| 1694 | elif item.getInput() == "list": |
|---|
| 1695 | if item.getId() == "title": |
|---|
| 1696 | for title in TitlesRegistry().getList(): |
|---|
| 1697 | selected = "" |
|---|
| 1698 | if value == title: |
|---|
| 1699 | selected = "selected" |
|---|
| 1700 | inputHTML += """<option value="%s" %s>%s</option>"""%(title, selected, title) |
|---|
| 1701 | inputHTML = """<select id="%s" name="%s">%s</select>"""%(item.getId(), item.getId(), inputHTML) |
|---|
| 1702 | elif item.getId() == "country": |
|---|
| 1703 | inputHTML= i18nformat("""<option value="">-- _("Select a country") --</option>""") |
|---|
| 1704 | for ck in CountryHolder().getCountrySortedKeys(): |
|---|
| 1705 | selected = "" |
|---|
| 1706 | if value == ck: |
|---|
| 1707 | selected = "selected" |
|---|
| 1708 | inputHTML += """<option value="%s" %s>%s</option>"""%(ck, selected, CountryHolder().getCountryById(ck)) |
|---|
| 1709 | inputHTML = """<select id="%s" name="%s">%s</select>"""%(item.getId(), item.getId(), inputHTML) |
|---|
| 1710 | |
|---|
| 1711 | else: |
|---|
| 1712 | inputHTML = """<input type="%s" id="%s" name="%s" size="40" value="%s">"""%(item.getInput(), item.getId(), item.getId(), value) |
|---|
| 1713 | if item.isMandatory(): |
|---|
| 1714 | addParam = """<script>addParam($E('%s'), 'text', false);</script>""" % item.getId() |
|---|
| 1715 | else: |
|---|
| 1716 | addParam = '' |
|---|
| 1717 | inputHTML = "%s%s"%(inputHTML, addParam) |
|---|
| 1718 | mandatory=" " |
|---|
| 1719 | if item.isMandatory(): |
|---|
| 1720 | mandatory = """<font color="red">* </font>""" |
|---|
| 1721 | html = """ |
|---|
| 1722 | <tr> |
|---|
| 1723 | <td nowrap class="displayField">%s<b>%s</b></td> |
|---|
| 1724 | <td width="100%%" align="left">%s</td> |
|---|
| 1725 | </tr> |
|---|
| 1726 | """%(mandatory, _(item.getName()), inputHTML) |
|---|
| 1727 | return html |
|---|
| 1728 | |
|---|
| 1729 | def getVars(self): |
|---|
| 1730 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 1731 | personalData = self._conf.getRegistrationForm().getPersonalData() |
|---|
| 1732 | data = [] |
|---|
| 1733 | sortedKeys = personalData.getSortedKeys() |
|---|
| 1734 | if self._currentUser is not None and self._currentUser.isRegisteredInConf(self._conf): |
|---|
| 1735 | formValues = personalData.getValuesFromRegistrant(self._currentUser.getRegistrantById(self._conf.getId())) |
|---|
| 1736 | else: |
|---|
| 1737 | formValues = personalData.getValuesFromAvatar(self._currentUser) |
|---|
| 1738 | for key in sortedKeys: |
|---|
| 1739 | item = personalData.getDataItem(key) |
|---|
| 1740 | if item.isEnabled(): |
|---|
| 1741 | data.append(self._getItemHTML(item, formValues.get(item.getId(), ""))) |
|---|
| 1742 | vars["data"] = "".join(data) |
|---|
| 1743 | return vars |
|---|
| 1744 | |
|---|
| 1745 | |
|---|
| 1746 | class WConfRegFormReasonParticipationDisplay(wcomponents.WTemplated): |
|---|
| 1747 | |
|---|
| 1748 | def __init__(self, conf, currentUser): |
|---|
| 1749 | self._conf = conf |
|---|
| 1750 | self._currentUser = currentUser |
|---|
| 1751 | |
|---|
| 1752 | def getVars(self): |
|---|
| 1753 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 1754 | regForm = self._conf.getRegistrationForm() |
|---|
| 1755 | rp = regForm.getReasonParticipationForm() |
|---|
| 1756 | vars["title"] = rp.getTitle() |
|---|
| 1757 | vars["description"] = rp.getDescription() |
|---|
| 1758 | vars["reasonParticipation"] = "" |
|---|
| 1759 | if self._currentUser is not None and self._currentUser.isRegisteredInConf(self._conf): |
|---|
| 1760 | vars["reasonParticipation"] = self._currentUser.getRegistrantById(self._conf.getId()).getReasonParticipation() |
|---|
| 1761 | return vars |
|---|
| 1762 | |
|---|
| 1763 | class WConfRegFormSessionsBase(wcomponents.WTemplated): |
|---|
| 1764 | |
|---|
| 1765 | def __init__(self, conf, currentUser): |
|---|
| 1766 | self._conf = conf |
|---|
| 1767 | self._currentUser = currentUser |
|---|
| 1768 | self._sessionForm = self._conf.getRegistrationForm().getSessionsForm() |
|---|
| 1769 | self._regSessions = [] |
|---|
| 1770 | if self._currentUser is not None and self._currentUser.isRegisteredInConf(self._conf): |
|---|
| 1771 | self._regSessions = [ses.getRegSession() for ses in self._currentUser.getRegistrantById(self._conf.getId()).getSessionList()] |
|---|
| 1772 | |
|---|
| 1773 | def getVars(self): |
|---|
| 1774 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 1775 | vars["title"] = self._sessionForm.getTitle() |
|---|
| 1776 | vars["description"] = self._sessionForm.getDescription() |
|---|
| 1777 | return vars |
|---|
| 1778 | |
|---|
| 1779 | class WConfRegFormSessionsDisplay(WConfRegFormSessionsBase): |
|---|
| 1780 | |
|---|
| 1781 | def _getSessionsHTML(self, sessions): |
|---|
| 1782 | if sessions.getSessionList() == []: |
|---|
| 1783 | html = i18nformat("""--_("None selected")--""") |
|---|
| 1784 | else: |
|---|
| 1785 | html = [] |
|---|
| 1786 | for ses in sessions.getSessionList(True): |
|---|
| 1787 | selected = "" |
|---|
| 1788 | if ses in self._regSessions: |
|---|
| 1789 | selected = "selected" |
|---|
| 1790 | price = "" |
|---|
| 1791 | if ses.isBillable() and sessions.getType() != "2priorities": |
|---|
| 1792 | price = " [%s %s]" % (ses.getPrice(), self._conf.getRegistrationForm().getCurrency()) |
|---|
| 1793 | html.append(""" |
|---|
| 1794 | <input type="checkbox" name="sessionIds" value="%s" %s>%s%s |
|---|
| 1795 | """%(ses.getId(), selected, ses.getTitle(), price) ) |
|---|
| 1796 | html = "<br>".join(html) |
|---|
| 1797 | return html |
|---|
| 1798 | |
|---|
| 1799 | def getVars(self): |
|---|
| 1800 | vars = WConfRegFormSessionsBase.getVars( self ) |
|---|
| 1801 | vars ["sessions"] = self._getSessionsHTML(self._sessionForm) |
|---|
| 1802 | return vars |
|---|
| 1803 | |
|---|
| 1804 | class WConfRegFormSessions2PrioritiesDisplay(WConfRegFormSessionsBase): |
|---|
| 1805 | |
|---|
| 1806 | def _getSessionsHTML(self, sessions, selectName, sessionValue, mandatory=False): |
|---|
| 1807 | selected = "" |
|---|
| 1808 | if sessionValue is None: |
|---|
| 1809 | selected = "selected" |
|---|
| 1810 | if mandatory: |
|---|
| 1811 | addParam = """<script>addParam($E('%s'), 'text', false, function(value) { |
|---|
| 1812 | if (value === "nosession") { |
|---|
| 1813 | return Html.span({}, "Please choose an option"); |
|---|
| 1814 | }else { |
|---|
| 1815 | return null; |
|---|
| 1816 | } |
|---|
| 1817 | });</script>""" % selectName |
|---|
| 1818 | else: |
|---|
| 1819 | addParam = '' |
|---|
| 1820 | html = [ i18nformat("""<select id="%s" name="%s"> |
|---|
| 1821 | <option value="nosession" %s>--_("Select a session")--</option>""")%(selectName, selectName, selected)] |
|---|
| 1822 | for ses in sessions.getSessionList(True): |
|---|
| 1823 | selected = "" |
|---|
| 1824 | if ses == sessionValue: |
|---|
| 1825 | selected = "selected" |
|---|
| 1826 | html.append(""" |
|---|
| 1827 | <option value="%s" %s>%s</option> |
|---|
| 1828 | """%(ses.getId(), selected, ses.getTitle()) ) |
|---|
| 1829 | html = """%s</select>%s"""%("".join(html), addParam) |
|---|
| 1830 | return html |
|---|
| 1831 | |
|---|
| 1832 | def getVars(self): |
|---|
| 1833 | vars = WConfRegFormSessionsBase.getVars( self ) |
|---|
| 1834 | ses1 = None |
|---|
| 1835 | if len(self._regSessions)>0: |
|---|
| 1836 | ses1 = self._regSessions[0] |
|---|
| 1837 | vars ["sessions1"] = self._getSessionsHTML(self._sessionForm, "session1", ses1, True) |
|---|
| 1838 | ses2 = None |
|---|
| 1839 | if len(self._regSessions)>1: |
|---|
| 1840 | ses2 = self._regSessions[1] |
|---|
| 1841 | vars["sessions2"] = self._getSessionsHTML(self._sessionForm, "session2", ses2) |
|---|
| 1842 | return vars |
|---|
| 1843 | |
|---|
| 1844 | |
|---|
| 1845 | def cmpSessionByStartDateThenTitle(x, y): |
|---|
| 1846 | if cmp(x.getStartDate(),y.getStartDate()): |
|---|
| 1847 | return cmp(x.getStartDate(),y.getStartDate()) |
|---|
| 1848 | else: |
|---|
| 1849 | return cmp(x.getTitle(),y.getTitle()) |
|---|
| 1850 | |
|---|
| 1851 | class WConfRegFormSessionsAllDisplay(WConfRegFormSessionsBase): |
|---|
| 1852 | |
|---|
| 1853 | def _getSessionsHTML(self, alreadyPaid): |
|---|
| 1854 | html=[] |
|---|
| 1855 | sessionList = self._sessionForm.getSessionList() |
|---|
| 1856 | sessionList.sort(cmpSessionByStartDateThenTitle) |
|---|
| 1857 | for session in sessionList : |
|---|
| 1858 | selected="" |
|---|
| 1859 | if session in self._regSessions: |
|---|
| 1860 | selected=" checked" |
|---|
| 1861 | disabled = "" |
|---|
| 1862 | if alreadyPaid and session.isBillable(): |
|---|
| 1863 | disabled = " disabled" |
|---|
| 1864 | price = "" |
|---|
| 1865 | if session.isBillable(): |
|---|
| 1866 | price = " [%s %s]" % (session.getPrice(), self._conf.getRegistrationForm().getCurrency()) |
|---|
| 1867 | html.append("""<input type="checkbox" name="sessions" value="%s"%s%s>%s%s"""%(session.getId(), selected, disabled, session.getTitle(), price) ) |
|---|
| 1868 | return "<br>".join(html) |
|---|
| 1869 | |
|---|
| 1870 | def getVars(self): |
|---|
| 1871 | vars = WConfRegFormSessionsBase.getVars( self ) |
|---|
| 1872 | alreadyPaid = False |
|---|
| 1873 | if self._currentUser is not None and self._currentUser.isRegisteredInConf(self._conf): |
|---|
| 1874 | registrant = self._currentUser.getRegistrantById(self._conf.getId()) |
|---|
| 1875 | alreadyPaid = registrant.getPayed() |
|---|
| 1876 | vars ["sessions"] = self._getSessionsHTML(alreadyPaid) |
|---|
| 1877 | return vars |
|---|
| 1878 | |
|---|
| 1879 | class WConfRegFormAccommodationDisplay(wcomponents.WTemplated): |
|---|
| 1880 | |
|---|
| 1881 | def __init__(self, conf, currentUser): |
|---|
| 1882 | self._conf = conf |
|---|
| 1883 | self._accommodation = self._conf.getRegistrationForm().getAccommodationForm() |
|---|
| 1884 | self._currentUser = currentUser |
|---|
| 1885 | |
|---|
| 1886 | def _getDatesHTML(self, name, currentDate, startDate=None, endDate=None, alreadyPaid=False): |
|---|
| 1887 | if name=="arrivalDate": |
|---|
| 1888 | dates = self._accommodation.getArrivalDates() |
|---|
| 1889 | elif name=="departureDate": |
|---|
| 1890 | dates = self._accommodation.getDepartureDates() |
|---|
| 1891 | else: |
|---|
| 1892 | dates = [] |
|---|
| 1893 | curDate = startDate = self._conf.getStartDate() - timedelta(days=1) |
|---|
| 1894 | endDate = self._conf.getEndDate() + timedelta(days=1) |
|---|
| 1895 | while curDate <= endDate: |
|---|
| 1896 | dates.append(curDate) |
|---|
| 1897 | curDate += timedelta(days=1) |
|---|
| 1898 | selected = "" |
|---|
| 1899 | if currentDate is None: |
|---|
| 1900 | selected = "selected" |
|---|
| 1901 | disabled = "" |
|---|
| 1902 | if alreadyPaid: |
|---|
| 1903 | disabled = " disabled" |
|---|
| 1904 | html = [ i18nformat(""" |
|---|
| 1905 | <select id="%s" name="%s"%s> |
|---|
| 1906 | <option value="nodate" %s>--_("select a date")--</option> |
|---|
| 1907 | """)%(name, name, disabled, selected)] |
|---|
| 1908 | for date in dates: |
|---|
| 1909 | selected = "" |
|---|
| 1910 | if currentDate is not None and currentDate.strftime("%d-%B-%Y") == date.strftime("%d-%B-%Y"): |
|---|
| 1911 | selected = "selected" |
|---|
| 1912 | html.append(""" |
|---|
| 1913 | <option value=%s %s>%s</option> |
|---|
| 1914 | """%(quoteattr(str(date.strftime("%d-%m-%Y"))), selected, date.strftime("%d-%B-%Y"))) |
|---|
| 1915 | |
|---|
| 1916 | addParam = """<script>addParam($E('%s'), 'text', false, function(value) { |
|---|
| 1917 | if (value === "nodate") { |
|---|
| 1918 | return Html.span({}, "Please choose an option"); |
|---|
| 1919 | }else { |
|---|
| 1920 | return null; |
|---|
| 1921 | } |
|---|
| 1922 | });</script>""" % name |
|---|
| 1923 | html.append("</select>%s"%addParam) |
|---|
| 1924 | return "".join(html) |
|---|
| 1925 | |
|---|
| 1926 | def _getAccommodationTypesHTML(self, currentAccoType, alreadyPaid): |
|---|
| 1927 | html=[] |
|---|
| 1928 | for atype in self._accommodation.getAccommodationTypesList(): |
|---|
| 1929 | if not atype.isCancelled(): |
|---|
| 1930 | if atype.getPlacesLimit() <= 0 or atype.hasAvailablePlaces(): |
|---|
| 1931 | selected = "" |
|---|
| 1932 | if currentAccoType == atype: |
|---|
| 1933 | selected = "checked=\"checked\"" |
|---|
| 1934 | disabled = "" |
|---|
| 1935 | if alreadyPaid and (atype.isBillable() or (currentAccoType and currentAccoType.isBillable())): |
|---|
| 1936 | disabled = ' disabled="disabled"' |
|---|
| 1937 | placesLeft = "" |
|---|
| 1938 | if atype.getNoPlacesLeft() > 0: |
|---|
| 1939 | placesLeft = " <span style='color:green; font-style:italic;'>[%s place(s) left]</span>"%atype.getNoPlacesLeft() |
|---|
| 1940 | priceCol = "" |
|---|
| 1941 | if atype.isBillable(): |
|---|
| 1942 | priceCol = """<td align="right">%s %s per night</td>""" % (atype.getPrice(), self._conf.getRegistrationForm().getCurrency()) |
|---|
| 1943 | |
|---|
| 1944 | html.append("""<tr> |
|---|
| 1945 | <td align="left" style="padding-left:10px"><input type="radio" id="accommodationType" name="accommodationType" value="%s" %s%s>%s%s</td> |
|---|
| 1946 | %s |
|---|
| 1947 | </tr> |
|---|
| 1948 | """%(atype.getId(), selected, disabled, atype.getCaption(), placesLeft, priceCol ) ) |
|---|
| 1949 | else: |
|---|
| 1950 | html.append("""<tr> |
|---|
| 1951 | <td align="left" style="padding-left:10px"> <b>-</b> %s <font color="red">\ |
|---|
| 1952 | (no places left)</font></td> |
|---|
| 1953 | </tr> |
|---|
| 1954 | """%(atype.getCaption() ) ) |
|---|
| 1955 | else: |
|---|
| 1956 | html.append( i18nformat("""<tr> |
|---|
| 1957 | <td align="left" style="padding-left:10px"> <b>-</b> %s <font color="red">( _("not available at present") )</font></td> |
|---|
| 1958 | </tr> |
|---|
| 1959 | """)%(atype.getCaption() ) ) |
|---|
| 1960 | |
|---|
| 1961 | html.append("""<script>addParam($E('accommodationType'), 'radio', false);</script>""") |
|---|
| 1962 | if currentAccoType is not None and currentAccoType.isCancelled() and currentAccoType not in self._accommodation.getAccommodationTypesList(): |
|---|
| 1963 | html.append( i18nformat("""<tr> |
|---|
| 1964 | <td align="left" style="padding-left:10px"> <b>-</b> %s <font color="red">( _("not available at present") )</font></td> |
|---|
| 1965 | </tr> |
|---|
| 1966 | """)%(currentAccoType.getCaption() ) ) |
|---|
| 1967 | return "".join(html) |
|---|
| 1968 | |
|---|
| 1969 | |
|---|
| 1970 | def getVars(self): |
|---|
| 1971 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 1972 | currentArrivalDate = None |
|---|
| 1973 | currentDepartureDate = None |
|---|
| 1974 | currentAccoType = None |
|---|
| 1975 | alreadyPaid = False |
|---|
| 1976 | alreadyPaidAcco = False |
|---|
| 1977 | if self._currentUser is not None and self._currentUser.isRegisteredInConf(self._conf): |
|---|
| 1978 | registrant = self._currentUser.getRegistrantById(self._conf.getId()) |
|---|
| 1979 | acco = registrant.getAccommodation() |
|---|
| 1980 | currentArrivalDate = None |
|---|
| 1981 | currentDepartureDate = None |
|---|
| 1982 | currentAccoType = None |
|---|
| 1983 | alreadyPaid = registrant.getPayed() |
|---|
| 1984 | if acco is not None: |
|---|
| 1985 | currentArrivalDate = acco.getArrivalDate() |
|---|
| 1986 | currentDepartureDate = acco.getDepartureDate() |
|---|
| 1987 | currentAccoType = acco.getAccommodationType() |
|---|
| 1988 | alreadyPaidAcco = alreadyPaid and acco.isBillable() |
|---|
| 1989 | vars["title"] = self._accommodation.getTitle() |
|---|
| 1990 | vars["description"] = self._accommodation.getDescription() |
|---|
| 1991 | vars["arrivalDate"] = self._getDatesHTML("arrivalDate", currentArrivalDate, alreadyPaid=alreadyPaidAcco) |
|---|
| 1992 | vars["departureDate"] = self._getDatesHTML("departureDate", currentDepartureDate, alreadyPaid=alreadyPaidAcco) |
|---|
| 1993 | vars["accommodationTypes"] = self._getAccommodationTypesHTML(currentAccoType, alreadyPaid) |
|---|
| 1994 | return vars |
|---|
| 1995 | |
|---|
| 1996 | class WConfRegFormSocialEventDisplay(wcomponents.WTemplated): |
|---|
| 1997 | |
|---|
| 1998 | def __init__(self, conf, currentUser): |
|---|
| 1999 | self._conf = conf |
|---|
| 2000 | self._socialEvent = self._conf.getRegistrationForm().getSocialEventForm() |
|---|
| 2001 | self._currentUser = currentUser |
|---|
| 2002 | |
|---|
| 2003 | def _getSocialEventsHTML(self, socialEvents=[], alreadyPaid=False): |
|---|
| 2004 | html=[] |
|---|
| 2005 | for se in self._socialEvent.getSocialEventList(True): |
|---|
| 2006 | if not se.isCancelled(): |
|---|
| 2007 | checked = "" |
|---|
| 2008 | for ser in socialEvents: |
|---|
| 2009 | if se == ser.getSocialEventItem(): |
|---|
| 2010 | se = ser |
|---|
| 2011 | checked = "checked=\"checked\"" |
|---|
| 2012 | break |
|---|
| 2013 | disabled = "" |
|---|
| 2014 | if se.isBillable() and alreadyPaid: |
|---|
| 2015 | disabled = ' disabled="disabled"' |
|---|
| 2016 | optList = [] |
|---|
| 2017 | for i in range(1, se.getMaxPlacePerRegistrant()+1): |
|---|
| 2018 | selected = "" |
|---|
| 2019 | if isinstance(se, registration.SocialEvent) and i == se.getNoPlaces(): |
|---|
| 2020 | selected = " selected" |
|---|
| 2021 | optList.append("""<option value="%s"%s%s>%s"""%(i, selected, disabled, i)) |
|---|
| 2022 | if len(optList)>0: |
|---|
| 2023 | optList.insert(0, """<select name="places-%s"%s>"""%(se.getId(), disabled)) |
|---|
| 2024 | optList.append("</select>") |
|---|
| 2025 | seItem=se |
|---|
| 2026 | if isinstance(se, registration.SocialEvent): |
|---|
| 2027 | seItem = se.getSocialEventItem() |
|---|
| 2028 | placesLeft = "" |
|---|
| 2029 | if seItem.getPlacesLimit() > 0: |
|---|
| 2030 | placesLeft = "<span style='color:green; font-style:italic;'>[%s place(s) left]</span>"%seItem.getNoPlacesLeft() |
|---|
| 2031 | priceCol = "" |
|---|
| 2032 | if seItem.isBillable(): |
|---|
| 2033 | perPlace = "" |
|---|
| 2034 | if seItem.isPricePerPlace(): |
|---|
| 2035 | perPlace = ' <acronym title="" onmouseover="IndicoUI.Widgets.Generic.tooltip(this, event, \'per place\')">pp</acronym>' |
|---|
| 2036 | priceCol = """<td align="right" nowrap>%s %s%s</td>""" % (seItem.getPrice(), self._conf.getRegistrationForm().getCurrency(), perPlace) |
|---|
| 2037 | |
|---|
| 2038 | inputType="checkbox" |
|---|
| 2039 | if self._socialEvent.getSelectionTypeId() == "unique": |
|---|
| 2040 | inputType="radio" |
|---|
| 2041 | html.append("""<tr> |
|---|
| 2042 | <td align="left" style="padding-left:10px"><input type="%s" name="socialEvents" value="%s" %s%s>%s </td> |
|---|
| 2043 | <td align="left" nowrap> |
|---|
| 2044 | %s%s |
|---|
| 2045 | </td> |
|---|
| 2046 | %s |
|---|
| 2047 | </tr> |
|---|
| 2048 | """%(inputType, se.getId(), checked, disabled, se.getCaption(), "".join(optList), placesLeft, priceCol ) ) |
|---|
| 2049 | else: |
|---|
| 2050 | cancelledReason = "" |
|---|
| 2051 | if se.getCancelledReason().strip(): |
|---|
| 2052 | cancelledReason = "(%s)"%se.getCancelledReason().strip() |
|---|
| 2053 | html.append("""<tr> |
|---|
| 2054 | <td align="left" colspan="4" nowrap style="padding-left:10px"> <b>-</b> %s <font color="red">%s</font></td> |
|---|
| 2055 | </tr> |
|---|
| 2056 | """%(se.getCaption(), cancelledReason ) ) |
|---|
| 2057 | for se in socialEvents: |
|---|
| 2058 | if se.isCancelled and se.getSocialEventItem() not in self._socialEvent.getSocialEventList(): |
|---|
| 2059 | cancelledReason = "" |
|---|
| 2060 | if se.getCancelledReason().strip(): |
|---|
| 2061 | cancelledReason = "(%s)"%se.getCancelledReason().strip() |
|---|
| 2062 | html.append("""<tr> |
|---|
| 2063 | <td align="left" colspan="4" nowrap style="padding-left:10px"> <b>-</b> %s <font color="red">%s</font></td> |
|---|
| 2064 | </tr> |
|---|
| 2065 | """%(se.getCaption(), cancelledReason ) ) |
|---|
| 2066 | return "".join(html) |
|---|
| 2067 | |
|---|
| 2068 | |
|---|
| 2069 | def getVars(self): |
|---|
| 2070 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 2071 | socialEvents = [] |
|---|
| 2072 | alreadyPaid = False |
|---|
| 2073 | if self._currentUser is not None and self._currentUser.isRegisteredInConf(self._conf): |
|---|
| 2074 | registrant = self._currentUser.getRegistrantById(self._conf.getId()) |
|---|
| 2075 | socialEvents = registrant.getSocialEvents() |
|---|
| 2076 | alreadyPaid = registrant.getPayed() |
|---|
| 2077 | vars["title"] = self._socialEvent.getTitle() |
|---|
| 2078 | vars["description"] = self._socialEvent.getDescription() |
|---|
| 2079 | vars["intro"] = self._socialEvent.getIntroSentence() |
|---|
| 2080 | vars["socialEvents"] = self._getSocialEventsHTML(socialEvents, alreadyPaid) |
|---|
| 2081 | return vars |
|---|
| 2082 | |
|---|
| 2083 | class WConfRegFormFurtherInformationDisplay(wcomponents.WTemplated): |
|---|
| 2084 | |
|---|
| 2085 | def __init__(self, conf): |
|---|
| 2086 | self._conf = conf |
|---|
| 2087 | |
|---|
| 2088 | def getVars(self): |
|---|
| 2089 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 2090 | fi = self._conf.getRegistrationForm().getFurtherInformationForm() |
|---|
| 2091 | vars["title"] = fi.getTitle() |
|---|
| 2092 | vars["content"] = fi.getContent() |
|---|
| 2093 | return vars |
|---|
| 2094 | |
|---|
| 2095 | class WPRegFormInactive( conferences.WPConferenceDefaultDisplayBase ): |
|---|
| 2096 | |
|---|
| 2097 | def _getBody( self, params ): |
|---|
| 2098 | wc = WConfRegFormDeactivated() |
|---|
| 2099 | return wc.getHTML() |
|---|
| 2100 | |
|---|
| 2101 | def _defineSectionMenu( self ): |
|---|
| 2102 | conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self) |
|---|
| 2103 | self._sectionMenu.setCurrentItem(self._regFormOpt) |
|---|
| 2104 | |
|---|
| 2105 | class WConfRegFormDeactivated(wcomponents.WTemplated): |
|---|
| 2106 | pass |
|---|
| 2107 | |
|---|
| 2108 | class WPRegistrationFormAlreadyRegistered( conferences.WPConferenceDefaultDisplayBase ): |
|---|
| 2109 | navigationEntry = navigation.NERegistrationFormDisplay |
|---|
| 2110 | |
|---|
| 2111 | def _getBody( self, params ): |
|---|
| 2112 | wc = WConfRegistrationFormAlreadyRegistered( self._conf ) |
|---|
| 2113 | return wc.getHTML() |
|---|
| 2114 | |
|---|
| 2115 | def _defineSectionMenu( self ): |
|---|
| 2116 | conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self) |
|---|
| 2117 | self._sectionMenu.setCurrentItem(self._regFormOpt) |
|---|
| 2118 | |
|---|
| 2119 | class WConfRegistrationFormAlreadyRegistered(wcomponents.WTemplated): |
|---|
| 2120 | |
|---|
| 2121 | def __init__(self, conf): |
|---|
| 2122 | self._conf = conf |
|---|
| 2123 | |
|---|
| 2124 | class WPRegistrationFormCreationDone( conferences.WPConferenceDefaultDisplayBase ): |
|---|
| 2125 | navigationEntry = navigation.NERegistrationFormDisplay |
|---|
| 2126 | |
|---|
| 2127 | def __init__(self, rh, conf, reg): |
|---|
| 2128 | conferences.WPConferenceDefaultDisplayBase.__init__(self, rh, conf) |
|---|
| 2129 | self._registrant=reg |
|---|
| 2130 | |
|---|
| 2131 | def _getBody( self, params ): |
|---|
| 2132 | wc = WConfRegistrationFormCreationDone( self._registrant ) |
|---|
| 2133 | return wc.getHTML() |
|---|
| 2134 | |
|---|
| 2135 | def _defineSectionMenu( self ): |
|---|
| 2136 | conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self) |
|---|
| 2137 | self._sectionMenu.setCurrentItem(self._regFormOpt) |
|---|
| 2138 | |
|---|
| 2139 | |
|---|
| 2140 | |
|---|
| 2141 | class WConfRegistrationFormCreationDone(wcomponents.WTemplated): |
|---|
| 2142 | |
|---|
| 2143 | def __init__( self, registrant ): |
|---|
| 2144 | self._registrant = registrant |
|---|
| 2145 | self._conf = self._registrant.getConference() |
|---|
| 2146 | |
|---|
| 2147 | def _getSessionsHTML(self): |
|---|
| 2148 | regForm = self._conf.getRegistrationForm() |
|---|
| 2149 | sessions = self._registrant.getSessionList() |
|---|
| 2150 | if regForm.getSessionsForm().isEnabled(): |
|---|
| 2151 | if regForm.getSessionsForm().getType() == "2priorities": |
|---|
| 2152 | session1 = i18nformat("""<font color=\"red\">--_("not selected")--</font>""") |
|---|
| 2153 | session2 = "-- not selected --" |
|---|
| 2154 | if len(sessions) > 0: |
|---|
| 2155 | session1 = sessions[0].getTitle() |
|---|
| 2156 | if sessions[0].isCancelled(): |
|---|
| 2157 | session1 = i18nformat("""%s <font color=\"red\">( _("cancelled") )""")%session1 |
|---|
| 2158 | if len(sessions) > 1: |
|---|
| 2159 | session2 = sessions[1].getTitle() |
|---|
| 2160 | if sessions[1].isCancelled(): |
|---|
| 2161 | session2 = i18nformat("""%s <font color=\"red\">( _("cancelled") )""")%session2 |
|---|
| 2162 | text= i18nformat(""" |
|---|
| 2163 | <table> |
|---|
| 2164 | <tr> |
|---|
| 2165 | <td align="right"><b> _("First Priority"):</b></td> |
|---|
| 2166 | <td align="left">%s</td> |
|---|
| 2167 | </tr> |
|---|
| 2168 | <tr> |
|---|
| 2169 | <td align="right"><b> _("Other option"):</b></td> |
|---|
| 2170 | <td align="left">%s</td> |
|---|
| 2171 | </tr> |
|---|
| 2172 | </table> |
|---|
| 2173 | """)%(session1, session2) |
|---|
| 2174 | return _(""" |
|---|
| 2175 | <tr> |
|---|
| 2176 | <td style="color:black"><b>%s</b></td> |
|---|
| 2177 | <td bgcolor="white" class="blacktext">%s</td> |
|---|
| 2178 | </tr> |
|---|
| 2179 | <tr> |
|---|
| 2180 | <td colspan="4" style="border-top:2px solid black"> </td> |
|---|
| 2181 | </tr> |
|---|
| 2182 | """)%(regForm.getSessionsForm().getTitle(),text) |
|---|
| 2183 | if regForm.getSessionsForm().getType() == "all": |
|---|
| 2184 | sessionList = i18nformat("""<font color=\"red\">--_("not selected")--</font>""") |
|---|
| 2185 | if len(sessions) > 0: |
|---|
| 2186 | sessionList=["<ul>"] |
|---|
| 2187 | for ses in sessions: |
|---|
| 2188 | sesText = "<li>%s</li>"%ses.getTitle() |
|---|
| 2189 | if ses.isCancelled(): |
|---|
| 2190 | sesText = i18nformat("""<li>%s <font color=\"red\">( _("cancelled") )</font></li>""")%ses.getTitle() |
|---|
| 2191 | sessionList.append(sesText) |
|---|
| 2192 | sessionList.append("</ul>") |
|---|
| 2193 | sessionList="".join(sessionList) |
|---|
| 2194 | text= """ |
|---|
| 2195 | <table> |
|---|
| 2196 | <tr> |
|---|
| 2197 | <td align="left">%s</td> |
|---|
| 2198 | </tr> |
|---|
| 2199 | </table> |
|---|
| 2200 | """%(sessionList) |
|---|
| 2201 | return _(""" |
|---|
| 2202 | <tr> |
|---|
| 2203 | <td style="color:black"><b>%s</b></td> |
|---|
| 2204 | <td bgcolor="white" class="blacktext">%s</td> |
|---|
| 2205 | </tr> |
|---|
| 2206 | <tr> |
|---|
| 2207 | <td colspan="4" style="border-top:2px solid black"> </td> |
|---|
| 2208 | </tr> |
|---|
| 2209 | """)%(regForm.getSessionsForm().getTitle(), text) |
|---|
| 2210 | return "" |
|---|
| 2211 | |
|---|
| 2212 | def _getAccommodationHTML(self): |
|---|
| 2213 | regForm = self._conf.getRegistrationForm() |
|---|
| 2214 | if regForm.getAccommodationForm().isEnabled(): |
|---|
| 2215 | accommodation = self._registrant.getAccommodation() |
|---|
| 2216 | accoType = i18nformat("""<font color=\"red\">--_("not selected")--</font>""") |
|---|
| 2217 | cancelled = "" |
|---|
| 2218 | if accommodation is not None and accommodation.getAccommodationType() is not None: |
|---|
| 2219 | accoType = accommodation.getAccommodationType().getCaption() |
|---|
| 2220 | if accommodation.getAccommodationType().isCancelled(): |
|---|
| 2221 | cancelled = """<font color=\"red\">( """+_("disabled")+""" )</font>""" |
|---|
| 2222 | arrivalDate = """<font color=\"red\">--""" + _("not selected") + """--</font>""" |
|---|
| 2223 | if accommodation is not None and accommodation.getArrivalDate() is not None: |
|---|
| 2224 | arrivalDate = accommodation.getArrivalDate().strftime("%d-%B-%Y") |
|---|
| 2225 | departureDate = """<font color=\"red\">--""" + _("not selected") + """--</font>""" |
|---|
| 2226 | if accommodation is not None and accommodation.getDepartureDate() is not None: |
|---|
| 2227 | departureDate = accommodation.getDepartureDate().strftime("%d-%B-%Y") |
|---|
| 2228 | accoTypeHTML = "" |
|---|
| 2229 | if regForm.getAccommodationForm().getAccommodationTypesList() !=[]: |
|---|
| 2230 | accoTypeHTML = """ |
|---|
| 2231 | <tr> |
|---|
| 2232 | <td align="right"><b>Accommodation type:</b></td> |
|---|
| 2233 | <td align="left">%s %s</td> |
|---|
| 2234 | </tr>"""%(accoType, cancelled) |
|---|
| 2235 | |
|---|
| 2236 | text = i18nformat(""" |
|---|
| 2237 | <table> |
|---|
| 2238 | <tr> |
|---|
| 2239 | <td align="right"><b> _("Arrival date"):</b></td> |
|---|
| 2240 | <td align="left">%s</td> |
|---|
| 2241 | </tr> |
|---|
| 2242 | <tr> |
|---|
| 2243 | <td align="right"><b> _("Departure date"):</b></td> |
|---|
| 2244 | <td align="left">%s</td> |
|---|
| 2245 | </tr> |
|---|
| 2246 | %s |
|---|
| 2247 | </table> |
|---|
| 2248 | """)%(arrivalDate, departureDate, accoTypeHTML) |
|---|
| 2249 | return i18nformat(""" |
|---|
| 2250 | <tr> |
|---|
| 2251 | <td style="color:black"><b> _("Accommodation")</b></td> |
|---|
| 2252 | <td bgcolor="white" class="blacktext">%s</td> |
|---|
| 2253 | </tr> |
|---|
| 2254 | <tr> |
|---|
| 2255 | <td colspan="4" style="border-top:2px solid black"> </td> |
|---|
| 2256 | </tr> |
|---|
| 2257 | """)%(text) |
|---|
| 2258 | return "" |
|---|
| 2259 | |
|---|
| 2260 | def _getSocialEventsHTML(self): |
|---|
| 2261 | regForm = self._conf.getRegistrationForm() |
|---|
| 2262 | text = "" |
|---|
| 2263 | if regForm.getSocialEventForm().isEnabled(): |
|---|
| 2264 | socialEvents = self._registrant.getSocialEvents() |
|---|
| 2265 | r = [] |
|---|
| 2266 | for se in socialEvents: |
|---|
| 2267 | cancelled = "" |
|---|
| 2268 | if se.isCancelled(): |
|---|
| 2269 | cancelled = i18nformat("""<font color=\"red\">( _("cancelled") )</font>""") |
|---|
| 2270 | if se.getCancelledReason().strip(): |
|---|
| 2271 | cancelled = i18nformat("""<font color=\"red\">( _("cancelled"): %s)</font>""")%se.getCancelledReason().strip() |
|---|
| 2272 | r.append( i18nformat(""" |
|---|
| 2273 | <tr> |
|---|
| 2274 | <td align="left">%s <b>[%s _("place(s) needed")]</b> %s</td> |
|---|
| 2275 | </tr> |
|---|
| 2276 | """)%(se.getCaption(), se.getNoPlaces(), cancelled)) |
|---|
| 2277 | if r == []: |
|---|
| 2278 | text = i18nformat("""-- _("no social events selected") --""") |
|---|
| 2279 | else: |
|---|
| 2280 | text = """ |
|---|
| 2281 | <table> |
|---|
| 2282 | %s |
|---|
| 2283 | </table> |
|---|
| 2284 | """%("".join(r)) |
|---|
| 2285 | text = _(""" |
|---|
| 2286 | <tr> |
|---|
| 2287 | <td style="color:black"><b>%s</b></td> |
|---|
| 2288 | <td bgcolor="white" class="blacktext">%s</td> |
|---|
| 2289 | </tr> |
|---|
| 2290 | <tr> |
|---|
| 2291 | <td colspan="4" style="border-top:2px solid black"> </td> |
|---|
| 2292 | </tr> |
|---|
| 2293 | """)%(regForm.getSocialEventForm().getTitle(), text) |
|---|
| 2294 | return text |
|---|
| 2295 | |
|---|
| 2296 | def _getReasonParticipationHTML(self): |
|---|
| 2297 | regForm = self._conf.getRegistrationForm() |
|---|
| 2298 | if regForm.getReasonParticipationForm().isEnabled(): |
|---|
| 2299 | return i18nformat(""" |
|---|
| 2300 | <tr> |
|---|
| 2301 | <td style="color:black"><b> _("Reason for participation")</b></td> |
|---|
| 2302 | <td bgcolor="white" class="blacktext">%s</td> |
|---|
| 2303 | </tr> |
|---|
| 2304 | <tr> |
|---|
| 2305 | <td colspan="4" style="border-top:2px solid black"> </td> |
|---|
| 2306 | </tr> |
|---|
| 2307 | """)%(self.htmlText( self._registrant.getReasonParticipation() )) |
|---|
| 2308 | return "" |
|---|
| 2309 | |
|---|
| 2310 | def _formatValue(self, fieldInput, value): |
|---|
| 2311 | try: |
|---|
| 2312 | return str(fieldInput.getValueDisplay(value)) |
|---|
| 2313 | except: |
|---|
| 2314 | return str(value).strip() |
|---|
| 2315 | |
|---|
| 2316 | def _getMiscInfoItemsHTML(self, gsf): |
|---|
| 2317 | regForm = self._conf.getRegistrationForm() |
|---|
| 2318 | miscGroup=self._registrant.getMiscellaneousGroupById(gsf.getId()) |
|---|
| 2319 | html=["""<table>"""] |
|---|
| 2320 | #jmf |
|---|
| 2321 | for f in gsf.getSortedFields(): |
|---|
| 2322 | miscItem=None |
|---|
| 2323 | price="" |
|---|
| 2324 | currancy="" |
|---|
| 2325 | fieldInput = None |
|---|
| 2326 | if miscGroup is not None: |
|---|
| 2327 | miscItem=miscGroup.getResponseItemById(f.getId()) |
|---|
| 2328 | if miscItem is None: continue # for fields created after the registration of the user, we skip it. |
|---|
| 2329 | fieldInput = miscItem.getGeneralField().getInput() |
|---|
| 2330 | v= i18nformat("""--_("no value selected")--""") |
|---|
| 2331 | if f.isBillable(): |
|---|
| 2332 | price=f.getPrice() |
|---|
| 2333 | currancy=regForm.getCurrency() |
|---|
| 2334 | if miscItem is not None: |
|---|
| 2335 | v=miscItem.getValue() |
|---|
| 2336 | if miscItem.isBillable(): |
|---|
| 2337 | price=miscItem.getPrice() |
|---|
| 2338 | currancy=regForm.getCurrency() |
|---|
| 2339 | if v is None : v="" |
|---|
| 2340 | html.append(""" |
|---|
| 2341 | <tr> |
|---|
| 2342 | <td align="right"><b>%s%s</b></td> |
|---|
| 2343 | <td align="left">%s</td> |
|---|
| 2344 | <td align="right">%s %s</td> |
|---|
| 2345 | </tr> |
|---|
| 2346 | """%(f.getCaption(), ":" if not isinstance(fieldInput, LabelInput) else '', self._formatValue(fieldInput, v), price, currancy) ) |
|---|
| 2347 | if miscGroup is not None: |
|---|
| 2348 | for miscItem in miscGroup.getResponseItemList(): |
|---|
| 2349 | f=gsf.getFieldById(miscItem.getId()) |
|---|
| 2350 | if f is None: |
|---|
| 2351 | html.append( i18nformat(""" |
|---|
| 2352 | <tr> |
|---|
| 2353 | <td align="right" nowrap><b>%s:</b></td> |
|---|
| 2354 | <td align="left">%s <font color="red">( _("cancelled") )</font></td> |
|---|
| 2355 | </tr> |
|---|
| 2356 | """)%(miscItem.getCaption(), self._formatValue(fieldInput, miscItem.getValue())) ) |
|---|
| 2357 | if len(html)==1: |
|---|
| 2358 | html.append( i18nformat(""" |
|---|
| 2359 | <tr><td><font color="black"><i>--_("No fields")--</i></font></td></tr> |
|---|
| 2360 | """)) |
|---|
| 2361 | html.append("</table>") |
|---|
| 2362 | return "".join(html) |
|---|
| 2363 | |
|---|
| 2364 | def _getMiscInfoItemsHTMLBilllable(self, gsf,total): |
|---|
| 2365 | regForm = self._conf.getRegistrationForm() |
|---|
| 2366 | miscGroup=self._registrant.getMiscellaneousGroupById(gsf.getId()) |
|---|
| 2367 | html=[""""""] |
|---|
| 2368 | if miscGroup is not None: |
|---|
| 2369 | for miscItem in miscGroup.getResponseItemList(): |
|---|
| 2370 | _billlable=False |
|---|
| 2371 | price=0.0 |
|---|
| 2372 | quantity=0 |
|---|
| 2373 | value="" |
|---|
| 2374 | caption=miscItem.getCaption() |
|---|
| 2375 | currency=miscItem.getCurrency() |
|---|
| 2376 | if miscItem is not None: |
|---|
| 2377 | v=miscItem.getValue() |
|---|
| 2378 | fieldInput = miscItem.getGeneralField().getInput() |
|---|
| 2379 | if miscItem.isBillable(): |
|---|
| 2380 | _billlable=miscItem.isBillable() |
|---|
| 2381 | #caption=miscItem.getValue() |
|---|
| 2382 | value=miscItem.getValue() |
|---|
| 2383 | price=string.atof(miscItem.getPrice()) |
|---|
| 2384 | quantity=miscItem.getQuantity() |
|---|
| 2385 | total["value"]+=price*quantity |
|---|
| 2386 | if value != "": |
|---|
| 2387 | value=":%s"%value |
|---|
| 2388 | if(quantity>0): |
|---|
| 2389 | html.append(""" |
|---|
| 2390 | <tr> |
|---|
| 2391 | <td ><b>%i</b></td> |
|---|
| 2392 | <td>%s:%s%s</td> |
|---|
| 2393 | <td align="right" style="padding-right:10px" nowrap >%s</td> |
|---|
| 2394 | <td align="right"nowrap >%s %s</td> |
|---|
| 2395 | </tr> |
|---|
| 2396 | """%(quantity,gsf.getTitle(),caption,self._formatValue(fieldInput, value),price,price*quantity,currency) ) |
|---|
| 2397 | return "".join(html) |
|---|
| 2398 | |
|---|
| 2399 | |
|---|
| 2400 | def _getFormItemsHTMLBilllable(self, bf, total): |
|---|
| 2401 | html=[""] |
|---|
| 2402 | for item in bf.getBilledItems(): |
|---|
| 2403 | caption = item.getCaption() |
|---|
| 2404 | currency = item.getCurrency() |
|---|
| 2405 | price = item.getPrice() |
|---|
| 2406 | quantity = item.getQuantity() |
|---|
| 2407 | total["value"] += price*quantity |
|---|
| 2408 | if quantity > 0: |
|---|
| 2409 | html.append(""" |
|---|
| 2410 | <tr> |
|---|
| 2411 | <td><b>%i</b></td> |
|---|
| 2412 | <td>%s</td> |
|---|
| 2413 | <td align="right" style="padding-right:10px" nowrap >%s</td> |
|---|
| 2414 | <td align="right"nowrap >%s %s</td> |
|---|
| 2415 | </tr> |
|---|
| 2416 | """%(quantity, caption, price, price*quantity, currency)) |
|---|
| 2417 | return "".join(html) |
|---|
| 2418 | |
|---|
| 2419 | |
|---|
| 2420 | def _getMiscellaneousInfoHTML(self, gsf): |
|---|
| 2421 | html=[] |
|---|
| 2422 | if gsf.isEnabled(): |
|---|
| 2423 | html.append(""" |
|---|
| 2424 | <tr> |
|---|
| 2425 | <td style="color:black"><b>%s</b></td> |
|---|
| 2426 | <td bgcolor="white" class="blacktext">%s</td> |
|---|
| 2427 | </tr> |
|---|
| 2428 | <tr> |
|---|
| 2429 | <td colspan="4" style="border-top:2px solid black"> </td> |
|---|
| 2430 | </tr> |
|---|
| 2431 | """%(gsf.getTitle(), self._getMiscInfoItemsHTML(gsf) ) ) |
|---|
| 2432 | return "".join(html) |
|---|
| 2433 | |
|---|
| 2434 | def _getPaymentInfo(self): |
|---|
| 2435 | regForm = self._conf.getRegistrationForm() |
|---|
| 2436 | modPay=self._conf.getModPay() |
|---|
| 2437 | html=[] |
|---|
| 2438 | if modPay.isActivated() and self._registrant.doPay(): |
|---|
| 2439 | total={} |
|---|
| 2440 | total["value"]=0 |
|---|
| 2441 | html.append( i18nformat(""" <tr><td colspan="2"><table width="100%%"> |
|---|
| 2442 | <tr> |
|---|
| 2443 | <tr><td colspan="4" class="title"><b>_("Payment summary")</b></td></tr> |
|---|
| 2444 | <tr> |
|---|
| 2445 | <td style="color:black"><b> _("Quantity")</b></td> |
|---|
| 2446 | <td style="color:black"><b> _("Item")</b></td> |
|---|
| 2447 | <td style="color:black;padding-right:10px" nowrap ><b>_("Unit Price")</b></td> |
|---|
| 2448 | <td style="color:black"><b> _("Cost")</b></td> |
|---|
| 2449 | </tr> |
|---|
| 2450 | """)) |
|---|
| 2451 | for gsf in self._registrant.getMiscellaneousGroupList(): |
|---|
| 2452 | html.append("""<tr>%s</tr>"""%(self._getMiscInfoItemsHTMLBilllable(gsf,total))) |
|---|
| 2453 | for bf in self._registrant.getBilledForms(): |
|---|
| 2454 | html.append("""<tr>%s</tr>"""%(self._getFormItemsHTMLBilllable(bf,total))) |
|---|
| 2455 | |
|---|
| 2456 | url=urlHandlers.UHConfRegistrationFormconfirmBooking.getURL(self._registrant) |
|---|
| 2457 | url.addParam("registrantId", self._registrant.getId()) |
|---|
| 2458 | url.addParam("confId", self._conf.getId()) |
|---|
| 2459 | |
|---|
| 2460 | condChecking="" |
|---|
| 2461 | if modPay.hasPaymentConditions(): |
|---|
| 2462 | condChecking="""<!--<tr><td>Please ensure that you have read the terms and conditions before continuing.</td></tr> |
|---|
| 2463 | <tr><td>I have read and agree to the terms and conditions and understand that by confirming this order I will be entering into a binding transaction.</td></tr>--> |
|---|
| 2464 | <tr> |
|---|
| 2465 | <td><input type="checkbox" name="conditions"/>I have read and accept the terms and conditions and understand that by confirming this order I will be entering into a binding transaction (<a href="#" onClick="window.open('%s','Conditions','width=400,height=200,resizable=yes,scrollbars=yes'); return false;">Terms and conditions</a>).</td> |
|---|
| 2466 | </tr> |
|---|
| 2467 | <tr> |
|---|
| 2468 | <td><br></td> |
|---|
| 2469 | </tr>"""%str(urlHandlers.UHConfRegistrationFormConditions.getURL(self._conf)) |
|---|
| 2470 | |
|---|
| 2471 | html.append( i18nformat(""" |
|---|
| 2472 | <tr> </tr> |
|---|
| 2473 | <tr> |
|---|
| 2474 | <td ><b> _("TOTAL")</b></td> |
|---|
| 2475 | <td></td> |
|---|
| 2476 | <td></td> |
|---|
| 2477 | <td align="right"nowrap>%s %s</td> |
|---|
| 2478 | </tr> |
|---|
| 2479 | <form name="epay" action="%s" method="POST"> |
|---|
| 2480 | <tr> |
|---|
| 2481 | <table width="100%%"> |
|---|
| 2482 | |
|---|
| 2483 | <tr><td> </td></tr> |
|---|
| 2484 | %s |
|---|
| 2485 | <tr> |
|---|
| 2486 | <td align="right" nowrap><input type="submit" value="Next ->" onclick="return checkConditions()" ></td> |
|---|
| 2487 | </tr> |
|---|
| 2488 | </table> |
|---|
| 2489 | </tr> |
|---|
| 2490 | </form> <td colspan="4" style="border-top:2px solid black"> </td></tr> |
|---|
| 2491 | </table></td></tr> |
|---|
| 2492 | """)%(total["value"],regForm.getCurrency(),url,condChecking)) |
|---|
| 2493 | return "".join(html) |
|---|
| 2494 | |
|---|
| 2495 | def _getFormSections(self): |
|---|
| 2496 | sects = [] |
|---|
| 2497 | regForm = self._conf.getRegistrationForm() |
|---|
| 2498 | for formSection in regForm.getSortedForms(): |
|---|
| 2499 | if formSection.getId() == "reasonParticipation": |
|---|
| 2500 | sects.append(self._getReasonParticipationHTML()) |
|---|
| 2501 | elif formSection.getId() == "sessions": |
|---|
| 2502 | sects.append(self._getSessionsHTML()) |
|---|
| 2503 | elif formSection.getId() == "accommodation": |
|---|
| 2504 | sects.append(self._getAccommodationHTML()) |
|---|
| 2505 | elif formSection.getId() == "socialEvents": |
|---|
| 2506 | sects.append(self._getSocialEventsHTML()) |
|---|
| 2507 | elif formSection.getId() == "furtherInformation": |
|---|
| 2508 | pass |
|---|
| 2509 | else: |
|---|
| 2510 | sects.append(self._getMiscellaneousInfoHTML(formSection)) |
|---|
| 2511 | return "".join(sects) |
|---|
| 2512 | |
|---|
| 2513 | def getVars( self ): |
|---|
| 2514 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 2515 | vars["id"] = self._registrant.getId() |
|---|
| 2516 | vars["pdfields"] = self._getPDInfoHTML() |
|---|
| 2517 | vars["registrationDate"] = i18nformat("""--_("date unknown")--""") |
|---|
| 2518 | |
|---|
| 2519 | if self._registrant.getRegistrationDate() is not None: |
|---|
| 2520 | vars["registrationDate"] = self._registrant.getAdjustedRegistrationDate().strftime("%d-%B-%Y %H:%M") |
|---|
| 2521 | vars["otherSections"] = self._getFormSections() |
|---|
| 2522 | vars["paymentInfo"] = self._getPaymentInfo() |
|---|
| 2523 | vars["epaymentAnnounce"] = "" |
|---|
| 2524 | if self._conf.getModPay().isActivated() and self._registrant.doPay(): |
|---|
| 2525 | vars["epaymentAnnounce"] = """<br><font color="black">Please proceed to the <b>payment of your order</b> (by using the "Next" button down this page). You will then receive the payment details.</font>""" |
|---|
| 2526 | return vars |
|---|
| 2527 | |
|---|
| 2528 | class WPRegistrationFormconfirmBooking( conferences.WPConferenceDefaultDisplayBase ): |
|---|
| 2529 | navigationEntry = navigation.NERegistrationFormDisplay |
|---|
| 2530 | |
|---|
| 2531 | def __init__(self, rh, conf, reg): |
|---|
| 2532 | conferences.WPConferenceDefaultDisplayBase.__init__(self, rh, conf) |
|---|
| 2533 | self._registrant=reg |
|---|
| 2534 | |
|---|
| 2535 | def _getBody( self, params ): |
|---|
| 2536 | wc = WRegistrationFormconfirmBooking( self._registrant ) |
|---|
| 2537 | return wc.getHTML() |
|---|
| 2538 | |
|---|
| 2539 | def _defineSectionMenu( self ): |
|---|
| 2540 | conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self) |
|---|
| 2541 | self._sectionMenu.setCurrentItem(self._regFormOpt) |
|---|
| 2542 | |
|---|
| 2543 | class WRegistrationFormconfirmBooking(wcomponents.WTemplated): |
|---|
| 2544 | def __init__( self, registrant ): |
|---|
| 2545 | self._registrant = registrant |
|---|
| 2546 | self._conf = self._registrant.getConference() |
|---|
| 2547 | self.modPay = self._conf.getModPay() |
|---|
| 2548 | |
|---|
| 2549 | def _getModPayHTML(self): |
|---|
| 2550 | forms="" |
|---|
| 2551 | html=[] |
|---|
| 2552 | regForm = self._conf.getRegistrationForm() |
|---|
| 2553 | for m in self.modPay.getSortedModPay(): |
|---|
| 2554 | if m.isEnabled(): |
|---|
| 2555 | forms=forms+""" |
|---|
| 2556 | <tr> |
|---|
| 2557 | <td></td> |
|---|
| 2558 | <td><b>%s</b></td> |
|---|
| 2559 | %s |
|---|
| 2560 | </tr> |
|---|
| 2561 | """%(m.getTitle(),m.getFormHTML(self._registrant.getTotal(),regForm.getCurrency(),self._conf,self._registrant, lang = self._rh._getSession().getLang(), secure=self._rh._req.is_https())) |
|---|
| 2562 | #forms=forms+"</table>" |
|---|
| 2563 | |
|---|
| 2564 | if forms: |
|---|
| 2565 | html.append( _(""" |
|---|
| 2566 | <tr> </tr> |
|---|
| 2567 | <tr> |
|---|
| 2568 | <td colspan="4" style="color:black"><b>Pay by credit card online with:</b></td> |
|---|
| 2569 | </tr> |
|---|
| 2570 | <tr> |
|---|
| 2571 | %s |
|---|
| 2572 | </tr> |
|---|
| 2573 | <tr><td colspan="4" style="border-top:2px solid black"> </td></tr> |
|---|
| 2574 | """)%"".join(forms)) |
|---|
| 2575 | return "".join(html) |
|---|
| 2576 | |
|---|
| 2577 | def getVars( self ): |
|---|
| 2578 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 2579 | vars["modPay"]=self._getModPayHTML() |
|---|
| 2580 | vars["modPayDetails"] = self.modPay.getPaymentDetails() |
|---|
| 2581 | return vars |
|---|
| 2582 | |
|---|
| 2583 | class WPRegistrationFormSignIn( conferences.WPConferenceDefaultDisplayBase ): |
|---|
| 2584 | navigationEntry = navigation.NERegistrationFormDisplay |
|---|
| 2585 | |
|---|
| 2586 | def _getBody( self, params ): |
|---|
| 2587 | urlCreateAccount=urlHandlers.UHConfUserCreation.getURL( self._conf ) |
|---|
| 2588 | urlCreateAccount.addParam("returnURL",urlHandlers.UHConfRegistrationFormDisplay.getURL(self._conf)) |
|---|
| 2589 | p = { \ |
|---|
| 2590 | "postURL": urlHandlers.UHConfSignIn.getURL( self._conf ), \ |
|---|
| 2591 | "returnURL": urlHandlers.UHConfRegistrationFormDisplay.getURL(self._conf), \ |
|---|
| 2592 | "createAccountURL": urlCreateAccount, \ |
|---|
| 2593 | "forgotPassordURL": urlHandlers.UHConfSendLogin.getURL( self._conf ), \ |
|---|
| 2594 | "login": "", \ |
|---|
| 2595 | "msg": "" } |
|---|
| 2596 | wc = WConfRegistrationFormSignIn( self._conf, p ) |
|---|
| 2597 | return wc.getHTML(p) |
|---|
| 2598 | |
|---|
| 2599 | def _defineSectionMenu( self ): |
|---|
| 2600 | conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self) |
|---|
| 2601 | self._sectionMenu.setCurrentItem(self._newRegFormOpt) |
|---|
| 2602 | |
|---|
| 2603 | class WConfRegistrationFormSignIn(wcomponents.WTemplated): |
|---|
| 2604 | |
|---|
| 2605 | def __init__(self, conf, p): |
|---|
| 2606 | self._conf = conf |
|---|
| 2607 | self._params = p |
|---|
| 2608 | |
|---|
| 2609 | def getVars(self): |
|---|
| 2610 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 2611 | wc = wcomponents.WSignIn() |
|---|
| 2612 | vars["signIn"] = wc.getHTML(self._params) |
|---|
| 2613 | return vars |
|---|
| 2614 | |
|---|
| 2615 | class WPRegistrationFormModify( conferences.WPConferenceDefaultDisplayBase ): |
|---|
| 2616 | navigationEntry = navigation.NERegistrationFormModify |
|---|
| 2617 | |
|---|
| 2618 | def _getBody( self, params ): |
|---|
| 2619 | wc = WConfRegistrationFormModify( self._conf, self._rh._getUser() ) |
|---|
| 2620 | pars = {"menuStatus":self._rh._getSession().getVar("menuStatus") or "open"} |
|---|
| 2621 | return wc.getHTML(pars) |
|---|
| 2622 | |
|---|
| 2623 | def _defineSectionMenu( self ): |
|---|
| 2624 | conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self) |
|---|
| 2625 | self._sectionMenu.setCurrentItem(self._viewRegFormOpt) |
|---|
| 2626 | |
|---|
| 2627 | class WConfRegistrationFormModify(WConfRegistrationFormDisplay): |
|---|
| 2628 | |
|---|
| 2629 | def getVars(self): |
|---|
| 2630 | vars = WConfRegistrationFormDisplay.getVars( self ) |
|---|
| 2631 | registrant = self._currentUser.getRegistrantById(self._conf.getId()) |
|---|
| 2632 | vars["postURL"] = quoteattr(str(urlHandlers.UHConfRegistrationFormPerformModify.getURL(self._conf))) |
|---|
| 2633 | return vars |
|---|
| 2634 | |
|---|
| 2635 | class WPRegistrationFormFull( conferences.WPConferenceDefaultDisplayBase ): |
|---|
| 2636 | navigationEntry = navigation.NERegistrationFormDisplay |
|---|
| 2637 | |
|---|
| 2638 | def _getBody( self, params ): |
|---|
| 2639 | wc = WConfRegistrationFormFull( self._conf ) |
|---|
| 2640 | return wc.getHTML() |
|---|
| 2641 | |
|---|
| 2642 | def _defineSectionMenu( self ): |
|---|
| 2643 | conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self) |
|---|
| 2644 | self._sectionMenu.setCurrentItem(self._regFormOpt) |
|---|
| 2645 | |
|---|
| 2646 | class WConfRegistrationFormFull(wcomponents.WTemplated): |
|---|
| 2647 | |
|---|
| 2648 | def __init__(self, conf): |
|---|
| 2649 | self._conf = conf |
|---|
| 2650 | |
|---|
| 2651 | def getVars(self): |
|---|
| 2652 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 2653 | vars["limit"] = self._conf.getRegistrationForm().getUsersLimit() |
|---|
| 2654 | return vars |
|---|
| 2655 | |
|---|
| 2656 | class WPRegistrationFormClosed( conferences.WPConferenceDefaultDisplayBase ): |
|---|
| 2657 | navigationEntry = navigation.NERegistrationFormDisplay |
|---|
| 2658 | |
|---|
| 2659 | def _getBody( self, params ): |
|---|
| 2660 | wc = WConfRegistrationFormClosed( self._conf ) |
|---|
| 2661 | return wc.getHTML() |
|---|
| 2662 | |
|---|
| 2663 | def _defineSectionMenu( self ): |
|---|
| 2664 | conferences.WPConferenceDefaultDisplayBase._defineSectionMenu(self) |
|---|
| 2665 | self._sectionMenu.setCurrentItem(self._regFormOpt) |
|---|
| 2666 | |
|---|
| 2667 | class WConfRegistrationFormClosed(wcomponents.WTemplated): |
|---|
| 2668 | |
|---|
| 2669 | def __init__(self, conf): |
|---|
| 2670 | self._conf = conf |
|---|
| 2671 | |
|---|
| 2672 | def getVars(self): |
|---|
| 2673 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 2674 | regForm=self._conf.getRegistrationForm() |
|---|
| 2675 | vars["title"]= _("Impossible to register") |
|---|
| 2676 | vars["msg"]= _("No period for registration") |
|---|
| 2677 | if nowutc()<regForm.getStartRegistrationDate(): |
|---|
| 2678 | vars["title"]= _("Registration is not open yet") |
|---|
| 2679 | vars["msg"]= _("Sorry but the registration is not open yet:") |
|---|
| 2680 | elif regForm.getAllowedEndRegistrationDate()<nowutc(): |
|---|
| 2681 | vars["title"]= _("Registration is closed") |
|---|
| 2682 | vars["msg"]= _("Sorry but the registration is now closed:") |
|---|
| 2683 | vars["startDate"] = self._conf.getRegistrationForm().getStartRegistrationDate().strftime("%A %d %B %Y") |
|---|
| 2684 | vars["endDate"] = self._conf.getRegistrationForm().getEndRegistrationDate().strftime("%A %d %B %Y") |
|---|
| 2685 | return vars |
|---|
| 2686 | |
|---|
| 2687 | class WPRegistrationFormConditions(WPBase): |
|---|
| 2688 | |
|---|
| 2689 | def __init__(self, rh, conf): |
|---|
| 2690 | WPBase.__init__(self, rh) |
|---|
| 2691 | self._conf = conf |
|---|
| 2692 | |
|---|
| 2693 | def _display( self, params ): |
|---|
| 2694 | wc = WConfRegistrationFormConditions( self._conf ) |
|---|
| 2695 | return wc.getHTML() |
|---|
| 2696 | |
|---|
| 2697 | class WConfRegistrationFormConditions(wcomponents.WTemplated): |
|---|
| 2698 | |
|---|
| 2699 | def __init__(self, conf): |
|---|
| 2700 | self._conf = conf |
|---|
| 2701 | |
|---|
| 2702 | def getVars(self): |
|---|
| 2703 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 2704 | vars["conditions"]=self._conf.getModPay().getConditions() |
|---|
| 2705 | return vars |
|---|