[FIX] Book of Abstracts setup sort by
[cds-indico.git] / indico / MaKaC / webinterface / pages / conferences.py
blobf43baef1d94ea2b12e663d1405b6db300faf5945
1 # -*- coding: utf-8 -*-
2 ##
3 ##
4 ## This file is part of Indico.
5 ## Copyright (C) 2002 - 2013 European Organization for Nuclear Research (CERN).
6 ##
7 ## Indico is free software; you can redistribute it and/or
8 ## modify it under the terms of the GNU General Public License as
9 ## published by the Free Software Foundation; either version 3 of the
10 ## License, or (at your option) any later version.
12 ## Indico is distributed in the hope that it will be useful, but
13 ## WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ## General Public License for more details.
17 ## You should have received a copy of the GNU General Public License
18 ## along with Indico;if not, see <http://www.gnu.org/licenses/>.
20 import collections
21 import os
22 import random
23 import urllib
24 from indico.util import json
26 from datetime import timedelta, datetime
27 from xml.sax.saxutils import quoteattr, escape
29 import MaKaC.webinterface.wcomponents as wcomponents
30 import MaKaC.webinterface.urlHandlers as urlHandlers
31 import MaKaC.webinterface.displayMgr as displayMgr
32 import MaKaC.webinterface.timetable as timetable
33 import MaKaC.webinterface.linking as linking
34 import MaKaC.webinterface.navigation as navigation
35 import MaKaC.schedule as schedule
36 import MaKaC.conference as conference
37 import MaKaC.webinterface.materialFactories as materialFactories
38 import MaKaC.common.filters as filters
39 from MaKaC.common.utils import isStringHTML, formatDateTime, formatDate
40 import MaKaC.common.utils
41 import MaKaC.review as review
42 from MaKaC.webinterface.pages.base import WPDecorated
43 from MaKaC.webinterface.common.tools import strip_ml_tags, escape_html
44 from MaKaC.webinterface.materialFactories import ConfMFRegistry,PaperFactory,SlidesFactory,PosterFactory
45 from MaKaC.common import Config
46 from MaKaC.webinterface.common.abstractStatusWrapper import AbstractStatusList
47 from MaKaC.webinterface.common.contribStatusWrapper import ContribStatusList
48 from MaKaC.common.output import outputGenerator
49 from MaKaC.webinterface.general import strfFileSize
50 from MaKaC.webinterface.common.timezones import TimezoneRegistry
51 from MaKaC.PDFinterface.base import PDFSizes
52 from pytz import timezone
53 from MaKaC.common.timezoneUtils import nowutc, DisplayTZ
54 from MaKaC.badgeDesignConf import BadgeDesignConfiguration
55 from MaKaC.posterDesignConf import PosterDesignConfiguration
56 from MaKaC.webinterface.pages import main
57 from MaKaC.webinterface.pages import base
58 from MaKaC.webinterface.materialFactories import MaterialFactoryRegistry
59 import MaKaC.common.info as info
60 from MaKaC.common.cache import EventCache
61 from MaKaC.i18n import _
62 from indico.util.i18n import i18nformat
63 from indico.util.date_time import format_time, format_date, format_datetime
64 import MaKaC.webcast as webcast
66 from MaKaC.common.fossilize import fossilize
67 from MaKaC.fossils.conference import IConferenceEventInfoFossil
68 from MaKaC.common.Conversion import Conversion
69 from MaKaC.common.logger import Logger
70 from MaKaC.plugins.base import OldObservable
71 from MaKaC.plugins.base import extension_point
72 from MaKaC.common import Configuration
73 from indico.modules import ModuleHolder
74 from MaKaC.paperReviewing import ConferencePaperReview as CPR
75 from MaKaC.conference import Session, Contribution, LocalFile
76 from MaKaC.common.Configuration import Config
77 from MaKaC.common.utils import formatDateTime
78 from MaKaC.user import AvatarHolder
79 from MaKaC.webinterface.general import WebFactory
82 def stringToDate( str ):
83 #Don't delete this dictionary inside comment. Its purpose is to add the dictionary in the language dictionary during the extraction!
84 #months = { _("January"):1, _("February"):2, _("March"):3, _("April"):4, _("May"):5, _("June"):6, _("July"):7, _("August"):8, _("September"):9, _("October"):10, _("November"):11, _("December"):12 }
85 months = { "January":1, "February":2, "March":3, "April":4, "May":5, "June":6, "July":7, "August":8, "September":9, "October":10, "November":11, "December":12 }
86 [ day, month, year ] = str.split("-")
87 return datetime(int(year),months[month],int(day))
90 class WPConferenceBase( base.WPDecorated ):
92 def __init__( self, rh, conference ):
93 WPDecorated.__init__( self, rh )
94 self._navigationTarget = self._conf = conference
95 tz = self._tz = DisplayTZ(rh._aw,self._conf).getDisplayTZ()
96 sDate = self.sDate = self._conf.getAdjustedScreenStartDate(tz)
97 eDate = self.eDate = self._conf.getAdjustedScreenEndDate(tz)
98 dates=" (%s)"%format_date(sDate, format='long')
99 if sDate.strftime("%d%B%Y") != eDate.strftime("%d%B%Y"):
100 if sDate.strftime("%B%Y") == eDate.strftime("%B%Y"):
101 dates=" (%s-%s)"%(sDate.strftime("%d"), format_date(eDate, format='long'))
102 else:
103 dates=" (%s - %s)"%(format_date(sDate, format='long'), format_date(eDate, format='long'))
104 self._setTitle( "%s %s"%(strip_ml_tags(self._conf.getTitle()), dates ))
106 def _getFooter( self ):
109 wc = wcomponents.WFooter()
111 p = {"modificationDate": format_datetime(self._conf.getModificationDate(), format='d MMMM yyyy H:mm'),
112 "subArea": self._getSiteArea()
114 return wc.getHTML(p)
116 def getLoginURL( self ):
117 wf = self._rh.getWebFactory()
118 if wf:
119 return WPDecorated.getLoginURL(self)
121 return urlHandlers.UHConfSignIn.getURL(self._conf,"%s"%self._rh.getCurrentURL())
123 def getLogoutURL( self ):
124 return urlHandlers.UHSignOut.getURL(str(urlHandlers.UHConferenceDisplay.getURL(self._conf)))
127 class WPConferenceDisplayBase( WPConferenceBase, OldObservable ):
129 def getCSSFiles(self):
130 # flatten returned list
132 return WPConferenceBase.getCSSFiles(self) + \
133 sum(self._notify('injectCSSFiles'), [])
135 class WPConferenceDefaultDisplayBase( WPConferenceBase):
136 navigationEntry = None
138 def getJSFiles(self):
139 return WPConferenceBase.getJSFiles(self) + \
140 self._includeJSPackage('MaterialEditor') + sum(self._notify('injectJSFiles'), [])
142 def _getFooter( self ):
143 wc = wcomponents.WFooter()
144 p = {"modificationDate": format_datetime(self._conf.getModificationDate(), format='d MMMM yyyy H:mm'),
145 "subArea": self._getSiteArea()}
147 cid = self._conf.getUrlTag().strip() or self._conf.getId()
148 p["shortURL"] = Config.getInstance().getShortEventURL() + cid
150 self._notify('eventDetailFooter', p)
152 return wc.getHTML(p)
154 def _getHeader( self ):
157 wc = wcomponents.WConferenceHeader( self._getAW(), self._conf )
158 return wc.getHTML( { "loginURL": self.getLoginURL(),\
159 "logoutURL": self.getLogoutURL(),\
160 "confId": self._conf.getId(), \
161 "dark": True} )
163 def _defineSectionMenu( self ):
165 awUser = self._getAW().getUser()
166 self._sectionMenu = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu()
167 self._overviewOpt = self._sectionMenu.getLinkByName("overview")
168 self._programOpt = self._sectionMenu.getLinkByName("programme")
169 link = self._programOpt
170 self._cfaOpt = self._sectionMenu.getLinkByName("CFA")
171 self._cfaNewSubmissionOpt = self._sectionMenu.getLinkByName("SubmitAbstract")
172 self._cfaViewSubmissionsOpt = self._sectionMenu.getLinkByName("ViewAbstracts")
173 self._abstractsBookOpt = self._sectionMenu.getLinkByName("abstractsBook")
174 if not self._conf.getAbstractMgr().isActive() or not self._conf.hasEnabledSection("cfa"):
175 self._cfaOpt.setVisible(False)
176 self._abstractsBookOpt.setVisible(False)
177 else:
178 self._cfaOpt.setVisible(True)
179 self._abstractsBookOpt.setVisible(True)
180 self._trackMgtOpt = self._sectionMenu.getLinkByName("manageTrack")
182 #registration form
183 self._regFormOpt = self._sectionMenu.getLinkByName("registrationForm")
184 self._viewRegFormOpt = self._sectionMenu.getLinkByName("ViewMyRegistration")
185 self._newRegFormOpt = self._sectionMenu.getLinkByName("NewRegistration")
186 if awUser != None:
187 self._viewRegFormOpt.setVisible(awUser.isRegisteredInConf(self._conf))
188 self._newRegFormOpt.setVisible(not awUser.isRegisteredInConf(self._conf))
189 else:
190 self._viewRegFormOpt.setVisible(False)
191 self._newRegFormOpt.setVisible(True)
192 self._registrantsListOpt = self._sectionMenu.getLinkByName("registrants")
193 if not self._conf.getRegistrationForm().isActivated() or not self._conf.hasEnabledSection("regForm"):
194 self._regFormOpt.setVisible(False)
195 self._registrantsListOpt.setVisible(False)
196 else:
197 self._regFormOpt.setVisible(True)
198 self._registrantsListOpt.setVisible(True)
201 #instant messaging
202 self._notify('confDisplaySMShow', {})
204 #evaluation
205 evaluation = self._conf.getEvaluation()
206 self._evaluationOpt = self._sectionMenu.getLinkByName("evaluation")
207 self._newEvaluationOpt = self._sectionMenu.getLinkByName("newEvaluation")
208 self._viewEvaluationOpt = self._sectionMenu.getLinkByName("viewMyEvaluation")
209 self._evaluationOpt.setVisible(self._conf.hasEnabledSection("evaluation") and evaluation.isVisible() and evaluation.getNbOfQuestions()>0)
210 if awUser!=None and awUser.hasSubmittedEvaluation(evaluation):
211 self._newEvaluationOpt.setVisible(not awUser.hasSubmittedEvaluation(evaluation))
212 self._viewEvaluationOpt.setVisible(awUser.hasSubmittedEvaluation(evaluation))
213 else:
214 self._newEvaluationOpt.setVisible(True)
215 self._viewEvaluationOpt.setVisible(False)
219 self._sectionMenu.setCurrentItem(None)
221 self._timetableOpt = self._sectionMenu.getLinkByName("timetable")
222 self._contribListOpt = self._sectionMenu.getLinkByName("contributionList")
223 self._authorIndexOpt = self._sectionMenu.getLinkByName("authorIndex")
224 self._speakerIndexOpt = self._sectionMenu.getLinkByName("speakerIndex")
225 self._myStuffOpt=self._sectionMenu.getLinkByName("mystuff")
226 self._myStuffOpt.setVisible(awUser is not None)
227 self._mySessionsOpt=self._sectionMenu.getLinkByName("mysessions")
228 ls = set(self._conf.getCoordinatedSessions(awUser)) | set(self._conf.getManagedSession(awUser))
229 self._mySessionsOpt.setVisible(len(ls)>0)
230 self._myTracksOpt=self._sectionMenu.getLinkByName("mytracks")
231 lt=self._conf.getCoordinatedTracks(awUser)
232 self._myTracksOpt.setVisible(len(lt)>0)
233 if not self._conf.getAbstractMgr().isActive():
234 self._myTracksOpt.setVisible(False)
235 self._myContribsOpt=self._sectionMenu.getLinkByName("mycontribs")
236 lc=self._conf.getContribsForSubmitter(awUser)
237 self._myContribsOpt.setVisible(len(lc)>0)
238 self._trackMgtOpt.setVisible(len(lt)>0)
239 if not self._conf.getAbstractMgr().isActive():
240 self._trackMgtOpt.setVisible(False)
242 #paper reviewing related
243 self._paperReviewingOpt = self._sectionMenu.getLinkByName("paperreviewing")
244 self._paperReviewingMgtOpt=self._sectionMenu.getLinkByName("managepaperreviewing")
245 self._paperReviewingMgtOpt.setVisible(False)
247 self._assignContribOpt=self._sectionMenu.getLinkByName("assigncontributions")
248 self._assignContribOpt.setVisible(False)
250 self._judgeListOpt=self._sectionMenu.getLinkByName("judgelist")
251 self._judgeListOpt.setVisible(False)
252 self._judgereviewerListOpt=self._sectionMenu.getLinkByName("judgelistreviewer")
254 self._judgereviewerListOpt.setVisible(False)
255 self._judgeeditorListOpt=self._sectionMenu.getLinkByName("judgelisteditor")
256 self._judgeeditorListOpt.setVisible(False)
258 self._uploadPaperOpt = self._sectionMenu.getLinkByName("uploadpaper")
259 self._downloadTemplateOpt = self._sectionMenu.getLinkByName("downloadtemplate")
261 if self._conf.getConfPaperReview().hasReviewing():
262 self._paperReviewingOpt.setVisible(True)
263 # These options are shown if there is any contribution of this user
264 self._uploadPaperOpt.setVisible(len(lc)>0)
265 self._downloadTemplateOpt.setVisible(len(lc)>0)
266 else:
267 self._paperReviewingOpt.setVisible(False)
268 self._uploadPaperOpt.setVisible(False)
269 self._downloadTemplateOpt.setVisible(False)
272 if awUser != None:
274 conferenceRoles = awUser.getLinkedTo()["conference"]
276 if "paperReviewManager" in conferenceRoles:
277 if self._conf in awUser.getLinkedTo()["conference"]["paperReviewManager"]:
278 self._paperReviewingMgtOpt.setVisible(True)
279 self._assignContribOpt.setVisible(True)
280 self._uploadPaperOpt.setVisible(len(lc)>0)
281 self._downloadTemplateOpt.setVisible(True)
283 if "referee" in conferenceRoles and "editor" in conferenceRoles and "reviewer" in conferenceRoles:
284 showrefereearea = self._conf in awUser.getLinkedTo()["conference"]["referee"]
285 showreviewerarea = self._conf in awUser.getLinkedTo()["conference"]["reviewer"]
286 showeditorarea = self._conf in awUser.getLinkedTo()["conference"]["editor"]
288 if showrefereearea and (self._conf.getConfPaperReview().getChoice() == CPR.CONTENT_REVIEWING or self._conf.getConfPaperReview().getChoice() == CPR.CONTENT_AND_LAYOUT_REVIEWING):
289 self._assignContribOpt.setVisible(True)
290 self._judgeListOpt.setVisible(True)
292 if showreviewerarea and (self._conf.getConfPaperReview().getChoice() == CPR.CONTENT_REVIEWING or self._conf.getConfPaperReview().getChoice() == CPR.CONTENT_AND_LAYOUT_REVIEWING):
293 self._judgereviewerListOpt.setVisible(True)
295 if showeditorarea and (self._conf.getConfPaperReview().getChoice() == CPR.LAYOUT_REVIEWING or self._conf.getConfPaperReview().getChoice() == CPR.CONTENT_AND_LAYOUT_REVIEWING):
296 self._judgeeditorListOpt.setVisible(True)
300 #collaboration related
301 self._collaborationOpt = self._sectionMenu.getLinkByName("collaboration")
302 self._collaborationOpt.setVisible(False)
303 csbm = self._conf.getCSBookingManager()
304 if csbm is not None and csbm.hasBookings() and csbm.isCSAllowed():
305 self._collaborationOpt.setVisible(True)
309 def _defineToolBar(self):
310 pass
312 def _display( self, params ):
313 self._defineSectionMenu()
314 self._toolBar=wcomponents.WebToolBar()
315 self._defineToolBar()
316 return WPConferenceBase._display(self,params)
318 def _getNavigationBarHTML(self):
319 item=None
320 if self.navigationEntry:
321 item = self.navigationEntry()
322 itemList = []
323 while item is not None:
324 if itemList == []:
325 itemList.insert(0, wcomponents.WTemplated.htmlText(item.getTitle()) )
326 else:
327 itemList.insert(0, """<a href=%s>%s</a>"""%( quoteattr(str(item.getURL(self._navigationTarget))), wcomponents.WTemplated.htmlText(item.getTitle()) ) )
328 item = item.getParent(self._navigationTarget)
329 itemList.insert(0, i18nformat("""<a href=%s> _("Home")</a>""")%quoteattr(str(urlHandlers.UHConferenceDisplay.getURL(self._conf))) )
330 return " &gt; ".join(itemList)
332 def _getToolBarHTML(self):
333 drawer=wcomponents.WConfTBDrawer(self._toolBar)
334 return drawer.getHTML()
336 def _applyConfDisplayDecoration( self, body ):
337 drawer = wcomponents.WConfTickerTapeDrawer(self._conf, self._tz)
338 frame = WConfDisplayFrame( self._getAW(), self._conf )
339 urlClose = urlHandlers.UHConferenceDisplayMenuClose.getURL(self._conf)
340 urlClose.addParam("currentURL",self._rh.getCurrentURL())
341 urlOpen = urlHandlers.UHConferenceDisplayMenuOpen.getURL(self._conf)
342 urlOpen.addParam("currentURL",self._rh.getCurrentURL())
343 menuStatus = self._rh._getSession().getVar("menuStatus") or "open"
345 wm = webcast.HelperWebcastManager.getWebcastManagerInstance()
347 onAirURL = wm.isOnAir(self._conf)
348 if onAirURL:
349 webcastURL = onAirURL
350 else:
351 wc = wm.getForthcomingWebcast(self._conf)
352 webcastURL = wm.getWebcastServiceURL(wc)
353 forthcomingWebcast = not onAirURL and wm.getForthcomingWebcast(self._conf)
355 frameParams = {\
356 "confModifURL": urlHandlers.UHConferenceModification.getURL(self._conf), \
357 "logoURL": urlHandlers.UHConferenceLogo.getURL( self._conf), \
358 "currentURL":self._rh.getCurrentURL(), \
359 "closeMenuURL": urlClose, \
360 "menuStatus": menuStatus, \
361 "nowHappening": drawer.getNowHappeningHTML(), \
362 "simpleTextAnnouncement": drawer.getSimpleText(), \
363 "onAirURL": onAirURL,
364 "webcastURL": webcastURL,
365 "forthcomingWebcast": forthcomingWebcast }
366 if self._conf.getLogo():
367 frameParams["logoURL"] = urlHandlers.UHConferenceLogo.getURL( self._conf)
369 colspan=""
370 imgOpen=""
371 padding=""
372 if menuStatus != "open":
373 urlOpen = urlHandlers.UHConferenceDisplayMenuOpen.getURL(self._conf)
374 urlOpen.addParam("currentURL",self._rh.getCurrentURL())
375 colspan = """ colspan="2" """
376 imgOpen = """<table valign="top" align="left" border="0" cellspacing="0" cellpadding="0" style="padding-right:10px;">
377 <tr>
378 <td align="left" valign="top">
379 <a href=%s><img alt="Show menu" src="%s" class="imglink" style="padding:0px; border:0px"></a>
380 </td>
381 </tr>
382 </table>"""%(quoteattr(str(urlOpen)),Config.getInstance().getSystemIconURL("openMenuIcon"))
383 padding=""" style="padding:0px" """
385 body = """
386 <div class="confBodyBox clearfix" %s %s>
388 <div>
389 <div>%s</div>
390 <div class="breadcrumps">%s</div>
391 <div style="float:right;">%s</div>
392 </div>
393 <!--Main body-->
394 <div class="mainContent">
395 <div class="col2">
397 </div>
398 </div>
399 </div>"""%(colspan,padding,imgOpen,
400 self._getNavigationBarHTML(),
401 self._getToolBarHTML().strip(),
402 body)
403 return frame.getHTML( self._sectionMenu, body, frameParams)
405 def _getHeadContent( self ):
406 #This is used for fetching the default css file for the conference pages
407 #And also the modificated uploaded css
409 dmgr = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf)
410 path = self._getBaseURL()
411 timestamp = os.stat(__file__).st_mtime
412 printCSS = """
413 <link rel="stylesheet" type="text/css" href="%s/css/Conf_Basic.css?%d" >
414 """ % (path, timestamp)
415 confCSS = dmgr.getStyleManager().getCSS()
417 if confCSS:
418 printCSS = printCSS + """<link rel="stylesheet" type="text/css" href="%s">"""%(confCSS.getURL())
420 return printCSS
422 def _applyDecoration( self, body ):
423 body = self._applyConfDisplayDecoration( body )
424 return WPConferenceBase._applyDecoration( self, body )
427 class WConfMetadata(wcomponents.WTemplated):
428 def __init__(self, conf):
429 self._conf = conf
431 def getVars(self):
432 v = wcomponents.WTemplated.getVars( self )
433 minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance()
435 v['site_name'] = minfo.getTitle()
436 v['fb_config'] = minfo.getSocialAppConfig().get('facebook', {})
438 if self._conf.getLogo():
439 v['image'] = urlHandlers.UHConferenceLogo.getURL(self._conf)
440 else:
441 v['image'] = Config.getInstance().getSystemIconURL("indico_co")
443 v['description'] = strip_ml_tags(self._conf.getDescription()[:500])
444 return v
447 class WConfDisplayFrame(wcomponents.WTemplated):
449 def __init__(self, aw, conf):
450 self._aw = aw
451 self._conf = conf
453 def getHTML( self, menu, body, params ):
454 self._body = body
455 self._menu = menu
456 return wcomponents.WTemplated.getHTML( self, params )
458 def getVars(self):
459 vars = wcomponents.WTemplated.getVars( self )
460 vars["logo"] = ""
461 if self._conf.getLogo():
462 vars["logo"] = "<img src=\"%s\" alt=\"%s\" border=\"0\" class=\"confLogo\" >"%(vars["logoURL"], escape_html(self._conf.getTitle(), escape_quotes = True))
463 vars["confTitle"] = self._conf.getTitle()
464 vars["displayURL"] = urlHandlers.UHConferenceDisplay.getURL(self._conf)
465 vars["imgConferenceRoom"] = Config.getInstance().getSystemIconURL( "conferenceRoom" )
466 tz = DisplayTZ(self._aw,self._conf).getDisplayTZ()
467 adjusted_sDate = self._conf.getAdjustedScreenStartDate(tz)
468 adjusted_eDate = self._conf.getAdjustedScreenEndDate(tz)
470 vars["timezone"] = tz
471 vars["confDateInterval"] = i18nformat("""_("from") %s _("to") %s (%s)""")%(format_date(adjusted_sDate, format='long'), format_date(adjusted_eDate, format='long'), tz)
472 if adjusted_sDate.strftime("%d%B%Y") == \
473 adjusted_eDate.strftime("%d%B%Y"):
474 vars["confDateInterval"] = format_date(adjusted_sDate, format='long')
475 elif adjusted_sDate.strftime("%B%Y") == adjusted_eDate.strftime("%B%Y"):
476 vars["confDateInterval"] = "%s-%s %s"%(adjusted_sDate.day, adjusted_eDate.day, format_date(adjusted_sDate, format='MMMM yyyy'))
477 vars["confLocation"] = ""
478 if self._conf.getLocationList():
479 vars["confLocation"] = self._conf.getLocationList()[0].getName()
480 vars["body"] = self._body
481 vars["supportEmail"] = ""
482 vars["supportTelephone"] = ""
484 sinfo = self._conf.getSupportInfo()
487 p={"closeMenuURL": vars["closeMenuURL"], \
488 "menuStatus": vars["menuStatus"], \
489 "menu": self._menu,
490 "support_info": sinfo,
491 "event": self._conf
493 vars["menu"] = WConfDisplayMenu(self._menu).getHTML(p)
495 dm = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf, False)
496 format = dm.getFormat()
497 vars["bgColorCode"] = format.getFormatOption("titleBgColor")["code"].replace("#","")
498 vars["textColorCode"] = format.getFormatOption("titleTextColor")["code"].replace("#","")
500 vars['searchBox']= ""
501 vars["confId"] = self._conf.getId()
502 vars["dm"] = dm
503 extension_point("fillConferenceHeader", vars)
504 return vars
507 class WConfDisplayMenu(wcomponents.WTemplated):
509 def __init__(self, menu):
510 wcomponents.WTemplated.__init__(self)
511 self._menu = menu
514 class WPConfSignIn( WPConferenceDefaultDisplayBase ):
516 def __init__(self, rh, conf, login="", msg = ""):
517 self._login = login
518 self._msg = msg
519 WPConferenceBase.__init__( self, rh, conf)
521 def _getBody( self, params ):
522 wc = wcomponents.WSignIn()
523 p = { \
524 "postURL": urlHandlers.UHConfSignIn.getURL( self._conf ), \
525 "returnURL": params["returnURL"], \
526 "createAccountURL": urlHandlers.UHConfUserCreation.getURL( self._conf ), \
527 "forgotPassordURL": urlHandlers.UHConfSendLogin.getURL( self._conf ), \
528 "login": self._login, \
529 "msg": self._msg }
530 return wc.getHTML( p )
532 class WPConfAccountAlreadyActivated( WPConferenceDefaultDisplayBase ):
534 def __init__(self, rh, conf, av):
535 WPConferenceDefaultDisplayBase.__init__( self, rh, conf )
536 self._av = av
538 def _getBody( self, params ):
539 wc = wcomponents.WAccountAlreadyActivated( self._av)
540 params["mailLoginURL"] = urlHandlers.UHConfSendLogin.getURL( self._conf, self._av)
541 return wc.getHTML( params )
543 class WPConfAccountActivated( WPConferenceDefaultDisplayBase ):
545 def __init__(self, rh, conf, av, returnURL=""):
546 WPConferenceDefaultDisplayBase.__init__( self, rh, conf )
547 self._av = av
548 self._returnURL=returnURL
550 def _getBody( self, params ):
551 wc = wcomponents.WAccountActivated( self._av)
552 params["mailLoginURL"] = urlHandlers.UHConfSendLogin.getURL(self._conf, self._av)
553 params["loginURL"] = urlHandlers.UHConfSignIn.getURL(self._conf)
554 if self._returnURL.strip()!="":
555 params["loginURL"] = self._returnURL
556 return wc.getHTML( params )
558 class WPConfAccountDisabled( WPConferenceDefaultDisplayBase ):
560 def __init__(self, rh, conf, av):
561 WPConferenceDefaultDisplayBase.__init__( self, rh, conf )
562 self._av = av
564 def _getBody( self, params ):
565 wc = wcomponents.WAccountDisabled( self._av )
566 #params["mailLoginURL"] = urlHandlers.UHSendLogin.getURL(self._av)
568 return wc.getHTML( params )
570 class WPConfUnactivatedAccount( WPConferenceDefaultDisplayBase ):
572 def __init__(self, rh, conf, av):
573 WPConferenceDefaultDisplayBase.__init__( self, rh, conf )
574 self._av = av
576 def _getBody( self, params ):
577 wc = wcomponents.WUnactivatedAccount( self._av )
578 params["mailActivationURL"] = urlHandlers.UHConfSendActivation.getURL( self._conf, self._av)
580 return wc.getHTML( params )
583 class WPConfUserCreation( WPConferenceDefaultDisplayBase ):
585 def __init__(self, rh, conf, params):
586 self._params = params
587 WPConferenceDefaultDisplayBase.__init__(self, rh, conf)
589 def _getBody(self, params ):
590 pars = self._params
591 p = wcomponents.WUserRegistration()
592 postURL = urlHandlers.UHConfUserCreation.getURL( self._conf )
593 postURL.addParam("returnURL", self._params.get("returnURL",""))
594 pars["postURL"] = postURL
595 if pars["msg"] != "":
596 pars["msg"] = "<table bgcolor=\"gray\"><tr><td bgcolor=\"white\">\n<font size=\"+1\" color=\"red\"><b>%s</b></font>\n</td></tr></table>"%pars["msg"]
597 return p.getHTML( pars )
600 class WPConfUserCreated( WPConferenceDefaultDisplayBase ):
602 def __init__(self, rh, conf, av):
603 WPConferenceDefaultDisplayBase.__init__( self, rh, conf )
604 self._av = av
606 def _getBody(self, params ):
607 p = wcomponents.WUserCreated(self._av)
608 pars = {"signInURL" : urlHandlers.UHConfSignIn.getURL( self._conf )}
609 return p.getHTML( pars )
612 class WPConfUserExistWithIdentity( WPConferenceDefaultDisplayBase ):
614 def __init__(self, rh, conf, av):
615 WPConferenceDefaultDisplayBase.__init__(self, rh, conf)
616 self._av = av
618 def _getBody(self, params ):
619 p = wcomponents.WUserSendIdentity(self._av)
620 pars = {"postURL" : urlHandlers.UHConfSendLogin.getURL(self._conf, self._av)}
621 return p.getHTML( pars )
624 class WConfDetailsBase( wcomponents.WTemplated ):
626 def __init__(self, aw, conf):
627 self._conf = conf
628 self._aw = aw
630 def _getMaterialHTML( self ):
631 l = []
632 for mat in self._conf.getAllMaterialList():
633 if mat.getTitle() != _("Internal Page Files"):
634 temp = wcomponents.WMaterialDisplayItem()
635 url = urlHandlers.UHMaterialDisplay.getURL( mat )
636 l.append( temp.getHTML( self._aw, mat, url ) )
637 return l
639 def _getActionsHTML( self, showActions = False):
640 html=[]
641 if showActions:
642 html=[ i18nformat("""
643 <table style="padding-top:40px; padding-left:20px">
644 <tr>
645 <td nowrap>
646 <b> _("Conference sections"):</b>
647 <ul>
648 """)]
649 menu = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu()
650 for link in menu.getLinkList():
651 if link.isVisible() and link.isEnabled():
652 if not isinstance(link, displayMgr.Spacer):
653 html.append(""" <li><a href="%s">%s</a></li>
654 """%( link.getURL(), link.getCaption() ) )
655 else:
656 html.append("%s"%link)
657 html.append("""
658 </ul>
659 </td>
660 </tr>
661 </table>
662 """)
663 return "".join(html)
665 def getVars( self ):
666 vars = wcomponents.WTemplated.getVars( self )
667 tz = DisplayTZ(self._aw,self._conf).getDisplayTZ()
668 vars["timezone"] = tz
670 description = self._conf.getDescription()
671 vars["description_html"] = isStringHTML(description)
672 vars["description"] = description
674 sdate, edate = self._conf.getAdjustedScreenStartDate(tz), self._conf.getAdjustedScreenEndDate(tz)
675 fsdate, fedate = format_date(sdate, format='medium'), format_date(edate, format='medium')
676 fstime, fetime = sdate.strftime("%H:%M"), edate.strftime("%H:%M")
678 vars["dateInterval"] = (fsdate, fstime, fedate, fetime)
680 vars["location"] = None
681 vars["address"] = None
682 vars["room"] = None
684 location = self._conf.getLocation()
685 if location:
686 vars["location"] = location.getName()
687 vars["address"] = location.getAddress()
689 room = self._conf.getRoom()
690 if room and room.getName():
691 roomLink = linking.RoomLinker().getHTMLLink(room, location)
692 vars["room"] = roomLink
694 vars["chairs"] = self._conf.getChairList()
695 vars["material"] = self._getMaterialHTML()
696 vars["conf"] = self._conf
698 info = self._conf.getContactInfo()
699 vars["moreInfo_html"] = isStringHTML(info)
700 vars["moreInfo"] = info
701 vars["actions"] = self._getActionsHTML(vars.get("menuStatus", "open") != "open")
702 vars["isSubmitter"] = self._conf.getAccessController().canUserSubmit(self._aw.getUser()) or self._conf.canModify(self._aw)
703 return vars
706 class WConfDetailsFull(WConfDetailsBase):
707 pass
710 #---------------------------------------------------------------------------
713 class WConfDetails:
715 def __init__(self, aw, conf):
716 self._conf = conf
717 self._aw = aw
719 def getHTML( self, params ):
720 return WConfDetailsFull( self._aw, self._conf ).getHTML( params )
723 class WPConferenceDisplay( WPConferenceDefaultDisplayBase ):
725 def _getBody( self, params ):
727 wc = WConfDetails( self._getAW(), self._conf )
728 pars = { \
729 "modifyURL": urlHandlers.UHConferenceModification.getURL( self._conf ), \
730 "sessionModifyURLGen": urlHandlers.UHSessionModification.getURL, \
731 "contribModifyURLGen": urlHandlers.UHContributionModification.getURL, \
732 "subContribModifyURLGen": urlHandlers.UHSubContribModification.getURL, \
733 "materialURLGen": urlHandlers.UHMaterialDisplay.getURL, \
734 "menuStatus": self._rh._getSession().getVar("menuStatus") or "open"}
735 return wc.getHTML( pars )
737 def _getHeadContent( self ):
738 printCSS = WPConferenceDefaultDisplayBase._getHeadContent(self)
739 confMetadata = WConfMetadata(self._conf).getHTML()
740 return printCSS + confMetadata
742 def _getFooter(self):
743 wc = wcomponents.WEventFooter(self._conf)
744 return wc.getHTML()
746 def _defineSectionMenu( self ):
747 WPConferenceDefaultDisplayBase._defineSectionMenu(self)
748 self._sectionMenu.setCurrentItem(self._overviewOpt)
750 class WSentMail (wcomponents.WTemplated):
751 def __init__(self,conf):
752 self._conf = conf
754 def getVars(self):
755 vars = wcomponents.WTemplated.getVars( self )
756 vars["BackURL"]=urlHandlers.UHConferenceDisplay.getURL(self._conf)
757 return vars
760 class WPSentEmail( WPConferenceDefaultDisplayBase ):
761 def _getBody(self,params):
762 wc = WSentMail(self._conf)
763 return wc.getHTML()
765 class WEmail(wcomponents.WTemplated):
767 def __init__(self,conf,user,toUsers):
768 self._conf = conf
769 self._from = user
770 self._to = toUsers
772 def getVars(self):
773 vars = wcomponents.WTemplated.getVars( self )
774 if vars.get("from", None) is None :
775 vars["FromName"] = self._from
776 vars["fromUser"] = self._from
777 vars["toUsers"] = self._to
778 if vars.get("postURL",None) is None :
779 vars["postURL"]=urlHandlers.UHConferenceSendEmail.getURL(self._to)
780 if vars.get("subject", None) is None :
781 vars["subject"]=""
782 if vars.get("body", None) is None :
783 vars["body"]=""
784 return vars
786 class WPEMail ( WPConferenceDefaultDisplayBase ):
788 def _getBody(self,params):
789 toemail = params["emailto"]
790 wc = WEmail(self._conf, self._getAW().getUser(), toemail)
791 params["fromDisabled"] = True
792 params["toDisabled"] = True
793 params["ccDisabled"] = True
794 return wc.getHTML(params)
796 class WPXSLConferenceDisplay( WPConferenceBase ):
798 """ Use this class just to transform to XML"""
800 def __init__( self, rh, conference, view, type, params ):
801 WPConferenceBase.__init__( self, rh, conference )
802 self._params = params
803 self._view = view
804 self._conf = conference
805 self._type = type
806 self._firstDay = params.get("firstDay")
807 self._lastDay = params.get("lastDay")
808 self._daysPerRow = params.get("daysPerRow")
809 self._webcastadd = False
810 wm = webcast.HelperWebcastManager.getWebcastManagerInstance()
811 if wm.isManager(self._getAW().getUser()):
812 self._webcastadd = True
814 def _getFooter( self ):
817 return ""
819 def _getHTMLHeader( self ):
820 return ""
822 def _applyDecoration( self, body ):
825 return body
827 def _getHTMLFooter( self ):
828 return ""
830 def _getBodyVariables(self):
831 pars = { \
832 "modifyURL": urlHandlers.UHConferenceModification.getURL( self._conf ), \
833 "iCalURL": urlHandlers.UHConferenceToiCal.getURL(self._conf), \
834 "cloneURL": urlHandlers.UHConfClone.getURL( self._conf ), \
835 "sessionModifyURLGen": urlHandlers.UHSessionModification.getURL, \
836 "contribModifyURLGen": urlHandlers.UHContributionModification.getURL, \
837 "subContribModifyURLGen": urlHandlers.UHSubContribModification.getURL, \
838 "materialURLGen": urlHandlers.UHMaterialDisplay.getURL, \
839 "resourceURLGen": urlHandlers.UHFileAccess.getURL }
841 pars.update({ 'firstDay' : self._firstDay, 'lastDay' : self._lastDay, 'daysPerRow' : self._daysPerRow })
843 if self._webcastadd:
844 urladdwebcast = urlHandlers.UHWebcastAddWebcast.getURL()
845 urladdwebcast.addParam("eventid",self._conf.getId())
846 pars['webcastAdminURL'] = urladdwebcast
847 return pars
849 def _getBody( self, params ):
850 vars = self._getBodyVariables()
851 view = self._view
852 outGen = outputGenerator(self._getAW())
853 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager()
854 if styleMgr.existsXSLFile(self._view):
855 minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance()
856 tz = DisplayTZ(self._getAW(),self._conf).getDisplayTZ()
857 useCache = minfo.isCacheActive() and self._params.get("detailLevel", "") in [ "", "contribution" ] and self._view == self._conf.getDefaultStyle() and self._params.get("showSession","all") == "all" and self._params.get("showDate","all") == "all" and tz == self._conf.getTimezone()
858 useNormalCache = useCache and self._conf.getAccessController().isFullyPublic() and not self._conf.canModify(self._getAW()) and self._getAW().getUser() == None
859 useManagerCache = useCache and self._conf.canModify( self._getAW())
860 body = ""
861 if useManagerCache:
862 cache = EventCache({"id": self._conf.getId(), "type": "manager"})
863 body = cache.getCachePage()
864 elif useNormalCache:
865 cache = EventCache({"id": self._conf.getId(), "type": "normal"})
866 body = cache.getCachePage()
867 if body == "":
868 if self._params.get("detailLevel", "") == "contribution" or self._params.get("detailLevel", "") == "":
869 includeContribution = 1
870 else:
871 includeContribution = 0
872 body = outGen.getFormattedOutput(self._rh, self._conf, styleMgr.getXSLPath(self._view), vars, 1, includeContribution, 1, 1, self._params.get("showSession",""), self._params.get("showDate",""))
873 if useManagerCache or useNormalCache:
874 cache.saveCachePage( body )
875 return body
876 else:
877 return _("Cannot find the %s stylesheet") % view
879 def _defineSectionMenu( self ):
880 WPConferenceDefaultDisplayBase._defineSectionMenu(self)
881 self._sectionMenu.setCurrentItem(self._overviewOpt)
883 class WPTPLConferenceDisplay(WPXSLConferenceDisplay):
884 """Overrides XSL related functions in WPXSLConferenceDisplay
885 class and re-implements them using normal Indico templates.
887 _ImagesBaseURL = Config.getInstance().getImagesBaseURL()
888 _Types = {
889 "pdf" :{"mapsTo" : "pdf", "imgURL" : os.path.join(_ImagesBaseURL, "pdf_small.png"), "imgAlt" : "pdf file"},
890 "doc" :{"mapsTo" : "doc", "imgURL" : os.path.join(_ImagesBaseURL, "word.png"), "imgAlt" : "word file"},
891 "docx" :{"mapsTo" : "doc", "imgURL" : os.path.join(_ImagesBaseURL, "word.png"), "imgAlt" : "word file"},
892 "ppt" :{"mapsTo" : "ppt", "imgURL" : os.path.join(_ImagesBaseURL, "powerpoint.png"), "imgAlt" : "powerpoint file"},
893 "pptx" :{"mapsTo" : "ppt", "imgURL" : os.path.join(_ImagesBaseURL, "powerpoint.png"), "imgAlt" : "powerpoint file"},
894 "sxi" :{"mapsTo" : "odp", "imgURL" : os.path.join(_ImagesBaseURL, "impress.png"), "imgAlt" : "presentation file"},
895 "odp" :{"mapsTo" : "odp", "imgURL" : os.path.join(_ImagesBaseURL, "impress.png"), "imgAlt" : "presentation file"},
896 "sxw" :{"mapsTo" : "odt", "imgURL" : os.path.join(_ImagesBaseURL, "writer.png"), "imgAlt" : "writer file"},
897 "odt" :{"mapsTo" : "odt", "imgURL" : os.path.join(_ImagesBaseURL, "writer.png"), "imgAlt" : "writer file"},
898 "sxc" :{"mapsTo" : "ods", "imgURL" : os.path.join(_ImagesBaseURL, "calc.png"), "imgAlt" : "spreadsheet file"},
899 "ods" :{"mapsTo" : "ods", "imgURL" : os.path.join(_ImagesBaseURL, "calc.png"), "imgAlt" : "spreadsheet file"},
900 "other" :{"mapsTo" : "other", "imgURL" : os.path.join(_ImagesBaseURL, "file_small.png"), "imgAlt" : "unknown type file"},
901 "link" :{"mapsTo" : "link", "imgURL" : os.path.join(_ImagesBaseURL, "link.png"), "imgAlt" : "link"}
904 def __init__( self, rh, conference, view, type, params ):
905 WPXSLConferenceDisplay.__init__( self, rh, conference, view, type, params )
907 def _getVariables(self, conf):
908 vars = {}
909 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager()
910 vars['INCLUDE'] = '../include'
912 vars['accessWrapper'] = accessWrapper = self._rh._aw
913 vars['conf'] = conf
914 if conf.getOwnerList():
915 vars['category'] = conf.getOwnerList()[0].getName()
916 else:
917 vars['category'] = ''
919 timezoneUtil = DisplayTZ(accessWrapper, conf)
920 tz = timezoneUtil.getDisplayTZ()
921 vars['startDate'] = conf.getAdjustedStartDate(tz)
922 vars['endDate'] = conf.getAdjustedEndDate(tz)
923 vars['timezone'] = tz
925 if conf.getParticipation().displayParticipantList() :
926 vars['participants'] = conf.getParticipation().getPresentParticipantListText()
928 wm = webcast.HelperWebcastManager.getWebcastManagerInstance()
929 vars['webcastOnAirURL'] = wm.isOnAir(conf)
930 forthcomingWebcast = wm.getForthcomingWebcast(conf)
931 vars['forthcomingWebcast'] = forthcomingWebcast
932 if forthcomingWebcast:
933 vars['forthcomingWebcastURL'] = wm.getWebcastServiceURL(forthcomingWebcast)
935 vars['files'] = {}
936 lectureTitles = ['part%s' % nr for nr in xrange(1, 11)]
937 materials, lectures, minutesText = [], [], []
938 for material in conf.getAllMaterialList():
939 if not material.canView(accessWrapper):
940 continue
941 if material.getTitle() in lectureTitles:
942 lectures.append(material)
943 elif material.getTitle() != "Internal Page Files":
944 materials.append(material)
946 vars['materials'] = materials
947 vars['minutesText'] = minutesText
948 byTitleNumber = lambda x, y: int(x.getTitle()[4:]) - int(y.getTitle()[4:])
949 vars['lectures'] = sorted(lectures, cmp=byTitleNumber)
951 if (conf.getType() in ("meeting", "simple_event")
952 and conf.getParticipation().isAllowedForApplying()
953 and conf.getStartDate() > nowutc()
954 and not conf.getParticipation().isFull()):
955 vars['registrationOpen'] = True
956 evaluation = conf.getEvaluation()
957 if evaluation.isVisible() and evaluation.inEvaluationPeriod() and evaluation.getNbOfQuestions() > 0:
958 vars['evaluationLink'] = urlHandlers.UHConfEvaluationDisplay.getURL(conf)
959 vars['supportEmailCaption'] = conf.getSupportInfo().getCaption()
961 vars['types'] = WPTPLConferenceDisplay._Types
963 vars['entries'] = []
964 confSchedule = conf.getSchedule()
965 showSession = self._params.get("showSession","")
966 detailLevel = self._params.get("detailLevel", "contribution")
967 showDate = self._params.get("showDate", "all")
968 # Filter by day
969 if showDate == "all":
970 entrylist = confSchedule.getEntries()
971 else:
972 entrylist = confSchedule.getEntriesOnDay(timezone(tz).localize(stringToDate(showDate)))
973 # Check entries filters and access rights
974 for entry in entrylist:
975 sessionCand = entry.getOwner().getOwner()
976 # Filter by session
977 if isinstance(sessionCand, Session) and (showSession != "all" and sessionCand.getId() != showSession):
978 continue
979 # Hide/Show contributions
980 if isinstance(entry.getOwner(), Contribution) and detailLevel != "contribution":
981 continue
982 if entry.getOwner().canView(accessWrapper):
983 if type(entry) is schedule.BreakTimeSchEntry:
984 newItem = entry
985 else:
986 newItem = entry.getOwner()
987 vars['entries'].append(newItem)
989 vars["pluginDetails"] = "".join(self._notify('eventDetailBanner', self._conf))
991 vars["daysPerRow"] = self._daysPerRow
992 vars["firstDay"] = self._firstDay
993 vars["lastDay"] = self._lastDay
994 vars["currentUser"] = self._rh._aw.getUser()
995 vars["reportNumberSystems"] = Config.getInstance().getReportNumberSystems()
997 return vars
999 def _getMaterialFiles(self, material):
1000 files = []
1001 for res in material.getResourceList():
1002 if isinstance(res, LocalFile):
1003 fileType = res.getFileType().lower()
1004 try:
1005 fileType = WPTPLConferenceDisplay._Types[fileType]["mapsTo"]
1006 except KeyError:
1007 fileType = "other"
1008 filename = res.getName() or res.getFileName()
1009 fileURL = str(urlHandlers.UHFileAccess.getURL(res))
1010 else:
1011 filename, fileType, fileURL = str(res.getName() or res.getURL()), "link", str(res.getURL())
1012 files.append({'id': res.getId(),
1013 'name': filename,
1014 'description': res.getDescription(),
1015 'type': fileType,
1016 'url': fileURL,
1017 'pdfConversionStatus': res.getPDFConversionStatus()})
1018 return files
1020 def _getItemType(self, item):
1021 itemClass = item.__class__.__name__
1022 if itemClass == 'BreakTimeSchEntry':
1023 return 'Break'
1024 elif itemClass == 'SessionSlot':
1025 return 'Session'
1026 elif itemClass == 'AcceptedContribution':
1027 return 'Contribution'
1028 else:
1029 # return Conference, Contribution or SubContribution
1030 return itemClass
1032 def _generateMaterialList(self, obj):
1034 Generates a list containing all the materials, with the
1035 corresponding Ids for those that already exist
1037 # yes, this may look a bit redundant, but materialRegistry isn't
1038 # bound to a particular target
1039 materialRegistry = obj.getMaterialRegistry()
1040 return materialRegistry.getMaterialList(obj.getConference())
1042 def _extractInfoForButton(self, item):
1043 info = {}
1044 for key in ['sessId', 'slotId', 'contId', 'subContId']:
1045 info[key] = 'null'
1046 info['confId'] = self._conf.getId()
1048 itemType = self._getItemType(item)
1049 info['uploadURL'] = 'Indico.Urls.UploadAction.%s' % itemType.lower()
1051 if itemType != 'Session':
1052 info['materialList'] = self._generateMaterialList(item)
1053 else:
1054 info['materialList'] = self._generateMaterialList(item.getSession())
1056 if itemType == 'Conference':
1057 info['parentProtection'] = item.getAccessController().isProtected()
1058 if item.canModify(self._rh._aw):
1059 info["modifyLink"] = urlHandlers.UHConferenceModification.getURL(item)
1060 info["minutesLink"] = True
1061 info["materialLink"] = True
1062 info["cloneLink"] = urlHandlers.UHConfClone.getURL(item)
1063 if item.getAccessController().canUserSubmit(self._rh._aw.getUser()):
1064 info["minutesLink"] = True
1065 info["materialLink"] = True
1067 elif itemType == 'Session':
1068 session = item.getSession()
1069 info['parentProtection'] = session.getAccessController().isProtected()
1070 if session.canModify(self._rh._aw) or session.canCoordinate(self._rh._aw):
1071 info["modifyLink"] = urlHandlers.UHSessionModification.getURL(item)
1072 info['slotId'] = session.getSortedSlotList().index(item)
1073 info['sessId'] = session.getId()
1074 if session.canModify(self._rh._aw) or session.canCoordinate(self._rh._aw):
1075 info["minutesLink"] = True
1076 info["materialLink"] = True
1077 url = urlHandlers.UHSessionModifSchedule.getURL(session)
1078 ttLink = "%s#%s.s%sl%s" % (url, session.getStartDate().strftime('%Y%m%d'), session.getId(), info['slotId'])
1079 info["sessionTimetableLink"] = ttLink
1081 elif itemType == 'Contribution':
1082 info['parentProtection'] = item.getAccessController().isProtected()
1083 if item.canModify(self._rh._aw):
1084 info["modifyLink"] = urlHandlers.UHContributionModification.getURL(item)
1085 if item.canModify(self._rh._aw) or item.canUserSubmit(self._rh._aw.getUser()):
1086 info["minutesLink"] = True
1087 info["materialLink"] = True
1088 info["contId"] = item.getId()
1089 owner = item.getOwner()
1090 if self._getItemType(owner) == 'Session':
1091 info['sessId'] = owner.getId()
1093 elif itemType == 'SubContribution':
1094 info['parentProtection'] = item.getContribution().getAccessController().isProtected()
1095 if item.canModify(self._rh._aw):
1096 info["modifyLink"] = urlHandlers.UHSubContributionModification.getURL(item)
1097 if item.canModify(self._rh._aw) or item.canUserSubmit(self._rh._aw.getUser()):
1098 info["minutesLink"] = True
1099 info["materialLink"] = True
1100 info["subContId"] = item.getId()
1101 info["contId"] = item.getContribution().getId()
1102 owner = item.getOwner()
1103 if self._getItemType(owner) == 'Session':
1104 info['sessId'] = owner.getId()
1106 return info
1108 def _getHTMLHeader( self ):
1109 return WPConferenceBase._getHTMLHeader(self)
1111 def _getHeadContent( self ):
1112 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager()
1113 htdocs = Config.getInstance().getHtdocsDir()
1114 baseurl = self._getBaseURL()
1115 # First include the default Indico stylesheet
1116 timestamp = os.stat(__file__).st_mtime
1117 styleText = """<link rel="stylesheet" href="%s/css/%s?%d">\n""" % \
1118 (baseurl, Config.getInstance().getCssStylesheetName(), timestamp)
1119 # Then the common event display stylesheet
1120 if os.path.exists("%s/css/events/common.css" % htdocs):
1121 styleText += """ <link rel="stylesheet" href="%s/css/events/common.css?%d">\n""" % (baseurl, timestamp)
1122 # And finally the specific display stylesheet
1123 if styleMgr.existsCSSFile(self._view):
1124 cssPath = os.path.join(baseurl, 'css', 'events', styleMgr.getCSSFilename(self._view))
1125 styleText += """ <link rel="stylesheet" href="%s?%d">\n""" % (cssPath, timestamp)
1127 confMetadata = WConfMetadata(self._conf).getHTML()
1129 return styleText + confMetadata
1131 def _getFooter( self ):
1134 wc = wcomponents.WEventFooter(self._conf)
1135 p = {"modificationDate":format_datetime(self._conf.getModificationDate(), format='d MMMM yyyy H:mm'),"subArea": self._getSiteArea(),"dark":True}
1136 if Config.getInstance().getShortEventURL():
1137 id=self._conf.getUrlTag().strip()
1138 if not id:
1139 id = self._conf.getId()
1140 p["shortURL"] = Config.getInstance().getShortEventURL() + id
1141 return wc.getHTML(p)
1143 def _getHeader( self ):
1146 if self._type == "simple_event":
1147 wc = wcomponents.WMenuSimpleEventHeader( self._getAW(), self._conf )
1148 elif self._type == "meeting":
1149 wc = wcomponents.WMenuMeetingHeader( self._getAW(), self._conf )
1150 else:
1151 wc = wcomponents.WMenuConferenceHeader( self._getAW(), self._conf )
1152 return wc.getHTML( { "loginURL": self.getLoginURL(),\
1153 "logoutURL": self.getLogoutURL(),\
1154 "confId": self._conf.getId(),\
1155 "currentView": self._view,\
1156 "type": self._type,\
1157 "selectedDate": self._params.get("showDate",""),\
1158 "selectedSession": self._params.get("showSession",""),\
1159 "detailLevel": self._params.get("detailLevel",""),\
1160 "filterActive": self._params.get("filterActive",""),\
1161 "dark": True } )
1163 def getCSSFiles(self):
1164 # flatten returned list
1166 return WPConferenceBase.getCSSFiles(self) + \
1167 sum(self._notify('injectCSSFiles'), [])
1169 def getJSFiles(self):
1170 modules = WPConferenceBase.getJSFiles(self)
1172 # if the user has management powers, include
1173 # these modules
1174 #if self._conf.canModify(self._rh.getAW()):
1176 # TODO: find way to check if the user is able to manage
1177 # anything inside the conference (sessions, ...)
1178 modules += self._includeJSPackage('Management')
1179 modules += self._includeJSPackage('MaterialEditor')
1180 modules += self._includeJSPackage('Display')
1181 modules += self._includeJSPackage('Collaboration')
1182 modules += sum(self._notify('injectJSFiles'), [])
1183 return modules
1185 def _applyDecoration( self, body ):
1188 if self._params.get("frame","")=="no" or self._params.get("fr","")=="no":
1189 return WPrintPageFrame().getHTML({"content":body})
1190 return WPConferenceBase._applyDecoration(self, body)
1192 def _getHTMLFooter( self ):
1193 if self._params.get("frame","")=="no" or self._params.get("fr","")=="no":
1194 return ""
1195 return WPConferenceBase._getHTMLFooter(self)
1197 def _getBody(self, params):
1198 """Return main information about the event."""
1199 if self._view != 'xml':
1200 vars = self._getVariables(self._conf)
1201 vars['getTime'] = lambda date : format_time(date.time(), format="HH:mm")
1202 vars['isTime0H0M'] = lambda date : (date.hour, date.minute) == (0,0)
1203 vars['getDate'] = lambda date : format_date(date, format='yyyy-MM-dd')
1204 vars['prettyDate'] = lambda date : format_date(date, format='full')
1205 vars['prettyDuration'] = MaKaC.common.utils.prettyDuration
1206 vars['parseDate'] = MaKaC.common.utils.parseDate
1207 vars['isStringHTML'] = MaKaC.common.utils.isStringHTML
1208 vars['getMaterialFiles'] = lambda material : self._getMaterialFiles(material)
1209 vars['extractInfoForButton'] = lambda item : self._extractInfoForButton(item)
1210 vars['getItemType'] = lambda item : self._getItemType(item)
1211 vars['getLocationInfo'] = MaKaC.common.utils.getLocationInfo
1212 vars['dumps'] = json.dumps
1213 else:
1214 outGen = outputGenerator(self._rh._aw)
1215 varsForGenerator = self._getBodyVariables()
1216 vars = {}
1217 vars['xml'] = outGen._getBasicXML(self._conf, varsForGenerator, 1, 1, 1, 1)
1219 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager()
1220 if styleMgr.existsTPLFile(self._view):
1221 fileName = os.path.splitext(styleMgr.getTemplateFilename(self._view))[0]
1222 body = wcomponents.WTemplated(os.path.join("events", fileName)).getHTML(vars)
1223 else:
1224 return _("Template could not be found.")
1225 return body
1228 class WPrintPageFrame (wcomponents.WTemplated):
1229 pass
1232 class WText(wcomponents.WTemplated):
1234 def __init__(self):
1235 wcomponents.WTemplated("events/Text")
1238 class WConfProgram(wcomponents.WTemplated):
1240 def __init__(self, aw, conf):
1241 self._conf = conf
1242 self._aw = aw
1244 def buildTrackData(self, track):
1246 Returns a dict representing the data of the track and its Sub-tracks
1247 should it have any.
1249 description = track.getDescription()
1251 formattedTrack = {
1252 'title': track.getTitle(),
1253 'description': description
1256 if track.getConference().getAbstractMgr().isActive() and \
1257 track.getConference().hasEnabledSection("cfa") and \
1258 track.canCoordinate(self._aw):
1260 if track.getConference().canModify(self._aw):
1261 formattedTrack['url'] = urlHandlers.UHTrackModification.getURL(track)
1262 else:
1263 formattedTrack['url'] = urlHandlers.UHTrackModifAbstracts.getURL(track)
1265 return formattedTrack
1267 def getVars(self):
1268 pvars = wcomponents.WTemplated.getVars(self)
1269 pvars['description'] = self._conf.getProgramDescription()
1270 pvars['program'] = [self.buildTrackData(t) for t in self._conf.getTrackList()]
1271 pvars['pdf_url'] = urlHandlers.UHConferenceProgramPDF.getURL(self._conf)
1273 return pvars
1276 class WPConferenceProgram(WPConferenceDefaultDisplayBase):
1278 def _getBody(self, params):
1279 wc = WConfProgram(self._getAW(), self._conf)
1280 return wc.getHTML()
1282 def _defineSectionMenu(self):
1283 WPConferenceDefaultDisplayBase._defineSectionMenu(self)
1284 self._sectionMenu.setCurrentItem(self._programOpt)
1287 class WInternalPageDisplay(wcomponents.WTemplated):
1289 def __init__(self, conf, page):
1290 self._conf = conf
1291 self._page=page
1293 def getVars( self ):
1294 vars = wcomponents.WTemplated.getVars( self )
1295 vars["content"] = self._page.getContent()
1296 return vars
1298 class WPInternalPageDisplay( WPConferenceDefaultDisplayBase ):
1300 def __init__( self, rh, conference, page ):
1301 WPConferenceDefaultDisplayBase.__init__( self, rh, conference )
1302 self._page = page
1304 def _getBody( self, params ):
1305 wc = WInternalPageDisplay( self._conf, self._page )
1306 return wc.getHTML()
1308 def _defineSectionMenu( self ):
1309 WPConferenceDefaultDisplayBase._defineSectionMenu(self)
1311 for link in self._sectionMenu.getAllLinks():
1312 if link.getType() == 'page' and link.getPage().getId() == self._page.getId():
1313 self._sectionMenu.setCurrentItem(link)
1314 break
1317 class WConferenceTimeTable(wcomponents.WTemplated):
1319 def __init__( self, conference, aw ):
1320 self._conf = conference
1321 self._aw = aw
1323 def getVars( self ):
1324 vars = wcomponents.WTemplated.getVars( self )
1325 tz = DisplayTZ(self._aw,self._conf).getDisplayTZ()
1326 sf = schedule.ScheduleToJson.process(self._conf.getSchedule(),
1327 tz, self._aw,
1328 useAttrCache = True,
1329 hideWeekends = True)
1330 # TODO: Move to beginning of file when proved useful
1331 try:
1332 import ujson
1333 jsonf = ujson.encode
1334 except ImportError:
1335 jsonf = json.dumps
1336 vars["ttdata"] = jsonf(sf)
1337 eventInfo = fossilize(self._conf, IConferenceEventInfoFossil, tz=tz)
1338 eventInfo['isCFAEnabled'] = self._conf.getAbstractMgr().isActive()
1339 vars['eventInfo'] = eventInfo
1340 vars['timetableLayout'] = vars.get('ttLyt','')
1341 return vars
1343 #class WMeetingHighDetailTimeTable(WConferenceTimeTable):
1345 # def getVars( self ):
1346 # vars = wcomponents.WTemplated.getVars( self )
1347 # self._contribURLGen = vars["contribURLGen"]
1348 # self._sessionURLGen = vars["sessionURLGen"]
1349 # vars["title"] = self._conf.getTitle()
1350 # vars["timetable"] = self._getHTMLTimeTable(1)
1351 # return vars
1354 class WPConferenceTimeTable( WPConferenceDefaultDisplayBase ):
1355 navigationEntry = navigation.NEConferenceTimeTable
1357 def getJSFiles(self):
1358 return WPConferenceDefaultDisplayBase.getJSFiles(self) + \
1359 self._includeJSPackage('Timetable')
1361 def _getBody( self, params ):
1362 wc = WConferenceTimeTable( self._conf, self._getAW() )
1363 return wc.getHTML(params)
1365 def _defineSectionMenu( self ):
1366 WPConferenceDefaultDisplayBase._defineSectionMenu( self )
1367 self._sectionMenu.setCurrentItem(self._timetableOpt)
1369 def _getHeadContent( self ):
1370 headContent=WPConferenceDefaultDisplayBase._getHeadContent(self)
1371 baseurl = self._getBaseURL()
1372 timestamp = os.stat(__file__).st_mtime
1373 return """
1375 <link rel="stylesheet" type="text/css" href="%s/css/timetable.css?%d">
1376 """ % ( headContent, baseurl, timestamp)
1378 #class WMeetingTimeTable(WConferenceTimeTable):
1380 # def getVars( self ):
1381 # vars = wcomponents.WTemplated.getVars( self )
1382 # self._contribURLGen = vars["contribURLGen"]
1383 # self._sessionURLGen = vars["sessionURLGen"]
1384 # vars["title"] = self._conf.getTitle()
1385 # vars["timetable"] = self._getHTMLTimeTable(0)
1386 # return vars
1388 class WPMeetingTimeTable( WPTPLConferenceDisplay ):
1390 def getJSFiles(self):
1391 return WPXSLConferenceDisplay.getJSFiles(self) + \
1392 self._includeJSPackage('Timetable')
1394 def _getBody( self, params ):
1395 wc = WConferenceTimeTable( self._conf, self._getAW() )
1396 return wc.getHTML(params)
1398 class WPConferenceModifBase( main.WPMainBase, OldObservable ):
1400 _userData = ['favorite-user-ids']
1402 def __init__( self, rh, conference ):
1403 main.WPMainBase.__init__( self, rh )
1404 self._navigationTarget = self._conf = conference
1406 def getJSFiles(self):
1407 return main.WPMainBase.getJSFiles(self) + \
1408 self._includeJSPackage('Management') + \
1409 self._includeJSPackage('MaterialEditor')
1411 def _getSiteArea(self):
1412 return "ModificationArea"
1414 def _getHeader( self ):
1417 wc = wcomponents.WHeader( self._getAW() )
1418 return wc.getHTML( { "subArea": self._getSiteArea(), \
1419 "loginURL": self._escapeChars(str(self.getLoginURL())),\
1420 "logoutURL": self._escapeChars(str(self.getLogoutURL())) } )
1422 def _getNavigationDrawer(self):
1423 pars = {"target": self._conf, "isModif": True }
1424 return wcomponents.WNavigationDrawer( pars, bgColor="white" )
1426 def _createSideMenu(self):
1427 self._sideMenu = wcomponents.ManagementSideMenu()
1429 # The main section containing most menu items
1430 self._generalSection = wcomponents.SideMenuSection()
1432 self._generalSettingsMenuItem = wcomponents.SideMenuItem(_("General settings"),
1433 urlHandlers.UHConferenceModification.getURL( self._conf ))
1434 self._generalSection.addItem( self._generalSettingsMenuItem)
1436 self._timetableMenuItem = wcomponents.SideMenuItem(_("Timetable"),
1437 urlHandlers.UHConfModifSchedule.getURL( self._conf ))
1438 self._generalSection.addItem( self._timetableMenuItem)
1440 self._materialMenuItem = wcomponents.SideMenuItem(_("Material"),
1441 urlHandlers.UHConfModifShowMaterials.getURL( self._conf ))
1442 self._generalSection.addItem( self._materialMenuItem)
1444 self._roomBookingMenuItem = wcomponents.SideMenuItem(_("Room booking"),
1445 urlHandlers.UHConfModifRoomBookingList.getURL( self._conf ))
1446 self._generalSection.addItem( self._roomBookingMenuItem)
1448 self._programMenuItem = wcomponents.SideMenuItem(_("Programme"),
1449 urlHandlers.UHConfModifProgram.getURL( self._conf ))
1450 self._generalSection.addItem( self._programMenuItem)
1452 self._regFormMenuItem = wcomponents.SideMenuItem(_("Registration"),
1453 urlHandlers.UHConfModifRegForm.getURL( self._conf ))
1454 self._generalSection.addItem( self._regFormMenuItem)
1456 self._abstractMenuItem = wcomponents.SideMenuItem(_("Abstracts"),
1457 urlHandlers.UHConfModifCFA.getURL( self._conf ))
1458 self._generalSection.addItem( self._abstractMenuItem)
1460 self._contribListMenuItem = wcomponents.SideMenuItem(_("Contributions"),
1461 urlHandlers.UHConfModifContribList.getURL( self._conf ))
1462 self._generalSection.addItem( self._contribListMenuItem)
1464 self._reviewingMenuItem = wcomponents.SideMenuItem(_("Paper Reviewing"),
1465 urlHandlers.UHConfModifReviewingAccess.getURL( target = self._conf ) )
1466 self._generalSection.addItem( self._reviewingMenuItem)
1468 if self._conf.getCSBookingManager() is not None and self._conf.getCSBookingManager().isCSAllowed(self._rh.getAW().getUser()):
1469 self._videoServicesMenuItem = wcomponents.SideMenuItem(_("Video Services"),
1470 urlHandlers.UHConfModifCollaboration.getURL(self._conf, secure = self._rh.use_https()))
1471 self._generalSection.addItem( self._videoServicesMenuItem)
1472 else:
1473 self._videoServicesMenuItem = wcomponents.SideMenuItem(_("Video Services"), None)
1474 self._generalSection.addItem( self._videoServicesMenuItem)
1475 self._videoServicesMenuItem.setVisible(False)
1477 self._participantsMenuItem = wcomponents.SideMenuItem(_("Participants"),
1478 urlHandlers.UHConfModifParticipants.getURL( self._conf ) )
1479 self._generalSection.addItem( self._participantsMenuItem)
1481 self._evaluationMenuItem = wcomponents.SideMenuItem(_("Evaluation"),
1482 urlHandlers.UHConfModifEvaluation.getURL( self._conf ) )
1483 self._generalSection.addItem( self._evaluationMenuItem)
1485 self._pluginsDictMenuItem = {}
1486 self._notify('fillManagementSideMenu', self._pluginsDictMenuItem)
1487 for element in self._pluginsDictMenuItem.values():
1488 try:
1489 self._generalSection.addItem( element)
1490 except Exception, e:
1491 Logger.get('Conference').error("Exception while trying to access the plugin elements of the side menu: %s" %str(e))
1493 self._sideMenu.addSection(self._generalSection)
1495 # The section containing all advanced options
1496 self._advancedOptionsSection = wcomponents.SideMenuSection(_("Advanced options"))
1498 self._listingsMenuItem = wcomponents.SideMenuItem(_("Lists"),
1499 urlHandlers.UHConfAllSpeakers.getURL( self._conf ) )
1500 self._advancedOptionsSection.addItem( self._listingsMenuItem)
1502 self._ACMenuItem = wcomponents.SideMenuItem(_("Protection"),
1503 urlHandlers.UHConfModifAC.getURL( self._conf ) )
1504 self._advancedOptionsSection.addItem( self._ACMenuItem)
1506 self._toolsMenuItem = wcomponents.SideMenuItem(_("Tools"),
1507 urlHandlers.UHConfModifTools.getURL( self._conf ) )
1508 self._advancedOptionsSection.addItem( self._toolsMenuItem)
1510 self._layoutMenuItem = wcomponents.SideMenuItem(_("Layout"),
1511 urlHandlers.UHConfModifDisplay.getURL(self._conf))
1512 self._advancedOptionsSection.addItem( self._layoutMenuItem)
1514 self._logMenuItem = wcomponents.SideMenuItem(_("Logs"),
1515 urlHandlers.UHConfModifLog.getURL( self._conf ) )
1516 self._advancedOptionsSection.addItem( self._logMenuItem)
1518 self._sideMenu.addSection(self._advancedOptionsSection)
1520 #we decide which side menu item appear and which don't
1521 from MaKaC.webinterface.rh.reviewingModif import RCPaperReviewManager, RCReviewingStaff
1522 from MaKaC.webinterface.rh.collaboration import RCVideoServicesManager, RCCollaborationAdmin, RCCollaborationPluginAdmin
1524 canModify = self._conf.canModify(self._rh.getAW())
1525 isReviewingStaff = RCReviewingStaff.hasRights(self._rh)
1526 isPRM = RCPaperReviewManager.hasRights(self._rh)
1527 #isAM = RCAbstractManager.hasRights(self._rh)
1528 isRegistrar = self._conf.canManageRegistration(self._rh.getAW().getUser())
1530 if not canModify:
1531 self._generalSettingsMenuItem.setVisible(False)
1532 self._timetableMenuItem.setVisible(False)
1533 self._materialMenuItem.setVisible(False)
1534 self._programMenuItem.setVisible(False)
1535 self._participantsMenuItem.setVisible(False)
1536 self._listingsMenuItem.setVisible(False)
1537 self._layoutMenuItem.setVisible(False)
1538 self._ACMenuItem.setVisible(False)
1539 self._toolsMenuItem.setVisible(False)
1540 self._logMenuItem.setVisible(False)
1541 self._evaluationMenuItem.setVisible(False)
1543 if not (info.HelperMaKaCInfo.getMaKaCInfoInstance().getRoomBookingModuleActive() and canModify):
1544 self._roomBookingMenuItem.setVisible(False)
1546 #if not (self._conf.hasEnabledSection("cfa") and (canModify or isAM)):
1547 if not (self._conf.hasEnabledSection("cfa") and (canModify)):
1548 self._abstractMenuItem.setVisible(False)
1550 if not (canModify or isPRM):
1551 self._contribListMenuItem.setVisible(False)
1553 if not (self._conf.hasEnabledSection("regForm") and (canModify or isRegistrar)):
1554 self._regFormMenuItem.setVisible(False)
1556 if not (self._conf.getType() == "conference" and (canModify or isReviewingStaff)):
1557 self._reviewingMenuItem.setVisible(False)
1558 else: #reviewing tab is enabled
1559 if isReviewingStaff and not canModify:
1560 self._reviewingMenuItem.setVisible(True)
1561 # For now we don't want the paper reviewing to be displayed
1562 #self._reviewingMenuItem.setVisible(False)
1565 if not (canModify or
1566 RCVideoServicesManager.hasRights(self._rh, 'any') or
1567 RCCollaborationAdmin.hasRights(self._rh) or RCCollaborationPluginAdmin.hasRights(self._rh, plugins = 'any')):
1568 self._videoServicesMenuItem.setVisible(False)
1570 #we hide the Advanced Options section if it has no items
1571 if not self._advancedOptionsSection.hasVisibleItems():
1572 self._advancedOptionsSection.setVisible(False)
1574 # we disable the Participants section for events of type conference
1575 if self._conf.getType() == 'conference':
1576 self._participantsMenuItem.setVisible(False)
1578 # make sure that the section evaluation is always activated
1579 # for all conferences
1580 self._conf.enableSection("evaluation")
1581 wf = self._rh.getWebFactory()
1582 if wf:
1583 wf.customiseSideMenu( self )
1585 def _setActiveSideMenuItem( self ):
1586 pass
1588 def _applyFrame( self, body ):
1589 frame = wcomponents.WConferenceModifFrame( self._conf, self._getAW())
1591 sideMenu = self._sideMenu.getHTML()
1593 p = { "categDisplayURLGen": urlHandlers.UHCategoryDisplay.getURL, \
1594 "confDisplayURLGen": urlHandlers.UHConferenceDisplay.getURL, \
1595 "event": "Conference",
1596 "sideMenu": sideMenu }
1597 wf = self._rh.getWebFactory()
1598 if wf:
1599 p["event"]=wf.getName()
1600 return frame.getHTML( body, **p )
1602 def _getBody( self, params ):
1603 self._createSideMenu()
1604 self._setActiveSideMenuItem()
1606 return self._applyFrame( self._getPageContent( params ) )
1608 def _getTabContent( self, params ):
1609 return "nothing"
1611 def _getPageContent( self, params ):
1612 return "nothing"
1614 class WPConferenceModifAbstractBase( WPConferenceModifBase ):
1616 def __init__(self, rh, conf):
1617 WPConferenceModifBase.__init__(self, rh, conf)
1619 def _createTabCtrl(self):
1620 self._tabCtrl = wcomponents.TabControl()
1622 self._tabCFA = self._tabCtrl.newTab( "cfasetup", _("Setup"), urlHandlers.UHConfModifCFA.getURL( self._conf ) )
1623 self._tabCFAPreview = self._tabCtrl.newTab("cfapreview", _("Preview"), urlHandlers.UHConfModifCFAPreview.getURL(self._conf))
1624 self._tabAbstractList = self._tabCtrl.newTab( "abstractList", _("List of Abstracts"), urlHandlers.UHConfAbstractList.getURL( self._conf ) )
1625 self._tabBOA = self._tabCtrl.newTab("boa", _("Book of Abstracts Setup"), urlHandlers.UHConfModAbstractBook.getURL(self._conf))
1626 self._tabCFAR = self._tabCtrl.newTab("reviewing", _("Reviewing"), urlHandlers.UHAbstractReviewingSetup.getURL(self._conf))
1628 # Create subtabs for the reviewing
1629 self._subTabARSetup = self._tabCFAR.newSubTab( "revsetup", _("Settings"),\
1630 urlHandlers.UHAbstractReviewingSetup.getURL(self._conf))
1631 self._subTabARTeam = self._tabCFAR.newSubTab( "revteam", _("Team"),\
1632 urlHandlers.UHAbstractReviewingTeam.getURL(self._conf))
1633 self._subTabARNotifTpl = self._tabCFAR.newSubTab( "notiftpl", _("Notification templates"),\
1634 urlHandlers.UHAbstractReviewingNotifTpl.getURL(self._conf))
1636 if not self._conf.hasEnabledSection("cfa"):
1637 self._tabBOA.disable()
1638 self._tabCFA.disable()
1639 self._tabAbstractList.disable()
1640 self._tabCFAPreview.disable()
1641 self._tabCFAR.disable()
1643 self._setActiveTab()
1645 def _getPageContent(self, params):
1646 self._createTabCtrl()
1648 return wcomponents.WTabControl( self._tabCtrl, self._getAW() ).getHTML( self._getTabContent( params ) )
1650 def _setActiveSideMenuItem(self):
1651 self._abstractMenuItem.setActive()
1653 def _getTabContent(self, params):
1654 return "nothing"
1656 def _setActiveTab(self):
1657 pass
1659 class WConfModifMainData(wcomponents.WTemplated):
1661 def __init__(self,conference,mfRegistry,ct,rh):
1662 self._conf=conference
1663 self.__mfr=mfRegistry
1664 self._ct=ct
1665 self._rh = rh
1667 def _getChairPersonsList(self):
1668 result = fossilize(self._conf.getChairList())
1669 for chair in result:
1670 av = AvatarHolder().match({"email": chair['email']},
1671 forceWithoutExtAuth=True, exact=True)
1672 chair['showManagerCB'] = True
1673 chair['showSubmitterCB'] = True
1674 if not av:
1675 if self._conf.getPendingQueuesMgr().getPendingConfSubmittersByEmail(chair['email']):
1676 chair['showSubmitterCB'] = False
1677 elif (av[0] in self._conf.getAccessController().getSubmitterList()):
1678 chair['showSubmitterCB'] = False
1679 if (av and self._conf.getAccessController().canModify(av[0])) or chair['email'] in self._conf.getAccessController().getModificationEmail():
1680 chair['showManagerCB'] = False
1681 return result
1683 def getVars(self):
1684 vars = wcomponents.WTemplated.getVars(self)
1685 type = vars["type"]
1686 vars["defaultStyle"] = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getDefaultStyle()
1687 vars["visibility"] = self._conf.getVisibility()
1688 vars["dataModificationURL"]=quoteattr(str(urlHandlers.UHConfDataModif.getURL(self._conf)))
1689 vars["addTypeURL"]=urlHandlers.UHConfAddContribType.getURL(self._conf)
1690 vars["removeTypeURL"]=urlHandlers.UHConfRemoveContribType.getURL(self._conf)
1691 vars["title"]=self._conf.getTitle()
1692 if isStringHTML(self._conf.getDescription()):
1693 vars["description"] = self._conf.getDescription()
1694 elif self._conf.getDescription():
1695 vars["description"] = self._conf.getDescription()
1696 else:
1697 vars["description"] = ""
1699 ###################################
1700 # Fermi timezone awareness #
1701 ###################################
1702 tz = self._conf.getTimezone()
1703 vars["timezone"] = tz
1704 vars["startDate"]=formatDateTime(self._conf.getAdjustedStartDate())
1705 vars["endDate"]=formatDateTime(self._conf.getAdjustedEndDate())
1706 ###################################
1707 # Fermi timezone awareness(end) #
1708 ###################################
1709 vars["chairText"] = self.htmlText(self._conf.getChairmanText())
1710 place=self._conf.getLocation()
1712 vars["locationName"]=vars["locationAddress"]=""
1713 if place:
1714 vars["locationName"]=self.htmlText(place.getName())
1715 vars["locationAddress"]=self.htmlText(place.getAddress())
1716 room=self._conf.getRoom()
1717 vars["locationRoom"]=""
1718 if room:
1719 vars["locationRoom"]=self.htmlText(room.getName())
1720 if isStringHTML(self._conf.getContactInfo()):
1721 vars["contactInfo"]=self._conf.getContactInfo()
1722 else:
1723 vars["contactInfo"] = """<table class="tablepre"><tr><td><pre>%s</pre></td></tr></table>""" % self._conf.getContactInfo()
1724 vars["supportEmailCaption"] = self._conf.getSupportInfo().getCaption()
1725 vars["supportEmail"] = i18nformat("""--_("not set")--""")
1726 if self._conf.getSupportInfo().hasEmail():
1727 vars["supportEmail"] = self.htmlText(self._conf.getSupportInfo().getEmail())
1728 typeList = []
1729 for type in self._conf.getContribTypeList():
1730 typeList.append("""<input type="checkbox" name="types" value="%s"><a href="%s">%s</a><br>
1731 <table><tr><td width="30"></td><td><font><pre>%s</pre></font></td></tr></table>"""%( \
1732 type.getId(), \
1733 str(urlHandlers.UHConfEditContribType.getURL(type)), \
1734 type.getName(), \
1735 type.getDescription()))
1736 vars["typeList"] = "".join(typeList)
1737 #------------------------------------------------------
1738 vars["reportNumbersTable"]=wcomponents.WReportNumbersTable(self._conf).getHTML()
1739 vars["eventType"] = self._conf.getType()
1740 vars["keywords"] = self._conf.getKeywords()
1741 vars["shortURLBase"] = Config.getInstance().getShortEventURL()
1742 vars["shortURLTag"] = self._conf.getUrlTag()
1743 vars["screenDatesURL"] = urlHandlers.UHConfScreenDatesEdit.getURL(self._conf)
1744 ssdate = format_datetime(self._conf.getAdjustedScreenStartDate(), format='EEEE d MMMM yyyy H:mm')
1745 if self._conf.getScreenStartDate() == self._conf.getStartDate():
1746 ssdate += i18nformat(""" <i> _("(normal)")</i>""")
1747 else:
1748 ssdate += i18nformat(""" <font color='red'>_("(modified)")</font>""")
1749 sedate = format_datetime(self._conf.getAdjustedScreenEndDate(), format='EEEE d MMMM yyyy H:mm')
1750 if self._conf.getScreenEndDate() == self._conf.getEndDate():
1751 sedate += i18nformat(""" <i> _("(normal)")</i>""")
1752 else:
1753 sedate += i18nformat(""" <font color='red'> _("(modified)")</font>""")
1754 vars['rbActive'] = info.HelperMaKaCInfo.getMaKaCInfoInstance().getRoomBookingModuleActive()
1755 vars["screenDates"] = "%s -> %s" % (ssdate, sedate)
1756 vars["timezoneList"] = TimezoneRegistry.getList()
1757 vars["chairpersons"] = self._getChairPersonsList()
1759 loc = self._conf.getLocation()
1760 room = self._conf.getRoom()
1761 vars["currentLocation"] = { 'location': loc.getName() if loc else "",
1762 'room': room.name if room else "",
1763 'address': loc.getAddress() if loc else "" }
1764 return vars
1766 class WPConferenceModificationClosed( WPConferenceModifBase ):
1768 def __init__(self, rh, target):
1769 WPConferenceModifBase.__init__(self, rh, target)
1771 def _getPageContent( self, params ):
1772 message = _("The event is currently locked and you cannot modify it in this status. ")
1773 if self._conf.canModify(self._rh.getAW()):
1774 message += _("If you unlock the event, you will be able to modify its details again.")
1775 return wcomponents.WClosed().getHTML({"message": message,
1776 "postURL": urlHandlers.UHConferenceOpen.getURL(self._conf),
1777 "showUnlockButton": self._conf.canModify(self._rh.getAW()),
1778 "unlockButtonCaption": _("Unlock event")})
1781 class WPConferenceModification( WPConferenceModifBase ):
1783 def __init__(self, rh, target, ct=None):
1784 WPConferenceModifBase.__init__(self, rh, target)
1785 self._ct = ct
1787 def _setActiveSideMenuItem( self ):
1788 self._generalSettingsMenuItem.setActive()
1790 def _getPageContent( self, params ):
1791 wc = WConfModifMainData( self._conf, ConfMFRegistry(), self._ct, self._rh )
1792 pars = { "type": params.get("type","") , "conferenceId": self._conf.getId()}
1793 return wc.getHTML( pars )
1795 class WConfModScreenDatesEdit(wcomponents.WTemplated):
1797 def __init__(self,conf):
1798 self._conf=conf
1800 def getVars(self):
1801 vars=wcomponents.WTemplated.getVars(self)
1802 vars["postURL"]=quoteattr(str(urlHandlers.UHConfScreenDatesEdit.getURL(self._conf)))
1803 ###################################
1804 # Fermi timezone awareness #
1805 ###################################
1806 csd = self._conf.getAdjustedStartDate()
1807 ced = self._conf.getAdjustedEndDate()
1808 ###################################
1809 # Fermi timezone awareness(end) #
1810 ###################################
1811 vars["conf_start_date"]=self.htmlText(format_datetime(csd, format='EEEE d MMMM yyyy H:mm'))
1812 vars["conf_end_date"]=self.htmlText(format_datetime(ced, format='EEEE d MMMM yyyy H:mm'))
1813 vars["start_date_own_sel"]=""
1814 vars["start_date_conf_sel"]=" checked"
1815 vars["sDay"],vars["sMonth"],vars["sYear"]=csd.day,csd.month,csd.year
1816 vars["sHour"],vars["sMin"]=csd.hour,csd.minute
1817 if self._conf.getScreenStartDate() != self._conf.getStartDate():
1818 vars["start_date_own_sel"]=" checked"
1819 vars["start_date_conf_sel"]=""
1820 sd=self._conf.getAdjustedScreenStartDate()
1821 vars["sDay"]=quoteattr(str(sd.day))
1822 vars["sMonth"]=quoteattr(str(sd.month))
1823 vars["sYear"]=quoteattr(str(sd.year))
1824 vars["sHour"]=quoteattr(str(sd.hour))
1825 vars["sMin"]=quoteattr(str(sd.minute))
1826 vars["end_date_own_sel"]=""
1827 vars["end_date_conf_sel"]=" checked"
1828 vars["eDay"],vars["eMonth"],vars["eYear"]=ced.day,ced.month,ced.year
1829 vars["eHour"],vars["eMin"]=ced.hour,ced.minute
1830 if self._conf.getScreenEndDate() != self._conf.getEndDate():
1831 vars["end_date_own_sel"]=" checked"
1832 vars["end_date_conf_sel"]=""
1833 ed=self._conf.getAdjustedScreenEndDate()
1834 vars["eDay"]=quoteattr(str(ed.day))
1835 vars["eMonth"]=quoteattr(str(ed.month))
1836 vars["eYear"]=quoteattr(str(ed.year))
1837 vars["eHour"]=quoteattr(str(ed.hour))
1838 vars["eMin"]=quoteattr(str(ed.minute))
1839 return vars
1841 class WPScreenDatesEdit(WPConferenceModification):
1843 def _getPageContent( self, params ):
1844 wc = WConfModScreenDatesEdit(self._conf)
1845 return wc.getHTML()
1847 class WConferenceDataModificationAdditionalInfo(wcomponents.WTemplated):
1849 def __init__( self, conference ):
1850 self._conf = conference
1852 def getVars(self):
1853 vars = wcomponents.WTemplated.getVars( self )
1854 vars["contactInfo"] = self._conf.getContactInfo()
1855 return vars
1858 class WConferenceDataModification(wcomponents.WTemplated):
1860 def __init__( self, conference, rh ):
1861 self._conf = conference
1862 self._rh = rh
1864 def _getVisibilityHTML(self):
1865 visibility = self._conf.getVisibility()
1866 topcat = self._conf.getOwnerList()[0]
1867 level = 0
1868 selected = ""
1869 if visibility == 0:
1870 selected = "selected"
1871 vis = [ i18nformat("""<option value="0" %s> _("Nowhere")</option>""") % selected]
1872 while topcat:
1873 level += 1
1874 selected = ""
1875 if level == visibility:
1876 selected = "selected"
1877 if topcat.getId() != "0":
1878 from MaKaC.common.TemplateExec import truncateTitle
1879 vis.append("""<option value="%s" %s>%s</option>""" % (level, selected, truncateTitle(topcat.getName(), 120)))
1880 topcat = topcat.getOwner()
1881 selected = ""
1882 if visibility > level:
1883 selected = "selected"
1884 vis.append( i18nformat("""<option value="999" %s> _("Everywhere")</option>""") % selected)
1885 vis.reverse()
1886 return "".join(vis)
1888 def getVars(self):
1889 vars = wcomponents.WTemplated.getVars( self )
1890 minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance()
1892 navigator = ""
1893 styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager()
1894 type = self._conf.getType()
1895 vars["timezoneOptions"] = TimezoneRegistry.getShortSelectItemsHTML(self._conf.getTimezone())
1896 styles=styleMgr.getExistingStylesForEventType(type)
1897 styleoptions = ""
1898 defStyle = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getDefaultStyle()
1899 if defStyle not in styles:
1900 defStyle = ""
1901 for styleId in styles:
1902 if styleId == defStyle or (defStyle == "" and styleId == "static"):
1903 selected = "selected"
1904 else:
1905 selected = ""
1906 styleoptions += "<option value=\"%s\" %s>%s</option>" % (styleId,selected,styleMgr.getStyleName(styleId))
1907 vars["conference"] = self._conf
1908 vars["useRoomBookingModule"] = minfo.getRoomBookingModuleActive()
1909 vars["styleOptions"] = styleoptions
1910 import MaKaC.webinterface.webFactoryRegistry as webFactoryRegistry
1911 wr = webFactoryRegistry.WebFactoryRegistry()
1912 types = [ "conference" ]
1913 for fact in wr.getFactoryList():
1914 types.append(fact.getId())
1915 vars["types"] = ""
1916 for id in types:
1917 typetext = id
1918 if typetext == "simple_event":
1919 typetext = "lecture"
1920 if self._conf.getType() == id:
1921 vars["types"] += "<option value=\"%s\" selected>%s" % (id,typetext)
1922 else:
1923 vars["types"] += "<option value=\"%s\">%s" % (id,typetext)
1924 vars["title"] = quoteattr( self._conf.getTitle() )
1925 vars["description"] = self._conf.getDescription()
1926 vars["keywords"] = self._conf.getKeywords()
1927 tz = self._conf.getTimezone()
1928 vars["sDay"] = str( self._conf.getAdjustedStartDate(tz).day )
1929 vars["sMonth"] = str( self._conf.getAdjustedStartDate(tz).month )
1930 vars["sYear"] = str( self._conf.getAdjustedStartDate(tz).year )
1931 vars["sHour"] = str( self._conf.getAdjustedStartDate(tz).hour )
1932 vars["sMinute"] = str( self._conf.getAdjustedStartDate(tz).minute )
1933 vars["eDay"] = str( self._conf.getAdjustedEndDate(tz).day )
1934 vars["eMonth"] = str( self._conf.getAdjustedEndDate(tz).month )
1935 vars["eYear"] = str( self._conf.getAdjustedEndDate(tz).year )
1936 vars["eHour"] = str( self._conf.getAdjustedEndDate(tz).hour )
1937 vars["eMinute"] = str( self._conf.getAdjustedEndDate(tz).minute )
1938 vars["chairText"] = quoteattr( self._conf.getChairmanText() )
1939 vars["orgText"] = quoteattr( self._conf.getOrgText() )
1940 vars["visibility"] = self._getVisibilityHTML()
1941 vars["shortURLTag"] = quoteattr( self._conf.getUrlTag() )
1942 locName, locAddress, locRoom = "", "", ""
1943 location = self._conf.getLocation()
1944 if location:
1945 locName = location.getName()
1946 locAddress = location.getAddress()
1947 room = self._conf.getRoom()
1948 if room:
1949 locRoom = room.getName()
1950 vars["locator"] = self._conf.getLocator().getWebForm()
1952 vars["locationAddress"] = locAddress
1954 vars["supportCaption"] = quoteattr(self._conf.getSupportInfo().getCaption())
1955 vars["supportEmail"] = quoteattr( self._conf.getSupportInfo().getEmail() )
1956 vars["locator"] = self._conf.getLocator().getWebForm()
1957 vars["event_type"] = ""
1958 vars["navigator"] = navigator
1959 eventType = self._conf.getType()
1960 if eventType == "conference":
1961 vars["additionalInfo"] = WConferenceDataModificationAdditionalInfo(self._conf).getHTML(vars)
1962 else:
1963 vars["additionalInfo"] = ""
1964 return vars
1967 class WPConfDataModif( WPConferenceModification ):
1969 def _getPageContent( self, params ):
1970 p = WConferenceDataModification( self._conf, self._rh )
1971 pars = {
1972 "postURL": urlHandlers.UHConfPerformDataModif.getURL(),
1973 "calendarIconURL": Config.getInstance().getSystemIconURL("calendar"),
1974 "calendarSelectURL": urlHandlers.UHSimpleCalendar.getURL(),
1975 "type": params.get("type") }
1976 return p.getHTML( pars )
1979 class WPConfAddMaterial( WPConferenceModification ):
1981 def __init__( self, rh, conf, mf ):
1982 WPConferenceModification.__init__( self, rh, conf )
1983 self._mf = mf
1985 def _getTabContent( self, params ):
1986 if self._mf:
1987 comp = self._mf.getCreationWC( self._conf )
1988 else:
1989 comp = wcomponents.WMaterialCreation( self._conf )
1990 pars = { "postURL": urlHandlers.UHConferencePerformAddMaterial.getURL() }
1991 return comp.getHTML( pars )
1994 class WConfModifScheduleGraphic(wcomponents.WTemplated):
1996 def __init__(self, conference, customLinks, **params):
1997 wcomponents.WTemplated.__init__(self, **params)
1998 self._conf = conference
1999 self._customLinks = customLinks
2001 def getVars( self ):
2002 vars=wcomponents.WTemplated.getVars(self)
2003 ################################
2004 # Fermi timezone awareness #
2005 ################################
2006 tz = self._conf.getTimezone()
2007 vars["timezone"]= tz
2008 vars["start_date"]=self._conf.getAdjustedStartDate().strftime("%a %d/%m")
2009 vars["end_date"]=self._conf.getAdjustedEndDate().strftime("%a %d/%m")
2010 #################################
2011 # Fermi timezone awareness(end) #
2012 #################################
2013 vars["editURL"]=quoteattr(str(urlHandlers.UHConfModScheduleDataEdit.getURL(self._conf)))
2015 vars['ttdata'] = schedule.ScheduleToJson.process(self._conf.getSchedule(), tz, None,
2016 days = None, mgmtMode = True)
2018 vars['customLinks'] = self._customLinks
2020 eventInfo = fossilize(self._conf, IConferenceEventInfoFossil, tz = tz)
2021 eventInfo['isCFAEnabled'] = self._conf.getAbstractMgr().isActive()
2022 vars['eventInfo'] = eventInfo
2024 return vars
2026 class WPConfModifScheduleGraphic( WPConferenceModifBase ):
2028 _userData = ['favorite-user-list', 'favorite-user-ids']
2030 def __init__(self, rh, conf):
2031 WPConferenceModifBase.__init__(self, rh, conf)
2032 self._contrib = None
2034 def _setActiveSideMenuItem( self ):
2035 self._timetableMenuItem.setActive()
2037 def getJSFiles(self):
2038 pluginJSFiles = {"paths" : []}
2039 self._notify("includeTimetableJSFiles", pluginJSFiles)
2040 return WPConferenceModifBase.getJSFiles(self) + \
2041 self._includeJSPackage('Timetable') + \
2042 pluginJSFiles['paths']
2044 def _getSchedule(self):
2045 self._customLinks = {}
2046 self._notify("customTimetableLinks", self._customLinks)
2047 return WConfModifScheduleGraphic( self._conf, self._customLinks )
2049 def _getTTPage( self, params ):
2050 wc = self._getSchedule()
2051 return wc.getHTML(params)
2053 def _getHeadContent( self ):
2055 baseurl = self._getBaseURL()
2056 pluginCSSFiles = {"paths" : []}
2057 self._notify("includeTimetableCSSFiles", pluginCSSFiles)
2058 return ".".join(["""<link rel="stylesheet" href="%s/%s">"""%(baseurl,path) for path in pluginCSSFiles['paths']])
2060 def _getPageContent(self, params):
2061 return self._getTTPage(params)
2063 #------------------------------------------------------------------------------
2064 class WPConfModifSchedule( WPConferenceModifBase ):
2066 def _setActiveTab( self ):
2067 self._tabSchedule.setActive()
2069 #def _getTabContent( self, params ):
2070 # wc = WConfModifSchedule( self._conf )
2071 # return wc.getHTML(params)
2073 #------------------------------------------------------------------------------
2074 class WConfModScheduleDataEdit(wcomponents.WTemplated):
2076 def __init__(self,conf):
2077 self._conf=conf
2079 def getVars(self):
2080 vars=wcomponents.WTemplated.getVars(self)
2081 vars["postURL"]=quoteattr(str(urlHandlers.UHConfModScheduleDataEdit.getURL(self._conf)))
2082 #######################################
2083 # Fermi timezone awareness #
2084 #######################################
2085 csd = self._conf.getAdjustedStartDate()
2086 ced = self._conf.getAdjustedEndDate()
2087 #######################################
2088 # Fermi timezone awareness(end) #
2089 #######################################
2090 vars["sDay"],vars["sMonth"],vars["sYear"]=str(csd.day),str(csd.month),str(csd.year)
2091 vars["sHour"],vars["sMin"]=str(csd.hour),str(csd.minute)
2092 vars["eDay"],vars["eMonth"],vars["eYear"]=str(ced.day),str(ced.month),str(ced.year)
2093 vars["eHour"],vars["eMin"]=str(ced.hour),str(ced.minute)
2094 return vars
2096 class WPModScheduleDataEdit(WPConfModifSchedule):
2098 def _getPageContent( self, params ):
2099 wc = WConfModScheduleDataEdit(self._conf)
2100 return wc.getHTML()
2103 class WConfModifACSessionCoordinatorRights(wcomponents.WTemplated):
2105 def __init__(self,conf):
2106 self._conf = conf
2108 def getVars( self ):
2109 vars = wcomponents.WTemplated.getVars(self)
2110 url = urlHandlers.UHConfModifCoordinatorRights.getURL(self._conf)
2111 html=[]
2112 scr = conference.SessionCoordinatorRights()
2113 for rightKey in scr.getRightKeys():
2114 url = urlHandlers.UHConfModifCoordinatorRights.getURL(self._conf)
2115 url.addParam("rightId", rightKey)
2116 if self._conf.hasSessionCoordinatorRight(rightKey):
2117 imgurl=Config.getInstance().getSystemIconURL("tick")
2118 else:
2119 imgurl=Config.getInstance().getSystemIconURL("cross")
2120 html.append("""
2121 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=%s><img class="imglink" src=%s></a> %s
2122 """%(quoteattr(str(url)), quoteattr(str(imgurl)), scr.getRight(rightKey)))
2123 vars["optionalRights"]="<br>".join(html)
2124 return vars
2127 class WConfModifAC:
2129 def __init__(self, conference, eventType, user):
2130 self.__conf = conference
2131 self._eventType = eventType
2132 self.__user = user
2134 def getHTML( self, params ):
2135 ac = wcomponents.WConfAccessControlFrame().getHTML( self.__conf,\
2136 params["setVisibilityURL"])
2137 dc = ""
2138 if not self.__conf.isProtected():
2139 dc = "<br>%s"%wcomponents.WDomainControlFrame( self.__conf ).getHTML()
2141 mc = wcomponents.WConfModificationControlFrame().getHTML( self.__conf) + "<br>"
2143 if self._eventType == "conference":
2144 rc = wcomponents.WConfRegistrarsControlFrame().getHTML(self.__conf) + "<br>"
2145 else:
2146 rc = ""
2148 tf = ""
2149 if self._eventType in ["conference", "meeting"]:
2150 tf = "<br>%s" % wcomponents.WConfProtectionToolsFrame(self.__conf).getHTML()
2151 cr = ""
2152 if self._eventType == "conference":
2153 cr = "<br>%s" % WConfModifACSessionCoordinatorRights(self.__conf).getHTML()
2155 return """<br><table width="100%%" class="ACtab"><tr><td>%s%s%s%s%s%s<br></td></tr></table>""" % (mc, rc, ac, dc, tf, cr)
2158 class WPConfModifAC(WPConferenceModifBase):
2160 def __init__(self, rh, conf):
2161 WPConferenceModifBase.__init__(self, rh, conf)
2162 self._eventType = "conference"
2163 if self._rh.getWebFactory() is not None:
2164 self._eventType = self._rh.getWebFactory().getId()
2165 self._user = self._rh._getUser()
2167 def _setActiveSideMenuItem(self):
2168 self._ACMenuItem.setActive()
2170 def _getPageContent(self, params):
2171 wc = WConfModifAC(self._conf, self._eventType, self._user)
2172 import MaKaC.webinterface.rh.conferenceModif as conferenceModif
2173 p = {
2174 "setVisibilityURL": urlHandlers.UHConfSetVisibility.getURL()
2176 return wc.getHTML(p)
2179 class WConfModifTools(wcomponents.WTemplated):
2181 def __init__(self, conference, user=None):
2182 self.__conf = conference
2183 self._user = user
2185 def getVars(self):
2186 vars = wcomponents.WTemplated.getVars(self)
2187 vars["offlsiteMsg"] = ""
2188 vars["dvdURL"] = quoteattr(str(urlHandlers.UHConfDVDCreation.getURL(self.__conf)))
2190 if self._user is None:
2191 vars["offlsiteMsg"] = _("(Please, login if you want to apply for your Offline Website)")
2192 vars["dvdURL"] = quoteattr("")
2194 vars["deleteIconURL"] = Config.getInstance().getSystemIconURL("delete")
2195 vars["cloneIconURL"] = Config.getInstance().getSystemIconURL("clone")
2196 vars["matPkgIconURL"] = quoteattr(str(Config.getInstance().getSystemIconURL("materialPkg")))
2197 vars["matPkgURL"] = quoteattr(str(urlHandlers.UHConfModFullMaterialPackage.getURL(self.__conf)))
2198 vars["dvdIconURL"] = quoteattr(str(Config.getInstance().getSystemIconURL("dvd")))
2199 vars["closeIconURL"] = quoteattr(str(Config.getInstance().getSystemIconURL("closeIcon")))
2200 vars["closeURL"] = quoteattr(str(urlHandlers.UHConferenceClose.getURL(self.__conf)))
2201 vars["alarmURL"] = quoteattr(str(urlHandlers.UHConfDisplayAlarm.getURL(self.__conf)))
2202 vars["alarmIconURL"] = quoteattr(str(Config.getInstance().getSystemIconURL("alarmIcon")))
2203 vars["badgePrintingURL"] = quoteattr(str(urlHandlers.UHConfModifBadgePrinting.getURL(self.__conf)))
2204 vars["badgeIconURL"] = quoteattr(str(Config.getInstance().getSystemIconURL("badge")))
2205 return vars
2208 class WPConfModifToolsBase(WPConferenceModifBase):
2210 def _setActiveSideMenuItem(self):
2211 self._toolsMenuItem.setActive()
2213 def _createTabCtrl(self):
2214 self._tabCtrl = wcomponents.TabControl()
2216 self._tabAlarms = self._tabCtrl.newTab("alarms", _("Alarms"), \
2217 urlHandlers.UHConfDisplayAlarm.getURL(self._conf))
2218 self._tabCloneEvent = self._tabCtrl.newTab("clone", _("Clone Event"), \
2219 urlHandlers.UHConfClone.getURL(self._conf))
2220 self._tabPosters = self._tabCtrl.newTab("posters", _("Posters"), \
2221 urlHandlers.UHConfModifPosterPrinting.getURL(self._conf))
2222 self._tabBadges = self._tabCtrl.newTab("badges", _("Badges/Tablesigns"), \
2223 urlHandlers.UHConfModifBadgePrinting.getURL(self._conf))
2224 self._tabClose = self._tabCtrl.newTab("close", _("Lock"), \
2225 urlHandlers.UHConferenceClose.getURL(self._conf))
2226 self._tabDelete = self._tabCtrl.newTab("delete", _("Delete"), \
2227 urlHandlers.UHConfDeletion.getURL(self._conf))
2228 self._tabMatPackage = self._tabCtrl.newTab("matPackage", _("Material Package"), \
2229 urlHandlers.UHConfModFullMaterialPackage.getURL(self._conf))
2230 self._tabOfflineSite = self._tabCtrl.newTab("offlineSite", _("Offline Site"), \
2231 urlHandlers.UHConfDVDCreation.getURL(self._conf))
2233 self._tabOfflineSite.setHidden(True)
2235 self._setActiveTab()
2237 wf = self._rh.getWebFactory()
2238 if wf:
2239 wf.customiseToolsTabCtrl(self._tabCtrl)
2241 def _getPageContent(self, params):
2242 self._createTabCtrl()
2244 html = wcomponents.WTabControl(self._tabCtrl, self._getAW()).getHTML(self._getTabContent(params))
2245 return html
2247 def _setActiveTab(self):
2248 pass
2250 def _getTabContent(self, params):
2251 return "nothing"
2254 class WPConfClosing(WPConfModifToolsBase):
2256 def __init__(self, rh, conf):
2257 WPConferenceModifBase.__init__(self, rh, conf)
2258 self._eventType = "conference"
2259 if self._rh.getWebFactory() is not None:
2260 self._eventType = self._rh.getWebFactory().getId()
2262 def _setActiveTab(self):
2263 self._tabClose.setActive()
2265 def _getTabContent(self, params):
2266 msg = {'challenge': _("Are you sure that you want to lock the event?"),
2267 'target': self._conf.getTitle(),
2268 'subtext': _("Note that if you lock the event, you will not be able to change its details any more. "
2269 "Only the creator of the event or an administrator of the system / category can unlock an event."),
2272 wc = wcomponents.WConfirmation()
2273 return wc.getHTML(msg,
2274 urlHandlers.UHConferenceClose.getURL(self._conf),
2276 severity="warning",
2277 confirmButtonCaption=_("Yes, lock this event"),
2278 cancelButtonCaption=_("No"))
2281 class WPConfDeletion(WPConfModifToolsBase):
2283 def _setActiveTab(self):
2284 self._tabDelete.setActive()
2286 def _getTabContent(self, params):
2287 msg = {'challenge': _("Are you sure that you want to delete the conference?"),
2288 'target': self._conf.getTitle(),
2289 'subtext': _("Note that if you delete the conference, all the items below it will also be deleted")
2292 wc = wcomponents.WConfirmation()
2293 return wc.getHTML(msg,
2294 urlHandlers.UHConfDeletion.getURL(self._conf),
2296 severity="danger",
2297 confirmButtonCaption=_("Yes, I am sure"),
2298 cancelButtonCaption=_("No"))
2301 class WPConfCloneConfirm(WPConfModifToolsBase):
2303 def __init__(self, rh, conf, nbClones):
2304 WPConfModifToolsBase.__init__(self, rh, conf)
2305 self._nbClones = nbClones
2307 def _setActiveTab(self):
2308 self._tabCloneEvent.setActive()
2310 def _getTabContent(self, params):
2312 msg = _("This action will create {0} new events. Are you sure you want to proceed").format(self._nbClones)
2314 wc = wcomponents.WConfirmation()
2315 url = urlHandlers.UHConfPerformCloning.getURL(self._conf)
2316 params = self._rh._getRequestParams()
2317 for key in params.keys():
2318 url.addParam(key, params[key])
2319 return wc.getHTML( msg, \
2320 url, {}, True, \
2321 confirmButtonCaption=_("Yes"), cancelButtonCaption=_("No"))
2323 #---------------------------------------------------------------------------
2326 class WPConferenceModifParticipantBase(WPConferenceModifBase):
2328 def __init__(self, rh, conf):
2329 WPConferenceModifBase.__init__(self, rh, conf)
2331 def _createTabCtrl(self):
2332 self._tabCtrl = wcomponents.TabControl()
2334 self._tabParticipantsSetup = self._tabCtrl.newTab("participantsetup", _("Setup"), urlHandlers.UHConfModifParticipantsSetup.getURL(self._conf))
2335 self._tabParticipantsList = self._tabCtrl.newTab("participantsList", _("Participants"), urlHandlers.UHConfModifParticipants.getURL(self._conf))
2336 self._tabStatistics = self._tabCtrl.newTab("statistics", _("Statistics"), urlHandlers.UHConfModifParticipantsStatistics.getURL(self._conf))
2337 if self._conf.getParticipation().getPendingParticipantList() and nowutc() < self._conf.getStartDate():
2338 self._tabParticipantsPendingList = self._tabCtrl.newTab("pendingList", _("Pending"), urlHandlers.UHConfModifParticipantsPending.getURL(self._conf), className="pendingTab")
2339 if self._conf.getParticipation().getDeclinedParticipantList():
2340 self._tabParticipantsDeclinedList = self._tabCtrl.newTab("declinedList", _("Declined"), urlHandlers.UHConfModifParticipantsDeclined.getURL(self._conf))
2342 self._setActiveTab()
2344 def _getPageContent(self, params):
2345 self._createTabCtrl()
2347 return wcomponents.WTabControl(self._tabCtrl, self._getAW()).getHTML(self._getTabContent(params))
2349 def getJSFiles(self):
2350 return WPConferenceModifBase.getJSFiles(self) + \
2351 self._includeJSPackage('Display')
2353 def _setActiveSideMenuItem(self):
2354 self._participantsMenuItem.setActive()
2356 def _getTabContent(self, params):
2357 return "nothing"
2359 def _setActiveTab(self):
2360 pass
2363 class WConferenceParticipant(wcomponents.WTemplated):
2365 def __init__(self, conference, participant):
2366 self._conf = conference
2367 self._participant = participant
2369 def getVars(self):
2370 vars = wcomponents.WTemplated.getVars(self)
2371 vars["conference"] = self._conf
2372 vars["participant"] = self._participant
2373 return vars
2376 class WConferenceParticipantPending(wcomponents.WTemplated):
2378 def __init__(self, conference, id, pending):
2379 self._conf = conference
2380 self._id = id
2381 self._pending = pending
2383 def getVars(self):
2384 vars = wcomponents.WTemplated.getVars(self)
2385 vars["conference"] = self._conf
2386 vars["id"] = self._id
2387 vars["pending"] = self._pending
2388 return vars
2391 class WConferenceParticipantsSetup(wcomponents.WTemplated):
2393 def __init__(self, conference):
2394 self._conf = conference
2396 def getVars(self):
2397 vars = wcomponents.WTemplated.getVars(self)
2398 vars["confId"] = self._conf.getId()
2399 vars["isObligatory"] = self._conf.getParticipation().isObligatory()
2400 vars["allowDisplay"] = self._conf.getParticipation().displayParticipantList()
2401 vars["addedInfo"] = self._conf.getParticipation().isAddedInfo()
2402 vars["allowForApply"] = self._conf.getParticipation().isAllowedForApplying()
2403 vars["autoAccept"] = self._conf.getParticipation().isAutoAccept()
2404 vars["numMaxParticipants"] = self._conf.getParticipation().getNumMaxParticipants()
2405 vars["notifyMgrNewParticipant"] = self._conf.getParticipation().isNotifyMgrNewParticipant()
2406 return vars
2409 class WPConfModifParticipantsSetup(WPConferenceModifParticipantBase):
2411 def _setActiveTab(self):
2412 self._tabParticipantsSetup.setActive()
2414 def _getTabContent(self, params):
2415 p = WConferenceParticipantsSetup(self._conf)
2416 return p.getHTML(params)
2419 class WConferenceParticipants(wcomponents.WTemplated):
2421 def __init__(self, conference):
2422 self._conf = conference
2424 def getVars(self):
2425 vars = wcomponents.WTemplated.getVars(self)
2427 vars["selectAll"] = Config.getInstance().getSystemIconURL("checkAll")
2428 vars["deselectAll"] = Config.getInstance().getSystemIconURL("uncheckAll")
2430 vars["participantsAction"] = str(urlHandlers.UHConfModifParticipantsAction.getURL(self._conf))
2431 vars["hasStarted"] = nowutc() < self._conf.getStartDate()
2432 vars["currentUser"] = self._rh._aw.getUser()
2433 vars["numberParticipants"] = len(self._conf.getParticipation().getParticipantList())
2434 vars["conf"] = self._conf
2435 vars["excelIconURL"] = quoteattr(str(Config.getInstance().getSystemIconURL("excel")))
2437 return vars
2440 class WPConfModifParticipants(WPConferenceModifParticipantBase):
2442 def _setActiveTab(self):
2443 self._tabParticipantsList.setActive()
2445 def _getTabContent(self, params):
2446 p = WConferenceParticipants(self._conf)
2447 return p.getHTML(params)
2450 class WConferenceParticipantsPending(wcomponents.WTemplated):
2452 def __init__(self, conference):
2453 self._conf = conference
2455 def getVars(self):
2456 vars = wcomponents.WTemplated.getVars(self)
2458 vars["selectAll"] = Config.getInstance().getSystemIconURL("checkAll")
2459 vars["deselectAll"] = Config.getInstance().getSystemIconURL("uncheckAll")
2460 vars["pending"] = self._getPendingParticipantsList()
2461 vars["numberPending"] = self._conf.getParticipation().getPendingNumber()
2462 vars["conf"] = self._conf
2463 vars["conferenceStarted"] = nowutc() > self._conf.getStartDate()
2464 vars["currentUser"] = self._rh._aw.getUser()
2466 return vars
2468 def _getPendingParticipantsList(self):
2469 l = []
2471 for k in self._conf.getParticipation().getPendingParticipantList().keys():
2472 p = self._conf.getParticipation().getPendingParticipantByKey(k)
2473 l.append((k, p))
2474 return l
2477 class WPConfModifParticipantsPending(WPConferenceModifParticipantBase):
2479 def _setActiveTab(self):
2480 self._tabParticipantsPendingList.setActive()
2482 def _getTabContent(self, params):
2483 p = WConferenceParticipantsPending(self._conf)
2484 return p.getHTML()
2487 class WConferenceParticipantsDeclined(wcomponents.WTemplated):
2489 def __init__(self, conference):
2490 self._conf = conference
2492 def getVars(self):
2494 vars = wcomponents.WTemplated.getVars(self)
2495 vars["declined"] = self._getDeclinedParticipantsList()
2496 vars["numberDeclined"] = self._conf.getParticipation().getDeclinedNumber()
2497 return vars
2499 def _getDeclinedParticipantsList(self):
2500 l = []
2502 for k in self._conf.getParticipation().getDeclinedParticipantList().keys():
2503 p = self._conf.getParticipation().getDeclinedParticipantByKey(k)
2504 l.append((k, p))
2505 return l
2508 class WPConfModifParticipantsDeclined(WPConferenceModifParticipantBase):
2510 def _setActiveTab(self):
2511 self._tabParticipantsDeclinedList.setActive()
2513 def _getTabContent(self, params):
2514 p = WConferenceParticipantsDeclined(self._conf)
2515 return p.getHTML()
2518 class WConferenceParticipantsStatistics(wcomponents.WTemplated):
2520 def __init__(self, conference):
2521 self._conf = conference
2523 def getVars(self):
2525 vars = wcomponents.WTemplated.getVars(self)
2526 vars["invited"] = self._conf.getParticipation().getInvitedNumber()
2527 vars["rejected"] = self._conf.getParticipation().getRejectedNumber()
2528 vars["added"] = self._conf.getParticipation().getAddedNumber()
2529 vars["refused"] = self._conf.getParticipation().getRefusedNumber()
2530 vars["pending"] = self._conf.getParticipation().getPendingNumber()
2531 vars["declined"] = self._conf.getParticipation().getDeclinedNumber()
2532 vars["conferenceStarted"] = nowutc() > self._conf.getStartDate()
2533 vars["present"] = self._conf.getParticipation().getPresentNumber()
2534 vars["absent"] = self._conf.getParticipation().getAbsentNumber()
2535 vars["excused"] = self._conf.getParticipation().getExcusedNumber()
2536 return vars
2539 class WPConfModifParticipantsStatistics(WPConferenceModifParticipantBase):
2541 def _setActiveTab(self):
2542 self._tabStatistics.setActive()
2544 def _getTabContent(self, params):
2545 p = WConferenceParticipantsStatistics(self._conf)
2546 return p.getHTML(params)
2549 class WPConfModifParticipantsInvitationBase(WPConferenceDisplayBase):
2551 def _getHeader(self):
2554 wc = wcomponents.WMenuSimpleEventHeader(self._getAW(), self._conf)
2555 return wc.getHTML({"loginURL": self.getLoginURL(),\
2556 "logoutURL": self.getLogoutURL(),\
2557 "confId": self._conf.getId(),\
2558 "currentView": "static",\
2559 "type": WebFactory.getId(),\
2560 "dark": True})
2562 def _getBody(self, params):
2563 return '<div style="margin:10px">{0}</div>'.format(self._getContent(params))
2566 class WPConfModifParticipantsInvite(WPConfModifParticipantsInvitationBase):
2568 def _getContent(self, params):
2569 msg = _("Please indicate whether you want to accept or reject the invitation to '{0}'").format(self._conf.getTitle())
2570 wc = wcomponents.WConfirmation()
2571 url = urlHandlers.UHConfParticipantsInvitation.getURL(self._conf)
2572 url.addParam("participantId",params["participantId"])
2573 return wc.getHTML(msg,
2574 url,
2576 confirmButtonCaption=_("Accept"),
2577 cancelButtonCaption=_("Reject"),
2578 severity="accept")
2580 #---------------------------------------------------------------------------
2582 class WPConfModifParticipantsRefuse(WPConfModifParticipantsInvitationBase):
2584 def _getContent( self, params ):
2585 msg = i18nformat("""
2586 <font size="+2"> _("Are you sure you want to refuse to attend the '%s'")?</font>
2587 """)%(self._conf.getTitle())
2588 wc = wcomponents.WConfirmation()
2589 url = urlHandlers.UHConfParticipantsRefusal.getURL( self._conf )
2590 url.addParam("participantId",params["participantId"])
2591 return wc.getHTML( msg, url, {}, \
2592 confirmButtonCaption= _("Refuse"), cancelButtonCaption= _("Cancel") )
2594 #---------------------------------------------------------------------------
2596 class WConferenceLog(wcomponents.WTemplated):
2598 def __init__(self, conference):
2599 wcomponents.WTemplated.__init__(self)
2600 self.__conf = conference
2601 self._tz = info.HelperMaKaCInfo.getMaKaCInfoInstance().getTimezone()
2602 if not self._tz:
2603 self._tz = 'UTC'
2605 def getVars(self):
2606 log_vars = wcomponents.WTemplated.getVars(self)
2607 log_vars["log_dict"] = self._getLogDict()
2608 log_vars["timezone"] = timezone(self._tz)
2609 return log_vars
2611 def _getLogDict(self):
2612 """Return a dictionary of log entries per day."""
2613 log = self.__conf.getLogHandler().getLogList()
2614 log_dict = collections.defaultdict(list)
2615 for line in log:
2616 date = line.getLogDate().date()
2617 log_dict[date].append(line)
2618 return log_dict
2621 class WPConfModifLog(WPConferenceModifBase):
2623 def _setActiveSideMenuItem(self):
2624 self._logMenuItem.setActive()
2626 def _getPageContent(self, params):
2627 p = WConferenceLog(self._conf)
2628 return p.getHTML(params)
2630 #---------------------------------------------------------------------------
2632 class WConfModifListings( wcomponents.WTemplated ):
2634 def __init__( self, conference ):
2635 self.__conf = conference
2637 def getVars( self ):
2638 vars = wcomponents.WTemplated.getVars( self )
2639 vars["pendingQueuesIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("listing")))
2640 vars["pendingQueuesURL"]=quoteattr(str(urlHandlers.UHConfModifPendingQueues.getURL( self.__conf )))
2641 vars["allSessionsConvenersIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("listing")))
2642 vars["allSessionsConvenersURL"]=quoteattr(str(urlHandlers.UHConfAllSessionsConveners.getURL( self.__conf )))
2643 vars["allSpeakersIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("listing")))
2644 vars["allSpeakersURL"]=quoteattr(str(urlHandlers.UHConfAllSpeakers.getURL( self.__conf )))
2645 vars["allPrimaryAuthorsIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("listing")))
2646 vars["allPrimaryAuthorsURL"]=quoteattr(str(urlHandlers.UHConfAllPrimaryAuthors.getURL( self.__conf )))
2647 vars["allCoAuthorsIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("listing")))
2648 vars["allCoAuthorsURL"]=quoteattr(str(urlHandlers.UHConfAllCoAuthors.getURL( self.__conf )))
2649 return vars
2652 class WPConfModifListings(WPConferenceModifBase):
2654 def __init__(self, rh, conference):
2655 WPConferenceModifBase.__init__(self, rh, conference)
2656 self._createTabCtrl()
2658 def _setActiveSideMenuItem(self):
2659 self._listingsMenuItem.setActive()
2661 def _createTabCtrl(self):
2662 self._tabCtrl = wcomponents.TabControl()
2663 self._subTabSpeakers = self._tabCtrl.newTab('speakers',
2664 _('All Contribution Speakers'),
2665 urlHandlers.UHConfAllSpeakers.getURL(self._conf))
2666 self._subTabConveners = self._tabCtrl.newTab('conveners',
2667 _('All Session Conveners'),
2668 urlHandlers.UHConfAllSessionsConveners.getURL(self._conf))
2669 self._subTabUsers = self._tabCtrl.newTab('users',
2670 _('People Pending'),
2671 urlHandlers.UHConfModifPendingQueues.getURL(self._conf))
2673 def _getPageContent(self, params):
2674 self._setActiveTab()
2675 return wcomponents.WTabControl(self._tabCtrl, self._getAW()).getHTML(self._getTabContent(params))
2677 def _setActiveTab(self):
2678 self._subTabUsers.setActive()
2680 #---------------------------------------------------------------------------
2681 #---------------------------------------------------------------------------
2683 class WConferenceClone(wcomponents.WTemplated):
2685 def __init__(self, conference):
2686 self.__conf = conference
2688 def _getSelectDay(self):
2689 sd = ""
2690 for i in range(31) :
2691 selected = ""
2692 if datetime.today().day == (i+1) :
2693 selected = "selected=\"selected\""
2694 sd += "<OPTION VALUE=\"%d\" %s>%d\n"%(i+1, selected, i+1)
2695 return sd
2697 def _getSelectMonth(self):
2698 sm = ""
2699 month = [ "January", "February", "March", "April", "May", "June",
2700 "July", "August", "September", "October", "November", "December"]
2701 for i in range(12) :
2702 selected = ""
2703 if datetime.today().month == (i+1) :
2704 selected = "selected=\"selected\""
2705 sm += "\t<OPTION VALUE=\"%d\" %s>%s\n"%(i+1, selected, _(month[i]))
2706 return sm
2708 def _getSelectYear(self):
2709 sy = ""
2710 i = 1995
2711 while i < 2015 :
2712 selected = ""
2713 if datetime.today().year == i :
2714 selected = "selected=\"selected\""
2715 sy += "\t<OPTION VALUE=\"%d\" %s>%d\n"%(i, selected, i)
2716 i += 1
2717 return sy
2720 def getVars(self):
2721 vars = wcomponents.WTemplated.getVars(self)
2722 vars["confTitle"] = self.__conf.getTitle()
2723 vars["confId"] = self.__conf.getId()
2724 vars["selectDay"] = self._getSelectDay()
2725 vars["selectMonth"] = self._getSelectMonth()
2726 vars["selectYear"] = self._getSelectYear()
2727 vars["calendarIconURL"] = Config.getInstance().getSystemIconURL( "calendar" )
2728 vars["calendarSelectURL"] = urlHandlers.UHSimpleCalendar.getURL()
2729 return vars
2732 class WPConfClone( WPConfModifToolsBase, OldObservable ):
2734 def _setActiveTab( self ):
2735 self._tabCloneEvent.setActive()
2737 def _getTabContent( self, params ):
2738 p = WConferenceClone( self._conf )
2739 pars = {"cancelURL": urlHandlers.UHConfModifTools.getURL( self._conf ), \
2740 "cloneOnce": urlHandlers.UHConfPerformCloneOnce.getURL( self._conf ), \
2741 "cloneInterval": urlHandlers.UHConfPerformCloneInterval.getURL( self._conf ), \
2742 "cloneday": urlHandlers.UHConfPerformCloneDays.getURL( self._conf ), \
2743 "cloning" : urlHandlers.UHConfPerformCloning.getURL( self._conf ),
2744 "cloneOptions": i18nformat("""<li><input type="checkbox" name="cloneTracks" id="cloneTracks" value="1" />_("Tracks")</li>
2745 <li><input type="checkbox" name="cloneTimetable" id="cloneTimetable" value="1" />_("Full timetable")</li>
2746 <li><ul style="list-style-type: none;"><li><input type="checkbox" name="cloneSessions" id="cloneSessions" value="1" />_("Sessions")</li></ul></li>
2747 <li><input type="checkbox" name="cloneRegistration" id="cloneRegistration" value="1" >_("Registration")</li>
2748 <li><input type="checkbox" name="cloneEvaluation" id="cloneEvaluation" value="1" />_("Evaluation")</li>""") }
2749 #let the plugins add their own elements
2750 self._notify('addCheckBox2CloneConf', pars)
2751 return p.getHTML(pars)
2753 #---------------------------------------------------------------------------------------
2756 class WConferenceAllSessionsConveners(wcomponents.WTemplated):
2758 def __init__(self, conference):
2759 self.__conf = conference
2761 def getVars(self):
2762 vars = wcomponents.WTemplated.getVars(self)
2763 vars["confTitle"] = self.__conf.getTitle()
2764 vars["confId"] = self.__conf.getId()
2765 vars["convenerSelectionAction"] = quoteattr(str(urlHandlers.UHConfAllSessionsConvenersAction.getURL(self.__conf)))
2766 vars["contribSetIndex"] = 'index'
2767 vars["convenerNumber"] = str(len(self.__conf.getAllSessionsConvenerList()))
2768 vars["conveners"] = self._getAllConveners()
2769 vars["backURL"] = quoteattr(str(urlHandlers.UHConfModifListings.getURL(self.__conf)))
2770 return vars
2772 def _getTimetableURL(self, convener):
2773 url = urlHandlers.UHSessionModifSchedule.getURL(self.__conf)
2774 url.addParam("sessionId", convener.getSession().getId())
2775 if hasattr(convener, "getSlot"):
2776 timetable = "#" + str(convener.getSlot().getStartDate().strftime("%Y%m%d")) + ".s%sl%s" % (convener.getSession().getId(), convener.getSlot().getId())
2777 else:
2778 timetable = "#" + str(convener.getSession().getStartDate().strftime("%Y%m%d"))
2780 return "%s%s" % (url, timetable)
2782 def _getAllConveners(self):
2783 convenersFormatted = []
2784 convenersDict = self.__conf.getAllSessionsConvenerList()
2786 for key, conveners in convenersDict.iteritems():
2787 data = None
2789 for convener in convenersDict[key]:
2791 if not data:
2792 data = {
2793 'email': convener.getEmail(),
2794 'name': convener.getFullName() or '',
2795 'sessions': []
2798 sessionData = {
2799 'title': '',
2800 'urlTimetable': self._getTimetableURL(convener),
2801 'urlSessionModif': None
2804 if isinstance(convener, conference.SlotChair):
2805 title = convener.getSlot().getTitle() or "Block %s" % convener.getSlot().getId()
2806 sessionData['title'] = convener.getSession().getTitle() + ': ' + title
2807 else:
2808 url = urlHandlers.UHSessionModification.getURL(self.__conf)
2809 url.addParam('sessionId', convener.getSession().getId())
2811 sessionData['urlSessionModif'] = str(url)
2812 sessionData['title'] = convener.getSession().getTitle() or ''
2814 data['sessions'].append(sessionData)
2816 convenersFormatted.append(data)
2818 return convenersFormatted
2821 class WPConfAllSessionsConveners(WPConfModifListings):
2823 def _setActiveTab(self):
2824 self._subTabConveners.setActive()
2826 def _getTabContent(self, params):
2827 p = WConferenceAllSessionsConveners(self._conf)
2828 return p.getHTML()
2830 #---------------------------------------------------------------------------------------
2833 class WConfModifAllContribParticipants(wcomponents.WTemplated):
2835 def __init__(self, conference, partIndex):
2836 self._title = _("All participants list")
2837 self._conf = conference
2838 self._order = ""
2839 self._dispopts = ["Email", "Contributions"]
2840 self._partIndex = partIndex
2842 def getVars(self):
2843 vars = wcomponents.WTemplated.getVars(self)
2844 self._url = vars["participantMainPageURL"]
2845 vars["speakers"] = self._getAllParticipants()
2846 vars["backURL"] = quoteattr(str(urlHandlers.UHConfModifListings.getURL(self._conf)))
2847 vars["participantNumber"] = str(len(self._partIndex.getParticipationKeys()))
2849 return vars
2851 def _getAllParticipants(self):
2852 speakers = []
2854 for key in self._partIndex.getParticipationKeys():
2855 participationList = self._partIndex.getById(key)
2857 if participationList:
2858 participant = participationList[0]
2860 pData = {
2861 'name': participant.getFullName(),
2862 'email': participant.getEmail(),
2863 'contributions': []
2866 for participation in participationList:
2867 contribution = participation.getContribution()
2869 if contribution:
2870 pData['contributions'].append({
2871 'title': contribution.getTitle(),
2872 'url': str(urlHandlers.UHContributionModification.getURL(contribution))
2875 speakers.append(pData)
2877 return speakers
2879 def _getURL(self):
2880 return self._url
2883 class WPConfAllSpeakers(WPConfModifListings):
2885 def _setActiveTab(self):
2886 self._subTabSpeakers.setActive()
2888 def _getTabContent(self, params):
2889 p = WConfModifAllContribParticipants( self._conf, self._conf.getSpeakerIndex() )
2890 return p.getHTML({"title": _("All speakers list"), \
2891 "participantMainPageURL":urlHandlers.UHConfAllSpeakers.getURL(self._conf), \
2892 "participantSelectionAction":quoteattr(str(urlHandlers.UHConfAllSpeakersAction.getURL(self._conf)))})
2894 # I can't find where any of these are used or mathcing tpls,
2895 # I presume they are legacy and (potentially) can be deleted? Matt
2897 # class WPConfAllPrimaryAuthors( WPConfModifListings ):
2899 # def _getPageContent( self, params ):
2900 # p = WConfModifAllContribParticipants( self._conf, self._conf.getPrimaryAuthorIndex() )
2901 # return p.getHTML({"title": _("All primary authors list"), \
2902 # "participantMainPageURL":urlHandlers.UHConfAllPrimaryAuthors.getURL(self._conf), \
2903 # "participantSelectionAction":quoteattr(str(urlHandlers.UHConfAllPrimaryAuthorsAction.getURL(self._conf)))})
2906 # class WPConfAllCoAuthors( WPConfModifListings ):
2908 # def _getPageContent( self, params ):
2909 # p = WConfModifAllContribParticipants( self._conf, self._conf.getCoAuthorIndex() )
2910 # return p.getHTML({"title": _("All co-authors list"), \
2911 # "participantMainPageURL":urlHandlers.UHConfAllCoAuthors.getURL(self._conf), \
2912 # "participantSelectionAction":quoteattr(str(urlHandlers.UHConfAllCoAuthorsAction.getURL(self._conf)))})
2915 class WPEMailContribParticipants ( WPConfModifListings):
2916 def __init__(self, rh, conf, participantList):
2917 WPConfModifListings.__init__(self, rh, conf)
2918 self._participantList = participantList
2920 def _getPageContent(self,params):
2921 wc = WEmailToContribParticipants(self._conf, self._getAW().getUser(), self._participantList)
2922 return wc.getHTML()
2924 class WEmailToContribParticipants(wcomponents.WTemplated):
2925 def __init__(self,conf,user,contribParticipantList):
2926 self._conf = conf
2927 try:
2928 self._fromemail = user.getEmail()
2929 except:
2930 self._fromemail = ""
2931 self._contribParticipantList = contribParticipantList
2933 def getVars(self):
2934 vars = wcomponents.WTemplated.getVars( self )
2935 toEmails=[]
2936 toIds=[]
2937 for email in self._contribParticipantList:
2938 if len(email) > 0 :
2939 toEmails.append(email)
2940 vars["From"] = self._fromemail
2941 vars["toEmails"]= ", ".join(toEmails)
2942 vars["emails"]= ",".join(toEmails)
2943 vars["postURL"]=urlHandlers.UHContribParticipantsSendEmail.getURL(self._conf)
2944 vars["subject"]=""
2945 vars["body"]=""
2946 return vars
2947 #---------------------------------------------------------------------------------------
2949 class WPEMailConveners ( WPConfModifListings):
2950 def __init__(self, rh, conf, convenerList):
2951 WPConfModifListings.__init__(self, rh, conf)
2952 self._convenerList = convenerList
2954 def _getPageContent(self,params):
2955 wc = WEmailToConveners(self._conf, self._getAW().getUser(), self._convenerList)
2956 return wc.getHTML()
2958 class WEmailToConveners(wcomponents.WTemplated):
2959 def __init__(self,conf,user,convenerList):
2960 self._conf = conf
2961 try:
2962 self._fromemail = user.getEmail()
2963 except:
2964 self._fromemail = ""
2965 self._convenerList = convenerList
2967 def getVars(self):
2968 vars = wcomponents.WTemplated.getVars( self )
2969 toEmails=[]
2970 toIds=[]
2971 for email in self._convenerList:
2972 if len(email) > 0 :
2973 toEmails.append(email)
2974 vars["From"] = self._fromemail
2975 vars["toEmails"]= ", ".join(toEmails)
2976 vars["emails"]= ",".join(toEmails)
2977 vars["postURL"]=urlHandlers.UHConvenersSendEmail.getURL(self._conf)
2978 vars["subject"]=""
2979 vars["body"]=""
2980 return vars
2982 class WPConfAllParticipants( WPConfModifListings ):
2984 def _getTabContent( self, params ):
2985 p = wcomponents.WConferenceAllParticipants( self._conf )
2986 return p.getHTML()
2988 #---------------------------------------------------------------------------------------
2991 class WConvenerSentMail (wcomponents.WTemplated):
2992 def __init__(self,conf):
2993 self._conf = conf
2995 def getVars(self):
2996 vars = wcomponents.WTemplated.getVars( self )
2997 vars["BackURL"]=quoteattr(str(urlHandlers.UHConfAllSessionsConveners.getURL(self._conf)))
2998 return vars
3000 class WPConvenerSentEmail( WPConfModifListings ):
3001 def _getTabContent(self,params):
3002 wc = WConvenerSentMail(self._conf)
3003 return wc.getHTML()
3006 class WContribParticipationSentMail(wcomponents.WTemplated):
3007 def __init__(self,conf):
3008 self._conf = conf
3010 def getVars(self):
3011 vars = wcomponents.WTemplated.getVars( self )
3012 vars["BackURL"]=quoteattr(str(urlHandlers.UHConfAllSpeakers.getURL(self._conf)))
3013 return vars
3016 class WPContribParticipationSentEmail( WPConfModifListings ):
3017 def _getTabContent(self,params):
3018 wc = WContribParticipationSentMail(self._conf)
3019 return wc.getHTML()
3022 #---------------------------------------------------------------------------------------
3024 class WConfDisplayAlarm( wcomponents.WTemplated ):
3026 def __init__(self, conference, aw):
3027 self.__conf = self.__target = conference
3028 self._aw=aw
3030 def getVars( self ):
3031 vars = wcomponents.WTemplated.getVars( self )
3032 vars["locator"] = self.__target.getLocator().getWebForm()
3033 vars["dtFormat"]= "%Y-%m-%d %H:%M"
3034 vars["confTZ"]= timezone(self.__target.getTimezone())
3035 vars["alarmList"] = self.__target.getAlarmList()
3036 vars["timezone"] = self.__target.getTimezone()
3037 vars["addAlarmURL"] = urlHandlers.UHConfAddAlarm.getURL( self.__conf )
3038 vars["deleteAlarmURL"] = urlHandlers.UHConfDeleteAlarm.getURL()
3039 vars["modifyAlarmURL"] = urlHandlers.UHConfModifyAlarm.getURL()
3040 return vars
3042 class WPConfDisplayAlarm( WPConfModifToolsBase ):
3044 def _getTabContent( self, params ):
3045 wc = WConfDisplayAlarm( self._conf, self._rh._getUser() )
3046 return wc.getHTML()
3048 #---------------------------------------------------------------------------------------
3050 class WSetAlarm(wcomponents.WTemplated):
3052 def __init__(self, conference, aw):
3053 self.__conf = conference
3054 self._aw=aw
3056 def _getFromList(self):
3057 fromList = {}
3058 for ch in self.__conf.getChairList():
3059 if not fromList.has_key(ch.getEmail().strip()):
3060 fromList[ch.getEmail().strip()] = ch.getFullName()
3061 if self.__conf.getSupportInfo().getEmail().strip()!="" and not fromList.has_key(self.__conf.getSupportInfo().getEmail().strip()):
3062 fromList[self.__conf.getSupportInfo().getEmail().strip()] = self.__conf.getSupportInfo().getEmail().strip()
3063 if self._aw.getUser() is not None and not fromList.has_key(self._aw.getUser().getEmail().strip()):
3064 fromList[self._aw.getUser().getEmail().strip()] = self._aw.getUser().getFullName()
3065 if self.__conf.getCreator() is not None and not fromList.has_key(self.__conf.getCreator().getEmail().strip()):
3066 fromList[self.__conf.getCreator().getEmail().strip()] = self.__conf.getCreator().getFullName()
3067 return fromList
3069 def getVars(self):
3070 vars = wcomponents.WTemplated.getVars(self)
3071 if vars.has_key("alarmId"):
3072 vars["formTitle"] = _("Create a new alarm email")
3073 else:
3074 vars["formTitle"] = _("Modify alarm data")
3075 vars["timezone"] = self.__conf.getTimezone()
3076 vars["conference"] = self.__conf
3077 vars["today"] = datetime.today()
3078 vars["fromList"] = self._getFromList()
3079 vars["date_format"] = '%d/%m/%Y %H:%M'
3081 try:
3082 vars["alarm_date"] = datetime(vars['year'], vars['month'], vars['day'],
3083 int(vars['hour']), int(vars['minute']))
3084 except ValueError:
3085 vars["alarm_date"] = self.__conf.getAdjustedStartDate()
3086 return vars
3088 class WPConfAddAlarm( WPConfModifToolsBase ):
3090 def _setActiveTab( self ):
3091 self._tabAlarms.setActive()
3093 def _getTabContent( self, params ):
3094 wc = WSetAlarm( self._conf, self._getAW() )
3095 pars = {}
3096 pars["alarmId"] = self._rh._reqParams.get("alarmId","")
3097 pars["user"] = self._rh._getUser()
3098 pars["fromAddr"] = self._rh._reqParams.get("fromAddr","")
3099 pars["Emails"] = self._rh._reqParams.get("Emails","")
3100 pars["note"] = self._rh._reqParams.get("note","")
3101 pars["includeConf"] = (self._rh._reqParams.get("includeConf","")=="1")
3102 pars["toAllParticipants"] = (self._rh._reqParams.get("toAllParticipants",False) == "on")
3103 pars["dateType"] = int(self._rh._reqParams.get("dateType",-1))
3104 tz=self._conf.getTimezone()
3105 now = nowutc().astimezone(timezone(tz))
3106 pars["year"]=self._rh._reqParams.get("year",now.year)
3107 pars["month"] = self._rh._reqParams.get("month",now.month)
3108 pars["day"] = self._rh._reqParams.get("day",now.day)
3109 pars["hour"] = self._rh._reqParams.get("hour","08")
3110 pars["minute"] = self._rh._reqParams.get("minute","00")
3111 pars["timeBefore"] = int(self._rh._reqParams.get("_timeBefore",0))
3112 pars["timeTypeBefore"] = self._rh._reqParams.get("dayBefore","")
3113 return wc.getHTML( pars )
3115 #--------------------------------------------------------------------
3117 class WPConfModifyAlarm( WPConfModifToolsBase ):
3119 def __init__(self, caller, conf, alarm):
3120 WPConfModifToolsBase.__init__(self, caller, conf)
3121 self._alarm = alarm
3123 def _getTabContent( self, params ):
3124 wc = WSetAlarm(self._conf, self._getAW())
3125 pars ={}
3126 pars["alarmId"] = self._alarm.getConfRelativeId()
3127 pars["timeBeforeType"] = ""
3128 timeBefore=0
3129 year = month = day = hour = minute = -1
3130 if self._alarm.getTimeBefore():
3131 pars["dateType"] = 2
3132 #the date is calculated from the conference startdate
3133 if self._alarm.getTimeBefore() < timedelta(days=1):
3134 pars["timeBeforeType"] = "hours"
3135 timeBefore = int(self._alarm.getTimeBefore().seconds/3600)
3136 else:
3137 #time before upper to 1 day
3138 pars["timeBeforeType"] = "days"
3139 timeBefore = int(self._alarm.getTimeBefore().days)
3140 else:
3141 #the date is global
3142 pars["dateType"] = 1
3143 startOn = self._alarm.getStartOn().astimezone(timezone(self._conf.getTimezone()))
3144 if startOn != None:
3145 month = startOn.month
3146 day = startOn.day
3147 hour = startOn.hour
3148 minute = startOn.minute
3149 year = startOn.year
3150 pars["day"] = day
3151 pars["month"] = month
3152 pars["year"] = year
3153 pars["hour"] = hour
3154 pars["minute"] = minute
3155 pars["timeBefore"] = timeBefore
3156 pars["subject"] = self._alarm.getSubject()
3157 pars["Emails"] = ", ".join(self._alarm.getToAddrList())
3158 pars["fromAddr"] = self._alarm.getFromAddr()
3159 pars["text"] = self._alarm.getText()
3160 pars["note"] = self._alarm.getNote()
3161 pars["toAllParticipants"] = self._alarm.getToAllParticipants()
3162 pars["includeConf"] = self._alarm.getConfSummary()
3163 return wc.getHTML( pars )
3165 #----------------------------------------------------------------------------------
3167 class WConfModifCFAAddField( wcomponents.WTemplated ):
3169 def __init__( self, conference, fieldId ):
3170 self._conf = conference
3171 self._fieldId = fieldId
3173 def getVars (self):
3174 vars = wcomponents.WTemplated.getVars(self)
3175 vars["postURL"] = quoteattr(str(urlHandlers.UHConfModifCFAPerformAddOptFld.getURL(self._conf)))
3176 selectedYes = ""
3177 selectedNo = "checked"
3178 fieldType = "textarea"
3179 if self._fieldId != "":
3180 abf = self._conf.getAbstractMgr().getAbstractFieldsMgr().getFieldById(self._fieldId)
3181 vars["id"] = quoteattr(abf.getId())
3182 vars["name"] = quoteattr(abf.getName())
3183 vars["caption"] = quoteattr(abf.getCaption())
3184 vars["maxlength"] = quoteattr(str(abf.getMaxLength()))
3185 vars["action"] = "Edit"
3186 if abf.isMandatory():
3187 selectedYes = "checked"
3188 selectedNo = ""
3189 fieldType = abf.getType()
3190 vars["limitationOption"] = abf.getLimitation()
3191 else:
3192 vars["id"] = vars["name"] = vars["caption"] = quoteattr("")
3193 vars["maxlength"] = 0
3194 vars["action"] = "Add"
3195 vars["limitationOption"] = "words" # by default we show selected the "words" option
3196 #vars["fieldName"] = """<input type="text" name="fieldId" value=%s size="60">""" % quoteattr(self._fieldId)
3197 #if self._fieldId == "content":
3198 # vars["fieldName"] = """%s<input type="hidden" name="fieldId" value=%s size="60">""" % (self._fieldId, quoteattr(self._fieldId))
3199 vars["selectedYes"] = selectedYes
3200 vars["selectedNo"] = selectedNo
3201 vars["fieldTypeOptions"] = ""
3202 for type in review.AbstractField._fieldTypes:
3203 selected = ""
3204 if type == fieldType:
3205 selected = " selected"
3206 vars["fieldTypeOptions"] += """<option value="%s"%s>%s\n""" % (type, selected, type)
3207 return vars
3210 class WConfModifCFA( wcomponents.WTemplated ):
3212 def __init__( self, conference ):
3213 self._conf = conference
3215 def _getAbstractFieldsHTML(self, vars):
3216 abMgr = self._conf.getAbstractMgr()
3217 enabledText = _("Click to disable")
3218 disabledText = _("Click to enable")
3219 laf=[]
3220 urlAdd = str(urlHandlers.UHConfModifCFAAddOptFld.getURL(self._conf))
3221 urlRemove = str(urlHandlers.UHConfModifCFARemoveOptFld.getURL(self._conf))
3222 laf.append("""<form action="%s" method="POST">""" % urlAdd)
3223 for af in abMgr.getAbstractFieldsMgr().getFields():
3224 urlUp = urlHandlers.UHConfModifCFAAbsFieldUp.getURL(self._conf)
3225 urlUp.addParam("fieldId",af.getId())
3226 urlDown = urlHandlers.UHConfModifCFAAbsFieldDown.getURL(self._conf)
3227 urlDown.addParam("fieldId",af.getId())
3228 if af.isMandatory():
3229 mandatoryText = _("mandatory")
3230 else:
3231 mandatoryText = _("optional")
3232 maxCharText = ""
3233 if int(af.getMaxLength()) != 0:
3234 maxCharText = _("max: %s %s.") % (af.getMaxLength(), af.getLimitation())
3235 else:
3236 maxCharText = _("no limited")
3237 addInfo = "(%s - %s)" % (mandatoryText,maxCharText)
3238 url=urlHandlers.UHConfModifCFAOptFld.getURL(self._conf)
3239 url.addParam("fieldId", af.getId())
3240 url=quoteattr("%s#optional"%str(url))
3241 urledit=urlHandlers.UHConfModifCFAEditOptFld.getURL(self._conf)
3242 urledit.addParam("fieldId", af.getId())
3243 urledit=quoteattr("%s#optional"%str(urledit))
3244 if self._conf.getAbstractMgr().hasEnabledAbstractField(af.getId()):
3245 icon=vars["enablePic"]
3246 textIcon=enabledText
3247 else:
3248 icon=vars["disablePic"]
3249 textIcon=disabledText
3250 if af.getId() == "content":
3251 removeButton = ""
3252 else:
3253 removeButton = "<input type=\"checkbox\" name=\"fieldId\" value=\"%s\">" % af.getId()
3254 laf.append("""
3255 <tr>
3256 <td>
3257 <a href=%s><img src=%s alt="%s" class="imglink"></a>&nbsp;<a href=%s><img src=%s border="0" alt=""></a><a href=%s><img src=%s border="0" alt=""></a>
3258 </td>
3259 <td width="1%%">%s</td>
3260 <td>
3261 &nbsp;<a href=%s>%s</a> %s
3262 </td>
3263 </tr>
3264 """%(
3265 url, \
3266 icon, \
3267 textIcon, \
3268 quoteattr(str(urlUp)),\
3269 quoteattr(str(Config.getInstance().getSystemIconURL("upArrow"))),\
3270 quoteattr(str(urlDown)),\
3271 quoteattr(str(Config.getInstance().getSystemIconURL("downArrow"))),\
3272 removeButton, \
3273 urledit, \
3274 af.getName(), \
3275 addInfo))
3276 laf.append( i18nformat("""
3277 <tr>
3278 <td align="right" colspan="3">
3279 <input type="submit" value="_("remove")" onClick="this.form.action='%s';" class="btn">
3280 <input type="submit" value="_("add")" class="btn">
3281 </td>
3282 </tr>
3283 </form>""") % urlRemove)
3284 laf.append("</form>")
3285 return "".join(laf)
3287 def getVars( self ):
3288 vars = wcomponents.WTemplated.getVars(self)
3289 abMgr = self._conf.getAbstractMgr()
3291 vars["iconDisabled"] = str(Config.getInstance().getSystemIconURL( "disabledSection" ))
3292 vars["iconEnabled"] = str(Config.getInstance().getSystemIconURL( "enabledSection" ))
3294 vars["multipleTracks"] = abMgr.getMultipleTracks()
3295 vars["areTracksMandatory"] = abMgr.areTracksMandatory()
3296 vars["canAttachFiles"] = abMgr.canAttachFiles()
3297 vars["showSelectAsSpeaker"] = abMgr.showSelectAsSpeaker()
3298 vars["isSelectSpeakerMandatory"] = abMgr.isSelectSpeakerMandatory()
3299 vars["showAttachedFilesContribList"] = abMgr.showAttachedFilesContribList()
3301 vars["multipleUrl"] = urlHandlers.UHConfCFASwitchMultipleTracks.getURL(self._conf)
3302 vars["mandatoryUrl"] = urlHandlers.UHConfCFAMakeTracksMandatory.getURL(self._conf)
3303 vars["attachUrl"] = urlHandlers.UHConfCFAAllowAttachFiles.getURL(self._conf)
3304 vars["showSpeakerUrl"] = urlHandlers.UHConfCFAShowSelectAsSpeaker.getURL(self._conf)
3305 vars["speakerMandatoryUrl"] = urlHandlers.UHConfCFASelectSpeakerMandatory.getURL(self._conf)
3306 vars["showAttachedFilesUrl"] = urlHandlers.UHConfCFAAttachedFilesContribList.getURL(self._conf)
3308 vars["setStatusURL"]=urlHandlers.UHConfCFAChangeStatus.getURL(self._conf)
3309 vars["dataModificationURL"]=urlHandlers.UHCFADataModification.getURL(self._conf)
3310 vars["addTypeURL"]=urlHandlers.UHCFAManagementAddType.getURL(self._conf)
3311 vars["removeTypeURL"]=urlHandlers.UHCFAManagementRemoveType.getURL(self._conf)
3312 if abMgr.getCFAStatus():
3313 vars["changeTo"] = "False"
3314 vars["status"] = _("ENABLED")
3315 vars["changeStatus"] = _("DISABLE")
3316 vars["startDate"] = format_date(abMgr.getStartSubmissionDate(), format='full')
3317 vars["endDate"] = format_date(abMgr.getEndSubmissionDate(), format='full')
3318 vars["announcement"] = abMgr.getAnnouncement()
3319 vars["disabled"] = ""
3320 modifDL = abMgr.getModificationDeadline()
3321 vars["modifDL"] = i18nformat("""--_("not specified")--""")
3322 if modifDL:
3323 vars["modifDL"] = format_date(modifDL, format='full')
3324 vars["notification"] = i18nformat("""
3325 <table align="left">
3326 <tr>
3327 <td align="right"><b> _("To List"):</b></td>
3328 <td align="left">%s</td>
3329 </tr>
3330 <tr>
3331 <td align="right"><b> _("Cc List"):</b></td>
3332 <td align="left">%s</td>
3333 </tr>
3334 </table>
3335 """)%(", ".join(abMgr.getSubmissionNotification().getToList()) or i18nformat("""--_("no TO list")--"""), ", ".join(abMgr.getSubmissionNotification().getCCList()) or i18nformat("""--_("no CC list")--"""))
3336 else:
3337 vars["changeTo"] = "True"
3338 vars["status"] = _("DISABLED")
3339 vars["changeStatus"] = _("ENABLE")
3340 vars["startDate"] = ""
3341 vars["endDate"] = ""
3342 vars["announcement"] = ""
3343 vars["manage"] = ""
3344 vars["type"] = ""
3345 vars["disabled"] = "disabled"
3346 vars["modifDL"] = ""
3347 vars["submitters"] = ""
3348 vars["notification"]=""
3349 vars["enablePic"]=quoteattr(str(Config.getInstance().getSystemIconURL( "enabledSection" )))
3350 vars["disablePic"]=quoteattr(str(Config.getInstance().getSystemIconURL( "disabledSection" )))
3351 vars["abstractFields"]=self._getAbstractFieldsHTML(vars)
3352 vars["addNotifTplURL"]=urlHandlers.UHAbstractModNotifTplNew.getURL(self._conf)
3353 vars["remNotifTplURL"]=urlHandlers.UHAbstractModNotifTplRem.getURL(self._conf)
3354 vars["confId"] = self._conf.getId()
3355 vars["lateAuthUsers"] = fossilize(self._conf.getAbstractMgr().getAuthorizedSubmitterList())
3356 return vars
3359 class WPConfModifCFAPreview( WPConferenceModifAbstractBase ):
3361 def _setActiveTab( self ):
3362 self._tabCFAPreview.setActive()
3364 def _getTabContent( self, params ):
3365 import MaKaC.webinterface.pages.abstracts as abstracts
3366 wc = abstracts.WAbstractDataModification( self._conf )
3367 # Simulate fake abstract
3368 from MaKaC.webinterface.common.abstractDataWrapper import AbstractData
3369 ad = AbstractData(self._conf.getAbstractMgr(), {}, 9999)
3370 params = ad.toDict()
3371 params["postURL"] = ""
3372 params["origin"] = "management"
3373 return wc.getHTML(params)
3375 class WPConfModifCFA( WPConferenceModifAbstractBase ):
3377 def _setActiveTab( self ):
3378 self._tabCFA.setActive()
3380 def _getTabContent( self, params ):
3381 wc = WConfModifCFA( self._conf )
3382 return wc.getHTML()
3384 class WPConfModifCFAAddField( WPConferenceModifAbstractBase ):
3386 def __init__(self,rh,conf,fieldId):
3387 WPConferenceModifAbstractBase.__init__(self, rh, conf)
3388 self._conf = conf
3389 self._fieldId = fieldId
3391 def _setActiveTab( self ):
3392 self._tabCFA.setActive()
3394 def _getTabContent( self, params ):
3395 wc = WConfModifCFAAddField( self._conf, self._fieldId )
3396 return wc.getHTML()
3398 class WCFADataModification(wcomponents.WTemplated):
3400 def __init__( self, conf ):
3401 self._conf = conf
3403 def getVars( self ):
3404 vars = wcomponents.WTemplated.getVars(self)
3405 abMgr = self._conf.getAbstractMgr()
3406 vars["sDay"] = abMgr.getStartSubmissionDate().day
3407 vars["sMonth"] = abMgr.getStartSubmissionDate().month
3408 vars["sYear"] = abMgr.getStartSubmissionDate().year
3410 vars["eDay"] = abMgr.getEndSubmissionDate().day
3411 vars["eMonth"] = abMgr.getEndSubmissionDate().month
3412 vars["eYear"] = abMgr.getEndSubmissionDate().year
3414 vars["mDay"] = ""
3415 vars["mMonth"] = ""
3416 vars["mYear"] = ""
3417 if abMgr.getModificationDeadline():
3418 vars["mDay"] = str(abMgr.getModificationDeadline().day)
3419 vars["mMonth"] = str(abMgr.getModificationDeadline().month)
3420 vars["mYear"] = str(abMgr.getModificationDeadline().year)
3422 vars["announcement"] = abMgr.getAnnouncement()
3423 vars["toList"] = ", ".join(abMgr.getSubmissionNotification().getToList())
3424 vars["ccList"] = ", ".join(abMgr.getSubmissionNotification().getCCList())
3425 vars["postURL" ] = urlHandlers.UHCFAPerformDataModification.getURL( self._conf )
3426 return vars
3428 class WPCFADataModification( WPConferenceModifAbstractBase ):
3430 def _setActiveTab( self ):
3431 self._tabCFA.setActive()
3433 def _getTabContent( self, params ):
3434 p = WCFADataModification( self._conf )
3435 return p.getHTML()
3438 class WConfModifProgram(wcomponents.WTemplated):
3440 def __init__( self, conference ):
3441 self._conf = conference
3443 def getVars( self ):
3444 vars = wcomponents.WTemplated.getVars(self)
3445 vars["deleteItemsURL"]=urlHandlers.UHConfDelTracks.getURL(self._conf)
3446 vars["addTrackURL"]=urlHandlers.UHConfAddTrack.getURL( self._conf )
3447 vars["conf"] = self._conf
3448 return vars
3451 class WPConfModifProgram( WPConferenceModifBase ):
3453 def _setActiveSideMenuItem( self ):
3454 self._programMenuItem.setActive()
3456 def _getPageContent( self, params ):
3457 wc = WConfModifProgram( self._conf )
3458 return wc.getHTML()
3461 class WTrackCreation( wcomponents.WTemplated ):
3463 def __init__( self, targetConf ):
3464 self.__conf = targetConf
3466 def getVars( self ):
3467 vars = wcomponents.WTemplated.getVars(self)
3468 vars["title"], vars["description"] = "", ""
3469 vars["locator"] = self.__conf.getLocator().getWebForm()
3470 return vars
3474 class WPConfAddTrack( WPConfModifProgram ):
3476 def _setActiveSideMenuItem(self):
3477 self._programMenuItem.setActive()
3479 def _getPageContent( self, params ):
3480 p = WTrackCreation( self._conf )
3481 pars = {"postURL": urlHandlers.UHConfPerformAddTrack.getURL() }
3482 return p.getHTML( pars )
3484 class WFilterCriteriaAbstracts(wcomponents.WFilterCriteria):
3486 Draws the options for a filter criteria object
3487 This means rendering the actual table that contains
3488 all the HTML for the several criteria
3491 def __init__(self, options, filterCrit, extraInfo=""):
3492 wcomponents.WFilterCriteria.__init__(self, options, filterCrit, extraInfo)
3494 def _drawFieldOptions(self, id, data):
3495 page = WFilterCriterionOptionsAbstracts(id, data)
3497 # TODO: remove when we have a better template system
3498 return page.getHTML()
3500 class WFilterCriterionOptionsAbstracts(wcomponents.WTemplated):
3502 def __init__(self, id, data):
3503 self._id = id
3504 self._data = data
3506 def getVars(self):
3508 vars = wcomponents.WTemplated.getVars( self )
3510 vars["id"] = self._id
3511 vars["title"] = self._data["title"]
3512 vars["options"] = self._data["options"]
3513 vars["selectFunc"] = self._data.get("selectFunc", True)
3515 return vars
3517 class WAbstracts( wcomponents.WTemplated ):
3519 # available columns
3520 COLUMNS = ["ID", "Title", "PrimaryAuthor", "Tracks", "Type", "Status", "Rating", "AccTrack", "AccType", "SubmissionDate", "ModificationDate"]
3522 def __init__( self, conference, filterCrit, sortingCrit, order, display, filterUsed):
3523 self._conf = conference
3524 self._filterCrit = filterCrit
3525 self._sortingCrit = sortingCrit
3526 self._order = order
3527 self._display = display
3528 self._filterUsed = filterUsed
3530 def _getURL( self, sortingField, column ):
3531 url = urlHandlers.UHConfAbstractManagment.getURL(self._conf)
3532 url.addParam("sortBy", column)
3533 if sortingField and sortingField.getId() == column:
3534 if self._order == "down":
3535 url.addParam("order","up")
3536 elif self._order == "up":
3537 url.addParam("order","down")
3538 return url
3541 def _getTrackFilterItemList( self ):
3542 checked = ""
3543 field=self._filterCrit.getField("track")
3544 if field is not None and field.getShowNoValue():
3545 checked = " checked"
3546 l = [ i18nformat("""<input type="checkbox" name="trackShowNoValue"%s> --_("not specified")--""")%checked]
3547 for t in self._conf.getTrackList():
3548 checked = ""
3549 if field is not None and t.getId() in field.getValues():
3550 checked = " checked"
3551 l.append( """<input type="checkbox" name="track" value=%s%s> (%s) %s\n"""%(quoteattr(t.getId()),checked,self.htmlText(t.getCode()),self.htmlText(t.getTitle())))
3552 return l
3554 def _getContribTypeFilterItemList( self ):
3555 checked = ""
3556 field=self._filterCrit.getField("type")
3557 if field is not None and field.getShowNoValue():
3558 checked = " checked"
3559 l = [ i18nformat("""<input type="checkbox" name="typeShowNoValue"%s> --_("not specified")--""")%checked]
3560 for contribType in self._conf.getContribTypeList():
3561 checked = ""
3562 if field is not None and contribType in field.getValues():
3563 checked = " checked"
3564 l.append( """<input type="checkbox" name="type" value=%s%s> %s"""%(quoteattr(contribType.getId()), checked, self.htmlText(contribType.getName())) )
3565 return l
3567 def _getAccTrackFilterItemList( self ):
3568 checked = ""
3569 field=self._filterCrit.getField("acc_track")
3570 if field is not None and field.getShowNoValue():
3571 checked = " checked"
3572 l = [ i18nformat("""<input type="checkbox" name="accTrackShowNoValue"%s> --_("not specified")--""")%checked]
3573 for t in self._conf.getTrackList():
3574 checked = ""
3575 if field is not None and t.getId() in field.getValues():
3576 checked=" checked"
3577 l.append("""<input type="checkbox" name="acc_track" value=%s%s> (%s) %s"""%(quoteattr(t.getId()),checked,self.htmlText(t.getCode()),self.htmlText(t.getTitle())))
3578 return l
3580 def _getAccContribTypeFilterItemList( self ):
3581 checked = ""
3582 field=self._filterCrit.getField("acc_type")
3583 if field is not None and field.getShowNoValue():
3584 checked = " checked"
3585 l = [ i18nformat("""<input type="checkbox" name="accTypeShowNoValue"%s> --_("not specified")--""")%checked]
3586 for contribType in self._conf.getContribTypeList():
3587 checked = ""
3588 if field is not None and contribType in field.getValues():
3589 checked = " checked"
3590 l.append( """<input type="checkbox" name="acc_type" value=%s%s> %s"""%(quoteattr(contribType.getId()),checked,self.htmlText(contribType.getName())))
3591 return l
3593 def _getStatusFilterItemList( self ):
3594 l = []
3595 for status in AbstractStatusList.getInstance().getStatusList():
3596 checked = ""
3597 statusId = AbstractStatusList.getInstance().getId( status )
3598 statusCaption = AbstractStatusList.getInstance().getCaption( status )
3599 statusCode=AbstractStatusList.getInstance().getCode(status)
3600 statusIconURL= AbstractStatusList.getInstance().getIconURL( status )
3601 field=self._filterCrit.getField("status")
3602 if field is not None and statusId in field.getValues():
3603 checked = "checked"
3604 imgHTML = """<img src=%s border="0" alt="">"""%(quoteattr(str(statusIconURL)))
3605 l.append( """<input type="checkbox" name="status" value=%s%s>%s (%s) %s"""%(quoteattr(statusId),checked,imgHTML,self.htmlText(statusCode),self.htmlText(statusCaption)))
3606 return l
3608 def _getOthersFilterItemList( self ):
3609 checkedShowMultiple, checkedShowComments = "", ""
3610 track_field=self._filterCrit.getField("track")
3611 if track_field is not None and track_field.onlyMultiple():
3612 checkedShowMultiple = " checked"
3613 if self._filterCrit.getField("comment") is not None:
3614 checkedShowComments = " checked"
3615 l = [ i18nformat("""<input type="checkbox" name="trackShowMultiple"%s> _("only multiple tracks")""")%checkedShowMultiple,
3616 i18nformat("""<input type="checkbox" name="comment"%s> _("only with comments")""")%checkedShowComments]
3617 return l
3619 def _getFilterMenu(self):
3621 options = [
3622 ('Tracks', {"title": _("tracks"),
3623 "options": self._getTrackFilterItemList()}),
3624 ('Types', {"title": _("types"),
3625 "options": self._getContribTypeFilterItemList()}),
3626 ('Status', {"title": _("status"),
3627 "options": self._getStatusFilterItemList()}),
3628 ('AccTracks', {"title": _("(proposed to be) accepted for tracks"),
3629 "options": self._getAccTrackFilterItemList()}),
3630 ('AccTypes', {"title": _("(proposed to be) accepted for types"),
3631 "options": self._getAccContribTypeFilterItemList()}),
3632 ('Others', {"title": _("others"),
3633 "selectFunc": False,
3634 "options": self._getOthersFilterItemList()})
3637 extraInfo = ""
3638 if self._conf.getRegistrationForm().getStatusesList():
3639 extraInfo = i18nformat("""<table align="center" cellspacing="10" width="100%%">
3640 <tr>
3641 <td colspan="5" class="titleCellFormat"> _("Author search") <input type="text" name="authSearch" value=%s></td>
3642 </tr>
3643 </table>
3644 """)%(quoteattr(str(self._authSearch)))
3646 p = WFilterCriteriaAbstracts(options, None, extraInfo)
3648 return p.getHTML()
3651 def _getColumnTitlesDict(self):
3653 Dictionary with the translation from "ids" to "name to display" for each of the options you can choose for the display.
3654 This method complements the method "_setDispOpts" in which we get a dictonary with "ids".
3656 if not hasattr(self, "_columns"):
3657 self._columns = {"ID": "ID","Title": "Title", "PrimaryAuthor": "Primary Author", "Tracks": "Tracks", "Type": "Type", "Status":"Status", \
3658 "Rating":" Rating", "AccTrack": "Acc. Track", "AccType": "Acc. Type", "SubmissionDate": "Submission Date", "ModificationDate": "Modification Date"}
3659 return self._columns
3661 def _getDisplay(self):
3663 These are the 'display' options selected by the user. In case no options were selected we add some of them by default.
3665 display = self._display[:]
3667 if display == []:
3668 display = self.COLUMNS
3669 return display
3671 def _getAccType(self, abstract):
3672 status = abstract.getCurrentStatus()
3673 if isinstance(status,(review.AbstractStatusAccepted, review.AbstractStatusProposedToAccept)) and status.getType() is not None:
3674 return self.htmlText(status.getType().getName())
3675 return ""
3677 def _getAccTrack(self, abstract):
3678 status = abstract.getCurrentStatus()
3679 if isinstance(status,(review.AbstractStatusAccepted, review.AbstractStatusProposedToAccept)) and status.getTrack() is not None:
3680 return self.htmlText(status.getTrack().getCode())
3681 return ""
3683 def getVars( self ):
3684 vars = wcomponents.WTemplated.getVars(self)
3685 vars["abstractSelectionAction"]=quoteattr(str(urlHandlers.UHAbstractConfSelectionAction.getURL(self._conf)))
3686 vars["confId"] = self._conf.getId()
3687 self._authSearch=vars.get("authSearch","")
3689 vars["filterMenu"] = self._getFilterMenu()
3691 sortingField=None
3692 if self._sortingCrit is not None:
3693 sortingField=self._sortingCrit.getField()
3695 vars["sortingField"] = sortingField.getId()
3696 vars["order"] = self._order
3697 vars["downArrow"] = Config.getInstance().getSystemIconURL("downArrow")
3698 vars["upArrow"] = Config.getInstance().getSystemIconURL("upArrow")
3699 vars["getSortingURL"] = lambda column: self._getURL(sortingField, column)
3700 vars["getAccType"] = lambda abstract: self._getAccType(abstract)
3701 vars["getAccTrack"] = lambda abstract: self._getAccTrack(abstract)
3703 f = filters.SimpleFilter( self._filterCrit, self._sortingCrit )
3704 abstractList=f.apply(self._conf.getAbstractMgr().getAbstractsMatchingAuth(self._authSearch))
3705 if self._order =="up":
3706 abstractList.reverse()
3707 vars["abstracts"] = abstractList
3709 vars["totalNumberAbstracts"] = str(len(self._conf.getAbstractMgr().getAbstractList()))
3710 vars["filteredNumberAbstracts"] = str(len(abstractList))
3711 vars["filterUsed"] = self._filterUsed
3712 vars["accessAbstract"] = quoteattr(str(urlHandlers.UHAbstractDirectAccess.getURL(self._conf)))
3714 url = urlHandlers.UHConfAbstractManagment.getURL(self._conf)
3715 url.setSegment( "results" )
3716 vars["filterPostURL"] = quoteattr(str(url))
3717 vars["excelIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("excel")))
3718 vars["pdfIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("pdf")))
3719 vars["xmlIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("xml")))
3720 vars["displayColumns"] = self._getDisplay()
3721 vars["columnsDict"] = self._getColumnTitlesDict()
3722 vars["columns"] = self.COLUMNS
3724 return vars
3726 class WPConfAbstractList( WPConferenceModifAbstractBase ):
3728 def __init__(self, rh, conf, msg, filterUsed = False ):
3729 self._msg = msg
3730 self._filterUsed = filterUsed
3731 WPConferenceModifAbstractBase.__init__(self, rh, conf)
3733 def _getTabContent( self, params ):
3734 order = params.get("order","down")
3735 wc = WAbstracts( self._conf, params.get("filterCrit", None ),
3736 params.get("sortingCrit", None),
3737 order,
3738 params.get("display",None),
3739 self._filterUsed )
3740 p = {"authSearch":params.get("authSearch","")}
3741 return wc.getHTML( p )
3743 def _setActiveTab(self):
3744 self._tabAbstractList.setActive()
3747 class WPModNewAbstract(WPConfAbstractList):
3749 def __init__(self, rh, conf, abstractData):
3750 WPConfAbstractList.__init__(self, rh, conf, "")
3752 def _getTabContent(self, params):
3753 from MaKaC.webinterface.pages.abstracts import WAbstractDataModification
3754 params["postURL"] = urlHandlers.UHConfModNewAbstract.getURL(self._conf)
3755 params["origin"] = "management"
3756 wc = WAbstractDataModification(self._conf)
3757 return wc.getHTML(params)
3760 class WConfModAbstractsMerge(wcomponents.WTemplated):
3762 def __init__(self,conf):
3763 self._conf=conf
3765 def getVars(self):
3766 vars=wcomponents.WTemplated.getVars(self)
3767 vars["postURL"]=quoteattr(str(urlHandlers.UHConfModAbstractsMerge.getURL(self._conf)))
3768 vars["selAbstracts"]=",".join(vars.get("absIdList",[]))
3769 vars["targetAbs"]=quoteattr(str(vars.get("targetAbsId","")))
3770 vars["inclAuthChecked"]=""
3771 if vars.get("inclAuth",False):
3772 vars["inclAuthChecked"]=" checked"
3773 vars["comments"]=self.htmlText(vars.get("comments",""))
3774 vars["notifyChecked"]=""
3775 if vars.get("notify",False):
3776 vars["notifyChecked"]=" checked"
3777 return vars
3780 class WPModMergeAbstracts(WPConfAbstractList):
3782 def __init__(self, rh, conf):
3783 WPConfAbstractList.__init__(self, rh, conf, "")
3785 def _getTabContent(self, params):
3786 wc = WConfModAbstractsMerge(self._conf)
3787 p = {"absIdList": params.get("absIdList", []),
3788 "targetAbsId": params.get("targetAbsId", ""),
3789 "inclAuth": params.get("inclAuth", False),
3790 "comments": params.get("comments", ""),
3791 "notify": params.get("notify", True),
3793 return wc.getHTML(p)
3797 class WPConfModifDisplayBase( WPConferenceModifBase ):
3799 def _createTabCtrl( self ):
3801 self._tabCtrl = wcomponents.TabControl()
3803 self._tabDisplayCustomization = self._tabCtrl.newTab( "dispCustomization", _("Layout customization"), \
3804 urlHandlers.UHConfModifDisplayCustomization.getURL( self._conf ) )
3805 self._tabDisplayConfHeader = self._tabCtrl.newTab( "displConfHeader", _("Conference header"), \
3806 urlHandlers.UHConfModifDisplayConfHeader.getURL( self._conf ) )
3807 self._tabDisplayMenu = self._tabCtrl.newTab( "dispMenu", _("Menu"), \
3808 urlHandlers.UHConfModifDisplayMenu.getURL( self._conf ) )
3809 self._tabDisplayResources = self._tabCtrl.newTab( "dispResources", _("Images"), \
3810 urlHandlers.UHConfModifDisplayResources.getURL( self._conf ) )
3812 self._setActiveTab()
3814 def _getPageContent( self, params ):
3815 self._createTabCtrl()
3817 html = wcomponents.WTabControl( self._tabCtrl, self._getAW() ).getHTML( self._getTabContent( params ) )
3818 return html
3820 def _getTabContent( self ):
3821 return "nothing"
3823 def _setActiveSideMenuItem( self ):
3824 self._layoutMenuItem.setActive()
3826 class WPConfModifDisplayCustomization( WPConfModifDisplayBase ):
3828 def __init__(self, rh, conf):
3829 WPConfModifDisplayBase.__init__(self, rh, conf)
3831 def _getTabContent( self, params ):
3832 wc = WConfModifDisplayCustom( self._conf )
3833 return wc.getHTML()
3835 def _setActiveTab( self ):
3836 self._tabDisplayCustomization.setActive()
3838 class WConfModifDisplayCustom(wcomponents.WTemplated):
3840 def __init__(self, conf):
3841 self._conf = conf
3842 dm = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf)
3843 self._format = dm.getFormat()
3845 def getVars(self):
3846 vars = wcomponents.WTemplated.getVars(self)
3847 vars["conf"]=self._conf
3848 vars["saveLogo"]=urlHandlers.UHSaveLogo.getURL(self._conf)
3849 vars["logoURL"]=""
3850 if self._conf.getLogo():
3851 vars["logoURL"] = urlHandlers.UHConferenceLogo.getURL( self._conf)
3853 vars["formatTitleTextColor"] = WFormatColorOptionModif("titleTextColor", self._format, self._conf, 3).getHTML()
3854 vars["formatTitleBgColor"] = WFormatColorOptionModif("titleBgColor", self._format, self._conf, 4).getHTML()
3856 #indico-style "checkboxes"
3857 enabledText = _("Click to disable")
3858 disabledText = _("Click to enable")
3860 # Set up the logo of the conference
3861 vars["logoIconURL"] = Config.getInstance().getSystemIconURL("logo")
3862 if vars["logoURL"]:
3863 vars["logo"] = """<img heigth=\"95\" width=\"150\" src="%s" alt="%s" border="0">"""%(vars["logoURL"], self._conf.getTitle())
3864 vars["removeLogo"] = i18nformat("""<form action=%s method="POST"><input type="submit" class="btn" value="_("remove")"></form>""")%quoteattr(str(urlHandlers.UHRemoveLogo.getURL(self._conf)))
3865 else:
3866 vars["logo"] = "<em>No logo has been saved for this conference</em>"
3867 vars["removeLogo"] = ""
3870 #creating css part
3871 vars["saveCSS"]=urlHandlers.UHSaveCSS.getURL(self._conf)
3872 sm = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getStyleManager()
3873 if sm.getLocalCSS():
3874 vars["cssDownload"] = sm.getCSS().getURL()
3875 else:
3876 vars["css"] = ""
3877 vars["cssDownload"] = ""
3878 vars["removeCSS"] = str(urlHandlers.UHRemoveCSS.getURL(self._conf))
3879 vars["previewURL"]= urlHandlers.UHConfModifPreviewCSS.getURL(self._conf)
3882 if sm.getCSS():
3883 vars["currentCSSFileName"] = sm.getCSS().getFileName()
3884 else:
3885 vars["currentCSSFileName"] = ""
3886 return vars
3888 class WPConfModifDisplayMenu( WPConfModifDisplayBase ):
3890 def __init__(self, rh, conf, linkId):
3891 WPConfModifDisplayBase.__init__(self, rh, conf)
3892 self._linkId = linkId
3894 def _getTabContent( self, params ):
3895 wc = WConfModifDisplayMenu( self._conf, self._linkId )
3896 return wc.getHTML()
3898 def _setActiveTab( self ):
3899 self._tabDisplayMenu.setActive()
3901 class WConfModifDisplayMenu(wcomponents.WTemplated):
3903 def __init__(self, conf, linkId):
3904 self._conf = conf
3905 dm = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf)
3906 self._menu = dm.getMenu()
3907 self._link = self._menu.getLinkById(linkId)
3909 def getVars(self):
3910 vars = wcomponents.WTemplated.getVars(self)
3911 vars["addLinkURL"]=quoteattr(str(urlHandlers.UHConfModifDisplayAddLink.getURL(self._conf)))
3912 vars["addPageURL"]=quoteattr(str(urlHandlers.UHConfModifDisplayAddPage.getURL(self._conf)))
3913 vars["addSpacerURL"]=quoteattr(str(urlHandlers.UHConfModifDisplayAddSpacer.getURL(self._conf)))
3914 vars["menuDisplay"] = ConfEditMenu(self._menu, urlHandlers.UHConfModifDisplayMenu.getURL).getHTML()
3915 vars["confId"] = self._conf.getId()
3916 if self._link:
3917 if isinstance(self._link, displayMgr.SystemLink):
3918 p = {
3919 "dataModificationURL": quoteattr(str(urlHandlers.UHConfModifDisplayModifySystemData.getURL(self._link))), \
3920 "moveUpURL": quoteattr(str(urlHandlers.UHConfModifDisplayUpLink.getURL(self._link))), \
3921 "imageUpURL": quoteattr(str(Config.getInstance().getSystemIconURL("upArrow"))), \
3922 "moveDownURL": quoteattr(str(urlHandlers.UHConfModifDisplayDownLink.getURL(self._link))), \
3923 "imageDownURL": quoteattr(str(Config.getInstance().getSystemIconURL("downArrow")))
3925 vars["linkEdition"] = WSystemLinkModif(self._link).getHTML(p)
3926 elif isinstance(self._link, displayMgr.Spacer):
3927 p = {
3928 "removeLinkURL": quoteattr(str(urlHandlers.UHConfModifDisplayRemoveLink.getURL(self._link))), \
3929 "toggleLinkStatusURL": quoteattr(str(urlHandlers.UHConfModifDisplayToggleLinkStatus.getURL(self._link))), \
3930 "moveUpURL": quoteattr(str(urlHandlers.UHConfModifDisplayUpLink.getURL(self._link))), \
3931 "imageUpURL": quoteattr(str(Config.getInstance().getSystemIconURL("upArrow"))), \
3932 "moveDownURL": quoteattr(str(urlHandlers.UHConfModifDisplayDownLink.getURL(self._link))), \
3933 "imageDownURL": quoteattr(str(Config.getInstance().getSystemIconURL("downArrow")))
3935 vars["linkEdition"] = WSpacerModif(self._link).getHTML(p)
3936 elif isinstance(self._link, displayMgr.ExternLink):
3937 p = {
3938 "dataModificationURL": quoteattr(str(urlHandlers.UHConfModifDisplayModifyData.getURL(self._link))), \
3939 "removeLinkURL": quoteattr(str(urlHandlers.UHConfModifDisplayRemoveLink.getURL(self._link))), \
3940 "addSubLinkURL": quoteattr(str(urlHandlers.UHConfModifDisplayAddLink.getURL(self._link))), \
3941 "toggleLinkStatusURL": quoteattr(str(urlHandlers.UHConfModifDisplayToggleLinkStatus.getURL(self._link))), \
3942 "moveUpURL": quoteattr(str(urlHandlers.UHConfModifDisplayUpLink.getURL(self._link))), \
3943 "imageUpURL": quoteattr(str(Config.getInstance().getSystemIconURL("upArrow"))), \
3944 "moveDownURL": quoteattr(str(urlHandlers.UHConfModifDisplayDownLink.getURL(self._link))), \
3945 "imageDownURL": quoteattr(str(Config.getInstance().getSystemIconURL("downArrow"))) }
3946 vars["linkEdition"] = WLinkModif(self._link).getHTML(p)
3947 else:
3948 p = {
3949 "dataModificationURL": quoteattr(str(urlHandlers.UHConfModifDisplayModifyData.getURL(self._link))), \
3950 "removeLinkURL": quoteattr(str(urlHandlers.UHConfModifDisplayRemoveLink.getURL(self._link))), \
3951 "toggleLinkStatusURL": quoteattr(str(urlHandlers.UHConfModifDisplayToggleLinkStatus.getURL(self._link))), \
3952 "toggleHomePageURL": quoteattr(str(urlHandlers.UHConfModifDisplayToggleHomePage.getURL(self._link))), \
3953 "moveUpURL": quoteattr(str(urlHandlers.UHConfModifDisplayUpLink.getURL(self._link))), \
3954 "imageUpURL": quoteattr(str(Config.getInstance().getSystemIconURL("upArrow"))), \
3955 "moveDownURL": quoteattr(str(urlHandlers.UHConfModifDisplayDownLink.getURL(self._link))), \
3956 "imageDownURL": quoteattr(str(Config.getInstance().getSystemIconURL("downArrow"))) }
3957 vars["linkEdition"] = WPageLinkModif(self._link).getHTML(p)
3958 else:
3959 vars["linkEdition"] = i18nformat("""<center><b> _("Click on an item of the menu to edit it")</b></center>""")
3961 return vars
3963 class WPConfModifDisplayResources( WPConfModifDisplayBase ):
3965 def __init__(self, rh, conf):
3966 WPConfModifDisplayBase.__init__(self, rh, conf)
3968 def _getTabContent( self, params ):
3969 wc = WConfModifDisplayResources( self._conf)
3970 return wc.getHTML()
3972 def _setActiveTab( self ):
3973 self._tabDisplayResources.setActive()
3975 class WConfModifDisplayResources(wcomponents.WTemplated):
3977 def __init__(self, conf):
3978 self._conf = conf
3980 def getVars(self):
3981 vars = wcomponents.WTemplated.getVars(self)
3982 vars["savePic"]=urlHandlers.UHSavePic.getURL(self._conf)
3983 #creating picture items for each saved picture
3984 vars["picsList"] = []
3985 im = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getImagesManager()
3986 for pic in im.getPicList().values():
3987 vars["picsList"].append({"id":pic.getId(),
3988 "picURL": str(urlHandlers.UHConferencePic.getURL(pic))})
3989 return vars
3991 class WPConfModifDisplayConfHeader( WPConfModifDisplayBase ):
3993 def __init__(self, rh, conf, optionalParams={}):
3994 WPConfModifDisplayBase.__init__(self, rh, conf)
3995 self._optionalParams=optionalParams
3997 def _getTabContent( self, params ):
3998 wc = WConfModifDisplayConfHeader( self._conf)
3999 return wc.getHTML(self._optionalParams)
4001 def _setActiveTab( self ):
4002 self._tabDisplayConfHeader.setActive()
4004 class WConfModifDisplayConfHeader(wcomponents.WTemplated):
4006 def __init__(self, conf):
4007 self._conf = conf
4008 dm = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf)
4009 self._tickerTape=dm.getTickerTape()
4010 self._searchEnabled = dm.getSearchEnabled()
4012 def getVars(self):
4013 vars = wcomponents.WTemplated.getVars(self)
4015 #indico-style "checkboxes"
4016 vars["enablePic"]=quoteattr(str(Config.getInstance().getSystemIconURL( "enabledSection" )))
4017 vars["disablePic"]=quoteattr(str(Config.getInstance().getSystemIconURL( "disabledSection" )))
4018 enabledText = _("Click to disable")
4019 disabledText = _("Click to enable")
4021 # ------ Ticker Tape: ------
4022 # general
4023 vars["tickertapeURL"]=quoteattr(str(urlHandlers.UHTickerTapeAction.getURL(self._conf)))
4024 status= _("DISABLED")
4025 btnLabel= _("Enable")
4026 statusColor = "#612828"
4027 if self._tickerTape.isSimpleTextEnabled():
4028 statusColor = "#286135"
4029 status= _("ENABLED")
4030 btnLabel= _("Disable")
4031 vars["status"]= """<span style="color: %s;">%s</span>""" %(statusColor,status)
4032 vars["statusBtn"]=btnLabel
4033 # annoucements
4034 urlNP=urlHandlers.UHTickerTapeAction.getURL(self._conf)
4035 urlNP.addParam("nowHappening", "action")
4036 if self._tickerTape.isNowHappeningEnabled():
4037 vars["nowHappeningIcon"]=vars["enablePic"]
4038 vars["nowHappeningTextIcon"]=enabledText
4039 else:
4040 vars["nowHappeningIcon"]=vars["disablePic"]
4041 vars["nowHappeningTextIcon"]=disabledText
4042 vars["nowHappeningURL"]=quoteattr("%s#tickerTape"%str(urlNP))
4044 urlST=urlHandlers.UHTickerTapeAction.getURL(self._conf)
4045 urlST.addParam("simpleText", "action")
4046 vars["simpleTextURL"]=quoteattr("%s#tickerTape"%urlST)
4047 # simple ext
4048 vars["text"]=quoteattr(self._tickerTape.getText())
4049 if not vars.has_key("modifiedText"):
4050 vars["modifiedText"]=""
4051 else:
4052 vars["modifiedText"]= i18nformat("""<font color="green"> _("(text saved)")</font>""")
4054 #enable or disable the contribution search feature
4055 urlSB=urlHandlers.UHConfModifToggleSearch.getURL(self._conf)
4056 if self._searchEnabled:
4057 vars["searchBoxIcon"]=vars["enablePic"]
4058 vars["searchBoxTextIcon"]=enabledText
4059 else:
4060 vars["searchBoxIcon"]=vars["disablePic"]
4061 vars["searchBoxTextIcon"]=disabledText
4062 vars["searchBoxURL"]=quoteattr(str(urlSB))
4064 #enable or disable navigation icons
4065 vars["confType"] = self._conf.getType()
4066 urlSB=urlHandlers.UHConfModifToggleNavigationBar.getURL(self._conf)
4067 if displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getDisplayNavigationBar():
4068 vars["navigationBoxIcon"]=vars["enablePic"]
4069 vars["navigationBoxTextIcon"]=enabledText
4070 else:
4071 vars["navigationBoxIcon"]=vars["disablePic"]
4072 vars["navigationBoxTextIcon"]=disabledText
4073 vars["navigationBoxURL"]=quoteattr(str(urlSB))
4075 return vars
4077 class WFormatColorOptionModif(wcomponents.WTemplated):
4079 def __init__(self, formatOption, format, conf, formId=4):
4080 self._formatOption = formatOption
4081 self._format = format
4082 self._conf = conf
4084 # The form number on the page... used for the color picker
4085 self._formId = formId
4087 def getVars(self):
4088 vars = wcomponents.WTemplated.getVars(self)
4089 value = self._format.getFormatOption(self._formatOption)
4091 urlChangeColor = value["url"].getURL(self._conf)
4092 urlChangeColor.addParam("formatOption",self._formatOption)
4094 vars["changeColorURL"] = str(urlChangeColor)
4095 vars["colorCode"] = value["code"]
4096 vars["formatOption"] = self._formatOption
4098 return vars
4100 class ConfEditMenu:
4102 def __init__(self, menu, modifURLGen=None):
4103 self._menu = menu
4104 self._linkModifHandler = modifURLGen
4106 def getHTML(self):
4107 html = ["<table>"]
4108 for link in self._menu.getLinkList():
4109 html.append(self._getLinkHTML(link))
4110 html.append("</table>")
4111 return "".join(html)
4113 def _getLinkHTML(self, link, indent=""):
4114 if self._menu.linkHasToBeDisplayed(link):
4115 disabled = i18nformat("""<font size="-1" color="red"> _("(disabled)")</font>""")
4116 if link.isEnabled():
4117 disabled = ""
4118 if link.getType() == "spacer":
4119 html = """<tr><td></td><td nowrap><a href="%s">[%s]</a>%s</td></tr>\n"""%(self._linkModifHandler(link), link.getName(), disabled)
4120 else:
4121 system = "<font size=-1>E </font>"
4122 home = ""
4123 if isinstance(link, displayMgr.SystemLink):
4124 system = "<font size=-1 color=\"green\">S </font>"
4125 if isinstance(link, displayMgr.PageLink):
4126 if link.getPage().isHome():
4127 home = "&nbsp;<font size=-1 color=\"green\">(home)</font>"
4128 system = "<font size=-1 color=\"black\">P </font>"
4129 html = ["""<tr><td>%s</td><td nowrap>%s<a href="%s">%s</a>%s%s</td></tr>\n"""%(system, indent, self._linkModifHandler(link), escape(link.getCaption()), disabled, home)]
4130 for l in link.getLinkList():
4131 html.append( self._getLinkHTML(l, "%s%s"%(indent ,self._menu.getIndent())))
4132 return "".join(html)
4133 return ""
4136 class WLinkModif(wcomponents.WTemplated):
4137 def __init__(self, link):
4138 self._link = link
4140 def getVars(self):
4141 vars = wcomponents.WTemplated.getVars(self)
4143 vars["linkName"] = self._link.getCaption()
4144 vars["linkURL"] = self._link.getURL()
4145 vars["displayTarget"] = _("Display in the SAME window")
4146 if self._link.getDisplayTarget() == "_blank":
4147 vars["displayTarget"] = _("Display in a NEW window")
4148 if self._link.isEnabled():
4149 vars["linkStatus"] = _("Activated")
4150 vars["changeStatusTo"] = _("Disable")
4151 else:
4152 vars["linkStatus"] = _("Disabled")
4153 vars["changeStatusTo"] = _("Activate")
4155 return vars
4157 class WPageLinkModif(wcomponents.WTemplated):
4159 def __init__(self, link):
4160 self._link = link
4162 def getVars(self):
4163 vars = wcomponents.WTemplated.getVars(self)
4165 vars["linkName"] = self._link.getCaption()
4166 vars["linkContent"] = self.htmlText("%s..."%self._link.getPage().getContent()[0:50])
4167 vars["displayTarget"] = _("Display in the SAME window")
4168 if self._link.getDisplayTarget() == "_blank":
4169 vars["displayTarget"] = _("Display in a NEW window")
4170 if self._link.isEnabled():
4171 vars["linkStatus"] = _("Activated")
4172 vars["changeStatusTo"] = _("Disable")
4173 else:
4174 vars["linkStatus"] = _("Disabled")
4175 vars["changeStatusTo"] = _("Activate")
4176 if self._link.getPage().isHome():
4177 vars["homeText"] = _("Default conference home page")
4178 vars["changeHomeTo"] = _("Normal page")
4179 else:
4180 vars["homeText"] = _("Normal page")
4181 vars["changeHomeTo"] = _("Default conference home page")
4182 return vars
4184 class WSystemLinkModif(wcomponents.WTemplated):
4186 def __init__(self, link):
4187 self._link = link
4189 def getVars(self):
4190 vars = wcomponents.WTemplated.getVars(self)
4191 vars["linkName"] = self._link.getCaption()
4192 vars["linkURL"] = self._link.getURL()
4193 vars["linkStatus"] = _("Disabled")
4194 vars["changeStatusTo"] = _("Activate")
4195 if self._link.isEnabled():
4196 vars["linkStatus"] = _("Activated")
4197 vars["changeStatusTo"] = _("Disable")
4198 url=urlHandlers.UHConfModifDisplayToggleLinkStatus.getURL(self._link)
4199 vars["toggleLinkStatusURL"]=quoteattr(str(url))
4200 return vars
4203 class WSpacerModif(wcomponents.WTemplated):
4204 def __init__(self, link):
4205 self._link = link
4207 def getVars(self):
4208 vars = wcomponents.WTemplated.getVars(self)
4209 vars["linkName"] = self._link.getName()
4210 if self._link.isEnabled():
4211 vars["linkStatus"] = _("Activated")
4212 vars["changeStatusTo"] = _("Disable")
4213 else:
4214 vars["linkStatus"] = _("Disabled")
4215 vars["changeStatusTo"] = _("Activate")
4216 return vars
4218 class WPConfModifDisplayAddPage( WPConfModifDisplayBase ):
4220 def __init__(self, rh, conf, linkId):
4221 WPConfModifDisplayBase.__init__(self, rh, conf)
4222 self._linkId = linkId
4223 self._menu = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu()
4224 if linkId:
4225 self._link = self._menu.getLinkById(linkId)
4226 else:
4227 self._link = self._menu
4229 def _setActiveTab( self ):
4230 self._tabDisplayMenu.setActive()
4232 def _getTabContent( self, params ):
4233 return WConfModifDisplayAddPage( self._conf, self._linkId ).getHTML()
4236 class WConfModifDisplayAddPage(wcomponents.WTemplated):
4238 def __init__(self, conf, linkId):
4239 self._conf = conf
4240 self._menu = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu()
4241 if linkId:
4242 self._link = self._menu.getLinkById(linkId)
4243 else:
4244 self._link = self._menu
4246 def getVars(self):
4247 vars = wcomponents.WTemplated.getVars(self)
4248 vars["saveLinkURL"] = quoteattr(str(urlHandlers.UHConfModifDisplayAddPage.getURL(self._link)))
4249 vars["content"]=""
4250 return vars
4252 class WPConfModifDisplayAddLink( WPConfModifDisplayBase ):
4253 def __init__(self, rh, conf, linkId):
4254 WPConfModifDisplayBase.__init__(self, rh, conf)
4255 self._linkId = linkId
4256 self._menu = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu()
4257 if linkId:
4258 self._link = self._menu.getLinkById(linkId)
4259 else:
4260 self._link = self._menu
4262 def _setActiveTab( self ):
4263 self._tabDisplayMenu.setActive()
4265 def _getTabContent( self, params ):
4266 wc = WConfModifDisplayAddLink( self._conf, self._linkId )
4267 p = {"addLinkURL": quoteattr(str(urlHandlers.UHConfModifDisplayAddLink.getURL(self._conf))), \
4268 "addPageURL": quoteattr(str(urlHandlers.UHConfModifDisplayAddPage.getURL(self._conf))), \
4269 "addSpacerURL": quoteattr(str(urlHandlers.UHConfModifDisplayAddSpacer.getURL(self._conf))) }
4270 return wc.getHTML( p )
4273 class WConfModifDisplayAddLink(wcomponents.WTemplated):
4275 def __init__(self, conf, linkId):
4276 self._conf = conf
4277 self._menu = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu()
4278 if linkId:
4279 self._link = self._menu.getLinkById(linkId)
4280 else:
4281 self._link = self._menu
4283 def getVars(self):
4284 vars = wcomponents.WTemplated.getVars(self)
4285 vars["menuDisplay"] = ConfEditMenu(self._menu, urlHandlers.UHConfModifDisplay.getURL).getHTML()
4286 vars["saveLinkURL"] = quoteattr(str(urlHandlers.UHConfModifDisplayAddLink.getURL(self._link)))
4287 return vars
4290 class WPConfModifDisplayModifyData( WPConfModifDisplayBase ):
4291 def __init__(self, rh, conf, link):
4292 WPConfModifDisplayBase.__init__(self, rh, conf)
4293 self._link = link
4294 self._menu = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu()
4296 def _setActiveTab( self ):
4297 self._tabDisplayMenu.setActive()
4299 def _getTabContent( self, params ):
4300 wc = WConfModifDisplayModifyData( self._conf, self._link )
4301 p = {
4302 "modifyDataURL": quoteattr(str(urlHandlers.UHConfModifDisplayModifyData.getURL(self._link))), \
4303 "addLinkURL": quoteattr(str(urlHandlers.UHConfModifDisplayAddLink.getURL(self._conf))), \
4304 "addPageURL": quoteattr(str(urlHandlers.UHConfModifDisplayAddPage.getURL(self._conf))), \
4305 "addSpacerURL": quoteattr(str(urlHandlers.UHConfModifDisplayAddSpacer.getURL(self._conf))) }
4306 return wc.getHTML( p )
4308 class WConfModifDisplayModifyData(wcomponents.WTemplated):
4310 def __init__(self, conf, link):
4311 self._conf = conf
4312 self._menu = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu()
4313 self._link = link
4316 def getVars(self):
4317 vars = wcomponents.WTemplated.getVars(self)
4318 vars["menuDisplay"] = ConfEditMenu(self._menu, urlHandlers.UHConfModifDisplay.getURL).getHTML()
4319 vars["saveLinkURL"] = quoteattr(str(urlHandlers.UHConfModifDisplayAddLink.getURL(self._link)))
4320 vars["name"] = self._link.getCaption()
4321 vars["value_name"] = quoteattr(self._link.getCaption())
4322 vars["url"] = self._link.getURL()
4323 if self._link.getDisplayTarget() == "_blank":
4324 vars["newChecked"] = _("""CHECKED""")
4325 vars["sameChecked"] = ""
4326 else:
4327 vars["newChecked"] = ""
4328 vars["sameChecked"] = _("""CHECKED""")
4330 return vars
4334 class WPConfModifDisplayModifyPage( WPConfModifDisplayBase ):
4335 def __init__(self, rh, conf, link):
4336 WPConfModifDisplayBase.__init__(self, rh, conf)
4337 self._link = link
4338 self._menu = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu()
4340 def _setActiveTab( self ):
4341 self._tabDisplayMenu.setActive()
4343 def _getTabContent( self, params ):
4344 wc = WConfModifDisplayModifyPage( self._conf, self._link )
4345 p = {
4346 "modifyDataURL": quoteattr(str(urlHandlers.UHConfModifDisplayModifyData.getURL(self._link))) }
4347 return wc.getHTML( p )
4349 class WConfModifDisplayModifyPage(wcomponents.WTemplated):
4351 def __init__(self, conf, link):
4352 self._conf = conf
4353 self._menu = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu()
4354 self._link = link
4357 def getVars(self):
4358 vars = wcomponents.WTemplated.getVars(self)
4359 vars["saveLinkURL"] = quoteattr(str(urlHandlers.UHConfModifDisplayAddLink.getURL(self._link)))
4360 vars["name"] = self._link.getCaption()
4361 vars["value_name"] = quoteattr(self._link.getCaption())
4362 vars["content"] = self._link.getPage().getContent().replace('"','\\"').replace("'","\\'").replace('\r\n','\\n').replace('\n','\\n')
4363 if self._link.getDisplayTarget() == "_blank":
4364 vars["newChecked"] = _("""CHECKED""")
4365 vars["sameChecked"] = ""
4366 else:
4367 vars["newChecked"] = ""
4368 vars["sameChecked"] = _("""CHECKED""")
4369 return vars
4371 class WPConfModifDisplayModifySystemData( WPConfModifDisplayBase ):
4372 def __init__(self, rh, conf, link):
4373 WPConfModifDisplayBase.__init__(self, rh, conf)
4374 self._link = link
4375 self._menu = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu()
4377 def _setActiveTab( self ):
4378 self._tabDisplayMenu.setActive()
4380 def _getTabContent( self, params ):
4381 wc = WConfModifDisplayModifySystemData( self._conf, self._link )
4382 p = {
4383 "modifyDataURL": quoteattr(str(urlHandlers.UHConfModifDisplayModifySystemData.getURL(self._link))), \
4384 "addLinkURL": quoteattr(str(urlHandlers.UHConfModifDisplayAddLink.getURL(self._conf))), \
4385 "addPageURL": quoteattr(str(urlHandlers.UHConfModifDisplayAddPage.getURL(self._conf))), \
4386 "addSpacerURL": quoteattr(str(urlHandlers.UHConfModifDisplayAddSpacer.getURL(self._conf))) }
4387 return wc.getHTML( p )
4389 class WConfModifDisplayModifySystemData(wcomponents.WTemplated):
4391 def __init__(self, conf, link):
4392 self._conf = conf
4393 self._menu = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu()
4394 self._link = link
4397 def getVars(self):
4398 vars = wcomponents.WTemplated.getVars(self)
4399 vars["menuDisplay"] = ConfEditMenu(self._menu, urlHandlers.UHConfModifDisplay.getURL).getHTML()
4400 vars["saveLinkURL"] = quoteattr(str(urlHandlers.UHConfModifDisplayModifySystemData.getURL(self._link)))
4401 vars["name"] = self._link.getCaption()
4402 vars["value_name"] = quoteattr(self._link.getCaption())
4403 return vars
4406 class WPConfModifDisplayRemoveLink( WPConfModifDisplayBase ):
4407 def __init__(self, rh, conf, link):
4408 WPConfModifDisplayBase.__init__(self, rh, conf)
4409 self._link = link
4411 def _setActiveTab( self ):
4412 self._tabDisplayMenu.setActive()
4414 def _getTabContent( self, params ):
4416 msg = {
4417 'challenge': _("Are you sure that you want to delete this link?"),
4418 'target': self._link.getName()
4421 postURL = quoteattr(str(urlHandlers.UHConfModifDisplayRemoveLink.getURL(self._link)))
4422 return wcomponents.WConfirmation().getHTML( msg, postURL, {})
4425 class WPConfParticipantList( WPConfAbstractList ):
4427 def __init__(self, rh, conf, emailList, displayedGroups, abstracts):
4428 WPConfAbstractList.__init__(self, rh, conf, None)
4429 self._emailList = emailList
4430 self._displayedGroups = displayedGroups
4431 self._abstracts = abstracts
4433 def _getTabContent( self, params ):
4434 wc = WAbstractsParticipantList(self._conf, self._emailList, self._displayedGroups, self._abstracts)
4435 return wc.getHTML()
4437 class WPConfModifParticipantList( WPConferenceBase ):
4439 def __init__(self, rh, conf, emailList, displayedGroups, contribs):
4440 WPConferenceBase.__init__(self, rh, conf)
4441 self._emailList = emailList
4442 self._displayedGroups = displayedGroups
4443 self._contribs = contribs
4445 def _getBody( self, params ):
4446 WPConferenceBase._getBody(self, params)
4447 wc = WContribParticipantList(self._conf, self._emailList, self._displayedGroups, self._contribs)
4448 params = {"urlDisplayGroup":urlHandlers.UHContribsConfManagerDisplayParticipantList.getURL(self._conf)}
4449 return wc.getHTML(params)
4452 class WConfModifContribList(wcomponents.WTemplated):
4454 def __init__(self,conf,filterCrit, sortingCrit, order, websession, filterUsed=False, filterUrl=None):
4455 self._conf=conf
4456 self._filterCrit=filterCrit
4457 self._sortingCrit=sortingCrit
4458 self._order = order
4459 self._totaldur =timedelta(0)
4460 self.websession = websession
4461 self._filterUsed = filterUsed
4462 self._filterUrl = filterUrl
4465 def _getURL( self ):
4466 #builds the URL to the contribution list page
4467 # preserving the current filter and sorting status
4468 url = urlHandlers.UHConfModifContribList.getURL(self._conf)
4470 #save params in websession
4471 dict = self.websession.getVar("ContributionFilterConf%s"%self._conf.getId())
4472 if not dict:
4473 dict = {}
4474 if self._filterCrit.getField("type"):
4475 l=[]
4476 for t in self._filterCrit.getField("type").getValues():
4477 if t!="":
4478 l.append(t)
4479 dict["types"] = l
4480 if self._filterCrit.getField("type").getShowNoValue():
4481 dict["typeShowNoValue"] = "1"
4483 if self._filterCrit.getField("track"):
4484 dict["tracks"] = self._filterCrit.getField("track").getValues()
4485 if self._filterCrit.getField("track").getShowNoValue():
4486 dict["trackShowNoValue"] = "1"
4488 if self._filterCrit.getField("session"):
4489 dict["sessions"] = self._filterCrit.getField("session").getValues()
4490 if self._filterCrit.getField("session").getShowNoValue():
4491 dict["sessionShowNoValue"] = "1"
4493 if self._filterCrit.getField("status"):
4494 dict["status"] = self._filterCrit.getField("status").getValues()
4496 if self._filterCrit.getField("material"):
4497 dict["material"] = self._filterCrit.getField("material").getValues()
4499 if self._sortingCrit.getField():
4500 dict["sortBy"] = self._sortingCrit.getField().getId()
4501 dict["order"] = "down"
4502 dict["OK"] = "1"
4503 self.websession.setVar("ContributionFilterConf%s"%self._conf.getId(), dict)
4505 return url
4508 def _getMaterialsHTML(self, contrib):
4509 materials=[]
4510 if contrib.getPaper() is not None:
4511 url= urlHandlers.UHContribModifMaterialBrowse.getURL(contrib.getPaper())
4512 #url.addParams({'contribId' : contrib.getId(), 'confId' : contrib.getConference().getId(), 'materialId' : 'paper'})
4513 materials.append("""<a href=%s>%s</a>"""%(quoteattr(str(url)),self.htmlText(PaperFactory().getTitle().lower())))
4514 if contrib.getSlides() is not None:
4515 url= urlHandlers.UHContribModifMaterialBrowse.getURL(contrib.getSlides())
4516 #url.addParams({'contribId' : contrib.getId(), 'confId' : contrib.getConference().getId(), 'materialId' : 'slides'})
4517 materials.append("""<a href=%s>%s</a>"""%(quoteattr(str(url)),self.htmlText(SlidesFactory().getTitle().lower())))
4518 if contrib.getPoster() is not None:
4519 url= urlHandlers.UHContribModifMaterialBrowse.getURL(contrib.getPoster())
4520 #url.addParams({'contribId' : contrib.getId(), 'confId' : contrib.getConference().getId(), 'materialId' : 'poster'})
4521 materials.append("""<a href=%s>%s</a>"""%(quoteattr(str(url)),self.htmlText(PosterFactory().getTitle().lower())))
4522 if contrib.getVideo() is not None:
4523 materials.append("""<a href=%s>%s</a>"""%(
4524 quoteattr(str(urlHandlers.UHContribModifMaterials.getURL(contrib))),
4525 self.htmlText(materialFactories.VideoFactory.getTitle())))
4526 if contrib.getMinutes() is not None:
4527 materials.append("""<a href=%s>%s</a>"""%(
4528 quoteattr(str(urlHandlers.UHContribModifMaterials.getURL(contrib))),
4529 self.htmlText(materialFactories.MinutesFactory.getTitle())))
4530 for material in contrib.getMaterialList():
4531 url=urlHandlers.UHContribModifMaterials.getURL(contrib)
4532 materials.append("""<a href=%s>%s</a>"""%(
4533 quoteattr(str(url)),self.htmlText(material.getTitle())))
4534 return "<br>".join(materials)
4536 def _getContribHTML( self, contrib ):
4537 try:
4538 sdate=contrib.getAdjustedStartDate().strftime("%d-%b-%Y %H:%M" )
4539 except AttributeError:
4540 sdate = ""
4541 title = """<a href=%s>%s</a>"""%( quoteattr( str( urlHandlers.UHContributionModification.getURL( contrib ) ) ), self.htmlText( contrib.getTitle() ))
4542 strdur = ""
4543 if contrib.getDuration() is not None and contrib.getDuration().seconds != 0:
4544 strdur = (datetime(1900,1,1)+ contrib.getDuration()).strftime("%Hh%M'")
4545 dur = contrib.getDuration()
4546 self._totaldur = self._totaldur + dur
4548 l = [self.htmlText( spk.getFullName() ) for spk in contrib.getSpeakerList()]
4549 speaker = "<br>".join( l )
4550 session = ""
4551 if contrib.getSession() is not None:
4552 if contrib.getSession().getCode() != "no code":
4553 session=self.htmlText(contrib.getSession().getCode())
4554 else:
4555 session=self.htmlText(contrib.getSession().getId())
4556 track = ""
4557 if contrib.getTrack() is not None:
4558 if contrib.getTrack().getCode() is not None:
4559 track = self.htmlText( contrib.getTrack().getCode() )
4560 else:
4561 track = self.htmlText( contrib.getTrack().getId() )
4562 cType=""
4563 if contrib.getType() is not None:
4564 cType=self.htmlText(contrib.getType().getName())
4565 status=contrib.getCurrentStatus()
4566 statusCaption=ContribStatusList().getCode(status.__class__)
4567 html = """
4568 <tr id="contributions%s" style="background-color: transparent;" onmouseout="javascript:onMouseOut('contributions%s')" onmouseover="javascript:onMouseOver('contributions%s')">
4569 <td valign="top" align="right" nowrap><input onchange="javascript:isSelected('contributions%s')" type="checkbox" name="contributions" value=%s></td>
4570 <td valign="top" nowrap class="CRLabstractDataCell">%s</td>
4571 <td valign="top" nowrap class="CRLabstractDataCell">%s</td>
4572 <td valign="top" nowrap class="CRLabstractDataCell">%s</td>
4573 <td valign="top" class="CRLabstractDataCell">%s</td>
4574 <td valign="top" class="CRLabstractDataCell">%s</td>
4575 <td valign="top" class="CRLabstractDataCell">%s</td>
4576 <td valign="top" class="CRLabstractDataCell">%s</td>
4577 <td valign="top" class="CRLabstractDataCell">%s</td>
4578 <td valign="top" class="CRLabstractDataCell">%s</td>
4579 <td valign="top" class="CRLabstractDataCell" nowrap>%s</td>
4580 </tr>
4581 """%(contrib.getId(), contrib.getId(), contrib.getId(),
4582 contrib.getId(), contrib.getId(),
4583 self.htmlText(contrib.getId()),
4584 sdate or "&nbsp;",strdur or "&nbsp;",cType or "&nbsp;",
4585 title or "&nbsp;",
4586 speaker or "&nbsp;",session or "&nbsp;",
4587 track or "&nbsp;",statusCaption or "&nbsp;",
4588 self._getMaterialsHTML(contrib) or "&nbsp;")
4589 return html
4591 def _getTypeItemsHTML(self):
4592 checked=""
4593 if self._filterCrit.getField("type").getShowNoValue():
4594 checked=" checked"
4595 res=[ i18nformat("""<input type="checkbox" name="typeShowNoValue" value="--none--"%s> --_("not specified")--""")%checked]
4596 for t in self._conf.getContribTypeList():
4597 checked=""
4598 if t.getId() in self._filterCrit.getField("type").getValues():
4599 checked=" checked"
4600 res.append("""<input type="checkbox" name="types" value=%s%s> %s"""%(quoteattr(str(t.getId())),checked,self.htmlText(t.getName())))
4601 return res
4603 def _getSessionItemsHTML(self):
4604 checked=""
4605 if self._filterCrit.getField("session").getShowNoValue():
4606 checked=" checked"
4607 res=[ i18nformat("""<input type="checkbox" name="sessionShowNoValue" value="--none--"%s> --_("not specified")--""")%checked]
4608 for s in self._conf.getSessionListSorted():
4609 checked=""
4610 l = self._filterCrit.getField("session").getValues()
4611 if not isinstance(l, list):
4612 l = [l]
4613 if s.getId() in l:
4614 checked=" checked"
4615 res.append("""<input type="checkbox" name="sessions" value=%s%s> (%s) %s"""%(quoteattr(str(s.getId())),checked,self.htmlText(s.getCode()),self.htmlText(s.getTitle())))
4616 return res
4618 def _getTrackItemsHTML(self):
4619 checked=""
4620 if self._filterCrit.getField("track").getShowNoValue():
4621 checked=" checked"
4622 res=[ i18nformat("""<input type="checkbox" name="trackShowNoValue" value="--none--"%s> --_("not specified")--""")%checked]
4623 for t in self._conf.getTrackList():
4624 checked=""
4625 if t.getId() in self._filterCrit.getField("track").getValues():
4626 checked=" checked"
4627 res.append("""<input type="checkbox" name="tracks" value=%s%s> (%s) %s"""%(quoteattr(str(t.getId())),checked,self.htmlText(t.getCode()),self.htmlText(t.getTitle())))
4628 return res
4630 def _getStatusItemsHTML(self):
4631 res=[]
4632 for st in ContribStatusList().getList():
4633 id=ContribStatusList().getId(st)
4634 checked=""
4635 if id in self._filterCrit.getField("status").getValues():
4636 checked=" checked"
4637 code=ContribStatusList().getCode(st)
4638 caption=ContribStatusList().getCaption(st)
4639 res.append("""<input type="checkbox" name="status" value=%s%s> (%s) %s"""%(quoteattr(str(id)),checked,self.htmlText(code),self.htmlText(caption)))
4640 return res
4642 def _getMaterialItemsHTML(self):
4643 res=[]
4644 for (id,caption) in [(PaperFactory().getId(),PaperFactory().getTitle()),\
4645 (SlidesFactory().getId(),SlidesFactory().getTitle()),\
4646 ("--other--", _("other")),("--none--", i18nformat("""--_("no material")--"""))]:
4647 checked=""
4648 if id in self._filterCrit.getField("material").getValues():
4649 checked=" checked"
4650 res.append("""<input type="checkbox" name="material" value=%s%s> %s"""%(quoteattr(str(id)),checked,self.htmlText(caption)))
4651 return res
4653 def _getFilterMenu(self):
4655 options = [
4656 ('Types', {"title": _("Types"),
4657 "options": self._getTypeItemsHTML()}),
4658 ('Sessions', {"title": _("Sessions"),
4659 "options": self._getSessionItemsHTML()}),
4660 ('Tracks', {"title": _("Tracks"),
4661 "options": self._getTrackItemsHTML()}),
4662 ('Status', {"title": _("Status"),
4663 "options": self._getStatusItemsHTML()}),
4664 ('Materials', {"title": _("Materials"),
4665 "options": self._getMaterialItemsHTML()})
4668 extraInfo = i18nformat("""<table align="center" cellspacing="10" width="100%%">
4669 <tr>
4670 <td colspan="5" class="titleCellFormat"> _("Author search") <input type="text" name="authSearch" value=%s></td>
4671 </tr>
4672 </table>
4673 """)%(quoteattr(str(self._authSearch)))
4675 p = WFilterCriteriaContribs(options, None, extraInfo)
4677 return p.getHTML()
4679 def getVars( self ):
4680 vars = wcomponents.WTemplated.getVars( self )
4681 vars["filterUrl"] = str(self._filterUrl).replace('%', '%%')
4682 vars["quickSearchURL"]=quoteattr(str(urlHandlers.UHConfModContribQuickAccess.getURL(self._conf)))
4683 vars["filterPostURL"]=quoteattr(str(urlHandlers.UHConfModifContribList.getURL(self._conf)))
4684 self._authSearch=vars.get("authSearch","").strip()
4685 cl=self._conf.getContribsMatchingAuth(self._authSearch)
4687 sortingField = self._sortingCrit.getField()
4688 self._currentSorting=""
4690 if sortingField is not None:
4691 self._currentSorting=sortingField.getId()
4692 vars["currentSorting"]=""
4694 url=self._getURL()
4695 url.addParam("sortBy","number")
4696 vars["numberImg"]=""
4697 if self._currentSorting == "number":
4698 vars["currentSorting"] = i18nformat("""<input type="hidden" name="sortBy" value="_("number")">""")
4699 if self._order == "down":
4700 vars["numberImg"] = """<img src=%s alt="down">"""%(quoteattr(Config.getInstance().getSystemIconURL("downArrow")))
4701 url.addParam("order","up")
4702 elif self._order == "up":
4703 vars["numberImg"] = """<img src=%s alt="up">"""%(quoteattr(Config.getInstance().getSystemIconURL("upArrow")))
4704 url.addParam("order","down")
4705 vars["numberSortingURL"]=quoteattr(str(url))
4707 url = self._getURL()
4708 url.addParam("sortBy", "date")
4709 vars["dateImg"] = ""
4710 if self._currentSorting == "date":
4711 vars["currentSorting"]= i18nformat("""<input type="hidden" name="sortBy" value="_("date")">""")
4712 if self._order == "down":
4713 vars["dateImg"]="""<img src=%s alt="down">"""%(quoteattr(Config.getInstance().getSystemIconURL("downArrow")))
4714 url.addParam("order","up")
4715 elif self._order == "up":
4716 vars["dateImg"]="""<img src=%s alt="up">"""%(quoteattr(Config.getInstance().getSystemIconURL("upArrow")))
4717 url.addParam("order","down")
4718 vars["dateSortingURL"]=quoteattr(str(url))
4721 url = self._getURL()
4722 url.addParam("sortBy", "name")
4723 vars["titleImg"] = ""
4724 if self._currentSorting == "name":
4725 vars["currentSorting"]= i18nformat("""<input type="hidden" name="sortBy" value="_("name")">""")
4726 if self._order == "down":
4727 vars["titleImg"]="""<img src=%s alt="down">"""%(quoteattr(Config.getInstance().getSystemIconURL("downArrow")))
4728 url.addParam("order","up")
4729 elif self._order == "up":
4730 vars["titleImg"]="""<img src=%s alt="up">"""%(quoteattr(Config.getInstance().getSystemIconURL("upArrow")))
4731 url.addParam("order","down")
4732 vars["titleSortingURL"]=quoteattr(str(url))
4735 url = self._getURL()
4736 url.addParam("sortBy", "type")
4737 vars["typeImg"] = ""
4738 if self._currentSorting == "type":
4739 vars["currentSorting"]= i18nformat("""<input type="hidden" name="sortBy" value="_("type")">""")
4740 if self._order == "down":
4741 vars["typeImg"]="""<img src=%s alt="down">"""%(quoteattr(Config.getInstance().getSystemIconURL("downArrow")))
4742 url.addParam("order","up")
4743 elif self._order == "up":
4744 vars["typeImg"]="""<img src=%s alt="up">"""%(quoteattr(Config.getInstance().getSystemIconURL("upArrow")))
4745 url.addParam("order","down")
4746 vars["typeSortingURL"] = quoteattr( str( url ) )
4747 url = self._getURL()
4748 url.addParam("sortBy", "session")
4749 vars["sessionImg"] = ""
4750 if self._currentSorting == "session":
4751 vars["currentSorting"] = i18nformat("""<input type="hidden" name="sortBy" value='_("session")'>""")
4752 if self._order == "down":
4753 vars["sessionImg"] = """<img src=%s alt="down">"""%(quoteattr(Config.getInstance().getSystemIconURL("downArrow")))
4754 url.addParam("order","up")
4755 elif self._order == "up":
4756 vars["sessionImg"] = """<img src=%s alt="up">"""%(quoteattr(Config.getInstance().getSystemIconURL("upArrow")))
4757 url.addParam("order","down")
4758 vars["sessionSortingURL"] = quoteattr( str( url ) )
4759 url = self._getURL()
4760 url.addParam("sortBy", "speaker")
4761 vars["speakerImg"]=""
4762 if self._currentSorting=="speaker":
4763 vars["currentSorting"] = i18nformat("""<input type="hidden" name="sortBy" value="_("speaker")">""")
4764 if self._order == "down":
4765 vars["speakerImg"] = """<img src=%s alt="down">"""%(quoteattr(Config.getInstance().getSystemIconURL("downArrow")))
4766 url.addParam("order","up")
4767 elif self._order == "up":
4768 vars["speakerImg"] = """<img src=%s alt="up">"""%(quoteattr(Config.getInstance().getSystemIconURL("upArrow")))
4769 url.addParam("order","down")
4770 vars["speakerSortingURL"]=quoteattr( str( url ) )
4772 url = self._getURL()
4773 url.addParam("sortBy","track")
4774 vars["trackImg"] = ""
4775 if self._currentSorting == "track":
4776 vars["currentSorting"] = i18nformat("""<input type="hidden" name="sortBy" value="_("track")">""")
4777 if self._order == "down":
4778 vars["trackImg"] = """<img src=%s alt="down">"""%(quoteattr(Config.getInstance().getSystemIconURL("downArrow")))
4779 url.addParam("order","up")
4780 elif self._order == "up":
4781 vars["trackImg"] = """<img src=%s alt="up">"""%(quoteattr(Config.getInstance().getSystemIconURL("upArrow")))
4782 url.addParam("order","down")
4783 vars["trackSortingURL"] = quoteattr( str( url ) )
4785 f=filters.SimpleFilter(self._filterCrit,self._sortingCrit)
4786 filteredContribs = f.apply(cl)
4787 l = [self._getContribHTML(contrib) for contrib in filteredContribs]
4788 contribsToPrint = ["""<input type="hidden" name="contributions" value="%s">"""%contrib.getId() for contrib in filteredContribs]
4789 numContribs = len(filteredContribs)
4791 if self._order =="up":
4792 l.reverse()
4793 vars["contribsToPrint"] = "\n".join(contribsToPrint)
4794 vars["contributions"] = "".join(l)
4795 orginURL = urlHandlers.UHConfModifContribList.getURL(self._conf)
4796 vars["numContribs"]=str(numContribs)
4798 vars["totalNumContribs"] = str(len(self._conf.getContributionList()))
4799 vars["filterUsed"] = self._filterUsed
4801 vars["contributionsPDFURL"]=quoteattr(str(urlHandlers.UHContribsConfManagerDisplayMenuPDF.getURL(self._conf)))
4802 vars["contribSelectionAction"]=quoteattr(str(urlHandlers.UHContribConfSelectionAction.getURL(self._conf)))
4804 totaldur = self._totaldur
4805 days = totaldur.days
4806 hours = (totaldur.seconds)/3600
4807 dayhours = (days * 24)+hours
4808 mins = ((totaldur.seconds)/60)-(hours*60)
4809 vars["totaldur" ]="""%sh%sm"""%(dayhours,mins)
4810 vars['rbActive'] = info.HelperMaKaCInfo.getMaKaCInfoInstance().getRoomBookingModuleActive()
4811 vars["bookings"] = Conversion.reservationsList(self._conf.getRoomBookingList())
4812 vars["filterMenu"] = self._getFilterMenu()
4813 vars["sortingOptions"]="""<input type="hidden" name="sortBy" value="%s">
4814 <input type="hidden" name="order" value="%s">"""%(self._sortingCrit.getField().getId(), self._order)
4815 vars["pdfIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("pdf")))
4816 vars["excelIconURL"] = quoteattr(str(Config.getInstance().getSystemIconURL("excel")))
4817 vars["xmlIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("xml")))
4818 return vars
4820 class WFilterCriteriaContribs(wcomponents.WFilterCriteria):
4822 Draws the options for a filter criteria object
4823 This means rendering the actual table that contains
4824 all the HTML for the several criteria
4827 def __init__(self, options, filterCrit, extraInfo=""):
4828 wcomponents.WFilterCriteria.__init__(self, options, filterCrit, extraInfo)
4830 def _drawFieldOptions(self, id, data):
4832 page = WFilterCriterionOptionsContribs(id, data)
4834 # TODO: remove when we have a better template system
4835 return page.getHTML().replace('%','%%')
4837 class WFilterCriterionOptionsContribs(wcomponents.WTemplated):
4839 def __init__(self, id, data):
4840 self._id = id
4841 self._data = data
4843 def getVars(self):
4845 vars = wcomponents.WTemplated.getVars( self )
4847 vars["id"] = self._id
4848 vars["title"] = self._data["title"]
4849 vars["options"] = self._data["options"]
4850 vars["selectFunc"] = self._data.get("selectFunc", True)
4852 return vars
4854 class WPModifContribList( WPConferenceModifBase ):
4856 _userData = ['favorite-user-list', 'favorite-user-ids']
4858 def __init__(self, rh, conference, filterUsed=False):
4859 WPConferenceModifBase.__init__(self, rh, conference)
4860 self._filterUsed = filterUsed
4862 def _setActiveSideMenuItem(self):
4863 self._contribListMenuItem.setActive(True)
4865 def _getPageContent( self, params ):
4866 filterCrit=params.get("filterCrit",None)
4867 sortingCrit=params.get("sortingCrit",None)
4868 order = params.get("order","down")
4869 websession = self._rh._getSession()
4871 filterParams = {}
4872 fields = getattr(filterCrit, '_fields')
4873 for field in fields.values():
4874 id = field.getId()
4875 showNoValue = field.getShowNoValue()
4876 values = field.getValues()
4877 if showNoValue:
4878 filterParams['%sShowNoValue' % id] = '--none--'
4879 filterParams[id] = values
4881 requestParams = self._rh.getRequestParams()
4883 operationType = requestParams.get('operationType')
4884 if operationType != 'resetFilters':
4885 operationType = 'filter'
4886 urlParams = dict(isBookmark='y', operationType=operationType)
4888 urlParams.update(self._rh.getRequestParams())
4889 urlParams.update(filterParams)
4890 filterUrl = self._rh._uh.getURL(None, **urlParams)
4892 wc = WConfModifContribList(self._conf,filterCrit, sortingCrit, order, websession, self._filterUsed, filterUrl)
4893 p={"authSearch":params.get("authSearch","")}
4895 return wc.getHTML(p)
4897 class WPConfModifContribToPDFMenu( WPModifContribList ):
4899 def __init__(self, rh, conf, contribIds):
4900 WPModifContribList.__init__(self, rh, conf)
4901 self._contribIds = contribIds
4903 def _getPageContent(self, params):
4905 wc = WConfModifContribToPDFMenu(self._conf, self._contribIds)
4906 return wc.getHTML(params)
4908 class WConfModifContribToPDFMenu(wcomponents.WTemplated):
4909 def __init__(self, conf, contribIds):
4910 self._conf = conf
4911 self.contribIds = contribIds
4913 def getVars( self ):
4914 vars = wcomponents.WTemplated.getVars( self )
4915 vars["createPDFURL"] = urlHandlers.UHContribsConfManagerDisplayMenuPDF.getURL(self._conf)
4916 l = []
4917 for id in self.contribIds:
4918 l.append("""<input type="hidden" name="contributions" value="%s">"""%id)
4919 vars["contribIdsList"] = "\n".join(l)
4920 return vars
4923 class WConfModMoveContribsToSession(wcomponents.WTemplated):
4925 def __init__(self,conf,contribIdList=[]):
4926 self._conf=conf
4927 self._contribIdList=contribIdList
4929 def getVars(self):
4930 vars=wcomponents.WTemplated.getVars(self)
4931 vars["postURL"]=quoteattr(str(urlHandlers.UHConfModMoveContribsToSession.getURL(self._conf)))
4932 vars["contribs"]=",".join(self._contribIdList)
4933 s=["""<option value="--none--">--none--</option>"""]
4934 for session in self._conf.getSessionListSorted():
4935 if not session.isClosed():
4936 s.append("""<option value=%s>%s</option>"""%(
4937 quoteattr(str(session.getId())),
4938 self.htmlText(session.getTitle())))
4939 vars["sessions"]="".join(s)
4940 return vars
4943 class WPModMoveContribsToSession(WPModifContribList):
4945 def _getPageContent(self,params):
4946 wc=WConfModMoveContribsToSession(self._conf,params.get("contribIds",[]))
4947 return wc.getHTML()
4950 class WPModMoveContribsToSessionConfirmation(WPModifContribList):
4952 def _getPageContent(self,params):
4953 wc=wcomponents.WConfModMoveContribsToSessionConfirmation(self._conf,params.get("contribIds",[]),params.get("targetSession",None))
4954 p={"postURL":urlHandlers.UHConfModMoveContribsToSession.getURL(self._conf),}
4955 return wc.getHTML(p)
4958 class WPConfEditContribType(WPConferenceModifBase):
4960 def __init__(self, rh, ct):
4961 self._conf = ct.getConference()
4962 self._contribType = ct
4963 WPConferenceModifBase.__init__(self, rh, self._conf)
4965 def _setActiveSideMenuItem(self):
4966 self._generalSettingsMenuItem.setActive(True)
4968 def _getPageContent( self, params ):
4969 wc = WConfEditContribType(self._contribType)
4970 params["saveURL"] = quoteattr(str(urlHandlers.UHConfEditContribType.getURL(self._contribType)))
4971 return wc.getHTML(params)
4974 class WConfEditContribType(wcomponents.WTemplated):
4976 def __init__(self, contribType):
4977 self._contribType = contribType
4979 def getVars(self):
4980 vars = wcomponents.WTemplated.getVars(self)
4981 vars["ctName"] = self._contribType.getName()
4982 vars["ctDescription"] = self._contribType.getDescription()
4984 return vars
4986 class WPConfAddContribType(WPConferenceModifBase):
4988 def _setActiveSideMenuItem(self):
4989 self._generalSettingsMenuItem.setActive(True)
4991 def _getPageContent( self, params ):
4992 wc = WConfAddContribType()
4993 params["saveURL"] = quoteattr(str(urlHandlers.UHConfAddContribType.getURL(self._conf)))
4994 return wc.getHTML(params)
4997 class WConfAddContribType(wcomponents.WTemplated):
4999 def getVars(self):
5000 vars = wcomponents.WTemplated.getVars(self)
5001 return vars
5003 class WAbstractsParticipantList(wcomponents.WTemplated):
5005 def __init__(self, conf, emailList, displayedGroups, abstracts):
5006 self._emailList = emailList
5007 self._displayedGroups = displayedGroups
5008 self._conf = conf
5009 self._abstracts = abstracts
5011 def getVars(self):
5012 vars = wcomponents.WTemplated.getVars(self)
5014 vars["submitterEmails"] = ",".join(self._emailList["submitters"]["emails"])
5015 vars["primaryAuthorEmails"] = ",".join(self._emailList["primaryAuthors"]["emails"])
5016 vars["coAuthorEmails"] = ",".join(self._emailList["coAuthors"]["emails"])
5018 urlDisplayGroup = urlHandlers.UHAbstractsConfManagerDisplayParticipantList.getURL(self._conf)
5019 abstractsToPrint = []
5020 for abst in self._abstracts:
5021 abstractsToPrint.append("""<input type="hidden" name="abstracts" value="%s">"""%abst)
5022 abstractsList = "".join(abstractsToPrint)
5023 displayedGroups = []
5024 for dg in self._displayedGroups:
5025 displayedGroups.append("""<input type="hidden" name="displayedGroups" value="%s">"""%dg)
5026 groupsList = "".join(displayedGroups)
5028 # Submitters
5029 text = _("show list")
5030 vars["submitters"] = "<tr colspan=\"2\"><td>&nbsp;</td></tr>"
5031 if "submitters" in self._displayedGroups:
5032 l = []
5033 color = "white"
5034 text = _("close list")
5035 for subm in self._emailList["submitters"]["tree"].values():
5036 if color=="white":
5037 color="#F6F6F6"
5038 else:
5039 color="white"
5040 participant = "%s %s %s <%s>"%(subm.getTitle(), subm.getFirstName(), subm.getFamilyName().upper(), subm.getEmail())
5041 l.append("<tr>\
5042 <td colspan=\"2\" nowrap bgcolor=\"%s\" class=\"blacktext\">\
5043 &nbsp;&nbsp;&nbsp;%s</td></tr>"%(color, self.htmlText(participant)))
5044 vars["submitters"] = "".join(l)
5045 urlDisplayGroup.addParam("clickedGroup", "submitters")
5046 vars["showSubmitters"] = """<form action="%s" method="post">\
5049 <input type="submit" class="btn" value="%s">
5050 </form>"""%(str(urlDisplayGroup), abstractsList,groupsList, text)
5052 # Primary authors
5053 text = _("show list")
5054 vars["primaryAuthors"] = "<tr colspan=\"2\"><td>&nbsp;</td></tr>"
5055 if "primaryAuthors" in self._displayedGroups:
5056 l = []
5057 color = "white"
5058 text = _("close list")
5059 for pAuth in self._emailList["primaryAuthors"]["tree"].values():
5060 if color=="white":
5061 color="#F6F6F6"
5062 else:
5063 color="white"
5064 participant = "%s <%s>"%(pAuth.getFullName(), pAuth.getEmail())
5065 l.append("<tr><td colspan=\"2\" nowrap bgcolor=\"%s\" \
5066 class=\"blacktext\">&nbsp;&nbsp;&nbsp;%s</td></tr>"%(color, self.htmlText(participant)))
5067 vars["primaryAuthors"] = "".join(l)
5068 urlDisplayGroup.addParam("clickedGroup", "primaryAuthors")
5069 vars["showPrimaryAuthors"] = """<form action="%s" method="post">\
5072 <input type="submit" class="btn" value="%s">
5073 </form>"""%(str(urlDisplayGroup), abstractsList,groupsList, text)
5075 # Co-Authors
5076 text = _("show list")
5077 vars["coAuthors"] = "<tr colspan=\"2\"><td>&nbsp;</td></tr>"
5078 if "coAuthors" in self._displayedGroups:
5079 l = []
5080 color = "white"
5081 text = _("close list")
5082 for cAuth in self._emailList["coAuthors"]["tree"].values():
5083 if color=="white":
5084 color="#F6F6F6"
5085 else:
5086 color="white"
5087 cAuthEmail = cAuth.getEmail()
5088 if cAuthEmail.strip() == "":
5089 participant = "%s"%cAuth.getFullName()
5090 else:
5091 participant = "%s <%s>"%(cAuth.getFullName(), cAuthEmail)
5092 l.append("<tr><td colspan=\"2\" nowrap bgcolor=\"%s\" class=\"blacktext\">\
5093 &nbsp;&nbsp;&nbsp;%s</td></tr>"%(color, self.htmlText(participant)))
5094 vars["coAuthors"] = "".join(l)
5095 urlDisplayGroup.addParam("clickedGroup", "coAuthors")
5096 vars["showCoAuthors"] = """<form action="%s" method="post">\
5099 <input type="submit" class="btn" value="%s">
5100 </form>"""%(str(urlDisplayGroup), abstractsList,groupsList, text)
5101 return vars
5103 class WContribParticipantList(wcomponents.WTemplated):
5105 def __init__(self, conf, emailList, displayedGroups, contribs):
5106 self._emailList = emailList
5107 self._displayedGroups = displayedGroups
5108 self._conf = conf
5109 self._contribs = contribs
5111 def getVars(self):
5112 vars = wcomponents.WTemplated.getVars(self)
5114 vars["speakerEmails"] = ", ".join(self._emailList["speakers"]["emails"])
5115 vars["primaryAuthorEmails"] = ", ".join(self._emailList["primaryAuthors"]["emails"])
5116 vars["coAuthorEmails"] = ", ".join(self._emailList["coAuthors"]["emails"])
5118 urlDisplayGroup = vars["urlDisplayGroup"]
5119 contribsToPrint = []
5120 for contrib in self._contribs:
5121 contribsToPrint.append("""<input type="hidden" name="contributions" value="%s">"""%contrib)
5122 contribsList = "".join(contribsToPrint)
5123 displayedGroups = []
5124 for dg in self._displayedGroups:
5125 displayedGroups.append("""<input type="hidden" name="displayedGroups" value="%s">"""%dg)
5126 groupsList = "".join(displayedGroups)
5128 # Speakers
5129 text = _("show list")
5130 vars["speakers"] = "<tr colspan=\"2\"><td>&nbsp;</td></tr>"
5131 if "speakers" in self._displayedGroups:
5132 l = []
5133 color = "white"
5134 text = _("close list")
5135 for speaker in self._emailList["speakers"]["tree"].values():
5136 if color=="white":
5137 color="#F6F6F6"
5138 else:
5139 color="white"
5140 participant = "%s <%s>"%(speaker.getFullName(), speaker.getEmail())
5141 l.append("<tr>\
5142 <td colspan=\"2\" nowrap bgcolor=\"%s\" class=\"blacktext\">\
5143 &nbsp;&nbsp;&nbsp;%s</td></tr>"%(color, self.htmlText(participant)))
5144 vars["speakers"] = "".join(l)
5145 urlDisplayGroup.addParam("clickedGroup", "speakers")
5146 vars["showSpeakers"] = """<form action="%s" method="post">\
5149 <input type="submit" class="btn" value="%s">
5150 </form>"""%(str(urlDisplayGroup), contribsList,groupsList, text)
5152 # Primary authors
5153 text = _("show list")
5154 vars["primaryAuthors"] = "<tr colspan=\"2\"><td>&nbsp;</td></tr>"
5155 if "primaryAuthors" in self._displayedGroups:
5156 l = []
5157 color = "white"
5158 text = _("close list")
5159 for pAuth in self._emailList["primaryAuthors"]["tree"].values():
5160 if color=="white":
5161 color="#F6F6F6"
5162 else:
5163 color="white"
5164 participant = "%s %s %s <%s>"%(pAuth.getTitle(), pAuth.getFirstName(), pAuth.getFamilyName().upper(), pAuth.getEmail())
5165 l.append("<tr><td colspan=\"2\" nowrap bgcolor=\"%s\" \
5166 class=\"blacktext\">&nbsp;&nbsp;&nbsp;%s</td></tr>"%(color, self.htmlText(participant)))
5167 vars["primaryAuthors"] = "".join(l)
5168 urlDisplayGroup.addParam("clickedGroup", "primaryAuthors")
5169 vars["showPrimaryAuthors"] = """<form action="%s" method="post">\
5172 <input type="submit" class="btn" value="%s">
5173 </form>"""%(str(urlDisplayGroup), contribsList,groupsList, text)
5175 # Co-Authors
5176 text = _("show list")
5177 vars["coAuthors"] = "<tr colspan=\"2\"><td>&nbsp;</td></tr>"
5178 if "coAuthors" in self._displayedGroups:
5179 l = []
5180 color = "white"
5181 text = _("close list")
5182 for cAuth in self._emailList["coAuthors"]["tree"].values():
5183 if color=="white":
5184 color="#F6F6F6"
5185 else:
5186 color="white"
5187 cAuthEmail = cAuth.getEmail()
5188 if cAuthEmail.strip() == "":
5189 participant = "%s %s %s"%(cAuth.getTitle(), cAuth.getFirstName(), cAuth.getFamilyName().upper())
5190 else:
5191 participant = "%s %s %s <%s>"%(cAuth.getTitle(), cAuth.getFirstName(), cAuth.getFamilyName().upper(), cAuthEmail)
5192 l.append("<tr><td colspan=\"2\" nowrap bgcolor=\"%s\" class=\"blacktext\">\
5193 &nbsp;&nbsp;&nbsp;%s</td></tr>"%(color, self.htmlText(participant)))
5194 vars["coAuthors"] = "".join(l)
5195 urlDisplayGroup.addParam("clickedGroup", "coAuthors")
5196 vars["showCoAuthors"] = """<form action="%s" method="post">\
5199 <input type="submit" class="btn" value="%s">
5200 </form>"""%(str(urlDisplayGroup), contribsList,groupsList, text)
5201 return vars
5204 class WPAbstractSendNotificationMail(WPConferenceBase):
5206 def __init__(self, rh, conf, count):
5207 WPConferenceBase.__init__(self, rh, conf)
5208 self._count = count
5210 def _getBody( self, params ):
5211 return i18nformat("""
5212 <table align="center"><tr><td align="center">
5213 <b> _("The submitters of the selected abstracts will nearly recieve the notification mail").<br>
5214 <br>
5215 _("You can now close this window.")</b>
5216 </td></tr></table>
5218 """)
5221 class WPContributionList( WPConferenceDefaultDisplayBase ):
5222 navigationEntry = navigation.NEContributionList
5224 def _getBody( self, params ):
5225 wc = WConfContributionList( self._getAW(), self._conf, params["filterCrit"], params.get("filterText",""))
5226 return wc.getHTML()
5228 def _defineSectionMenu( self ):
5229 WPConferenceDefaultDisplayBase._defineSectionMenu( self )
5230 self._sectionMenu.setCurrentItem(self._contribListOpt)
5234 class WConfContributionList ( wcomponents.WTemplated ):
5236 def __init__(self, aw, conf, filterCrit, filterText):
5237 self._aw = aw
5238 self._conf = conf
5239 self._filterCrit = filterCrit
5240 self._filterText = filterText
5242 def getVars( self ):
5243 vars = wcomponents.WTemplated.getVars( self )
5245 vars["contributions"] = self._conf.getContributionListSorted(includeWithdrawn=False, key="title")
5246 vars["showAttachedFiles"] = self._conf.getAbstractMgr().showAttachedFilesContribList()
5247 vars["conf"] = self._conf
5248 vars["accessWrapper"] = self._aw
5249 vars["filterCriteria"] = self._filterCrit
5250 vars["filterText"] = self._filterText
5251 vars["formatDate"] = lambda date: format_date(date, "d MMM yyyy")
5252 vars["formatTime"] = lambda time: format_time(time, format="short", timezone=timezone(DisplayTZ(self._aw, self._conf).getDisplayTZ()))
5253 return vars
5256 class WConfAuthorIndex( wcomponents.WTemplated ):
5258 def __init__(self, conf):
5259 self._conf = conf
5262 def getVars(self):
5263 vars = wcomponents.WTemplated.getVars(self)
5264 res = []
5265 for key, authors in self._conf.getAuthorIndex().iteritems():
5267 # get the first identity that matches the author
5268 if len(authors) == 0:
5269 continue
5270 else:
5271 auth = authors[0]
5273 authorURL = urlHandlers.UHContribAuthorDisplay.getURL(auth.getContribution(),
5274 authorId=auth.getId())
5275 contribs = []
5276 res.append({'fullName': auth.getFullNameNoTitle(),
5277 'affiliation': auth.getAffiliation(),
5278 'authorURL': authorURL,
5279 'contributions': contribs
5282 for auth in authors:
5283 contrib = auth.getContribution()
5284 if contrib is not None:
5285 contribs.append({
5286 'title': contrib.getTitle(),
5287 'url': str(urlHandlers.UHContributionDisplay.getURL(auth.getContribution())),
5288 'materials': fossilize(contrib.getAllMaterialList())
5291 vars["items"] = dict(enumerate(res))
5292 return vars
5295 class WPAuthorIndex( WPConferenceDefaultDisplayBase ):
5296 navigationEntry = navigation.NEAuthorIndex
5298 def getJSFiles(self):
5299 return WPConferenceDefaultDisplayBase.getJSFiles(self) + \
5300 self._asset_env['indico_authors'].urls()
5302 def _getBody(self,params):
5303 wc = WConfAuthorIndex(self._conf)
5304 return wc.getHTML()
5306 def _defineSectionMenu( self ):
5307 WPConferenceDefaultDisplayBase._defineSectionMenu( self )
5308 self._sectionMenu.setCurrentItem(self._authorIndexOpt)
5311 class WConfSpeakerIndex( wcomponents.WTemplated ):
5313 def __init__(self, conf):
5314 self._conf = conf
5316 def getVars(self):
5317 vars = wcomponents.WTemplated.getVars(self)
5318 res = collections.defaultdict(list)
5319 for index, key in enumerate(self._conf.getSpeakerIndex().getParticipationKeys()):
5320 pl = self._conf.getSpeakerIndex().getById(key)
5321 try:
5322 speaker = pl[0]
5323 except IndexError:
5324 continue
5325 res[index].append({'fullName': speaker.getFullNameNoTitle(), 'affiliation': speaker.getAffiliation()})
5326 for speaker in pl:
5327 if isinstance(speaker, conference.SubContribParticipation):
5328 participation = speaker.getSubContrib()
5329 if participation is None:
5330 continue
5331 url = urlHandlers.UHSubContributionDisplay.getURL(participation)
5332 else:
5333 participation = speaker.getContribution()
5334 if participation is None:
5335 continue
5336 url = urlHandlers.UHContributionDisplay.getURL(participation)
5337 res[index].append({'title': participation.getTitle(), 'url': str(url), 'materials': fossilize(participation.getAllMaterialList())})
5338 vars["items"] = res
5339 return vars
5341 class WPSpeakerIndex( WPConferenceDefaultDisplayBase ):
5342 navigationEntry = navigation.NESpeakerIndex
5344 def _getBody(self, params):
5345 wc=WConfSpeakerIndex(self._conf)
5346 return wc.getHTML()
5348 def getJSFiles(self):
5349 return WPConferenceDefaultDisplayBase.getJSFiles(self) + \
5350 self._asset_env['indico_authors'].urls()
5352 def _defineSectionMenu( self ):
5353 WPConferenceDefaultDisplayBase._defineSectionMenu( self )
5354 self._sectionMenu.setCurrentItem(self._speakerIndexOpt)
5356 class WConfMyContributions(wcomponents.WTemplated):
5358 def __init__(self, aw, conf):
5359 self._aw=aw
5360 self._conf=conf
5362 def getHTML(self, params):
5363 return wcomponents.WTemplated.getHTML(self, params)
5365 def getVars(self):
5366 vars = wcomponents.WTemplated.getVars( self )
5367 vars["User"] = self._aw.getUser()
5368 vars["Conference"] = self._conf
5369 vars["ConfReviewingChoice"] = self._conf.getConfPaperReview().getChoice()
5370 return vars
5372 class WConfMyStuffMySessions(wcomponents.WTemplated):
5374 def __init__(self,aw,conf):
5375 self._aw=aw
5376 self._conf=conf
5378 def _getSessionsHTML(self):
5379 if self._aw.getUser() is None:
5380 return ""
5381 #ls=self._conf.getCoordinatedSessions(self._aw.getUser())+self._conf.getManagedSession(self._aw.getUser())
5382 ls = set(self._conf.getCoordinatedSessions(self._aw.getUser()))
5383 ls = list(ls | set(self._conf.getManagedSession(self._aw.getUser())))
5384 if len(ls)<=0:
5385 return ""
5386 res=[]
5387 iconURL=Config.getInstance().getSystemIconURL("conf_edit")
5388 for s in ls:
5389 modURL=urlHandlers.UHSessionModification.getURL(s)
5390 dispURL=urlHandlers.UHSessionDisplay.getURL(s)
5391 res.append("""
5392 <tr class="infoTR">
5393 <td class="infoTD" width="100%%">%s</td>
5394 <td nowrap class="infoTD"><a href=%s>Edit</a><span class="horizontalSeparator">|</span><a href=%s>View</a></td>
5395 </tr>"""%(self.htmlText(s.getTitle()),
5396 quoteattr(str(modURL)),
5397 quoteattr(str(dispURL))))
5398 return """
5399 <table class="groupTable width="70%%" align="center" cellspacing="0" style="padding-top:15px;">
5400 <tr>
5401 <td class="groupTitle" colspan="4">Sessions</td>
5402 </tr>
5403 <tr>
5404 <td>%s</td>
5405 </tr>
5406 </table>
5407 """%"".join(res)
5410 def getVars(self):
5411 vars=wcomponents.WTemplated.getVars(self)
5412 vars["items"]=self._getSessionsHTML()
5413 return vars
5415 class WPConfMyStuffMySessions(WPConferenceDefaultDisplayBase):
5416 navigationEntry = navigation.NEMyStuff
5418 def _getBody(self,params):
5419 wc=WConfMyStuffMySessions(self._getAW(),self._conf)
5420 return wc.getHTML()
5422 def _defineSectionMenu( self ):
5423 WPConferenceDefaultDisplayBase._defineSectionMenu( self )
5424 self._sectionMenu.setCurrentItem(self._myStuffOpt)
5427 class WConfMyStuffMyContributions(wcomponents.WTemplated):
5429 def __init__(self,aw,conf):
5430 self._aw=aw
5431 self._conf=conf
5433 def _getContribsHTML(self):
5434 return WConfMyContributions(self._aw, self._conf).getHTML({})
5436 def getVars(self):
5437 vars=wcomponents.WTemplated.getVars(self)
5438 vars["items"]=self._getContribsHTML()
5439 return vars
5441 class WPConfMyStuffMyContributions(WPConferenceDefaultDisplayBase):
5442 navigationEntry = navigation.NEMyStuff
5444 def _getBody(self,params):
5445 wc=WConfMyStuffMyContributions(self._getAW(),self._conf)
5446 return wc.getHTML()
5448 def _defineSectionMenu( self ):
5449 WPConferenceDefaultDisplayBase._defineSectionMenu( self )
5450 self._sectionMenu.setCurrentItem(self._myContribsOpt)
5453 class WConfMyStuffMyTracks(wcomponents.WTemplated):
5455 def __init__(self,aw,conf):
5456 self._aw=aw
5457 self._conf=conf
5459 def _getTracksHTML(self):
5460 if self._aw.getUser() is None or not self._conf.getAbstractMgr().isActive() or not self._conf.hasEnabledSection("cfa"):
5461 return ""
5462 lt=self._conf.getCoordinatedTracks(self._aw.getUser())
5463 if len(lt)<=0:
5464 return ""
5465 res=[]
5466 iconURL=Config.getInstance().getSystemIconURL("conf_edit")
5467 for t in lt:
5468 modURL=urlHandlers.UHTrackModifAbstracts.getURL(t)
5469 res.append("""
5470 <tr class="infoTR">
5471 <td class="infoTD" width="100%%">%s</td>
5472 <td nowrap class="infoTD"><a href=%s>Edit</a></td>
5473 </tr>"""%(self.htmlText(t.getTitle()),
5474 quoteattr(str(modURL))))
5475 return """
5476 <table class="groupTable width="70%%" align="center" cellspacing="0" style="padding-top: 25px;">
5477 <tr>
5478 <td class="groupTitle" colspan="4">Tracks</td>
5479 </tr>
5480 <tr>
5481 <td>%s</td>
5482 </tr>
5483 </table>
5484 """%"".join(res)
5486 def getVars(self):
5487 vars=wcomponents.WTemplated.getVars(self)
5488 vars["items"]=self._getTracksHTML()
5490 from MaKaC.webinterface.pages import reviewing
5491 vars["hasPaperReviewing"] = self._conf.hasEnabledSection('paperReviewing')
5492 vars["ContributionReviewingTemplatesList"] = reviewing.WContributionReviewingTemplatesList(self._conf).getHTML({"CanDelete" : False})
5493 return vars
5495 class WPConfMyStuffMyTracks(WPConferenceDefaultDisplayBase):
5496 navigationEntry = navigation.NEMyStuff
5498 def _getBody(self,params):
5499 wc=WConfMyStuffMyTracks(self._getAW(),self._conf)
5500 return wc.getHTML()
5502 def _defineSectionMenu( self ):
5503 WPConferenceDefaultDisplayBase._defineSectionMenu( self )
5504 self._sectionMenu.setCurrentItem(self._myTracksOpt)
5506 class WConfMyStuff(wcomponents.WTemplated):
5508 def __init__(self,aw,conf):
5509 self._aw=aw
5510 self._conf=conf
5512 class WPMyStuff(WPConferenceDefaultDisplayBase):
5513 navigationEntry = navigation.NEMyStuff
5515 def _getBody(self,params):
5516 wc=WConfMyStuff(self._getAW(),self._conf)
5517 return wc.getHTML()
5519 def _defineSectionMenu( self ):
5520 WPConferenceDefaultDisplayBase._defineSectionMenu( self )
5521 self._sectionMenu.setCurrentItem(self._myStuffOpt)
5524 class WConfModAbstractBook(wcomponents.WTemplated):
5526 def __init__(self,conf):
5527 self._conf = conf
5529 def getVars(self):
5530 vars = wcomponents.WTemplated.getVars(self)
5531 boaConfig = self._conf.getBOAConfig()
5532 vars["sortByList"] = boaConfig.getSortByTypes()
5533 vars["modURL"] = quoteattr(str(urlHandlers.UHConfModAbstractBookEdit.getURL(self._conf)))
5534 vars["previewURL"] = quoteattr(str(urlHandlers.UHConfAbstractBook.getURL(self._conf)))
5535 vars["sortBy"] = boaConfig.getSortBy()
5536 vars["boaConfig"] = boaConfig
5537 vars["urlToogleShowIds"] = str(urlHandlers.UHConfModAbstractBookToogleShowIds.getURL(self._conf))
5538 vars["conf"] = self._conf
5539 vars["bookOfAbstractsActive"] = self._conf.getAbstractMgr().getCFAStatus()
5540 vars["bookOfAbstractsMenuActive"] = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu().getLinkByName('abstractsBook').isEnabled()
5541 vars["correspondingAuthorList"] = boaConfig.getCorrespondingAuthorTypes()
5542 vars["correspondingAuthor"]= boaConfig.getCorrespondingAuthor()
5543 return vars
5545 class WPModAbstractBook(WPConferenceModifAbstractBase):
5547 def _setActiveTab( self ):
5548 self._tabBOA.setActive()
5550 def _getTabContent( self, params ):
5551 wc=WConfModAbstractBook(self._conf)
5552 return wc.getHTML()
5555 class WPFullMaterialPackage(WPConfModifToolsBase):
5557 def _setActiveTab(self):
5558 self._tabMatPackage.setActive()
5560 def _getTabContent(self, params):
5561 wc = WFullMaterialPackage(self._conf)
5562 return wc.getHTML()
5565 class WFullMaterialPackage(wcomponents.WTemplated):
5567 def __init__(self,conf):
5568 self._conf=conf
5570 def getVars(self):
5571 vars=wcomponents.WTemplated.getVars(self)
5572 if not vars.has_key("getPkgURL"):
5573 vars["getPkgURL"] = quoteattr(str(urlHandlers.UHConfModFullMaterialPackagePerform.getURL(self._conf)))
5575 #######################################
5576 # Fermi timezone awareness #
5577 #######################################
5578 sDate = self._conf.getSchedule().getAdjustedStartDate()
5579 eDate = self._conf.getSchedule().getAdjustedEndDate()
5580 #######################################
5581 # Fermi timezone awareness(end) #
5582 #######################################
5583 vars["selectAll"] = Config.getInstance().getSystemIconURL("checkAll")
5584 vars["deselectAll"] = Config.getInstance().getSystemIconURL("uncheckAll")
5585 htmlDay = []
5586 while sDate <= eDate:
5587 htmlDay.append("""
5588 <tr>
5589 <td nowrap="nowrap" valign="top"><input name="days" type="checkbox" checked="checked" value="%s">%s</td>
5590 </tr>
5591 """%(format_date(sDate, format='dMMMMyyyy'), format_date(sDate, format='long') ) )
5592 sDate += timedelta(days=1)
5593 vars["dayList"] = "".join(htmlDay)
5594 vars["sessionList"] = ""
5595 if len(self._conf.getSessionList()) == 0:
5596 vars["sessionList"] = "No session in this event"
5597 for session in self._conf.getSessionList():
5598 vars["sessionList"] += i18nformat("""
5599 <input name="sessionList" type="checkbox" value="%s" checked="checked">%s _("(last modified: %s)")<br>""") % (session.getId(),session.getTitle(), format_datetime(session.getModificationDate(), format='d MMMM yyyy H:mm'))
5601 vars["materialTypes"] = MaterialFactoryRegistry.getAllowed(self._conf)
5602 return vars
5604 # ------------------ Static web pages ------------------
5606 class WPConferenceStaticDefaultDisplayBase( WPConferenceDefaultDisplayBase ):
5608 def _getHTMLHeader( self ):
5609 cssDir="./css"
5610 if len(self._staticPars) > 0 and self._staticPars.values()[0].startswith(".."):
5611 cssDir="../css"
5612 return """
5613 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
5614 <html>
5615 <head>
5616 <title>%s</title>
5617 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
5618 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5619 <link rel="shortcut icon" href=%s>
5620 <link rel="stylesheet" type="text/css" href="%s/%s">
5621 </head>
5622 <body>
5624 """%(self._getTitle(), quoteattr(self._staticPars["addressBarIcon"]),
5625 cssDir, Config.getInstance().getCssStylesheetName(),
5626 self._getWarningMessage())
5628 def _getHeader( self ):
5631 wc = wcomponents.WStaticWebHeader()
5632 params = {}
5633 params["imgLogo"] = self._staticPars["miniLogo"]
5634 return wc.getHTML( params )
5636 def _applyConfDisplayDecoration( self, body ):
5637 frame = WConfStaticDisplayFrame( self._getAW(), self._conf, self._staticPars)
5638 frameParams = {}
5639 body = """
5640 <div class="confBodyBox clearfix">
5641 <div style="width: 100%;">
5642 <!--Main body-->
5644 </div>
5645 </div>"""%( body )
5646 return frame.getHTML( self._sectionMenu, body, frameParams)
5648 class WConfStaticDetails( wcomponents.WTemplated ):
5650 def __init__(self, aw, conf, staticPars):
5651 self._conf = conf
5652 self._aw = aw
5653 self._staticPars = staticPars
5655 def _getChairsHTML( self ):
5656 chairList = []
5657 l = []
5658 for chair in self._conf.getChairList():
5659 mailToURL = """mailto:%s"""%urllib.quote(chair.getEmail())
5660 l.append( """<a href=%s>%s</a>"""%(quoteattr(mailToURL),self.htmlText(chair.getFullName())))
5661 res = ""
5662 if len(l) > 0:
5663 res = i18nformat("""
5664 <tr>
5665 <td align="right" valign="top" class="displayField"><b> _("Chairs"):</b></td>
5666 <td>%s</td>
5667 </tr>
5668 """)%"<br>".join(l)
5669 return res
5671 def _getMaterialHTML( self ):
5672 l = []
5673 for mat in self._conf.getAllMaterialList():
5674 temp = wcomponents.WMaterialDisplayItem()
5675 url = urlHandlers.UHStaticMaterialDisplay.getRelativeURL(mat)
5676 l.append( temp.getHTML( self._aw, mat, url, self._staticPars["material"] ) )
5677 res = ""
5678 if l:
5679 res = i18nformat("""
5680 <tr>
5681 <td align="right" valign="top" class="displayField"><b> _("Material"):</b></td>
5682 <td align="left" width="100%%">%s</td>
5683 </tr>""")%"<br>".join( l )
5684 return res
5686 def _getMoreInfoHTML( self ):
5687 res = ""
5688 if self._conf.getContactInfo() != "":
5689 res = i18nformat("""
5690 <tr>
5691 <td align="right" valign="top" class="displayField"><b> _("Additional info"):</b>
5692 </td>
5693 <td>%s</td>
5694 </tr>""")%self._conf.getContactInfo()
5695 return res
5697 def _getActionsHTML( self, showActions = False):
5698 html=[]
5699 if showActions:
5700 html=[ i18nformat("""
5701 <table style="padding-top:40px; padding-left:20px">
5702 <tr>
5703 <td nowrap>
5704 <b> _("Conference sections"):</b>
5705 <ul>
5706 """)]
5707 menu = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu()
5708 for link in menu.getLinkList():
5709 if link.isVisible() and link.isEnabled():
5710 html.append(""" <li><a href="%s">%s</a></li>
5711 """%( link.getURL(), link.getCaption() ) )
5712 html.append("""
5713 </ul>
5714 </td>
5715 </tr>
5716 </table>
5717 """)
5718 return "".join(html)
5720 def getVars( self ):
5721 vars = wcomponents.WTemplated.getVars( self )
5722 vars["description"] = self._conf.getDescription()
5723 sdate, edate = self._conf.getAdjustedStartDate(), self._conf.getAdjustedEndDate()
5724 fsdate, fedate = format_date(sDate, format='long'), format_date(eDate, format='long')
5725 fstime, fetime = sdate.strftime("%H:%M"), edate.strftime("%H:%M")
5726 vars["dateInterval"] = i18nformat("""_("from") %s %s _("to") %s %s""")%(fsdate, fstime, \
5727 fedate, fetime)
5728 if sdate.strftime("%d%B%Y") == edate.strftime("%d%B%Y"):
5729 timeInterval = fstime
5730 if sdate.strftime("%H%M") != edate.strftime("%H%M"):
5731 timeInterval = "%s-%s"%(fstime, fetime)
5732 vars["dateInterval"] = "%s (%s)"%( fsdate, timeInterval)
5733 vars["location"] = ""
5734 location = self._conf.getLocation()
5735 if location:
5736 vars["location"] = "<i>%s</i><br><pre>%s</pre>"%( location.getName(), location.getAddress() )
5737 room = self._conf.getRoom()
5738 if room:
5739 roomLink = linking.RoomLinker().getHTMLLink( room, location )
5740 vars["location"] += i18nformat("""<small> _("Room"):</small> %s""")%roomLink
5741 vars["chairs"] = self._getChairsHTML()
5742 vars["material"] = self._getMaterialHTML()
5743 vars["moreInfo"] = self._getMoreInfoHTML()
5744 vars["actions"] = self._getActionsHTML(vars.get("menuStatus", "open") != "open")
5746 return vars
5748 class ConfStaticDisplayMenu:
5750 def __init__(self, menu, linkList):
5751 self._menu = menu
5752 self._linkList = linkList
5754 def getHTML(self, params):
5755 html = []
5756 html = ["""<!--Left menu-->
5757 <div class="conf_leftMenu">
5758 <ul>
5759 <li class="menuConfTopCell">
5760 &nbsp;
5761 </li>
5762 """]
5763 for link in self._linkList:
5764 if link.isVisible():
5765 html.append(self._getLinkHTML(link, params))
5766 html.append("""<li class="menuConfBottomCell">&nbsp;</li>""")
5767 html.append(""" </ul>
5768 <div align="left" class="confSupportEmailBox">%s</div>
5769 </div>"""%params["supportEmail"])
5770 return "".join(html)
5772 def _getLinkHTML(self, link, params, indent=""):
5773 if not link.isVisible():
5774 return ""
5775 if link.getType() == "spacer":
5776 html = """<tr><td><br></td></tr>\n"""
5777 else:
5778 parentDir = ""
5779 if len(params) > 0 and params.values()[0].startswith(".."):
5780 parentDir = "."
5781 target = ""
5782 sublinkList=[]
5784 for sublink in link.getEnabledLinkList():
5785 if sublink.isVisible():
5786 sublinkList.append(sublink)
5788 if isinstance(link,displayMgr.ExternLink):
5789 target=""" target="_blank" """
5790 #Commented because menuicon variable is not used anymore
5791 #if sublinkList:
5792 # menuicon=params["arrowBottomMenuConf"]
5793 #else:
5794 # menuicon=params["arrowRightMenuConf"]
5796 #TODO: eventually change this so that it's the same as the non-static menu
5797 if self._menu.isCurrentItem(link):
5798 url="%s%s"%(parentDir, link.getStaticURL())
5799 html = ["""<li id="menuLink_%s" class="menuConfSelected" nowrap><a href="%s"%s>%s</a></li>\n"""%(sublink.getName(), url, target, \
5800 _(link.getCaption()))]
5801 else:
5802 url="%s%s"%(parentDir, link.getStaticURL())
5803 html = ["""<li id="menuLink_%s" class="menuConfTitle" nowrap><a class="confSection" href="%s"%s>%s</a></li>\n"""%(sublink.getName(), url, target, link.getCaption())]
5805 for sublink in sublinkList:
5806 target = ""
5807 if isinstance(link, displayMgr.ExternLink):
5808 target = " target=\"_blank\""
5809 if self._menu.isCurrentItem(sublink):
5810 url="%s%s"%(parentDir, sublink.getStaticURL())
5811 html.append("""<li id="menuLink_%s" class="menuConfSelected" nowrap><a href="%s"%s>\
5812 %s</a></li>\n"""\
5813 %(sublink.getName(), url, target, _(sublink.getCaption())))
5814 else:
5815 url="%s%s"%(parentDir, sublink.getStaticURL())
5816 html.append( """<li id="menuLink_%s" class="menuConfMiddleCell" nowrap><a class="confSubSection" href="%s"%s>\
5817 <img border="0" src="%s" alt="">&nbsp;%s</a></li>"""%(sublink.getName(), url, target,\
5818 params["bulletMenuConf"], _(sublink.getCaption()) ))
5819 return "".join(html)
5821 class WConfStaticDisplayFrame(wcomponents.WTemplated):
5823 def __init__(self, aw, conf, staticPars):
5824 self._aw = aw
5825 self._conf = conf
5826 self._staticPars = staticPars
5828 def getHTML( self, menu, body, params ):
5829 self._body = body
5830 self._menu = menu
5831 return wcomponents.WTemplated.getHTML( self, params )
5833 def _getMenuList(self, menuIds):
5834 l = []
5835 for id in menuIds:
5836 link = self._menu.getLinkByName(id)
5837 if link is not None:
5838 l.append(link)
5839 return l
5841 def getVars(self):
5842 vars = wcomponents.WTemplated.getVars( self )
5843 vars["logo"] = ""
5844 if self._conf.getLogo():
5845 vars["logo"] = "<img src=\"%s\" alt=\"%s\" border=\"0\" class=\"\" >"%(self._staticPars["logo"], self._conf.getTitle())
5846 vars["confTitle"] = self._conf.getTitle()
5847 tz = DisplayTZ(self._aw,self._conf).getDisplayTZ()
5848 adjusted_sDate = self._conf.getAdjustedStartDate(tz)
5849 adjusted_eDate = self._conf.getAdjustedEndDate(tz)
5850 vars["confDateInterval"] = i18nformat("""_("from") %s _("to") %s""")%(format_date(adjusted_sDate, format='long'), format_date(adjusted_eDate, format='long'))
5851 if adjusted_sDate.strftime("%d%B%Y") == \
5852 adjusted_eDate.strftime("%d%B%Y"):
5853 vars["confDateInterval"] = format_date(adjusted_sDate, format='long')
5854 elif adjusted_sDate.strftime("%B%Y") == adjusted_eDate.strftime("%B%Y"):
5855 vars["confDateInterval"] = "%s-%s %s"%(adjusted_sDate.day, adjusted_eDate.day, format_date(adjusted_sDate, format='MMMM yyyy'))
5856 vars["confLocation"] = ""
5857 if self._conf.getLocationList():
5858 vars["confLocation"] = self._conf.getLocationList()[0].getName()
5859 vars["body"] = self._body
5860 vars["supportEmail"] = ""
5861 if self._conf.getSupportInfo().hasEmail():
5862 mailto = quoteattr("""mailto:%s?subject=%s"""%(self._conf.getSupportInfo().getEmail(), urllib.quote( self._conf.getTitle() ) ))
5863 vars["supportEmail"] = i18nformat("""<a href=%s class="confSupportEmail"><img src="%s" border="0" alt="email"> _("support")</a>""")%(mailto, self._staticPars["smallEmail"] )
5864 p=self._staticPars
5865 p["supportEmail"] = vars["supportEmail"]
5866 menuList = self._getMenuList(["overview", "programme", "timetable", "contributionList", "authorIndex", "abstractsBook"])
5867 vars["menu"] = ConfStaticDisplayMenu( self._menu, menuList ).getHTML(p)
5868 format = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getFormat()
5869 vars["bgColorCode"] = format.getFormatOption("titleBgColor")["code"]
5870 vars["textColorCode"] = format.getFormatOption("titleTextColor")["code"]
5871 return vars
5873 class WPConferenceStaticDisplay( WPConferenceStaticDefaultDisplayBase ):
5875 def __init__(self, rh, target, staticPars):
5876 WPConferenceStaticDefaultDisplayBase.__init__(self, rh, target)
5877 self._staticPars = staticPars
5879 def _getBody( self, params ):
5880 wc = WConfStaticDetails( self._getAW(), self._conf, self._staticPars )
5881 return wc.getHTML({})
5883 def _defineSectionMenu( self ):
5884 WPConferenceStaticDefaultDisplayBase._defineSectionMenu(self)
5885 self._sectionMenu.setCurrentItem(self._overviewOpt)
5887 class WConfStaticProgramTrack(wcomponents.WTemplated):
5889 def __init__( self, aw, track, staticPars ):
5890 self._aw = aw
5891 self._track = track
5892 self._staticPars=staticPars
5894 def getVars( self ):
5895 vars = wcomponents.WTemplated.getVars( self )
5896 vars["bulletURL"] = self._staticPars["track_bullet"]
5897 vars["title"] = """%s """%(self._track.getTitle() )#"""<a href=%s>%s</a> """%(quoteattr(str(urlHandlers.UHStaticTrackContribList.getRelativeURL(self._track))), self._track.getTitle() )
5898 vars["description"] = self._track.getDescription()
5899 subtracks = []
5900 for subtrack in self._track.getSubTrackList():
5901 subtracks.append( "%s"%subtrack.getTitle() )
5902 vars["subtracks"] = ""
5903 if subtracks:
5904 vars["subtracks"] = i18nformat("""<i> _("Sub-tracks") </i>: %s""")%", ".join( subtracks )
5905 return vars
5907 class WConfStaticProgram(wcomponents.WTemplated):
5909 def __init__(self, aw, conf, staticPars):
5910 self._conf = conf
5911 self._aw = aw
5912 self._staticPars = staticPars
5914 def getVars( self ):
5915 vars = wcomponents.WTemplated.getVars( self )
5916 program = []
5917 for track in self._conf.getTrackList():
5918 program.append( WConfStaticProgramTrack( self._aw, track, self._staticPars ).getHTML() )
5919 vars["program"] = "".join( program )
5920 return vars
5922 class WPConferenceStaticProgram( WPConferenceStaticDefaultDisplayBase ):
5924 def __init__(self, rh, target, staticPars):
5925 WPConferenceStaticDefaultDisplayBase.__init__(self, rh, target)
5926 self._staticPars = staticPars
5928 def _getBody( self, params ):
5929 wc = WConfStaticProgram( self._getAW(), self._conf, self._staticPars )
5930 return wc.getHTML()
5932 def _defineSectionMenu( self ):
5933 WPConferenceStaticDefaultDisplayBase._defineSectionMenu( self )
5934 self._sectionMenu.setCurrentItem(self._programOpt)
5936 class WConfStaticAuthorIndex(wcomponents.WTemplated):
5938 def __init__(self,aw,conf, staticPars):
5939 self._aw=aw
5940 self._conf=conf
5941 self._staticPars=staticPars
5942 self._lastLetter = "-1"
5944 def _getMaterialHTML(self, contrib):
5945 lm=[]
5946 paper=contrib.getPaper()
5947 track=contrib.getTrack()
5948 trackFolder="./other_contributions"
5949 if track is not None:
5950 trackFolder=track.getTitle().replace(" ","_")
5951 for mat in contrib.getAllMaterialList():
5952 url="%s/%s"%(trackFolder, str(urlHandlers.UHStaticMaterialDisplay.getRelativeURL(mat)))
5953 lm.append("""<a href=%s><span style="font-style: italic;"><small> %s</small></span></a>"""%(
5954 quoteattr(url),
5955 self.htmlText(mat.getTitle().lower())))
5956 return ", ".join(lm)
5958 def _getLetterIndex(self):
5959 url=urlHandlers.UHStaticConfAuthorIndex.getRelativeURL()
5960 res=[]
5961 for letter in ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']:
5962 res.append("""<a href="%s#letter_%s">%s</a>"""%(str(url),letter, letter))
5963 return " | ".join(res)
5965 def _getItemHTML(self,pl):
5966 if len(pl)<=0:
5967 return ""
5968 auth=pl[0]
5969 authCaption="%s"%auth.getFamilyName().upper()
5970 htmlLetter = ""
5971 letter = "-1"
5972 if len(auth.getFamilyName()) > 0:
5973 letter = auth.getFamilyName()[0].lower()
5974 if self._lastLetter != letter:
5975 self._lastLetter = letter
5976 htmlLetter = """<a href="" name="letter_%s"></a>"""%letter
5977 if auth.getFirstName()!="":
5978 authCaption="%s, %s"%(authCaption,auth.getFirstName())
5979 if authCaption.strip()=="":
5980 return ""
5981 contribList=[]
5982 for auth in pl:
5983 contrib=auth.getContribution()
5984 url=urlHandlers.UHStaticContributionDisplay.getRelativeURL(contrib)
5985 material = self._getMaterialHTML(contrib)
5986 if material.strip()!="":
5987 material = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;( %s )"%material
5988 contribList.append("""<p style="text-indent: -3em;margin-left:3em"><a href=%s>%s-%s</a>%s</p>"""%(quoteattr(str(url)), self.htmlText(contrib.getId()),self.htmlText(contrib.getTitle()), material ))
5989 res="""
5990 <tr>
5991 <td valign="top">%s%s</td>
5992 <td width="100%%">%s</td>
5993 </tr>
5994 <tr>
5995 <td colspan="2" style="border-bottom: 1px solid; border-color: #EAEAEA">&nbsp;</td>
5996 </tr>"""%(htmlLetter, self.htmlText(authCaption),"".join(contribList))
5997 return res
5999 def getVars(self):
6000 vars=wcomponents.WTemplated.getVars(self)
6001 res=[]
6002 for partList in self._conf.getAuthorIndex().getParticipations():
6003 res.append(self._getItemHTML(partList))
6004 vars["letterIndex"] = self._getLetterIndex()
6005 vars["items"]="".join(res)
6006 return vars
6008 class WPStaticAuthorIndex(WPConferenceStaticDefaultDisplayBase):
6010 def __init__(self, rh, target, staticPars):
6011 WPConferenceStaticDefaultDisplayBase.__init__(self, rh, target)
6012 self._staticPars = staticPars
6014 def _getBody(self,params):
6015 wc=WConfStaticAuthorIndex(self._getAW(),self._conf,self._staticPars)
6016 return wc.getHTML()
6018 def _defineSectionMenu( self ):
6019 WPConferenceStaticDefaultDisplayBase._defineSectionMenu( self )
6020 self._sectionMenu.setCurrentItem(self._authorIndexOpt)
6022 class WConfStaticContributionList ( wcomponents.WTemplated ):
6024 def __init__( self, conf, trackDict ):
6025 self._conf = conf
6026 self._trackDict = trackDict
6028 def _getMaterialHTML(self, contrib):
6029 lm=[]
6030 paper=contrib.getPaper()
6031 track=contrib.getTrack()
6032 trackFolder="./other_contributions"
6033 if track is not None:
6034 trackFolder=track.getTitle().replace(" ","_")
6035 for mat in contrib.getAllMaterialList():
6036 url="%s/%s"%(trackFolder, str(urlHandlers.UHStaticMaterialDisplay.getRelativeURL(mat)))
6037 lm.append("""<a href=%s><span style="font-style: italic;"><small> %s</small></span></a>"""%(
6038 quoteattr(url),
6039 self.htmlText(mat.getTitle().lower())))
6040 return ", ".join(lm)
6042 def _getTrackHTML(self, track):
6043 return """
6044 <tr><td colspan="5">&nbsp;</td></tr>
6045 <tr>
6046 <td class="groupTitle" colspan="5" style="background:#E5E5E5; color:gray">%s</td>
6047 </tr>
6048 <tr><td colspan="5">&nbsp;</td></tr>
6049 """%(track.getTitle())
6051 def _getContribHTML( self, contrib ):
6052 sdate = ""
6053 if contrib.isScheduled():
6054 sdate=contrib.getAdjustedStartDate().strftime("%d-%b-%Y %H:%M" )
6055 title = """<a href=%s>%s</a>"""%( quoteattr( str( urlHandlers.UHStaticContributionDisplay.getRelativeURL( contrib ) ) ), self.htmlText( contrib.getTitle() ))
6056 contribType = ""
6057 if contrib.getType() is not None:
6058 contribType = contrib.getType().getName()
6059 l = []
6060 for spk in contrib.getSpeakerList():
6061 l.append( self.htmlText( spk.getFullName() ) )
6062 speaker = "<br>".join( l )
6063 session = ""
6064 if contrib.getSession() is not None:
6065 if contrib.getSession().getCode() != "no code":
6066 session=self.htmlText(contrib.getSession().getCode())
6067 else:
6068 session=self.htmlText(contrib.getSession().getTitle())
6069 track = ""
6070 if contrib.getTrack() is not None:
6071 track = self.htmlText( contrib.getTrack().getCode() )
6072 html = """
6073 <tr>
6074 <td class="abstractLeftDataCell">%s</td>
6075 <td class="abstractDataCell">%s</td>
6076 <td class="abstractDataCell">%s</td>
6077 <td class="abstractDataCell">%s</td>
6078 <td class="abstractDataCell">%s</td>
6079 </tr>
6080 """%(title or "&nbsp;", speaker or "&nbsp;",
6081 self._getMaterialHTML(contrib) or "&nbsp;",
6082 contribType or "&nbsp;",
6083 self.htmlText( contrib.getId() )
6085 return html
6087 def _cmpContribTitle(c1, c2):
6088 o1=c1.getTitle().lower().strip()
6089 o2=c2.getTitle().lower().strip()
6090 return cmp( o1, o2 )
6091 _cmpContribTitle=staticmethod(_cmpContribTitle)
6093 def getVars( self ):
6094 vars = wcomponents.WTemplated.getVars( self )
6096 l = []
6097 #for track in self._conf.getTrackList():
6098 # l.append(self._getTrackHTML(track))
6099 # for contrib in self._trackDict[track.getId()]:
6100 # l.append( self._getContribHTML( contrib ) )
6101 contList=self._conf.getContributionList()
6102 contList.sort(WConfStaticContributionList._cmpContribTitle)
6103 for contrib in contList:
6104 l.append( self._getContribHTML( contrib ) )
6105 vars["contributions"] = "".join(l)
6107 return vars
6109 class WPStaticContributionList( WPConferenceStaticDefaultDisplayBase ):
6111 def __init__(self, rh, target, staticPars, trackDict):
6112 WPConferenceStaticDefaultDisplayBase.__init__(self, rh, target)
6113 self._staticPars = staticPars
6114 self._trackDict = trackDict
6116 def _getBody( self, params ):
6117 wc = WConfStaticContributionList( self._conf, self._trackDict)
6118 return wc.getHTML()
6120 def _defineSectionMenu( self ):
6121 WPConferenceStaticDefaultDisplayBase._defineSectionMenu( self )
6122 self._sectionMenu.setCurrentItem(self._contribListOpt)
6124 class WPContributionStaticDisplay( WPConferenceStaticDefaultDisplayBase ):
6126 def __init__(self, rh, target, staticPars):
6127 WPConferenceStaticDefaultDisplayBase.__init__(self, rh, target.getConference())
6128 self._staticPars = staticPars
6129 self._contrib = target
6131 def _getBody( self, params ):
6132 wc=WContributionStaticDisplay( self._getAW(), self._contrib, self._staticPars )
6133 return wc.getHTML()
6135 def _defineSectionMenu( self ):
6136 WPConferenceStaticDefaultDisplayBase._defineSectionMenu( self )
6137 self._sectionMenu.setCurrentItem(self._contribListOpt)
6139 class WContributionStaticDisplay(wcomponents.WTemplated):
6141 def __init__(self, aw, contrib, staticPars):
6142 self._aw = aw
6143 self._contrib = contrib
6144 self._staticPars=staticPars
6146 def _getHTMLRow( self, title, body):
6147 if body.strip() == "":
6148 return ""
6149 str = """
6150 <tr>
6151 <td align="right" valign="top" class="displayField" nowrap><b>%s:</b></td>
6152 <td width="100%%">%s</td>
6153 </tr>"""%(title, body)
6154 return str
6156 def _getMaterialHTML(self):
6157 lm=[]
6158 paper=self._contrib.getPaper()
6159 if paper is not None:
6160 lm.append("""<a href=%s><img src=%s border="0" alt="paper"> %s</a>"""%(
6161 quoteattr(str(urlHandlers.UHStaticMaterialDisplay.getRelativeURL(paper))),
6162 quoteattr(str(self._staticPars["paper"])),
6163 self.htmlText(materialFactories.PaperFactory().getTitle())))
6164 slides=self._contrib.getSlides()
6165 if slides is not None:
6166 lm.append("""<a href=%s><img src=%s border="0" alt="slides"> %s</a>"""%(
6167 quoteattr(str(urlHandlers.UHStaticMaterialDisplay.getRelativeURL(slides))),
6168 quoteattr(str(self._staticPars["slides"])),
6169 self.htmlText(materialFactories.SlidesFactory().getTitle())))
6170 poster=self._contrib.getPoster()
6171 if poster is not None:
6172 lm.append("""<a href=%s><img src=%s border="0" alt="poster"> %s</a>"""%(
6173 quoteattr(str(urlHandlers.UHStaticMaterialDisplay.getRelativeURL(poster))),
6174 quoteattr(str(self._staticPars["poster"])),
6175 self.htmlText(materialFactories.PosterFactory().getTitle())))
6176 video=self._contrib.getVideo()
6177 if video is not None:
6178 lm.append("""<a href=%s><img src=%s border="0" alt="video"> %s</a>"""%(
6179 quoteattr(str(urlHandlers.UHStaticMaterialDisplay.getRelativeURL(video))),
6180 quoteattr(str(self._staticPars["video"])),
6181 self.htmlText(materialFactories.VideoFactory().getTitle())))
6182 iconURL=quoteattr(str(self._staticPars["material"]))
6183 minutes=self._contrib.getMinutes()
6184 if minutes is not None:
6185 lm.append("""<a href=%s><img src=%s border="0" alt="minutes"> %s</a>"""%(
6186 quoteattr(str(urlHandlers.UHStaticMaterialDisplay.getRelativeURL(minutes))),
6187 iconURL,
6188 self.htmlText(materialFactories.MinutesFactory().getTitle())))
6189 iconURL=quoteattr(str(self._staticPars["material"]))
6190 for material in self._contrib.getMaterialList():
6191 url=urlHandlers.UHStaticMaterialDisplay.getRelativeURL(material)
6192 lm.append("""<a href=%s><img src=%s border="0" alt=""> %s</a>"""%(
6193 quoteattr(str(url)),iconURL,self.htmlText(material.getTitle())))
6194 return self._getHTMLRow("Material","<br>".join(lm))
6196 def getVars( self ):
6197 vars = wcomponents.WTemplated.getVars( self )
6199 vars["title"] = self.htmlText(self._contrib.getTitle())
6200 vars["description"] = self._contrib.getDescription()
6201 vars["id"]=self.htmlText(self._contrib.getId())
6202 vars["startDate"] = i18nformat("""--_("not yet scheduled")--""")
6203 vars["startTime"] = ""
6204 if self._contrib.isScheduled():
6205 vars["startDate"]=self.htmlText(self._contrib.getAdjustedStartDate().strftime("%d-%b-%Y"))
6206 vars["startTime"]=self.htmlText(self._contrib.getAdjustedStartDate().strftime("%H:%M"))
6207 vars["location"]=""
6208 loc=self._contrib.getLocation()
6209 if loc is not None:
6210 vars["location"]="<i>%s</i>"%(self.htmlText(loc.getName()))
6211 if loc.getAddress() is not None and loc.getAddress()!="":
6212 vars["location"]="%s <pre>%s</pre>"%(vars["location"],loc.getAddress())
6213 room=self._contrib.getRoom()
6214 if room is not None:
6215 roomLink=linking.RoomLinker().getHTMLLink(room,loc)
6216 vars["location"]= i18nformat("""%s <small> _("Room"):</small> %s""")%(\
6217 vars["location"],roomLink)
6218 vars["location"]=self._getHTMLRow( _("Place"),vars["location"])
6219 l=[]
6220 for speaker in self._contrib.getSpeakerList():
6221 l.append(self.htmlText(speaker.getFullName()))
6222 vars["speakers"]=self._getHTMLRow( _("Presenters"),"<br>".join(l))
6224 pal = []
6225 for pa in self._contrib.getPrimaryAuthorList():
6226 authCaption="%s"%pa.getFullName()
6227 if pa.getAffiliation()!="":
6228 authCaption="%s (%s)"%(authCaption,pa.getAffiliation())
6229 pal.append(self.htmlText(authCaption))
6230 vars["primaryAuthors"]=self._getHTMLRow( _("Primary Authors"),"<br>".join(pal))
6231 cal = []
6232 for ca in self._contrib.getCoAuthorList():
6233 authCaption="%s"%ca.getFullName()
6234 if ca.getAffiliation()!="":
6235 authCaption="%s (%s)"%(authCaption,ca.getAffiliation())
6236 cal.append(self.htmlText(authCaption))
6237 vars["coAuthors"]=self._getHTMLRow( _("Co-Authors"),"<br>".join(cal))
6238 vars["contribType"]=""
6239 if self._contrib.getType() != None:
6240 vars["contribType"]=self._getHTMLRow( _("Contribution type"),self.htmlText(self._contrib.getType().getName()))
6241 vars["material"]=self._getMaterialHTML()
6242 vars["duration"]=""
6243 if self._contrib.getDuration() is not None:
6244 vars["duration"]=(datetime(1900,1,1)+self._contrib.getDuration()).strftime("%M'")
6245 if (datetime(1900,1,1)+self._contrib.getDuration()).hour>0:
6246 vars["duration"]=(datetime(1900,1,1)+self._contrib.getDuration()).strftime("%Hh%M'")
6247 vars["inTrack"]=""
6248 if self._contrib.getTrack():
6249 trackCaption=self._contrib.getTrack().getTitle()
6250 vars["inTrack"]="""%s"""%(self.htmlText(trackCaption))
6251 vars["inTrack"]=self._getHTMLRow( _("Included in track"),vars["inTrack"])
6252 return vars
6254 class WMaterialStaticDisplay(wcomponents.WTemplated):
6256 def __init__(self, aw, material, staticPars):
6257 self._material=material
6258 self._aw=aw
6259 self._staticPars = staticPars
6261 def getVars( self ):
6262 vars=wcomponents.WTemplated.getVars( self )
6263 if isinstance(self._material, conference.Paper):
6264 vars["icon"]=quoteattr(str(self._staticPars["paper"]))
6265 elif isinstance(self._material, conference.Slides):
6266 vars["icon"]=quoteattr(str(self._staticPars["slides"]))
6267 else:
6268 vars["icon"]=quoteattr(str(self._staticPars["material"]))
6269 vars["title"]=self._material.getTitle()
6270 vars["description"]=self._material.getDescription()
6271 rl = []
6272 for res in self._material.getResourceList():
6273 # TODO: remove the check "isinstance", it is only for CHEP04
6274 if isinstance(res ,conference.Link):# and not isinstance(self._material, conference.Video):
6275 rl.append("""<tr><td align="left">[LINK]</td><td width="100%%" align="left"><b>%s</b> <small>(<a href="%s">%s</a>)</small)</td></tr>"""%(res.getName(), res.getURL(), res.getURL()))
6276 else:
6277 rl.append("""
6278 <tr>
6279 <td align="left">&nbsp;</td>
6280 <td width="100%%" align="left"><b>%s</b> <small>(<a href="%s/%s">%s</a> %s)</small></td>
6281 </tr>"""%(res.getName(),
6282 vars["rootDir"], vars["fileAccessURLGen"](res),
6283 res.getFileName(),strfFileSize(res.getSize())))
6284 vars["resources"] = """
6285 <table border="0" width="100%%" align="left">
6287 </table>"""%"".join(rl)
6288 return vars
6291 class WPMaterialStaticDisplay( WPConferenceStaticDefaultDisplayBase ):
6293 def __init__(self, rh, material, staticPars):
6294 WPConferenceStaticDefaultDisplayBase.__init__(self, rh, material.getConference())
6295 self._material=material
6296 self._staticPars = staticPars
6298 def _getBody( self, params ):
6299 wc = WMaterialStaticDisplay( self._getAW(), self._material, self._staticPars )
6300 pars = {"rootDir":".", "fileAccessURLGen": urlHandlers.UHStaticResourceDisplay.getRelativeURL }
6301 return wc.getHTML( pars )
6303 class WTrackStaticContribList ( wcomponents.WTemplated ):
6305 def __init__( self, track, trackDict ):
6306 self._track = track
6307 self._conf = track.getConference()
6308 self._trackDict = trackDict
6310 def _getTrackHTML(self, track):
6311 return """
6312 <tr><td colspan="5">&nbsp;</td></tr>
6313 <tr>
6314 <td class="groupTitle" colspan="5" style="background:#E5E5E5; color:gray">%s</td>
6315 </tr>
6316 <tr><td colspan="5">&nbsp;</td></tr>
6317 """%(track.getTitle())
6319 def _getMaterialHTML(self, contrib):
6320 lm=[]
6321 paper=contrib.getPaper()
6322 track=contrib.getTrack()
6323 trackFolder="./other_contributions"
6324 if track is not None:
6325 trackFolder=track.getTitle().replace(" ","_")
6326 for mat in self._conf.getAllMaterialList():
6327 url="%s/%s"%(trackFolder, str(urlHandlers.UHStaticMaterialDisplay.getRelativeURL(mat)))
6328 lm.append("""<a href=%s><span style="font-style: italic;"><small> %s</small></span></a>"""%(
6329 quoteattr(url),
6330 self.htmlText(mat.getTitle().lower())))
6331 return ", ".join(lm)
6333 def _getContribHTML( self, contrib ):
6334 sdate = ""
6335 if contrib.isScheduled():
6336 sdate=contrib.getAdjustedStartDate().strftime("%d-%b-%Y %H:%M" )
6337 title = """<a href=%s>%s</a>"""%( quoteattr( str( urlHandlers.UHStaticContributionDisplay.getRelativeURL( contrib ) ) ), self.htmlText( contrib.getTitle() ))
6338 contribType = ""
6339 if contrib.getType() is not None:
6340 contribType = contrib.getType().getName()
6341 l = []
6342 for spk in contrib.getSpeakerList():
6343 l.append( self.htmlText( spk.getFullName() ) )
6344 speaker = "<br>".join( l )
6345 session = ""
6346 if contrib.getSession() is not None:
6347 if contrib.getSession().getCode() != "no code":
6348 session=self.htmlText(contrib.getSession().getCode())
6349 else:
6350 session=self.htmlText(contrib.getSession().getTitle())
6351 track = ""
6352 if contrib.getTrack() is not None:
6353 track = self.htmlText( contrib.getTrack().getCode() )
6354 html = """
6355 <tr>
6356 <td class="abstractLeftDataCell">%s</td>
6357 <td class="abstractDataCell">%s</td>
6358 <td class="abstractDataCell">%s</td>
6359 <td class="abstractDataCell">%s</td>
6360 <td class="abstractDataCell">%s</td>
6361 </tr>
6362 """%(title or "&nbsp;", speaker or "&nbsp;",
6363 self._getMaterialHTML(contrib) or "&nbsp;",
6364 contribType or "&nbsp;",
6365 self.htmlText( contrib.getId() )
6367 return html
6369 def getVars( self ):
6370 vars = wcomponents.WTemplated.getVars( self )
6372 l = []
6373 l.append(self._getTrackHTML(self._track))
6374 for contrib in self._trackDict[self._track.getId()]:
6375 l.append( self._getContribHTML( contrib ) )
6376 vars["contributions"] = "".join(l)
6378 return vars
6380 class WPTrackStaticContribList( WPConferenceStaticDefaultDisplayBase ):
6382 def __init__(self, rh, target, staticPars, trackDict):
6383 WPConferenceStaticDefaultDisplayBase.__init__(self, rh, target.getConference())
6384 self._staticPars = staticPars
6385 self._track = target
6386 self._trackDict = trackDict
6388 def _getBody( self, params ):
6389 wc = WTrackStaticContribList( self._track, self._trackDict)
6390 return wc.getHTML()
6392 def _defineSectionMenu( self ):
6393 WPConferenceStaticDefaultDisplayBase._defineSectionMenu( self )
6394 self._sectionMenu.setCurrentItem(self._programOpt)
6396 class WPStaticMeetingBase(WPConferenceStaticDefaultDisplayBase):
6398 def getRootDir(self, target):
6399 rootDir="."
6400 if not isinstance(target, conference.Conference):
6401 rootDir="%s/.."%rootDir
6402 owner=target.getOwner()
6403 while not isinstance(owner, conference.Conference):
6404 rootDir="%s/.."%rootDir
6405 owner=owner.getOwner()
6406 return rootDir
6408 def _getHTMLHeader( self ):
6409 path = Config.getInstance().getStylesheetsDir()
6410 # if a css file is associated with the XSL stylesheet, then we include it in the header
6411 styleText = """<link rel="stylesheet" href="%s/css/%s">
6412 <link rel="stylesheet" href="%s/css/events/common.css">""" % \
6413 (self.getRootDir(self._target), Config.getInstance().getCssStylesheetName(), self.getRootDir(self._target))
6414 try:
6415 if os.path.exists("%s.css" % (os.path.join(path,self._view))):
6416 styleText += """
6417 <style type="text/css">
6419 </style>""" % open("%s/%s.css" % (path,self._view),"r").read()
6420 except AttributeError, e:
6421 pass
6422 return """
6423 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
6424 <html>
6425 <head>
6426 <title>%s</title>
6427 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6428 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6429 <link rel="shortcut icon" href=%s>
6431 </head>
6432 <body>"""%(self._getTitle(),
6433 quoteattr(self._staticPars["addressBarIcon"]),
6434 styleText)
6436 def _getHeader( self ):
6439 wc = wcomponents.WStaticWebHeader()
6440 params = {}
6441 params["imgLogo"] = self._staticPars["miniLogo"]
6442 return wc.getHTML( params )
6444 def _applyConfDisplayDecoration( self, body ):
6445 return body
6448 class WPXSLMeetingStaticDisplay( WPStaticMeetingBase ):
6450 def __init__(self, rh, target, staticPars):
6451 WPStaticMeetingBase.__init__(self, rh, target.getConference())
6452 self._view = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(target.getConference()).getDefaultStyle()
6453 if self._view =="static":
6454 self._view="standard"
6455 self._type = "meeting"
6456 self._params={}
6457 self._params["showDate"] = "all"
6458 self._params["showSession"] = "all"
6459 self._params["detailLevel"] = "contribution"
6460 self._conf = self._target=target
6461 self._staticPars = staticPars
6463 def _getBody( self, params ):
6464 pars = { \
6465 "modifyURL": "", \
6466 "materialURL": "", \
6467 "cloneURL": "", \
6468 "sessionModifyURLGen": "", \
6469 "contribModifyURLGen": "", \
6470 "contribMaterialURLGen": "", \
6471 "subContribMaterialURLGen": "", \
6472 "sessionMaterialURLGen": "", \
6473 "subContribModifyURLGen": "", \
6474 "materialURLGen": urlHandlers.UHMStaticMaterialDisplay.getRelativeURL, \
6475 "resourceURLGen": urlHandlers.UHMStaticResourceDisplay.getRelativeURL}
6476 view = self._view
6477 from MaKaC.accessControl import AccessWrapper
6478 outGen = outputGenerator(AccessWrapper())
6479 path = Config.getInstance().getStylesheetsDir()
6480 stylepath = "%s.xsl" % (os.path.join(path, view))
6481 if os.path.exists(stylepath):
6482 if self._params.get("detailLevel", "") == "contribution" or self._params.get("detailLevel", "") == "":
6483 includeContribution = 1
6484 else:
6485 includeContribution = 0
6486 return outGen.getFormattedOutput(self._rh, self._conf, stylepath, pars, 1, includeContribution, 1, 1, self._params.get("showSession",""), self._params.get("showDate",""))
6487 else:
6488 return "Cannot find the %s stylesheet" % view
6490 class WPMMaterialStaticDisplay( WPStaticMeetingBase ):
6492 def __init__(self, rh, material, staticPars):
6493 WPStaticMeetingBase.__init__(self, rh, material.getConference())
6494 self._material=self._target=material
6495 self._staticPars = staticPars
6497 def _applyConfDisplayDecoration( self, body ):
6498 from MaKaC.webinterface.meeting import WMConfDisplayFrame
6499 frame = WMConfDisplayFrame( self._getAW(), self._conf )
6500 frameParams = {\
6501 "logoURL": urlHandlers.UHConferenceLogo.getURL( self._conf) }
6502 if self._conf.getLogo():
6503 frameParams["logoURL"] = urlHandlers.UHConferenceLogo.getURL( self._conf)
6505 confTitle = self._conf.getTitle()
6506 colspan=""
6507 imgOpen=""
6508 padding=""
6509 padding=""" style="padding:0px" """
6510 urlIndex=str(urlHandlers.UHStaticConferenceDisplay.getRelativeURL())
6511 urlIndex="%s/%s"%(self.getRootDir(self._material), urlIndex)
6512 body = i18nformat("""
6513 <div class="confBodyBox clearfix" %s %s>
6515 <table border="0" cellpadding="0" cellspacing="0"
6516 align="center" valign="top" width="95%%">
6517 <tr>
6518 <td class="formTitle" width="100%%"> _("Added Material") - %s</td>
6519 </tr>
6520 <tr>
6521 <td align="left" valign="middle" width="100%%">
6522 <b><br><a href=%s> _("Home")</a></b>
6523 </td>
6524 </tr>
6525 </table>
6526 <!--Main body-->
6528 </div>""")%(colspan,padding,imgOpen, confTitle,
6529 quoteattr(urlIndex),
6530 body)
6531 return frame.getHTML( body, frameParams)
6533 def _getBody( self, params ):
6534 wc = WMaterialStaticDisplay( self._getAW(), self._material, self._staticPars )
6535 pars = { "rootDir":self.getRootDir(self._material), "fileAccessURLGen": urlHandlers.UHMStaticResourceDisplay.getRelativeURL }
6536 return wc.getHTML( pars )
6539 class WConferenceStaticTimeTable(wcomponents.WTemplated):
6541 def __init__( self, timeTable, conference, aw ):
6542 self._aw = aw
6543 self._timeTable = timeTable
6544 self._conf = conference
6545 self._sessionColorMap = {}
6547 def _getRandomColor( self, color=1 ):
6548 if color==0:
6549 r=g=b = random.randint(130,255)
6550 else:
6551 r = random.randint(130,255)
6552 g = random.randint(130,255)
6553 b = random.randint(130,255)
6554 return "#%X%X%X"%(r,g,b)
6556 def _generateColor( self, color=1, colorMap={} ):
6558 This function generates a color which does not already exist in the passed colormap
6559 params:
6560 color: indicates whether the returned color should be gray-level or colored
6561 colormap: returned color must not be in this dict.
6563 color = self._getRandomColor(color)
6564 while(color in colorMap.values()):
6565 color = self._getRandomColor(color)
6566 return color
6568 def _getSessionColor( self, session ):
6569 if session.getId() not in self._sessionColorMap.keys():
6570 color = session.getColor()
6571 # if color=="#F0C060" and color in self._sessionColorMap.values():
6572 # color = self._generateColor(1,self._sessionColorMap)
6573 self._sessionColorMap[session.getId()] = color
6574 return self._sessionColorMap[session.getId()]
6576 def _getColor( self, entry ):
6577 bgcolor = "#E6E6E6"
6578 if isinstance(entry, schedule.LinkedTimeSchEntry) and \
6579 isinstance(entry.getOwner(), conference.SessionSlot):
6580 bgcolor = self._getSessionColor( entry.getOwner().getSession() )
6581 elif isinstance(entry, schedule.LinkedTimeSchEntry) and \
6582 isinstance(entry.getOwner(), conference.Contribution):
6583 contrib = entry.getOwner()
6584 if contrib.getSession():
6585 bgcolor = self._getSessionColor( contrib.getSession() )
6586 else:
6587 bgcolor = "#F6F6F6"
6588 elif isinstance(entry, schedule.BreakTimeSchEntry):
6589 owner = entry.getSchedule().getOwner()
6590 if isinstance(owner,conference.Session):
6591 bgcolor = self._getSessionColor( owner )
6592 else:
6593 bgcolor = "#90C0F0"
6594 if entry.getColor()!="":
6595 bgcolor=entry.getColor()
6596 return bgcolor
6598 def _getTextColor( self, entry ):
6599 textcolor = "#777777"
6600 if isinstance(entry, schedule.LinkedTimeSchEntry) and \
6601 isinstance(entry.getOwner(), conference.SessionSlot):
6602 textcolor = entry.getOwner().getSession().getTextColor()
6603 elif isinstance(entry, schedule.LinkedTimeSchEntry) and \
6604 isinstance(entry.getOwner(), conference.Contribution):
6605 contrib = entry.getOwner()
6606 if contrib.getSession():
6607 textcolor = contrib.getSession().getTextColor()
6608 elif isinstance(entry, schedule.BreakTimeSchEntry):
6609 owner = entry.getSchedule().getOwner()
6610 if isinstance(owner,conference.Session):
6611 textcolor = owner.getTextColor()
6612 else:
6613 if entry.getTextColor()!="":
6614 textcolor=entry.getTextColor()
6615 return textcolor
6617 def _getContributionHTML( self, contribution, URL ):
6618 room = ""
6619 if contribution.getRoom() != None:
6620 room = "%s: "%contribution.getRoom().getName()
6621 speakerList = []
6622 for spk in contribution.getSpeakerList():
6623 spkcapt=spk.getFullName()
6624 if spk.getAffiliation().strip() != "":
6625 spkcapt="%s (%s)"%(spkcapt, spk.getAffiliation())
6626 speakerList.append(spkcapt)
6627 speakers =""
6628 if speakerList != []:
6629 speakers = "<br><small>by %s</small>"%"; ".join(speakerList)
6630 linkColor=""
6631 if contribution.getSession() is not None:
6632 if contribution.getSession().isTextColorToLinks():
6633 linkColor="color:%s"%contribution.getSession().getTextColor()
6634 return """<table width="100%%">
6635 <tr>
6636 <td width="100%%" align="center" style="%s">
6637 [%s] <a href="%s" style="%s">%s</a>%s<br><small>(%s%s - %s)</small>
6638 </td>
6639 </tr>
6640 </table>"""%(linkColor, self.htmlText(contribution.getId()),URL, linkColor,
6641 self.htmlText(contribution.getTitle()),
6642 speakers, room,
6643 contribution.getAdjustedStartDate().strftime("%H:%M"),
6644 contribution.getAdjustedEndDate().strftime("%H:%M") )
6646 def _getSessionHTML( self, session, URL, refDay ):
6647 room = ""
6648 if session.getRoom() != None:
6649 room = "%s: "%session.getRoom().getName()
6650 #################################
6651 # Fermi timezone awareness #
6652 #################################
6653 sDate = session.getAdjustedStartDate()
6654 eDate = session.getAdjustedEndDate()
6655 timeInterval = "<br>(%s%s - %s)"%(room, \
6656 sDate.strftime("%H:%M"), \
6657 eDate.strftime("%H:%M") )
6658 if session.getAdjustedStartDate().strftime("%d%B%Y") != \
6659 refDay.getDate().strftime("%d%B%Y") :
6660 if session.getAdjustedEndDate().strftime("%d%B%Y") != \
6661 refDay.getDate().strftime("%d%B%Y") :
6662 timeInterval = ""
6663 else:
6664 timeInterval = i18nformat("""<br>(%s_("until") %s)""")%(room, eDate.strftime("%H:%M"))
6665 else:
6666 if session.getAdjustedEndDate().strftime("%d%B%Y") != \
6667 refDay.getDate().strftime("%d%B%Y") :
6668 timeInterval = i18nformat("""<br>(%s_("from") %s)""")%(room, sDate.strftime("%H:%M"))
6670 #################################
6671 # Fermi timezone awareness(end) #
6672 #################################
6673 conveners=""
6674 l=[]
6675 for conv in session.getConvenerList():
6676 l.append("""%s"""%(self.htmlText(conv.getDirectFullName())))
6677 if len(l)>0:
6678 conveners= i18nformat("""<br><small> _("Conveners"): %s</small>""")%"; ".join(l)
6679 title = self.htmlText(session.getSession().getTitle())
6680 if session.getTitle().strip() != "":
6681 title = "%s: %s"%(title, session.getTitle())
6682 linkColor=""
6683 if session.getSession().isTextColorToLinks():
6684 linkColor="color:%s"%session.getSession().getTextColor()
6685 return """<a href="%s" style="%s">%s</a>%s<small>%s</small>"""%(URL, linkColor,\
6686 title, conveners, timeInterval )
6688 def _getBreakHTML( self, breakEntry ):
6689 room = ""
6690 if breakEntry.getRoom() != None:
6691 room = "%s: "%breakEntry.getRoom().getName()
6693 ################################
6694 # Fermi timezone awareness #
6695 ################################
6696 sDate = breakEntry.getAdjustedStartDate()
6697 eDate = breakEntry.getAdjustedEndDate()
6698 return """<b>%s</b><br><small>(%s%s - %s)</small>"""%( breakEntry.getTitle(),\
6699 room, \
6700 sDate.strftime("%H:%M"),\
6701 eDate.strftime("%H:%M") )
6702 ################################
6703 # Fermi timezone awareness(end) #
6704 ################################
6706 def _getEntryHTML(self,entry,refDay):
6707 if isinstance(entry,schedule.LinkedTimeSchEntry):
6708 if isinstance(entry.getOwner(),conference.SessionSlot):
6709 return self._getSessionHTML(entry.getOwner(),self._sessionURLGen(entry.getOwner().getSession()),refDay)
6710 if isinstance(entry.getOwner(), conference.Contribution):
6711 return self._getContributionHTML(entry.getOwner(), \
6712 self._contribURLGen(entry.getOwner()))
6713 elif isinstance(entry,schedule.BreakTimeSchEntry):
6714 return self._getBreakHTML(entry)
6716 def _getColorLegendItemHTML( self, color, descrip ):
6717 str = """ <span height="10px" width="20px" style="background:%s; border:1px solid black;font-size: 10px;">&nbsp;&nbsp;</span>
6718 <span align="left" style="font-size: 10px;">%s</span>
6719 """%(color, descrip)
6720 return str
6722 def _getColorLegendHTML( self ):
6723 html = """<table bgcolor="white" cellpadding="0" cellspacing="1" width="100%%" style="padding:3px; border-top:1px solid #E6E6E6;border-bottom:1px solid #E6E6E6;">
6724 <tr>
6725 <td bgcolor="white" width="100%%" align="center">
6726 &nbsp;
6728 </td>
6729 </tr>
6730 </table>
6732 l = []
6733 l.append( self._getColorLegendItemHTML( "#90C0F0", _("Conference break")) )
6734 l.append( self._getColorLegendItemHTML( "#F6F6F6", _("Conference contribution")) )
6735 for sessionId in self._sessionColorMap.keys():
6736 session = self._conf.getSessionById( sessionId )
6737 str = self._getColorLegendItemHTML(\
6738 self._sessionColorMap[ sessionId ],\
6739 i18nformat(""" _("Session"): <i>%s </i>""")%session.getTitle())
6740 l.append( str )
6741 return html%" - ".join( l )
6743 def _getHTMLTimeTable( self, highDetailLevel=0 ):
6744 self._sessionColorMap = {}
6745 daySch = []
6746 num_slots_in_hour=int(timedelta(hours=1).seconds/self._timeTable.getSlotLength().seconds)
6747 for day in self._timeTable.getDayList():
6748 self._sessionColorMap.clear()
6749 emptyDay=True
6750 slotList=[]
6751 lastEntries=[]
6752 maxOverlap=day.getNumMaxOverlaping()
6753 width="100"
6754 if maxOverlap!=0:
6755 width=100/maxOverlap
6756 else:
6757 maxOverlap=1
6758 for hour in range(day.getStartHour(),day.getEndHour()+1):
6759 hourSlots=[]
6760 emptyHour = True
6761 for slot in day.getSlotsOnHour(hour):
6762 remColSpan=maxOverlap
6763 temp=[]
6764 entryList=slot.getEntryList()
6765 entryList.sort(timetable.sortEntries)
6766 for entry in entryList:
6767 emptyHour = False
6768 emptyDay = False
6769 if len(slot.getEntryList()):
6770 remColSpan=0
6771 else:
6772 remColSpan-=1
6773 if entry in lastEntries:
6774 continue
6775 bgcolor=self._getColor(entry)
6776 textcolor=self._getTextColor(entry)
6777 colspan=""
6778 if not day.hasEntryOverlaps(entry):
6779 colspan=""" colspan="%s" """%maxOverlap
6780 temp.append("""<td valign="top" rowspan="%i" align="center" bgcolor="%s" width="%i%%"%s><font color="%s">%s</font></td>"""%(day.getNumSlots(entry),bgcolor, width, colspan, textcolor, self._getEntryHTML(entry,day)))
6781 lastEntries.append(entry)
6782 if remColSpan>0:
6783 temp.append("""<td width="100%%" colspan="%i"></td>"""%(remColSpan))
6784 if slot.getAdjustedStartDate().minute==0:
6785 hourSlots.append("""
6786 <tr>
6787 <td valign="top" rowspan="%s" bgcolor="white" width="10" style="padding-right: 5px;"><font color="gray" size="-1">%02i:00</font></td>
6789 </tr>
6790 """%(num_slots_in_hour,\
6791 hour,\
6792 "".join(temp)))
6793 else:
6794 if len(temp) == 0:
6795 temp = ["<td></td>"]
6796 hourSlots.append("""<tr>%s</tr>"""%"".join(temp))
6797 if emptyHour:
6798 slotList.append("""
6799 <tr>
6800 <td valign="top" bgcolor="white" width="10" style="padding-right: 5px;"><font color="gray" size="-1">%02i:00</font></td>
6801 <td>&nbsp;</td>
6802 </tr>""" % hour)
6803 else:
6804 slotList.append("".join(hourSlots))
6805 legend=""
6806 if highDetailLevel:
6807 legend=self._getColorLegendHTML()
6808 if not emptyDay:
6809 str="""
6810 <table align="center" width="100%%">
6811 <tr>
6812 <td width="100%%">
6813 <table align="center" border="0" width="100%%"
6814 celspacing="0" cellpadding="0" bgcolor="#E6E6E6">
6815 <tr>
6816 <td colspan="%i" align="center" bgcolor="white"><b>%s</b></td>
6817 </tr>
6818 <tr>
6819 <td colspan="%i">%s</td>
6820 </tr>
6822 </table>
6823 </td>
6824 </tr>
6825 </table>
6826 """%(maxOverlap+2,\
6827 format_date(day.getDate(), format='full'), \
6828 maxOverlap+2, legend, \
6829 "".join(slotList) )
6830 daySch.append(str)
6831 str = "<br>".join( daySch )
6832 return str
6834 def getVars( self ):
6835 vars = wcomponents.WTemplated.getVars( self )
6836 self._contribURLGen = vars["contribURLGen"]
6837 self._sessionURLGen = vars["sessionURLGen"]
6838 vars["timetable"] = self._getHTMLTimeTable(vars.get("detailLevel", "") == "contribution")
6839 return vars
6843 class WPConferenceStaticTimeTable( WPConferenceStaticDefaultDisplayBase ):
6845 def __init__(self, rh, target, staticPars):
6846 WPConferenceStaticDefaultDisplayBase.__init__(self, rh, target)
6847 self._staticPars = staticPars
6849 def _getEntryList(self):
6850 lsessions = self._conf.getSchedule().getEntries()
6851 res = []
6852 for entry in lsessions:
6853 if isinstance(entry,schedule.LinkedTimeSchEntry):
6854 owner = entry.getOwner()
6855 if isinstance(owner, conference.SessionSlot):
6856 if owner.canAccess(self._getAW()):
6857 res.append( entry )
6858 elif owner.canView(self._getAW()):
6859 if isinstance(owner,conference.SessionSlot):
6860 slot=owner
6861 for slotEntry in slot.getSchedule().getEntries():
6862 if isinstance(slotEntry.getOwner(),conference.Contribution):
6863 if slotEntry.getOwner().canAccess(self._getAW()):
6864 res.append(slotEntry)
6865 else:
6866 if owner.canAccess(self._getAW()):
6867 res.append( entry )
6868 else:
6869 res.append( entry )
6870 return res
6872 def _getParallelTimeTable( self, params ):
6873 tz = DisplayTZ(self._getAW(),self._conf).getDisplayTZ()
6874 tt = timetable.TimeTable( self._conf.getSchedule(), tz )
6875 #####################################
6876 # Fermi timezone awareness #
6877 #####################################
6878 sDate = self._conf.getSchedule().getStartDate(tz)
6879 eDate = self._conf.getSchedule().getEndDate(tz)
6880 #####################################
6881 # Fermi timezone awareness(end) #
6882 #####################################
6883 tt.setStartDate( sDate )
6884 tt.setEndDate( eDate )
6885 tt.mapEntryList(self._getEntryList())
6886 return tt
6888 def _getBody( self, params ):
6889 tt = self._getParallelTimeTable( params )
6890 wc = WConferenceStaticTimeTable( tt, self._conf, self._getAW() )
6891 pars = {"contribURLGen": urlHandlers.UHStaticContributionDisplay.getRelativeURL, \
6892 "sessionURLGen": urlHandlers.UHStaticSessionDisplay.getRelativeURL }
6893 return wc.getHTML( pars )
6895 def _defineSectionMenu( self ):
6896 WPConferenceStaticDefaultDisplayBase._defineSectionMenu( self )
6897 self._sectionMenu.setCurrentItem(self._timetableOpt)
6899 class WSessionStaticDisplay(wcomponents.WTemplated):
6901 def __init__(self,aw,session):
6902 self._aw=aw
6903 self._session=session
6905 def _getHTMLRow(self,title,body):
6906 str = """
6907 <tr>
6908 <td nowrap class="displayField" valign="top"><b>%s:</b></td>
6909 <td>%s</td>
6910 </tr>"""%(title,body)
6911 if body.strip() == "":
6912 return ""
6913 return str
6915 def _getColor(self,entry):
6916 bgcolor = "white"
6917 if isinstance(entry,schedule.LinkedTimeSchEntry):
6918 if isinstance(entry.getOwner(),conference.Contribution):
6919 bgcolor = entry.getOwner().getSession().getColor()
6920 elif isinstance(entry,schedule.BreakTimeSchEntry):
6921 bgcolor = entry.getColor()
6922 return bgcolor
6924 def _getContributionHTML(self,contrib):
6925 URL=urlHandlers.UHStaticContributionDisplay.getRelativeURL(contrib, "..")
6926 room = ""
6927 if contrib.getRoom() != None:
6928 room = "%s: "%contrib.getRoom().getName()
6929 speakerList = []
6930 for spk in contrib.getSpeakerList():
6931 speakerList.append(spk.getDirectFullName())
6932 speakers =""
6933 if speakerList != []:
6934 speakers = i18nformat("""<br><small> _("by") %s</small>""")%"; ".join(speakerList)
6935 linkColor=""
6936 if contrib.getSession().isTextColorToLinks():
6937 linkColor="color:%s"%contrib.getSession().getTextColor()
6938 return """<table width="100%%">
6939 <tr>
6940 <td width="100%%" align="center" style="color:%s">
6941 [%s] <a href="%s" style="%s">%s</a>%s<br><small>(%s%s - %s)</small>
6942 </td>
6943 </tr>
6944 </table>"""%(
6945 contrib.getSession().getTextColor(),contrib.getId(),URL,\
6946 linkColor, contrib.getTitle(),speakers,room,
6947 contrib.getAdjustedStartDate().strftime("%H:%M"),
6948 contrib.getAdjustedEndDate().strftime("%H:%M") )
6950 def _getBreakHTML(self,breakEntry):
6951 return """
6952 <font color="%s">%s<br><small>(%s - %s)</small></font>
6953 """%(\
6954 breakEntry.getTextColor(),\
6955 self.htmlText(breakEntry.getTitle()),\
6956 self.htmlText(breakEntry.getAdjustedStartDate().strftime("%H:%M")),\
6957 self.htmlText(breakEntry.getAdjustedEndDate().strftime("%H:%M")))
6959 def _getSchEntries(self):
6960 res=[]
6961 for slot in self._session.getSlotList():
6962 for entry in slot.getSchedule().getEntries():
6963 res.append(entry)
6964 return res
6966 def _getEntryHTML(self,entry):
6967 if isinstance(entry,schedule.LinkedTimeSchEntry):
6968 if isinstance(entry.getOwner(),conference.Contribution):
6969 return self._getContributionHTML(entry.getOwner())
6970 elif isinstance(entry,schedule.BreakTimeSchEntry):
6971 return self._getBreakHTML(entry)
6973 def _getTimeTableHTML(self):
6974 tz = DisplayTZ(self._aw,self._session.getConference()).getDisplayTZ()
6975 timeTable=timetable.TimeTable(self._session.getSchedule(), tz)
6976 sDate,eDate=self._session.getAdjustedStartDate(tz),self._session.getAdjustedEndDate(tz)
6977 timeTable.setStartDate(sDate)
6978 timeTable.setEndDate(eDate)
6979 timeTable.mapEntryList(self._getSchEntries())
6980 daySch = []
6981 num_slots_in_hour=int(timedelta(hours=1).seconds/timeTable.getSlotLength().seconds)
6982 hourSlots,hourNeedsDisplay=[],False
6983 for day in timeTable.getDayList():
6984 slotList=[]
6985 lastEntries=[]
6986 maxOverlap=day.getNumMaxOverlaping()
6987 width="100"
6988 if maxOverlap!=0:
6989 width=100/maxOverlap
6990 else:
6991 maxOverlap=1
6992 for slot in day.getSlotList():
6993 if slot.getAdjustedStartDate().minute==0:
6994 if hourNeedsDisplay:
6995 slotList.append("".join(hourSlots))
6996 hourSlots,hourNeedsDisplay=[],False
6997 remColSpan=maxOverlap
6998 temp=[]
6999 for entry in slot.getEntryList():
7000 hourNeedsDisplay=True
7001 if len(slot.getEntryList()):
7002 remColSpan=0
7003 else:
7004 remColSpan-=1
7005 if entry in lastEntries:
7006 continue
7007 bgcolor=self._getColor(entry)
7008 colspan=""
7009 if not day.hasEntryOverlaps(entry):
7010 colspan=""" colspan="%s" """%maxOverlap
7011 temp.append("""<td valign="top" rowspan="%i" align="center" bgcolor="%s" width="%i%%"%s>%s</td>"""%(day.getNumSlots(entry),bgcolor,width,colspan,self._getEntryHTML(entry)))
7012 lastEntries.append(entry)
7013 if remColSpan>0:
7014 temp.append("""<td width="100%%" colspan="%i"></td>"""%(remColSpan))
7015 if slot.getAdjustedStartDate().minute==0:
7016 str="""
7017 <tr>
7018 <td valign="top" rowspan="%s" bgcolor="white" width="40"><font color="gray" size="-1">%s</font></td>
7020 </tr>
7021 """%(num_slots_in_hour,\
7022 slot.getAdjustedStartDate().strftime("%H:%M"),\
7023 "".join(temp))
7024 else:
7025 if len(temp) == 0:
7026 temp = ["<td></td>"]
7027 str = """<tr>%s</tr>"""%"".join(temp)
7028 hourSlots.append(str)
7029 str="""
7030 <a name="%s">
7031 <table align="center" width="100%%">
7032 <tr>
7033 <td width="100%%">
7034 <table align="center" border="0" width="100%%"
7035 celspacing="0" cellpadding="0" bgcolor="#E6E6E6">
7036 <tr>
7037 <td colspan="%i" align="center" bgcolor="white"><b>%s</b></td>
7038 </tr>
7040 </table>
7041 </td>
7042 </tr>
7043 </table>
7044 """%(day.getDate().strftime("%Y-%m-%d"),maxOverlap+2,
7045 format_date(day.getDate(), format='full'),
7046 "".join(slotList) )
7047 daySch.append(str)
7048 str = "<br>".join( daySch )
7049 return str
7051 def getVars(self):
7052 vars=wcomponents.WTemplated.getVars( self )
7054 vars["title"]=self.htmlText(self._session.getTitle())
7056 if self._session.getDescription():
7057 desc = self._session.getDescription().strip()
7058 else:
7059 desc = ""
7061 if desc!="":
7062 vars["description"]="""
7063 <tr>
7064 <td colspan="2">%s</td>
7065 </tr>
7066 """%desc
7067 else:
7068 vars["description"] = ""
7070 #################################
7071 # Fermi timezone awareness #
7072 #################################
7073 sDate=self._session.getAdjustedStartDate()
7074 eDate=self._session.getAdjustedEndDate()
7075 if sDate.strftime("%d%b%Y")==eDate.strftime("%d%b%Y"):
7076 vars["dateInterval"]=format_datetime(sDate, format='EEEE d MMMM yyyy H:mm')
7077 else:
7078 vars["dateInterval"]=i18nformat("""_("from") %s _("to") %s""")%(
7079 format_datetime(sDate, format='EEEE d MMMM yyyy H:mm'),
7080 format_datetime(eDate, format='EEEE d MMMM yyyy H:mm'))
7081 #################################
7082 # Fermi timezone awareness(end) #
7083 #################################
7085 vars["location"]=""
7086 loc=self._session.getLocation()
7087 if loc is not None and loc.getName().strip()!="":
7088 vars["location"]="""<i>%s</i>"""%self.htmlText(loc.getName())
7089 if loc.getAddress().strip()!="":
7090 vars["location"]="""%s<pre>%s</pre>"""%(vars["location"],
7091 loc.getAddress())
7092 room = self._session.getRoom()
7093 if room is not None:
7094 roomLink=linking.RoomLinker().getHTMLLink(room,loc)
7095 vars["location"]= i18nformat("""%s<br><small> _("Room"):</small> %s""")%(vars["location"],
7096 roomLink)
7097 vars["location"]=self._getHTMLRow("Place", vars["location"])
7099 sessionConvs=[]
7100 for convener in self._session.getConvenerList():
7101 sessionConvs.append("""<a href="mailto:%s">%s</a>"""%(convener.getEmail(),
7102 self.htmlText(convener.getFullName())))
7103 slotConvsHTML=""
7104 for entry in self._session.getSchedule().getEntries():
7105 slot=entry.getOwner()
7106 l=[]
7107 for convener in slot.getOwnConvenerList():
7108 l.append("""<a href="mailto:%s">%s</a>"""%(convener.getEmail(),
7109 self.htmlText(convener.getFullName())))
7110 if len(l)>0:
7111 slotConvsHTML+="""
7112 <tr>
7113 <td valign="top">%s (<small>%s-%s</small>):</td>
7114 <td>%s</td>
7115 </tr>
7116 """%(self.htmlText(slot.getTitle()),
7117 slot.getAdjustedStartDate().strftime("%d-%b-%y %H:%M"),
7118 slot.getAdjustedEndDate().strftime("%d-%b-%y %H:%M"),
7119 "; ".join(l))
7120 convs=""
7121 if len(sessionConvs)>0 or slotConvsHTML.strip()!="":
7122 convs="""
7123 <table>
7124 <tr>
7125 <td valign="top" colspan="2">%s</td>
7126 </tr>
7128 </table>"""%("<br>".join(sessionConvs),slotConvsHTML)
7129 vars["conveners"]=self._getHTMLRow( _("Conveners"),convs)
7130 lm = []
7131 for material in self._session.getAllMaterialList():
7132 url=urlHandlers.UHStaticMaterialDisplay.getRelativeURL(material)
7133 lm.append(wcomponents.WMaterialDisplayItem().getHTML(self._aw,material,url))
7134 vars["material"] = self._getHTMLRow( _("Material"), "<br>".join( lm ) )
7135 vars["contribs"]= ""
7136 if self._session.getContributionList() != []:
7137 vars["contribs"]=self._getTimeTableHTML()
7138 return vars
7141 class WPSessionStaticDisplay(WPConferenceStaticDefaultDisplayBase):
7143 def __init__(self, rh, target, staticPars):
7144 WPConferenceStaticDefaultDisplayBase.__init__(self, rh, target.getConference())
7145 self._session = target
7146 self._staticPars = staticPars
7148 def _defineSectionMenu(self):
7149 WPConferenceStaticDefaultDisplayBase._defineSectionMenu(self)
7150 self._sectionMenu.setCurrentItem(self._timetableOpt)
7152 def _getBody(self,params):
7153 wc = WSessionStaticDisplay(self._getAW(), self._session)
7154 return wc.getHTML()
7156 #------------------------ End Static ---------------------------------------------------------------
7159 class WDVDDone(wcomponents.WTemplated):
7161 def getVars(self):
7162 vars = wcomponents.WTemplated.getVars(self)
7163 vars["supportAddr"] = Config.getInstance().getSupportEmail()
7164 return vars
7167 class WPDVDDone(WPConfModifToolsBase):
7169 def _setActiveTab(self):
7170 self._tabOfflineSite.setActive()
7172 def _getTabContent(self, params):
7173 w = WDVDDone()
7174 p = {}
7175 p["url"] = quoteattr(str(params.get("url")))
7176 return w.getHTML(p)
7179 class WPConfModifDVDCreationConfirm(WPConfModifToolsBase):
7181 def _setActiveTab(self):
7182 self._tabOfflineSite.setActive()
7184 def _getTabContent(self, params):
7185 wc = wcomponents.WConfirmation()
7186 msg = """<br>Please confirm that you want to create an "Offline Website" for your event<br>
7187 <font color="red">(note if you confirm you cannot stop the creation of the website )</font><br>"""
7188 url = urlHandlers.UHConfDVDCreation.getURL(self._conf)
7189 return wc.getHTML(msg, url, {})
7192 class WTimeTableCustomizePDF(wcomponents.WTemplated):
7194 def __init__(self, conf):
7195 self._conf = conf
7197 def getVars(self):
7198 vars = wcomponents.WTemplated.getVars(self)
7199 url = urlHandlers.UHConfTimeTablePDF.getURL(self._conf)
7200 vars["getPDFURL"] = quoteattr(str(url))
7201 vars["showDays"] = vars.get("showDays", "all")
7202 vars["showSessions"] = vars.get("showSessions", "all")
7204 wc = WConfCommonPDFOptions(self._conf)
7205 vars["commonPDFOptions"] = wc.getHTML()
7207 return vars
7210 class WPTimeTableCustomizePDF(WPConferenceDefaultDisplayBase):
7211 navigationEntry = navigation.NETimeTableCustomizePDF
7213 def _getBody(self, params):
7214 wc = WTimeTableCustomizePDF(self._conf)
7215 return wc.getHTML(params)
7217 def _defineSectionMenu(self):
7218 WPConferenceDefaultDisplayBase._defineSectionMenu(self)
7219 self._sectionMenu.setCurrentItem(self._timetableOpt)
7222 class WConfModifPendingQueuesList(wcomponents.WTemplated):
7224 def __init__(self, url, title, target, list, pType):
7225 self._postURL = url
7226 self._title = title
7227 self._target = target
7228 self._list = list
7229 self._pType = pType
7231 def _cmpByConfName(self, cp1, cp2):
7232 if cp1 is None and cp2 is not None:
7233 return -1
7234 elif cp1 is not None and cp2 is None:
7235 return 1
7236 elif cp1 is None and cp2 is None:
7237 return 0
7238 return cmp(cp1.getTitle(), cp2.getTitle())
7240 def _cmpByContribName(self, cp1, cp2):
7241 if cp1 is None and cp2 is not None:
7242 return -1
7243 elif cp1 is not None and cp2 is None:
7244 return 1
7245 elif cp1 is None and cp2 is None:
7246 return 0
7247 return cmp(cp1.getContribution().getTitle(), cp2.getContribution().getTitle())
7249 def _cmpBySessionName(self, cp1, cp2):
7250 if cp1 is None and cp2 is not None:
7251 return -1
7252 elif cp1 is not None and cp2 is None:
7253 return 1
7254 elif cp1 is None and cp2 is None:
7255 return 0
7256 return cmp(cp1.getSession().getTitle(), cp2.getSession().getTitle())
7258 def getVars(self):
7259 vars = wcomponents.WTemplated.getVars(self)
7261 vars["postURL"] = self._postURL
7262 vars["title"] = self._title
7263 vars["target"] = self._target
7264 vars["list"] = self._list
7265 vars["pType"] = self._pType
7267 return vars
7270 class WConfModifPendingQueues(wcomponents.WTemplated):
7272 def __init__(self, conf, aw, activeTab="submitters"):
7273 self._conf = conf
7274 self._aw = aw
7275 self._activeTab = activeTab
7276 self._pendingConfSubmitters = self._conf.getPendingQueuesMgr().getPendingConfSubmitters()
7277 self._pendingSubmitters = self._conf.getPendingQueuesMgr().getPendingSubmitters()
7278 self._pendingManagers = self._conf.getPendingQueuesMgr().getPendingManagers()
7279 self._pendingCoordinators = self._conf.getPendingQueuesMgr().getPendingCoordinators()
7281 def _createTabCtrl(self):
7282 self._tabCtrl = wcomponents.TabControl()
7283 url = urlHandlers.UHConfModifPendingQueues.getURL(self._conf)
7284 url.addParam("tab", "conf_submitters")
7285 self._tabConfSubmitters = self._tabCtrl.newTab("conf_submitters", \
7286 _("Pending Conference Submitters"),str(url))
7287 url.addParam("tab", "submitters")
7288 self._tabSubmitters = self._tabCtrl.newTab("submitters", \
7289 _("Pending Contribution Submitters"),str(url))
7290 url.addParam("tab", "managers")
7291 self._tabManagers = self._tabCtrl.newTab("managers", \
7292 _("Pending Managers"),str(url))
7293 url.addParam("tab", "coordinators")
7294 self._tabCoordinators = self._tabCtrl.newTab("coordinators", \
7295 _("Pending Coordinators"),str(url))
7296 self._tabSubmitters.setEnabled(True)
7297 tab = self._tabCtrl.getTabById(self._activeTab)
7298 if tab is None:
7299 tab = self._tabCtrl.getTabById("conf_submitters")
7300 tab.setActive()
7302 def getVars(self):
7303 vars = wcomponents.WTemplated.getVars(self)
7304 self._createTabCtrl()
7305 list = []
7306 url = ""
7307 title = ""
7309 if self._tabConfSubmitters.isActive():
7310 # Pending conference submitters
7311 keys = self._conf.getPendingQueuesMgr().getPendingConfSubmittersKeys(True)
7313 url = urlHandlers.UHConfModifPendingQueuesActionConfSubm.getURL(self._conf)
7314 url.addParam("tab","conf_submitters")
7315 title = _("Pending chairpersons/speakers to become submitters")
7316 target = _("Conference")
7317 pType = "ConfSubmitters"
7319 for key in keys:
7320 list.append((key, self._pendingConfSubmitters[key][:]))
7322 if self._tabSubmitters.isActive():
7323 # Pending submitters
7324 keys = self._conf.getPendingQueuesMgr().getPendingSubmittersKeys(True)
7326 url = urlHandlers.UHConfModifPendingQueuesActionSubm.getURL(self._conf)
7327 url.addParam("tab", "submitters")
7328 title = _("Pending authors/speakers to become submitters")
7329 target = _("Contribution")
7330 pType = "Submitters"
7332 for key in keys:
7333 list.append((key, self._pendingSubmitters[key][:]))
7335 elif self._tabManagers.isActive():
7336 # Pending managers
7337 keys = self._conf.getPendingQueuesMgr().getPendingManagersKeys(True)
7339 url = urlHandlers.UHConfModifPendingQueuesActionMgr.getURL(self._conf)
7340 url.addParam("tab", "managers")
7341 title = _("Pending conveners to become managers")
7342 target = _("Session")
7343 pType = "Managers"
7345 for key in keys:
7346 list.append((key, self._pendingManagers[key][:]))
7347 #list.sort(conference.SessionChair._cmpFamilyName)
7349 elif self._tabCoordinators.isActive():
7350 # Pending coordinators
7351 keys = self._conf.getPendingQueuesMgr().getPendingCoordinatorsKeys(True)
7353 url = urlHandlers.UHConfModifPendingQueuesActionCoord.getURL(self._conf)
7354 url.addParam("tab", "coordinators")
7355 title = _("Pending conveners to become coordinators")
7356 target = _("Session")
7357 pType = "Coordinators"
7359 for key in keys:
7360 list.append((key, self._pendingCoordinators[key][:]))
7361 list.sort(conference.ConferenceParticipation._cmpFamilyName)
7363 html = WConfModifPendingQueuesList(str(url), title, target, list, pType).getHTML()
7364 vars["pendingQueue"] = wcomponents.WTabControl(self._tabCtrl, self._aw).getHTML(html)
7365 vars["backURL"] = quoteattr(str(urlHandlers.UHConfModifListings.getURL(self._conf)))
7367 return vars
7370 class WPConfModifPendingQueuesBase(WPConfModifListings):
7372 def __init__(self, rh, conf, activeTab=""):
7373 WPConfModifListings.__init__(self, rh, conf)
7374 self._activeTab = activeTab
7376 def _getTabContent(self, params):
7377 banner = wcomponents.WListingsBannerModif(self._conf, _("Pending queues")).getHTML()
7378 return banner + self._getTabContent(params)
7380 def _setActiveSideMenuItem(self):
7381 self._listingsMenuItem.setActive(True)
7384 class WPConfModifPendingQueues(WPConfModifPendingQueuesBase):
7386 def _getTabContent(self, params):
7387 wc = WConfModifPendingQueues(self._conf, self._getAW(), self._activeTab)
7388 return wc.getHTML()
7390 class WPConfModifPendingQueuesRemoveConfSubmConfirm(WPConfModifPendingQueuesBase):
7392 def __init__(self, rh, conf, pendingConfSubms):
7393 WPConfModifPendingQueuesBase.__init__(self, rh, conf)
7394 self._pendingConfSubms = pendingConfSubms
7396 def _getTabContent(self,params):
7397 wc = wcomponents.WConfirmation()
7398 psubs = ''.join(list("<li>{0}</li>".format(s) for s in self._pendingConfSubms))
7400 msg = {'challenge': _("Are you sure you want to delete the following users pending to become submitters?"),
7401 'target': "<ul>{0}</ul>".format(psubs),
7402 'subtext': _("Please note that they will still remain as user"),
7405 url = urlHandlers.UHConfModifPendingQueuesActionConfSubm.getURL(self._conf)
7406 return wc.getHTML(msg,url,{"pendingSubmitters":self._pendingConfSubms, "remove": _("remove")})
7408 class WPConfModifPendingQueuesRemoveSubmConfirm(WPConfModifPendingQueuesBase):
7410 def __init__(self, rh, conf, pendingSubms):
7411 WPConfModifPendingQueuesBase.__init__(self, rh, conf)
7412 self._pendingSubms = pendingSubms
7414 def _getTabContent(self, params):
7415 wc = wcomponents.WConfirmation()
7416 psubs = ''.join(list("<li>{0}</li>".format(s) for s in self._pendingSubms))
7418 msg = {'challenge': _("Are you sure you want to delete the following participants pending to become submitters?"),
7419 'target': "<ul>{0}</ul>".format(psubs),
7420 'subtext': _("Please note that they will still remain as participants"),
7423 url = urlHandlers.UHConfModifPendingQueuesActionSubm.getURL(self._conf)
7424 return wc.getHTML(msg, url, {"pendingSubmitters": self._pendingSubms, "remove": _("remove")})
7426 class WPConfModifPendingQueuesReminderConfSubmConfirm(WPConfModifPendingQueuesBase):
7428 def __init__(self, rh, conf, pendingConfSubms):
7429 WPConfModifPendingQueuesBase.__init__(self, rh, conf)
7430 self._pendingConfSubms = pendingConfSubms
7432 def _getTabContent(self,params):
7433 wc = wcomponents.WConfirmation()
7434 psubs = ''.join(list("<li>{0}</li>".format(s) for s in self._pendingConfSubms))
7436 msg = {'challenge': _("Are you sure that you want to send these users an email with a reminder to create an account in Indico?"),
7437 'target': "<ul>{0}</ul>".format(psubs)
7439 url = urlHandlers.UHConfModifPendingQueuesActionConfSubm.getURL(self._conf)
7440 return wc.getHTML(
7441 msg,
7442 url, {
7443 "pendingSubmitters": self._pendingConfSubms,
7444 "reminder": _("reminder")
7446 severity='accept')
7448 class WPConfModifPendingQueuesReminderSubmConfirm( WPConfModifPendingQueuesBase ):
7450 def __init__(self,rh, conf, pendingSubms):
7451 WPConfModifPendingQueuesBase.__init__(self,rh,conf)
7452 self._pendingSubms = pendingSubms
7454 def _getTabContent(self,params):
7455 wc = wcomponents.WConfirmation()
7457 psubs = ''.join(list("<li>{0}</li>".format(s) for s in self._pendingSubms))
7459 msg = {'challenge': _("Are you sure that you want to send these users an email with a reminder to create an account in Indico?"),
7460 'target': "<ul>{0}</ul>".format(psubs)
7463 url = urlHandlers.UHConfModifPendingQueuesActionSubm.getURL(self._conf)
7464 return wc.getHTML(
7465 msg,
7466 url, {
7467 "pendingSubmitters": self._pendingSubms,
7468 "reminder": _("reminder")
7470 severity='accept')
7472 class WPConfModifPendingQueuesRemoveMgrConfirm( WPConfModifPendingQueuesBase ):
7474 def __init__(self,rh, conf, pendingMgrs):
7475 WPConfModifPendingQueuesBase.__init__(self,rh,conf)
7476 self._pendingMgrs = pendingMgrs
7478 def _getTabContent(self,params):
7479 wc = wcomponents.WConfirmation()
7481 pmgrs = ''.join(list("<li>{0}</li>".format(s) for s in self._pendingMgrs))
7483 msg = {'challenge': _("Are you sure you want to delete the following conveners pending to become managers?"),
7484 'target': "<ul>{0}</ul>".format(pmgrs),
7485 'subtext': _("Please note that they will still remain as conveners")
7488 url = urlHandlers.UHConfModifPendingQueuesActionMgr.getURL(self._conf)
7489 return wc.getHTML(msg,url,{"pendingManagers":self._pendingMgrs, "remove": _("remove")})
7491 class WPConfModifPendingQueuesReminderMgrConfirm( WPConfModifPendingQueuesBase ):
7493 def __init__(self,rh, conf, pendingMgrs):
7494 WPConfModifPendingQueuesBase.__init__(self,rh,conf)
7495 self._pendingMgrs = pendingMgrs
7497 def _getTabContent(self,params):
7498 wc = wcomponents.WConfirmation()
7500 pmgrs = ''.join(list("<li>{0}</li>".format(s) for s in self._pendingMgrs))
7502 msg = {'challenge': _("Are you sure that you want to send these users an email with a reminder to create an account in Indico?"),
7503 'target': "<ul>{0}</ul>".format(pmgrs)
7506 url = urlHandlers.UHConfModifPendingQueuesActionMgr.getURL(self._conf)
7507 return wc.getHTML(msg,url,{"pendingManagers":self._pendingMgrs, "reminder": _("reminder")})
7509 class WPConfModifPendingQueuesRemoveCoordConfirm( WPConfModifPendingQueuesBase ):
7511 def __init__(self,rh, conf, pendingCoords):
7512 WPConfModifPendingQueuesBase.__init__(self,rh,conf)
7513 self._pendingCoords = pendingCoords
7515 def _getTabContent(self,params):
7516 wc = wcomponents.WConfirmation()
7518 pcoords = ''.join(list("<li>{0}</li>".format(s) for s in self._pendingMgrs))
7520 msg = {'challenge': _("Are you sure you want to delete the following conveners pending to become coordinators?"),
7521 'target': "<ul>{0}</ul>".format(pcoords),
7522 'subtext': _("Please note that they will still remain as conveners")
7525 url = urlHandlers.UHConfModifPendingQueuesActionCoord.getURL(self._conf)
7526 return wc.getHTML(msg, url,{
7527 "pendingCoordinators": self._pendingCoords,
7528 "remove": _("remove")
7531 class WPConfModifPendingQueuesReminderCoordConfirm( WPConfModifPendingQueuesBase ):
7533 def __init__(self,rh, conf, pendingCoords):
7534 WPConfModifPendingQueuesBase.__init__(self,rh,conf)
7535 self._pendingCoords = pendingCoords
7537 def _getTabContent(self,params):
7538 wc = wcomponents.WConfirmation()
7540 pcoords = ''.join(list("<li>{0}</li>".format(s) for s in self._pendingMgrs))
7542 msg = {'challenge': _("Are you sure that you want to send these users an email with a reminder to create an account in Indico?"),
7543 'target': "<ul>{0}</ul>".format(pcoords)
7546 url = urlHandlers.UHConfModifPendingQueuesActionCoord.getURL(self._conf)
7547 return wc.getHTML(
7548 msg, url, {
7549 "pendingCoordinators": self._pendingCoords,
7550 "reminder": _("reminder")
7553 class WAbstractBookCustomise(wcomponents.WTemplated):
7555 def __init__(self, conf):
7556 self._conf = conf
7558 def getVars( self ):
7559 vars = wcomponents.WTemplated.getVars( self )
7560 url=urlHandlers.UHConfAbstractBookPerform.getURL(self._conf)
7561 vars["getPDFURL"]=quoteattr(str(url))
7562 return vars
7564 class WPAbstractBookCustomise( WPConferenceDefaultDisplayBase ):
7565 navigationEntry = navigation.NEAbstractBookCustomise
7567 def _getBody( self, params ):
7568 wc = WAbstractBookCustomise( self._conf )
7569 return wc.getHTML(params)
7571 def _defineSectionMenu( self ):
7572 WPConferenceDefaultDisplayBase._defineSectionMenu( self )
7573 self._sectionMenu.setCurrentItem(self._abstractsBookOpt)
7575 ##################################################################################3
7577 class WPMeetingStaticDisplay( WPConferenceStaticDefaultDisplayBase ):
7579 def __init__(self, rh, target, staticPars):
7580 WPConferenceStaticDefaultDisplayBase.__init__(self, rh, target)
7581 self._staticPars = staticPars
7583 def _getBody( self, params ):
7584 wc = WMeetingStaticDetails( self._getAW(), self._conf, self._staticPars )
7585 return wc.getHTML({})
7587 def _defineSectionMenu( self ):
7588 WPConferenceStaticDefaultDisplayBase._defineSectionMenu(self)
7589 self._sectionMenu.setCurrentItem(self._overviewOpt)
7592 class WPMeetiStaticProgram( WPConferenceStaticDefaultDisplayBase ):
7594 def __init__(self, rh, target, staticPars):
7595 WPConferenceStaticDefaultDisplayBase.__init__(self, rh, target)
7596 self._staticPars = staticPars
7598 def _getBody( self, params ):
7599 wc = WConfStaticProgram( self._getAW(), self._conf, self._staticPars )
7600 return wc.getHTML()
7602 def _defineSectionMenu( self ):
7603 WPConferenceStaticDefaultDisplayBase._defineSectionMenu( self )
7604 self._sectionMenu.setCurrentItem(self._programOpt)
7607 class WMConfStaticDetails( wcomponents.WTemplated ):
7609 def __init__(self, aw, conf, staticPars):
7610 self._conf = conf
7611 self._aw = aw
7612 self._staticPars = staticPars
7614 def _getChairsHTML( self ):
7615 chairList = []
7616 l = []
7617 for chair in self._conf.getChairList():
7618 mailToURL = """mailto:%s"""%urllib.quote(chair.getEmail())
7619 l.append( """<a href=%s>%s</a>"""%(quoteattr(mailToURL),self.htmlText(chair.getFullName())))
7620 res = ""
7621 if len(l) > 0:
7622 res = i18nformat("""
7623 <tr>
7624 <td align="right" valign="top" class="displayField"><b> _("Chairs"):</b></td>
7625 <td>%s</td>
7626 </tr>
7627 """)%"<br>".join(l)
7628 return res
7630 def _getMaterialHTML( self ):
7631 l = []
7632 for mat in self._conf.getAllMaterialList():
7633 temp = wcomponents.WMaterialDisplayItem()
7634 url = urlHandlers.UHStaticMaterialDisplay.getRelativeURL(mat)
7635 l.append( temp.getHTML( self._aw, mat, url, self._staticPars["material"] ) )
7636 res = ""
7637 if l:
7638 res = i18nformat("""
7639 <tr>
7640 <td align="right" valign="top" class="displayField"><b> _("Material"):</b></td>
7641 <td align="left" width="100%%">%s</td>
7642 </tr>""")%"<br>".join( l )
7643 return res
7645 def _getMoreInfoHTML( self ):
7646 res = ""
7647 if self._conf.getContactInfo() != "":
7648 res = i18nformat("""
7649 <tr>
7650 <td align="right" valign="top" class="displayField"><b> _("Additional info"):</b>
7651 </td>
7652 <td>%s</td>
7653 </tr>""")%self._conf.getContactInfo()
7654 return res
7656 def _getActionsHTML( self, showActions = False):
7657 html=[]
7658 if showActions:
7659 html=[ i18nformat("""
7660 <table style="padding-top:40px; padding-left:20px">
7661 <tr>
7662 <td nowrap>
7663 <b> _("Conference sections"):</b>
7664 <ul>
7665 """)]
7666 menu = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu()
7667 for link in menu.getLinkList():
7668 if link.isVisible() and link.isEnabled():
7669 html.append(""" <li><a href="%s">%s</a></li>
7670 """%( link.getURL(), link.getCaption() ) )
7671 html.append("""
7672 </ul>
7673 </td>
7674 </tr>
7675 </table>
7676 """)
7677 return "".join(html)
7679 def getVars( self ):
7680 vars = wcomponents.WTemplated.getVars( self )
7681 vars["description"] = self._conf.getDescription()
7682 sdate, edate = self._conf.getAdjustedStartDate(), self._conf.getAdjustedEndDate()
7683 fsdate, fedate = format_date(sdate, format='long'), format_date(edate, format='long')
7684 fstime, fetime = sdate.strftime("%H:%M"), edate.strftime("%H:%M")
7685 vars["dateInterval"] = i18nformat("""_("from") %s %s _("to") %s %s""")%(fsdate, fstime, \
7686 fedate, fetime)
7687 if sdate.strftime("%d%B%Y") == edate.strftime("%d%B%Y"):
7688 timeInterval = fstime
7689 if sdate.strftime("%H%M") != edate.strftime("%H%M"):
7690 timeInterval = "%s-%s"%(fstime, fetime)
7691 vars["dateInterval"] = "%s (%s)"%( fsdate, timeInterval)
7692 vars["location"] = ""
7693 location = self._conf.getLocation()
7694 if location:
7695 vars["location"] = "<i>%s</i><br><pre>%s</pre>"%( location.getName(), location.getAddress() )
7696 room = self._conf.getRoom()
7697 if room:
7698 roomLink = linking.RoomLinker().getHTMLLink( room, location )
7699 vars["location"] += i18nformat("""<small> _("Room"):</small> %s""")%roomLink
7700 vars["chairs"] = self._getChairsHTML()
7701 vars["material"] = self._getMaterialHTML()
7702 vars["moreInfo"] = self._getMoreInfoHTML()
7703 vars["actions"] = self._getActionsHTML(vars.get("menuStatus", "open") != "open")
7705 return vars
7707 class WConfStaticProgram(wcomponents.WTemplated):
7709 def __init__(self, aw, conf, staticPars):
7710 self._conf = conf
7711 self._aw = aw
7712 self._staticPars = staticPars
7714 def getVars( self ):
7715 vars = wcomponents.WTemplated.getVars( self )
7716 program = []
7717 for track in self._conf.getTrackList():
7718 program.append( WConfStaticProgramTrack( self._aw, track, self._staticPars ).getHTML() )
7719 vars["program"] = "".join( program )
7720 return vars
7722 class WConfModifReschedule(wcomponents.WTemplated):
7724 def __init__(self, targetDay):
7725 self._targetDay = targetDay
7727 def getVars(self):
7728 vars = wcomponents.WTemplated.getVars(self)
7729 vars["targetDay"]=quoteattr(str(self._targetDay))
7730 return vars
7732 class WPConfModifReschedule(WPConferenceModifBase):
7734 def __init__(self, rh, conf, targetDay):
7735 WPConferenceModifBase.__init__(self, rh, conf)
7736 self._targetDay=targetDay
7738 def _getPageContent( self, params):
7739 wc=WConfModifReschedule(self._targetDay)
7740 p={"postURL":quoteattr(str(urlHandlers.UHConfModifReschedule.getURL(self._conf)))}
7741 return wc.getHTML(p)
7743 class WPConfModifRelocate(WPConferenceModifBase):
7745 def __init__(self, rh, conf, entry, targetDay):
7746 WPConferenceModifBase.__init__(self, rh, conf)
7747 self._targetDay=targetDay
7748 self._entry=entry
7750 def _getPageContent( self, params):
7751 wc=wcomponents.WSchRelocate(self._entry)
7752 p={"postURL":quoteattr(str(urlHandlers.UHConfModifScheduleRelocate.getURL(self._entry))), \
7753 "targetDay":quoteattr(str(self._targetDay))}
7754 return wc.getHTML(p)
7756 class WPConfModifExistingMaterials( WPConferenceModifBase ):
7758 _userData = ['favorite-user-list', 'favorite-user-ids']
7760 def __init__(self, rh, conf):
7761 WPConferenceModifBase.__init__(self, rh, conf)
7763 def _getPageContent( self, pars ):
7764 wc=wcomponents.WShowExistingMaterial(self._conf)
7765 return wc.getHTML( pars )
7767 def _setActiveTab( self ):
7768 self._tabMaterials.setActive()
7770 def _setActiveSideMenuItem( self ):
7771 self._materialMenuItem.setActive()
7773 class WPConfModifDisplayImageBrowser (wcomponents.WTemplated):
7775 def __init__(self, conf, req):
7776 self._conf = conf
7777 self._req = req
7779 def _getFileHTML(self, file):
7780 return """<td>&nbsp;<a href="#" onClick="OpenFile('%s');return false;"><img src="%s" height="80"></a></td>""" % (str(urlHandlers.UHFileAccess.getURL(file)),str(urlHandlers.UHFileAccess.getURL(file)))
7782 def getVars(self):
7783 vars = wcomponents.WTemplated.getVars( self )
7784 vars["baseURL"] = Config.getInstance().getBaseURL()
7785 vars["body"] = ""
7786 materialName = _("Internal Page Files")
7787 mats = self._conf.getMaterialList()
7788 mat = None
7789 existingFiles = []
7790 for m in mats:
7791 if m.getTitle() == materialName:
7792 mat = m
7793 if mat != None:
7794 existingFiles = mat.getResourceList()
7795 if len(existingFiles) == 0:
7796 vars["body"] = i18nformat("""<br><br>&nbsp;&nbsp;&nbsp; _("no image found")...""")
7797 else:
7798 vars["body"] += "<table><tr>"
7799 for file in existingFiles:
7800 vars["body"] += self._getFileHTML(file)
7801 vars["body"] += "</tr></table>"
7802 return vars
7805 class WPDisplayFullMaterialPackage(WPConferenceDefaultDisplayBase):
7807 def _getBody(self, params):
7808 wc = WFullMaterialPackage(self._conf)
7809 p = {"getPkgURL": urlHandlers.UHConferenceDisplayMaterialPackagePerform.getURL(self._conf)}
7810 return wc.getHTML(p)
7813 # ============================================================================
7814 # === Room booking related ===================================================
7815 # ============================================================================
7817 #from MaKaC.webinterface.pages.roomBooking import WPRoomBookingBase0
7818 class WPConfModifRoomBookingBase( WPConferenceModifBase ):
7820 def getJSFiles(self):
7821 return WPConferenceModifBase.getJSFiles(self) + \
7822 self._includeJSPackage('RoomBooking')
7824 def _getHeadContent( self ):
7826 !!!! WARNING
7827 If you update the following, you will need to do
7828 the same update in:
7829 roomBooking.py / WPRoomBookingBase0 AND
7830 conferences.py / WPConfModifRoomBookingBase
7832 For complex reasons, these two inheritance chains
7833 should not have common root, so this duplication is
7834 necessary evil. (In general, one chain is for standalone
7835 room booking and second is for conference-context room
7836 booking.)
7838 baseurl = self._getBaseURL()
7839 return """
7840 <!-- Our libs -->
7841 <script type="text/javascript" src="%s/js/indico/Legacy/validation.js?%d"></script>
7843 """ % (baseurl, os.stat(__file__).st_mtime)
7845 def _setActiveSideMenuItem(self):
7846 self._roomBookingMenuItem.setActive()
7848 def _createTabCtrl(self):
7849 self._tabCtrl = wcomponents.TabControl()
7851 self._tabExistBookings = self._tabCtrl.newTab( "existing", "Existing Bookings", \
7852 urlHandlers.UHConfModifRoomBookingList.getURL( self._conf ) )
7853 self._tabNewBooking = self._tabCtrl.newTab( "new", "New Booking", \
7854 urlHandlers.UHConfModifRoomBookingChooseEvent.getURL( self._conf ) )
7856 self._setActiveTab()
7858 def _getPageContent(self, params):
7859 self._createTabCtrl()
7860 return wcomponents.WTabControl( self._tabCtrl, self._getAW() ).getHTML( self._getTabContent( params ) )
7862 def _getTabContent(self, params):
7863 return "nothing"
7866 # 0. Choosing an "event" (conference / session / contribution)...
7868 class WPConfModifRoomBookingChooseEvent( WPConfModifRoomBookingBase ):
7870 def __init__( self, rh ):
7871 self._rh = rh
7872 WPConfModifRoomBookingBase.__init__( self, rh, rh._conf )
7874 def _getTabContent( self, params ):
7875 wc = wcomponents.WRoomBookingChooseEvent( self._rh )
7876 return wc.getHTML( params )
7878 def _setActiveTab( self ):
7879 self._tabNewBooking.setActive()
7881 # 1. Searching...
7883 class WPConfModifRoomBookingSearch4Rooms( WPConfModifRoomBookingBase ):
7885 def __init__( self, rh ):
7886 self._rh = rh
7887 WPConfModifRoomBookingBase.__init__( self, rh, rh._conf )
7890 def _getTabContent( self, params ):
7891 wc = wcomponents.WRoomBookingSearch4Rooms( self._rh )
7892 return wc.getHTML( params )
7894 def _setActiveTab( self ):
7895 self._tabNewBooking.setActive()
7897 # 2. List of...
7899 class WPConfModifRoomBookingRoomList( WPConfModifRoomBookingBase ):
7901 def __init__( self, rh ):
7902 self._rh = rh
7903 WPConfModifRoomBookingBase.__init__( self, rh, self._rh._conf )
7905 def _setActiveTab( self ):
7906 self._tabNewBooking.setActive()
7908 def _getTabContent( self, params ):
7909 wc = wcomponents.WRoomBookingRoomList( self._rh )
7910 return wc.getHTML( params )
7914 class WPConfModifRoomBookingList( WPConfModifRoomBookingBase ):
7916 def __init__( self, rh ):
7917 WPConfModifRoomBookingBase.__init__( self, rh, rh._conf )
7919 def _setActiveTab( self ):
7920 self._tabExistBookings.setActive()
7922 def _getTabContent( self, pars ):
7923 wc = wcomponents.WRoomBookingList( self._rh )
7924 return wc.getHTML( pars )
7927 # 3. Details of...
7929 class WPConfModifRoomBookingRoomDetails( WPConfModifRoomBookingBase ):
7931 def __init__( self, rh ):
7932 self._rh = rh
7933 WPConfModifRoomBookingBase.__init__( self, rh, rh._conf )
7935 def _setActiveTab( self ):
7936 self._tabNewBooking.setActive()
7938 def _getTabContent( self, params ):
7939 wc = wcomponents.WRoomBookingRoomDetails( self._rh )
7940 return wc.getHTML( params )
7942 class WPConfModifRoomBookingDetails( WPConfModifRoomBookingBase ):
7944 def __init__( self, rh ):
7945 self._rh = rh
7946 WPConfModifRoomBookingBase.__init__( self, rh, rh._conf )
7948 def _setActiveTab( self ):
7949 self._tabExistBookings.setActive()
7951 def _getTabContent( self, params ):
7952 wc = wcomponents.WRoomBookingDetails( self._rh, self._rh._conf )
7953 return wc.getHTML( params )
7955 # 4. New booking
7957 class WPConfModifRoomBookingBookingForm( WPConfModifRoomBookingBase ):
7959 def __init__( self, rh ):
7960 self._rh = rh
7961 WPConfModifRoomBookingBase.__init__( self, rh, rh._conf )
7963 def _setActiveTab( self ):
7964 self._tabNewBooking.setActive()
7966 def _getTabContent( self, params ):
7967 wc = wcomponents.WRoomBookingBookingForm( self._rh )
7968 return wc.getHTML( params )
7970 class WPConfModifRoomBookingConfirmBooking( WPConfModifRoomBookingBase ):
7972 def __init__( self, rh ):
7973 self._rh = rh
7974 WPConfModifRoomBookingBase.__init__( self, rh, rh._conf)
7976 def _setActiveTab( self ):
7977 self._tabNewBooking.setActive()
7979 def _getTabContent( self, params ):
7980 wc = wcomponents.WRoomBookingConfirmBooking( self._rh, standalone = False )
7981 return wc.getHTML( params )
7983 # ============================================================================
7984 # === Badges related =========================================================
7985 # ============================================================================
7987 ##------------------------------------------------------------------------------------------------------------
7989 Badge Printing classes
7991 class WConfModifBadgePrinting(wcomponents.WTemplated):
7992 """ This class corresponds to the screen where badge templates are
7993 listed and can be created, edited, deleted, and tried.
7996 def __init__(self, conference, user=None):
7997 self.__conf = conference
7998 self._user = user
8000 def _getBaseTemplateOptions(self):
8001 dconf = conference.CategoryManager().getDefaultConference()
8002 templates = dconf.getBadgeTemplateManager().getTemplates()
8004 options = [{'value': 'blank', 'label': _('Blank Page')}]
8006 for id, template in templates.iteritems():
8007 options.append({'value': id, 'label': template.getName()})
8009 return options
8011 def getVars(self):
8012 uh = urlHandlers
8013 templates = []
8014 sortedTemplates = self.__conf.getBadgeTemplateManager().getTemplates().items()
8015 sortedTemplates.sort(lambda x, y: cmp(x[1].getName(), y[1].getName()))
8017 for templateId, template in sortedTemplates:
8019 data = {
8020 'id': templateId,
8021 'name': template.getName(),
8022 'urlEdit': str(uh.UHConfModifBadgeDesign.getURL(self.__conf, templateId)),
8023 'urlDelete': str(uh.UHConfModifBadgePrinting.getURL(self.__conf, deleteTemplateId=templateId)),
8024 'urlCopy': str(uh.UHConfModifBadgePrinting.getURL(self.__conf, copyTemplateId=templateId))
8027 templates.append(data)
8029 wcPDFOptions = WConfModifBadgePDFOptions(self.__conf)
8030 vars = wcomponents.WTemplated.getVars(self)
8031 vars['NewTemplateURL'] = str(uh.UHConfModifBadgeDesign.getURL(self.__conf,
8032 self.__conf.getBadgeTemplateManager().getNewTemplateId(),new = True))
8033 vars['CreatePDFURL'] = str(uh.UHConfModifBadgePrintingPDF.getURL(self.__conf))
8034 vars['templateList'] = templates
8035 vars['PDFOptions'] = wcPDFOptions.getHTML()
8036 vars['baseTemplates'] = self._getBaseTemplateOptions()
8038 return vars
8041 class WConfModifBadgePDFOptions(wcomponents.WTemplated):
8043 def __init__(self, conference, showKeepValues=True, showTip=True):
8044 self.__conf = conference
8045 self.__showKeepValues = showKeepValues
8046 self.__showTip = showTip
8048 def getVars(self):
8049 vars = wcomponents.WTemplated.getVars(self)
8051 pagesizeNames = PDFSizes().PDFpagesizes.keys()
8052 pagesizeNames.sort()
8053 vars['PagesizeNames'] = pagesizeNames
8054 vars['PDFOptions'] = self.__conf.getBadgeTemplateManager().getPDFOptions()
8055 vars['ShowKeepValues'] = self.__showKeepValues
8056 vars['ShowTip'] = self.__showTip
8058 return vars
8061 class WPBadgeBase(WPConfModifToolsBase):
8063 def getCSSFiles(self):
8064 return WPConfModifToolsBase.getCSSFiles(self) + self._asset_env['indico_badges_css'].urls()
8066 def getJSFiles(self):
8067 return WPConfModifToolsBase.getJSFiles(self) + self._includeJSPackage('badges_js')
8070 class WPConfModifBadgePrinting(WPBadgeBase):
8072 def _setActiveTab(self):
8073 self._tabBadges.setActive()
8075 def _getTabContent(self, params):
8076 wc = WConfModifBadgePrinting(self._conf)
8077 return wc.getHTML()
8081 ##------------------------------------------------------------------------------------------------------------
8083 Badge Design classes
8085 class WConfModifBadgeDesign(wcomponents.WTemplated):
8086 """ This class corresponds to the screen where a template
8087 is designed inserting, dragging and editing items.
8090 def __init__(self, conference, templateId, new=False, user=None):
8091 self.__conf = conference
8092 self.__templateId = templateId
8093 self.__new = new
8094 self._user = user
8096 def getVars( self ):
8097 vars = wcomponents.WTemplated.getVars( self )
8098 vars["baseURL"] = Config.getInstance().getBaseURL() ##base url of the application, used for the ruler images
8099 vars["cancelURL"] = urlHandlers.UHConfModifBadgePrinting.getURL(self.__conf, templateId = self.__templateId, cancel = True)
8100 vars["saveBackgroundURL"] = urlHandlers.UHConfModifBadgeSaveBackground.getURL(self.__conf, self.__templateId)
8101 vars["loadingIconURL"] = quoteattr(str(Config.getInstance().getSystemIconURL("loading")))
8102 vars["templateId"] = self.__templateId
8104 badgeDesignConfiguration = BadgeDesignConfiguration()
8105 from MaKaC.services.interface.rpc.json import encode as jsonEncode
8106 vars["translateName"]= jsonEncode(dict([(key, value[0]) for key, value in badgeDesignConfiguration.items_actions.iteritems()]))
8108 cases = []
8109 for itemKey in badgeDesignConfiguration.items_actions.keys():
8110 case = []
8111 case.append('case "')
8112 case.append(itemKey)
8113 case.append('":')
8114 case.append('\n')
8115 case.append('items[itemId] = new Item(itemId, "')
8116 case.append(itemKey)
8117 case.append('");')
8118 case.append('\n')
8119 case.append('newDiv.html(items[itemId].toHTML());')
8120 case.append('\n')
8121 case.append('break;')
8122 cases.append("".join(case))
8124 vars['switchCases'] = "\n".join(cases)
8126 optgroups = []
8127 for optgroupName, options in badgeDesignConfiguration.groups:
8128 optgroup = []
8129 optgroup.append('<optgroup label="')
8130 optgroup.append(optgroupName)
8131 optgroup.append('">')
8132 optgroup.append('\n')
8133 for optionName in options:
8134 optgroup.append('<option value="%s">'%optionName)
8135 optgroup.append(badgeDesignConfiguration.items_actions[optionName][0])
8136 optgroup.append('</option>')
8137 optgroup.append('\n')
8138 optgroup.append('</optgroup>')
8139 optgroups.append("".join(optgroup))
8141 vars['selectOptions'] = "\n".join(optgroups)
8142 vars["backgroundPos"] = "Stretch"
8144 if self.__new:
8145 vars["saveTemplateURL"]=urlHandlers.UHConfModifBadgePrinting.getURL(self.__conf, new=True)
8146 vars["titleMessage"]= _("Creating new badge template")
8147 vars["editingTemplate"]="false"
8148 vars["templateData"]="[]"
8149 vars["hasBackground"]="false"
8150 vars["backgroundURL"]="false"
8151 vars["backgroundId"]=-1
8153 elif self.__templateId is None:
8154 vars["saveTemplateURL"]=urlHandlers.UHConfModifBadgePrinting.getURL(self.__conf)
8155 vars["titleMessage"]= _("No template id given")
8156 vars["editingTemplate"]="false"
8157 vars["templateData"]="[]"
8158 vars["hasBackground"]="false"
8159 vars["backgroundURL"]="false"
8160 vars["backgroundId"]=-1
8162 else:
8163 vars["saveTemplateURL"]=urlHandlers.UHConfModifBadgePrinting.getURL(self.__conf)
8164 vars["titleMessage"]= _("Editing badge template")
8165 vars["editingTemplate"]="true"
8167 templateDataString = jsonEncode(self.__conf.getBadgeTemplateManager().getTemplateData(self.__templateId))
8168 vars["templateData"]= templateDataString
8170 usedBackgroundId = self.__conf.getBadgeTemplateManager().getTemplateById(self.__templateId).getUsedBackgroundId()
8171 vars["backgroundId"] = usedBackgroundId
8172 if usedBackgroundId != -1:
8173 vars["hasBackground"]="true"
8174 vars["backgroundURL"]=str(urlHandlers.UHConfModifBadgeGetBackground.getURL(self.__conf, self.__templateId, usedBackgroundId))
8175 else:
8176 vars["hasBackground"]="false"
8177 vars["backgroundURL"]="false"
8180 return vars
8183 class WPConfModifBadgeDesign(WPBadgeBase):
8185 def __init__(self, rh, conf, templateId=None, new=False, baseTemplateId="blank"):
8186 WPBadgeBase.__init__(self, rh, conf)
8187 self.__templateId = templateId
8188 self.__new = new
8189 self.__baseTemplate = baseTemplateId
8191 if baseTemplateId != 'blank':
8192 dconf = conference.CategoryManager().getDefaultConference()
8193 templMan = conf.getBadgeTemplateManager()
8194 newId = templateId
8195 dconf.getBadgeTemplateManager().getTemplateById(baseTemplateId).clone(templMan, newId)
8196 # now, let's pretend nothing happened, and let the code
8197 # handle the template as if it existed before
8198 self.__new = False
8200 def _setActiveTab(self):
8201 self._tabBadges.setActive()
8203 def _getTabContent(self, params):
8204 wc = WConfModifBadgeDesign(self._conf, self.__templateId, self.__new)
8205 return wc.getHTML()
8207 ##------------------------------------------------------------------------------------------------------------
8209 Common PDF Options classes
8211 class WConfCommonPDFOptions( wcomponents.WTemplated ):
8212 """ This class corresponds to a section of options
8213 that are common to each PDF in Indico.
8216 def __init__( self, conference, user=None ):
8217 self.__conf = conference
8218 self._user=user
8220 def getVars(self):
8221 vars = wcomponents.WTemplated.getVars( self )
8223 pagesizeNames = PDFSizes().PDFpagesizes.keys()
8224 pagesizeNames.sort()
8225 pagesizeOptions = []
8226 for pagesizeName in pagesizeNames:
8227 pagesizeOptions.append('<option ')
8228 if pagesizeName == 'A4':
8229 pagesizeOptions.append('selected="selected"')
8230 pagesizeOptions.append('>')
8231 pagesizeOptions.append(pagesizeName)
8232 pagesizeOptions.append('</option>')
8234 vars['pagesizes'] = "".join(pagesizeOptions)
8236 fontsizeOptions = []
8237 for fontsizeName in PDFSizes().PDFfontsizes:
8238 fontsizeOptions.append('<option ')
8239 if fontsizeName == 'normal':
8240 fontsizeOptions.append('selected="selected"')
8241 fontsizeOptions.append('>')
8242 fontsizeOptions.append(fontsizeName)
8243 fontsizeOptions.append('</option>')
8245 vars['fontsizes'] = "".join(fontsizeOptions)
8247 return vars
8250 # ============================================================================
8251 # === Posters related ========================================================
8252 # ============================================================================
8254 ##------------------------------------------------------------------------------------------------------------
8256 Poster Printing classes
8258 class WConfModifPosterPrinting(wcomponents.WTemplated):
8259 """ This class corresponds to the screen where poster templates are
8260 listed and can be created, edited, deleted, and tried.
8263 def __init__(self, conference, user=None):
8264 self.__conf = conference
8265 self._user = user
8267 def _getFullTemplateListOptions(self):
8268 templates = {}
8269 templates['global'] = conference.CategoryManager().getDefaultConference().getPosterTemplateManager().getTemplates()
8270 templates['local'] = self.__conf.getPosterTemplateManager().getTemplates()
8271 options = []
8273 def _iterTemplatesToObjectList(key, templates):
8274 newList = []
8276 for id, template in templates.iteritems():
8277 pKey = ' (' + key + ')'
8278 # Only if the template is 'global' should it have the word prefixed.
8279 value = key + str(id) if key == 'global' else str(id)
8280 newList.append({'value': value,
8281 'label': template.getName() + pKey})
8283 return newList
8285 for k, v in templates.iteritems():
8286 options.extend(_iterTemplatesToObjectList(k, v))
8288 return options
8290 def _getBaseTemplateListOptions(self):
8291 templates = conference.CategoryManager().getDefaultConference().getPosterTemplateManager().getTemplates()
8292 options = [{'value': 'blank', 'label': _('Blank Page')}]
8294 for id, template in templates.iteritems():
8295 options.append({'value': id, 'label': template.getName()})
8297 return options
8299 def getVars(self):
8300 uh = urlHandlers
8301 templates = []
8302 wcPDFOptions = WConfModifPosterPDFOptions(self.__conf)
8303 sortedTemplates = self.__conf.getPosterTemplateManager().getTemplates().items()
8304 sortedTemplates.sort(lambda item1, item2: cmp(item1[1].getName(), item2[1].getName()))
8306 for templateId, template in sortedTemplates:
8308 data = {
8309 'id': templateId,
8310 'name': template.getName(),
8311 'urlEdit': str(uh.UHConfModifPosterDesign.getURL(self.__conf, templateId)),
8312 'urlDelete': str(uh.UHConfModifPosterPrinting.getURL(self.__conf, deleteTemplateId=templateId)),
8313 'urlCopy': str(uh.UHConfModifPosterPrinting.getURL(self.__conf, copyTemplateId=templateId))
8316 templates.append(data)
8318 vars = wcomponents.WTemplated.getVars(self)
8319 vars["NewTemplateURL"] = str(uh.UHConfModifPosterDesign.getURL(self.__conf, self.__conf.getPosterTemplateManager().getNewTemplateId(),new=True))
8320 vars["CreatePDFURL"]= str(uh.UHConfModifPosterPrintingPDF.getURL(self.__conf))
8321 vars["templateList"] = templates
8322 vars['PDFOptions'] = wcPDFOptions.getHTML()
8323 vars['baseTemplates'] = self._getBaseTemplateListOptions()
8324 vars['fullTemplateList'] = self._getFullTemplateListOptions()
8326 return vars
8328 class WConfModifPosterPDFOptions(wcomponents.WTemplated):
8330 def __init__(self, conference, user=None):
8331 self.__conf = conference
8332 self._user= user
8334 def getVars(self):
8335 vars = wcomponents.WTemplated.getVars(self)
8337 pagesizeNames = PDFSizes().PDFpagesizes.keys()
8338 pagesizeNames.sort()
8339 pagesizeOptions = []
8341 for pagesizeName in pagesizeNames:
8342 pagesizeOptions.append('<option ')
8344 if pagesizeName == 'A4':
8345 pagesizeOptions.append('selected="selected"')
8347 pagesizeOptions.append('>')
8348 pagesizeOptions.append(pagesizeName)
8349 pagesizeOptions.append('</option>')
8351 vars['pagesizes'] = "".join(pagesizeOptions)
8353 return vars
8355 class WPConfModifPosterPrinting(WPBadgeBase):
8357 def _setActiveTab(self):
8358 self._tabPosters.setActive()
8360 def _getTabContent(self, params):
8361 wc = WConfModifPosterPrinting(self._conf)
8362 return wc.getHTML()
8364 ##------------------------------------------------------------------------------------------------------------
8366 Poster Design classes
8368 class WConfModifPosterDesign( wcomponents.WTemplated ):
8369 """ This class corresponds to the screen where a template
8370 is designed inserting, dragging and editing items.
8373 def __init__(self, conference, templateId, new=False, user=None):
8374 self.__conf = conference
8375 self.__templateId = templateId
8376 self.__new = new
8377 self._user = user
8380 def getVars(self):
8381 vars = wcomponents.WTemplated.getVars( self )
8382 vars["baseURL"] = Config.getInstance().getBaseURL() # base url of the application, used for the ruler images
8383 vars["cancelURL"] = urlHandlers.UHConfModifPosterPrinting.getURL(self.__conf, templateId = self.__templateId, cancel = True)
8384 vars["saveBackgroundURL"] = urlHandlers.UHConfModifPosterSaveBackground.getURL(self.__conf, self.__templateId)
8385 vars["loadingIconURL"] = quoteattr(str(Config.getInstance().getSystemIconURL("loading")))
8386 vars["templateId"] = self.__templateId
8388 posterDesignConfiguration = PosterDesignConfiguration()
8389 from MaKaC.services.interface.rpc.json import encode as jsonEncode
8390 vars["translateName"]= jsonEncode(dict([(key, value[0]) for key, value in posterDesignConfiguration.items_actions.iteritems()]))
8392 cases = []
8393 for itemKey in posterDesignConfiguration.items_actions.keys():
8394 case = []
8395 case.append('case "')
8396 case.append(itemKey)
8397 case.append('":')
8398 case.append('\n')
8399 case.append('items[itemId] = new Item(itemId, "')
8400 case.append(itemKey)
8401 case.append('");')
8402 case.append('\n')
8403 case.append('newDiv.html(items[itemId].toHTML());')
8404 case.append('\n')
8405 case.append('break;')
8406 cases.append("".join(case))
8408 vars['switchCases'] = "\n".join(cases)
8410 optgroups = []
8411 for optgroupName, options in posterDesignConfiguration.groups:
8412 optgroup = []
8413 optgroup.append('<optgroup label="')
8414 optgroup.append(optgroupName)
8415 optgroup.append('">')
8416 optgroup.append('\n')
8417 for optionName in options:
8418 optgroup.append('<option value="%s">'%optionName)
8419 optgroup.append(posterDesignConfiguration.items_actions[optionName][0])
8420 optgroup.append('</option>')
8421 optgroup.append('\n')
8422 optgroup.append('</optgroup>')
8423 optgroups.append("".join(optgroup))
8425 vars['selectOptions'] = "\n".join(optgroups)
8427 if self.__new:
8428 vars["saveTemplateURL"]=urlHandlers.UHConfModifPosterPrinting.getURL(self.__conf, new=True)
8429 vars["titleMessage"]= _("Creating new poster template")
8430 vars["hasBackground"]="false"
8431 vars["backgroundURL"]="false"
8432 vars["backgroundId"]=-1
8433 vars["backgroundPos"]="Stretch"
8434 vars["templateData"]="[]"
8435 vars["editingTemplate"]="false"
8438 elif self.__templateId is None:
8439 vars["saveTemplateURL"]=urlHandlers.UHConfModifPosterPrinting.getURL(self.__conf)
8440 vars["titleMessage"]= _("No template id given")
8441 vars["hasBackground"]="false"
8442 vars["backgroundURL"]="false"
8443 vars["backgroundId"]=-1
8444 vars["backgroundPos"]="Stretch"
8445 vars["templateData"] = "[]"
8446 vars["editingTemplate"]="false"
8449 else:
8450 vars["saveTemplateURL"]=urlHandlers.UHConfModifPosterPrinting.getURL(self.__conf)
8451 vars["titleMessage"]= _("Editing poster template")
8452 vars["editingTemplate"]="true"
8453 templateDataString = jsonEncode(self.__conf.getPosterTemplateManager().getTemplateData(self.__templateId))
8454 vars["templateData"]= templateDataString
8456 usedBackgroundId = self.__conf.getPosterTemplateManager().getTemplateById(self.__templateId).getUsedBackgroundId()
8457 vars["backgroundId"] = usedBackgroundId
8459 if usedBackgroundId != -1:
8460 vars["hasBackground"]="true"
8461 vars["backgroundURL"]=str(urlHandlers.UHConfModifPosterGetBackground.getURL(self.__conf, self.__templateId, usedBackgroundId))
8462 vars["backgroundPos"]=self.__conf.getPosterTemplateManager().getTemplateById(self.__templateId).getBackgroundPosition(usedBackgroundId)
8463 else:
8464 vars["hasBackground"]="false"
8465 vars["backgroundURL"]="false"
8466 vars["backgroundPos"]="Stretch"
8468 return vars
8471 class WPConfModifPosterDesign(WPBadgeBase):
8473 def __init__(self, rh, conf, templateId=None, new=False, baseTemplateId="blank"):
8474 WPBadgeBase.__init__(self, rh, conf)
8475 self.__templateId = templateId
8476 self.__new = new
8477 self.__baseTemplate = baseTemplateId
8479 def _setActiveTab(self):
8480 self._tabPosters.setActive()
8482 def _getTabContent(self, params):
8483 wc = WConfModifPosterDesign(self._conf, self.__templateId, self.__new)
8484 return wc.getHTML()
8486 def sortByName(x,y):
8487 return cmp(x.getFamilyName(),y.getFamilyName())
8489 class WPConfModifPreviewCSS( WPConferenceDefaultDisplayBase ):
8491 def __init__( self, rh, conf, selectedCSSId):
8492 WPConferenceDefaultDisplayBase.__init__( self, rh, conf )
8494 self._conf = conf
8495 self._cssTplsModule = ModuleHolder().getById("cssTpls")
8496 self._styleMgr = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getStyleManager()
8498 self._selectedCSS = None
8499 if selectedCSSId == "css": # local uploaded file choice
8500 self._selectedCSS = self._styleMgr.getLocalCSS()
8501 elif selectedCSSId:
8502 self._selectedCSS = self._cssTplsModule.getCssTplById(selectedCSSId)
8504 def _applyDecoration( self, body ):
8507 return "%s%s%s"%( self._getHeader(), body, self._getFooter() )
8509 def _getBody( self, params ):
8510 params["URL2Back"] = urlHandlers.UHConfModifDisplay.getURL(self._conf)
8511 params["cssurl"] = ""
8512 params['selectedCSSId'] = ""
8513 if self._selectedCSS:
8514 params["cssurl"] = self._selectedCSS.getURL()
8515 params['selectedCSSId'] = self._selectedCSS.getId()
8516 elif self._styleMgr.getCSS():
8517 params["cssurl"] = self._styleMgr.getCSS().getURL()
8518 params['selectedCSSId'] = self._styleMgr.getCSS().getId()
8519 params["saveCSS"]=urlHandlers.UHUseCSS.getURL(self._conf)
8520 params['confId'] = self._conf.getId()
8521 params["previewURL"]= urlHandlers.UHConfModifPreviewCSS.getURL(self._conf)
8522 params["templatesList"]=[]
8523 if self._styleMgr.getLocalCSS():
8524 params["templatesList"].append(self._styleMgr.getLocalCSS())
8525 params["templatesList"].extend(self._cssTplsModule.getCssTplsList())
8527 ###############################
8528 # injecting ConferenceDisplay #
8529 ###############################
8530 p = WPConferenceDisplay( self._rh, self._conf )
8531 p._defineSectionMenu()
8532 p._toolBar=wcomponents.WebToolBar()
8533 p._defineToolBar()
8534 params["bodyConf"] = p._applyConfDisplayDecoration( p._getBody( params ) )
8535 ###############################
8536 ###############################
8538 wc = WPreviewPage()
8539 return wc.getHTML(params)
8541 def _getHeadContent( self ):
8542 path = self._getBaseURL()
8543 timestamp = os.stat(__file__).st_mtime
8544 printCSS = """
8545 <link rel="stylesheet" type="text/css" href="%s/css/Conf_Basic.css?%d" >
8546 """ % (path, timestamp)
8548 if self._selectedCSS:
8549 printCSS = printCSS + """<link rel="stylesheet" type="text/css" href="%s" >"""%self._selectedCSS.getURL()
8550 elif self._styleMgr.getCSS():
8551 printCSS = printCSS + """<link rel="stylesheet" type="text/css" href="%s" >"""%self._styleMgr.getCSS().getURL()
8552 return printCSS
8555 class WPreviewPage( wcomponents.WTemplated ):
8556 pass