# -*- coding: utf-8 -*- ## ## ## This file is part of CDS Indico. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. ## ## CDS Indico is free software; you can redistribute it and/or ## modify it under the terms of the GNU General Public License as ## published by the Free Software Foundation; either version 2 of the ## License, or (at your option) any later version. ## ## CDS Indico is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with CDS Indico; if not, write to the Free Software Foundation, Inc., ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. import urllib import os import string import random import simplejson from datetime import timedelta,datetime from xml.sax.saxutils import quoteattr, escape from MaKaC import user import MaKaC.webinterface.wcomponents as wcomponents import MaKaC.webinterface.urlHandlers as urlHandlers import MaKaC.webinterface.displayMgr as displayMgr import MaKaC.webinterface.timetable as timetable import MaKaC.webinterface.linking as linking import MaKaC.webinterface.navigation as navigation import MaKaC.schedule as schedule import MaKaC.conference as conference import MaKaC.webinterface.materialFactories as materialFactories import MaKaC.common.filters as filters from MaKaC.common.utils import isStringHTML, formatDateTime import MaKaC.review as review from MaKaC.webinterface.pages.base import WPDecorated from MaKaC.webinterface.common.tools import strip_ml_tags, escape_html from MaKaC.webinterface.materialFactories import ConfMFRegistry,PaperFactory,SlidesFactory,PosterFactory from MaKaC.webinterface.common.abstractNotificator import EmailNotificator from MaKaC.common import Config from MaKaC.webinterface.common.abstractStatusWrapper import AbstractStatusList from MaKaC.webinterface.common.contribStatusWrapper import ContribStatusList from MaKaC.common.output import outputGenerator from MaKaC.webinterface.general import strfFileSize from MaKaC.webinterface.common.person_titles import TitlesRegistry from MaKaC.webinterface.common.timezones import TimezoneRegistry from MaKaC.PDFinterface.base import PDFSizes from pytz import timezone import MaKaC.webinterface.common.timezones as convertTime from MaKaC.common.timezoneUtils import nowutc, DisplayTZ from MaKaC.badgeDesignConf import BadgeDesignConfiguration from MaKaC.posterDesignConf import PosterDesignConfiguration from MaKaC.webinterface.pages import main from MaKaC.webinterface.pages import base import MaKaC.common.info as info from MaKaC.common.cache import EventCache from MaKaC.i18n import _ import MaKaC.webcast as webcast from MaKaC.common.fossilize import fossilize from MaKaC.fossils.conference import IConferenceEventInfoFossil from MaKaC.common.Conversion import Conversion from MaKaC.common.logger import Logger from MaKaC.plugins.base import OldObservable from indico.modules import ModuleHolder def stringToDate( str ): #Don't delete this dictionary inside comment. Its purpose is to add the dictionary in the language dictionary during the extraction! #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 } 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 } [ day, month, year ] = str.split("-") return datetime(int(year),months[month],int(day)) class WPConferenceBase( base.WPDecorated ): def __init__( self, rh, conference ): WPDecorated.__init__( self, rh ) self._navigationTarget = self._conf = conference tz = self._tz = DisplayTZ(rh._aw,self._conf).getDisplayTZ() sDate = self.sDate = self._conf.getAdjustedScreenStartDate(tz) eDate = self.eDate = self._conf.getAdjustedScreenEndDate(tz) dates=" (%s)"%sDate.strftime("%d %B %Y") if sDate.strftime("%d%B%Y") != eDate.strftime("%d%B%Y"): if sDate.strftime("%B%Y") == eDate.strftime("%B%Y"): dates=" (%s-%s)"%(sDate.strftime("%d"), eDate.strftime("%d %B %Y")) else: dates=" (%s - %s)"%(sDate.strftime("%d %B %Y"), eDate.strftime("%d %B %Y")) self._setTitle( "%s %s"%(strip_ml_tags(self._conf.getTitle()), dates )) self._parentCateg = None categId = rh._getSession().getVar("currentCategoryId") if categId != None: self._parentCateg = self._conf.getOwnerById(categId) def _getFooter( self ): """ """ wc = wcomponents.WFooter() p = {"modificationDate":self._conf.getModificationDate().strftime("%d %B %Y %H:%M"), "subArea": self._getSiteArea()} return wc.getHTML(p) def getLoginURL( self ): wf = self._rh.getWebFactory() if wf: return WPDecorated.getLoginURL(self) return urlHandlers.UHConfSignIn.getURL(self._conf,"%s"%self._rh.getCurrentURL()) def getLogoutURL( self ): return urlHandlers.UHSignOut.getURL(str(urlHandlers.UHConferenceDisplay.getURL(self._conf))) class WPConferenceDisplayBase( WPConferenceBase, OldObservable ): def getJSFiles(self): return WPConferenceBase.getJSFiles(self) + \ self._includeJSPackage('MaterialEditor') def getCSSFiles(self): # flatten returned list return WPConferenceBase.getCSSFiles(self) + \ sum(self._notify('injectCSSFiles'), []) class WPConferenceDefaultDisplayBase( WPConferenceBase): navigationEntry = None def _getFooter( self ): """ """ wc = wcomponents.WFooter() p = {"modificationDate":self._conf.getModificationDate().strftime("%d %B %Y %H:%M"), "subArea": self._getSiteArea()} if Config.getInstance().getShortEventURL(): id=self._conf.getUrlTag().strip() if not id: id = self._conf.getId() p["shortURL"] = Config.getInstance().getShortEventURL() + id return wc.getHTML(p) def _getHeader( self ): """ """ wc = wcomponents.WConferenceHeader( self._getAW(), self._conf ) return wc.getHTML( { "loginURL": self.getLoginURL(),\ "logoutURL": self.getLogoutURL(),\ "loginAsURL": self.getLoginAsURL(), \ "confId": self._conf.getId(), \ "dark": True} ) def _defineSectionMenu( self ): awUser = self._getAW().getUser() self._sectionMenu = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu() self._overviewOpt = self._sectionMenu.getLinkByName("overview") self._programOpt = self._sectionMenu.getLinkByName("programme") link = self._programOpt self._cfaOpt = self._sectionMenu.getLinkByName("CFA") self._cfaNewSubmissionOpt = self._sectionMenu.getLinkByName("SubmitAbstract") self._cfaViewSubmissionsOpt = self._sectionMenu.getLinkByName("ViewAbstracts") self._abstractsBookOpt = self._sectionMenu.getLinkByName("abstractsBook") if not self._conf.getAbstractMgr().isActive() or not self._conf.hasEnabledSection("cfa"): self._cfaOpt.setVisible(False) self._abstractsBookOpt.setVisible(False) else: self._cfaOpt.setVisible(True) self._abstractsBookOpt.setVisible(True) self._trackMgtOpt = self._sectionMenu.getLinkByName("manageTrack") #registration form self._regFormOpt = self._sectionMenu.getLinkByName("registrationForm") self._viewRegFormOpt = self._sectionMenu.getLinkByName("ViewMyRegistration") self._newRegFormOpt = self._sectionMenu.getLinkByName("NewRegistration") if awUser != None: self._viewRegFormOpt.setVisible(awUser.isRegisteredInConf(self._conf)) self._newRegFormOpt.setVisible(not awUser.isRegisteredInConf(self._conf)) else: self._viewRegFormOpt.setVisible(False) self._newRegFormOpt.setVisible(True) self._registrantsListOpt = self._sectionMenu.getLinkByName("registrants") if not self._conf.getRegistrationForm().isActivated() or not self._conf.hasEnabledSection("regForm"): self._regFormOpt.setVisible(False) self._registrantsListOpt.setVisible(False) else: self._regFormOpt.setVisible(True) self._registrantsListOpt.setVisible(True) #instant messaging self._notify('confDisplaySMShow', {}) #evaluation evaluation = self._conf.getEvaluation() self._evaluationOpt = self._sectionMenu.getLinkByName("evaluation") self._newEvaluationOpt = self._sectionMenu.getLinkByName("newEvaluation") self._viewEvaluationOpt = self._sectionMenu.getLinkByName("viewMyEvaluation") self._evaluationOpt.setVisible(self._conf.hasEnabledSection("evaluation") and evaluation.isVisible() and evaluation.getNbOfQuestions()>0) if awUser!=None and awUser.hasSubmittedEvaluation(evaluation): self._newEvaluationOpt.setVisible(not awUser.hasSubmittedEvaluation(evaluation)) self._viewEvaluationOpt.setVisible(awUser.hasSubmittedEvaluation(evaluation)) else: self._newEvaluationOpt.setVisible(True) self._viewEvaluationOpt.setVisible(False) self._sectionMenu.setCurrentItem(None) self._timetableOpt = self._sectionMenu.getLinkByName("timetable") self._contribListOpt = self._sectionMenu.getLinkByName("contributionList") self._authorIndexOpt = self._sectionMenu.getLinkByName("authorIndex") self._speakerIndexOpt = self._sectionMenu.getLinkByName("speakerIndex") self._myStuffOpt=self._sectionMenu.getLinkByName("mystuff") self._myStuffOpt.setVisible(awUser is not None) self._mySessionsOpt=self._sectionMenu.getLinkByName("mysessions") from sets import Set ls = Set(self._conf.getCoordinatedSessions(awUser)) ls = list(ls | Set(self._conf.getManagedSession(awUser))) self._mySessionsOpt.setVisible(len(ls)>0) if len(ls)==1: self._mySessionsOpt.setCaption( _("My session")) self._mySessionsOpt.setURL(urlHandlers.UHSessionModification.getURL(ls[0])) self._myTracksOpt=self._sectionMenu.getLinkByName("mytracks") lt=self._conf.getCoordinatedTracks(awUser) self._myTracksOpt.setVisible(len(lt)>0) if len(lt)==1: self._myTracksOpt.setCaption( _("My track")) self._myTracksOpt.setURL(urlHandlers.UHTrackModifAbstracts.getURL(lt[0])) if not self._conf.getAbstractMgr().isActive() or not self._conf.hasEnabledSection("cfa"): self._myTracksOpt.setVisible(False) self._myContribsOpt=self._sectionMenu.getLinkByName("mycontribs") lc=self._conf.getContribsForSubmitter(awUser) self._myContribsOpt.setVisible(len(lc)>0) self._trackMgtOpt.setVisible(False) tracks = self._conf.getCoordinatedTracks( awUser ) if tracks: if len(tracks)>1: self._trackMgtOpt.setCaption( _("Manage my tracks")) url = urlHandlers.UHConferenceProgram.getURL( self._conf ) else: url = urlHandlers.UHTrackModifAbstracts.getURL( tracks[0] ) self._trackMgtOpt.setURL(str(url)) self._trackMgtOpt.setVisible(True) if not self._conf.getAbstractMgr().isActive() or not self._conf.hasEnabledSection("cfa"): self._trackMgtOpt.setVisible(False) self._abstractReviewingMgtOpt=self._sectionMenu.getLinkByName("manageabstractreviewing") self._abstractReviewingMgtOpt.setVisible(False) #paper reviewing related self._paperReviewingMgtOpt=self._sectionMenu.getLinkByName("managepaperreviewing") self._paperReviewingMgtOpt.setVisible(False) self._assignContribOpt=self._sectionMenu.getLinkByName("assigncontributions") self._assignContribOpt.setVisible(False) self._judgeListOpt=self._sectionMenu.getLinkByName("judgelist") self._judgeListOpt.setVisible(False) self._judgereviewerListOpt=self._sectionMenu.getLinkByName("judgelistreviewer") self._judgereviewerListOpt.setVisible(False) self._judgeeditorListOpt=self._sectionMenu.getLinkByName("judgelisteditor") self._judgeeditorListOpt.setVisible(False) if awUser != None: conferenceRoles = awUser.getLinkedTo()["conference"] if "abstractManager" in conferenceRoles: if self._conf in awUser.getLinkedTo()["conference"]["abstractManager"]: self._abstractReviewingMgtOpt.setVisible(True) if "paperReviewManager" in conferenceRoles: if self._conf in awUser.getLinkedTo()["conference"]["paperReviewManager"]: self._paperReviewingMgtOpt.setVisible(True) self._assignContribOpt.setVisible(True) if "referee" in conferenceRoles and "editor" in conferenceRoles and "reviewer" in conferenceRoles: showrefereearea = self._conf in awUser.getLinkedTo()["conference"]["referee"] showreviewerarea = self._conf in awUser.getLinkedTo()["conference"]["reviewer"] showeditorarea = self._conf in awUser.getLinkedTo()["conference"]["editor"] if showrefereearea and (self._conf.getConfReview().getChoice()==2 or self._conf.getConfReview().getChoice()==4): self._assignContribOpt.setVisible(True) self._judgeListOpt.setVisible(True) if showreviewerarea and (self._conf.getConfReview().getChoice()==2 or self._conf.getConfReview().getChoice()==4): self._judgereviewerListOpt.setVisible(True) if showeditorarea and (self._conf.getConfReview().getChoice()==3 or self._conf.getConfReview().getChoice()==4): self._judgeeditorListOpt.setVisible(True) #collaboration related self._collaborationOpt = self._sectionMenu.getLinkByName("collaboration") self._collaborationOpt.setVisible(False) csbm = self._conf.getCSBookingManager() if csbm is not None and csbm.hasBookings() and csbm.isCSAllowed(): self._collaborationOpt.setVisible(True) def _defineToolBar(self): pass def _display( self, params ): self._defineSectionMenu() self._toolBar=wcomponents.WebToolBar() self._defineToolBar() return WPConferenceBase._display(self,params) def _getNavigationBarHTML(self): item=None if self.navigationEntry: item = self.navigationEntry() itemList = [] while item is not None: if itemList == []: itemList.insert(0, wcomponents.WTemplated.htmlText(item.getTitle()) ) else: itemList.insert(0, """%s"""%( quoteattr(str(item.getURL(self._navigationTarget))), wcomponents.WTemplated.htmlText(item.getTitle()) ) ) item = item.getParent(self._navigationTarget) itemList.insert(0, _(""" _("Home")""")%quoteattr(str(urlHandlers.UHConferenceDisplay.getURL(self._conf))) ) return " > ".join(itemList) def _getToolBarHTML(self): drawer=wcomponents.WConfTBDrawer(self._toolBar) return drawer.getHTML() def _applyConfDisplayDecoration( self, body ): drawer = wcomponents.WConfTickerTapeDrawer(self._conf, self._tz) frame = WConfDisplayFrame( self._getAW(), self._conf ) urlClose = urlHandlers.UHConferenceDisplayMenuClose.getURL(self._conf) urlClose.addParam("currentURL",self._rh.getCurrentURL()) urlOpen = urlHandlers.UHConferenceDisplayMenuOpen.getURL(self._conf) urlOpen.addParam("currentURL",self._rh.getCurrentURL()) menuStatus = self._rh._getSession().getVar("menuStatus") or "open" wm = webcast.HelperWebcastManager.getWebcastManagerInstance() onAirURL = wm.isOnAir(self._conf) if onAirURL: webcastURL = onAirURL else: webcastURL = wm.getWebcastServiceURL() forthcomingWebcast = not onAirURL and wm.getForthcomingWebcast(self._conf) frameParams = {\ "confModifURL": urlHandlers.UHConferenceModification.getURL(self._conf), \ "logoURL": urlHandlers.UHConferenceLogo.getURL( self._conf), \ "currentURL":self._rh.getCurrentURL(), \ "closeMenuURL": urlClose, \ "menuStatus": menuStatus, \ "nowHappening": drawer.getNowHappeningHTML(), \ "simpleTextAnnouncement": drawer.getSimpleText(), \ "onAirURL": onAirURL, "webcastURL": webcastURL, "forthcomingWebcast": forthcomingWebcast } if self._conf.getLogo(): frameParams["logoURL"] = urlHandlers.UHConferenceLogo.getURL( self._conf) colspan="" imgOpen="" padding="" if menuStatus != "open": urlOpen = urlHandlers.UHConferenceDisplayMenuOpen.getURL(self._conf) urlOpen.addParam("currentURL",self._rh.getCurrentURL()) colspan = """ colspan="2" """ imgOpen = """
Show menu
"""%(quoteattr(str(urlOpen)),Config.getInstance().getSystemIconURL("openMenuIcon")) padding=""" style="padding:0px" """ body = """
%s
%s
%s
%s
"""%(colspan,padding,imgOpen, self._getNavigationBarHTML(), self._getToolBarHTML().strip(), body) return frame.getHTML( self._sectionMenu, body, frameParams) def _getHeadContent( self ): #This is used for fetching the default css file for the conference pages #And also the modificated uploaded css path = baseurl = self._getBaseURL() printCSS = """ """ % path confCSS = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getStyleManager().getCSS() if confCSS: printCSS = printCSS + """"""%(confCSS.getURL()) return printCSS def _applyDecoration( self, body ): body = self._applyConfDisplayDecoration( body ) return WPConferenceBase._applyDecoration( self, body ) class WConfDisplayFrame(wcomponents.WTemplated): def __init__(self, aw, conf): self._aw = aw self._conf = conf def getHTML( self, menu, body, params ): self._body = body self._menu = menu return wcomponents.WTemplated.getHTML( self, params ) def getVars(self): vars = wcomponents.WTemplated.getVars( self ) vars["logo"] = "" if self._conf.getLogo(): vars["logo"] = "\"%s\""%(vars["logoURL"], escape_html(self._conf.getTitle(), escape_quotes = True)) vars["confTitle"] = self._conf.getTitle() vars["displayURL"] = urlHandlers.UHConferenceDisplay.getURL(self._conf) vars["imgConferenceRoom"] = Config.getInstance().getSystemIconURL( "conferenceRoom" ) tz = DisplayTZ(self._aw,self._conf).getDisplayTZ() adjusted_sDate = self._conf.getAdjustedScreenStartDate(tz) adjusted_eDate = self._conf.getAdjustedScreenEndDate(tz) vars["timezone"] = tz vars["confDateInterval"] = "from %s to %s (%s)"%(adjusted_sDate.strftime("%d %B %Y"), adjusted_eDate.strftime("%d %B %Y"), tz) if adjusted_sDate.strftime("%d%B%Y") == \ adjusted_eDate.strftime("%d%B%Y"): vars["confDateInterval"] = adjusted_sDate.strftime("%d %B %Y") elif adjusted_sDate.strftime("%B%Y") == adjusted_eDate.strftime("%B%Y"): vars["confDateInterval"] = "%s-%s %s"%(adjusted_sDate.day, adjusted_eDate.day, adjusted_sDate.strftime("%B %Y")) vars["confLocation"] = "" if self._conf.getLocationList(): vars["confLocation"] = self._conf.getLocationList()[0].getName() vars["body"] = self._body vars["supportEmail"] = "" if self._conf.hasSupportEmail(): mailto = quoteattr("""mailto:%s?subject=%s"""%(self._conf.getSupportEmail(), urllib.quote( self._conf.getTitle() ) )) vars["supportEmail"] = """email %s"""%(mailto, Config.getInstance().getSystemIconURL("smallEmail"), displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf, False).getSupportEmailCaption()) p={"closeMenuURL": vars["closeMenuURL"], \ "menuStatus": vars["menuStatus"], \ "supportEmail": vars["supportEmail"] \ } vars["menu"] = ConfDisplayMenu( self._menu ).getHTML(p) dm = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf, False) format = dm.getFormat() vars["bgColorCode"] = format.getFormatOption("titleBgColor")["code"] vars["textColorCode"] = format.getFormatOption("titleTextColor")["code"] if (Config.getInstance().getIndicoSearchServer() != '') and dm.getSearchEnabled(): vars["searchBox"] = wcomponents.WMiniSearchBox(self._conf.getId()).getHTML() else: vars["searchBox"] = "" return vars class ConfDisplayMenu: def __init__(self, menu): self._menu = menu def getHTML(self, params): html = [] if params["menuStatus"] == "open" and self._menu: html = ["""
%s
"""%params["supportEmail"]) return "".join(html) def _getLinkHTML(self, link, indent=""): if not link.isVisible(): return "" if link.getType() == "spacer": html = """
\n""" try: index = link.getParent().getLinkList().index(link)-1 type = link.getParent().getLinkList()[index].getType() if (type == "system" or type == "extern") and index!= -1: html = """
  • \n""" except Exception: pass else: target = "" sublinkList=[] for sublink in link.getEnabledLinkList(): if sublink.isVisible(): sublinkList.append(sublink) if isinstance(link,displayMgr.ExternLink): target=""" target="%s" """%link.getDisplayTarget() #Commented because 'menuicon' variable is not used #if sublinkList: # menuicon=Config.getInstance().getSystemIconURL("arrowBottomMenuConf") #else: # menuicon=Config.getInstance().getSystemIconURL("arrowRightMenuConf") if self._menu.isCurrentItem(link): html = ["""
  • " return "".join(html) class WPConfSignIn( WPConferenceDefaultDisplayBase ): def __init__(self, rh, conf, login="", msg = ""): self._login = login self._msg = msg WPConferenceBase.__init__( self, rh, conf) def _getBody( self, params ): wc = wcomponents.WSignIn() p = { \ "postURL": urlHandlers.UHConfSignIn.getURL( self._conf ), \ "returnURL": params["returnURL"], \ "createAccountURL": urlHandlers.UHConfUserCreation.getURL( self._conf ), \ "forgotPassordURL": urlHandlers.UHConfSendLogin.getURL( self._conf ), \ "login": self._login, \ "msg": self._msg } return wc.getHTML( p ) class WPConfAccountAlreadyActivated( WPConferenceDefaultDisplayBase ): def __init__(self, rh, conf, av): WPConferenceDefaultDisplayBase.__init__( self, rh, conf ) self._av = av def _getBody( self, params ): wc = wcomponents.WAccountAlreadyActivated( self._av) params["mailLoginURL"] = urlHandlers.UHConfSendLogin.getURL( self._conf, self._av) return wc.getHTML( params ) class WPConfAccountActivated( WPConferenceDefaultDisplayBase ): def __init__(self, rh, conf, av, returnURL=""): WPConferenceDefaultDisplayBase.__init__( self, rh, conf ) self._av = av self._returnURL=returnURL def _getBody( self, params ): wc = wcomponents.WAccountActivated( self._av) params["mailLoginURL"] = urlHandlers.UHConfSendLogin.getURL(self._conf, self._av) params["loginURL"] = urlHandlers.UHConfSignIn.getURL(self._conf) if self._returnURL.strip()!="": params["loginURL"] = self._returnURL return wc.getHTML( params ) class WPConfAccountDisabled( WPConferenceDefaultDisplayBase ): def __init__(self, rh, conf, av): WPConferenceDefaultDisplayBase.__init__( self, rh, conf ) self._av = av def _getBody( self, params ): wc = wcomponents.WAccountDisabled( self._av ) #params["mailLoginURL"] = urlHandlers.UHSendLogin.getURL(self._av) return wc.getHTML( params ) class WPConfUnactivatedAccount( WPConferenceDefaultDisplayBase ): def __init__(self, rh, conf, av): WPConferenceDefaultDisplayBase.__init__( self, rh, conf ) self._av = av def _getBody( self, params ): wc = wcomponents.WUnactivatedAccount( self._av ) params["mailActivationURL"] = urlHandlers.UHConfSendActivation.getURL( self._conf, self._av) return wc.getHTML( params ) class WPConfUserCreation( WPConferenceDefaultDisplayBase ): def __init__(self, rh, conf, params): self._params = params WPConferenceDefaultDisplayBase.__init__(self, rh, conf) def _getBody(self, params ): pars = self._params p = wcomponents.WUserRegistration() postURL = urlHandlers.UHConfUserCreation.getURL( self._conf ) postURL.addParam("returnURL", self._params.get("returnURL","")) pars["postURL"] = postURL if pars["msg"] != "": pars["msg"] = "
    \n%s\n
    "%pars["msg"] return p.getHTML( pars ) class WPConfUserCreated( WPConferenceDefaultDisplayBase ): def __init__(self, rh, conf, av): WPConferenceDefaultDisplayBase.__init__( self, rh, conf ) self._av = av def _getBody(self, params ): p = wcomponents.WUserCreated(self._av) pars = {"signInURL" : urlHandlers.UHConfSignIn.getURL( self._conf )} return p.getHTML( pars ) class WPConfUserExistWithIdentity( WPConferenceDefaultDisplayBase ): def __init__(self, rh, conf, av): WPConferenceDefaultDisplayBase.__init__(self, rh, conf) self._av = av def _getBody(self, params ): p = wcomponents.WUserSendIdentity(self._av) pars = {"postURL" : urlHandlers.UHConfSendLogin.getURL(self._conf, self._av)} return p.getHTML( pars ) class WConfDetailsBase( wcomponents.WTemplated ): def __init__(self, aw, conf): self._conf = conf self._aw = aw def _getChairsHTML( self ): chairList = [] l = [] for chair in self._conf.getChairList(): if chair.getEmail(): mailToURL = """%s"""%urlHandlers.UHConferenceEmail.getURL(chair) l.append( """%s"""%(quoteattr(mailToURL),self.htmlText(chair.getFullName()))) else: l.append(self.htmlText(chair.getFullName())) res = "" if len(l) > 0: res = _(""" _("Chairs"): %s """)%"
    ".join(l) return res def _getMaterialHTML( self ): l = [] for mat in self._conf.getAllMaterialList(): if mat.getTitle() != _("Internal Page Files"): temp = wcomponents.WMaterialDisplayItem() url = urlHandlers.UHMaterialDisplay.getURL( mat ) l.append( temp.getHTML( self._aw, mat, url ) ) res = "" if l: res = _(""" _("Material"): %s """)%"
    ".join( l ) return res def _getMoreInfoHTML( self ): res = "" if isStringHTML(self._conf.getContactInfo()): text = self._conf.getContactInfo() else: text = """
    %s
    """ % self._conf.getContactInfo() if self._conf.getContactInfo() != "": res = _(""" _("Additional info"): %s """)%text return res def _getActionsHTML( self, showActions = False): html=[] if showActions: html=[ _("""
    _("Conference sections"):
      """)] menu = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getMenu() for link in menu.getLinkList(): if link.isVisible() and link.isEnabled(): if not isinstance(link, displayMgr.Spacer): html.append("""
    • %s
    • """%( link.getURL(), link.getCaption() ) ) else: html.append("%s"%link) html.append("""
    """) return "".join(html) def getVars( self ): vars = wcomponents.WTemplated.getVars( self ) tz = DisplayTZ(self._aw,self._conf).getDisplayTZ() vars["timezone"] = tz if isStringHTML(self._conf.getDescription()): vars["description"] = self._conf.getDescription() else: vars["description"] = """
    %s
    """ % self._conf.getDescription() sdate, edate = self._conf.getAdjustedScreenStartDate(tz), self._conf.getAdjustedScreenEndDate(tz) fsdate, fedate = sdate.strftime("%d %B %Y"), edate.strftime("%d %B %Y") fstime, fetime = sdate.strftime("%H:%M"), edate.strftime("%H:%M") vars["dateInterval"] = "from %s %s to %s %s "%(fsdate, fstime, \ fedate, fetime) if sdate.strftime("%d%B%Y") == edate.strftime("%d%B%Y"): timeInterval = fstime if sdate.strftime("%H%M") != edate.strftime("%H%M"): timeInterval = "%s-%s"%(fstime, fetime) vars["dateInterval"] = "%s (%s)"%( fsdate, timeInterval) vars["location"] = "" location = self._conf.getLocation() if location: vars["location"] = "%s
    %s
    "%( location.getName(), location.getAddress() ) room = self._conf.getRoom() if room: roomLink = linking.RoomLinker().getHTMLLink( room, location ) vars["location"] += _(""" _("Room"): %s""")%roomLink vars["chairs"] = self._getChairsHTML() vars["material"] = self._getMaterialHTML() vars["moreInfo"] = self._getMoreInfoHTML() vars["actions"] = self._getActionsHTML(vars.get("menuStatus", "open") != "open") return vars class WConfDetailsFull(WConfDetailsBase): pass class WConfDetailsMin(WConfDetailsBase): pass #--------------------------------------------------------------------------- class WConfDetails: def __init__(self, aw, conf): self._conf = conf self._aw = aw def getHTML( self, params ): if self._conf.canAccess( self._aw ): return WConfDetailsFull( self._aw, self._conf ).getHTML( params ) if self._conf.canView( self._aw ): return WConfDetailsMin( self._aw, self._conf ).getHTML( params ) return "" class WPConferenceDisplay( WPConferenceDefaultDisplayBase ): def _getBody( self, params ): wc = WConfDetails( self._getAW(), self._conf ) pars = { \ "modifyURL": urlHandlers.UHConferenceModification.getURL( self._conf ), \ "sessionModifyURLGen": urlHandlers.UHSessionModification.getURL, \ "contribModifyURLGen": urlHandlers.UHContributionModification.getURL, \ "subContribModifyURLGen": urlHandlers.UHSubContribModification.getURL, \ "materialURLGen": urlHandlers.UHMaterialDisplay.getURL, \ "menuStatus": self._rh._getSession().getVar("menuStatus") or "open"} return wc.getHTML( pars ) def _getHeadContent( self ): #This is used for fetching the css file for conference page path = baseurl = self._getBaseURL() printCSS = """ """ % path confCSS = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getStyleManager().getCSS() if confCSS: printCSS = printCSS + """"""%(confCSS.getURL()) return printCSS def _defineSectionMenu( self ): WPConferenceDefaultDisplayBase._defineSectionMenu(self) self._sectionMenu.setCurrentItem(self._overviewOpt) class WSentMail (wcomponents.WTemplated): def __init__(self,conf): self._conf = conf def getVars(self): vars = wcomponents.WTemplated.getVars( self ) vars["BackURL"]=urlHandlers.UHConferenceDisplay.getURL(self._conf) return vars class WPSentEmail( WPConferenceDefaultDisplayBase ): def _getBody(self,params): wc = WSentMail(self._conf) return wc.getHTML() class WEmail(wcomponents.WTemplated): def __init__(self,conf,user,toEmail): self._conf = conf try: self._fromEmail = user.getEmail() except: self._fromEmail = "" self._toEmail = toEmail def getVars(self): vars = wcomponents.WTemplated.getVars( self ) if vars.get("from", None) is None : vars["from"] = self._fromEmail if vars.get("fromDisabled", None) is None or not vars.get("fromDisabled", None): vars["fromField"] = """"""%vars["from"] else : vars["fromField"] = """%s"""%(vars["from"],vars["from"]) if vars.get("to", None) is None : vars["to"] = self._toEmail if vars.get("toDisabled",None) is None or not vars.get("toDisabled",None): vars["toField"] = """"""%vars["to"] else : vars["toField"] = """%s"""%(vars["to"],vars["to"]) if vars.get("cc", None) is None : vars["cc"]= "" if vars.get("postURL",None) is None : vars["postURL"]=urlHandlers.UHConferenceSendEmail.getURL(self._conf) if vars.get("subject", None) is None : vars["subject"]="" if vars.get("body", None) is None : vars["body"]="" return vars class WPEMail ( WPConferenceDefaultDisplayBase ): def _getBody(self,params): toemail = params["emailto"] wc = WEmail(self._conf, self._getAW().getUser(), toemail) params["fromDisabled"] = True params["toDisabled"] = True params["ccDisabled"] = True return wc.getHTML(params) class WPXSLConferenceDisplay( WPConferenceBase ): def __init__( self, rh, conference, view, type, params ): WPConferenceBase.__init__( self, rh, conference ) self._params = params self._view = view self._conf = conference self._type = type self._firstDay = params.get("firstDay") self._lastDay = params.get("lastDay") self._daysPerRow = params.get("daysPerRow") self._parentCateg = None categId = rh._getSession().getVar("currentCategoryId") if categId != None: self._parentCateg = self._conf.getOwnerById(categId) self._webcastadd = False wm = webcast.HelperWebcastManager.getWebcastManagerInstance() if wm.isManager(self._getAW().getUser()): self._webcastadd = True def getCSSFiles(self): # flatten returned list return WPConferenceBase.getCSSFiles(self) + \ sum(self._notify('injectCSSFiles'), []) def getJSFiles(self): modules = WPConferenceBase.getJSFiles(self) # if the user has management powers, include # these modules #if self._conf.canModify(self._rh.getAW()): # TODO: find way to check if the user is able to manage # anything inside the conference (sessions, ...) modules += self._includeJSPackage('Management') modules += self._includeJSPackage('MaterialEditor') modules += self._includeJSPackage('Display') return modules def _getFooter( self ): """ """ wc = wcomponents.WFooter() p = {"modificationDate":self._conf.getModificationDate().strftime("%d %B %Y %H:%M"),"subArea": self._getSiteArea(),"dark":True} if Config.getInstance().getShortEventURL(): id=self._conf.getUrlTag().strip() if not id: id = self._conf.getId() p["shortURL"] = Config.getInstance().getShortEventURL() + id return wc.getHTML(p) def _getHeadContent( self ): htdocs = Config.getInstance().getHtdocsDir() # First include the default Indico stylesheet styleText = """\n""" % \ (self._getBaseURL(), Config.getInstance().getCssStylesheetName()) # Then the common event display stylesheet if os.path.exists("%s/css/common.css" % htdocs): styleText += """ \n""" % self._getBaseURL() if self._type == "simple_event": styleText += """ \n""" % self._getBaseURL() # And finally the specific display stylesheet if os.path.exists("%s/css/%s.css" % (htdocs,self._view)): styleText += """ \n""" % (self._getBaseURL(), self._view) return styleText def _getHTMLHeader( self ): if self._view in ["xml","text","jacow"] and (self._params.get("frame","")=="no" or self._params.get("fr","")=="no"): return "" tpl = wcomponents.WHTMLHeader(); return tpl.getHTML({"area": "", "baseurl": self._getBaseURL(), "conf": Config.getInstance(), "page": self, "extraCSS": self.getCSSFiles(), "extraJSFiles": self.getJSFiles(), "extraJS": self._extraJS, "language": self._getAW().getSession().getLang() }) def _getHeader( self ): """ """ if self._type == "simple_event": wc = wcomponents.WMenuSimpleEventHeader( self._getAW(), self._conf ) elif self._type == "meeting": wc = wcomponents.WMenuMeetingHeader( self._getAW(), self._conf ) else: wc = wcomponents.WMenuConferenceHeader( self._getAW(), self._conf ) return wc.getHTML( { "loginURL": self.getLoginURL(),\ "logoutURL": self.getLogoutURL(),\ "confId": self._conf.getId(),\ "currentView": self._view,\ "type": self._type,\ "selectedDate": self._params.get("showDate",""),\ "selectedSession": self._params.get("showSession",""),\ "detailLevel": self._params.get("detailLevel",""),\ "filterActive": self._params.get("filterActive",""),\ "loginAsURL": self.getLoginAsURL(), "dark": True } ) def _applyDecoration( self, body ): """ """ if self._params.get("frame","")=="no" or self._params.get("fr","")=="no": if self._view in ["xml","text","jacow"]: return body else: return WPrintPageFrame().getHTML({"content":body}) return WPConferenceBase._applyDecoration(self, body) def _getHTMLFooter( self ): if (self._view in ["xml","text","jacow"]) and (self._params.get("frame","")=="no" or self._params.get("fr","")=="no"): return "" return WPConferenceBase._getHTMLFooter(self) def _getBody( self, params ): pars = { \ "modifyURL": urlHandlers.UHConferenceModification.getURL( self._conf ), \ "minutesURL": urlHandlers.UHConferenceDisplayWriteMinutes.getURL(self._conf), \ "iCalURL": urlHandlers.UHConferenceToiCal.getURL(self._conf), \ "cloneURL": urlHandlers.UHConfClone.getURL( self._conf ), \ "sessionModifyURLGen": urlHandlers.UHSessionModification.getURL, \ "contribModifyURLGen": urlHandlers.UHContributionModification.getURL, \ "contribMinutesURLGen": urlHandlers.UHContributionDisplayWriteMinutes.getURL, \ "sessionMinutesURLGen": urlHandlers.UHSessionDisplayWriteMinutes.getURL, \ "subContribMinutesURLGen": urlHandlers.UHSubContributionDisplayWriteMinutes.getURL, \ "subContribModifyURLGen": urlHandlers.UHSubContribModification.getURL, \ "materialURLGen": urlHandlers.UHMaterialDisplay.getURL, \ "resourceURLGen": urlHandlers.UHFileAccess.getURL, \ "frame": self._params.get("frame","") or self._params.get("fr","") } if self._webcastadd: urladdwebcast = urlHandlers.UHWebcastAddWebcast.getURL() urladdwebcast.addParam("eventid",self._conf.getId()) pars['webcastAdminURL'] = urladdwebcast frame = self._params.get("frame","") != "no" and self._params.get("fr","") != "no" view = self._view outGen = outputGenerator(self._getAW()) path = Config.getInstance().getStylesheetsDir() if os.path.exists("%s.xsl" % (os.path.join(path,view))): minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance() tz = DisplayTZ(self._getAW(),self._conf).getDisplayTZ() useCache = minfo.isCacheActive() and frame 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() useNormalCache = useCache and self._conf.isFullyPublic() and not self._conf.canModify(self._getAW()) and self._getAW().getUser() == None useManagerCache = useCache and self._conf.canModify( self._getAW()) body = "" if useManagerCache: cache = EventCache({"id": self._conf.getId(), "type": "manager"}) body = cache.getCachePage() elif useNormalCache: cache = EventCache({"id": self._conf.getId(), "type": "normal"}) body = cache.getCachePage() if body == "": stylepath = "%s.xsl" % (os.path.join(path,view)) if self._params.get("detailLevel", "") == "contribution" or self._params.get("detailLevel", "") == "": includeContribution = 1 else: includeContribution = 0 pars.update({'firstDay':self._firstDay, 'lastDay':self._lastDay, 'daysPerRow':self._daysPerRow}) body = outGen.getFormattedOutput(self._conf,stylepath,pars,1,includeContribution,1,1,self._params.get("showSession",""),self._params.get("showDate","")) if useManagerCache or useNormalCache: cache.saveCachePage( body ) if not frame: html = body else: html = """ %s %s %s """%(wcomponents.WErrorMessage().getHTML(params), \ wcomponents.WInfoMessage().getHTML(params), \ body) return html else: return _("Cannot find the %s stylesheet") % view def _defineSectionMenu( self ): WPConferenceDefaultDisplayBase._defineSectionMenu(self) self._sectionMenu.setCurrentItem(self._overviewOpt) class WPrintPageFrame ( wcomponents.WTemplated ): pass class WConfProgramTrack(wcomponents.WTemplated): def __init__( self, aw, track ): self._aw = aw self._track = track def getVars( self ): vars = wcomponents.WTemplated.getVars( self ) vars["bulletURL"] = Config.getInstance().getSystemIconURL( "track_bullet" ) mgtIconHTML = "" if self._track.getConference().getAbstractMgr().isActive() and self._track.getConference().hasEnabledSection("cfa") and self._track.canCoordinate( self._aw ): url = urlHandlers.UHTrackModifAbstracts.getURL( self._track ) if self._track.getConference().canModify( self._aw ): url = urlHandlers.UHTrackModification.getURL( self._track ) mgtIconHTML = """Enter in track management area """%(url, Config.getInstance().getSystemIconURL( "modify" )) vars["mgtIcon"] = mgtIconHTML vars["title"] = self._track.getTitle() vars["coordinators"] = "" vars["description"] = self._track.getDescription() subtracks = [] for subtrack in self._track.getSubTrackList(): subtracks.append( "%s"%subtrack.getTitle() ) vars["subtracks"] = "" if subtracks: vars["subtracks"] = _(""" _("Sub-tracks"): %s""")%", ".join( subtracks ) return vars class WConfProgram(wcomponents.WTemplated): def __init__(self, aw, conf): self._conf = conf self._aw = aw def getVars( self ): vars = wcomponents.WTemplated.getVars( self ) vars["description"] = self._conf.getProgramDescription() program = [] for track in self._conf.getTrackList(): program.append( WConfProgramTrack( self._aw, track ).getHTML() ) vars["program"] = "".join( program ) return vars class WPConferenceProgram( WPConferenceDefaultDisplayBase ): def _getBody( self, params ): wc = WConfProgram( self._getAW(), self._conf ) return wc.getHTML() def _defineSectionMenu( self ): WPConferenceDefaultDisplayBase._defineSectionMenu( self ) self._sectionMenu.setCurrentItem(self._programOpt) def _defineToolBar(self): pdf=wcomponents.WTBItem( _("get PDF of the programme"), icon=Config.getInstance().getSystemIconURL("pdf"), actionURL=urlHandlers.UHConferenceProgramPDF.getURL(self._conf)) if len(self._conf.getTrackList()) > 0: self._toolBar.addItem(pdf) class WInternalPageDisplay(wcomponents.WTemplated): def __init__(self, conf, page): self._conf = conf self._page=page def getVars( self ): vars = wcomponents.WTemplated.getVars( self ) vars["content"] = self._page.getContent() return vars class WPInternalPageDisplay( WPConferenceDefaultDisplayBase ): def __init__( self, rh, conference, page ): WPConferenceDefaultDisplayBase.__init__( self, rh, conference ) self._page = page def _getBody( self, params ): wc = WInternalPageDisplay( self._conf, self._page ) return wc.getHTML() def _defineSectionMenu( self ): WPConferenceDefaultDisplayBase._defineSectionMenu(self) for link in self._sectionMenu.getAllLinks(): if link.getType() == 'page' and link.getPage().getId() == self._page.getId(): self._sectionMenu.setCurrentItem(link) break class WConferenceTimeTable(wcomponents.WTemplated): def __init__( self, conference, aw ): self._conf = conference self._aw = aw def getVars( self ): vars = wcomponents.WTemplated.getVars( self ) tz = DisplayTZ(self._aw,self._conf).getDisplayTZ() vars["ttdata"] = simplejson.dumps(schedule.ScheduleToJson.process(self._conf.getSchedule(), tz, self._aw, useAttrCache = True)) eventInfo = fossilize(self._conf, IConferenceEventInfoFossil, tz = tz) eventInfo['isCFAEnabled'] = self._conf.getAbstractMgr().isActive() vars['eventInfo'] = simplejson.dumps(eventInfo) vars['timetableLayout'] = vars.get('ttLyt','') return vars class WConferenceRoomTimeTable(WConferenceTimeTable): def _blankEntryHTML( self ): return """ """ def _getEntryHTML(self,entry,refDay): if isinstance(entry,schedule.LinkedTimeSchEntry): if isinstance(entry.getOwner(),conference.SessionSlot): return self._getSessionHTML(entry.getOwner(),self._sessionURLGen(entry.getOwner()),refDay) if isinstance(entry.getOwner(), conference.Contribution): return self._getContributionHTML(entry.getOwner(), \ self._contribURLGen(entry.getOwner())) elif isinstance(entry,schedule.BreakTimeSchEntry): return self._getBreakHTML(entry) else: return self._blankEntryHTML() def _getHTMLTimeTable( self, highDetailLevel=0 ): self._sessionColorMap = {} daySch = [] num_slots_in_hour=int(timedelta(hours=1).seconds/self._timeTable.getSlotLength().seconds) tzUtil = DisplayTZ(self._aw,self._conf) tz = tzUtil.getDisplayTZ() for day in self._timeTable.getDayList(): self._sessionColorMap.clear() emptyDay=True slotList=[] lastEntries=[] roomList=[] maxOverlap=day.getNumMaxOverlaping() width="100" if maxOverlap!=0: width=100/maxOverlap else: maxOverlap=1 # Make a list of all the Rooms used in that day unknown =False for hour in range(day.getStartHour(),day.getEndHour()+1): for slot in day.getSlotsOnHour(hour): entryList=slot.getEntryList() for entry in entryList: room = entry.getOwner().getRoom() if room != None: if room.getName() not in roomList: roomList.append(room.getName()) if room ==None and not isinstance(entry,schedule.BreakTimeSchEntry): unknown=True else: continue if unknown: roomList.append( _("Room Unknown")) for hour in range(day.getStartHour(),day.getEndHour()+1): hourSlots=[] emptyHour = True #Order the entries based on the room order for slot in day.getSlotsOnHour(hour): entryOrder=[] for i in range(0,(len(roomList))): entryOrder.append(i) entryList=slot.getEntryList() remColSpan=maxOverlap temp=[] for ent in entryList: roomname =None room = ent.getOwner().getRoom() if room !=None: roomname = room.getName() elif not isinstance(ent,schedule.BreakTimeSchEntry): roomname = _("Room Unknown") if entryOrder != []: if roomname !=None: if roomname in roomList: pos =roomList.index(roomname) try: entryOrder[pos]=ent except TypeError,e: continue except IndexError,e: entryOrder if not isinstance(ent,schedule.BreakTimeSchEntry): entryOrder.append(ent) elif isinstance(ent,schedule.BreakTimeSchEntry): entryOrder=[] entryOrder.append(ent) #Create the timetable for entry in entryOrder: emptyHour = False emptyDay = False if entry in lastEntries: continue bgcolor=self._getColor(entry) textcolor=self._getTextColor(entry) colspan=""" colspan="1" """ if isinstance(entry,schedule.BreakTimeSchEntry): colspan = """ colspan="%s" """%len(roomList) temp.append("""%s"""%(day.getNumSlots(entry),bgcolor,colspan,textcolor,self._getEntryHTML(entry,day))) if type(entry) != int: lastEntries.append(entry) if slot.getAdjustedStartDate().minute==0: hourSlots.append(""" %02i:00 %s """%(num_slots_in_hour,\ hour,\ "".join(temp))) else: if len(temp) == 0: temp = [""] hourSlots.append("""%s"""%"".join(temp)) if emptyHour: slotList.append(""" %02i:00   """ % hour) else: slotList.append("".join(hourSlots)) legend="" roomhtml =[] if roomList !=[]: roomhtml.append( _(""" _("Room")""")) for room in roomList: if room != "": roomhtml.append("""%s"""%room) #if len(roomList) < len(entryOrder): # roomhtml.append("""Unknown Room""") if highDetailLevel: legend=self._getColorLegendHTML() if not emptyDay: str="""
    %s %s
    %s
    %s
    """%(len(roomList),\ day.getDate().strftime("%A, %d %B %Y"),\ len(roomList),legend,"".join(roomhtml), \ "".join(slotList) ) daySch.append(str) str = "
    ".join( daySch ) return str class WConferenceSessionTimeTable(WConferenceTimeTable): def _blankEntryHTML( self ): return """ """ def _getEntryHTML(self,entry,refDay): if isinstance(entry,schedule.LinkedTimeSchEntry): if isinstance(entry.getOwner(),conference.SessionSlot): return self._getSessionHTML(entry.getOwner(),self._sessionURLGen(entry.getOwner()),refDay) if isinstance(entry.getOwner(), conference.Contribution): return self._getContributionHTML(entry.getOwner(), \ self._contribURLGen(entry.getOwner())) elif isinstance(entry,schedule.BreakTimeSchEntry): return self._getBreakHTML(entry) else: return self._blankEntryHTML() def _getHTMLTimeTable( self, highDetailLevel=0 ): self._sessionColorMap = {} daySch = [] num_slots_in_hour=int(timedelta(hours=1).seconds/self._timeTable.getSlotLength().seconds) tzUtil = DisplayTZ(self._aw,self._conf) tz = tzUtil.getDisplayTZ() for day in self._timeTable.getDayList(): self._sessionColorMap.clear() emptyDay=True slotList=[] lastEntries=[] sessionList=[] maxOverlap=day.getNumMaxOverlaping() width="100" if maxOverlap!=0: width=100/maxOverlap else: maxOverlap=1 # Make a list of all the sessions used in that day unknown =False for hour in range(day.getStartHour(),day.getEndHour()+1): for slot in day.getSlotsOnHour(hour): entryList=slot.getEntryList() for entry in entryList: session = entry.getOwner().getSession() if session != None: if session.getTitle() not in sessionList: sessionList.append(session.getTitle()) if session ==None and not isinstance(entry,schedule.BreakTimeSchEntry): unknown=True else: continue if unknown: sessionList.append( _("Session Unknown")) for hour in range(day.getStartHour(),day.getEndHour()+1): hourSlots=[] emptyHour = True #Order the entries based on the session order for slot in day.getSlotsOnHour(hour): entryOrder=[] for i in range(0,(len(sessionList))): entryOrder.append(i) entryList=slot.getEntryList() remColSpan=maxOverlap temp=[] for ent in entryList: sessionname =None session = ent.getOwner().getSession() if session !=None: sessionname = session.getTitle() elif not isinstance(ent,schedule.BreakTimeSchEntry): sessionname = _("Session Unknown") if entryOrder != []: if sessionname !=None: if sessionname in sessionList: pos =sessionList.index(sessionname) try: entryOrder[pos]=ent except TypeError,e: continue except IndexError,e: entryOrder if not isinstance(ent,schedule.BreakTimeSchEntry): entryOrder.append(ent) elif isinstance(ent,schedule.BreakTimeSchEntry): entryOrder=[] entryOrder.append(ent) #Create the timetable for entry in entryOrder: emptyHour = False emptyDay = False if entry in lastEntries: continue bgcolor=self._getColor(entry) textcolor=self._getTextColor(entry) colspan=""" colspan="1" """ if isinstance(entry,schedule.BreakTimeSchEntry): colspan = """ colspan="%s" """%len(sessionList) temp.append("""%s"""%(day.getNumSlots(entry),bgcolor,colspan,textcolor,self._getEntryHTML(entry,day))) if type(entry) != int: lastEntries.append(entry) if slot.getAdjustedStartDate().minute==0: hourSlots.append(""" %02i:00 %s """%(num_slots_in_hour,\ hour,\ "".join(temp))) else: if len(temp) == 0: temp = [""] hourSlots.append("""%s"""%"".join(temp)) if emptyHour: slotList.append(""" %02i:00   """ % hour) else: slotList.append("".join(hourSlots)) legend="" sessionhtml =[] if sessionList !=[]: sessionhtml.append( _(""" _("session")""")) for session in sessionList: if session != "": sessionhtml.append("""%s"""%session) #if len(sessionList) < len(entryOrder): # sessionhtml.append("""Unknown session""") # if highDetailLevel: # legend=self._getColorLegendHTML() if not emptyDay: str="""
    %s %s
    %s
    %s
    """%(len(sessionList),\ day.getDate().strftime("%A, %d %B %Y"),\ len(sessionList),legend,"".join(sessionhtml), \ "".join(slotList) ) daySch.append(str) str = "
    ".join( daySch ) return str class WConferencePlainTimeTable(WConferenceTimeTable): def _getContributionHTML( self, contribution, URL ): speakerList = [] for speaker in contribution.getSpeakerList(): spkcapt=speaker.getDirectFullName() if speaker.getAffiliation().strip() != "": spkcapt="%s (%s)"%(spkcapt, speaker.getAffiliation()) speakerList.append(spkcapt) sDate = contribution.getAdjustedStartDate() eDate = contribution.getAdjustedEndDate() contrStr = """ %s-%s (%s) [%s] %s %s """%(sDate.strftime("%H:%M"), \ eDate.strftime("%H:%M"), \ (datetime(1900,1,1)+contribution.getDuration()).strftime("%Hh%M'"), \ self.htmlText(contribution.getId()), URL, self.htmlText(contribution.getTitle()), "
    ".join(speakerList) ) return contrStr def _getSessionSlotHTML(self,event,URL,refDay): sesSlot=event.getOwner() session=sesSlot.getSession() room="" if sesSlot.getRoom()!=None: room = """ Room: %s """%(session.getTextColor(),session.getTextColor(),sesSlot.getRoom().getName()) convenerList = [] for convener in sesSlot.getConvenerList(): convcapt=convener.getDirectFullName() if convener.getAffiliation().strip() != "": convcapt="%s (%s)"%(convcapt, convener.getAffiliation()) convenerList.append(convcapt) if len(convenerList)==0: for convener in session.getConvenerList(): convcapt=convener.getDirectFullName() if convener.getAffiliation().strip() != "": convcapt="%s (%s)"%(convcapt, convener.getAffiliation()) convenerList.append(convcapt) conveners = "" if len(convenerList) != 0: conveners = _(""" _("Conveners"): %s """)%(session.getTextColor(),session.getTextColor(),"
    ".join(convenerList)) materialList = [] for material in session.getMaterialList(): materialList.append(material.getTitle()) materials = "" if len(materialList) != 0: materials = _(""" _("Material"): %s """)%(session.getTextColor(),session.getTextColor(),"
    ".join(materialList)) currentUser = self._aw._currentUser tz = DisplayTZ(self._aw,self._conf).getDisplayTZ() sDate = event.getAdjustedStartDate(tz) eDate = event.getAdjustedEndDate(tz) timeInterval = " (%s-%s)"%( \ sDate.strftime("%H:%M"), \ eDate.strftime("%H:%M") ) if event.getAdjustedStartDate(tz).strftime("%d%B%Y") != \ refDay.getDate().strftime("%d%B%Y") : if event.getAdjustedEndDate(tz).strftime("%d%B%Y") != \ refDay.getDate().strftime("%d%B%Y") : timeInterval = "" else: timeInterval = "
    (until %s)"%(eDate.strftime("%H:%M")) else: if event.getAdjustedEndDate(tz).strftime("%d%B%Y") != \ refDay.getDate().strftime("%d%B%Y") : timeInterval = "
    (from %s)"%(sDate.strftime("%H:%M")) title = self.htmlText(event.getTitle()) linkColor="" if session.isTextColorToLinks(): linkColor="color:%s"%session.getTextColor() return """
    %s%s %s %s %s
    """%(session.getTextColor(), URL, linkColor, title,timeInterval,conveners,room,materials) def _getBreakHTML( self, breakEntry ): tz = DisplayTZ(self._aw,self._conf).getDisplayTZ() sDate = breakEntry.getAdjustedStartDate(tz) eDate = breakEntry.getAdjustedEndDate(tz) return """ %s-%s (%s) %s """%(sDate.strftime("%H:%M"), \ eDate.strftime("%H:%M"), \ (datetime(1900,1,1)+breakEntry.getDuration()).strftime("%Hh%M'"), \ breakEntry.getTitle()) def _getEntryHTML(self,entry,refDay): if isinstance(entry,timetable.SessionSlot): return self._getSessionSlotHTML(entry,self._sessionURLGen(entry.getOwner()),refDay) elif isinstance(entry, timetable.ConfEntry): if not entry.isBreak(): return self._getContributionHTML(entry.getOwner(), \ self._contribURLGen(entry.getOwner())) else: return self._getBreakHTML(entry) elif isinstance(entry, schedule.LinkedTimeSchEntry): return self._getContributionHTML(entry.getOwner(), \ self._contribURLGen(entry.getOwner())) else: return self._getBreakHTML(entry) def _getHTMLTimeTable(self,highDetailLevel=0): daySch = [] tzUtil = DisplayTZ(self._aw,self._conf) tz = tzUtil.getDisplayTZ() for day in self._timeTable.getDayList(): emptyDay = True eventList=[] c=0 for event in day.getEventList(): emptyDay = False temp=[] if isinstance(event,timetable.SessionSlot): entries=[] if highDetailLevel: for entry in event.getEntryList(): entries.append(""" %s     """%(self._getEntryHTML(entry,day) ) ) sesStr = """ %s
    %s
      """%(event.getOwner().getColor(),self._getEntryHTML(event,day),"".join(entries)) eventList.append(sesStr) else: temp.append("""%s    """%(self._getEntryHTML(event,day) ) ) eventList.append("".join(temp)) if not emptyDay: str="""
    %s
     
    %s
    """%(day.getDate().strftime("%A, %d %B %Y"), \ "".join(eventList)) daySch.append(str) str = "
    ".join( daySch ) return str class ContainerIndexItem: def __init__(self, container, day): self._overlap = container.getMaxOverlap(day) self._startPosition = -1 self._entryList = [] for i in range(0,self._overlap): self._entryList.append(None) def setStartPosition(self, counter): self._startPosition = counter def getStartPosition(self): return self._startPosition def setEntryList(self, newEntryList): # -- Remove the ones which are not in the new entry list i = 0 for entry in self._entryList: if entry not in newEntryList: self._entryList[i] = None i += 1 # -- Add the new ones to the new entry list for newEntry in newEntryList: if newEntry not in self._entryList: i = 0 for entry in self._entryList: if entry == None: self._entryList[i] = newEntry break i += 1 def getEntryIndex(self, i): return self._startPosition + i def getEntryByPosition(self, i): if i >= 0 and i < len(self._entryList): return self._entryList[i] return 0 def getOverlap(self): return self._overlap class ContainerIndex: def __init__(self, containerIndex = {}, day = None, hasOverlap = True): self._containerIndex = containerIndex self._day = day self._rowsCounter = 0 self._hasOverlap = hasOverlap def initialization(self, day, hasOverlap = True): self._containerIndex={} self._day = day self._rowsCounter = 0 self._hasOverlap = hasOverlap def hasOverlap(self): return self._hasOverlap def setHasOverlap(self, hasOverlap): self._hasOverlap = hasOverlap def addContainer(self, container): if not self._containerIndex.has_key(container): item = ContainerIndexItem(container, self._day) item.setStartPosition(self._rowsCounter) if self.hasOverlap(): self._rowsCounter += item.getOverlap() self._containerIndex[container] = item def setContainerEntries(self, container, entryList): if self._containerIndex.has_key(container): self._containerIndex[container].setEntryList(entryList) def getEntryIndex(self, container, i): if self._containerIndex.has_key(container): contItem = self._containerIndex[container] return contItem.getEntryIndex(i) return 0 def getEntryByPosition(self, container, i): if self._containerIndex.has_key(container): contItem = self._containerIndex[container] return contItem.getEntryByPosition(i) return 0 def getMaxOverlap(self, container): if self._containerIndex.has_key(container): contItem = self._containerIndex[container] return contItem.getOverlap() return 0 def getStartPosition(self, container): if self._containerIndex.has_key(container): contItem = self._containerIndex[container] return contItem.getStartPosition() return 0 def getLastPosition(self): lastPos = 0 for cont in self._containerIndex.values(): startPos = cont.getStartPosition() if startPos >= lastPos: lastPos = startPos + cont.getOverlap() return lastPos class WConferenceHighDetailTimeTable(WConferenceTimeTable): def _initTempList(self, max, defaultValue=None): t = [] for i in range(0, max): t.append(defaultValue) return t def _getHTMLTimeTable( self, highDetailLevel=0 ): containerIndex = ContainerIndex() daySch = [] num_slots_in_hour=int(timedelta(hours=1).seconds/self._timeTable.getSlotLength().seconds) hourSlots,hourNeedsDisplay = [],False for day in self._timeTable.getDayList(): emptyDay = True self._sessionColorMap.clear() slotList=[] lastEntries=[] maxOverlap=day.getContainerMaxOverlap() if not day.hasContainerOverlaps(): maxOverlap = day.getNumMaxOverlaping() or 1 width="100" if maxOverlap!=0: width=100/maxOverlap numMaxEntriesSlot=maxOverlap#day.getNumMaxOverlaping() containerIndex.initialization(day,day.hasContainerOverlaps()) for slot in day.getSlotList(): if slot.getAdjustedStartDate().minute==0: if hourNeedsDisplay: slotList.append("".join(hourSlots)) hourSlots,hourNeedsDisplay=[],False temp=self._initTempList(maxOverlap,""""""%width) for container in slot.getContainerList(): emptyDay = False hourNeedsDisplay=True containerIndex.addContainer(container) entryList=slot.getContainerEntries(container) containerIndex.setContainerEntries(container,entryList) maxoverlapContainer=containerIndex.getMaxOverlap(container) for i in range(0,maxoverlapContainer): entry=containerIndex.getEntryByPosition(container,i) entryIndex=containerIndex.getEntryIndex(container,i) if entry and (entry in lastEntries): temp[entryIndex] = "" continue bgcolor=self._getColor(entry) textcolor=self._getTextColor(entry) colspan="" if isinstance(entry,schedule.BreakTimeSchEntry) and \ len(entryList)==1: colspan=""" colspan="%s" """%maxoverlapContainer if entry: if not day.hasEntryOverlaps(entry) and \ len(slot.getEntryList()) == 1: entryIndex=0 colspan=""" colspan="%s" """%(numMaxEntriesSlot) for j in range(0, len(temp)): temp[j]="" temp[entryIndex] = """%s"""%(day.getNumSlots(entry),bgcolor,textcolor,width,colspan,self._getEntryHTML(entry,day)) lastEntries.append(entry) # --- Entries of the conference which are not inside any container(session slot) confEntries = slot.getEntriesWithoutContainer() if confEntries != []: hourNeedsDisplay=True if slot.getContainerList() == []: entryIndex=0 for j in range(0, len(temp)): temp[j]="" else: entryIndex = containerIndex.getLastPosition() if entryIndex >= len(temp): for entry in confEntries: temp.append("") for entry in confEntries: if entry and (entry in lastEntries): temp[entryIndex] = "" continue bgcolor=self._getColor(entry) textcolor=self._getTextColor(entry) colspan="" if not day.hasEntryOverlaps(entry): colspan=""" colspan="%s" """%(numMaxEntriesSlot) for j in range(entryIndex, len(temp)): temp[j] = "" if entry: temp[entryIndex] = """%s"""%(day.getNumSlots(entry),bgcolor,textcolor,width,colspan,self._getEntryHTML(entry,day)) entryIndex += 1 lastEntries.append(entry) # ---. if slot.getAdjustedStartDate().minute==0: str=""" %s %s """%(num_slots_in_hour,\ slot.getAdjustedStartDate().strftime("%H:%M"),\ "".join(temp)) else: if len(temp) == 0: temp = [""] str = """%s"""%"".join(temp) hourSlots.append(str) if hourNeedsDisplay: slotList.append("".join(hourSlots)) hourSlots,hourNeedsDisplay=[],False if not emptyDay: legend="" if highDetailLevel: legend=self._getColorLegendHTML() str="""
    %s
    %s
    %s
    """%(maxOverlap+3,\ day.getDate().strftime("%A, %d %B %Y"), \ maxOverlap+3, legend,\ "".join(slotList) ) daySch.append(str) str = "
    ".join( daySch ) return str #class WMeetingHighDetailTimeTable(WConferenceTimeTable): # # def getVars( self ): # vars = wcomponents.WTemplated.getVars( self ) # self._contribURLGen = vars["contribURLGen"] # self._sessionURLGen = vars["sessionURLGen"] # vars["title"] = self._conf.getTitle() # vars["timetable"] = self._getHTMLTimeTable(1) # return vars class WPConferenceTimeTable( WPConferenceDefaultDisplayBase ): navigationEntry = navigation.NEConferenceTimeTable def getJSFiles(self): return WPConferenceDefaultDisplayBase.getJSFiles(self) + \ self._includeJSPackage('Timetable') def _getBody( self, params ): wc = WConferenceTimeTable( self._conf, self._getAW() ) return wc.getHTML(params) def _defineSectionMenu( self ): WPConferenceDefaultDisplayBase._defineSectionMenu( self ) self._sectionMenu.setCurrentItem(self._timetableOpt) def _getHeadContent( self ): headContent=WPConferenceDefaultDisplayBase._getHeadContent(self) baseurl = Config.getInstance().getBaseURL() return """ %s """ % ( headContent, baseurl) #class WMeetingTimeTable(WConferenceTimeTable): # # def getVars( self ): # vars = wcomponents.WTemplated.getVars( self ) # self._contribURLGen = vars["contribURLGen"] # self._sessionURLGen = vars["sessionURLGen"] # vars["title"] = self._conf.getTitle() # vars["timetable"] = self._getHTMLTimeTable(0) # return vars class WPMeetingTimeTable( WPXSLConferenceDisplay ): def getJSFiles(self): return WPXSLConferenceDisplay.getJSFiles(self) + \ self._includeJSPackage('Timetable') def _getBody( self, params ): wc = WConferenceTimeTable( self._conf, self._getAW() ) return wc.getHTML(params) class WPConferenceModifBase( main.WPMainBase, OldObservable ): _userData = ['favorite-user-ids'] def __init__( self, rh, conference ): main.WPMainBase.__init__( self, rh ) self._navigationTarget = self._conf = conference self._parentCateg = None categId = rh._getSession().getVar("currentCategoryId") if categId != None: self._parentCateg = self._conf.getOwnerById(categId) def getJSFiles(self): return main.WPMainBase.getJSFiles(self) + \ self._includeJSPackage('Management') + \ self._includeJSPackage('MaterialEditor') def _getSiteArea(self): return "ModificationArea" def _getHeader( self ): """ """ wc = wcomponents.WHeader( self._getAW() ) return wc.getHTML( { "subArea": self._getSiteArea(), \ "loginURL": self._escapeChars(str(self.getLoginURL())),\ "logoutURL": self._escapeChars(str(self.getLogoutURL())),\ "loginAsURL": self.getLoginAsURL() } ) def _getNavigationDrawer(self): pars = {"target": self._conf, "isModif": True } return wcomponents.WNavigationDrawer( pars, bgColor="white" ) def _createSideMenu(self): self._sideMenu = wcomponents.ManagementSideMenu() # The main section containing most menu items self._generalSection = wcomponents.SideMenuSection() self._generalSettingsMenuItem = wcomponents.SideMenuItem(_("General settings"), urlHandlers.UHConferenceModification.getURL( self._conf )) self._generalSection.addItem( self._generalSettingsMenuItem) self._timetableMenuItem = wcomponents.SideMenuItem(_("Timetable"), urlHandlers.UHConfModifSchedule.getURL( self._conf )) self._generalSection.addItem( self._timetableMenuItem) self._materialMenuItem = wcomponents.SideMenuItem(_("Material"), urlHandlers.UHConfModifShowMaterials.getURL( self._conf )) self._generalSection.addItem( self._materialMenuItem) self._roomBookingMenuItem = wcomponents.SideMenuItem(_("Room booking"), urlHandlers.UHConfModifRoomBookingList.getURL( self._conf )) self._generalSection.addItem( self._roomBookingMenuItem) self._programMenuItem = wcomponents.SideMenuItem(_("Programme"), urlHandlers.UHConfModifProgram.getURL( self._conf )) self._generalSection.addItem( self._programMenuItem) self._abstractMenuItem = wcomponents.SideMenuItem(_("Call for Abstracts"), urlHandlers.UHConfModifCFA.getURL( self._conf )) self._generalSection.addItem( self._abstractMenuItem) self._contribListMenuItem = wcomponents.SideMenuItem(_("Contributions"), urlHandlers.UHConfModifContribList.getURL( self._conf )) self._generalSection.addItem( self._contribListMenuItem) self._reviewingMenuItem = wcomponents.SideMenuItem(_("Reviewing"), urlHandlers.UHConfModifReviewingAccess.getURL( target = self._conf ) ) self._generalSection.addItem( self._reviewingMenuItem) self._regFormMenuItem = wcomponents.SideMenuItem(_("Registration"), urlHandlers.UHConfModifRegForm.getURL( self._conf )) self._generalSection.addItem( self._regFormMenuItem) self._pluginsDictMenuItem = {} self._notify('fillManagementSideMenu', self._pluginsDictMenuItem) for element in self._pluginsDictMenuItem.values(): try: self._generalSection.addItem( element) except Exception, e: Logger.get('Conference').error("Exception while trying to access the plugin elements of the side menu: %s" %str(e)) if self._conf.getCSBookingManager() is not None and self._conf.getCSBookingManager().isCSAllowed(self._rh.getAW().getUser()): from MaKaC.plugins.Collaboration.collaborationTools import CollaborationTools self._videoServicesMenuItem = wcomponents.SideMenuItem(_("Video Services"), urlHandlers.UHConfModifCollaboration.getURL(self._conf, secure = CollaborationTools.isUsingHTTPS())) self._generalSection.addItem( self._videoServicesMenuItem) else: self._videoServicesMenuItem = wcomponents.SideMenuItem(_("Video Services"), None) self._generalSection.addItem( self._videoServicesMenuItem) self._videoServicesMenuItem.setVisible(False) self._participantsMenuItem = wcomponents.SideMenuItem(_("Participants"), urlHandlers.UHConfModifParticipants.getURL( self._conf ) ) self._generalSection.addItem( self._participantsMenuItem) self._evaluationMenuItem = wcomponents.SideMenuItem(_("Evaluation"), urlHandlers.UHConfModifEvaluation.getURL( self._conf ) ) self._generalSection.addItem( self._evaluationMenuItem) self._sideMenu.addSection(self._generalSection) # The section containing all advanced options self._advancedOptionsSection = wcomponents.SideMenuSection(_("Advanced options")) self._listingsMenuItem = wcomponents.SideMenuItem(_("Lists"), urlHandlers.UHConfModifListings.getURL( self._conf ) ) self._advancedOptionsSection.addItem( self._listingsMenuItem) self._ACMenuItem = wcomponents.SideMenuItem(_("Protection"), urlHandlers.UHConfModifAC.getURL( self._conf ) ) self._advancedOptionsSection.addItem( self._ACMenuItem) self._toolsMenuItem = wcomponents.SideMenuItem(_("Tools"), urlHandlers.UHConfModifTools.getURL( self._conf ) ) self._advancedOptionsSection.addItem( self._toolsMenuItem) self._layoutMenuItem = wcomponents.SideMenuItem(_("Layout"), urlHandlers.UHConfModifDisplay.getURL(self._conf)) self._advancedOptionsSection.addItem( self._layoutMenuItem) self._logMenuItem = wcomponents.SideMenuItem(_("Logs"), urlHandlers.UHConfModifLog.getURL( self._conf ) ) self._advancedOptionsSection.addItem( self._logMenuItem) self._sideMenu.addSection(self._advancedOptionsSection) #we decide which side menu item appear and which don't from MaKaC.webinterface.rh.reviewingModif import RCPaperReviewManager, RCAbstractManager, RCReviewingStaff from MaKaC.webinterface.rh.collaboration import RCVideoServicesManager, RCCollaborationAdmin, RCCollaborationPluginAdmin canModify = self._conf.canModify(self._rh.getAW()) isReviewingStaff = RCReviewingStaff.hasRights(self._rh) isPRM = RCPaperReviewManager.hasRights(self._rh) isAM = RCAbstractManager.hasRights(self._rh) isRegistrar = self._conf.canManageRegistration(self._rh.getAW().getUser()) if not canModify: self._generalSettingsMenuItem.setVisible(False) self._timetableMenuItem.setVisible(False) self._materialMenuItem.setVisible(False) self._programMenuItem.setVisible(False) self._participantsMenuItem.setVisible(False) self._listingsMenuItem.setVisible(False) self._layoutMenuItem.setVisible(False) self._ACMenuItem.setVisible(False) self._toolsMenuItem.setVisible(False) self._logMenuItem.setVisible(False) self._evaluationMenuItem.setVisible(False) if not (info.HelperMaKaCInfo.getMaKaCInfoInstance().getRoomBookingModuleActive() and canModify): self._roomBookingMenuItem.setVisible(False) if not (self._conf.hasEnabledSection("cfa") and (canModify or isAM)): self._abstractMenuItem.setVisible(False) if not (canModify or isPRM): self._contribListMenuItem.setVisible(False) if not (self._conf.hasEnabledSection("regForm") and (canModify or isRegistrar)): self._regFormMenuItem.setVisible(False) if not (self._conf.getType() == "conference" and (canModify or isReviewingStaff)): self._reviewingMenuItem.setVisible(False) else: #reviewing tab is enabled if isReviewingStaff and not canModify: self._reviewingMenuItem.setVisible(True) # For now we don't want the paper reviewing to be displayed #self._reviewingMenuItem.setVisible(False) if not (canModify or RCVideoServicesManager.hasRights(self._rh, 'any') or RCCollaborationAdmin.hasRights(self._rh) or RCCollaborationPluginAdmin.hasRights(self._rh, plugins = 'any')): self._videoServicesMenuItem.setVisible(False) #we hide the Advanced Options section if it has no items if not self._advancedOptionsSection.hasVisibleItems(): self._advancedOptionsSection.setVisible(False) # we disable the Participants section for events of type conference if self._conf.getType() == 'conference': self._participantsMenuItem.setVisible(False) # make sure that the section evaluation is always activated # for all conferences self._conf.enableSection("evaluation") wf = self._rh.getWebFactory() if wf: wf.customiseSideMenu( self ) def _setActiveSideMenuItem( self ): pass def _applyFrame( self, body ): frame = wcomponents.WConferenceModifFrame( self._conf, self._getAW()) sideMenu = self._sideMenu.getHTML() p = { "categDisplayURLGen": urlHandlers.UHCategoryDisplay.getURL, \ "confDisplayURLGen": urlHandlers.UHConferenceDisplay.getURL, \ "event": "Conference", "sideMenu": sideMenu } wf = self._rh.getWebFactory() if wf: p["event"]=wf.getName() return frame.getHTML( body, **p ) def _getBody( self, params ): self._createSideMenu() self._setActiveSideMenuItem() return self._applyFrame( self._getPageContent( params ) ) def _getTabContent( self, params ): return "nothing" def _getPageContent( self, params ): return "nothing" class WPConferenceModifAbstractBase( WPConferenceModifBase ): def __init__(self, rh, conf): WPConferenceModifBase.__init__(self, rh, conf) def _createTabCtrl(self): self._tabCtrl = wcomponents.TabControl() self._tabCFA = self._tabCtrl.newTab( "cfasetup", _("Setup"), urlHandlers.UHConfModifCFA.getURL( self._conf ) ) self._tabCFAPreview = self._tabCtrl.newTab("cfapreview", _("Preview"), urlHandlers.UHConfModifCFAPreview.getURL(self._conf)) self._tabAbstractList = self._tabCtrl.newTab( "abstractList", _("List of Abstracts"), urlHandlers.UHConfAbstractList.getURL( self._conf ) ) self._tabBOA = self._tabCtrl.newTab("boa", _("Book of Abstracts Setup"), urlHandlers.UHConfModAbstractBook.getURL(self._conf)) if not self._conf.hasEnabledSection("cfa"): self._tabBOA.disable() self._tabCFA.disable() self._tabAbstractList.disable() self._tabCFAPreview.disable() self._setActiveTab() def _getPageContent(self, params): self._createTabCtrl() return wcomponents.WTabControl( self._tabCtrl, self._getAW() ).getHTML( self._getTabContent( params ) ) def _setActiveSideMenuItem(self): self._abstractMenuItem.setActive() def _getTabContent(self, params): return "nothing" def _setActiveTab(self): pass class WConfModifClosed(wcomponents.WTemplated): def __init__(self): pass def getVars(self): vars = wcomponents.WTemplated.getVars(self) vars["closedIconURL"] = Config.getInstance().getSystemIconURL("closed") return vars ############# Start of old collaboration related ############################## class WBookingSystems( wcomponents.WTemplated ): def getVars( self ): vars = wcomponents.WTemplated.getVars( self ) vars["vrvs"] = "VRVS" vars["mcu"] = "MCU" return vars class WBookingsList( wcomponents.WTemplated ): def __init__( self, conference ): self._conf= conference def _getBookingsHTML( self, booking ): url = urlHandlers. UHBookingDetail.getURL(booking) Title = booking.getTitle() Description = booking.getDescription() Starts = str(booking.getStartingDate().strftime("%Y-%m-%d") + ' at ' + booking.getStartingDate().strftime("%H:%M")) Ends = str(booking.getEndingDate().strftime("%Y-%m-%d") + ' at ' + booking.getEndingDate().strftime("%H:%M")) System = booking.getSystem() html =""" %s %s %s %s %s """ %(self.htmlText(booking.getId()), quoteattr(str(url)), self.htmlText(Title), self.htmlText(Description), self.htmlText(Starts), self.htmlText(Ends), self.htmlText(System) or " ") return html def getVars( self ): vars = wcomponents.WTemplated.getVars( self ) l=[] for b in self._conf.getBookingsList(True): l.append(self._getBookingsHTML(b)) vars["bookings"] = "".join(l) vars["numBookings"]= str(len(l)) vars["actionPostURL"]=quoteattr(str(urlHandlers.UHConfModifBookingAction.getURL(self._conf))) return vars class WPConfModifBookings( WPConferenceModifBase ): def __init__(self, rh, conf, bs): WPConferenceModifBase.__init__(self, rh, conf) self._bs = bs def _setActiveTab( self ): self._tabVideoServices.setActive() def _getTabContent( self, params ): p={} if self._bs.strip() == "": wc = WConfModifBookings( self._conf ) return wc.getHTML(p) elif self._bs.strip()=="VRVS": wc = WBookingsWarning(self._conf) return wc.getHTML(p) # elif self._bs.strip()=="MCU": # wc = importPlugin("Collaboration", "Hermes", "CreateComponent")(self._conf) # if (wc == None): # wc= WBookingsNotYetAvailable(self._conf) # return wc.getHTML(p) class WConfModifBookings( wcomponents.WTemplated ): def __init__( self, conference ): self._conf= conference def getVars( self ): vars = wcomponents.WTemplated.getVars( self ) wc1 = WBookingSystems() wc2 = WBookingsList(self._conf) vars["bookingSystems"] = wc1.getHTML() vars["listOfBookings"] = wc2.getHTML() vars["bookSystemURL"] =quoteattr(str(urlHandlers.UHConfModifBookings.getURL(self._conf))) return vars class WBookings (wcomponents.WTemplated): def __init__(self, conf): self._conf= conf def getVars (self): vars = wcomponents.WTemplated.getVars( self ) vars["title"], vars["description"] = self._conf.getTitle(), self._conf.getDescription() now = nowutc() vars["sDay"] = now.day vars["sMonth"] = now.month vars["sYear"] = now.year vars["sHour"] = "" vars["sMinute"] = "" vars["eDay"] = now.day vars["eMonth"] = now.month vars["eYear"] = now.year vars["eHour"], vars["eMinute"] = "", "" if self._conf.getLocation() and self._conf.getRoom(): location = self._conf.getLocation() room = self._conf.getRoom() vars["locationRoom"] = location.getName() + " - " + room.getName() else: vars["locationRoom"] = "" vars["event_type"] = "" vars["calendarIconURL"] = Config.getInstance().getSystemIconURL("calendar") vars["calendarSelectURL"] = urlHandlers.UHSimpleCalendar.getURL() vars["comments"]="" return vars class WHERMESParticipantList (wcomponents.WTemplated): pass class WHERMESParticipantCreation (wcomponents.WTemplated): def __init__( self, conference ): self._conf = conference def getVars (self): vars = wcomponents.WTemplated.getVars( self ) vars["participantName"] = "" vars["participantIpAddress"] = "" return vars class WPBookingsHERMES (WPConfModifBookings): def __init__( self, rh, conf ): WPConferenceModifBase.__init__(self, rh, conf) def _setActiveTab( self ): self._tabVideoServices.setActive() def _getTabContent( self, params ): p={"UserEmail": self._getAW().getUser().getEmail()} wc = WBookingsHERMES (self._conf) return wc.getHTML(p) class WPBookingsVRVS(WPConfModifBookings): def __init__( self, rh, conf ): WPConferenceModifBase.__init__(self, rh, conf) def _setActiveTab( self ): self._tabVideoServices.setActive() def _getTabContent( self, params ): if self._getAW().getUser(): p={"supportEmail": self._getAW().getUser().getEmail()} else: p={"supportEmail": ""} wc = WBookingsVRVS(self._conf) return wc.getHTML(p) class WBookingsVRVS(WBookings): def __init__( self, conference ): self._conf= conference def getVars( self ): vars = WBookings.getVars( self ) vars["vrvsLogin"] = "" vars["vrvsPasswd"] = "" vars["vrvsCommunity"] = "" vars["vrvsEmailAddress"] = "" vars["accessPasswd"] = "" vars["postURL"] = quoteattr(str(urlHandlers.UHPerformBookingsVRVS.getURL(self._conf))) vars["sday"] = "" for i in range(1,32): sel = "" if i == self._conf.getStartDate().day: sel = " selected" vars["sday"] += """") % selected] while topcat: level += 1 selected = "" if level == visibility: selected = "selected" if topcat.getId() != "0": from MaKaC.common.TemplateExec import truncateTitle vis.append("""""" % (level, selected, truncateTitle(topcat.getName(), 120))) topcat = topcat.getOwner() selected = "" if visibility > level: selected = "selected" vis.append( _("""""") % selected) vis.reverse() return "".join(vis) def getVars(self): vars = wcomponents.WTemplated.getVars( self ) minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance() navigator = "" styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager() type = self._conf.getType() vars["timezoneOptions"] = TimezoneRegistry.getShortSelectItemsHTML(self._conf.getTimezone()) stylesheets=styleMgr.getStylesheetListForEventType(type) styleoptions = "" defStyle = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(self._conf).getDefaultStyle() if defStyle not in stylesheets: defStyle = "" for stylesheet in stylesheets: if stylesheet == defStyle or (defStyle == "" and stylesheet == "static"): selected = "selected" else: selected = "" styleoptions += "" % (stylesheet,selected,styleMgr.getStylesheetName(stylesheet)) vars["conference"] = self._conf vars["useRoomBookingModule"] = minfo.getRoomBookingModuleActive() vars["styleOptions"] = styleoptions import MaKaC.webinterface.webFactoryRegistry as webFactoryRegistry wr = webFactoryRegistry.WebFactoryRegistry() types = [ "conference" ] for fact in wr.getFactoryList(): types.append(fact.getId()) vars["types"] = "" for id in types: typetext = id if typetext == "simple_event": typetext = "lecture" if self._conf.getType() == id: vars["types"] += """") for session in self._conf.getSessionList() : for convener in session.getConvenerList() : name = convener.getFullNameNoTitle() if not name in names: text[name] = """"""%(session.getId(),convener.getId(),name) names.append(name) for contribution in self._conf.getContributionList() : for speaker in contribution.getSpeakerList() : name = speaker.getFullNameNoTitle() if not(name in names) : text[name] = """"""%(contribution.getId(),speaker.getId(),name) names.append(name) for author in contribution.getAuthorList() : name = author.getFullNameNoTitle() if not name in names: text[name] = """"""%(contribution.getId(),author.getId(),name) names.append(name) for coauthor in contribution.getCoAuthorList() : name = coauthor.getFullNameNoTitle() if not name in names: text[name] = """"""%(contribution.getId(),coauthor.getId(),name) names.append(name) names.sort() for name in names: html.append(text[name]) return "".join(html) #--------------------------------------------------------------------------- class WPNewSessionConvenerSelect( WPConferenceModifBase ): def _setActiveTab( self ): self._tabContribList.setActive() def _getTabContent( self, params ): searchAction = str(self._rh.getCurrentURL()) searchExt = params.get("searchExt","") if searchExt != "": searchLocal = False else: searchLocal = True p = wcomponents.WComplexSelection(self._conf,searchAction, forceWithoutExtAuth=searchLocal) return p.getHTML(params) #--------------------------------------------------------------------------- class WPNewSessionConvenerNew( WPConferenceModifBase ): def __init__(self, rh, conf, params): WPConferenceModifBase.__init__(self, rh, conf) self._params = params def _setActiveTab( self ): self._tabContribList.setActive() def _getTabContent( self, params ): p = wcomponents.WNewPerson() if self._params.get("formTitle",None) is None : self._params["formTitle"] = _("Define new convener") if self._params.get("titleValue",None) is None : self._params["titleValue"] = "" if self._params.get("surNameValue",None) is None : self._params["surNameValue"] = "" if self._params.get("nameValue",None) is None : self._params["nameValue"] = "" if self._params.get("emailValue",None) is None : self._params["emailValue"] = "" if self._params.get("addressValue",None) is None : self._params["addressValue"] = "" if self._params.get("affiliationValue",None) is None : self._params["affiliationValue"] = "" if self._params.get("phoneValue",None) is None : self._params["phoneValue"] = "" if self._params.get("faxValue",None) is None : self._params["faxValue"] = "" self._params["disabledRole"] = False self._params["roleDescription"] = _(""" _("Coordinator")
    _("Manager")""") self._params["roleValue"] = _(""" _("Give coordinator rights to the convener").
    _("Give management rights to the convener").""") self._params["disabledNotice"] = True self._params["noticeValue"] = _("""_("Note"): _("If this person does not already have an Indico account, he or she will be sent an email asking to create an account. After the account creation the user will automatically be given coordinator/management rights.")""") formAction = urlHandlers.UHConfNewSessionPersonAdd.getURL(self._conf) formAction.addParam("orgin","new") formAction.addParam("typeName","convener") self._params["formAction"] = formAction return p.getHTML(self._params) #--------------------------------------------------------------------------- class WPConfAddBreak( WPConfModifSchedule ): def __init__(self,rh,session,day=None): WPConfModifSchedule.__init__(self,rh,session) self._targetDay=day def _getTabContent( self, params ): p=wcomponents.WBreakDataModification(self._conf.getSchedule(),targetDay=self._targetDay,conf=self._conf) pars={"postURL": urlHandlers.UHConfPerformAddBreak.getURL(self._conf)} return p.getHTML( pars ) class WPConfModifyBreak( WPConfModifScheduleGraphic ): def __init__( self, rh, conf, schBreak ): WPConfModifScheduleGraphic.__init__( self, rh, conf ) self._break = schBreak def _getScheduleContent( self, params ): sch=self._conf.getSchedule() wc=wcomponents.WBreakDataModification(sch,self._break,conf=self._conf) pars = {"postURL":urlHandlers.UHConfPerformModifyBreak.getURL(self._break)} params["body"] = wc.getHTML(pars) return wcomponents.WBreakModifHeader( self._break, self._getAW() ).getHTML( params ) class WPModSchEditContrib(WPConfModifSchedule): def __init__(self,rh,contrib): WPConfModifSchedule.__init__(self,rh,contrib.getConference()) self._contrib=contrib def _getTabContent(self,params): wc=wcomponents.WSchEditContrib(self._contrib) pars={"postURL":urlHandlers.UHConfModSchEditContrib.getURL(self._contrib)} return wc.getHTML(pars) class WSchEditSlot(wcomponents.WTemplated): def __init__(self,slotData, errors=[]): self._slotData=slotData self._errors = errors #def _getTitleItemsHTML(self,selected=""): # titles=["", "Mr.", "Mrs.", "Miss.", "Prof.", "Dr."] # res=[] # for t in titles: # sel="" # if t==selected: # sel=" selected" # res.append(""""""%(quoteattr(t),sel,self.htmlText(t))) # return "".join(res) def _getConvenersHTML(self): res=[] for conv in self._slotData.getConvenerList(): tmp= _("""
     
    _("Title")
    _("Family name") _("First name")
    _("Affiliation") _("Email")
      """)%(quoteattr(str(conv.getId())),\ quoteattr(str(conv.getId())),\ TitlesRegistry.getSelectItemsHTML(conv.getTitle()), \ quoteattr(conv.getFamilyName()),\ quoteattr(conv.getFirstName()), \ quoteattr(conv.getAffiliation()), \ quoteattr(conv.getEmail()) ) res.append(tmp) return "".join(res) def _getErrorHTML( self, msgList ): if not msgList: return "" return """
      
      %s  
      
    """%"
    ".join( msgList ) def getVars(self): vars=wcomponents.WTemplated.getVars(self) slot = self._slotData.getSession().getSlotById(self._slotData.getId()) vars["title"]=self._slotData.getTitle() if vars.get("hideSlot","0") == "1" : vars["formTitle"] = _("Modify session schedule data") vars["slotTitle"] = "" vars["updateParentDates"] = """""" else : vars["formTitle"] = _("Modify session slot schedule data") vars["updateParentDates"] = "" vars["slotTitle"] = _(""" _("Slot Title")  %s """)%vars["title"] vars["orginURL"] = vars.get("orginURL","") vars["postURL"]=quoteattr(str(urlHandlers.UHConfModSchEditSlot.getURL(slot))) vars["sessionTitle"]=self.htmlText(self._slotData.getSession().getTitle()) defaultDefinePlace = defaultDefineRoom = "" defaultInheritPlace = defaultInheritRoom = "checked" locationName, locationAddress, roomName = "", "", "" confTZ = self._slotData._session.getOwner().getTimezone() sd = self._slotData.getStartDate().astimezone(timezone(confTZ)) vars["sDay"] = sd.day vars["sMonth"] = sd.month vars["sYear"] = sd.year vars["sHour"] = sd.hour vars["sMinute"] = sd.minute vars["durHours"] = (datetime(1900,1,1)+self._slotData.getDuration()).hour vars["durMins"] = (datetime(1900,1,1)+self._slotData.getDuration()).minute vars["contribDurHours"] = "" vars["contribDurMins"] = "" if self._slotData.getContribDuration() != None: vars["contribDurHours"] = (datetime(1900,1,1)+self._slotData.getContribDuration()).hour vars["contribDurMins"] = (datetime(1900,1,1)+self._slotData.getContribDuration()).minute if self._slotData.getLocationName() !="": defaultDefinePlace = "checked" defaultInheritPlace = "" locationName = self._slotData.getLocationName() locationAddress = self._slotData.getLocationAddress() if self._slotData.getRoomName() != "": defaultDefineRoom= "checked" defaultInheritRoom = "" roomName = self._slotData.getRoomName() vars["defaultInheritPlace"] = defaultInheritPlace vars["defaultDefinePlace"] = defaultDefinePlace vars["confPlace"]="" confLocation=slot.getOwner().getLocation() if confLocation: vars["confPlace"]=confLocation.getName() vars["locationName"] = locationName vars["locationAddress"] = locationAddress vars["defaultInheritRoom"] = defaultInheritRoom vars["defaultDefineRoom"] = defaultDefineRoom vars["confRoom"]="" confRoom=slot.getOwner().getRoom() if confRoom: vars["confRoom"]=confRoom.getName() vars["roomName"] = quoteattr(roomName) vars["conveners"]=self._getConvenersHTML() vars["errors"]=self._getErrorHTML(self._errors) vars["parentType"]="conference" if self._slotData.getSession() is not None: vars["parentType"]="session" return vars class WPModSchEditSlot(WPConfModifSchedule): def __init__(self,rh,slotData, errors=[]): WPConfModifSchedule.__init__(self,rh,slotData.getSession().getConference()) self._slotData=slotData self._errors = errors def _getTabContent(self,params): wc=WSchEditSlot(self._slotData, self._errors) return wc.getHTML(params) class WPModSessionMoveConfirmation(WPConfModifSchedule): def __init__(self,rh,session): WPConfModifSchedule.__init__(self,rh,session.getConference()) self._session=session self._aw = rh._aw def _getTabContent(self,params): wc=WSessionMoveConfirmation(self._session, self._aw) url=urlHandlers.UHConfModSessionMoveConfirmation.getURL(self._session) return wc.getHTML({"postURL":url}) class WSessionMoveConfirmation(wcomponents.WTemplated): def __init__(self,session, aw): self._session = session self._aw = aw def getVars( self ): vars = wcomponents.WTemplated.getVars(self) vars["calendarIconURL"] = Config.getInstance().getSystemIconURL("calendar") vars["calendarSelectURL"] = urlHandlers.UHSimpleCalendar.getURL() conf = self._session.getOwner() tz = conf.getTimezone() sd = self._session.getAdjustedStartDate() if sd is not None: vars["currentDate"]=sd.strftime("%A %d %B %Y %H:%M") vars["sDay"] = sd.day vars["sMonth"] = sd.month vars["sYear"] = sd.year vars["sHour"] = sd.hour vars["sMinute"] = sd.minute else: vars["currentDate"]= _("""--_("no start date")--""") vars["sDay"] = "dd" vars["sMonth"] = "mm" vars["sYear"] = "yyyy" vars["sHour"] = "hh" vars["sMinute"] = "mm" return vars class WPModSlotRemConfirmation(WPConfModifSchedule): def __init__(self,rh,slot): WPConfModifSchedule.__init__(self,rh,slot.getConference()) self._slot=slot def _getTabContent(self,params): wc=wcomponents.WConfirmation() slotCaption="on %s %s-%s"%( self._slot.getAdjustedStartDate().strftime("%A %d %B %Y"), self._slot.getAdjustedStartDate().strftime("%H:%M"), self._slot.getAdjustedEndDate().strftime("%H:%M")) if self._slot.getTitle()!="": slotCaption=""" "%s" (%s) """%(self._slot.getTitle(),slotCaption) msg= _("""Are you sure you want to delete the slot %s of the session "%s" (note that any contribution scheduled inside will be unscheduled)?""")%(slotCaption, self._slot.getSession().getTitle()) url=urlHandlers.UHConfModSlotRem.getURL(self._slot) return wc.getHTML(msg,url,{}) class WPModSessionRemConfirmation(WPConfModifSchedule): def __init__(self,rh,session): WPConfModifSchedule.__init__(self,rh,session.getConference()) self._session=session def _getTabContent(self,params): wc=wcomponents.WConfirmation() msg= _("""Are you sure you want to delete the session "%s" (note that any contribution scheduled inside will be unscheduled)?""")%(self._session.getTitle()) url=urlHandlers.UHConfModSessionRem.getURL(self._session) return wc.getHTML(msg,url,{}) class WConfModifACSessionCoordinatorRights(wcomponents.WTemplated): def __init__(self,conf): self._conf = conf def getVars( self ): vars = wcomponents.WTemplated.getVars(self) url = urlHandlers.UHConfModifCoordinatorRights.getURL(self._conf) html=[] scr = conference.SessionCoordinatorRights() for rightKey in scr.getRightKeys(): url = urlHandlers.UHConfModifCoordinatorRights.getURL(self._conf) url.addParam("rightId", rightKey) if self._conf.hasSessionCoordinatorRight(rightKey): imgurl=Config.getInstance().getSystemIconURL("tick") else: imgurl=Config.getInstance().getSystemIconURL("cross") html.append("""       %s """%(quoteattr(str(url)), quoteattr(str(imgurl)), scr.getRight(rightKey))) vars["optionalRights"]="
    ".join(html) return vars class WConfModifAC: def __init__( self, conference, eventType, user ): self.__conf = conference self._eventType = eventType self.__user = user def getHTML( self, params ): ac = wcomponents.WConfAccessControlFrame().getHTML( self.__conf,\ params["setVisibilityURL"],\ params["setAccessKeyURL"] ) dc = "" if not self.__conf.isProtected(): dc = "
    %s"%wcomponents.WDomainControlFrame( self.__conf ).getHTML( \ params["addDomainURL"], \ params["removeDomainURL"] ) mc = wcomponents.WConfModificationControlFrame().getHTML( self.__conf, params["addManagersURL"], params["removeManagersURL"], params["setModifKeyURL"] ) + "
    " if self._eventType == "conference": rc = wcomponents.WConfRegistrarsControlFrame().getHTML( self.__conf, params["addRegistrarsURL"], params["removeRegistrarsURL"]) + "
    " else: rc = "" tf="" if self._eventType in ["conference","meeting"]: tf = "
    %s" % wcomponents.WConfProtectionToolsFrame(self.__conf).getHTML() cr="" if self._eventType == "conference": cr = "
    %s"%WConfModifACSessionCoordinatorRights(self.__conf).getHTML() return """
    %s%s%s%s%s%s
    """%( mc, rc, ac, dc, tf, cr ) class WPConfModifAC( WPConferenceModifBase ): def __init__(self, rh, conf): WPConferenceModifBase.__init__(self, rh, conf) self._eventType="conference" if self._rh.getWebFactory() is not None: self._eventType=self._rh.getWebFactory().getId() self._user = self._rh._getUser() def _setActiveSideMenuItem( self ): self._ACMenuItem.setActive() def _getPageContent( self, params ): wc = WConfModifAC( self._conf, self._eventType, self._user ) import MaKaC.webinterface.rh.conferenceModif as conferenceModif p = { "setVisibilityURL": urlHandlers.UHConfSetVisibility.getURL(), "setAccessKeyURL": urlHandlers.UHConfSetAccessKey.getURL(), "setModifKeyURL": urlHandlers.UHConfSetModifKey.getURL(), "addAllowedURL": urlHandlers.UHConfSelectAllowed.getURL(), "removeAllowedURL": urlHandlers.UHConfRemoveAllowed.getURL(), "addDomainURL": urlHandlers.UHConfAddDomain.getURL(), "removeDomainURL": urlHandlers.UHConfRemoveDomain.getURL(), "addManagersURL": urlHandlers.UHConfSelectManagers.getURL(), "removeManagersURL": urlHandlers.UHConfRemoveManagers.getURL(), "addRegistrarsURL": conferenceModif.RHConfSelectRegistrars._uh.getURL(), "removeRegistrarsURL": conferenceModif.RHConfRemoveRegistrars._uh.getURL() } return wc.getHTML( p ) #============================================================ class WPConfSelectAllowed( WPConfModifAC ): def _getPageContent( self, params ): searchExt = params.get("searchExt","") if searchExt != "": searchLocal = False else: searchLocal = True wc = wcomponents.WPrincipalSelection( urlHandlers.UHConfSelectAllowed.getURL(),forceWithoutExtAuth=searchLocal ) params["addURL"] = urlHandlers.UHConfAddAllowed.getURL() return wc.getHTML( params ) class WPConfSelectManagers( WPConfModifAC ): def _getPageContent( self, params ): searchExt = params.get("searchExt","") if searchExt != "": searchLocal = False else: searchLocal = True wc = wcomponents.WPrincipalSelection( urlHandlers.UHConfSelectManagers.getURL(), forceWithoutExtAuth=searchLocal ) params["addURL"] = urlHandlers.UHConfAddManagers.getURL() return wc.getHTML( params ) class WPConfSelectRegistrars( WPConfModifAC ): def _getPageContent( self, params ): searchExt = params.get("searchExt","") if searchExt != "": searchLocal = False else: searchLocal = True from MaKaC.webinterface.rh.conferenceModif import RHConfAddRegistrars from MaKaC.webinterface.rh.conferenceModif import RHConfSelectRegistrars wc = wcomponents.WPrincipalSelection(RHConfSelectRegistrars._uh.getURL(), forceWithoutExtAuth=searchLocal) params["addURL"] = RHConfAddRegistrars._uh.getURL() return wc.getHTML( params ) #--------------------------------------------------------------------------- class WConfModifTools( wcomponents.WTemplated ): def __init__( self, conference, user=None ): self.__conf = conference self._user=user def getVars( self ): vars = wcomponents.WTemplated.getVars( self ) vars["offlsiteMsg"]="" vars["dvdURL"]=quoteattr(str(urlHandlers.UHConfDVDCreation.getURL(self.__conf))) if self._user is None: vars["offlsiteMsg"]= _("(Please, login if you want to apply for your Offline Website)") vars["dvdURL"]=quoteattr("") vars["deleteIconURL"] = Config.getInstance().getSystemIconURL("delete") vars["cloneIconURL"] = Config.getInstance().getSystemIconURL("clone") vars["matPkgIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("materialPkg"))) vars["matPkgURL"]=quoteattr(str(urlHandlers.UHConfModFullMaterialPackage.getURL(self.__conf))) vars["dvdIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("dvd"))) vars["closeIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("closeIcon"))) vars["closeURL"]=quoteattr(str(urlHandlers.UHConferenceClose.getURL(self.__conf))) vars["alarmURL"]=quoteattr(str(urlHandlers.UHConfDisplayAlarm.getURL(self.__conf))) vars["alarmIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("alarmIcon"))) vars["badgePrintingURL"]=quoteattr(str(urlHandlers.UHConfModifBadgePrinting.getURL(self.__conf))) vars["badgeIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("badge"))) return vars class WPConfModifToolsBase( WPConferenceModifBase ): def _setActiveSideMenuItem(self): self._toolsMenuItem.setActive() def _createTabCtrl(self): self._tabCtrl = wcomponents.TabControl() self._tabAlarms = self._tabCtrl.newTab( "alarms", _("Alarms"), \ urlHandlers.UHConfDisplayAlarm.getURL(self._conf) ) self._tabCloneEvent = self._tabCtrl.newTab( "clone", _("Clone Event"), \ urlHandlers.UHConfClone.getURL( self._conf ) ) self._tabPosters = self._tabCtrl.newTab( "posters", _("Posters"), \ urlHandlers.UHConfModifPosterPrinting.getURL(self._conf) ) self._tabBadges = self._tabCtrl.newTab( "badges", _("Badges/Tablesigns"), \ urlHandlers.UHConfModifBadgePrinting.getURL(self._conf) ) self._tabClose = self._tabCtrl.newTab( "close", _("Lock"), \ urlHandlers.UHConferenceClose.getURL( self._conf ) ) self._tabDelete = self._tabCtrl.newTab( "delete", _("Delete"), \ urlHandlers.UHConfDeletion.getURL(self._conf) ) self._tabMatPackage = self._tabCtrl.newTab( "matPackage", _("Material Package"), \ urlHandlers.UHConfModFullMaterialPackage.getURL(self._conf) ) self._tabOfflineSite = self._tabCtrl.newTab( "offlineSite", _("Offline Site"), \ urlHandlers.UHConfDVDCreation.getURL(self._conf) ) self._tabAlarms.setEnabled(False) self._tabOfflineSite.setHidden(True) self._setActiveTab() wf = self._rh.getWebFactory() if wf: wf.customiseToolsTabCtrl( self._tabCtrl ) def _getPageContent( self, params ): self._createTabCtrl() html = wcomponents.WTabControl( self._tabCtrl, self._getAW() ).getHTML( self._getTabContent( params ) ) return html def _setActiveTab( self ): pass def _getTabContent( self, params ): return "nothing" class WPConfClosing(WPConfModifToolsBase): def __init__(self, rh, conf): WPConferenceModifBase.__init__(self, rh, conf) self._eventType="conference" if self._rh.getWebFactory() is not None: self._eventType=self._rh.getWebFactory().getId() def _setActiveTab( self ): self._tabClose.setActive() def _getTabContent( self, params ): msg = _(""" _("Are you sure that you want to LOCK the event") "%s"?
    (_("Note that if you lock the event, you will not be able to change its details any more
    Only the creator of the event or an administrator of the system/category can unlock an event")) """)%(self._conf.getTitle()) wc = wcomponents.WConfirmation() return wc.getHTML( msg, \ urlHandlers.UHConferenceClose.getURL( self._conf ), {}, \ confirmButtonCaption= _("Yes"), cancelButtonCaption= _("No") ) class WPConfDeletion( WPConfModifToolsBase ): def _setActiveTab( self ): self._tabDelete.setActive() def _getTabContent( self, params ): msg = _(""" _("Are you sure that you want to DELETE the conference") "%s"?
    ( _("Note that if you delete the conference, all the items below it will also be deleted")) """)%(self._conf.getTitle()) wc = wcomponents.WConfirmation() return wc.getHTML( msg, \ urlHandlers.UHConfDeletion.getURL( self._conf ), {}, \ confirmButtonCaption= _("Yes"), cancelButtonCaption=_("No") ) class WPConfCloneConfirm( WPConfModifToolsBase ): def __init__(self, rh, conf, nbClones): WPConfModifToolsBase.__init__(self, rh, conf) self._nbClones = nbClones def _setActiveTab( self ): self._tabCloneEvent.setActive() def _getTabContent( self, params ): msg = _(""" _("This action will create %s new events. Are you sure you want to proceed")? """)%self._nbClones wc = wcomponents.WConfirmation() url = urlHandlers.UHConfPerformCloning.getURL( self._conf ) params = self._rh._getRequestParams() for key in params.keys(): url.addParam(key,params[key]) return wc.getHTML( msg, \ url, {}, \ confirmButtonCaption= _("Yes"), cancelButtonCaption= _("No") ) #--------------------------------------------------------------------------- class WConferenceParticipants(wcomponents.WTemplated): def __init__(self, conference): self._conf = conference def getVars(self): vars = wcomponents.WTemplated.getVars(self) vars["confTitle"] = self._conf.getTitle() vars["confId"] = self._conf.getId() vars["contribSetIndex"]='index' vars["selectAll"] = Config.getInstance().getSystemIconURL("checkAll") vars["deselectAll"] = Config.getInstance().getSystemIconURL("uncheckAll") vars["participants"] = self.getParticipantsList() vars["statisticAction"] = str(urlHandlers.UHConfModifParticipantsStatistics.getURL(self._conf)) vars["sendButton"] = _("""""") vars["excelButton"] = _("""""") vars["participantsAction"] = str(urlHandlers.UHConfModifParticipantsAction.getURL(self._conf)) if nowutc() < self._conf.getStartDate() : vars["inviteButton"] = _("""""") vars["inviteAction"] = str(urlHandlers.UHConfModifParticipantsSelectToInvite.getURL(self._conf)) vars["addButton"] = _("""""") vars["addAction"] = str(urlHandlers.UHConfModifParticipantsSelectToAdd.getURL(self._conf)) vars["sendAddedInfoButton"] = _("""""") vars["presenceButton"] = vars["absenceButton"] = vars["askButton"] = vars["excuseButton"] = "" else : vars["absenceButton"] = _("""""") vars["presenceButton"] = _("""""") vars["askButton"] = _("""""") vars["excuseButton"] = _("""""") vars["inviteButton"] = vars["inviteAction"] = "" vars["addButton"] = vars["addAction"] = "" vars["removeButton"] = vars["sendAddedInfoButton"] = "" vars["addButton"] = _("""""") vars["addAction"] = str(urlHandlers.UHConfModifParticipantsSelectToAdd.getURL(self._conf)) vars["removeButton"] = _("""""") vars["newParticipantURL"] = urlHandlers.UHConfModifParticipantsNewToAdd.getURL(self._conf) return vars def getParticipantsList(self): html = [] for p in self._conf.getParticipation().getParticipantList():#.values().list().sort(sortByName): presence = "n/a" if nowutc() > self._conf.getStartDate() : if p.isPresent() : presence = "present" else : presence = "absent" url = urlHandlers.UHConfModifParticipantsDetails.getURL(self._conf) url.addParam("participantId",p.getId()) text = """   %s %s %s   %s   %s """%(p.getId(),str(url),p.getTitle(), p.getFirstName(), p.getFamilyName(), p.getStatus(), presence) html.append(text) return "".join(html) class WPConfModifParticipants( WPConferenceModifBase ): def _setActiveSideMenuItem( self ): self._participantsMenuItem.setActive() def _getPageContent( self, params ): p = WConferenceParticipants( self._conf ) return p.getHTML(params) #--------------------------------------------------------------------------- class WConferenceParticipantsPending(wcomponents.WTemplated): def __init__(self, conference): self.__conf = conference def getVars(self): vars = wcomponents.WTemplated.getVars(self) vars["confTitle"] = self.__conf.getTitle() vars["confId"] = self.__conf.getId() vars["selectAll"] = Config.getInstance().getSystemIconURL("checkAll") vars["deselectAll"] = Config.getInstance().getSystemIconURL("uncheckAll") if len(vars.get("errorMsg", [])) > 0 : vars["errorMsg"] = wcomponents.WErrorMessage().getHTML(vars) else : vars["errorMsg"] = "" text = button = action = "" action = str(urlHandlers.UHConfModifParticipantsPendingAction.getURL(self.__conf)) vars["pending"] = self._getPendingParticipantsList() vars["pendingAction"] = action vars["conf"] = self.__conf vars["conferenceStarted"] = nowutc() > self.__conf.getStartDate() return vars def _getPendingParticipantsList(self): l = [] for k in self.__conf.getParticipation().getPendingParticipantList().keys() : p = self.__conf.getParticipation().getPendingParticipantByKey(k) l.append((k, p)) return l class WPConfModifParticipantsPending( WPConfModifParticipants ): def _getPageContent( self, params ): banner = wcomponents.WParticipantsBannerModif(self._conf).getHTML() p = WConferenceParticipantsPending( self._conf ) return banner+p.getHTML() #--------------------------------------------------------------------------- class WConferenceParticipantsStatistics(wcomponents.WTemplated): def __init__(self, conference): self.__conf = conference def getVars(self): vars = wcomponents.WTemplated.getVars(self) vars["confTitle"] = self.__conf.getTitle() vars["confId"] = self.__conf.getId() vars["invited"] = self.__conf.getParticipation().getInvitedNumber() vars["rejected"] = self.__conf.getParticipation().getRejectedNumber() vars["added"] = self.__conf.getParticipation().getAddedNumber() vars["refused"] = self.__conf.getParticipation().getRefusedNumber() vars["pending"] = self.__conf.getParticipation().getPendingNumber() if nowutc() < self.__conf.getStartDate() : vars["present"] = vars["absent"] = vars["excused"] = "" else : vars["present"] = _(""" _("Present participants") %s """)%self.__conf.getParticipation().getPresentNumber() vars["absent"] = _(""" _("Absent participants") %s """)%self.__conf.getParticipation().getAbsentNumber() vars["excused"] = _(""" _("Excused participants") %s """)%self.__conf.getParticipation().getExcusedNumber() return vars class WPConfModifParticipantsStatistics( WPConfModifParticipants ): def _getPageContent( self, params ): params["action"] = "search" banner = wcomponents.WParticipantsBannerModif(self._conf).getHTML() p = WConferenceParticipantsStatistics( self._conf ) return banner+p.getHTML(params) #--------------------------------------------------------------------------- class WPConfModifParticipantsSelect( WPConfModifParticipants ): def _getPageContent( self, params ): searchAction = str(self._rh.getCurrentURL()) searchExt = params.get("searchExt","") if searchExt != "": searchLocal = False else: searchLocal = True p = wcomponents.WComplexSelection(self._conf,searchAction,forceWithoutExtAuth=searchLocal) return p.getHTML(params) #--------------------------------------------------------------------------- class WPConfModifParticipantsNew( WPConfModifParticipants ): def _getPageContent( self, params ): p = wcomponents.WNewPerson() if params.get("formTitle",None) is None : params["formTitle"] = _("Define new participant") if params.get("titleValue",None) is None : params["titleValue"] = "" if params.get("surNameValue",None) is None : params["surNameValue"] = "" if params.get("nameValue",None) is None : params["nameValue"] = "" if params.get("emailValue",None) is None : params["emailValue"] = "" if params.get("addressValue",None) is None : params["addressValue"] = "" if params.get("affiliationValue",None) is None : params["affiliationValue"] = "" if params.get("phoneValue",None) is None : params["phoneValue"] = "" if params.get("faxValue",None) is None : params["faxValue"] = "" return p.getHTML(params) class WPConfModifParticipantsNewPending( WPConferenceDefaultDisplayBase ): def __init__(self, rh, conf): WPConferenceDefaultDisplayBase.__init__(self, rh, conf) def _getBody( self, params ): p = wcomponents.WNewPerson() params["formTitle"] = _("Apply for participation") if params.get("titleValue",None) is None : params["titleValue"] = "" if params.get("surNameValue",None) is None : params["surNameValue"] = "" if params.get("nameValue",None) is None : params["nameValue"] = "" if params.get("emailValue",None) is None : params["emailValue"] = "" if params.get("addressValue",None) is None : params["addressValue"] = "" if params.get("affiliationValue",None) is None : params["affiliationValue"] = "" if params.get("phoneValue",None) is None : params["phoneValue"] = "" if params.get("faxValue",None) is None : params["faxValue"] = "" params["disabledTitle"] = params.get("disabledTitle",False) params["disabledSurName"] = params.get("disabledSurName",False) params["disabledName"] = params.get("disabledName",False) params["disabledEmail"] = params.get("disabledEmail",False) params["disabledAddress"] = params.get("disabledAddress",False) params["disabledPhone"] = params.get("disabledPhone",False) params["disabledFax"] = params.get("disabledFax",False) params["disabledAffiliation"] = params.get("disabledAffiliation",False) return p.getHTML(params) #--------------------------------------------------------------------------- class WPConfModifParticipantsInvite(WPConferenceDefaultDisplayBase): def __init__(self, rh, conf): WPConferenceDefaultDisplayBase.__init__(self, rh, conf) def _defineSectionMenu(self): self._sectionMenu = None def _getBody( self, params ): msg = _(""" _("Please indicate whether you want to accept or reject the invitation to the") "%s"?
    """)%(self._conf.getTitle()) wc = wcomponents.WConfirmation() url = urlHandlers.UHConfParticipantsInvitation.getURL( self._conf ) url.addParam("participantId",params["participantId"]) return wc.getHTML( msg, url, {}, \ confirmButtonCaption= _("Accept"), cancelButtonCaption= _("Reject") ) #--------------------------------------------------------------------------- class WPConfModifParticipantsRefuse(WPConferenceDefaultDisplayBase): def __init__(self, rh, conf): WPConferenceDefaultDisplayBase.__init__(self, rh, conf) def _getBody( self, params ): msg = _(""" _("Are you sure you want to refuse to attend the "%s"")? """)%(self._conf.getTitle()) wc = wcomponents.WConfirmation() url = urlHandlers.UHConfParticipantsRefusal.getURL( self._conf ) url.addParam("participantId",params["participantId"]) return wc.getHTML( msg, url, {}, \ confirmButtonCaption= _("Refuse"), cancelButtonCaption= _("Cancel") ) #--------------------------------------------------------------------------- class WPConfModifParticipantsEMail(WPConferenceModifBase): def __init__(self, rh, conf): WPConferenceModifBase.__init__(self, rh, conf) def _setActiveTab( self ): self._tabParticipants.setActive() def _getPageContent( self, params ): toemail = params["emailto"] params["postURL"] = urlHandlers.UHConfModifParticipantsSendEmail.getURL( self._conf ) wc = WEmail(self._conf, self._getAW().getUser(), toemail) return wc.getHTML(params) #--------------------------------------------------------------------------- class WConferenceLog(wcomponents.WTemplated): def __init__(self, conference): self.__conf = conference self._tz = info.HelperMaKaCInfo.getMaKaCInfoInstance().getTimezone() if not self._tz: self._tz = 'UTC' def getVars(self): vars = wcomponents.WTemplated.getVars(self) vars["confTitle"] = self.__conf.getTitle() vars["confId"] = self.__conf.getId() vars["selectAll"] = Config.getInstance().getSystemIconURL("checkAll") vars["deselectAll"] = Config.getInstance().getSystemIconURL("uncheckAll") if len(vars.get("errorMsg", [])) > 0 : vars["errorMsg"] = wcomponents.WErrorMessage().getHTML(vars) else : vars["errorMsg"] = "" #default ordering by date #default general log list order = vars.get("order","date") filter = vars.get("filter","general") key = vars.get("filterKey","") vars["log"] = self._getLogList(order, filter, key) orderByDate = urlHandlers.UHConfModifLog.getURL(self.__conf) orderByDate.addParam("order","date") #orderByType = urlHandlers.UHConfModifLog.getURL(self.__conf) #orderByType.addParam("order","type") orderByModule = urlHandlers.UHConfModifLog.getURL(self.__conf) orderByModule.addParam("order","module") orderByResponsible = urlHandlers.UHConfModifLog.getURL(self.__conf) orderByResponsible.addParam("order","responsible") orderBySubject= urlHandlers.UHConfModifLog.getURL(self.__conf) orderBySubject.addParam("order","subject") vars["orderByDate"] = orderByDate #vars["orderByType"] = orderByType vars["orderByModule"] = orderByModule vars["orderByResponsible"] = orderByResponsible vars["orderBySubject"] = orderBySubject logFilterAction = urlHandlers.UHConfModifLog.getURL(self.__conf) logFilterAction.addParam("order",order) vars["logFilterAction"] = logFilterAction vars["logListAction"] = "" vars["timezone"] = self._tz return vars def _getLogList(self, order="date", filter="general", key=""): html = [] logList = self.__conf.getLogHandler().getGeneralLogList(order) if filter == "email" : logList = self.__conf.getLogHandler().getEmailLogList(order) elif filter == "action" : logList = self.__conf.getLogHandler().getActionLogList(order) elif filter == "custom" : logList = self.__conf.getLogHandler().getCustomLogList(key, order) for li in logList : url = urlHandlers.UHConfModifLogItem.getURL(self.__conf) url.addParam("logId",li.getLogId()) if len(li.getLogSubject()) < 50: subject = li.getLogSubject() else: subject = "%s..." % li.getLogSubject()[0:50] text = """ %s  %s  %s  %s """%(li.getLogDate().astimezone(timezone(self._tz)).strftime("%Y-%m-%d %H:%M:%S"),\ url, subject,\ li.getResponsibleName(),\ li.getModule()) html.append(text) return "".join(html) class WPConfModifLog( WPConferenceModifBase ): def _setActiveSideMenuItem( self ): self._logMenuItem.setActive() def _getPageContent( self, params ): p = WConferenceLog( self._conf ) return p.getHTML(params) #--------------------------------------------------------------------------- class WConferenceLogItem(wcomponents.WTemplated): def __init__(self, conference): self.__conf = conference def getVars(self): vars = wcomponents.WTemplated.getVars(self) vars["confTitle"] = self.__conf.getTitle() vars["confId"] = self.__conf.getId() if len(vars.get("errorMsg", [])) > 0 : vars["errorMsg"] = wcomponents.WErrorMessage().getHTML(vars) else : vars["errorMsg"] = "" logId = vars.get("logId","") logItem = self.__conf.getLogHandler().getLogItemById(logId) vars["logItem"] = self._getLogItemElements(logItem) url = urlHandlers.UHConfModifLog.getURL(self.__conf) vars["logListAction"] = url return vars def _getLogItemElements(self, logItem): html = [] text = """  %s  %s """%("Subject", logItem.getLogSubject()) html.append(text) logInfo = logItem.getLogInfo() for key in logInfo.keys(): if key != "subject": text = """  %s
    %s
    """%(key, escape(str(logInfo[key]))) html.append(text) return "".join(html) class WPConfModifLogItem( WPConfModifLog ): def _setActiveTab( self ): self._tabLog.setActive() def _getPageContent( self, params ): banner = wcomponents.WConfLogsBannerModif(self._conf).getHTML() p = WConferenceLogItem( self._conf ) return banner+p.getHTML(params) #--------------------------------------------------------------------------- class WConfModifListings( wcomponents.WTemplated ): def __init__( self, conference ): self.__conf = conference def getVars( self ): vars = wcomponents.WTemplated.getVars( self ) vars["pendingQueuesIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("listing"))) vars["pendingQueuesURL"]=quoteattr(str(urlHandlers.UHConfModifPendingQueues.getURL( self.__conf ))) vars["allSessionsConvenersIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("listing"))) vars["allSessionsConvenersURL"]=quoteattr(str(urlHandlers.UHConfAllSessionsConveners.getURL( self.__conf ))) vars["allSpeakersIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("listing"))) vars["allSpeakersURL"]=quoteattr(str(urlHandlers.UHConfAllSpeakers.getURL( self.__conf ))) vars["allPrimaryAuthorsIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("listing"))) vars["allPrimaryAuthorsURL"]=quoteattr(str(urlHandlers.UHConfAllPrimaryAuthors.getURL( self.__conf ))) vars["allCoAuthorsIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("listing"))) vars["allCoAuthorsURL"]=quoteattr(str(urlHandlers.UHConfAllCoAuthors.getURL( self.__conf ))) return vars class WPConfModifListings( WPConferenceModifBase ): def _setActiveSideMenuItem(self): self._listingsMenuItem.setActive() def _getPageContent( self, params ): wc = WConfModifListings( self._conf ) return wc.getHTML() #--------------------------------------------------------------------------- #--------------------------------------------------------------------------- class WConferenceClone(wcomponents.WTemplated): def __init__(self, conference): self.__conf = conference def _getSelectDay(self): sd = "" for i in range(31) : selected = "" if datetime.today().day == (i+1) : selected = "selected=\"selected\"" sd += "