source: indico/indico/MaKaC/webinterface/pages/registrants.py @ 2990cb

burotelhello-world-walkthroughipv6new-webexprov-dual-interfacev0.97-seriesv0.98-seriesv0.98.2v0.98.3v0.98b1v0.98b2v0.99v1.0v1.1
Last change on this file since 2990cb was 2990cb, checked in by Jose Benito <jose.benito.gonzalez@…>, 3 years ago

[IMPROVEMENT] Registration form sections in order

There is an order for printing all the sections in a registration form.
This order was just used in the page to register but not in the emails
and in the page after registration and nor in the management area.
Now, everything should keep the same order.

fixes #57

  • Property mode set to 100644
File size: 101.8 KB
Line 
1# -*- coding: utf-8 -*-
2##
3## $Id: registrants.py,v 1.28 2009/05/27 07:31:45 jose Exp $
4##
5## This file is part of CDS Indico.
6## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN.
7##
8## CDS Indico is free software; you can redistribute it and/or
9## modify it under the terms of the GNU General Public License as
10## published by the Free Software Foundation; either version 2 of the
11## License, or (at your option) any later version.
12##
13## CDS Indico is distributed in the hope that it will be useful, but
14## WITHOUT ANY WARRANTY; without even the implied warranty of
15## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16## General Public License for more details.
17##
18## You should have received a copy of the GNU General Public License
19## along with CDS Indico; if not, write to the Free Software Foundation, Inc.,
20## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
21
22import math
23from datetime import timedelta
24import MaKaC.webinterface.pages.registrationForm as registrationForm
25import MaKaC.webinterface.urlHandlers as urlHandlers
26import MaKaC.common.filters as filters
27from MaKaC.webinterface import wcomponents
28from xml.sax.saxutils import quoteattr
29from MaKaC.webinterface.pages.conferences import WPConferenceModifBase, WPConferenceDefaultDisplayBase
30from MaKaC.common import Config
31from MaKaC.webinterface.common.countries import CountryHolder
32from MaKaC.webinterface.common.person_titles import TitlesRegistry
33from MaKaC.webinterface.common.registrantNotificator import EmailNotificator
34from MaKaC import registration
35from conferences import WConfModifBadgePDFOptions
36from MaKaC.i18n import _
37from xml.sax.saxutils import escape
38import string
39
40# ----------------- MANAGEMENT AREA ---------------------------
41class WPConfModifRegistrantListBase( registrationForm.WPConfModifRegFormBase ):
42
43    def _setActiveTab( self ):
44        self._tabRegistrants.setActive()
45
46class WPConfModifRegistrantList( WPConfModifRegistrantListBase ):
47
48    def _getTabContent( self, params ):
49        filterCrit=params.get("filterCrit",None)
50        sortingCrit=params.get("sortingCrit",None)
51        display = params.get("display",None)
52        order = params.get("order",None)
53        sessionFilterName=params.get("sessionFilterName", "session")
54        menustatus = params.get("menuStatus", None)
55        websession = self._rh._getSession()
56        wc = WConfModifRegistrants(self._conf,filterCrit,sortingCrit,display, websession, order, sessionFilterName, menustatus)
57        return wc.getHTML()
58
59class WConfModifRegistrants( wcomponents.WTemplated ):
60
61    def __init__( self, conference,filterCrit, sortingCrit, display, websession, order="down", sessionFilterName="session", menustatus=None ):
62        self._conf = conference
63        self._filterCrit=filterCrit
64        self._sortingCrit=sortingCrit
65        self._order = order
66        self._sessionFilterName = sessionFilterName
67        self._menustatus = menustatus
68        self._display = display
69        self._setDispOpts()
70
71        dict = websession.getVar("registrantsFilterAndSortingConf%s"%self._conf.getId())
72        if not dict:
73            dict = {}
74        if self._filterCrit.getField("accomm"):
75            dict["accomm"] = self._filterCrit.getField("accomm").getValues()
76            if self._filterCrit.getField("accomm").getShowNoValue():
77                dict["accommShowNoValue"] = "1"
78
79        if self._filterCrit.getField(self._sessionFilterName):
80            dict["session"] = self._filterCrit.getField(self._sessionFilterName).getValues()
81            if self._filterCrit.getField(self._sessionFilterName).getShowNoValue():
82                dict["sessionShowNoValue"] = "1"
83
84        if self._sessionFilterName == "sessionfirstpriority":
85            dict["firstChoice"] = "1"
86
87        if self._filterCrit.getField("event"):
88            dict["event"] = self._filterCrit.getField("event").getValues()
89            if self._filterCrit.getField("event").getShowNoValue():
90                dict["eventShowNoValue"] = "1"
91
92        if self._sortingCrit.getField():
93            dict["sortBy"] = self._sortingCrit.getField().getId()
94            dict["order"] = "down"
95
96        dict["disp"] = self._getDisplay()
97        websession.setVar("registrantsFilterAndSortingConf%s"%self._conf.getId(), dict)
98
99
100    def _setDispOpts(self):
101        """
102            Dictionary with the available options you can choose for the display.
103            Within the dictionary we store the "ids" of the options.
104        """
105        self._dispopts = {"PersonalData":[ "Id", "LastName", "FirstName", "Email", "Position", "Institution","Phone","City","Country","Address","isPayed","idpayment","amountToPay"]}
106        self._dispopts["statuses"]=[]
107        for st in self._conf.getRegistrationForm().getStatusesList():
108            self._dispopts["statuses"].append("s-%s"%st.getId())
109        #if self._conf.getRegistrationForm().getAccommodationForm().isEnabled():
110        self._dispopts["Accommodation"]=["Accommodation", "ArrivalDate","DepartureDate"]
111        #if self._conf.getRegistrationForm().getSocialEventForm().isEnabled():
112        self._dispopts["SocialEvents"] = ["SocialEvents"]
113        #if self._conf.getRegistrationForm().getSessionsForm().isEnabled():
114        self._dispopts["Sessions"] = ["Sessions"]
115        #if self._conf.getRegistrationForm().getReasonParticipationForm().isEnabled():
116        self._dispopts["ReasonParticipation"]=["ReasonParticipation"]
117        self._dispopts["more"]=["RegistrationDate"]
118        for sect in self._conf.getRegistrationForm().getGeneralSectionFormsList():
119            #if sect.isEnabled():
120            self._dispopts[sect.getId()]=[]
121            ################
122            #jmf-start
123            #
124            #for fld in sect.getFields():
125            #    self._dispopts[sect.getId()].append("%s-%s"%(sect.getId(),fld.getId()))
126            for fld in sect.getSortedFields():
127                self._dispopts[sect.getId()].append("%s-%s"%(sect.getId(),fld.getId()))
128            #
129            #jmf-end
130            ################
131    def _getKeyDispOpts(self, value):
132        """
133        Returns the key which contains the done value.
134        """
135        for key in self._dispopts.keys():
136            if value in self._dispopts[key]:
137                return key
138        return None
139
140    def _getColumnTitlesDict(self):
141        """
142            Dictionary with the translation from "ids" to "name to display" for each of the options you can choose for the display.
143            This method complements the method "_setDispOpts" in which we get a dictonary with "ids".
144        """
145        try:
146            if self._columns:
147                pass
148        except AttributeError:
149            columns ={"PersonalData":"Personal Data","Id":"Id", "Email": "Email", "Position":"Position", "Institution":"Institution","Phone":"Phone","City":"City",\
150                      "Country":"Country", "Address":"Address", "ArrivalDate": "Arrival Date", "DepartureDate": "Departure Date", \
151                      "RegistrationDate": "Registration date (%s)"%self._conf.getTimezone()}
152
153            tit=self._conf.getRegistrationForm().getSessionsForm().getTitle()
154            if not self._conf.getRegistrationForm().getSessionsForm().isEnabled():
155                tit='%s <span style="color:red;font-size: 75%%">(disabled)</span>'%tit
156            columns["Sessions"]=tit
157            tit=self._conf.getRegistrationForm().getAccommodationForm().getTitle()
158            if not self._conf.getRegistrationForm().getAccommodationForm().isEnabled():
159                tit='%s <span style="color:red;font-size: 75%%">(disabled)</span>'%tit
160            columns["Accommodation"]=tit
161            tit=self._conf.getRegistrationForm().getSocialEventForm().getTitle()
162            if not self._conf.getRegistrationForm().getSocialEventForm().isEnabled():
163                tit='%s <span style="color:red;font-size: 75%%">(disabled)</span>'%tit
164            columns["SocialEvents"]=tit
165            tit=self._conf.getRegistrationForm().getReasonParticipationForm().getTitle()
166            if not self._conf.getRegistrationForm().getReasonParticipationForm().isEnabled():
167                tit='%s <span style="color:red;font-size: 75%%">(disabled)</span>'%tit
168            columns["ReasonParticipation"]=tit
169            columns["more"]="General info"
170            columns["statuses"]="Statuses"
171            columns["isPayed"]="Paid"
172            columns["idpayment"]="Payment ID"
173            columns["amountToPay"]="Amount"
174            columns["LastName"]="Last name"
175            columns["FirstName"]="First name"
176
177            for st in self._conf.getRegistrationForm().getStatusesList():
178                columns["s-%s"%st.getId()]=st.getCaption()
179            for sect in self._conf.getRegistrationForm().getGeneralSectionFormsList():
180                tit=sect.getTitle()
181                if not sect.isEnabled():
182                    tit='%s <span style="color:red;font-size: 75%%">(disabled)</span>'%tit
183                columns[sect.getId()]=tit
184                ############
185                # jmf-start
186                #for fld in sect.getFields():
187                #    columns["%s-%s"%(sect.getId(),fld.getId())]=fld.getCaption()
188                for fld in sect.getSortedFields():
189                    columns["%s-%s"%(sect.getId(),fld.getId())]=fld.getCaption()
190                # jmf-end
191                ############
192            self._columns=columns
193        return self._columns
194
195    def _getDisplay(self):
196        """
197            These are the 'display' options selected by the user. In case no options were selected we add some of them by default.
198        """
199        display=self._display[:]
200        if display == []:
201            display=["Email", "Institution","Phone","City","Country"]
202            if self._conf.hasEnabledSection("epay"):
203                display.extend(["isPayed","idpayment","amountToPay"])
204        return display
205
206    def _getURL( self ):
207        #builds the URL to the contribution list page
208        #   preserving the current filter and sorting status in the websesion
209        url = urlHandlers.UHConfModifRegistrantList.getURL(self._conf)
210
211        return url
212
213    def _getSessHTML(self):
214        regForm = self._conf.getRegistrationForm()
215        sessform =regForm.getSessionsForm()
216        sesstypes = sessform.getSessionList()
217        checked=""
218        if self._filterCrit.getField(self._sessionFilterName).getShowNoValue():
219            checked=" checked"
220        res=[ _("""<input type="checkbox" name="sessionShowNoValue" value="--none--"%s> --_("not specified")--""")%checked]
221        for sess in sesstypes:
222            checked=""
223            if sess.getId() in self._filterCrit.getField(self._sessionFilterName).getValues():
224                checked=" checked"
225            res.append("""<input type="checkbox" name="session" value=%s%s>%s"""%(quoteattr(str(sess.getId())),checked,self.htmlText(sess.getTitle())))
226        if sessform.getType() == "2priorities":
227            checked=""
228            if self._sessionFilterName == "sessionfirstpriority":
229                checked=" checked"
230            res.append( _("""<b>------</b><br><input type="checkbox" name="firstChoice" value="firstChoice"%s><i> _("Only by first choice")</i>""")%checked)
231        return "<br>".join(res)
232
233    def _getAcomHTML(self):
234        regForm = self._conf.getRegistrationForm()
235        accommform = regForm.getAccommodationForm()
236        accommtypes = accommform.getAccommodationTypesList()
237        checked=""
238        if self._filterCrit.getField("accomm").getShowNoValue():
239            checked=" checked"
240        res=[ _("""<input type="checkbox" name="accommShowNoValue" value="--none--"%s> --_("not specified")--""")%checked]
241        for accomm in accommtypes:
242            checked=""
243            if accomm.getId() in self._filterCrit.getField("accomm").getValues():
244                checked=" checked"
245            res.append("""<input type="checkbox" name="accomm" value=%s%s>%s"""%(quoteattr(str(accomm.getId())),checked,self.htmlText(accomm.getCaption())))
246        return "<br>".join(res)
247
248    def _getEventHTML(self):
249        regForm = self._conf.getRegistrationForm()
250        eventForm = regForm.getSocialEventForm()
251        events = eventForm.getSocialEventList()
252        checked=""
253        if self._filterCrit.getField("event").getShowNoValue():
254            checked=" checked"
255        res=[ _("""<input type="checkbox" name="eventShowNoValue" value="--none--"%s> --_("not specified")--""")%checked]
256        for event in events:
257            checked=""
258            if event.getId() in self._filterCrit.getField("event").getValues():
259                checked=" checked"
260            res.append("""<input type="checkbox" name="event" value=%s%s>%s"""%(quoteattr(str(event.getId())),checked,self.htmlText(event.getCaption())))
261        return "<br>".join(res)
262
263    def _getDispHTML(self):
264        """
265        Filtering criteria: table with all the options for the columns we need to display.
266        """
267        res=["""<table width="100%%" cellpadding="0" cellspacing="0" valign="top">"""]
268        columns=self._getColumnTitlesDict()
269        checked = " checked"
270        display=self._getDisplay()
271        counter=0
272        # sorting dispopts by
273        auxdict={}
274        for key in self._dispopts.keys():
275            if not auxdict.has_key(len(self._dispopts[key])):
276                auxdict[len(self._dispopts[key])]=[]
277            auxdict[len(self._dispopts[key])].append(key)
278        auxlens=auxdict.keys()
279        auxlens.sort()
280        auxlens.reverse()
281        dispoptssortedkeys=[]
282        for l in auxlens:
283            for k in auxdict[l]:
284                dispoptssortedkeys.append(k)
285        #---end sorting
286        for key in dispoptssortedkeys:
287            if self._dispopts[key] == []:
288                continue
289            if counter == 0:
290                res.append("""<tr>""")
291            res.append("""<td style="border-bottom:1px solid lightgrey; width:33%%" valign="top" align="left"><span style="color:black"><b>%s</b></span><br>"""%(columns[key]))
292            for keyfld in self._dispopts[key]:
293                res.append("""<table width="100%%" cellpadding="0" cellspacing="0" valign="top">""")
294                checked =""
295                if keyfld in display:
296                    checked=" checked"
297                res.append("""<tr><td align="left" valign="top"><input type="checkbox" name="disp" value="%s"%s></td><td width="100%%" align="left" valign="top">%s</td></tr>"""%(keyfld,checked,columns[keyfld].replace('<span style="color:red;font-size: 75%">(disabled)</span>','')))
298                res.append("""</table>""")
299            res.append("""</td>""")
300            if counter==2:
301                counter=0
302                res.append("""</tr>""")
303            else:
304                counter+=1
305        if counter in [1,2]:
306            res.append("""<td colspan="2" style="border-bottom:1px solid lightgrey; width:100%%">&nbsp;</td>""")
307        res.append("""</table>""")
308        return "".join(res)
309
310
311    def _getRegColumnHTML(self, sortingField):
312        """
313        Titles for the columns of the list.
314        """
315        resgroups={}
316        columns=self._getColumnTitlesDict()
317        currentSorting=""
318        if sortingField is not None:
319            currentSorting=sortingField.getSpecialId()
320        currentSortingHTML = ""
321        display=self._getDisplay()
322        resgroups["PersonalData"]=[]
323        if "Id" in display:
324            url=self._getURL()
325            url.addParam("sortBy","Id")
326            idImg=""
327            if currentSorting == "Id":
328                currentSortingHTML = """<input type="hidden" name="sortBy" value="Id">"""
329                if self._order == "down":
330                    idImg = """<img src=%s alt="down">"""%(quoteattr(Config.getInstance().getSystemIconURL("downArrow")))
331                    url.addParam("order","up")
332                elif self._order == "up":
333                    idImg = """<img src=%s alt="up">"""%(quoteattr(Config.getInstance().getSystemIconURL("upArrow")))
334                    url.addParam("order","down")
335            idSortingURL=quoteattr("%s#results"%str(url))
336            resgroups["PersonalData"]=[ _("""<td nowrap class="titleCellFormat" style="border-left:5px solid #FFFFFF;border-bottom: 1px solid #5294CC;">%s<a href=%s> _("Id")</a></td>""")%(idImg, idSortingURL)]
337
338        url=self._getURL()
339        url.addParam("sortBy","Name")
340        nameImg=""
341        if currentSorting == "Name":
342            currentSortingHTML = """<input type="hidden" name="sortBy" value="Name">"""
343            if self._order == "down":
344                nameImg = """<img src=%s alt="down">"""%(quoteattr(Config.getInstance().getSystemIconURL("downArrow")))
345                url.addParam("order","up")
346            elif self._order == "up":
347                nameImg = """<img src=%s alt="up">"""%(quoteattr(Config.getInstance().getSystemIconURL("upArrow")))
348                url.addParam("order","down")
349        nameSortingURL=quoteattr("%s#results"%str(url))
350
351        resgroups["PersonalData"].append( _("""<td nowrap class="titleCellFormat" style="border-left:5px solid #FFFFFF;border-bottom: 1px solid #5294CC;">%s<a href=%s> _("Name")</a></td>""")%(nameImg, nameSortingURL))
352        if "Id" in display:
353            pdil=["Id", "Name"]
354        else:
355            pdil=["Name"]
356        self._groupsorder={"PersonalData":pdil}#list used to display the info of the registrants in the same order
357        for key in display:
358            if key == "Id" or not columns.has_key(key):
359                continue
360            url=self._getURL()
361            url.addParam("sortBy",key)
362            img=""
363            if currentSorting == key:
364                currentSortingHTML = """<input type="hidden" name="sortBy" value="%s">"""%key
365                if self._order == "down":
366                    img = """<img src=%s alt="down">"""%(quoteattr(Config.getInstance().getSystemIconURL("downArrow")))
367                    url.addParam("order","up")
368                elif self._order == "up":
369                    img = """<img src=%s alt="up">"""%(quoteattr(Config.getInstance().getSystemIconURL("upArrow")))
370                    url.addParam("order","down")
371            sortingURL=quoteattr("%s#results"%str(url))
372            kg=self._getKeyDispOpts(key)
373            if not resgroups.has_key(kg):
374                self._groupsorder[kg]=[]
375                resgroups[kg]=[]
376            self._groupsorder[kg].append(key)
377            resgroups[kg].append("""<td class="titleCellFormat" style="border-left:5px solid #FFFFFF;border-bottom: 1px solid #5294CC;">%s<a href=%s>%s</a></td>"""%(img, sortingURL, self.htmlText(columns[key].replace('<span style="color:red;font-size: 75%">(disabled)</span>',''))))
378        # Setting up the two headers, one for the groups and one for the fields
379        groups=["""
380                <tr><td>&nbsp;</td></tr>
381                <tr>
382                    <td width="1px">%s</td>
383                """%currentSortingHTML]
384        fields=["""
385                <tr><td></td></tr>
386                <tr>
387                    <td align="right" nowrap><img src="%s" border="0" alt="Select all" onclick="javascript:selectAll()"><img src="%s" border="0" alt="Deselect all" onclick="javascript:deselectAll()">%s</td>"""%(Config.getInstance().getSystemIconURL("checkAll"),Config.getInstance().getSystemIconURL("uncheckAll"),currentSortingHTML)]
388        # First we want to display the personal data...
389        groupkey="PersonalData"
390        groups.append("""
391                    <td nowrap colspan="%s" style="color:black;border-left:5px solid #FFFFFF;border-bottom: 1px solid black;"><b>%s</b></td>
392
393                    """%(len(resgroups[groupkey]), self.htmlText(columns[groupkey].replace('<span style="color:red;font-size: 75%">(disabled)</span>',''))))
394        fields += resgroups[groupkey]
395        del resgroups[groupkey]
396        #...and them all the other info:
397        for groupkey in resgroups.keys():
398            groups.append("""
399                        <td nowrap colspan="%s" style="color:black;border-left:5px solid #FFFFFF;border-bottom: 1px solid black;"><b>%s</b></td>
400
401                        """%(len(resgroups[groupkey]), self.htmlText(columns[groupkey].replace('<span style="color:red;font-size: 75%">(disabled)</span>',''))))
402            fields += resgroups[groupkey]
403        groups.append("""
404                        </tr>
405                        """)
406        fields.append("""
407                        </tr>
408                        """)
409
410        return "%s%s"%("\r\n".join(groups), "\r\n".join(fields))
411
412
413    def _getRegistrantsHTML( self, reg ):
414        url = urlHandlers.UHRegistrantModification.getURL(reg)
415        fullName = reg.getFullName()
416        regdict={}
417        regdict["FirstName"]=reg.getFirstName()
418        regdict["LastName"]=reg.getSurName()
419        regdict["Institution"]=reg.getInstitution()
420        regdict["Position"] = reg.getPosition()
421        regdict["Phone"]=reg.getPhone()
422        regdict["City"]= reg.getCity()
423        regdict["Country"]=CountryHolder().getCountryById(reg.getCountry())
424        regdict["Address"] = reg.getAddress()
425        regdict["Email"]=reg.getEmail()
426        regdict["isPayed"]=reg.isPayedText()
427        regdict["idpayment"]=reg.getIdPay()
428        regdict["amountToPay"]="%.2f %s"%(reg.getTotal(), reg.getConference().getRegistrationForm().getCurrency())
429        regdict["Accommodation"]=""
430        regdict["DepartureDate"]=""
431        regdict["ArrivalDate"]=""
432        if reg.getAccommodation() is not None:
433            if reg.getAccommodation().getAccommodationType() is not None:
434                regdict["Accommodation"]= reg.getAccommodation().getAccommodationType().getCaption()
435            if reg.getAccommodation().getDepartureDate() is not None:
436                regdict["DepartureDate"]=reg.getAccommodation().getDepartureDate().strftime("%d-%B-%Y")
437            if reg.getAccommodation().getArrivalDate() is not None:
438                regdict["ArrivalDate"]=reg.getAccommodation().getArrivalDate().strftime("%d-%B-%Y")
439
440        events = reg.getSocialEvents()
441        items =[]
442        for item in events:
443            items.append("%s (%s)"%(item.getCaption(), item.getNoPlaces()))
444        regdict["SocialEvents"] = "<br>".join(items)
445
446        regdict["ReasonParticipation"]=reg.getReasonParticipation() or ""
447
448        regdict["RegistrationDate"]=  _("""--  _("date unknown")--""")
449        if reg.getRegistrationDate() is not None:
450            regdict["RegistrationDate"]=reg.getAdjustedRegistrationDate().strftime("%d-%B-%Y %H:%M")
451
452        sessions = reg.getSessionList()
453        sesslist =[]
454        for sess in sessions:
455            sesslist.append(sess.getTitle())
456        regdict["Sessions"] ="<br>".join(sesslist)
457
458        for strf in self._conf.getRegistrationForm().getStatusesList():
459            cap=  _("""<span style="white-space:nowrap">--  _("not set") --</span>""")
460            st=reg.getStatusById(strf.getId())
461            if st.getStatusValue() is not None:
462                cap=st.getStatusValue().getCaption()
463            regdict["s-%s"%st.getId()]=cap
464
465        for group in reg.getMiscellaneousGroupList():
466                regdict[group.getId()]=group.getTitle()
467                for fld in group.getResponseItemList():
468                    regdict["%s-%s"%(group.getId(),fld.getId())]=fld.getValue()
469
470        res =[]
471        res.append("""<td valign="top" align="right"  width="1px"><input type="checkbox" name="registrants" value="%s"></td>
472                    """%(self.htmlText(reg.getId())))
473        if "Id" in self._groupsorder["PersonalData"]:
474            res.append("""<td valign="top" nowrap class="abstractLeftDataCell">%s</td>
475                          <td valign="top" nowrap class="abstractDataCell"><a href=%s>%s</a></td>
476                       """%(reg.getId(), quoteattr(str(url)), self.htmlText(fullName)))
477        else:
478            res.append("""<td valign="top" nowrap class="abstractDataCell"><a href=%s>%s</a></td>
479                    """%(quoteattr(str(url)), self.htmlText(fullName)))
480        # Fisrtly the "PersonalData"
481        for key in self._groupsorder["PersonalData"]:
482            if key == "Name" or key == "Id":
483                continue
484            v = "&nbsp;"
485            if regdict.has_key(key) and regdict[key].strip() != "":
486                v = regdict[key]
487            res.append( """<td valign="top"  class="abstractDataCell">%s</td>"""%v)
488        for groupkey in self._groupsorder.keys():
489            if groupkey == "PersonalData":
490                continue
491            for key in  self._groupsorder[groupkey]:
492                v = "&nbsp;"
493                if regdict.has_key(key) and str(regdict[key]).strip() != "":
494                    v = regdict[key]
495                res.append( """<td valign="top"  class="abstractDataCell">%s</td>"""%v)
496        html = """
497            <tr>
498                %s
499            </tr>
500                """%"".join(res)
501        return html
502
503    def _getDisplayOptionsHTML(self):
504        html=[]
505        if self._display == []:
506            html.append("""<input type="hidden" name="disp" value="Email">""")
507            html.append("""<input type="hidden" name="disp" value="Institution">""")
508            html.append("""<input type="hidden" name="disp" value="Phone">""")
509            html.append("""<input type="hidden" name="disp" value="City">""")
510            html.append("""<input type="hidden" name="disp" value="Country">""")
511            html.append("""<input type="hidden" name="disp" value="isPayed">""")
512            html.append("""<input type="hidden" name="disp" value="idpayment">""")
513            html.append("""<input type="hidden" name="disp" value="amountToPay">""")
514        else:
515            for d in self._display:
516                html.append("""<input type="hidden" name="disp" value="%s">"""%(d))
517        html.append("""<input type="hidden" name="sortBy" value="%s">"""%(self._sortingCrit.getField().getId()))
518        return "".join(html)
519
520    def _getOpenMenuURL(self):
521        url = urlHandlers.UHConfModifRegistrantsOpenMenu.getURL(self._conf)
522        url.addParam("currentURL", self._getURL())
523        return url
524
525    def _getCloseMenuURL(self):
526        url = urlHandlers.UHConfModifRegistrantsCloseMenu.getURL(self._conf)
527        url.addParam("currentURL", self._getURL())
528        return url
529
530    def _getMenu(self):
531        if self._menustatus == "open":
532            menu =  _("""<table width="95%%" align="center" border="0" style="border-left: 1px solid #777777">
533        <tr>
534            <td class="groupTitle"><a href="%(closeMenuURL)s"><img src=%(openMenuImg)s alt="_("hide menu")" border="0"></a>  _("Filtering criteria") </td>
535        </tr>
536        <tr>
537            <td>
538                <table width="100%%">
539                    <tr>
540                        <td>
541
542                        </td>
543                    </tr>
544                    <tr>
545                        <td>
546                            <table align="center" cellspacing="10" width="100%%">
547                                <tr>
548                                    <td width="33%%" class="titleCellFormat" style="border-bottom: 1px solid #5294CC;">%(accomtitle)s %(checkAcco)s%(uncheckAcco)s</td>
549                    <td width="33%%"class="titleCellFormat" style="border-bottom: 1px solid #5294CC;">%(eventtitle)s %(checkEvent)s%(uncheckEvent)s</td>
550                    <td width="33%%"class="titleCellFormat" style="border-bottom: 1px solid #5294CC;">%(sesstitle)s %(checkSession)s%(uncheckSession)s</td>
551                                </tr>
552                                <tr>
553                                    <td valign="top" style="border-right:1px solid #777777;">%(acom)s</td>
554                    <td valign="top" style="border-right:1px solid #777777;">%(eve)s</td>
555                    <td valign="top" style="border-right:1px solid #777777;">%(ses)s</td>
556                                </tr>
557                            </table>
558                        </td>
559                    </tr>
560                    <tr>
561                        <td>
562                            <table align="center" cellspacing="10" width="100%%">
563                                <tr>
564                                    <td align="left" class="titleCellFormat" style="border-bottom: 1px solid #5294CC; padding-right:10px">  _("Display") %(checkDisplay)s%(uncheckDisplay)s</td>
565                                </tr>
566                                <tr>
567                                    <td valign="top" style="border-right:1px solid #777777;">%(disp)s</td>
568                                </tr>
569                            </table>
570                        </td>
571                    </tr>
572                    <tr>
573                        <td align="center" style="border-top:1px solid #777777;padding:10px"><input type="submit" class="btn" name="OK" value=  _("apply filter")></td>
574                    </tr>
575                </table>
576            </td>
577        </tr>
578    </table>""")
579        else:
580            menu =  _("""<table width="95%%" align="center" border="0" style="border-left: 1px solid #777777">
581        <tr>
582            <td class="groupTitle"><a href="%(openMenuURL)s"><img src=%(closeMenuImg)s alt="Show menu" border="0"></a>  _("Filtering criteria")</td>
583        </tr>
584        <tr><td align="left"><small>  _("Note that you can open the filtering criteria by clicking in the icon") <img src=%(closeMenuImg)s alt="Show menu" border="0">  _("which is above this line").</small></td></tr>
585    </table>""")
586
587        return menu
588
589
590    def getVars( self ):
591        vars = wcomponents.WTemplated.getVars( self )
592
593        sortingField = self._sortingCrit.getField()
594
595        vars["filterPostURL"]=quoteattr("%s#results"%str(urlHandlers.UHConfModifRegistrantList.getURL(self._conf)))
596        l=[]
597        cl = self._conf.getRegistrantsList(True)
598        f = filters.SimpleFilter(self._filterCrit,self._sortingCrit)
599        regl=[]
600        eventItems = self._conf.getRegistrationForm().getSocialEventForm().getSocialEventList()
601        vars["eve"]=""
602        vars["columns"]=self._getRegColumnHTML(sortingField)
603        for reg in f.apply(cl):
604            l.append(self._getRegistrantsHTML(reg))
605            regl.append(reg.getId())
606        if self._order =="up":
607            l.reverse()
608            regl.reverse()
609        vars["registrants"] = "".join(l)
610        vars["numRegistrants"]=str(len(l))
611        vars["actionPostURL"]=quoteattr(str(urlHandlers.UHConfModifRegistrantListAction.getURL(self._conf)))
612
613        if l == []:
614            vars["emailIconURL"]=""
615            vars["printIconURL"]=""
616            vars["infoIconURL"]=""
617            vars["excelIconURL"]=""
618            vars ["reglist"]=""
619        else:
620            vars ["reglist"]=",".join(regl)
621            vars["emailIconURL"]="""<input type="image" name="email" src=%s border="0">"""%quoteattr(str(Config.getInstance().getSystemIconURL("envelope")))
622            vars["printIconURL"]="""<input type="image" name="pdf" src=%s border="0">"""%quoteattr(str(Config.getInstance().getSystemIconURL("pdf")))
623            vars["infoIconURL"]="""<input type="image" name="info" src=%s border="0">"""%quoteattr(str(Config.getInstance().getSystemIconURL("info")))
624            vars["excelIconURL"]="""<input type="image" name="excel" src=%s border="0">"""%quoteattr(str(Config.getInstance().getSystemIconURL("excel")))
625        vars ["acom"] = self._getAcomHTML()
626        vars ["ses"]=self._getSessHTML()
627        vars ["eve"]+=self._getEventHTML()
628        vars ["disp"]= self._getDispHTML()
629        tit=self._conf.getRegistrationForm().getAccommodationForm().getTitle()
630        if not self._conf.getRegistrationForm().getAccommodationForm().isEnabled():
631            tit='%s <span style="color:red;font-size: 75%%">(disabled)</span>'%tit
632        vars ["accomtitle"]=tit
633        tit=self._conf.getRegistrationForm().getSessionsForm().getTitle()
634        if not self._conf.getRegistrationForm().getSessionsForm().isEnabled():
635            tit='%s <span style="color:red;font-size: 75%%">(disabled)</span>'%tit
636        vars["sesstitle"]=tit
637        tit=self._conf.getRegistrationForm().getSocialEventForm().getTitle()
638        if not self._conf.getRegistrationForm().getSocialEventForm().isEnabled():
639            tit='%s <span style="color:red;font-size: 75%%">(disabled)</span>'%tit
640        vars["eventtitle"]=tit
641        vars["displayOptions"]=self._getDisplayOptionsHTML()
642        vars["sortingOptions"]="""<input type="hidden" name="sortBy" value="%s">
643                                  <input type="hidden" name="order" value="%s">"""%(self._sortingCrit.getField().getId(), self._order)
644        vars["closeMenuURL"] = self._getCloseMenuURL()
645        vars["closeMenuImg"] = quoteattr(Config.getInstance().getSystemIconURL("openMenu"))
646        vars["openMenuURL"] = self._getOpenMenuURL()
647        vars["openMenuImg"] = quoteattr(Config.getInstance().getSystemIconURL("closeMenu"))
648
649        vars["checkAcco"] = """<img src=%s border="0" alt="Select all" onclick="javascript:selectAcco()">"""%quoteattr(Config.getInstance().getSystemIconURL("checkAll"))
650        vars["uncheckAcco"] = """<img src=%s border="0" alt="Unselect all" onclick="javascript:unselectAcco()">"""%quoteattr(Config.getInstance().getSystemIconURL("uncheckAll"))
651        vars["checkEvent"] = """<img src=%s border="0" alt="Select all" onclick="javascript:selectEvent()">"""%quoteattr(Config.getInstance().getSystemIconURL("checkAll"))
652        vars["uncheckEvent"] = """<img src=%s border="0" alt="Unselect all" onclick="javascript:unselectEvent()">"""%quoteattr(Config.getInstance().getSystemIconURL("uncheckAll"))
653        vars["checkSession"] = """<img src=%s border="0" alt="Select all" onclick="javascript:selectSession()">"""%quoteattr(Config.getInstance().getSystemIconURL("checkAll"))
654        vars["uncheckSession"] = """<img src=%s border="0" alt="Unselect all" onclick="javascript:unselectSession()">"""%quoteattr(Config.getInstance().getSystemIconURL("uncheckAll"))
655        vars["checkDisplay"] = """<img src=%s border="0" alt="Select all" onclick="javascript:selectDisplay()">"""%quoteattr(Config.getInstance().getSystemIconURL("checkAll"))
656        vars["uncheckDisplay"] = """<img src=%s border="0" alt="Unselect all" onclick="javascript:unselectDisplay()">"""%quoteattr(Config.getInstance().getSystemIconURL("uncheckAll"))
657
658        vars["menu"] = self._getMenu()%vars
659        return vars
660
661
662class WRegSentMail  (wcomponents.WTemplated):
663    def __init__(self,conf):
664        self._conf = conf
665
666    def getVars(self):
667        vars = wcomponents.WTemplated.getVars( self )
668        vars["BackURL"]=urlHandlers.UHConfModifRegistrantList.getURL(self._conf)
669        return vars
670
671
672class WPSentEmail( WPConfModifRegistrantListBase ):
673    def _getTabContent(self,params):
674        wc = WRegSentMail(self._conf)
675        return wc.getHTML()
676
677
678class WRegPreviewMail(wcomponents.WTemplated):
679    def __init__(self,conf, params):
680        self._conf = conf
681        self._params=params
682
683    def getVars(self):
684        vars = wcomponents.WTemplated.getVars( self )
685        fromAddr=self._params.get("from","")
686        cc=self._params.get("cc","")
687        subject=self._params.get("subject","")
688        body=self._params.get("body","")
689        regsIds=self._params.get("regsIds",[])
690        if type(regsIds) != list:
691            regsIds=[regsIds]
692        registrant=None
693        if len(regsIds)>0:
694            registrant=self._conf.getRegistrantById(regsIds[0])
695        vars["from"]=  _("""<center>  _("No preview avaible") </center>""")
696        vars["subject"]=  _("""<center>  _("No preview avaible") </center>""")
697        vars["body"]=  _("""<center> _("No preview avaible") </center>""")
698        vars["to"]=  _("""<center> _("No preview avaible") </center>""")
699        vars["cc"]=  _("""<center> _("No preview avaible") </center>""")
700        if registrant != None:
701            notif=EmailNotificator().apply(registrant,{"subject":subject, "body":body, "from":fromAddr, "to":[registrant.getEmail()], "cc": [cc]})
702            vars["from"]=notif.getFromAddr()
703            vars["to"]=notif.getToList()
704            vars["subject"]=notif.getSubject()
705            vars["body"] = notif.getBody()
706            vars["cc"] = notif.getCCList()
707        vars["params"]=[]
708        for regId in regsIds:
709            vars["params"].append("""<input type="hidden" name="regsIds" value="%s">"""%(regId))
710        vars["params"].append("""<input type="hidden" name="from" value=%s>"""%(quoteattr(fromAddr)))
711        vars["params"].append("""<input type="hidden" name="subject" value=%s>"""%(quoteattr(subject)))
712        vars["params"].append("""<input type="hidden" name="body" value=%s>"""%(quoteattr(body)))
713        vars["params"].append("""<input type="hidden" name="cc" value=%s>"""%(quoteattr(cc)))
714        vars["params"]="".join(vars["params"])
715        vars["postURL"]=urlHandlers.UHRegistrantsSendEmail.getURL(self._conf)
716        return vars
717
718
719class WPPreviewEmail( WPConfModifRegistrantListBase ):
720
721    def __init__(self, rh, conf, params):
722        WPConfModifRegistrantListBase.__init__(self, rh, conf)
723        self._params = params
724
725    def _getTabContent(self,params):
726        wc = WRegPreviewMail(self._conf, self._params)
727        return wc.getHTML()
728
729
730class WEmailToRegistrants(wcomponents.WTemplated):
731    def __init__(self,conf,user,reglist):
732        self._conf = conf
733        try:
734            self._fromemail = user.getEmail()
735        except:
736            self._fromemail = ""
737        self._regList = reglist
738
739    def _getAvailableTagsHTML(self):
740        res=[]
741        for var in EmailNotificator.getVarList():
742            res.append("""
743                    <tr>
744                            <td width="100%%" nowrap class="blacktext" style="padding-left:10px;padding-right:5px;">%s</td>
745                            <td>%s</td>
746                    </tr>"""%(self.htmlText(var.getLabel()),self.htmlText(var.getDescription())))
747        return "".join(res)
748
749    def getVars(self):
750        vars = wcomponents.WTemplated.getVars( self )
751        toEmails=[]
752        toIds=[]
753        for regId in self._regList:
754            reg=self._conf.getRegistrantById(regId)
755            if  reg!=None:
756                toEmails.append(reg.getEmail())
757                toIds.append("""<input type="hidden" name="regsIds" value="%s">"""%reg.getId())
758        vars["from"] = self._fromemail
759        vars["cc"] = ""
760        vars["toEmails"]= ", ".join(toEmails)
761        vars["toIds"]= "".join(toIds)
762        vars["postURL"]=urlHandlers.UHRegistrantsSendEmail.getURL(self._conf)
763        vars["subject"]=""
764        vars["body"]=""
765        vars["vars"]=self._getAvailableTagsHTML()
766        return vars
767
768class WPRegistrantModifRemoveConfirmation(WPConfModifRegistrantListBase):
769
770    def __init__(self,rh, conf, registrantList):
771        WPConfModifRegistrantListBase.__init__(self,rh,conf)
772        self._regList = registrantList
773
774    def _getTabContent(self,params):
775        wc=wcomponents.WConfirmation()
776        regs=[]
777        for reg in self._regList:
778            regs.append("<li><i>%s</i></li>"%self._conf.getRegistrantById(reg).getFullName())
779        msg=  _("""  _("Are you sure you want to delete the following registrants")?:<br><ul>%s</ul>
780        <font color="red"> _("(note you will permanently lose all the information about the registrants)")</font><br>""")%("".join(regs))
781        url=urlHandlers.UHConfModifRegistrantPerformRemove.getURL(self._conf)
782        return wc.getHTML(msg,url,{"registrants":self._regList})
783
784class WPEMail ( WPConfModifRegistrantListBase ):
785    def __init__(self, rh, conf, reglist):
786        WPConfModifRegistrantListBase.__init__(self, rh, conf)
787        self._regList = reglist
788
789    def _getTabContent(self,params):
790        wc = WEmailToRegistrants(self._conf, self._getAW().getUser(), self._regList)
791        return wc.getHTML()
792
793class WConfModifRegistrantsInfo(wcomponents.WTemplated):
794
795    def __init__(self,conf,reglist):
796        self._conf = conf
797        self._reglist = reglist
798
799    def _getAccommodationTypesInfoHTML(self):
800        accoDict = {}
801        for acco in self._conf.getRegistrationForm().getAccommodationForm().getAccommodationTypesList():
802            if acco is not None:
803                accoDict[acco]=0
804        total = 0
805        for reg in self._reglist:
806            acco = reg.getAccommodation().getAccommodationType()
807            if acco is not None:
808                if accoDict.has_key(acco):
809                    accoDict[acco] += 1
810                else:
811                    accoDict[acco] = 1
812                total += 1
813        html = []
814        for acco in accoDict.keys():
815            html.append("""
816                <tr>
817                    <td nowrap>%s</td>
818                    <td>&nbsp;&nbsp;&nbsp;</td>
819                    <td width="100%%" align="left"><b>%s</b></td>
820                </tr>
821                """%(acco.getCaption(), accoDict[acco]))
822        html.sort()
823        return "".join(html), total
824
825    def _getSocialEventsInfoHTML(self):
826        seCounter = {}
827        seObj = {}
828        for se in self._conf.getRegistrationForm().getSocialEventForm().getSocialEventList():
829            if se is not None:
830                seCounter[se.getId()]=0
831                seObj[se.getId()]=se
832        total = 0
833        for reg in self._reglist:
834            for se in reg.getSocialEvents():
835                if se is not None:
836                    if seCounter.has_key(se.getId()):
837                        seCounter[se.getId()] += se.getNoPlaces()
838                    else:
839                        seCounter[se.getId()] = se.getNoPlaces()
840                        seObj[se.getId()]=se
841                    total += se.getNoPlaces()
842        html = []
843        for se in seCounter.keys():
844            html.append("""
845                <tr>
846                    <td nowrap>%s</td>
847                    <td>&nbsp;&nbsp;&nbsp;</td>
848                    <td width="100%%" align="left"><b>%s</b></td>
849                </tr>
850                """%(seObj[se].getCaption(), seCounter[se]))
851        html.sort()
852        return "".join(html), total
853
854    def _getSessionsInfoHTML(self):
855        sesCounter = {}
856        sesObj = {}
857        for ses in self._conf.getRegistrationForm().getSessionsForm().getSessionList():
858            if ses is not None:
859                sesCounter[ses.getId()]=0
860                sesObj[ses.getId()]=ses
861        total = 0
862        for reg in self._reglist:
863            for ses in reg.getSessionList():
864                if ses is not None:
865                    if sesCounter.has_key(ses.getId()):
866                        sesCounter[ses.getId()] += 1
867                    else:
868                        sesCounter[ses.getId()] = 1
869                        sesObj[ses.getId()]=ses
870                    total += 1
871        html = []
872        for ses in sesCounter.keys():
873            html.append("""
874                <tr>
875                    <td nowrap>%s</td>
876                    <td>&nbsp;&nbsp;&nbsp;</td>
877                    <td width="100%%" align="left"><b>%s</b></td>
878                </tr>
879                """%(sesObj[ses].getTitle(), sesCounter[ses]))
880        html.sort()
881        return "".join(html), total
882
883    def getVars(self):
884        vars = wcomponents.WTemplated.getVars( self )
885        vars["accommodationTypes"], vars["numAccoTypes"] = self._getAccommodationTypesInfoHTML()
886        vars["socialEvents"], vars["numSocialEvents"] = self._getSocialEventsInfoHTML()
887        vars["sessions"], vars["numSessions"] = self._getSessionsInfoHTML()
888        vars["accoCaption"] = self._conf.getRegistrationForm().getAccommodationForm().getTitle()
889        vars["socialEventsCaption"] = self._conf.getRegistrationForm().getSocialEventForm().getTitle()
890        vars["sessionsCaption"] = self._conf.getRegistrationForm().getSessionsForm().getTitle()
891        vars["backURL"]=quoteattr(str(urlHandlers.UHConfModifRegistrantList.getURL(self._conf)))
892        return vars
893
894class WPRegistrantsInfo ( WPConfModifRegistrantListBase ):
895
896    def _getTabContent(self,params):
897        reglist = params["reglist"]
898        wc = WConfModifRegistrantsInfo(self._conf, reglist)
899        return wc.getHTML()
900
901
902class WPRegistrantBase( WPConferenceModifBase ):
903
904    def __init__( self, rh, registrant ):
905        self._registrant = self._target = registrant
906        WPConferenceModifBase.__init__( self, rh, self._registrant.getConference() )
907
908
909class WPRegistrantModifBase( WPRegistrantBase ):
910
911    def _getNavigationDrawer(self):
912        pars = {"target": self._conf, "isModif": True}
913        return wcomponents.WNavigationDrawer( pars, bgColor = "white" )
914
915    def _createTabCtrl( self ):
916        self._tabCtrl = wcomponents.TabControl()
917        self._tabMain = self._tabCtrl.newTab( "main", _("Main"), \
918                urlHandlers.UHRegistrantModification.getURL( self._target ) )
919        self._setActiveTab()
920        self._setupTabCtrl()
921
922    def _setActiveTab( self ):
923        pass
924
925    def _setupTabCtrl(self):
926        pass
927
928    def _setActiveSideMenuItem(self):
929        self._regFormMenuItem.setActive(True)
930
931    def _getPageContent( self, params ):
932        self._createTabCtrl()
933        banner = wcomponents.WRegFormBannerModif(self._target).getHTML()
934        html = wcomponents.WTabControl( self._tabCtrl, self._getAW() ).getHTML( self._getTabContent( params ) )
935        return banner+html
936
937    def _getTabContent( self, params ):
938        return  _("nothing")
939
940class WPRegistrantModifMain( WPRegistrantModifBase ):
941
942    def _setActiveTab( self ):
943        self._tabMain.setActive()
944
945
946class WPRegistrantModification( WPRegistrantModifMain ):
947
948    def _getTabContent( self, params ):
949        wc = WRegistrantModifMain(self._registrant)
950        return wc.getHTML()
951
952class WRegistrantModifMain( wcomponents.WTemplated ):
953
954    def __init__( self, registrant ):
955        self._registrant = registrant
956        self._conf = self._registrant.getConference()
957
958
959    def _getTransactionHTML(self):
960        if self._registrant.getPayed():
961            total=0
962            html=[]
963            currency = ""
964            html.append( _("""
965                        <tr>
966                        <tr><td colspan="4" class="title"><b> _("details") </b></td></tr>
967                        <tr>
968                            <td style="color:black"><b> _("Quantity") </b></td>
969                            <td style="color:black"><b> _("Item") </b></td>
970                            <td style="color:black"><b> _("Unit Price") </b></td>
971                            <td style="color:black"><b> _("Cost") </b></td>
972                            <td></td>
973                        </tr>
974                    """))
975            for gsf in self._registrant.getMiscellaneousGroupList():
976                regForm = self._conf.getRegistrationForm()
977                miscGroup=self._registrant.getMiscellaneousGroupById(gsf.getId())
978
979                if miscGroup is not None:
980                    for miscItem in miscGroup.getResponseItemList():
981                        _billlable=False
982                        price=0.0
983                        quantity=0
984                        caption=miscItem.getCaption()
985                        currency=miscItem.getCurrency()
986                        v= _("""--  _("no value selected") --""")
987                        if miscItem is not None:
988                            v=miscItem.getValue()
989                            if miscItem.isBillable():
990                                _billlable=miscItem.isBillable()
991                                caption=miscItem.getValue()
992                                price=string.atof(miscItem.getPrice())
993                                quantity=miscItem.getQuantity()
994                                total+=price*quantity
995
996                        gs = miscGroup.getGeneralSection()
997                        disSect = ""
998                        if not regForm.hasGeneralSectionForm(gs):
999                            disSect = """ <span style="color:red">(disabled or removed)</span>"""
1000                        if(quantity>0):
1001                            html.append("""
1002                                    <tr>
1003                                       <td ><b>%i</b></td>
1004                                       <td>%s:%s</td>
1005                                       <td align="right"nowrap >%s</td>
1006                                       <td align="right"nowrap >%s&nbsp;&nbsp;%s</td>
1007                                       <td>%s</td>
1008                                    </tr>
1009                                    """%(quantity,gsf.getTitle(),caption,price,price*quantity,currency,disSect) )
1010            html.append( _("""
1011                        <tr>&nbsp;</tr>
1012                        <tr>
1013                           <td ><b> _("TOTAL") </b></td>
1014                           <td></td>
1015                           <td></td>
1016                           <td align="right"nowrap>%s&nbsp;&nbsp;%s</td>
1017                        </tr>
1018                        """)%(total,currency))
1019            transHTML = ""
1020            if self._registrant.getTransactionInfo():
1021                transHTML = self._registrant.getTransactionInfo().getTransactionHTML()
1022            return  _("""<form action=%s method="POST">
1023                            <tr>
1024                              <td class="dataCaptionTD"><span class="dataCaptionFormat">  _("Amount")</span></td>
1025                              <td bgcolor="white" class="blacktext">%s</td>
1026                              <td valign="bottom"><input type="submit" name="Payment" value="_("modify")"></td>
1027                            </tr>
1028                            <tr>
1029                              <td class="dataCaptionTD"><span class="dataCaptionFormat"> _("Payment")</span></td>
1030                              <td bgcolor="white" class="blacktext">%s</td>
1031                              <td valign="bottom"></td>
1032                            </tr>
1033                              <td class="dataCaptionTD"></td>
1034                              <td bgcolor="white" class="blacktext"><table>%s</table></td>
1035                              <td valign="bottom"></td>
1036                            </tr>
1037                            <tr>
1038                              <td colspan="3" class="horizontalLine">&nbsp;</td>
1039                            </tr>
1040                     </form>
1041                 """)%(quoteattr(str(urlHandlers.UHConfModifRegistrantTransactionModify.getURL(self._registrant))), "%.2f %s"%(self._registrant.getTotal(), self._registrant.getConference().getRegistrationForm().getCurrency()), transHTML,"".join(html))
1042        elif self._registrant.doPay():
1043            urlEpayment=""
1044            if self._registrant.getConference().hasEnabledSection("epay") and self._registrant.getConference().getModPay().isActivated() and self._registrant.doPay():
1045                urlEpayment = """<br/><br/><i>Direct access link for epayment:</i><br/><small>%s</small>"""%escape(str(urlHandlers.UHConfRegistrationFormCreationDone.getURL(self._registrant)))
1046            return _(""" <form action=%s method="POST">
1047                            <tr>
1048                              <td class="dataCaptionTD"><span class="dataCaptionFormat">_("Amount")</span></td>
1049                              <td bgcolor="white" class="blacktext">%s</td>
1050                            </tr>
1051                            <tr>
1052                              <td class="dataCaptionTD"><span class="dataCaptionFormat">_("Payment")</span></td>
1053                              <td bgcolor="white" class="blacktext">%s%s</td>
1054                              <td valign="bottom"><input type="submit" name="Payment" value="_("modify")" class="btn"></td>
1055                            </tr>
1056                            <tr>
1057                              <td colspan="3" class="horizontalLine">&nbsp;</td>
1058                            </tr>
1059                            </form>
1060                            """)%(quoteattr(str(urlHandlers.UHConfModifRegistrantTransactionModify.getURL(self._registrant))), "%.2f %s"%(self._registrant.getTotal(), self._registrant.getConference().getRegistrationForm().getCurrency()),"unpaid",urlEpayment)
1061        else :
1062            return  _(""" <form action="" method="POST">
1063                            <tr>
1064                              <td class="dataCaptionTD"><span class="dataCaptionFormat"> _("Payment")</span></td>
1065                              <td bgcolor="white" class="blacktext">%s</td>
1066                              <td valign="bottom"></td>
1067                            </tr>
1068                            <tr>
1069                              <td colspan="3" class="horizontalLine">&nbsp;</td>
1070                            </tr>
1071                            </form>
1072                            """)%(" --- ")
1073
1074
1075    def _getSessionsHTML(self):
1076        regForm = self._conf.getRegistrationForm()
1077        sessions = self._registrant.getSessionList()
1078        if regForm.getSessionsForm().isEnabled():
1079            if regForm.getSessionsForm().getType() == "2priorities":
1080                session1 =  _("""<font color=\"red\">--  _("not selected") --</font>""")
1081                session2 =  _("""--  _("not selected") --""")
1082                if len(sessions) > 0:
1083                    session1 = sessions[0].getTitle()
1084                    if sessions[0].isCancelled():
1085                        session1 =  _("""%s <font color=\"red\">( _("cancelled") )""")%session1
1086                if len(sessions) > 1:
1087                    session2 = sessions[1].getTitle()
1088                    if sessions[1].isCancelled():
1089                        session2 =  _("""%s <font color=\"red\"> ( _("cancelled") )""")%session2
1090                text=  _("""
1091                        <table>
1092                          <tr>
1093                            <td align="right"><b> _("First Priority"):</b></td>
1094                            <td align="left">%s</td>
1095                          </tr>
1096                          <tr>
1097                            <td align="right"><b> _("Other option"):</b></td>
1098                            <td align="left">%s</td>
1099                          </tr>
1100                        </table>
1101                        """)%(session1, session2)
1102                return  _("""
1103                        <form action=%s method="POST">
1104                        <tr>
1105                          <td class="dataCaptionTD"><span class="dataCaptionFormat"> _("Sessions")</span></td>
1106                          <td bgcolor="white" class="blacktext">%s</td>
1107                          <td valign="bottom"><input type="submit" class="btn" name="sesmod" value="_("modify")"></td>
1108                        </tr>
1109                        <tr>
1110                          <td colspan="3" class="horizontalLine">&nbsp;</td>
1111                        </tr>
1112                        </form>
1113                        """)%(quoteattr(str(urlHandlers.UHConfModifRegistrantSessionModify.getURL(self._registrant))), text)
1114            if regForm.getSessionsForm().getType() == "all":
1115                sessionList =  _("""<font color=\"red\">--_("not selected")--</font>""")
1116                if len(sessions) > 0:
1117                    sessionList=["<ul>"]
1118                    for ses in sessions:
1119                        sesText = "<li>%s</li>"%ses.getTitle()
1120                        if ses.isCancelled():
1121                            sesText =  _("""<li>%s <font color=\"red\"> ( _("cancelled") )</font></li>""")%ses.getTitle()
1122                        sessionList.append(sesText)
1123                    sessionList.append("</ul>")
1124                    sessionList="".join(sessionList)
1125                text= """
1126                        <table>
1127                          <tr>
1128                            <td align="left">%s</td>
1129                          </tr>
1130                        </table>
1131                        """%(sessionList)
1132                return  _("""
1133                        <form action=%s method="POST">
1134                        <tr>
1135                          <td class="dataCaptionTD"><span class="dataCaptionFormat"> _("Sessions")</span></td>
1136                          <td bgcolor="white" class="blacktext">%s</td>
1137                          <td valign="bottom"><input type="submit" class="btn" name="sesmod" value="_("modify")"></td>
1138                        </tr>
1139                        <tr>
1140                          <td colspan="3" class="horizontalLine">&nbsp;</td>
1141                        </tr>
1142                        </form>
1143                        """)%(quoteattr(str(urlHandlers.UHConfModifRegistrantSessionModify.getURL(self._registrant))), text)
1144        return ""
1145
1146    def _getAccommodationHTML(self):
1147        regForm = self._conf.getRegistrationForm()
1148        if regForm.getAccommodationForm().isEnabled():
1149            accommodation = self._registrant.getAccommodation()
1150            accoType =   _("""<font color=\"red\">--_("not selected")--</font>""")
1151            cancelled = ""
1152            if accommodation is not None and accommodation.getAccommodationType() is not None:
1153                accoType = accommodation.getAccommodationType().getCaption()
1154                if accommodation.getAccommodationType().isCancelled():
1155                    cancelled =  _("""<font color=\"red\"> _("(disabled)")</font>""")
1156            arrivalDate =  _("""<font color=\"red\">--_("not selected")--</font>""")
1157            if accommodation is not None and accommodation.getArrivalDate() is not None:
1158                arrivalDate = accommodation.getArrivalDate().strftime("%d-%B-%Y")
1159            departureDate =  _("""<font color=\"red\">--_("not selected")--</font>""")
1160            if accommodation is not None and accommodation.getDepartureDate() is not None:
1161                departureDate = accommodation.getDepartureDate().strftime("%d-%B-%Y")
1162            text =  _("""
1163                        <table>
1164                          <tr>
1165                            <td align="right"><b> _("Arrival date"):</b></td>
1166                            <td align="left">%s</td>
1167                          </tr>
1168                          <tr>
1169                            <td align="right"><b> _("Departure date"):</b></td>
1170                            <td align="left">%s</td>
1171                          </tr>
1172                          <tr>
1173                            <td align="right"><b> _("Accommodation type"):</b></td>
1174                            <td align="left">%s %s</td>
1175                          </tr>
1176                        </table>
1177                        """)%(arrivalDate, departureDate, \
1178                                accoType, cancelled)
1179            return  _("""
1180                    <form action=%s method="POST">
1181                    <tr>
1182                      <td class="dataCaptionTD"><span class="dataCaptionFormat"> _("Accommodation")</span></td>
1183                      <td bgcolor="white" class="blacktext">%s</td>
1184                      <td valign="bottom"><input type="submit" class="btn" name="acomod" value="_("modify")"></td>
1185                    </tr>
1186                    <tr>
1187                      <td colspan="3" class="horizontalLine">&nbsp;</td>
1188                    </tr>
1189                    </form>
1190                    """)%(quoteattr(str(urlHandlers.UHConfModifRegistrantAccoModify.getURL(self._registrant))), text)
1191        return ""
1192
1193    def _getSocialEventsHTML(self):
1194        regForm = self._conf.getRegistrationForm()
1195        text = ""
1196        if regForm.getSocialEventForm().isEnabled():
1197            socialEvents = self._registrant.getSocialEvents()
1198            r = []
1199            for se in socialEvents:
1200                cancelled = ""
1201                if se.isCancelled():
1202                    cancelled =  _("""<font color=\"red\"> ( _("cancelled") )</font>""")
1203                    if se.getCancelledReason().strip():
1204                        cancelled =  _("""<font color=\"red\">( _("cancelled"): %s)</font>""")%se.getCancelledReason().strip()
1205                r.append( _("""
1206                            <tr>
1207                              <td align="left">%s <b>[%s _("place(s) needed")]</b> %s</td>
1208                            </tr>
1209                         """)%(se.getCaption(), se.getNoPlaces(), cancelled))
1210            if r == []:
1211                text = _("""--_("no social events selected")--""")
1212            else:
1213                text = """
1214                        <table>
1215                          %s
1216                        </table>
1217                        """%("".join(r))
1218            text = _("""
1219                    <form action=%s method="POST">
1220                    <tr>
1221                      <td class="dataCaptionTD"><span class="dataCaptionFormat"> _("Social events")</span></td>
1222                      <td bgcolor="white" class="blacktext">%s</td>
1223                      <td valign="bottom"><input type="submit" class="btn" name="socmod" value="_("modify")"></td>
1224                    </tr>
1225                    <tr>
1226                      <td colspan="3" class="horizontalLine">&nbsp;</td>
1227                    </tr>
1228                    </form>
1229                    """)%(quoteattr(str(urlHandlers.UHConfModifRegistrantSocialEventsModify.getURL(self._registrant))), text)
1230        return text
1231
1232    def _getReasonParticipationHTML(self):
1233        regForm = self._conf.getRegistrationForm()
1234        if regForm.getReasonParticipationForm().isEnabled():
1235            return _("""
1236                    <form action=%s method="POST">
1237                    <tr>
1238                      <td class="dataCaptionTD"><span class="dataCaptionFormat"> _("Reason for participation") </span></td>
1239                      <td bgcolor="white" class="blacktext">%s</td>
1240                      <td valign="bottom"><input type="submit" class="btn" name="reamod" value="_("modify")"></td>
1241                    </tr>
1242                    <tr>
1243                      <td colspan="3" class="horizontalLine">&nbsp;</td>
1244                    </tr>
1245                    </form>
1246                    """)%(quoteattr(str(urlHandlers.UHConfModifRegistrantReasonPartModify.getURL(self._registrant))), self.htmlText( self._registrant.getReasonParticipation() ))
1247        return ""
1248
1249    def _getMiscInfoItemsHTML(self, gsf):
1250        miscGroup=self._registrant.getMiscellaneousGroupById(gsf.getId())
1251        html=["""<table>"""]
1252        #########
1253        #jmf start
1254        #for f in gsf.getFields():
1255        for f in gsf.getSortedFields():
1256        #jmf end
1257        #########
1258            miscItem=None
1259            if miscGroup is not None:
1260                miscItem=miscGroup.getResponseItemById(f.getId())
1261            v= _("""--_("no value selected")--""")
1262            if miscItem is not None:
1263                v=miscItem.getValue()
1264            html.append("""
1265                    <tr>
1266                       <td align="left" style="max-width: 25%%" valign="top"><b>%s:</b></td>
1267                       <td align="left" valign="top">%s</td>
1268                    </tr>
1269                    <tr><td>&nbsp;</td></tr>
1270                    """%(f.getCaption(), v) )
1271        if miscGroup is not None:
1272            for miscItem in miscGroup.getResponseItemList():
1273                    f=gsf.getFieldById(miscItem.getId())
1274                    if f is None:
1275                        html.append( _("""
1276                                    <tr>
1277                                       <td align="left" style="max-width: 25%%"><b>%s:</b></td>
1278                                       <td align="left">%s <font color="red">(cancelled)</font></td>
1279                                    </tr>
1280                                    <tr><td>&nbsp;</td></tr>
1281                                    """) %(miscItem.getCaption(), miscItem.getValue()) )
1282        if len(html)==1:
1283            html.append( _("""
1284                        <tr><td><font color="black"><i> --_("No fields")--</i></font></td></tr>
1285                        """))
1286        html.append("</table>")
1287        return "".join(html)
1288
1289    def _getMiscellaneousInfoHTML(self, gsf):
1290        regForm = self._conf.getRegistrationForm()
1291        html=[]
1292        url=urlHandlers.UHConfModifRegistrantMiscInfoModify.getURL(self._registrant)
1293        url.addParam("miscInfoId", gsf.getId())
1294        html.append( _("""
1295            <form action=%s method="POST">
1296            <tr>
1297              <td class="dataCaptionTD" valign="top"><span class="dataCaptionFormat">%s</span></td>
1298              <td bgcolor="white" class="blacktext" valign="top">%s</td>
1299              <td valign="bottom"><input type="submit" class="btn" name="" value="_("modify")"></td>
1300            </tr>
1301            <tr>
1302              <td colspan="3" class="horizontalLine">&nbsp;</td>
1303            </tr>
1304            </form>
1305            """)%(quoteattr(str(url)), gsf.getTitle(), self._getMiscInfoItemsHTML(gsf) ) )
1306        return "".join(html)
1307   
1308    def _getFormSections(self):
1309        sects = []
1310        regForm = self._conf.getRegistrationForm()
1311        for formSection in regForm.getSortedForms():
1312            if formSection.getId() == "reasonParticipation":
1313                sects.append(self._getReasonParticipationHTML())
1314            elif formSection.getId() == "sessions":
1315                sects.append(self._getSessionsHTML())
1316            elif formSection.getId() == "accommodation":
1317                sects.append(self._getAccommodationHTML())
1318            elif formSection.getId() == "socialEvents":
1319                sects.append(self._getSocialEventsHTML())
1320            elif formSection.getId() == "furtherInformation":
1321                pass
1322            else:
1323                sects.append(self._getMiscellaneousInfoHTML(formSection))
1324        return "".join(sects)
1325
1326    def _getStatusesHTML(self):
1327        regForm = self._conf.getRegistrationForm()
1328        url=urlHandlers.UHConfModifRegistrantStatusesModify.getURL(self._registrant)
1329        if regForm.getStatusesList() == []:
1330            return ""
1331        html=["""<table>"""]
1332        for st in regForm.getStatusesList():
1333            rst=self._registrant.getStatusById(st.getId())
1334            vcap=" -- no value --"
1335            if rst.getStatusValue() is not None:
1336                vcap=rst.getStatusValue().getCaption()
1337            html.append("""
1338                        <tr>
1339                            <td align="left"><b>%s</b>: %s</td>
1340                        </tr>
1341                        """%(rst.getCaption(), vcap))
1342        html.append("""</table>""")
1343        html=[ _("""
1344                    <form action=%s method="POST">
1345                    <tr>
1346                      <td class="dataCaptionTD"><span class="dataCaptionFormat"> _("Statuses")</span></td>
1347                      <td bgcolor="white" class="blacktext">%s</td>
1348                      <td valign="bottom"><input type="submit" class="btn" name="" value="_("modify")"></td>
1349                    </tr>
1350                    <tr>
1351                      <td colspan="3" class="horizontalLine">&nbsp;</td>
1352                    </tr>
1353                    </form>
1354                    """)%(quoteattr(str(url)), "".join(html) ) ]
1355        return "".join(html)
1356
1357    def getVars( self ):
1358        vars = wcomponents.WTemplated.getVars( self )
1359        vars["id"] = self._registrant.getId()
1360        vars["title"] = self.htmlText( self._registrant.getTitle() )
1361        vars["familyName"] = self.htmlText( self._registrant.getFamilyName() )
1362        vars["firstName"] = self.htmlText( self._registrant.getFirstName() )
1363        vars["position"] = self.htmlText( self._registrant.getPosition() )
1364        vars["institution"] = self.htmlText( self._registrant.getInstitution() )
1365        vars["address"] = self.htmlText( self._registrant.getAddress() )
1366        vars["city"] = self.htmlText( self._registrant.getCity() )
1367        vars["country"] = self.htmlText( CountryHolder().getCountryById(self._registrant.getCountry()) )
1368        vars["phone"] = self.htmlText( self._registrant.getPhone() )
1369        vars["fax"] = self.htmlText( self._registrant.getFax() )
1370        vars["email"] = self.htmlText( self._registrant.getEmail() )
1371        vars["personalHomepage"] = self.htmlText( self._registrant.getPersonalHomepage() )
1372        vars["registrationDate"] = _("""--_("date unknown")--""")
1373        if self._registrant.getRegistrationDate() is not None:
1374            vars["registrationDate"] = "%s (%s)"%(self._registrant.getAdjustedRegistrationDate().strftime("%d-%B-%Y %H:%M"), self._conf.getTimezone())
1375        vars["dataModificationURL"] = quoteattr(str(urlHandlers.UHRegistrantDataModification.getURL(self._registrant)))
1376        vars["sections"] = self._getFormSections()
1377        vars["statuses"]=self._getStatusesHTML()
1378
1379        vars["transaction"]=self._getTransactionHTML()
1380        return vars
1381
1382class WPRegistrantDataModification( WPRegistrantModifMain ):
1383
1384    def _getTabContent( self, params ):
1385        wc = WRegistrantDataModification(self._registrant)
1386        return wc.getHTML()
1387
1388class WRegistrantDataModification( wcomponents.WTemplated ):
1389
1390    def __init__( self, registrant ):
1391        self._registrant = registrant
1392        self._conf = self._registrant.getConference()
1393
1394    def _getItemHTML(self, item, value):
1395        inputHTML = ""
1396        if item.getInput() == "list":
1397            if item.getId() == "title":
1398                for title in TitlesRegistry().getList():
1399                    selected = ""
1400                    if value == title:
1401                        selected = "selected"
1402                    inputHTML += """<option value="%s" %s>%s</option>"""%(title, selected, title)
1403                inputHTML = """<select name="%s">%s</select>"""%(item.getId(), inputHTML)
1404            elif item.getId() == "country":
1405                for ck in CountryHolder().getCountrySortedKeys():
1406                    selected = ""
1407                    if value == ck:
1408                        selected = "selected"
1409                    inputHTML += """<option value="%s" %s>%s</option>"""%(ck, selected, CountryHolder().getCountryById(ck))
1410                inputHTML = """<select name="%s">%s</select>"""%(item.getId(), inputHTML)
1411        else:
1412            input = item.getInput()
1413            if item.getId() == "email":
1414                input = "text"
1415            inputHTML = """<input type="%s" name="%s" size="40" value="%s">"""%(input, item.getId(), value)
1416        mandatory="&nbsp; &nbsp;"
1417        if item.isMandatory():
1418            mandatory = """<font color="red">* </font>"""
1419        html = """
1420                <tr>
1421                    <td nowrap class="titleCellTD">%s<span class="titleCellFormat">%s</span></td>
1422                    <td width="100%%" align="left" bgcolor="white" class="blacktext">%s</td>
1423                </tr>
1424                """%(mandatory, item.getName(), inputHTML)
1425        return html
1426
1427    def getVars( self ):
1428        vars = wcomponents.WTemplated.getVars( self )
1429        personalData = self._conf.getRegistrationForm().getPersonalData()
1430        data = []
1431        sortedKeys = personalData.getSortedKeys()
1432        formValues = personalData.getValuesFromRegistrant(self._registrant)
1433        for key in sortedKeys:
1434            item = personalData.getDataItem(key)
1435            data.append(self._getItemHTML(item, formValues.get(item.getId(), "")))
1436        vars["data"] = "".join(data)
1437        vars["postURL"] = quoteattr(str(urlHandlers.UHRegistrantPerformDataModification.getURL(self._registrant)))
1438        return vars
1439
1440class WConfModifRegistrantSessionsBase(wcomponents.WTemplated):
1441
1442    def __init__(self, registrant):
1443        self._registrant = registrant
1444        self._conf = self._registrant.getConference()
1445        self._sessionForm = self._conf.getRegistrationForm().getSessionsForm()
1446
1447    def getVars(self):
1448        vars = wcomponents.WTemplated.getVars( self )
1449        vars["title"] = self._sessionForm.getTitle()
1450        return vars
1451
1452class WConfModifRegistrantSessions2PrioritiesModify(WConfModifRegistrantSessionsBase):
1453
1454    def _getSessionsHTML(self, selectName, sessionValue):
1455        selected = ""
1456        if sessionValue is None:
1457            selected = "selected"
1458        html = [ _("""<select name="%s">
1459                        <option value="nosession" %s>--_("None selected")--</option>""")%(selectName, selected)]
1460        for ses in self._sessionForm.getSessionList(True):
1461            selected = ""
1462            if ses == sessionValue:
1463                selected = "selected"
1464            html.append("""
1465                    <option value="%s" %s>%s</option>
1466                    """%(ses.getId(), selected, ses.getTitle()) )
1467        html = """%s</select>"""%("".join(html))
1468        return html
1469
1470    def getVars(self):
1471        vars = WConfModifRegistrantSessionsBase.getVars( self )
1472        ses1 = None
1473        if len(self._registrant.getSessionList())>0:
1474            ses1 = self._registrant.getSessionList()[0]
1475        vars ["sessions1"] = self._getSessionsHTML("session1", ses1)
1476        ses2 = None
1477        if len(self._registrant.getSessionList())>1:
1478            ses2 = self._registrant.getSessionList()[1]
1479        vars["sessions2"] = self._getSessionsHTML("session2", ses2)
1480        return vars
1481
1482
1483
1484class WPRegistrantTransactionModify( WPRegistrantModifMain ):
1485
1486    def _getTabContent( self, params ):
1487        wc = WConfModifRegistrantTransactionModify(self._registrant)
1488        p={"postURL":quoteattr(str(urlHandlers.UHConfModifRegistrantTransactionPeformModify.getURL(self._registrant)))}
1489        return wc.getHTML(p)
1490
1491class WConfModifRegistrantTransactionModify(WConfModifRegistrantSessionsBase):
1492
1493    def _getTransactionHTML(self):
1494        transaction = self._registrant.getTransactionInfo()
1495        tmp=""
1496        checkedYes=""
1497        checkedNo=""
1498        if (transaction is None):
1499            checkedNo="selected"
1500        elif (transaction is None or transaction.isChangeable()):
1501            checkedYes="selected"
1502        tmp=  _("""<select name="isPayed"><option value="yes" %s> _("yes")</option><option value="no" %s> _("no")</option></select>""")%(checkedYes, checkedNo)
1503        return tmp
1504
1505    def getVars(self):
1506        vars = wcomponents.WTemplated.getVars( self )
1507        vars ["transation"] = self._getTransactionHTML()
1508        vars ["price"] = self._registrant.getTotal()
1509        vars ["Currency"] = self._registrant.getRegistrationForm().getCurrency()
1510        return vars
1511
1512class WPRegistrantSessionModify( WPRegistrantModifMain ):
1513
1514    def _getTabContent( self, params ):
1515        if self._registrant.getRegistrationForm().getSessionsForm().getType()=="all":
1516            wc = WConfModifRegistrantSessionsAllModify(self._registrant)
1517        else:
1518            wc = WConfModifRegistrantSessions2PrioritiesModify(self._registrant)
1519        p={"postURL":quoteattr(str(urlHandlers.UHConfModifRegistrantSessionPeformModify.getURL(self._registrant)))}
1520        return wc.getHTML(p)
1521
1522class WConfModifRegistrantSessionsAllModify(WConfModifRegistrantSessionsBase):
1523
1524    def _getSessionsHTML(self):
1525        html=[]
1526        for session in self._registrant.getRegistrationForm().getSessionsForm().getSessionList():
1527            selected=""
1528            if session in self._registrant.getSessionList():
1529                selected=" checked"
1530            html.append("""<input type="checkbox" name="sessions" value="%s"%s>%s"""%(session.getId(), selected, session.getTitle()) )
1531        return "<br>".join(html)
1532
1533    def getVars(self):
1534        vars = WConfModifRegistrantSessionsBase.getVars( self )
1535        vars ["sessions"] = self._getSessionsHTML()
1536        return vars
1537
1538class WConfModifRegistrantAccommodationModify(wcomponents.WTemplated):
1539
1540    def __init__(self, registrant):
1541        self._registrant = registrant
1542        self._conf = self._registrant.getConference()
1543        self._accommodation = self._conf.getRegistrationForm().getAccommodationForm()
1544
1545    def _getDatesHTML(self, name, currentDate, startDate=None, endDate=None):
1546        if name=="arrivalDate":
1547            dates = self._accommodation.getArrivalDates()
1548        elif name=="departureDate":
1549            dates = self._accommodation.getDepartureDates()
1550        else:
1551            dates = []
1552            curDate = startDate = self._conf.getStartDate() - timedelta(days=1)
1553            endDate = self._conf.getEndDate() + timedelta(days=1)
1554            while curDate <= endDate:
1555                dates.append(curDate)
1556                curDate += timedelta(days=1)
1557        selected = ""
1558        if currentDate is None:
1559            selected = "selected"
1560        html = ["""
1561                <select name="%s">
1562                <option value="nodate" %s>-- select a date --</option>
1563                """%(name, selected)]
1564        for date in dates:
1565            selected = ""
1566            if currentDate is not None and currentDate.strftime("%d-%B-%Y") == date.strftime("%d-%B-%Y"):
1567                selected = "selected"
1568            html.append("""
1569                        <option value=%s %s>%s</option>
1570                        """%(quoteattr(str(date.strftime("%d-%B-%Y"))), selected, date.strftime("%d-%B-%Y")))
1571        html.append("</select>")
1572        return "".join(html)
1573
1574    def _getAccommodationTypesHTML(self, currentAccoType):
1575        html=[]
1576        for type in self._accommodation.getAccommodationTypesList():
1577            if not type.isCancelled():
1578                selected = ""
1579                if currentAccoType == type:
1580                    selected = "checked=\"checked\""
1581                html.append("""<tr>
1582                                    <td align="left" style="padding-left:10px"><input type="radio" name="accommodationType" value="%s" %s>%s</td>
1583                                </tr>
1584                            """%(type.getId(), selected, type.getCaption() ) )
1585            else:
1586                html.append( _("""<tr>
1587                                 <td align="left" style="padding-left:10px">&nbsp;&nbsp;&nbsp;<b>-</b> %s <font color="red">( _("not available at present") )</font></td>
1588                               </tr>
1589                            """)%(type.getCaption() ) )
1590        if currentAccoType is not None and currentAccoType.isCancelled() and currentAccoType not in self._accommodation.getAccommodationTypesList():
1591            html.append("""<tr>
1592                                <td align="left" style="padding-left:10px">&nbsp;&nbsp;&nbsp;<b>-</b> %s <font color="red">( _("not available at present") )</font></td>
1593                            </tr>
1594                        """%(currentAccoType.getCaption() ) )
1595        return "".join(html)
1596
1597
1598    def getVars(self):
1599        vars = wcomponents.WTemplated.getVars( self )
1600        acco = self._registrant.getAccommodation()
1601        currentArrivalDate = None
1602        currentDepartureDate = None
1603        currentAccoType = None
1604        if acco is not None:
1605            currentArrivalDate = acco.getArrivalDate()
1606            currentDepartureDate = acco.getDepartureDate()
1607            currentAccoType = acco.getAccommodationType()
1608        vars["title"] = self._accommodation.getTitle()
1609        vars["arrivalDate"] = self._getDatesHTML("arrivalDate", currentArrivalDate)
1610        vars["departureDate"] = self._getDatesHTML("departureDate", currentDepartureDate)
1611        vars["accommodationTypes"] = self._getAccommodationTypesHTML(currentAccoType)
1612        return vars
1613
1614class WPRegistrantAccommodationModify( WPRegistrantModifMain ):
1615
1616    def _getTabContent( self, params ):
1617        wc = WConfModifRegistrantAccommodationModify(self._registrant)
1618        p={"postURL":quoteattr(str(urlHandlers.UHConfModifRegistrantAccoPeformModify.getURL(self._registrant)))}
1619        return wc.getHTML(p)
1620
1621class WConfModifRegistrantSocialEventsModify(wcomponents.WTemplated):
1622
1623    def __init__(self, registrant):
1624        self._registrant = registrant
1625        self._conf = self._registrant.getConference()
1626        self._socialEvents = self._conf.getRegistrationForm().getSocialEventForm()
1627
1628    def _getSocialEventsHTML(self, socialEvents=[]):
1629        html=[]
1630        for se in self._socialEvents.getSocialEventList():
1631            if not se.isCancelled():
1632                checked = ""
1633                for ser in socialEvents:
1634                    if se == ser.getSocialEventItem():
1635                        se = ser
1636                        checked = "checked=\"checked\""
1637                        break
1638                optList = []
1639                for i in range(1, 10):
1640                    selected = ""
1641                    if isinstance(se, registration.SocialEvent) and i == se.getNoPlaces():
1642                        selected = " selected"
1643                    optList.append("""<option value="%s"%s>%s"""%(i, selected, i))
1644
1645                html.append("""<tr>
1646                                    <td align="left" nowrap style="padding-left:10px"><input type="checkbox" name="socialEvents" value="%s" %s>%s&nbsp;&nbsp;
1647                                    </td>
1648                                    <td width="100%%" align="left">
1649                                    <select name="places-%s">
1650                                       %s
1651                                    </select>
1652                                    </td>
1653                                </tr>
1654                            """%(se.getId(), checked, se.getCaption(), se.getId(), "".join(optList) ) )
1655            else:
1656                cancelledReason = "(cancelled)"
1657                if se.getCancelledReason().strip():
1658                    cancelledReason = "(cancelled: %s)"%se.getCancelledReason().strip()
1659                html.append("""<tr>
1660                                        <td align="left" colspan="2" nowrap style="padding-left:10px">&nbsp;&nbsp;&nbsp;<b>-</b> %s <font color="red">%s</font></td>
1661                                    </tr>
1662                                """%(se.getCaption(), cancelledReason ) )
1663        for se in socialEvents:
1664            if se.isCancelled and se.getSocialEventItem() not in self._socialEvents.getSocialEventList():
1665                cancelledReason = "cancelled"
1666                if se.getCancelledReason().strip():
1667                    cancelledReason = "(cancelled: %s)"%se.getCancelledReason().strip()
1668                html.append("""<tr>
1669                                    <td align="left" colspan="2" nowrap style="padding-left:10px">&nbsp;&nbsp;&nbsp;<b>-</b> %s <font color="red">%s</font></td>
1670                                </tr>
1671                            """%(se.getCaption(), cancelledReason ) )
1672        return "".join(html)
1673
1674
1675    def getVars(self):
1676        vars = wcomponents.WTemplated.getVars( self )
1677        regSocialEvents = self._registrant.getSocialEvents()
1678        vars["title"] = self._socialEvents.getTitle()
1679        vars["socialEvents"] = self._getSocialEventsHTML(regSocialEvents)
1680        return vars
1681
1682class WPRegistrantSocialEventsModify( WPRegistrantModifMain ):
1683
1684    def _getTabContent( self, params ):
1685        wc = WConfModifRegistrantSocialEventsModify(self._registrant)
1686        p={"postURL":quoteattr(str(urlHandlers.UHConfModifRegistrantSocialEventsPeformModify.getURL(self._registrant)))}
1687        return wc.getHTML(p)
1688
1689class WConfModifRegistrantReasonParticipationModify(wcomponents.WTemplated):
1690
1691    def __init__(self, registrant):
1692        self._registrant = registrant
1693        self._conf = self._registrant.getConference()
1694        self._reasonParticipation = self._conf.getRegistrationForm().getReasonParticipationForm()
1695
1696
1697    def getVars(self):
1698        vars = wcomponents.WTemplated.getVars( self )
1699        vars["title"] = self._reasonParticipation.getTitle()
1700        vars["reasonParticipation"] = self._registrant.getReasonParticipation()
1701        return vars
1702
1703class WPRegistrantReasonParticipationModify( WPRegistrantModifMain ):
1704
1705    def _getTabContent( self, params ):
1706        wc = WConfModifRegistrantReasonParticipationModify(self._registrant)
1707        p={"postURL":quoteattr(str(urlHandlers.UHConfModifRegistrantReasonPartPeformModify.getURL(self._registrant)))}
1708        return wc.getHTML(p)
1709
1710class WConfModifRegistrantMiscInfoModify(wcomponents.WTemplated):
1711
1712    def __init__(self, miscGroup):
1713        self._miscGroup = miscGroup
1714        self._registrant = self._miscGroup.getRegistrant()
1715        self._conf = self._registrant.getConference()
1716
1717    def _getFieldsHTML(self):
1718        html=[]
1719        ############
1720        # jmf-start
1721        #for f in self._miscGroup.getGeneralSection().getFields():
1722        for f in self._miscGroup.getGeneralSection().getSortedFields():
1723        # jmf-start
1724        ############
1725            v=""
1726            miscItem = None
1727            if self._miscGroup.getResponseItemById(f.getId()) is not None:
1728                miscItem=self._miscGroup.getResponseItemById(f.getId())
1729                v=miscItem.getValue()
1730                price=v=miscItem.getPrice()
1731            html.append("""
1732                        <tr>
1733                          <td>
1734                             %s
1735                          </td>
1736                        </tr>
1737                        """%(f.getInput().getModifHTML(miscItem, self._registrant)) )
1738        return "".join(html)
1739
1740
1741    def getVars(self):
1742        vars = wcomponents.WTemplated.getVars( self )
1743        vars["title"] = self._miscGroup.getTitle()
1744        vars["fields"] = self._getFieldsHTML()
1745        return vars
1746
1747class WPRegistrantMiscInfoModify( WPRegistrantModifMain ):
1748
1749    def __init__( self, rh, miscGroup ):
1750        WPRegistrantModifMain.__init__( self, rh, miscGroup.getRegistrant() )
1751        self._miscGroup=miscGroup
1752
1753    def _getTabContent( self, params ):
1754        wc = WConfModifRegistrantMiscInfoModify(self._miscGroup)
1755        p={"postURL":quoteattr(str(urlHandlers.UHConfModifRegistrantMiscInfoPerformModify.getURL(self._miscGroup)))}
1756        return wc.getHTML(p)
1757
1758class WConfModifRegistrantStatusesModify(wcomponents.WTemplated):
1759
1760    def __init__(self, reg):
1761        self._conf = reg.getConference()
1762        self._registrant = reg
1763
1764    def _getStatusHTML(self, st):
1765        html=["""<table>"""]
1766        rst=self._registrant.getStatusById(st.getId())
1767        somechecked=False
1768        for v in st.getStatusValuesList():
1769            checked=""
1770            if rst.getStatusValue() is not None and v.getId() == rst.getStatusValue().getId():
1771                somechecked=True
1772                checked=" checked"
1773            html.append("""
1774                        <tr><td><input type="radio" name="statuses-%s" value="%s"%s>%s</td></tr>
1775                        """%(st.getId(), v.getId(), checked, v.getCaption()))
1776        checked=""
1777        if not somechecked:
1778            checked=" checked"
1779        html.insert(1, _("""
1780                        <tr><td><input type="radio" name="statuses-%s" value="novalue"%s>--_("no value")--</td></tr>
1781                        """)%(st.getId(), checked))
1782        html.append("""</table>""")
1783        return "".join(html)
1784
1785
1786    def getVars(self):
1787        vars = wcomponents.WTemplated.getVars( self )
1788        html=["""<table border="0" cellpadding="0" cellspacing="0" valign="top">"""]
1789        for st in self._conf.getRegistrationForm().getStatusesList():
1790            html.append("""
1791                        <tr>
1792                          <td align="right" valign="top" style="border-bottom:1px solid #777777"><b>%s:</b> </td>
1793                          <td align="left" valign="top" style="border-bottom:1px solid #777777">%s</td>
1794                        </tr>
1795                        """%(st.getCaption(), self._getStatusHTML(st)))
1796        html.append("""</table>""")
1797        vars["statuses"]="".join(html)
1798        return vars
1799
1800class WPRegistrantStatusesModify( WPRegistrantModifMain ):
1801
1802    def _getTabContent( self, params ):
1803        wc = WConfModifRegistrantStatusesModify(self._registrant)
1804        p={"postURL":quoteattr(str(urlHandlers.UHConfModifRegistrantStatusesPerformModify.getURL(self._registrant)))}
1805        return wc.getHTML(p)
1806
1807# ----------------- DISPLAY AREA ---------------------------
1808
1809class WPConfRegistrantsList( WPConferenceDefaultDisplayBase ):
1810
1811    def _getBody( self, params ):
1812        sortingCrit=params.get("sortingCrit",None)
1813        filterCrit=params.get("filterCrit",None)
1814        sessionFilterName=params.get("sessionFilterName", "session")
1815        order = params.get("order",None)
1816        wc = WConfRegistrantsList( self._conf, filterCrit, sortingCrit, order, sessionFilterName)
1817        return wc.getHTML()
1818
1819    def _defineSectionMenu( self ):
1820        WPConferenceDefaultDisplayBase._defineSectionMenu( self )
1821        self._sectionMenu.setCurrentItem(self._registrantsListOpt)
1822
1823class WConfRegistrantsList( wcomponents.WTemplated ):
1824
1825    def __init__( self, conference, filterCrit, sortingCrit, order, sessionFilterName ):
1826        self._conf = conference
1827        self._regForm = self._conf.getRegistrationForm()
1828        self._filterCrit=filterCrit
1829        self._sortingCrit=sortingCrit
1830        self._order=order
1831        self._sessionFilterName=sessionFilterName
1832
1833    def _getURL( self ):
1834        #builds the URL to the contribution list page
1835        #   preserving the current filter and sorting status
1836        url = urlHandlers.UHConfRegistrantsList.getURL(self._conf)
1837#        if self._filterCrit.getField("accomm"):
1838#            url.addParam("accomm",self._filterCrit.getField("accomm").getValues())
1839#            if self._filterCrit.getField("accomm").getShowNoValue():
1840#                url.addParam("accommShowNoValue","1")
1841#
1842        if self._filterCrit.getField(self._sessionFilterName):
1843            url.addParam("session",self._filterCrit.getField(self._sessionFilterName).getValues())
1844            if self._filterCrit.getField(self._sessionFilterName).getShowNoValue():
1845                url.addParam("sessionShowNoValue","1")
1846
1847        if self._sessionFilterName == "sessionfirstpriority":
1848            url.addParam("firstChoice", "1")
1849#
1850#        if self._filterCrit.getField("event"):
1851#            url.addParam("event",self._filterCrit.getField("event").getValues())
1852#            if self._filterCrit.getField("event").getShowNoValue():
1853#                url.addParam("eventShowNoValue","1")
1854#
1855        if self._sortingCrit.getField():
1856            url.addParam("sortBy",self._sortingCrit.getField().getId())
1857            url.addParam("order","down")
1858
1859#        url.addParam("disp",self._getDisplay())
1860
1861        return url
1862
1863    def _getRegistrantsHTML( self, reg ):
1864        fullName = reg.getFullName()
1865        institution = ""
1866        if self._regForm.getPersonalData().getDataItem("institution").isEnabled():
1867            institution = """<td valign="top" class="abstractDataCell">%s</td>"""%(self.htmlText(reg.getInstitution()) or "&nbsp;")
1868        position = ""
1869        if self._regForm.getPersonalData().getDataItem("position").isEnabled():
1870            position = """<td valign="top" class="abstractDataCell">%s</td>"""%(self.htmlText(reg.getPosition()) or "&nbsp;")
1871        city = ""
1872        if self._regForm.getPersonalData().getDataItem("city").isEnabled():
1873            city = """<td valign="top" class="abstractDataCell">%s</td>"""%(self.htmlText(reg.getCity()) or "&nbsp;")
1874        country = ""
1875        if self._regForm.getPersonalData().getDataItem("country").isEnabled():
1876            country = """<td valign="top" class="abstractDataCell">%s</td>"""%(self.htmlText(CountryHolder().getCountryById(reg.getCountry())) or "&nbsp;")
1877        sessions=""
1878        if self._regForm.getSessionsForm().isEnabled():
1879            sessionList = []
1880            for ses in reg.getSessionList():
1881                sessionList.append(self.htmlText(ses.getCode()))
1882            sessions = "<br>".join(sessionList)
1883            sessions = """<td valign="top" class="abstractDataCell" nowrap>%s</td>"""%(sessions or "&nbsp;")
1884        html = """
1885            <tr>
1886                <td valign="top" nowrap class="abstractLeftDataCell">%s</td>
1887                %s
1888                %s
1889                %s
1890                %s
1891                %s
1892            </tr>
1893                """%(self.htmlText(fullName),
1894                    institution,
1895                    position, city,
1896                    country,
1897                    sessions)
1898        return html
1899
1900    def _getSessHTML(self):
1901        sessform =self._regForm.getSessionsForm()
1902        sesstypes = sessform.getSessionList()
1903        checked=""
1904        if self._filterCrit.getField(self._sessionFilterName).getShowNoValue():
1905            checked=" checked"
1906        res=[ _("""<input type="checkbox" name="sessionShowNoValue" value="--none--"%s> --_("not specified")--""")%checked]
1907        for sess in sesstypes:
1908            checked=""
1909            if sess.getId() in self._filterCrit.getField(self._sessionFilterName).getValues():
1910                checked=" checked"
1911            res.append("""<input type="checkbox" name="session" value=%s%s>%s"""%(quoteattr(str(sess.getId())),checked,self.htmlText(sess.getTitle())))
1912        if sessform.getType() == "2priorities":
1913            checked=""
1914            if self._sessionFilterName == "sessionfirstpriority":
1915                checked=" checked"
1916            res.append( _("""<b>------</b><br><input type="checkbox" name="firstChoice" value="firstChoice"%s><i> _("Only by first choice") </i>""")%checked)
1917        return "<br>".join(res)
1918
1919    def _getFilterOptionsHTML(self, currentSortingHTML):
1920        filterPostURL=quoteattr("%s#results"%str(urlHandlers.UHConfRegistrantsList.getURL(self._conf)))
1921        return _("""<tr>
1922        <td width="100%%">
1923                    <br>
1924                    <form action=%s method="POST">
1925                        %s
1926                        <table width="100%%" align="center" border="0" style="border-left: 1px solid #777777;border-top: 1px solid #777777;">
1927                            <tr>
1928                                <td class="groupTitle" style="background:#E5E5E5; color:gray">&nbsp;&nbsp;&nbsp; _("Display options") </td>
1929                            </tr>
1930                            <tr>
1931                                <td>
1932                                    <table width="100%%">
1933                                        <tr>
1934                                            <td>
1935                                                <table align="center" cellspacing="10" width="100%%">
1936                                                    <tr>
1937                                                        <td align="center" class="titleCellFormat" style="border-bottom: 1px solid #5294CC;"> _("show sessions") </td>
1938                                                    </tr>
1939                                                    <tr>
1940                                                        <td valign="top" style="border-right:1px solid #777777;">%s</td>
1941                                                    </tr>
1942                                                </table>
1943                                            </td>
1944                                        </tr>
1945                                        <tr>
1946                                            <td align="center" style="border-top:1px solid #777777;padding:10px"><input type="submit" class="btn" name="OK" value="_("apply filter")"></td>
1947                                        </tr>
1948                                    </table>
1949                                </td>
1950                            </tr>
1951                        </table>
1952                    </form>
1953        </td>
1954            </tr>
1955                """)%(filterPostURL, currentSortingHTML, self._getSessHTML())
1956
1957    def getVars( self ):
1958        vars = wcomponents.WTemplated.getVars( self )
1959        vars["regForm"]= self._regForm
1960        l=[]
1961        lr=self._conf.getRegistrantsList(True)
1962        f = filters.SimpleFilter(self._filterCrit,self._sortingCrit)
1963        for rp in f.apply(lr):
1964            l.append(self._getRegistrantsHTML(rp))
1965        if self._order =="up":
1966            l.reverse()
1967        vars["registrants"] = "".join(l)
1968        vars["numRegistrants"]=str(len(l))
1969
1970        # Head Table Titles
1971        currentSorting=""
1972        if self._sortingCrit.getField() is not None:
1973            currentSorting=self._sortingCrit.getField().getSpecialId()
1974
1975        currentSortingHTML = ""
1976        # --- Name
1977        url=self._getURL()
1978        url.addParam("sortBy","Name")
1979        nameImg=""
1980        vars["imgNameTitle"]=""
1981        if currentSorting == "Name":
1982            currentSortingHTML = """<input type="hidden" name="sortBy" value="Name">"""
1983            if self._order == "down":
1984                vars["imgNameTitle"] = """<img src=%s alt="down">"""%(quoteattr(Config.getInstance().getSystemIconURL("downArrow")))
1985                url.addParam("order","up")
1986            elif self._order == "up":
1987                vars["imgNameTitle"] = """<img src=%s alt="up">"""%(quoteattr(Config.getInstance().getSystemIconURL("upArrow")))
1988                url.addParam("order","down")
1989        vars["urlNameTitle"]=quoteattr("%s#results"%str(url))
1990
1991        # --- Institution
1992        url=self._getURL()
1993        url.addParam("sortBy","Institution")
1994        nameImg=""
1995        vars["imgInstitutionTitle"]=""
1996        if currentSorting == "Institution":
1997            currentSortingHTML = """<input type="hidden" name="sortBy" value="Institution">"""
1998            if self._order == "down":
1999                vars["imgInstitutionTitle"] = """<img src=%s alt="down">"""%(quoteattr(Config.getInstance().getSystemIconURL("downArrow")))
2000                url.addParam("order","up")
2001            elif self._order == "up":
2002                vars["imgInstitutionTitle"] = """<img src=%s alt="up">"""%(quoteattr(Config.getInstance().getSystemIconURL("upArrow")))
2003                url.addParam("order","down")
2004        vars["urlInstitutionTitle"]=quoteattr("%s#results"%str(url))
2005
2006        # --- Position
2007        url=self._getURL()
2008        url.addParam("sortBy","Position")
2009        nameImg=""
2010        vars["imgPositionTitle"]=""
2011        if currentSorting == "Position":
2012            currentSortingHTML = """<input type="hidden" name="sortBy" value="Position">"""
2013            if self._order == "down":
2014                vars["imgPositionTitle"] = """<img src=%s alt="down">"""%(quoteattr(Config.getInstance().getSystemIconURL("downArrow")))
2015                url.addParam("order","up")
2016            elif self._order == "up":
2017                vars["imgPositionTitle"] = """<img src=%s alt="up">"""%(quoteattr(Config.getInstance().getSystemIconURL("upArrow")))
2018                url.addParam("order","down")
2019        vars["urlPositionTitle"]=quoteattr("%s#results"%str(url))
2020
2021        # --- City
2022        url=self._getURL()
2023        url.addParam("sortBy","City")
2024        nameImg=""
2025        vars["imgCityTitle"]=""
2026        if currentSorting == "City":
2027            currentSortingHTML = """<input type="hidden" name="sortBy" value="City">"""
2028            if self._order == "down":
2029                vars["imgCityTitle"] = """<img src=%s alt="down">"""%(quoteattr(Config.getInstance().getSystemIconURL("downArrow")))
2030                url.addParam("order","up")
2031            elif self._order == "up":
2032                vars["imgCityTitle"] = """<img src=%s alt="up">"""%(quoteattr(Config.getInstance().getSystemIconURL("upArrow")))
2033                url.addParam("order","down")
2034        vars["urlCityTitle"]=quoteattr("%s#results"%str(url))
2035
2036
2037        # --- Country
2038        url=self._getURL()
2039        url.addParam("sortBy","Country")
2040        nameImg=""
2041        vars["imgCountryTitle"]=""
2042        if currentSorting == "Country":
2043            currentSortingHTML = """<input type="hidden" name="sortBy" value="Country">"""
2044            if self._order == "down":
2045                vars["imgCountryTitle"] = """<img src=%s alt="down">"""%(quoteattr(Config.getInstance().getSystemIconURL("downArrow")))
2046                url.addParam("order","up")
2047            elif self._order == "up":
2048                vars["imgCountryTitle"] = """<img src=%s alt="up">"""%(quoteattr(Config.getInstance().getSystemIconURL("upArrow")))
2049                url.addParam("order","down")
2050        vars["urlCountryTitle"]=quoteattr("%s#results"%str(url))
2051
2052        # --- Sessions
2053
2054        vars["sessionsTitle"] = ""
2055        if self._regForm.getSessionsForm().isEnabled():
2056            url=self._getURL()
2057            url.addParam("sortBy","Sessions")
2058            nameImg=""
2059            imgSessionTitle=""
2060            if currentSorting == "Sessions":
2061                currentSortingHTML = """<input type="hidden" name="sortBy" value="Sessions">"""
2062                if self._order == "down":
2063                    imgSessionTitle = """<img src=%s alt="down">"""%(quoteattr(Config.getInstance().getSystemIconURL("downArrow")))
2064                    url.addParam("order","up")
2065                elif self._order == "up":
2066                    imgSessionTitle = """<img src=%s alt="up">"""%(quoteattr(Config.getInstance().getSystemIconURL("upArrow")))
2067                    url.addParam("order","down")
2068            urlSessionTitle=quoteattr("%s#results"%str(url))
2069            vars["sessionsTitle"] = """<td nowrap class="titleCellFormat" style="border-right:5px solid #FFFFFF;border-left:5px solid #FFFFFF;border-bottom: 1px solid #5294CC;">%s<a href=%s>%s</a></td>"""%(imgSessionTitle, urlSessionTitle, self._conf.getRegistrationForm().getSessionsForm().getTitle())
2070
2071        # --- Filter Options
2072        vars["filterOptions"]=""
2073        if self._regForm.getSessionsForm().isEnabled():
2074            vars["filterOptions"]=self._getFilterOptionsHTML(currentSortingHTML)
2075        return vars
2076#------------------------------------------------------------------------------------------------------------------------
2077"""
2078Badge Printing classes
2079"""
2080class WRegistrantModifPrintBadges( wcomponents.WTemplated ):
2081
2082    def __init__( self, conference, selectedRegistrants, user=None ):
2083        self.__conf = conference
2084        self._user=user
2085        self.__selectedRegistrants = selectedRegistrants
2086
2087    def getVars( self ):
2088        vars = wcomponents.WTemplated.getVars( self )
2089
2090        vars['CreatePDFURL']=str(urlHandlers.UHConfModifBadgePrintingPDF.getURL(self.__conf))
2091        vars['registrantNamesList'] = "; ".join([self.__conf.getRegistrantById(id).getFullName() for id in self.__selectedRegistrants])
2092        vars['registrantList'] = ",".join(self.__selectedRegistrants)
2093        vars['badgeDesignURL'] = str(urlHandlers.UHConfModifBadgePrinting.getURL(self.__conf))
2094
2095        templateListHTML = []
2096        first = True
2097
2098        nTemplates = len(self.__conf.getBadgeTemplateManager().getTemplates())
2099        nColumns = 3
2100        nPerColumn = int(math.ceil(nTemplates / nColumns))
2101
2102        n = 0
2103        templateListHTML.append("""              <tr>""")
2104
2105        sortedTemplates = self.__conf.getBadgeTemplateManager().getTemplates().items()
2106        sortedTemplates.sort(lambda item1, item2: cmp(item1[1].getName(), item2[1].getName()))
2107        for templateId, template in sortedTemplates:
2108
2109            templateListHTML.append("""                <td>""")
2110
2111            radio = []
2112            radio.append("""                  <input type="radio" name="templateId" value='""")
2113            radio.append(str(templateId))
2114            radio.append("""' id='""")
2115            radio.append(str(templateId))
2116            radio.append("""'""")
2117            if first:
2118                first = False
2119                radio.append(""" CHECKED """)
2120            radio.append(""">""")
2121            templateListHTML.append("".join(radio))
2122            templateListHTML.append("".join (["""                  """,
2123                                              """<label for='""",
2124                                              str(templateId),
2125                                              """'>""",
2126                                              template.getName(),
2127                                              """</label>""",
2128                                              """&nbsp;&nbsp;&nbsp;"""]))
2129
2130            templateListHTML.append("""                </td>""")
2131
2132            n = n + 1
2133            if n == nPerColumn + 1:
2134                n = 0
2135                templateListHTML.append("""              </tr>""")
2136                templateListHTML.append("""              <tr>""")
2137
2138
2139
2140        templateListHTML.append("""              </tr>""")
2141        vars["templateList"] = "\n".join(templateListHTML)
2142
2143        wcPDFOptions = WConfModifBadgePDFOptions(self.__conf)
2144        vars['PDFOptions'] = wcPDFOptions.getHTML()
2145
2146        return vars
2147
2148
2149class WPRegistrantModifPrintBadges( WPConfModifRegistrantListBase ):
2150
2151    def __init__(self, rh, conf, selectedRegistrants):
2152        WPConfModifRegistrantListBase.__init__(self, rh, conf)
2153        self._selectedRegistrants = selectedRegistrants
2154
2155    def _getTabContent( self, params ):
2156        wc = WRegistrantModifPrintBadges( self._conf, selectedRegistrants = self._selectedRegistrants )
2157        return wc.getHTML()
Note: See TracBrowser for help on using the repository browser.