| 1 | # -*- coding: utf-8 -*- |
|---|
| 2 | ## |
|---|
| 3 | ## |
|---|
| 4 | ## This file is part of CDS Indico. |
|---|
| 5 | ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN. |
|---|
| 6 | ## |
|---|
| 7 | ## CDS Indico is free software; you can redistribute it and/or |
|---|
| 8 | ## modify it under the terms of the GNU General Public License as |
|---|
| 9 | ## published by the Free Software Foundation; either version 2 of the |
|---|
| 10 | ## License, or (at your option) any later version. |
|---|
| 11 | ## |
|---|
| 12 | ## CDS Indico is distributed in the hope that it will be useful, but |
|---|
| 13 | ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 15 | ## General Public License for more details. |
|---|
| 16 | ## |
|---|
| 17 | ## You should have received a copy of the GNU General Public License |
|---|
| 18 | ## along with CDS Indico; if not, write to the Free Software Foundation, Inc., |
|---|
| 19 | ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
|---|
| 20 | |
|---|
| 21 | import urllib |
|---|
| 22 | from xml.sax.saxutils import quoteattr |
|---|
| 23 | from datetime import datetime |
|---|
| 24 | import MaKaC.conference as conference |
|---|
| 25 | import MaKaC.webinterface.wcomponents as wcomponents |
|---|
| 26 | import MaKaC.webinterface.linking as linking |
|---|
| 27 | import MaKaC.webinterface.urlHandlers as urlHandlers |
|---|
| 28 | import MaKaC.webinterface.navigation as navigation |
|---|
| 29 | import MaKaC.webinterface.materialFactories as materialFactories |
|---|
| 30 | import MaKaC.webinterface.timetable as timetable |
|---|
| 31 | from MaKaC.webinterface.pages.conferences import WPConfModifScheduleGraphic, WPConferenceBase, WPConferenceModifBase, WPConferenceDefaultDisplayBase |
|---|
| 32 | from MaKaC.webinterface.pages.main import WPMainBase |
|---|
| 33 | from MaKaC.webinterface.common.person_titles import TitlesRegistry |
|---|
| 34 | from MaKaC.common import Config |
|---|
| 35 | from MaKaC.common.utils import isStringHTML, formatDateTime |
|---|
| 36 | from MaKaC.common import info |
|---|
| 37 | from MaKaC.i18n import _ |
|---|
| 38 | from MaKaC import user |
|---|
| 39 | from pytz import timezone |
|---|
| 40 | import MaKaC.common.timezoneUtils as timezoneUtils |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | class WPContributionBase( WPMainBase, WPConferenceBase ): |
|---|
| 44 | |
|---|
| 45 | def __init__( self, rh, contribution ): |
|---|
| 46 | self._contrib = self._target = contribution |
|---|
| 47 | WPConferenceBase.__init__( self, rh, self._contrib.getConference() ) |
|---|
| 48 | self._navigationTarget = contribution |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | class WPContributionDefaultDisplayBase( WPConferenceDefaultDisplayBase, WPContributionBase ): |
|---|
| 52 | |
|---|
| 53 | def getJSFiles(self): |
|---|
| 54 | return WPConferenceDefaultDisplayBase.getJSFiles(self) + \ |
|---|
| 55 | self._includeJSPackage('Management') + \ |
|---|
| 56 | self._includeJSPackage('MaterialEditor') |
|---|
| 57 | |
|---|
| 58 | def __init__( self, rh, contribution ): |
|---|
| 59 | WPContributionBase.__init__( self, rh, contribution ) |
|---|
| 60 | |
|---|
| 61 | |
|---|
| 62 | class WContributionDisplayBase(wcomponents.WTemplated): |
|---|
| 63 | |
|---|
| 64 | def __init__(self, aw, contrib): |
|---|
| 65 | self._aw = aw |
|---|
| 66 | self._contrib = contrib |
|---|
| 67 | |
|---|
| 68 | def _getHTMLRow( self, title, body): |
|---|
| 69 | if body.strip() == "": |
|---|
| 70 | return "" |
|---|
| 71 | str = """ |
|---|
| 72 | <tr> |
|---|
| 73 | <td align="right" valign="top" class="displayField" nowrap><b>%s:</b></td> |
|---|
| 74 | <td width="100%%" valign="top">%s</td> |
|---|
| 75 | </tr>"""%(title, body) |
|---|
| 76 | return str |
|---|
| 77 | |
|---|
| 78 | def _getAdditionalFieldsHTML(self): |
|---|
| 79 | html="" |
|---|
| 80 | afm = self._contrib.getConference().getAbstractMgr().getAbstractFieldsMgr() |
|---|
| 81 | for f in afm.getActiveFields(): |
|---|
| 82 | id = f.getId() |
|---|
| 83 | caption = f.getName() |
|---|
| 84 | html+=self._getHTMLRow(caption, self._contrib.getField(id)) |
|---|
| 85 | return html |
|---|
| 86 | |
|---|
| 87 | def _getSubContributionItem(self, sc, modifURL): |
|---|
| 88 | modifyItem = "" |
|---|
| 89 | url = urlHandlers.UHSubContributionDisplay.getURL(sc) |
|---|
| 90 | if sc.canModify( self._aw ): |
|---|
| 91 | modifyItem = _(""" |
|---|
| 92 | <a href="%s"><img src="%s" border="0" alt='_("Jump to the modification interface")'></a> |
|---|
| 93 | """)%(modifURL, Config.getInstance().getSystemIconURL( "modify" ) ) |
|---|
| 94 | return """ |
|---|
| 95 | <tr> |
|---|
| 96 | <td valign="middle"> |
|---|
| 97 | %s<b> <a href=%s>%s</a></b> |
|---|
| 98 | </td> |
|---|
| 99 | </tr> |
|---|
| 100 | """%(modifyItem, quoteattr(str(url)), sc.getTitle()) |
|---|
| 101 | |
|---|
| 102 | def _getWithdrawnNoticeHTML(self): |
|---|
| 103 | res="" |
|---|
| 104 | if isinstance(self._contrib.getCurrentStatus(),conference.ContribStatusWithdrawn): |
|---|
| 105 | res= _(""" |
|---|
| 106 | <tr> |
|---|
| 107 | <td colspan="2" align="center"><b>--_("WITHDRAWN")--</b></td> |
|---|
| 108 | </tr> |
|---|
| 109 | """) |
|---|
| 110 | return res |
|---|
| 111 | |
|---|
| 112 | def _getSubmitButtonHTML(self): |
|---|
| 113 | res="" |
|---|
| 114 | status=self._contrib.getCurrentStatus() |
|---|
| 115 | if not isinstance(status,conference.ContribStatusWithdrawn) and \ |
|---|
| 116 | self._contrib.canUserSubmit(self._aw.getUser()): |
|---|
| 117 | res= _("""<input type="submit" class="btn" value="_("manage material")">""") |
|---|
| 118 | return res |
|---|
| 119 | |
|---|
| 120 | def _getModifIconHTML(self): |
|---|
| 121 | res="" |
|---|
| 122 | if self._contrib.canModify(self._aw): |
|---|
| 123 | res="""<a href="%s"><img src="%s" border="0" alt="Jump to the modification interface"></a>""" % (urlHandlers.UHContributionModification.getURL(self._contrib), Config.getInstance().getSystemIconURL( "modify" )) |
|---|
| 124 | return res |
|---|
| 125 | |
|---|
| 126 | def _getSubmitIconHTML(self): |
|---|
| 127 | res="" |
|---|
| 128 | if self._contrib.canUserSubmit(self._aw.getUser()): |
|---|
| 129 | res="""<a href="%s"><img src="%s" border="0" alt="Upload files"></a>""" % ('FIXME', Config.getInstance().getSystemIconURL( "submit" )) |
|---|
| 130 | return res |
|---|
| 131 | |
|---|
| 132 | def _getMaterialHTML(self): |
|---|
| 133 | lm=[] |
|---|
| 134 | paper=self._contrib.getPaper() |
|---|
| 135 | if paper is not None: |
|---|
| 136 | lm.append("""<a href=%s><img src=%s border="0" alt="paper"> %s</a>"""%( |
|---|
| 137 | quoteattr(str(urlHandlers.UHMaterialDisplay.getURL(paper))), |
|---|
| 138 | quoteattr(str(materialFactories.PaperFactory().getIconURL())), |
|---|
| 139 | self.htmlText(materialFactories.PaperFactory().getTitle())) ) |
|---|
| 140 | slides=self._contrib.getSlides() |
|---|
| 141 | if slides is not None: |
|---|
| 142 | lm.append("""<a href=%s><img src=%s border="0" alt="slide"> %s</a>"""%( |
|---|
| 143 | quoteattr(str(urlHandlers.UHMaterialDisplay.getURL(slides))), |
|---|
| 144 | quoteattr(str(materialFactories.SlidesFactory().getIconURL())), |
|---|
| 145 | self.htmlText(materialFactories.SlidesFactory().getTitle()))) |
|---|
| 146 | poster=self._contrib.getPoster() |
|---|
| 147 | if poster is not None: |
|---|
| 148 | lm.append("""<a href=%s><img src=%s border="0" alt="poster"> %s</a>"""%( |
|---|
| 149 | quoteattr(str(urlHandlers.UHMaterialDisplay.getURL(poster))), |
|---|
| 150 | quoteattr(str(materialFactories.PosterFactory().getIconURL())), |
|---|
| 151 | self.htmlText(materialFactories.PosterFactory().getTitle()))) |
|---|
| 152 | video=self._contrib.getVideo() |
|---|
| 153 | if video is not None: |
|---|
| 154 | lm.append("""<a href=%s><img src=%s border="0" alt="video"> %s</a>"""%( |
|---|
| 155 | quoteattr(str(urlHandlers.UHMaterialDisplay.getURL(video))), |
|---|
| 156 | quoteattr(str(materialFactories.VideoFactory().getIconURL())), |
|---|
| 157 | self.htmlText(materialFactories.VideoFactory().getTitle()))) |
|---|
| 158 | iconURL=quoteattr(str(Config.getInstance().getSystemIconURL("material"))) |
|---|
| 159 | minutes=self._contrib.getMinutes() |
|---|
| 160 | if minutes is not None: |
|---|
| 161 | lm.append("""<a href=%s><img src=%s border="0" alt="minutes"> %s</a>"""%( |
|---|
| 162 | quoteattr(str(urlHandlers.UHMaterialDisplay.getURL(minutes))), |
|---|
| 163 | quoteattr(str(materialFactories.MinutesFactory().getIconURL())), |
|---|
| 164 | self.htmlText(materialFactories.MinutesFactory().getTitle()))) |
|---|
| 165 | iconURL=quoteattr(str(Config.getInstance().getSystemIconURL("material"))) |
|---|
| 166 | for material in self._contrib.getMaterialList(): |
|---|
| 167 | url=urlHandlers.UHMaterialDisplay.getURL(material) |
|---|
| 168 | lm.append("""<a href=%s><img src=%s border="0" alt=""> %s</a>"""%( |
|---|
| 169 | quoteattr(str(url)),iconURL,self.htmlText(material.getTitle()))) |
|---|
| 170 | return self._getHTMLRow("Material","<br>".join(lm)) |
|---|
| 171 | |
|---|
| 172 | def _getReviewingMaterialsHTML(self): |
|---|
| 173 | rm=[] |
|---|
| 174 | reviewing=self._contrib.getReviewing() |
|---|
| 175 | if reviewing is not None: |
|---|
| 176 | rm.append("""<a href=%s><img src=%s border="0" alt="reviewing"> %s</a>"""%( |
|---|
| 177 | quoteattr(str(urlHandlers.UHMaterialDisplay.getURL(reviewing))), |
|---|
| 178 | quoteattr(str(materialFactories.ReviewingFactory().getIconURL())), |
|---|
| 179 | self.htmlText(materialFactories.ReviewingFactory().getTitle())) ) |
|---|
| 180 | return self._getHTMLRow("Reviewing Material","<br>".join(rm)) |
|---|
| 181 | |
|---|
| 182 | def getVars( self ): |
|---|
| 183 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 184 | vars["contribXML"]=quoteattr(str(urlHandlers.UHContribToXML.getURL(self._contrib))) |
|---|
| 185 | vars["contribPDF"]=quoteattr(str(urlHandlers.UHContribToPDF.getURL(self._contrib))) |
|---|
| 186 | vars["contribiCal"]=quoteattr(str(urlHandlers.UHContribToiCal.getURL(self._contrib))) |
|---|
| 187 | vars["xmlIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("xml"))) |
|---|
| 188 | vars["printIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("pdf"))) |
|---|
| 189 | vars["icalIconURL"]=quoteattr(str(Config.getInstance().getSystemIconURL("ical"))) |
|---|
| 190 | |
|---|
| 191 | vars["title"] = self.htmlText(self._contrib.getTitle()) |
|---|
| 192 | if isStringHTML(self._contrib.getDescription()): |
|---|
| 193 | vars["description"] = self._contrib.getDescription() |
|---|
| 194 | else: |
|---|
| 195 | vars["description"] = """<table class="tablepre"><tr><td><pre>%s</pre></td></tr></table>""" % self._contrib.getDescription() |
|---|
| 196 | vars["additionalFields"] = self._getAdditionalFieldsHTML() |
|---|
| 197 | vars["id"]=self.htmlText(self._contrib.getId()) |
|---|
| 198 | vars["startDate"] = _("""--_("not yet scheduled")--""") |
|---|
| 199 | vars["startTime"] = "" |
|---|
| 200 | if self._contrib.isScheduled(): |
|---|
| 201 | tzUtil = timezoneUtils.DisplayTZ(self._aw,self._contrib.getOwner()) |
|---|
| 202 | tz = tzUtil.getDisplayTZ() |
|---|
| 203 | sDate = self._contrib.getStartDate().astimezone(timezone(tz)) |
|---|
| 204 | vars["startDate"]=self.htmlText(sDate.strftime("%d-%b-%Y")) |
|---|
| 205 | vars["startTime"]=self.htmlText(sDate.strftime("%H:%M") + " (" + tz + ")") |
|---|
| 206 | vars["location"]="" |
|---|
| 207 | loc=self._contrib.getLocation() |
|---|
| 208 | if loc is not None: |
|---|
| 209 | vars["location"]="<i>%s</i>"%(self.htmlText(loc.getName())) |
|---|
| 210 | if loc.getAddress() is not None and loc.getAddress()!="": |
|---|
| 211 | vars["location"]="%s <pre>%s</pre>"%(vars["location"],loc.getAddress()) |
|---|
| 212 | room=self._contrib.getRoom() |
|---|
| 213 | if room is not None: |
|---|
| 214 | roomLink=linking.RoomLinker().getHTMLLink(room,loc) |
|---|
| 215 | vars["location"]= _("""%s<br><small> _("Room"):</small> %s""")%(\ |
|---|
| 216 | vars["location"],roomLink) |
|---|
| 217 | if self._contrib.getBoardNumber()!="": |
|---|
| 218 | vars["location"]= _("""%s - _("board #"): %s""")%(vars["location"],self._contrib.getBoardNumber()) |
|---|
| 219 | else: |
|---|
| 220 | if self._contrib.getBoardNumber()!="": |
|---|
| 221 | vars["location"]= _("""%s <br> _("board #"): %s""")%(vars["location"],self._contrib.getBoardNumber()) |
|---|
| 222 | |
|---|
| 223 | vars["location"]=self._getHTMLRow( _("Place"),vars["location"]) |
|---|
| 224 | |
|---|
| 225 | authIndex = self._contrib.getConference().getAuthorIndex() |
|---|
| 226 | |
|---|
| 227 | l=[] |
|---|
| 228 | for speaker in self._contrib.getSpeakerList(): |
|---|
| 229 | l.append(self.htmlText(speaker.getFullName())) |
|---|
| 230 | vars["speakers"]=self._getHTMLRow( _("Presenters"),"<br>".join(l)) |
|---|
| 231 | |
|---|
| 232 | pal = [] |
|---|
| 233 | for pa in self._contrib.getPrimaryAuthorList(): |
|---|
| 234 | authURL=urlHandlers.UHContribAuthorDisplay.getURL(self._contrib.getConference()) |
|---|
| 235 | authURL.addParam("authorId", authIndex._getKey(pa)) |
|---|
| 236 | authCaption="<a href=%s>%s</a>"%(quoteattr(str(authURL)), self.htmlText(pa.getFullName())) |
|---|
| 237 | if pa.getAffiliation()!="": |
|---|
| 238 | authCaption="%s (%s)"%(authCaption,self.htmlText(pa.getAffiliation())) |
|---|
| 239 | pal.append(authCaption) |
|---|
| 240 | vars["primaryAuthors"]=self._getHTMLRow( _("Primary Authors"),"<br>".join(pal)) |
|---|
| 241 | cal = [] |
|---|
| 242 | for ca in self._contrib.getCoAuthorList(): |
|---|
| 243 | authCaption="%s"%ca.getFullName() |
|---|
| 244 | if ca.getAffiliation()!="": |
|---|
| 245 | authCaption="%s (%s)"%(authCaption,ca.getAffiliation()) |
|---|
| 246 | cal.append(self.htmlText(authCaption)) |
|---|
| 247 | vars["coAuthors"]=self._getHTMLRow( _("Co-Authors"),"<br>".join(cal)) |
|---|
| 248 | vars["contribType"]="" |
|---|
| 249 | if self._contrib.getType() != None: |
|---|
| 250 | vars["contribType"]=self._getHTMLRow( _("Contribution type"),self.htmlText(self._contrib.getType().getName())) |
|---|
| 251 | |
|---|
| 252 | #TODO: fuse this two lines into one, so that they are not both executed... |
|---|
| 253 | #but the 1st line generates a lot of HTML in Python... |
|---|
| 254 | vars["material"]=self._getMaterialHTML() |
|---|
| 255 | vars["revmaterial"]=self._getReviewingMaterialsHTML() |
|---|
| 256 | |
|---|
| 257 | from MaKaC.webinterface.rh.conferenceBase import RHSubmitMaterialBase |
|---|
| 258 | vars["MaterialList"] = wcomponents.WShowExistingMaterial(self._contrib, False).getHTML() |
|---|
| 259 | vars["ReviewingMatList"] = wcomponents.WShowExistingReviewingMaterial(self._contrib, False).getHTML() |
|---|
| 260 | |
|---|
| 261 | vars["duration"]="" |
|---|
| 262 | if self._contrib.getDuration() is not None: |
|---|
| 263 | vars["duration"]=(datetime(1900,1,1)+self._contrib.getDuration()).strftime("%M'") |
|---|
| 264 | if (datetime(1900,1,1)+self._contrib.getDuration()).hour>0: |
|---|
| 265 | vars["duration"]=(datetime(1900,1,1)+self._contrib.getDuration()).strftime("%Hh%M'") |
|---|
| 266 | vars["inSession"]="" |
|---|
| 267 | if self._contrib.getSession() is not None: |
|---|
| 268 | url=urlHandlers.UHSessionDisplay.getURL(self._contrib.getSession()) |
|---|
| 269 | sessionCaption="%s"%self._contrib.getSession().getTitle() |
|---|
| 270 | vars["inSession"]="""<a href=%s>%s</a>"""%(\ |
|---|
| 271 | quoteattr(str(url)),self.htmlText(sessionCaption)) |
|---|
| 272 | vars["inSession"]=self._getHTMLRow( _("Included in session"),vars["inSession"]) |
|---|
| 273 | vars["inTrack"]="" |
|---|
| 274 | if self._contrib.getTrack(): |
|---|
| 275 | trackCaption=self._contrib.getTrack().getTitle() |
|---|
| 276 | vars["inTrack"]="""%s"""%(self.htmlText(trackCaption)) |
|---|
| 277 | vars["inTrack"]=self._getHTMLRow( _("Included in track"),vars["inTrack"]) |
|---|
| 278 | scl = [] |
|---|
| 279 | for sc in self._contrib.getSubContributionList(): |
|---|
| 280 | url=urlHandlers.UHSubContributionModification.getURL(sc) |
|---|
| 281 | scl.append(self._getSubContributionItem(sc,url)) |
|---|
| 282 | vars["subConts"]="" |
|---|
| 283 | if scl: |
|---|
| 284 | scl.insert(0,"""<table align="left" valign="top" width="100%%" border="0" cellpadding="3" cellspacing="3">""") |
|---|
| 285 | scl.append("</table>") |
|---|
| 286 | vars["subConts"]=self._getHTMLRow( _("Sub-contributions"),"".join(scl)) |
|---|
| 287 | vars["withdrawnNotice"]=self._getWithdrawnNoticeHTML() |
|---|
| 288 | vars["submitBtn"]=self._getSubmitButtonHTML() |
|---|
| 289 | vars["submitURL"]=quoteattr('FIXME') |
|---|
| 290 | vars["modifIcon"] = self._getModifIconHTML() |
|---|
| 291 | vars["submitIcon"] = self._getSubmitIconHTML() |
|---|
| 292 | vars["Contribution"] = self._contrib |
|---|
| 293 | import contributionReviewing |
|---|
| 294 | vars["ConfReview"] = self._contrib.getConference().getConfReview() |
|---|
| 295 | vars["reviewingStuffDisplay"]= contributionReviewing.WContributionReviewingDisplay(self._contrib).getHTML({"ShowReviewingTeam" : False}) |
|---|
| 296 | vars["reviewingHistoryStuffDisplay"]= contributionReviewing.WContributionReviewingHistory(self._contrib).getHTML({"ShowReviewingTeam" : False}) |
|---|
| 297 | if self._contrib.getSession(): |
|---|
| 298 | vars["sessionType"] = self._contrib.getSession().getScheduleType() |
|---|
| 299 | else: |
|---|
| 300 | vars["sessionType"] = 'none' |
|---|
| 301 | return vars |
|---|
| 302 | |
|---|
| 303 | |
|---|
| 304 | class WContributionDisplayFull(WContributionDisplayBase): |
|---|
| 305 | pass |
|---|
| 306 | |
|---|
| 307 | |
|---|
| 308 | class WContributionDisplayMin(WContributionDisplayBase): |
|---|
| 309 | pass |
|---|
| 310 | |
|---|
| 311 | |
|---|
| 312 | class WContributionDisplay: |
|---|
| 313 | |
|---|
| 314 | def __init__(self, aw, contrib): |
|---|
| 315 | self._aw = aw |
|---|
| 316 | self._contrib = contrib |
|---|
| 317 | |
|---|
| 318 | def getHTML(self,params={}): |
|---|
| 319 | if self._contrib.canAccess( self._aw ): |
|---|
| 320 | c = WContributionDisplayFull( self._aw, self._contrib) |
|---|
| 321 | return c.getHTML( params ) |
|---|
| 322 | if self._contrib.canView( self._aw ): |
|---|
| 323 | c = WContributionDisplayMin( self._aw, self._contrib) |
|---|
| 324 | return c.getHTML( params ) |
|---|
| 325 | return "" |
|---|
| 326 | |
|---|
| 327 | |
|---|
| 328 | class WPContributionDisplay( WPContributionDefaultDisplayBase ): |
|---|
| 329 | navigationEntry = navigation.NEContributionDisplay |
|---|
| 330 | |
|---|
| 331 | def _defineToolBar(self): |
|---|
| 332 | edit=wcomponents.WTBItem( _("manage this contribution"), |
|---|
| 333 | icon=Config.getInstance().getSystemIconURL("modify"), |
|---|
| 334 | actionURL=urlHandlers.UHContributionModification.getURL(self._contrib), |
|---|
| 335 | enabled=self._target.canModify(self._getAW())) |
|---|
| 336 | pdf=wcomponents.WTBItem( _("get PDF of this contribution"), |
|---|
| 337 | icon=Config.getInstance().getSystemIconURL("pdf"), |
|---|
| 338 | actionURL=urlHandlers.UHContribToPDF.getURL(self._contrib)) |
|---|
| 339 | xml=wcomponents.WTBItem( _("get XML of this contribution"), |
|---|
| 340 | icon=Config.getInstance().getSystemIconURL("xml"), |
|---|
| 341 | actionURL=urlHandlers.UHContribToXML.getURL(self._contrib)) |
|---|
| 342 | ical=wcomponents.WTBItem( _("get ICal of this contribution"), |
|---|
| 343 | icon=Config.getInstance().getSystemIconURL("ical"), |
|---|
| 344 | actionURL=urlHandlers.UHContribToiCal.getURL(self._contrib)) |
|---|
| 345 | self._toolBar.addItem(edit) |
|---|
| 346 | self._toolBar.addItem(pdf) |
|---|
| 347 | self._toolBar.addItem(xml) |
|---|
| 348 | self._toolBar.addItem(ical) |
|---|
| 349 | |
|---|
| 350 | def _getBody( self, params ): |
|---|
| 351 | wc=WContributionDisplay( self._getAW(), self._contrib ) |
|---|
| 352 | return wc.getHTML() |
|---|
| 353 | |
|---|
| 354 | |
|---|
| 355 | |
|---|
| 356 | class WPContributionModifBase( WPConferenceModifBase ): |
|---|
| 357 | |
|---|
| 358 | def __init__( self, rh, contribution ): |
|---|
| 359 | WPConferenceModifBase.__init__( self, rh, contribution.getConference() ) |
|---|
| 360 | self._contrib = self._target = contribution |
|---|
| 361 | from MaKaC.webinterface.rh.reviewingModif import RCPaperReviewManager |
|---|
| 362 | self._isPRM = RCPaperReviewManager.hasRights(rh) |
|---|
| 363 | self._canModify = self._conf.canModify(rh.getAW()) |
|---|
| 364 | |
|---|
| 365 | def _getEnabledControls(self): |
|---|
| 366 | return False |
|---|
| 367 | |
|---|
| 368 | def _getNavigationDrawer(self): |
|---|
| 369 | pars = {"target": self._contrib , "isModif": True} |
|---|
| 370 | return wcomponents.WNavigationDrawer( pars, bgColor="white" ) |
|---|
| 371 | |
|---|
| 372 | def _createTabCtrl( self ): |
|---|
| 373 | |
|---|
| 374 | self._tabCtrl = wcomponents.TabControl() |
|---|
| 375 | self._tabMain = self._tabCtrl.newTab( "main", _("Main"), \ |
|---|
| 376 | urlHandlers.UHContributionModification.getURL( self._target ) ) |
|---|
| 377 | self._tabMaterials = self._tabCtrl.newTab( "materials", _("Material"), \ |
|---|
| 378 | urlHandlers.UHContribModifMaterials.getURL( self._target ) ) |
|---|
| 379 | #self._tabMaterials = self._tabCtrl.newTab( "materials", _("Files"), \ |
|---|
| 380 | # urlHandlers.UHContribModifMaterials.getURL( self._target ) ) |
|---|
| 381 | self._tabSubCont = self._tabCtrl.newTab( "subCont", _("Sub Contribution"), \ |
|---|
| 382 | urlHandlers.UHContribModifSubCont.getURL( self._target ) ) |
|---|
| 383 | if self._canModify: |
|---|
| 384 | self._tabAC = self._tabCtrl.newTab( "ac", _("Protection"), \ |
|---|
| 385 | urlHandlers.UHContribModifAC.getURL( self._target ) ) |
|---|
| 386 | self._tabTools = self._tabCtrl.newTab( "tools", _("Tools"), \ |
|---|
| 387 | urlHandlers.UHContribModifTools.getURL( self._target ) ) |
|---|
| 388 | |
|---|
| 389 | hasReviewingEnabled = self._contrib.getConference().hasEnabledSection('paperReviewing') |
|---|
| 390 | confReviewChoice = self._contrib.getConference().getConfReview().getChoice() |
|---|
| 391 | |
|---|
| 392 | if hasReviewingEnabled and confReviewChoice != 1: |
|---|
| 393 | |
|---|
| 394 | if self._canModify or self._isPRM or self._contrib.getReviewManager().isReferee(self._rh._getUser()): |
|---|
| 395 | self._subtabReviewing = self._tabCtrl.newTab( "reviewing", "Paper Reviewing", \ |
|---|
| 396 | urlHandlers.UHContributionModifReviewing.getURL( self._target ) ) |
|---|
| 397 | else: |
|---|
| 398 | if self._contrib.getReviewManager().isEditor(self._rh._getUser()): |
|---|
| 399 | self._subtabReviewing = self._tabCtrl.newTab( "reviewing", "Paper Reviewing", \ |
|---|
| 400 | urlHandlers.UHContributionEditingJudgement.getURL( self._target ) ) |
|---|
| 401 | elif self._contrib.getReviewManager().isReviewer(self._rh._getUser()): |
|---|
| 402 | self._subtabReviewing = self._tabCtrl.newTab( "reviewing", "Paper Reviewing", \ |
|---|
| 403 | urlHandlers.UHContributionGiveAdvice.getURL( self._target ) ) |
|---|
| 404 | |
|---|
| 405 | |
|---|
| 406 | if self._canModify or self._isPRM or self._contrib.getReviewManager().isReferee(self._rh._getUser()): |
|---|
| 407 | self._subTabAssign = self._subtabReviewing.newSubTab( "assign", _("Assign Team"), \ |
|---|
| 408 | urlHandlers.UHContributionModifReviewing.getURL( self._target ) ) |
|---|
| 409 | if self._contrib.getReviewManager().isReferee(self._rh._getUser()) and not (confReviewChoice == 3 or confReviewChoice == 1): |
|---|
| 410 | self._subTabJudgements = self._subtabReviewing.newSubTab( "final", _("Final Judgement"), \ |
|---|
| 411 | urlHandlers.UHContributionReviewingJudgements.getURL( self._target ) ) |
|---|
| 412 | else: |
|---|
| 413 | self._subTabJudgements = self._subtabReviewing.newSubTab( "Judgements", _("Judgements"), \ |
|---|
| 414 | urlHandlers.UHContributionReviewingJudgements.getURL( self._target ) ) |
|---|
| 415 | |
|---|
| 416 | if (confReviewChoice == 3 or confReviewChoice == 4) and \ |
|---|
| 417 | self._contrib.getReviewManager().isEditor(self._rh._getUser()) and \ |
|---|
| 418 | <<<<<<< HEAD:indico/MaKaC/webinterface/pages/contributions.py |
|---|
| 419 | (not self._contrib.getReviewManager().getLastReview().getRefereeJudgement().isSubmitted() or confReviewChoice == 3) and \ |
|---|
| 420 | self._contrib.getReviewManager().getLastReview().isAuthorSubmitted(): |
|---|
| 421 | <<<<<<< HEAD:indico/MaKaC/webinterface/pages/contributions.py |
|---|
| 422 | |
|---|
| 423 | self._tabJudgeEditing = self._tabCtrl.newTab( "editing", "Editing", \ |
|---|
| 424 | ======= |
|---|
| 425 | ======= |
|---|
| 426 | (not self._contrib.getReviewManager().getLastReview().getRefereeJudgement().isSubmitted() or confReviewChoice == 3): |
|---|
| 427 | >>>>>>> [IMP] - if materials not submitted - no exception:indico/MaKaC/webinterface/pages/contributions.py |
|---|
| 428 | |
|---|
| 429 | self._tabJudgeEditing = self._subtabReviewing.newSubTab( "editing", "Judge Layout", \ |
|---|
| 430 | >>>>>>> [DEVELOPMENT] - new subtabs + other:indico/MaKaC/webinterface/pages/contributions.py |
|---|
| 431 | urlHandlers.UHContributionEditingJudgement.getURL(self._target) ) |
|---|
| 432 | |
|---|
| 433 | if (confReviewChoice == 2 or confReviewChoice == 4) and \ |
|---|
| 434 | self._contrib.getReviewManager().isReviewer(self._rh._getUser()) and \ |
|---|
| 435 | not self._contrib.getReviewManager().getLastReview().getRefereeJudgement().isSubmitted(): |
|---|
| 436 | |
|---|
| 437 | self._tabGiveAdvice = self._subtabReviewing.newSubTab( "advice", "Judge Content", \ |
|---|
| 438 | urlHandlers.UHContributionGiveAdvice.getURL(self._target)) |
|---|
| 439 | |
|---|
| 440 | if self._canModify or self._isPRM or self._contrib.getReviewManager().isInReviewingTeamforContribution(self._rh._getUser()): |
|---|
| 441 | self._subTabRevMaterial = self._subtabReviewing.newSubTab( "revmaterial", _("Material to Review"), \ |
|---|
| 442 | urlHandlers.UHContribModifReviewingMaterials.getURL( self._target ) ) |
|---|
| 443 | |
|---|
| 444 | if self._canModify or self._isPRM or self._contrib.getReviewManager().isReferee(self._rh._getUser()) or \ |
|---|
| 445 | len(self._contrib.getReviewManager().getVersioning()) > 1 or self._contrib.getReviewManager().getLastReview().getRefereeJudgement().isSubmitted(): |
|---|
| 446 | self._subTabReviewingHistory = self._subtabReviewing.newSubTab( "reviewing_history", "History", \ |
|---|
| 447 | urlHandlers.UHContributionModifReviewingHistory.getURL( self._target ) ) |
|---|
| 448 | |
|---|
| 449 | self._setActiveTab() |
|---|
| 450 | self._setupTabCtrl() |
|---|
| 451 | |
|---|
| 452 | def _setActiveTab( self ): |
|---|
| 453 | pass |
|---|
| 454 | |
|---|
| 455 | def _setupTabCtrl(self): |
|---|
| 456 | pass |
|---|
| 457 | |
|---|
| 458 | def _setActiveSideMenuItem(self): |
|---|
| 459 | if self._target.isScheduled(): |
|---|
| 460 | self._timetableMenuItem.setActive(True) |
|---|
| 461 | else: |
|---|
| 462 | self._contribListMenuItem.setActive(True) |
|---|
| 463 | |
|---|
| 464 | def _getPageContent( self, params ): |
|---|
| 465 | self._createTabCtrl() |
|---|
| 466 | #TODO: check if it comes from the timetable or the contribution list |
|---|
| 467 | # temp solution: isScheduled. |
|---|
| 468 | if self._target.isScheduled(): |
|---|
| 469 | banner = wcomponents.WTimetableBannerModif(self._getAW(), self._target).getHTML() |
|---|
| 470 | else: |
|---|
| 471 | banner = wcomponents.WContribListBannerModif(self._target).getHTML() |
|---|
| 472 | body = wcomponents.WTabControl( self._tabCtrl, self._getAW() ).getHTML( self._getTabContent( params ) ) |
|---|
| 473 | <<<<<<< HEAD:indico/MaKaC/webinterface/pages/contributions.py |
|---|
| 474 | return banner + body |
|---|
| 475 | |
|---|
| 476 | ======= |
|---|
| 477 | if not self._canModify or self._isPRM: |
|---|
| 478 | return body |
|---|
| 479 | else: |
|---|
| 480 | return banner + body |
|---|
| 481 | |
|---|
| 482 | >>>>>>> [FIXES] - task #108 + small layout fixes:indico/MaKaC/webinterface/pages/contributions.py |
|---|
| 483 | |
|---|
| 484 | class WPContribModifMain( WPContributionModifBase ): |
|---|
| 485 | |
|---|
| 486 | def _setActiveTab( self ): |
|---|
| 487 | self._tabMain.setActive() |
|---|
| 488 | |
|---|
| 489 | class WPContributionModifTools( WPContributionModifBase ): |
|---|
| 490 | |
|---|
| 491 | def _setActiveTab( self ): |
|---|
| 492 | self._tabTools.setActive() |
|---|
| 493 | |
|---|
| 494 | def _getTabContent( self, params ): |
|---|
| 495 | wc = wcomponents.WContribModifTool( self._target ) |
|---|
| 496 | pars = { \ |
|---|
| 497 | "deleteContributionURL": urlHandlers.UHContributionDelete.getURL( self._target ), \ |
|---|
| 498 | "MoveContributionURL": urlHandlers.UHContributionMove.getURL( self._target ), \ |
|---|
| 499 | "writeMinutes": urlHandlers.UHContributionWriteMinutes.getURL( self._target ) } |
|---|
| 500 | return wc.getHTML( pars ) |
|---|
| 501 | |
|---|
| 502 | class WPContributionModifMaterials( WPContributionModifBase ): |
|---|
| 503 | |
|---|
| 504 | _userData = ['favorite-user-list'] |
|---|
| 505 | |
|---|
| 506 | def __init__(self, rh, contribution): |
|---|
| 507 | WPContributionModifBase.__init__(self, rh, contribution) |
|---|
| 508 | |
|---|
| 509 | def _setActiveTab( self ): |
|---|
| 510 | self._tabMaterials.setActive() |
|---|
| 511 | |
|---|
| 512 | def _getTabContent( self, pars ): |
|---|
| 513 | wc=wcomponents.WShowExistingMaterial(self._target, mode='management', show=True) |
|---|
| 514 | return wc.getHTML( pars ) |
|---|
| 515 | |
|---|
| 516 | class WPModSearchPrimAuthor ( WPContribModifMain ): |
|---|
| 517 | |
|---|
| 518 | def _getTabContent(self,params): |
|---|
| 519 | url = urlHandlers.UHContribModPrimAuthSearch.getURL() |
|---|
| 520 | self._conf = self._target.getConference() |
|---|
| 521 | searchExt = params.get("searchExt","") |
|---|
| 522 | if searchExt != "": |
|---|
| 523 | searchLocal = False |
|---|
| 524 | else: |
|---|
| 525 | searchLocal = True |
|---|
| 526 | wc=wcomponents.WAuthorSearch(self._conf,url, addTo=2,forceWithoutExtAuth=searchLocal) |
|---|
| 527 | params["addURL"]=urlHandlers.UHContribModPrimAuthSearchAdd.getURL() |
|---|
| 528 | return wc.getHTML( params ) |
|---|
| 529 | |
|---|
| 530 | class WPModSearchCoAuthor ( WPContribModifMain ): |
|---|
| 531 | |
|---|
| 532 | def _getTabContent(self,params): |
|---|
| 533 | url = urlHandlers.UHContribModCoAuthSearch.getURL() |
|---|
| 534 | self._conf = self._target.getConference() |
|---|
| 535 | searchExt = params.get("searchExt","") |
|---|
| 536 | if searchExt != "": |
|---|
| 537 | searchLocal = False |
|---|
| 538 | else: |
|---|
| 539 | searchLocal = True |
|---|
| 540 | wc=wcomponents.WAuthorSearch(self._conf,url, addTo=2,forceWithoutExtAuth=searchLocal) |
|---|
| 541 | params["addURL"]=urlHandlers.UHContribModCoAuthSearchAdd.getURL() |
|---|
| 542 | return wc.getHTML( params ) |
|---|
| 543 | |
|---|
| 544 | class WPModSearchSpeaker ( WPContribModifMain ): |
|---|
| 545 | |
|---|
| 546 | def _getTabContent(self,params): |
|---|
| 547 | url = urlHandlers.UHContribModSpeakerSearch.getURL() |
|---|
| 548 | self._conf = self._target.getConference() |
|---|
| 549 | searchExt = params.get("searchExt","") |
|---|
| 550 | if searchExt != "": |
|---|
| 551 | searchLocal = False |
|---|
| 552 | else: |
|---|
| 553 | searchLocal = True |
|---|
| 554 | wc=wcomponents.WAuthorSearch(self._conf,url, addTo=2,forceWithoutExtAuth=searchLocal) |
|---|
| 555 | params["addURL"]=urlHandlers.UHContribModSpeakerSearchAdd.getURL() |
|---|
| 556 | return wc.getHTML( params ) |
|---|
| 557 | |
|---|
| 558 | class WAuthorTable(wcomponents.WTemplated): |
|---|
| 559 | |
|---|
| 560 | def __init__(self, authList, contrib): |
|---|
| 561 | self._list = authList |
|---|
| 562 | self._conf = contrib.getConference() |
|---|
| 563 | self._contrib = contrib |
|---|
| 564 | |
|---|
| 565 | def getVars(self): |
|---|
| 566 | vars=wcomponents.WTemplated.getVars(self) |
|---|
| 567 | urlGen=vars.get("modAuthorURLGen",None) |
|---|
| 568 | l = [] |
|---|
| 569 | for author in self._list: |
|---|
| 570 | authCaption=author.getFullName() |
|---|
| 571 | if author.getAffiliation()!="": |
|---|
| 572 | authCaption="%s (%s)"%(authCaption,author.getAffiliation()) |
|---|
| 573 | if urlGen: |
|---|
| 574 | authCaption="""<a href=%s>%s</a>"""%(urlGen(author),self.htmlText(authCaption)) |
|---|
| 575 | href ="\"\"" |
|---|
| 576 | if author.getEmail() != "": |
|---|
| 577 | mailtoSubject = """[%s] _("Contribution") %s: %s"""%( self._conf.getTitle(), self._contrib.getId(), self._contrib.getTitle() ) |
|---|
| 578 | mailtoURL = "mailto:%s?subject=%s"%( author.getEmail(), urllib.quote( mailtoSubject ) ) |
|---|
| 579 | href = quoteattr( mailtoURL ) |
|---|
| 580 | emailHtml = """ <a href=%s><img src="%s" style="border:0px" alt="email"></a> """%(href, Config.getInstance().getSystemIconURL("smallEmail")) |
|---|
| 581 | upURLGen=vars.get("upAuthorURLGen",None) |
|---|
| 582 | up="" |
|---|
| 583 | if upURLGen is not None: |
|---|
| 584 | up="""<a href=%s><img src=%s border="0" alt="up"></a>"""%(quoteattr(str(upURLGen(author))),quoteattr(str(Config.getInstance().getSystemIconURL("upArrow")))) |
|---|
| 585 | downURLGen=vars.get("downAuthorURLGen",None) |
|---|
| 586 | down="" |
|---|
| 587 | if downURLGen is not None: |
|---|
| 588 | down="""<a href=%s><img src=%s border="0" alt="down"></a>"""%(quoteattr(str(downURLGen(author))),quoteattr(str(Config.getInstance().getSystemIconURL("downArrow")))) |
|---|
| 589 | l.append("""<input type="checkbox" name="selAuthor" value=%s>%s%s%s %s"""%(quoteattr(author.getId()),up,down,emailHtml,authCaption)) |
|---|
| 590 | vars["authors"] = "<br>".join(l) |
|---|
| 591 | vars["remAuthorsURL"] = vars.get("remAuthorsURL","") |
|---|
| 592 | vars["addAuthorsURL"] = vars.get("addAuthorsURL","") |
|---|
| 593 | vars["searchAuthorURL"] = vars.get("searchAuthorURL","") |
|---|
| 594 | return vars |
|---|
| 595 | |
|---|
| 596 | class WContribModifClosed(wcomponents.WTemplated): |
|---|
| 597 | |
|---|
| 598 | def __init__(self): |
|---|
| 599 | pass |
|---|
| 600 | |
|---|
| 601 | def getVars(self): |
|---|
| 602 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 603 | vars["closedIconURL"] = Config.getInstance().getSystemIconURL("closed") |
|---|
| 604 | return vars |
|---|
| 605 | |
|---|
| 606 | class WContribModifMain(wcomponents.WTemplated): |
|---|
| 607 | |
|---|
| 608 | def __init__( self, contribution, mfRegistry, eventType = "conference" ): |
|---|
| 609 | self._contrib = contribution |
|---|
| 610 | self._mfRegistry = mfRegistry |
|---|
| 611 | self._eventType = eventType |
|---|
| 612 | |
|---|
| 613 | def _getAbstractHTML( self ): |
|---|
| 614 | if not self._contrib.getConference().getAbstractMgr().isActive() or not self._contrib.getConference().hasEnabledSection("cfa"): |
|---|
| 615 | return "" |
|---|
| 616 | abs = self._contrib.getAbstract() |
|---|
| 617 | if abs is not None: |
|---|
| 618 | html = _(""" |
|---|
| 619 | <tr> |
|---|
| 620 | <td class="dataCaptionTD"><span class="dataCaptionFormat"> _("Abstract")</span></td> |
|---|
| 621 | <td bgcolor="white" class="blacktext"><a href=%s>%s - %s</a></td> |
|---|
| 622 | </tr> |
|---|
| 623 | <tr> |
|---|
| 624 | <td colspan="3" class="horizontalLine"> </td> |
|---|
| 625 | </tr> |
|---|
| 626 | """)%( quoteattr(str(urlHandlers.UHAbstractManagment.getURL(abs))),\ |
|---|
| 627 | self.htmlText(abs.getId()), abs.getTitle() ) |
|---|
| 628 | else: |
|---|
| 629 | html = _(""" |
|---|
| 630 | <tr> |
|---|
| 631 | <td class="dataCaptionTD"><span class="dataCaptionFormat"> _("Abstract")</span></td> |
|---|
| 632 | <td bgcolor="white" class="blacktext"> <font color="red"> _("The abstract associated with this contribution has been removed")</font></td> |
|---|
| 633 | </tr> |
|---|
| 634 | <tr> |
|---|
| 635 | <td colspan="3" class="horizontalLine"> </td> |
|---|
| 636 | </tr> |
|---|
| 637 | """) |
|---|
| 638 | return html |
|---|
| 639 | |
|---|
| 640 | def _getSpeakersHTML(self): |
|---|
| 641 | res=[] |
|---|
| 642 | for spk in self._contrib.getSpeakerList(): |
|---|
| 643 | fullName = self.htmlText(spk.getFullName()) |
|---|
| 644 | submitter = "" |
|---|
| 645 | if spk.getEmail() in self._contrib.getSubmitterEmailList(): |
|---|
| 646 | submitter = _(""" <small>(_("Submitter"))</small>""") |
|---|
| 647 | for emails in [av.getEmails() for av in self._contrib.getSubmitterList() if av != None and hasattr(av,"getEmails")]: |
|---|
| 648 | if spk.getEmail() in emails: |
|---|
| 649 | submitter = _(""" <small>( _("Submitter"))</small>""") |
|---|
| 650 | break |
|---|
| 651 | |
|---|
| 652 | #if not self._contrib.isAuthor(spk): |
|---|
| 653 | fullName = """<a href=%s>%s</a>"""%(quoteattr(str(urlHandlers.UHContribModSpeaker.getURL(spk))), \ |
|---|
| 654 | self.htmlText(spk.getFullName())) |
|---|
| 655 | res.append("""<input type="checkbox" name="selSpeaker" value=%s><i>%s</i>%s"""%(quoteattr(str(spk.getId())),fullName, submitter)) |
|---|
| 656 | return "<br>".join(res) |
|---|
| 657 | |
|---|
| 658 | def _getAuthorsForSpeakers(self): |
|---|
| 659 | res=["""<option value=""></option>"""] |
|---|
| 660 | for auth in self._contrib.getPrimaryAuthorList(): |
|---|
| 661 | if self._contrib.isSpeaker(auth): |
|---|
| 662 | continue |
|---|
| 663 | res.append("""<option value=%s>%s</option>"""%(quoteattr(auth.getId()),self.htmlText(auth.getFullName()))) |
|---|
| 664 | for auth in self._contrib.getCoAuthorList(): |
|---|
| 665 | if self._contrib.isSpeaker(auth): |
|---|
| 666 | continue |
|---|
| 667 | res.append("""<option value=%s>%s</option>"""%(quoteattr(auth.getId()),self.htmlText(auth.getFullName()))) |
|---|
| 668 | return "".join(res) |
|---|
| 669 | |
|---|
| 670 | def _getChangeTracksHTML(self): |
|---|
| 671 | res=[] |
|---|
| 672 | if not self._contrib.getTrack() is None: |
|---|
| 673 | res=[ _("""<option value="">--_("none")--</option>""")] |
|---|
| 674 | for track in self._contrib.getConference().getTrackList(): |
|---|
| 675 | if self._contrib.getTrack()==track: |
|---|
| 676 | continue |
|---|
| 677 | res.append("""<option value=%s>%s</option>"""%(quoteattr(str(track.getId())),self.htmlText(track.getTitle()))) |
|---|
| 678 | return "".join(res) |
|---|
| 679 | |
|---|
| 680 | def _getChangeSessionsHTML(self): |
|---|
| 681 | res=[] |
|---|
| 682 | if not self._contrib.getSession() is None: |
|---|
| 683 | res=[ _("""<option value="">--_("none")--</option>""")] |
|---|
| 684 | for session in self._contrib.getConference().getSessionListSorted(): |
|---|
| 685 | if self._contrib.getSession()==session: |
|---|
| 686 | continue |
|---|
| 687 | from MaKaC.common.TemplateExec import truncateTitle |
|---|
| 688 | res.append("""<option value=%s>%s</option>"""%(quoteattr(str(session.getId())),self.htmlText(truncateTitle(session.getTitle(), 60)))) |
|---|
| 689 | return "".join(res) |
|---|
| 690 | |
|---|
| 691 | def _getWithdrawnNoticeHTML(self): |
|---|
| 692 | res="" |
|---|
| 693 | status=self._contrib.getCurrentStatus() |
|---|
| 694 | if isinstance(status,conference.ContribStatusWithdrawn): |
|---|
| 695 | res= _(""" |
|---|
| 696 | <tr> |
|---|
| 697 | <td align="center"><b>--_("WITHDRAWN")--</b></td> |
|---|
| 698 | </tr> |
|---|
| 699 | """) |
|---|
| 700 | return res |
|---|
| 701 | |
|---|
| 702 | def _getWithdrawnInfoHTML(self): |
|---|
| 703 | status=self._contrib.getCurrentStatus() |
|---|
| 704 | if not isinstance(status,conference.ContribStatusWithdrawn): |
|---|
| 705 | return "" |
|---|
| 706 | comment="" |
|---|
| 707 | if status.getComment()!="": |
|---|
| 708 | comment="""<br><i>%s"""%self.htmlText(status.getComment()) |
|---|
| 709 | d=self.htmlText(status.getDate().strftime("%Y-%b-%D %H:%M")) |
|---|
| 710 | resp="" |
|---|
| 711 | if status.getResponsible() is not None: |
|---|
| 712 | resp="by %s"%self.htmlText(status.getResponsible().getFullName()) |
|---|
| 713 | html = _(""" |
|---|
| 714 | <tr> |
|---|
| 715 | <td class="dataCaptionTD"><span class="dataCaptionFormat"> _("Withdrawal information")</span></td> |
|---|
| 716 | <td bgcolor="white" class="blacktext"><b> _("WITHDRAWN")</b> _("on") %s %s%s</td> |
|---|
| 717 | </tr> |
|---|
| 718 | <tr> |
|---|
| 719 | <td colspan="3" class="horizontalLine"> </td> |
|---|
| 720 | </tr> |
|---|
| 721 | """)%(d,resp,comment) |
|---|
| 722 | return html |
|---|
| 723 | |
|---|
| 724 | def _getAdditionalFieldsHTML(self): |
|---|
| 725 | html="" |
|---|
| 726 | if self._contrib.getConference().getAbstractMgr().isActive() and self._contrib.getConference().hasEnabledSection("cfa") and self._contrib.getConference().getAbstractMgr().hasAnyEnabledAbstractField(): |
|---|
| 727 | for f in self._contrib.getConference().getAbstractMgr().getAbstractFieldsMgr().getFields(): |
|---|
| 728 | if f.isActive(): |
|---|
| 729 | id = f.getId() |
|---|
| 730 | caption = f.getName() |
|---|
| 731 | html+=""" |
|---|
| 732 | <tr> |
|---|
| 733 | <td class="dataCaptionTD"><span class="dataCaptionFormat">%s</span></td> |
|---|
| 734 | <td bgcolor="white" class="blacktext"><table class="tablepre"><tr><td><pre>%s</pre></td></tr></table></td> |
|---|
| 735 | </tr>"""%(caption, self.htmlText( self._contrib.getField(id) )) |
|---|
| 736 | return html |
|---|
| 737 | |
|---|
| 738 | |
|---|
| 739 | def getVars( self ): |
|---|
| 740 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 741 | vars["eventType"] = self._eventType |
|---|
| 742 | vars["withdrawnNotice"]=self._getWithdrawnNoticeHTML() |
|---|
| 743 | vars["locator"] = self._contrib.getLocator().getWebForm() |
|---|
| 744 | vars["title"] = self._contrib.getTitle() |
|---|
| 745 | if isStringHTML(self._contrib.getDescription()): |
|---|
| 746 | vars["description"] = self._contrib.getDescription() |
|---|
| 747 | else: |
|---|
| 748 | vars["description"] = """<table class="tablepre"><tr><td><pre>%s</pre></td></tr></table>""" % self._contrib.getDescription() |
|---|
| 749 | vars["additionalFields"] = self._getAdditionalFieldsHTML() |
|---|
| 750 | vars["rowspan"]="6" |
|---|
| 751 | tmp = WAuthorTable( self._contrib.getPrimaryAuthorList(), self._contrib ) |
|---|
| 752 | p = {"addAuthorsURL":quoteattr(str(urlHandlers.UHContribModNewPrimAuthor.getURL(self._contrib))), \ |
|---|
| 753 | "authorActionURL":quoteattr(str(urlHandlers.UHContribModPrimaryAuthorAction.getURL(self._contrib))), \ |
|---|
| 754 | "modAuthorURLGen":urlHandlers.UHContribModPrimAuthor.getURL,\ |
|---|
| 755 | "upAuthorURLGen":urlHandlers.UHContribModPrimAuthUp.getURL, \ |
|---|
| 756 | "downAuthorURLGen":urlHandlers.UHContribModPrimAuthDown.getURL, \ |
|---|
| 757 | "searchAuthorURL":quoteattr(str(urlHandlers.UHContribModPrimAuthSearch.getURL(self._contrib))), \ |
|---|
| 758 | "moveValue": _("to co-author")} |
|---|
| 759 | vars["primAuthTable"] = tmp.getHTML(p) |
|---|
| 760 | tmp = WAuthorTable( self._contrib.getCoAuthorList(), self._contrib) |
|---|
| 761 | p = {"addAuthorsURL":quoteattr(str(urlHandlers.UHContribModNewCoAuthor.getURL(self._contrib))), \ |
|---|
| 762 | "authorActionURL":quoteattr(str(urlHandlers.UHContribModCoAuthorAction.getURL(self._contrib))), \ |
|---|
| 763 | "modAuthorURLGen":urlHandlers.UHContribModCoAuthor.getURL,\ |
|---|
| 764 | "upAuthorURLGen":urlHandlers.UHContribModCoAuthUp.getURL, \ |
|---|
| 765 | "downAuthorURLGen":urlHandlers.UHContribModCoAuthDown.getURL, \ |
|---|
| 766 | "searchAuthorURL":quoteattr(str(urlHandlers.UHContribModCoAuthSearch.getURL(self._contrib))), \ |
|---|
| 767 | "moveValue": _("to primary")} |
|---|
| 768 | vars["coAuthTable"] = tmp.getHTML(p) |
|---|
| 769 | vars["place"] = "" |
|---|
| 770 | if self._contrib.getLocation(): |
|---|
| 771 | vars["place"]=self.htmlText(self._contrib.getLocation().getName()) |
|---|
| 772 | room=self._contrib.getRoom() |
|---|
| 773 | if room is not None and room.getName().strip()!="": |
|---|
| 774 | vars["place"]= _("""%s <br> _("Room"): %s""")%(vars["place"],self.htmlText(room.getName())) |
|---|
| 775 | if self._eventType == "conference" and self._contrib.getBoardNumber()!="" and self._contrib.getBoardNumber() is not None: |
|---|
| 776 | vars["place"]= _("""%s<br> _("Board #")%s""")%(vars["place"],self.htmlText(self._contrib.getBoardNumber())) |
|---|
| 777 | vars["id"] = self.htmlText( self._contrib.getId() ) |
|---|
| 778 | vars["dataModificationURL"] = str( urlHandlers.UHContributionDataModification.getURL( self._contrib ) ) |
|---|
| 779 | vars["duration"]="" |
|---|
| 780 | if self._contrib.getDuration() is not None: |
|---|
| 781 | vars["duration"]=(datetime(1900,1,1)+self._contrib.getDuration()).strftime("%Hh%M'") |
|---|
| 782 | vars["type"] = "" |
|---|
| 783 | if self._contrib.getType(): |
|---|
| 784 | vars["type"] = self.htmlText( self._contrib.getType().getName() ) |
|---|
| 785 | vars["track"] = _("""--_("none")--""") |
|---|
| 786 | if self._contrib.getTrack(): |
|---|
| 787 | vars["track"] = """<a href=%s>%s</a>"""%(quoteattr(str(urlHandlers.UHTrackModification.getURL(self._contrib.getTrack()))),self.htmlText(self._contrib.getTrack().getTitle())) |
|---|
| 788 | vars["session"] = "" |
|---|
| 789 | if self._contrib.getSession(): |
|---|
| 790 | vars["session"]="""<a href=%s>%s</a>"""%(quoteattr(str(urlHandlers.UHSessionModification.getURL(self._contrib.getSession()))),self.htmlText(self._contrib.getSession().getTitle())) |
|---|
| 791 | vars["abstract"] = "" |
|---|
| 792 | if isinstance(self._contrib, conference.AcceptedContribution): |
|---|
| 793 | vars["abstract"] = self._getAbstractHTML() |
|---|
| 794 | vars["speakers"]=self._getSpeakersHTML() |
|---|
| 795 | vars["contrib"] = self._contrib |
|---|
| 796 | vars["authorsForSpeakers"]=self._getAuthorsForSpeakers() |
|---|
| 797 | vars["addSpeakersURL"]=quoteattr(str(urlHandlers.UHContribModAddSpeakers.getURL(self._contrib))) |
|---|
| 798 | vars["newSpeakerURL"]=quoteattr(str(urlHandlers.UHContribModNewSpeaker.getURL(self._contrib))) |
|---|
| 799 | vars["remSpeakersURL"]=quoteattr(str(urlHandlers.UHContribModRemSpeakers.getURL(self._contrib))) |
|---|
| 800 | vars["searchSpeakersURL"]=quoteattr(str(urlHandlers.UHContribModSpeakerSearch.getURL(self._contrib))) |
|---|
| 801 | vars["selTracks"]=self._getChangeTracksHTML() |
|---|
| 802 | vars["setTrackURL"]=quoteattr(str(urlHandlers.UHContribModSetTrack.getURL(self._contrib))) |
|---|
| 803 | vars["selSessions"]=self._getChangeSessionsHTML() |
|---|
| 804 | vars["setSessionURL"]=quoteattr(str(urlHandlers.UHContribModSetSession.getURL(self._contrib))) |
|---|
| 805 | vars["contribXML"]=urlHandlers.UHContribToXMLConfManager.getURL(self._contrib) |
|---|
| 806 | vars["contribPDF"]=urlHandlers.UHContribToPDFConfManager.getURL(self._contrib) |
|---|
| 807 | vars["printIconURL"] = Config.getInstance().getSystemIconURL("pdf") |
|---|
| 808 | vars["xmlIconURL"]=Config.getInstance().getSystemIconURL("xml") |
|---|
| 809 | vars["withdrawURL"]=quoteattr(str(urlHandlers.UHContribModWithdraw.getURL(self._contrib))) |
|---|
| 810 | vars["withdrawnInfo"]=self._getWithdrawnInfoHTML() |
|---|
| 811 | vars["withdrawDisabled"]=False |
|---|
| 812 | if isinstance(self._contrib.getCurrentStatus(),conference.ContribStatusWithdrawn): |
|---|
| 813 | vars["withdrawDisabled"]=True |
|---|
| 814 | vars["reportNumbersTable"]=wcomponents.WReportNumbersTable(self._contrib,"contribution").getHTML() |
|---|
| 815 | vars["keywords"]=self._contrib.getKeywords() |
|---|
| 816 | if self._contrib.getSession(): |
|---|
| 817 | vars["sessionType"] = self._contrib.getSession().getScheduleType() |
|---|
| 818 | else: |
|---|
| 819 | vars["sessionType"] = 'none' |
|---|
| 820 | return vars |
|---|
| 821 | |
|---|
| 822 | |
|---|
| 823 | class WPContributionModification( WPContribModifMain ): |
|---|
| 824 | |
|---|
| 825 | def _getTabContent( self, params ): |
|---|
| 826 | wc = WContribModifMain( self._contrib, materialFactories.ContribMFRegistry() ) |
|---|
| 827 | return wc.getHTML() |
|---|
| 828 | |
|---|
| 829 | class WPContributionModificationClosed( WPContribModifMain ): |
|---|
| 830 | |
|---|
| 831 | def _createTabCtrl( self ): |
|---|
| 832 | self._tabCtrl = wcomponents.TabControl() |
|---|
| 833 | self._tabMain = self._tabCtrl.newTab( "main", _("Main"), "") |
|---|
| 834 | |
|---|
| 835 | def _getTabContent( self, params ): |
|---|
| 836 | wc = WContribModifClosed() |
|---|
| 837 | return wc.getHTML() |
|---|
| 838 | |
|---|
| 839 | |
|---|
| 840 | class WContribModNewPrimAuthor(wcomponents.WTemplated): |
|---|
| 841 | |
|---|
| 842 | def __init__(self,contrib): |
|---|
| 843 | self._contrib = contrib |
|---|
| 844 | |
|---|
| 845 | def getVars( self ): |
|---|
| 846 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 847 | vars["postURL"]=quoteattr(str(urlHandlers.UHContribModNewPrimAuthor.getURL(self._contrib))) |
|---|
| 848 | vars["titles"]=TitlesRegistry().getSelectItemsHTML() |
|---|
| 849 | return vars |
|---|
| 850 | |
|---|
| 851 | |
|---|
| 852 | |
|---|
| 853 | class WPModNewPrimAuthor( WPContribModifMain ): |
|---|
| 854 | |
|---|
| 855 | def _getTabContent( self, params ): |
|---|
| 856 | wc = WContribModNewPrimAuthor(self._contrib) |
|---|
| 857 | return wc.getHTML() |
|---|
| 858 | |
|---|
| 859 | |
|---|
| 860 | class WContribModPrimAuthor(wcomponents.WTemplated): |
|---|
| 861 | |
|---|
| 862 | def __init__(self,auth): |
|---|
| 863 | self._auth=auth |
|---|
| 864 | |
|---|
| 865 | def getVars( self ): |
|---|
| 866 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 867 | vars["postURL"]=quoteattr(str(urlHandlers.UHContribModPrimAuthor.getURL(self._auth))) |
|---|
| 868 | vars["titles"]=TitlesRegistry.getSelectItemsHTML(self._auth.getTitle()) |
|---|
| 869 | vars["surName"]=quoteattr(self._auth.getFamilyName()) |
|---|
| 870 | vars["name"]=quoteattr(self._auth.getFirstName()) |
|---|
| 871 | vars["affiliation"]=quoteattr(self._auth.getAffiliation()) |
|---|
| 872 | vars["email"]=quoteattr(self._auth.getEmail()) |
|---|
| 873 | vars["address"]=self._auth.getAddress() |
|---|
| 874 | vars["phone"]=quoteattr(self._auth.getPhone()) |
|---|
| 875 | vars["fax"]=quoteattr(self._auth.getFax()) |
|---|
| 876 | return vars |
|---|
| 877 | |
|---|
| 878 | |
|---|
| 879 | class WPModPrimAuthor( WPContribModifMain ): |
|---|
| 880 | |
|---|
| 881 | def _getTabContent( self, params ): |
|---|
| 882 | wc = WContribModPrimAuthor(params["author"]) |
|---|
| 883 | return wc.getHTML() |
|---|
| 884 | |
|---|
| 885 | class WContribModNewCoAuthor(wcomponents.WTemplated): |
|---|
| 886 | |
|---|
| 887 | def __init__(self,contrib): |
|---|
| 888 | self._contrib = contrib |
|---|
| 889 | |
|---|
| 890 | def getVars( self ): |
|---|
| 891 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 892 | vars["postURL"]=quoteattr(str(urlHandlers.UHContribModNewCoAuthor.getURL(self._contrib))) |
|---|
| 893 | vars["titles"]=TitlesRegistry().getSelectItemsHTML() |
|---|
| 894 | return vars |
|---|
| 895 | |
|---|
| 896 | |
|---|
| 897 | class WPModNewCoAuthor( WPContribModifMain ): |
|---|
| 898 | |
|---|
| 899 | def _getTabContent( self, params ): |
|---|
| 900 | wc = WContribModNewCoAuthor(self._contrib) |
|---|
| 901 | return wc.getHTML() |
|---|
| 902 | |
|---|
| 903 | class WContribModNewSpeaker(wcomponents.WTemplated): |
|---|
| 904 | |
|---|
| 905 | def __init__(self,contrib): |
|---|
| 906 | self._contrib = contrib |
|---|
| 907 | |
|---|
| 908 | def getVars( self ): |
|---|
| 909 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 910 | vars["postURL"]=quoteattr(str(urlHandlers.UHContribModNewSpeaker.getURL(self._contrib))) |
|---|
| 911 | vars["titles"]=TitlesRegistry().getSelectItemsHTML() |
|---|
| 912 | return vars |
|---|
| 913 | |
|---|
| 914 | |
|---|
| 915 | class WPModNewSpeaker( WPContribModifMain ): |
|---|
| 916 | |
|---|
| 917 | def _getTabContent( self, params ): |
|---|
| 918 | wc = WContribModNewSpeaker(self._contrib) |
|---|
| 919 | return wc.getHTML() |
|---|
| 920 | |
|---|
| 921 | |
|---|
| 922 | class WContribModCoAuthor(wcomponents.WTemplated): |
|---|
| 923 | |
|---|
| 924 | def __init__(self,auth): |
|---|
| 925 | self._auth=auth |
|---|
| 926 | |
|---|
| 927 | def getVars( self ): |
|---|
| 928 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 929 | vars["postURL"]=quoteattr(str(urlHandlers.UHContribModCoAuthor.getURL(self._auth))) |
|---|
| 930 | vars["titles"]=TitlesRegistry.getSelectItemsHTML(self._auth.getTitle()) |
|---|
| 931 | vars["surName"]=quoteattr(self._auth.getFamilyName()) |
|---|
| 932 | vars["name"]=quoteattr(self._auth.getFirstName()) |
|---|
| 933 | vars["affiliation"]=quoteattr(self._auth.getAffiliation()) |
|---|
| 934 | vars["email"]=quoteattr(self._auth.getEmail()) |
|---|
| 935 | vars["address"]=self._auth.getAddress() |
|---|
| 936 | vars["phone"]=quoteattr(self._auth.getPhone()) |
|---|
| 937 | vars["fax"]=quoteattr(self._auth.getFax()) |
|---|
| 938 | return vars |
|---|
| 939 | |
|---|
| 940 | |
|---|
| 941 | class WPModCoAuthor( WPContribModifMain ): |
|---|
| 942 | |
|---|
| 943 | def _getTabContent( self, params ): |
|---|
| 944 | wc = WContribModCoAuthor(params["author"]) |
|---|
| 945 | return wc.getHTML() |
|---|
| 946 | |
|---|
| 947 | class WContribModSpeaker(wcomponents.WTemplated): |
|---|
| 948 | |
|---|
| 949 | def __init__(self,auth): |
|---|
| 950 | self._auth=auth |
|---|
| 951 | |
|---|
| 952 | def _getAddAsSubmitterHTML(self): |
|---|
| 953 | html= _(""" |
|---|
| 954 | <tr> |
|---|
| 955 | <td nowrap class="titleCellTD"> |
|---|
| 956 | <span class="titleCellFormat"> _("Submission control")</span> |
|---|
| 957 | </td> |
|---|
| 958 | <td bgcolor="white" width="100%%" valign="top" class="blacktext" style="padding-left:5px"> |
|---|
| 959 | %s |
|---|
| 960 | </td> |
|---|
| 961 | </tr> |
|---|
| 962 | <tr> |
|---|
| 963 | <td colspan="2"> </td> |
|---|
| 964 | </tr> |
|---|
| 965 | """) |
|---|
| 966 | from MaKaC.user import AvatarHolder |
|---|
| 967 | ah = AvatarHolder() |
|---|
| 968 | results=ah.match({"email":self._auth.getEmail()}, exact=1) |
|---|
| 969 | if results is not None and results!=[]: |
|---|
| 970 | av=results[0] |
|---|
| 971 | if self._auth.getContribution().canUserSubmit(av): |
|---|
| 972 | html=html%( _("""This speaker Already have submission rights.""")) |
|---|
| 973 | else: |
|---|
| 974 | html=html% _("""<input type="checkbox" name="submissionControl"> _("Give submission rights to the speaker").""") |
|---|
| 975 | elif self._auth.getEmail() in self._auth.getContribution().getSubmitterEmailList(): |
|---|
| 976 | html=html%( _("""This speaker Already have submission rights.""")) |
|---|
| 977 | else: |
|---|
| 978 | html=html% _("""<input type="checkbox" name="submissionControl"> _("Give submission rights to the speaker.")<br><br><i><font color="black"><b> _("Note"): </b></font> _("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 submission rights.")</i>""") |
|---|
| 979 | return html |
|---|
| 980 | |
|---|
| 981 | def getVars( self ): |
|---|
| 982 | vars = wcomponents.WTemplated.getVars(self) |
|---|
| 983 | vars["postURL"]=quoteattr(str(urlHandlers.UHContribModSpeaker.getURL(self._auth))) |
|---|
| 984 | vars["titles"]=TitlesRegistry.getSelectItemsHTML(self._auth.getTitle()) |
|---|
| 985 | vars["surName"]=quoteattr(self._auth.getFamilyName()) |
|---|
| 986 | vars["name"]=quoteattr(self._auth.getFirstName()) |
|---|
| 987 | vars["affiliation"]=quoteattr(self._auth.getAffiliation()) |
|---|
| 988 | vars["email"]=quoteattr(self._auth.getEmail()) |
|---|
| 989 | vars["address"]=self._auth.getAddress() |
|---|
| 990 | vars["phone"]=quoteattr(self._auth.getPhone()) |
|---|
| 991 | vars["fax"]=quoteattr(self._auth.getFax()) |
|---|
| 992 | vars["addAsSubmitter"]=self._getAddAsSubmitterHTML() |
|---|
| 993 | return vars |
|---|
| 994 | |
|---|
| 995 | |
|---|
| 996 | class WPModSpeaker( WPContribModifMain ): |
|---|
| 997 | |
|---|
| 998 | def _getTabContent( self, params ): |
|---|
| 999 | wc = WContribModSpeaker(params["author"]) |
|---|
| 1000 | return wc.getHTML() |
|---|
| 1001 | |
|---|
| 1002 | class WContribModWithdraw(wcomponents.WTemplated): |
|---|
| 1003 | |
|---|
| 1004 | def __init__(self,contrib): |
|---|
| 1005 | self._contrib=contrib |
|---|
| 1006 | |
|---|
| 1007 | def getVars(self): |
|---|
| 1008 | vars=wcomponents.WTemplated.getVars(self) |
|---|
| 1009 | vars["postURL"]=quoteattr(str(urlHandlers.UHContribModWithdraw.getURL(self._contrib))) |
|---|
| 1010 | vars["comment"]=self.htmlText("") |
|---|
| 1011 | return vars |
|---|
| 1012 | |
|---|
| 1013 | class WPModWithdraw(WPContribModifMain): |
|---|
| 1014 | |
|---|
| 1015 | def _getTabContent(self,params): |
|---|
| 1016 | wc=WContribModWithdraw(self._target) |
|---|
| 1017 | return wc.getHTML() |
|---|
| 1018 | |
|---|
| 1019 | class WContribModifAC(wcomponents.WTemplated): |
|---|
| 1020 | |
|---|
| 1021 | def __init__( self, contrib ): |
|---|
| 1022 | self._contrib = contrib |
|---|
| 1023 | |
|---|
| 1024 | def _getSubmittersHTML(self): |
|---|
| 1025 | #return wcomponents.WPrincipalTable().getHTML( self._contrib.getSubmitterList(), self._contrib, "", "" ) |
|---|
| 1026 | res=[] |
|---|
| 1027 | for sub in self._contrib.getSubmitterList(): |
|---|
| 1028 | if sub != None: |
|---|
| 1029 | if type(sub) == user.Avatar: |
|---|
| 1030 | res.append("""<input type="checkbox" name="selUsers" value=%s>%s"""%(quoteattr(str(sub.getId())),self.htmlText(sub.getFullName()))) |
|---|
| 1031 | else: |
|---|
| 1032 | res.append("""<input type="checkbox" name="selUsers" value=%s>%s"""%(quoteattr(str(sub.getId())),self.htmlText(sub.getName()))) |
|---|
| 1033 | for email in self._contrib.getSubmitterEmailList(): |
|---|
| 1034 | res.append( _("""<input type="checkbox" name="selUsers" value=%s>%s <small>( _("Pending"))</small>""")%(quoteattr(email),email)) |
|---|
| 1035 | return "<br>".join(res) |
|---|
| 1036 | |
|---|
| 1037 | def getVars( self ): |
|---|
| 1038 | vars=wcomponents.WTemplated.getVars( self ) |
|---|
| 1039 | vars["submitters"]=self._getSubmittersHTML() |
|---|
| 1040 | vars["addSubmittersURL"]=quoteattr(str(urlHandlers.UHContribModSubmittersSel.getURL(self._contrib))) |
|---|
| 1041 | vars["remSubmittersURL"]=quoteattr(str(urlHandlers.UHContribModSubmittersRem.getURL(self._contrib))) |
|---|
| 1042 | mcf=wcomponents.WModificationControlFrame() |
|---|
| 1043 | addMgrURL=urlHandlers.UHContributionSelectManagers.getURL() |
|---|
| 1044 | remMgrURL=urlHandlers.UHContributionRemoveManagers.getURL() |
|---|
| 1045 | vars["modifyControlFrame"]=mcf.getHTML(self._contrib,addMgrURL,remMgrURL) |
|---|
| 1046 | acf=wcomponents.WAccessControlFrame() |
|---|
| 1047 | visURL=urlHandlers.UHContributionSetVisibility.getURL() |
|---|
| 1048 | |
|---|
| 1049 | if isinstance(self._contrib.getOwner(), conference.Session): |
|---|
| 1050 | vars["accessControlFrame"]=acf.getHTML(self._contrib, visURL, "InSessionContribution") |
|---|
| 1051 | else : |
|---|
| 1052 | vars["accessControlFrame"]=acf.getHTML(self._contrib, visURL, "Contribution") |
|---|
| 1053 | |
|---|
| 1054 | if not self._contrib.isProtected(): |
|---|
| 1055 | df=wcomponents.WDomainControlFrame( self._contrib ) |
|---|
| 1056 | addDomURL=urlHandlers.UHContributionAddDomain.getURL() |
|---|
| 1057 | remDomURL=urlHandlers.UHContributionRemoveDomain.getURL() |
|---|
| 1058 | vars["accessControlFrame"] += "<br>%s"%df.getHTML(addDomURL,remDomURL) |
|---|
| 1059 | return vars |
|---|
| 1060 | |
|---|
| 1061 | |
|---|
| 1062 | class WPContribModifAC( WPContributionModifBase ): |
|---|
| 1063 | |
|---|
| 1064 | def _setActiveTab( self ): |
|---|
| 1065 | self._tabAC.setActive() |
|---|
| 1066 | |
|---|
| 1067 | def _getTabContent( self, params ): |
|---|
| 1068 | wc=WContribModifAC(self._target) |
|---|
| 1069 | return wc.getHTML() |
|---|
| 1070 | |
|---|
| 1071 | |
|---|
| 1072 | class WPContribModifSC( WPContributionModifBase ): |
|---|
| 1073 | |
|---|
| 1074 | def _setActiveTab( self ): |
|---|
| 1075 | self._tabSubCont.setActive() |
|---|
| 1076 | |
|---|
| 1077 | |
|---|
| 1078 | def _getTabContent( self, params ): |
|---|
| 1079 | |
|---|
| 1080 | wc = wcomponents.WContribModifSC( self._target ) |
|---|
| 1081 | pars = { \ |
|---|
| 1082 | "moveSubContribURL": urlHandlers.UHSubContribActions.getURL(self._contrib), \ |
|---|
| 1083 | "addSubContURL": urlHandlers.UHContribAddSubCont.getURL(self._contrib), \ |
|---|
| 1084 | "subContModifURL": urlHandlers.UHSubContribModification.getURL, \ |
|---|
| 1085 | "subContUpURL": urlHandlers.UHContribUpSubCont.getURL(), \ |
|---|
| 1086 | "subContDownURL": urlHandlers.UHContribDownSubCont.getURL()} |
|---|
| 1087 | return wc.getHTML( pars ) |
|---|
| 1088 | |
|---|
| 1089 | #----------------------------------------------------------------------------- |
|---|
| 1090 | |
|---|
| 1091 | class WSubContributionCreation(wcomponents.WTemplated): |
|---|
| 1092 | |
|---|
| 1093 | def __init__( self, target ): |
|---|
| 1094 | self.__owner = target |
|---|
| 1095 | |
|---|
| 1096 | def getVars( self ): |
|---|
| 1097 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 1098 | vars["title"] = vars.get("title","") |
|---|
| 1099 | vars["description"] = vars.get("description","") |
|---|
| 1100 | vars["durationHours"] = vars.get("durationHours","0") |
|---|
| 1101 | vars["durationMinutes"] = vars.get("durationMinutes","15") |
|---|
| 1102 | vars["keywords"] = vars.get("keywords","") |
|---|
| 1103 | vars["locator"] = self.__owner.getLocator().getWebForm() |
|---|
| 1104 | vars["speakers"] = "" |
|---|
| 1105 | |
|---|
| 1106 | vars["presenterDefined"] = vars.get("presenterDefined","") |
|---|
| 1107 | return vars |
|---|
| 1108 | |
|---|
| 1109 | def _getPersonOptions(self): |
|---|
| 1110 | html = [] |
|---|
| 1111 | names = [] |
|---|
| 1112 | text = {} |
|---|
| 1113 | html.append("""<option value=""> </option>""") |
|---|
| 1114 | for contribution in self.__owner.getConference().getContributionList() : |
|---|
| 1115 | for speaker in contribution.getSpeakerList() : |
|---|
| 1116 | name = speaker.getFullNameNoTitle() |
|---|
| 1117 | if not(name in names) : |
|---|
| 1118 | text[name] = """<option value="s%s-%s">%s</option>"""%(contribution.getId(),speaker.getId(),name) |
|---|
| 1119 | names.append(name) |
|---|
| 1120 | for author in contribution.getAuthorList() : |
|---|
| 1121 | name = author.getFullNameNoTitle() |
|---|
| 1122 | if not name in names: |
|---|
| 1123 | text[name] = """<option value="a%s-%s">%s</option>"""%(contribution.getId(),author.getId(),name) |
|---|
| 1124 | names.append(name) |
|---|
| 1125 | for coauthor in contribution.getCoAuthorList() : |
|---|
| 1126 | name = coauthor.getFullNameNoTitle() |
|---|
| 1127 | if not name in names: |
|---|
| 1128 | text[name] = """<option value="c%s-%s">%s</option>"""%(contribution.getId(),coauthor.getId(),name) |
|---|
| 1129 | names.append(name) |
|---|
| 1130 | names.sort() |
|---|
| 1131 | for name in names: |
|---|
| 1132 | html.append(text[name]) |
|---|
| 1133 | return "".join(html) |
|---|
| 1134 | |
|---|
| 1135 | class WPContribAddSC( WPContributionModifBase ): |
|---|
| 1136 | |
|---|
| 1137 | def _setActiveTab( self ): |
|---|
| 1138 | self._tabSubCont.setActive() |
|---|
| 1139 | |
|---|
| 1140 | def _getTabContent( self, params ): |
|---|
| 1141 | |
|---|
| 1142 | wc = WSubContributionCreation( self._target ) |
|---|
| 1143 | pars = { \ |
|---|
| 1144 | "postURL": urlHandlers.UHContribCreateSubCont.getURL()} |
|---|
| 1145 | params.update(pars) |
|---|
| 1146 | |
|---|
| 1147 | wpresenter = wcomponents.WAddPersonModule("presenter") |
|---|
| 1148 | params["presenterOptions"] = params.get("presenterOptions",self._getPersonOptions()) |
|---|
| 1149 | params["presenter"] = wpresenter.getHTML(params) |
|---|
| 1150 | |
|---|
| 1151 | return wc.getHTML( params ) |
|---|
| 1152 | |
|---|
| 1153 | def _getPersonOptions(self): |
|---|
| 1154 | html = [] |
|---|
| 1155 | names = [] |
|---|
| 1156 | text = {} |
|---|
| 1157 | html.append("""<option value=""> </option>""") |
|---|
| 1158 | for contribution in self._contrib.getConference().getContributionList() : |
|---|
| 1159 | for speaker in contribution.getSpeakerList() : |
|---|
| 1160 | name = speaker.getFullNameNoTitle() |
|---|
| 1161 | if not(name in names) : |
|---|
| 1162 | text[name] = """<option value="s%s-%s">%s</option>"""%(contribution.getId(),speaker.getId(),name) |
|---|
| 1163 | names.append(name) |
|---|
| 1164 | for author in contribution.getAuthorList() : |
|---|
| 1165 | name = author.getFullNameNoTitle() |
|---|
| 1166 | if not name in names: |
|---|
| 1167 | text[name] = """<option value="a%s-%s">%s</option>"""%(contribution.getId(),author.getId(),name) |
|---|
| 1168 | names.append(name) |
|---|
| 1169 | for coauthor in contribution.getCoAuthorList() : |
|---|
| 1170 | name = coauthor.getFullNameNoTitle() |
|---|
| 1171 | if not name in names: |
|---|
| 1172 | text[name] = """<option value="c%s-%s">%s</option>"""%(contribution.getId(),coauthor.getId(),name) |
|---|
| 1173 | names.append(name) |
|---|
| 1174 | names.sort() |
|---|
| 1175 | for name in names: |
|---|
| 1176 | html.append(text[name]) |
|---|
| 1177 | return "".join(html) |
|---|
| 1178 | |
|---|
| 1179 | #--------------------------------------------------------------------------- |
|---|
| 1180 | |
|---|
| 1181 | class WSubContributionCreationPresenterSelect(WPContributionModifBase ): |
|---|
| 1182 | |
|---|
| 1183 | def _setActiveTab( self ): |
|---|
| 1184 | self._tabSubCont.setActive() |
|---|
| 1185 | |
|---|
| 1186 | def _getTabContent( self, params ): |
|---|
| 1187 | searchAction = str(self._rh.getCurrentURL()) |
|---|
| 1188 | searchExt = params.get("searchExt","") |
|---|
| 1189 | if searchExt != "": |
|---|
| 1190 | searchLocal = False |
|---|
| 1191 | else: |
|---|
| 1192 | searchLocal = True |
|---|
| 1193 | p = wcomponents.WComplexSelection(self._conf,searchAction,forceWithoutExtAuth=searchLocal) |
|---|
| 1194 | return p.getHTML(params) |
|---|
| 1195 | |
|---|
| 1196 | #--------------------------------------------------------------------------- |
|---|
| 1197 | |
|---|
| 1198 | class WSubContributionCreationPresenterNew(WPContributionModifBase): |
|---|
| 1199 | |
|---|
| 1200 | def _setActiveTab( self ): |
|---|
| 1201 | self._tabSubCont.setActive() |
|---|
| 1202 | |
|---|
| 1203 | def _getTabContent( self, params ): |
|---|
| 1204 | p = wcomponents.WNewPerson() |
|---|
| 1205 | |
|---|
| 1206 | if params.get("formTitle",None) is None : |
|---|
| 1207 | params["formTitle"] = _("Define new presenter") |
|---|
| 1208 | if params.get("titleValue",None) is None : |
|---|
| 1209 | params["titleValue"] = "" |
|---|
| 1210 | if params.get("surNameValue",None) is None : |
|---|
| 1211 | params["surNameValue"] = "" |
|---|
| 1212 | if params.get("nameValue",None) is None : |
|---|
| 1213 | params["nameValue"] = "" |
|---|
| 1214 | if params.get("emailValue",None) is None : |
|---|
| 1215 | params["emailValue"] = "" |
|---|
| 1216 | if params.get("addressValue",None) is None : |
|---|
| 1217 | params["addressValue"] = "" |
|---|
| 1218 | if params.get("affiliationValue",None) is None : |
|---|
| 1219 | params["affiliationValue"] = "" |
|---|
| 1220 | if params.get("phoneValue",None) is None : |
|---|
| 1221 | params["phoneValue"] = "" |
|---|
| 1222 | if params.get("faxValue",None) is None : |
|---|
| 1223 | params["faxValue"] = "" |
|---|
| 1224 | |
|---|
| 1225 | formAction = urlHandlers.UHContribCreateSubContPersonAdd.getURL(self._contrib) |
|---|
| 1226 | formAction.addParam("orgin","new") |
|---|
| 1227 | formAction.addParam("typeName","presenter") |
|---|
| 1228 | params["formAction"] = formAction |
|---|
| 1229 | |
|---|
| 1230 | return p.getHTML(params) |
|---|
| 1231 | |
|---|
| 1232 | #--------------------------------------------------------------------------- |
|---|
| 1233 | |
|---|
| 1234 | class WPContributionSelectManagers( WPContribModifAC ): |
|---|
| 1235 | |
|---|
| 1236 | def _getTabContent( self, params ): |
|---|
| 1237 | searchExt = params.get("searchExt","") |
|---|
| 1238 | if searchExt != "": |
|---|
| 1239 | searchLocal = False |
|---|
| 1240 | else: |
|---|
| 1241 | searchLocal = True |
|---|
| 1242 | wc = wcomponents.WPrincipalSelection( urlHandlers.UHContributionSelectManagers.getURL(), forceWithoutExtAuth=searchLocal ) |
|---|
| 1243 | params["addURL"] = urlHandlers.UHContributionAddManagers.getURL() |
|---|
| 1244 | return wc.getHTML( params ) |
|---|
| 1245 | |
|---|
| 1246 | |
|---|
| 1247 | class WPContributionSelectAllowed( WPContribModifAC ): |
|---|
| 1248 | |
|---|
| 1249 | def _getTabContent( self, params ): |
|---|
| 1250 | searchExt = params.get("searchExt","") |
|---|
| 1251 | if searchExt != "": |
|---|
| 1252 | searchLocal = False |
|---|
| 1253 | else: |
|---|
| 1254 | searchLocal = True |
|---|
| 1255 | wc = wcomponents.WPrincipalSelection( urlHandlers.UHContributionSelectAllowed.getURL(), forceWithoutExtAuth=searchLocal ) |
|---|
| 1256 | params["addURL"] = urlHandlers.UHContributionAddAllowed.getURL() |
|---|
| 1257 | return wc.getHTML( params ) |
|---|
| 1258 | |
|---|
| 1259 | |
|---|
| 1260 | class WContributionDataModificationBoard(wcomponents.WTemplated): |
|---|
| 1261 | |
|---|
| 1262 | def __init__(self): |
|---|
| 1263 | pass |
|---|
| 1264 | |
|---|
| 1265 | def getVars( self ): |
|---|
| 1266 | vars=wcomponents.WTemplated.getVars(self) |
|---|
| 1267 | return vars |
|---|
| 1268 | |
|---|
| 1269 | class WContributionDataModificationType(wcomponents.WTemplated): |
|---|
| 1270 | |
|---|
| 1271 | def __init__(self): |
|---|
| 1272 | pass |
|---|
| 1273 | |
|---|
| 1274 | def getVars( self ): |
|---|
| 1275 | vars=wcomponents.WTemplated.getVars(self) |
|---|
| 1276 | return vars |
|---|
| 1277 | |
|---|
| 1278 | class WContributionDataModification(wcomponents.WTemplated): |
|---|
| 1279 | |
|---|
| 1280 | def __init__( self, contribution, conf, rh = None ): |
|---|
| 1281 | self._contrib = contribution |
|---|
| 1282 | self._owner = self._contrib.getOwner() |
|---|
| 1283 | self._conf = conf |
|---|
| 1284 | self._rh = rh |
|---|
| 1285 | |
|---|
| 1286 | def _getTypeItemsHTML(self): |
|---|
| 1287 | res = ["""<option value=""></option>"""] |
|---|
| 1288 | conf=self._contrib.getConference() |
|---|
| 1289 | for type in conf.getContribTypeList(): |
|---|
| 1290 | selected="" |
|---|
| 1291 | if self._contrib.getType()==type: |
|---|
| 1292 | selected=" selected" |
|---|
| 1293 | res.append("""<option value=%s%s>%s</option>"""%(\ |
|---|
| 1294 | quoteattr(str(type.getId())),selected,\ |
|---|
| 1295 | self.htmlText(type.getName()))) |
|---|
| 1296 | return "".join(res) |
|---|
| 1297 | |
|---|
| 1298 | def _getAdditionalFieldsHTML(self): |
|---|
| 1299 | html="" |
|---|
| 1300 | if self._contrib.getConference().getAbstractMgr().isActive() and \ |
|---|
| 1301 | self._contrib.getConference().hasEnabledSection("cfa") and \ |
|---|
| 1302 | self._contrib.getConference().getType() == "conference" and \ |
|---|
| 1303 | self._contrib.getConference().getAbstractMgr().hasAnyEnabledAbstractField(): |
|---|
| 1304 | for f in self._contrib.getConference().getAbstractMgr().getAbstractFieldsMgr().getFields(): |
|---|
| 1305 | if f.isActive(): |
|---|
| 1306 | id = f.getId() |
|---|
| 1307 | caption = f.getName() |
|---|
| 1308 | html+=""" |
|---|
| 1309 | <tr> |
|---|
| 1310 | <td nowrap class="titleCellTD"> |
|---|
| 1311 | <span class="titleCellFormat">%s</span> |
|---|
| 1312 | </td> |
|---|
| 1313 | <td bgcolor="white" width="100%%" valign="top" class="blacktext"> |
|---|
| 1314 | <textarea name="%s" cols="65" rows="10">%s</textarea> |
|---|
| 1315 | </td> |
|---|
| 1316 | </tr>"""%(caption, "f_%s"%id, self.htmlText(self._contrib.getField(id))) |
|---|
| 1317 | return html |
|---|
| 1318 | |
|---|
| 1319 | def getVars( self ): |
|---|
| 1320 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 1321 | defaultDefinePlace = defaultDefineRoom = "" |
|---|
| 1322 | defaultInheritPlace = defaultInheritRoom = "checked" |
|---|
| 1323 | locationName, locationAddress, roomName, defaultExistRoom = "", "", "","" |
|---|
| 1324 | vars["conference"] = self._conf |
|---|
| 1325 | vars["boardNumber"]=quoteattr(str(self._contrib.getBoardNumber())) |
|---|
| 1326 | vars["contrib"] = self._contrib |
|---|
| 1327 | vars["title"] = quoteattr(self._contrib.getTitle()) |
|---|
| 1328 | vars["description"] = self.htmlText(self._contrib.getDescription()) |
|---|
| 1329 | vars["additionalFields"] = self._getAdditionalFieldsHTML() |
|---|
| 1330 | vars["day"],vars["month"],vars["year"]="","","" |
|---|
| 1331 | vars["sHour"],vars["sMinute"]="","" |
|---|
| 1332 | sDate=self._contrib.getStartDate() |
|---|
| 1333 | if sDate is not None: |
|---|
| 1334 | vars["day"]=quoteattr(str(sDate.day)) |
|---|
| 1335 | vars["month"] = quoteattr(str(sDate.month)) |
|---|
| 1336 | vars["year"] = quoteattr(str(sDate.year)) |
|---|
| 1337 | vars["sHour"] = quoteattr(str(sDate.hour)) |
|---|
| 1338 | vars["sMinute"] = quoteattr(str(sDate.minute)) |
|---|
| 1339 | if self._contrib.getStartDate(): |
|---|
| 1340 | vars["dateTime"] = formatDateTime(self._contrib.getAdjustedStartDate()) |
|---|
| 1341 | else: |
|---|
| 1342 | vars["dateTime"] = "" |
|---|
| 1343 | vars["duration"] = self._contrib.getDuration().seconds/60 |
|---|
| 1344 | if self._contrib.getDuration() is not None: |
|---|
| 1345 | vars["durationHours"]=quoteattr(str((datetime(1900,1,1)+self._contrib.getDuration()).hour)) |
|---|
| 1346 | vars["durationMinutes"]=quoteattr(str((datetime(1900,1,1)+self._contrib.getDuration()).minute)) |
|---|
| 1347 | if self._contrib.getOwnLocation(): |
|---|
| 1348 | defaultDefinePlace = "checked" |
|---|
| 1349 | defaultInheritPlace = "" |
|---|
| 1350 | locationName = self._contrib.getLocation().getName() |
|---|
| 1351 | locationAddress = self._contrib.getLocation().getAddress() |
|---|
| 1352 | |
|---|
| 1353 | if self._contrib.getOwnRoom(): |
|---|
| 1354 | defaultDefineRoom= "checked" |
|---|
| 1355 | defaultInheritRoom = "" |
|---|
| 1356 | defaultExistRoom="" |
|---|
| 1357 | roomName = self._contrib.getRoom().getName() |
|---|
| 1358 | vars["defaultInheritPlace"] = defaultInheritPlace |
|---|
| 1359 | vars["defaultDefinePlace"] = defaultDefinePlace |
|---|
| 1360 | vars["confPlace"] = "" |
|---|
| 1361 | confLocation = self._owner.getLocation() |
|---|
| 1362 | if self._contrib.isScheduled(): |
|---|
| 1363 | confLocation=self._contrib.getSchEntry().getSchedule().getOwner().getLocation() |
|---|
| 1364 | if self._contrib.getSession() and not self._contrib.getConference().getEnableSessionSlots(): |
|---|
| 1365 | confLocation = self._contrib.getSession().getLocation() |
|---|
| 1366 | if confLocation: |
|---|
| 1367 | vars["confPlace"] = confLocation.getName() |
|---|
| 1368 | vars["locationName"] = locationName |
|---|
| 1369 | vars["locationAddress"] = locationAddress |
|---|
| 1370 | vars["defaultInheritRoom"] = defaultInheritRoom |
|---|
| 1371 | vars["defaultDefineRoom"] = defaultDefineRoom |
|---|
| 1372 | vars["defaultExistRoom"] = defaultExistRoom |
|---|
| 1373 | vars["confRoom"] = "" |
|---|
| 1374 | confRoom = self._owner.getRoom() |
|---|
| 1375 | rx=[] |
|---|
| 1376 | roomsexist = self._conf.getRoomList() |
|---|
| 1377 | roomsexist.sort() |
|---|
| 1378 | for room in roomsexist: |
|---|
| 1379 | sel="" |
|---|
| 1380 | rx.append("""<option value=%s%s>%s</option>"""%(quoteattr(str(room)), |
|---|
| 1381 | sel,self.htmlText(room))) |
|---|
| 1382 | vars ["roomsexist"] = "".join(rx) |
|---|
| 1383 | if self._contrib.isScheduled(): |
|---|
| 1384 | confRoom=self._contrib.getSchEntry().getSchedule().getOwner().getRoom() |
|---|
| 1385 | if self._contrib.getSession() and not self._contrib.getConference().getEnableSessionSlots(): |
|---|
| 1386 | confRoom = self._contrib.getSession().getRoom() |
|---|
| 1387 | if confRoom: |
|---|
| 1388 | vars["confRoom"] = confRoom.getName() |
|---|
| 1389 | vars["roomName"] = quoteattr(roomName) |
|---|
| 1390 | vars["parentType"] = "conference" |
|---|
| 1391 | if self._contrib.getSession() is not None: |
|---|
| 1392 | vars["parentType"] = "session" |
|---|
| 1393 | if self._contrib.isScheduled() and self._contrib.getConference().getEnableSessionSlots(): |
|---|
| 1394 | vars["parentType"]="session slot" |
|---|
| 1395 | vars["postURL"] = urlHandlers.UHContributionDataModif.getURL(self._contrib) |
|---|
| 1396 | vars["types"]=self._getTypeItemsHTML() |
|---|
| 1397 | vars["keywords"]=self._contrib.getKeywords() |
|---|
| 1398 | import MaKaC.webinterface.webFactoryRegistry as webFactoryRegistry |
|---|
| 1399 | wr = webFactoryRegistry.WebFactoryRegistry() |
|---|
| 1400 | wf = wr.getFactory(self._conf) |
|---|
| 1401 | if wf != None: |
|---|
| 1402 | type = wf.getId() |
|---|
| 1403 | else: |
|---|
| 1404 | type = "conference" |
|---|
| 1405 | if type == "conference": |
|---|
| 1406 | vars["Type"]=WContributionDataModificationType().getHTML(vars) |
|---|
| 1407 | vars["Board"]=WContributionDataModificationBoard().getHTML(vars) |
|---|
| 1408 | else: |
|---|
| 1409 | vars["Type"]="" |
|---|
| 1410 | vars["Board"]="" |
|---|
| 1411 | |
|---|
| 1412 | minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance() |
|---|
| 1413 | vars["useRoomBookingModule"] = minfo.getRoomBookingModuleActive() |
|---|
| 1414 | if self._contrib.getSession(): |
|---|
| 1415 | vars["sessionType"] = self._contrib.getSession().getScheduleType() |
|---|
| 1416 | else: |
|---|
| 1417 | vars["sessionType"] = 'none' |
|---|
| 1418 | return vars |
|---|
| 1419 | |
|---|
| 1420 | |
|---|
| 1421 | class WPEditData(WPContribModifMain): |
|---|
| 1422 | |
|---|
| 1423 | def _getTabContent( self, params ): |
|---|
| 1424 | wc = WContributionDataModification(self._target, self._conf) |
|---|
| 1425 | |
|---|
| 1426 | pars = {"postURL": urlHandlers.UHConfPerformAddContribution.getURL(), \ |
|---|
| 1427 | "calendarIconURL": Config.getInstance().getSystemIconURL( "calendar" ), \ |
|---|
| 1428 | "calendarSelectURL": urlHandlers.UHSimpleCalendar.getURL() } |
|---|
| 1429 | return wc.getHTML( pars ) |
|---|
| 1430 | |
|---|
| 1431 | |
|---|
| 1432 | class WPContribAddMaterial( WPContribModifMain ): |
|---|
| 1433 | |
|---|
| 1434 | def __init__( self, rh, contrib, mf ): |
|---|
| 1435 | WPContribModifMain.__init__( self, rh, contrib ) |
|---|
| 1436 | self._mf = mf |
|---|
| 1437 | |
|---|
| 1438 | def _getTabContent( self, params ): |
|---|
| 1439 | if self._mf: |
|---|
| 1440 | comp = self._mf.getCreationWC( self._target ) |
|---|
| 1441 | else: |
|---|
| 1442 | comp = wcomponents.WMaterialCreation( self._target ) |
|---|
| 1443 | pars = { "postURL": urlHandlers.UHContributionPerformAddMaterial.getURL() } |
|---|
| 1444 | return comp.getHTML( pars ) |
|---|
| 1445 | |
|---|
| 1446 | class WPContributionDeletion( WPContributionModifTools ): |
|---|
| 1447 | |
|---|
| 1448 | def _getTabContent( self, params ): |
|---|
| 1449 | wc = wcomponents.WContributionDeletion( [self._target] ) |
|---|
| 1450 | return wc.getHTML( urlHandlers.UHContributionDelete.getURL( self._target ) ) |
|---|
| 1451 | |
|---|
| 1452 | |
|---|
| 1453 | class WContributionMove(wcomponents.WTemplated): |
|---|
| 1454 | |
|---|
| 1455 | def __init__(self, contrib, conf ): |
|---|
| 1456 | self._contrib = contrib |
|---|
| 1457 | self._conf = conf |
|---|
| 1458 | |
|---|
| 1459 | def getVars( self ): |
|---|
| 1460 | vars = wcomponents.WTemplated.getVars( self ) |
|---|
| 1461 | sesList = "" |
|---|
| 1462 | if self._contrib.getOwner() != self._conf: |
|---|
| 1463 | sesList = _("""<option value=\"CONF\" > _("Conference") : %s</option>\n""")%self._conf.getTitle() |
|---|
| 1464 | for ses in self._conf.getSessionListSorted(): |
|---|
| 1465 | if self._contrib.getOwner() != ses: |
|---|
| 1466 | sesList = sesList + _("""<option value=\"%s\" > _("Session") : %s</option>\n""")%(ses.getId(), ses.getTitle()) |
|---|
| 1467 | vars["sessionList"] = sesList |
|---|
| 1468 | vars["confId"] = self._conf.getId() |
|---|
| 1469 | vars["contribId"] = self._contrib.getId() |
|---|
| 1470 | return vars |
|---|
| 1471 | |
|---|
| 1472 | |
|---|
| 1473 | class WPcontribMove( WPContributionModifTools ): |
|---|
| 1474 | |
|---|
| 1475 | def _getTabContent( self, params ): |
|---|
| 1476 | wc = WContributionMove( self._target, self._target.getConference() ) |
|---|
| 1477 | params["cancelURL"] = urlHandlers.UHContribModifTools.getURL( self._target ) |
|---|
| 1478 | params["moveURL"] = urlHandlers.UHContributionPerformMove.getURL() |
|---|
| 1479 | return wc.getHTML( params ) |
|---|
| 1480 | |
|---|
| 1481 | class WPContributionWriteMinutes( WPContributionModifTools ): |
|---|
| 1482 | |
|---|
| 1483 | def _getTabContent( self, params ): |
|---|
| 1484 | wc = wcomponents.WWriteMinutes( self._target ) |
|---|
| 1485 | pars = {"postURL": urlHandlers.UHContributionWriteMinutes.getURL(self._target) } |
|---|
| 1486 | return wc.getHTML( pars ) |
|---|
| 1487 | |
|---|
| 1488 | |
|---|
| 1489 | class WPModSubmittersSel(WPContribModifAC): |
|---|
| 1490 | |
|---|
| 1491 | def _getTabContent(self,params): |
|---|
| 1492 | wf=self._rh.getWebFactory() |
|---|
| 1493 | addTo=1 |
|---|
| 1494 | if wf is not None: |
|---|
| 1495 | addTo=4 |
|---|
| 1496 | searchExt = params.get("searchExt","") |
|---|
| 1497 | if searchExt != "": |
|---|
| 1498 | searchLocal = False |
|---|
| 1499 | else: |
|---|
| 1500 | searchLocal = True |
|---|
| 1501 | wc=wcomponents.WPrincipalSelection(urlHandlers.UHContribModSubmittersSel.getURL(), addTo=addTo, forceWithoutExtAuth=searchLocal) |
|---|
| 1502 | wc.setTitle( _("Selecting users allowed to submit material")) |
|---|
| 1503 | params["addURL"]=urlHandlers.UHContribModSubmittersAdd.getURL() |
|---|
| 1504 | return wc.getHTML( params ) |
|---|
| 1505 | |
|---|
| 1506 | class WPContributionDisplayRemoveMaterialsConfirm( WPContributionDefaultDisplayBase ): |
|---|
| 1507 | |
|---|
| 1508 | def __init__(self,rh, conf, mat): |
|---|
| 1509 | WPContributionDefaultDisplayBase.__init__(self,rh,conf) |
|---|
| 1510 | self._mat=mat |
|---|
| 1511 | |
|---|
| 1512 | def _getBody(self,params): |
|---|
| 1513 | wc=wcomponents.WDisplayConfirmation() |
|---|
| 1514 | msg= _(""" _("Are you sure you want to delete the following material")?<br> |
|---|
| 1515 | <b><i>%s</i></b> |
|---|
| 1516 | <br>""")%self._mat.getTitle() |
|---|
| 1517 | url=urlHandlers.UHContributionDisplayRemoveMaterial.getURL(self._mat.getOwner()) |
|---|
| 1518 | return wc.getHTML(msg,url,{"deleteMaterial":self._mat.getId()}) |
|---|
| 1519 | |
|---|
| 1520 | class WPContribDisplayWriteMinutes( WPContributionDefaultDisplayBase ): |
|---|
| 1521 | |
|---|
| 1522 | def _getBody( self, params ): |
|---|
| 1523 | wc = wcomponents.WWriteMinutes( self._contrib ) |
|---|
| 1524 | pars = {"postURL": urlHandlers.UHContributionDisplayWriteMinutes.getURL(self._contrib) } |
|---|
| 1525 | return wc.getHTML( pars ) |
|---|
| 1526 | |
|---|
| 1527 | |
|---|
| 1528 | class WPContributionReportNumberEdit(WPContributionModifBase): |
|---|
| 1529 | |
|---|
| 1530 | def __init__(self, rh, contribution, reportNumberSystem): |
|---|
| 1531 | WPContributionModifBase.__init__(self, rh, contribution) |
|---|
| 1532 | self._reportNumberSystem=reportNumberSystem |
|---|
| 1533 | |
|---|
| 1534 | def _getTabContent( self, params): |
|---|
| 1535 | wc=wcomponents.WModifReportNumberEdit(self._target, self._reportNumberSystem, "contribution") |
|---|
| 1536 | return wc.getHTML() |
|---|