| 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 | from MaKaC.common.fossilize import IFossil |
|---|
| 22 | from MaKaC.common.Conversion import Conversion |
|---|
| 23 | from MaKaC.fossils.conference import IMaterialMinimalFossil,\ |
|---|
| 24 | IConferenceParticipationFossil, IConferenceParticipationMinimalFossil |
|---|
| 25 | from MaKaC.fossils.contribution import IContributionParticipationTTDisplayFossil,\ |
|---|
| 26 | IContributionParticipationTTMgmtFossil |
|---|
| 27 | |
|---|
| 28 | class ISchEntryFossil(IFossil): |
|---|
| 29 | |
|---|
| 30 | def getInitId(self): |
|---|
| 31 | """ Id """ |
|---|
| 32 | getInitId.produce = Conversion.locatorString |
|---|
| 33 | getInitId.name = "id" |
|---|
| 34 | |
|---|
| 35 | def getTitle(self): |
|---|
| 36 | """ Title """ |
|---|
| 37 | |
|---|
| 38 | def getDescription(self): |
|---|
| 39 | """ Description """ |
|---|
| 40 | |
|---|
| 41 | def getSessionCode(self): |
|---|
| 42 | """ Entry Session Id """ |
|---|
| 43 | getSessionCode.produce = Conversion.parentSessionCode |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | class IBreakTimeSchEntryFossil(ISchEntryFossil): |
|---|
| 47 | |
|---|
| 48 | def getInitId(self): |
|---|
| 49 | """ Id """ |
|---|
| 50 | # 'produce' is not to be used anywhere else than for the time table |
|---|
| 51 | getInitId.produce = lambda s: Conversion.locatorString(s)+"b"+s.getId() |
|---|
| 52 | getInitId.name = "id" |
|---|
| 53 | |
|---|
| 54 | def getAdjustedStartDate(self): |
|---|
| 55 | """ Entry Start Date """ |
|---|
| 56 | getAdjustedStartDate.convert = Conversion.datetime |
|---|
| 57 | getAdjustedStartDate.name = "startDate" |
|---|
| 58 | |
|---|
| 59 | def getAdjustedEndDate(self): |
|---|
| 60 | """ Entry End Date """ |
|---|
| 61 | getAdjustedEndDate.convert = Conversion.datetime |
|---|
| 62 | getAdjustedEndDate.name = "endDate" |
|---|
| 63 | |
|---|
| 64 | def getDuration(self): |
|---|
| 65 | """ Entry Duration """ |
|---|
| 66 | getDuration.convert = Conversion.timedelta |
|---|
| 67 | |
|---|
| 68 | def getEntryType(self): |
|---|
| 69 | """ Entry Type """ |
|---|
| 70 | getEntryType.produce = lambda s: "Break" |
|---|
| 71 | getEntryType.name = 'entryType' |
|---|
| 72 | |
|---|
| 73 | def getConferenceId(self): |
|---|
| 74 | """ Entry Conference id """ |
|---|
| 75 | getConferenceId.produce = lambda s: s.getOwner().getConference().getId() |
|---|
| 76 | |
|---|
| 77 | def getSessionId(self): |
|---|
| 78 | """ Entry Session id """ |
|---|
| 79 | getSessionId.produce = Conversion.parentSession |
|---|
| 80 | |
|---|
| 81 | def getSessionSlotId(self): |
|---|
| 82 | """ Entry Session Slot Id """ |
|---|
| 83 | getSessionSlotId.produce = Conversion.parentSlot |
|---|
| 84 | |
|---|
| 85 | def getRoom(self): |
|---|
| 86 | """ Entry Room """ |
|---|
| 87 | getRoom.convert = Conversion.roomName |
|---|
| 88 | |
|---|
| 89 | def getLocation(self): |
|---|
| 90 | """ Entry Location """ |
|---|
| 91 | getLocation.convert = Conversion.locationName |
|---|
| 92 | |
|---|
| 93 | def getColor(self): |
|---|
| 94 | """ Entry Color """ |
|---|
| 95 | |
|---|
| 96 | def getTextColor(self): |
|---|
| 97 | """ Entry Text Color """ |
|---|
| 98 | |
|---|
| 99 | |
|---|
| 100 | class IBreakTimeSchEntryMgmtFossil(IBreakTimeSchEntryFossil): |
|---|
| 101 | |
|---|
| 102 | def getScheduleEntryId(self): |
|---|
| 103 | """ Entry Id """ |
|---|
| 104 | getScheduleEntryId.produce = lambda s: s.getId() |
|---|
| 105 | |
|---|
| 106 | def getAddress(self): |
|---|
| 107 | """ Entry Address """ |
|---|
| 108 | getAddress.produce = lambda s: s.getLocation() |
|---|
| 109 | getAddress.convert = Conversion.locationAddress |
|---|
| 110 | |
|---|
| 111 | def inheritLocation(self): |
|---|
| 112 | """ Does this entry inherit the location ?""" |
|---|
| 113 | inheritLocation.produce = lambda s: s.getOwnLocation() is None |
|---|
| 114 | inheritLocation.name = "inheritLoc" |
|---|
| 115 | |
|---|
| 116 | def inheritRoom(self): |
|---|
| 117 | """ Does this entry inherit the room ?""" |
|---|
| 118 | inheritRoom.produce = lambda s: s.getOwnRoom() is None |
|---|
| 119 | inheritRoom.name = "inheritRoom" |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | |
|---|
| 123 | class IContribSchEntryFossil(ISchEntryFossil): |
|---|
| 124 | |
|---|
| 125 | def getUniqueId(self): |
|---|
| 126 | """ Unique Id """ |
|---|
| 127 | getUniqueId.produce = lambda s: s.getOwner().getUniqueId() |
|---|
| 128 | |
|---|
| 129 | def getEntryType(self): |
|---|
| 130 | """ Entry Type """ |
|---|
| 131 | getEntryType.produce = lambda s: "Contribution" |
|---|
| 132 | |
|---|
| 133 | def getSessionId(self): |
|---|
| 134 | """ Entry Session Id """ |
|---|
| 135 | getSessionId.produce = Conversion.parentSession |
|---|
| 136 | |
|---|
| 137 | def getSessionSlotId(self): |
|---|
| 138 | """ Entry Session Id """ |
|---|
| 139 | getSessionSlotId.produce = Conversion.parentSlot |
|---|
| 140 | |
|---|
| 141 | def getContributionId(self): |
|---|
| 142 | """ Entry Contribution Id """ |
|---|
| 143 | getContributionId.produce = lambda s: s.getOwner().getId() |
|---|
| 144 | |
|---|
| 145 | def getDescription(self): |
|---|
| 146 | """ Entry Description """ |
|---|
| 147 | getDescription.produce = lambda s: s.getOwner().getDescription() |
|---|
| 148 | |
|---|
| 149 | def getRoom(self): |
|---|
| 150 | """ Entry Room """ |
|---|
| 151 | getRoom.convert = Conversion.roomName |
|---|
| 152 | |
|---|
| 153 | def getLocation(self): |
|---|
| 154 | """ Entry Location """ |
|---|
| 155 | getLocation.convert = Conversion.locationName |
|---|
| 156 | |
|---|
| 157 | def getAdjustedStartDate(self): |
|---|
| 158 | """ Entry Start Date """ |
|---|
| 159 | getAdjustedStartDate.convert = Conversion.datetime |
|---|
| 160 | getAdjustedStartDate.name = "startDate" |
|---|
| 161 | |
|---|
| 162 | def getAdjustedEndDate(self): |
|---|
| 163 | """ Entry End Date """ |
|---|
| 164 | getAdjustedEndDate.convert = Conversion.datetime |
|---|
| 165 | getAdjustedEndDate.name = "endDate" |
|---|
| 166 | |
|---|
| 167 | def getConferenceId(self): |
|---|
| 168 | """ Entry Conference id """ |
|---|
| 169 | getConferenceId.produce = lambda s: s.getOwner().getConference().getId() |
|---|
| 170 | |
|---|
| 171 | |
|---|
| 172 | class IContribSchEntryDisplayFossil(IContribSchEntryFossil): |
|---|
| 173 | |
|---|
| 174 | def getMaterial(self): |
|---|
| 175 | """ Entry Material """ |
|---|
| 176 | getMaterial.produce = lambda s: s.getOwner().getAllMaterialList() |
|---|
| 177 | getMaterial.result = IMaterialMinimalFossil |
|---|
| 178 | |
|---|
| 179 | def getPresenters(self): |
|---|
| 180 | """ Entry Presenters """ |
|---|
| 181 | getPresenters.produce = lambda x: x.getOwner().getSpeakerList() |
|---|
| 182 | getPresenters.result = IContributionParticipationTTDisplayFossil |
|---|
| 183 | |
|---|
| 184 | |
|---|
| 185 | class IContribSchEntryMgmtFossil(IContribSchEntryFossil): |
|---|
| 186 | |
|---|
| 187 | def getPresenters(self): |
|---|
| 188 | """ Entry Presenters """ |
|---|
| 189 | getPresenters.produce = lambda x: x.getOwner().getSpeakerList() |
|---|
| 190 | getPresenters.result = IContributionParticipationTTMgmtFossil |
|---|
| 191 | |
|---|
| 192 | def getId(self): |
|---|
| 193 | """ Default Id """ |
|---|
| 194 | getId.name = "scheduleEntryId" |
|---|
| 195 | |
|---|
| 196 | def getInheritLoc(self): |
|---|
| 197 | """ Inherited Loc """ |
|---|
| 198 | getInheritLoc.produce = lambda x: x.getOwner().getOwnLocation() is None |
|---|
| 199 | |
|---|
| 200 | def getInheritRoom(self): |
|---|
| 201 | """ Inherited Room """ |
|---|
| 202 | getInheritRoom.produce = lambda x: x.getOwner().getOwnRoom() is None |
|---|
| 203 | |
|---|
| 204 | def getDuration(self): |
|---|
| 205 | """ Entry End Date """ |
|---|
| 206 | getDuration.convert = Conversion.duration |
|---|
| 207 | |
|---|
| 208 | |
|---|
| 209 | class ILinkedTimeSchEntryFossil(ISchEntryFossil): |
|---|
| 210 | |
|---|
| 211 | def getTitle(self): |
|---|
| 212 | """ Title """ |
|---|
| 213 | getTitle.produce = lambda s: s.getOwner().getSession().getTitle() |
|---|
| 214 | |
|---|
| 215 | def getDescription(self): |
|---|
| 216 | """ Entry Description """ |
|---|
| 217 | getDescription.produce = lambda s: s.getOwner().getSession().getDescription() |
|---|
| 218 | |
|---|
| 219 | def getSlotTitle(self): |
|---|
| 220 | """ Slot Title """ |
|---|
| 221 | getSlotTitle.produce = lambda s: s.getOwner().getTitle() |
|---|
| 222 | |
|---|
| 223 | def getSessionId(self): |
|---|
| 224 | """ Session Id """ |
|---|
| 225 | getSessionId.produce = lambda s: s.getOwner().getSession().getId() |
|---|
| 226 | |
|---|
| 227 | def getSessionSlotId(self): |
|---|
| 228 | """ Session Slot Id """ |
|---|
| 229 | getSessionSlotId.produce = lambda s: s.getOwner().getId() |
|---|
| 230 | |
|---|
| 231 | def getEntryType(self): |
|---|
| 232 | """ Entry Type """ |
|---|
| 233 | getEntryType.produce = lambda s: "Session" |
|---|
| 234 | |
|---|
| 235 | def getColor(self): |
|---|
| 236 | """ Entry Background color """ |
|---|
| 237 | getColor.produce = lambda s: s.getOwner().getColor() |
|---|
| 238 | |
|---|
| 239 | def getTextColor(self): |
|---|
| 240 | """ Entry Text color """ |
|---|
| 241 | getTextColor.produce = lambda s: s.getOwner().getTextColor() |
|---|
| 242 | |
|---|
| 243 | def getAdjustedStartDate(self): |
|---|
| 244 | """ Entry Start Date """ |
|---|
| 245 | getAdjustedStartDate.convert = Conversion.datetime |
|---|
| 246 | getAdjustedStartDate.name = "startDate" |
|---|
| 247 | |
|---|
| 248 | def getAdjustedEndDate(self): |
|---|
| 249 | """ Entry End Date """ |
|---|
| 250 | getAdjustedEndDate.convert = Conversion.datetime |
|---|
| 251 | getAdjustedEndDate.name = "endDate" |
|---|
| 252 | |
|---|
| 253 | def isPoster(self): |
|---|
| 254 | """ Is self a Poster Session ? """ |
|---|
| 255 | isPoster.produce = lambda s: s.getOwner().getSession().getScheduleType() == 'poster' |
|---|
| 256 | |
|---|
| 257 | def getDuration(self): |
|---|
| 258 | """ Entry Duration """ |
|---|
| 259 | getDuration.convert = Conversion.timedelta |
|---|
| 260 | |
|---|
| 261 | def getRoom(self): |
|---|
| 262 | """ Entry Room """ |
|---|
| 263 | getRoom.produce = lambda s: s.getOwner().getRoom() |
|---|
| 264 | getRoom.convert = Conversion.roomName |
|---|
| 265 | |
|---|
| 266 | def getLocation(self): |
|---|
| 267 | """ Entry Location """ |
|---|
| 268 | getLocation.produce = lambda s: s.getOwner().getLocation() |
|---|
| 269 | getLocation.convert = Conversion.locationName |
|---|
| 270 | |
|---|
| 271 | def getConferenceId(self): |
|---|
| 272 | """ Entry Conference id """ |
|---|
| 273 | getConferenceId.produce = lambda s: s.getOwner().getConference().getId() |
|---|
| 274 | |
|---|
| 275 | |
|---|
| 276 | def getContribDuration(self): |
|---|
| 277 | """ Default duration for contribs """ |
|---|
| 278 | getContribDuration.produce = lambda s: s.getOwner().getSession().getContribDuration() |
|---|
| 279 | getContribDuration.convert = Conversion.timedelta |
|---|
| 280 | |
|---|
| 281 | def getInheritLoc(self): |
|---|
| 282 | """ Inherited Loc """ |
|---|
| 283 | getInheritLoc.produce = lambda x: x.getOwner().getOwnLocation() is None |
|---|
| 284 | |
|---|
| 285 | def getInheritRoom(self): |
|---|
| 286 | """ Inherited Room """ |
|---|
| 287 | getInheritRoom.produce = lambda x: x.getOwner().getOwnRoom() is None |
|---|
| 288 | |
|---|
| 289 | def getUniqueId(self): |
|---|
| 290 | """ Unique Id """ |
|---|
| 291 | getUniqueId.produce = lambda s: s.getOwner().getSession().getUniqueId() |
|---|
| 292 | |
|---|
| 293 | class ILinkedTimeSchEntryDisplayFossil(ILinkedTimeSchEntryFossil): |
|---|
| 294 | |
|---|
| 295 | def getEntries(self): |
|---|
| 296 | """ Entries contained inside the session """ |
|---|
| 297 | getEntries.produce = lambda s: s.getOwner().getSchedule().getEntries() |
|---|
| 298 | getEntries.result = {"MaKaC.schedule.ContribSchEntry": IContribSchEntryDisplayFossil, |
|---|
| 299 | "MaKaC.schedule.BreakTimeSchEntry": IBreakTimeSchEntryFossil} |
|---|
| 300 | |
|---|
| 301 | def getMaterial(self): |
|---|
| 302 | """ Entry Material """ |
|---|
| 303 | getMaterial.produce = lambda s: s.getOwner().getSession().getAllMaterialList() |
|---|
| 304 | getMaterial.result = IMaterialMinimalFossil |
|---|
| 305 | |
|---|
| 306 | def getConveners(self): |
|---|
| 307 | """ Entry Conveners """ |
|---|
| 308 | getConveners.produce = lambda s: s.getOwner().getOwnConvenerList() |
|---|
| 309 | getConveners.result = IConferenceParticipationMinimalFossil |
|---|
| 310 | |
|---|
| 311 | |
|---|
| 312 | class ILinkedTimeSchEntryMgmtFossil(ILinkedTimeSchEntryFossil): |
|---|
| 313 | |
|---|
| 314 | def getEntries(self): |
|---|
| 315 | """ Entries contained inside the session """ |
|---|
| 316 | getEntries.produce = lambda s: s.getOwner().getSchedule().getEntries() |
|---|
| 317 | getEntries.result = {"MaKaC.schedule.ContribSchEntry": IContribSchEntryMgmtFossil, |
|---|
| 318 | "MaKaC.schedule.BreakTimeSchEntry": IBreakTimeSchEntryMgmtFossil} |
|---|
| 319 | |
|---|
| 320 | def getConveners(self): |
|---|
| 321 | """ Entry Conveners """ |
|---|
| 322 | getConveners.produce = lambda s: s.getOwner().getOwnConvenerList() |
|---|
| 323 | getConveners.result = IConferenceParticipationFossil |
|---|
| 324 | |
|---|
| 325 | def getId(self): |
|---|
| 326 | """ Default Id """ |
|---|
| 327 | getId.name = "scheduleEntryId" |
|---|
| 328 | |
|---|
| 329 | |
|---|
| 330 | class IConferenceScheduleDisplayFossil(IFossil): |
|---|
| 331 | |
|---|
| 332 | def getEntries(self): |
|---|
| 333 | """ Schedule Entries """ |
|---|
| 334 | getEntries.result = {"LinkedTimeSchEntry": ILinkedTimeSchEntryDisplayFossil, |
|---|
| 335 | "BreakTimeSchEntry": IBreakTimeSchEntryFossil, |
|---|
| 336 | "ContribSchEntry": IContribSchEntryDisplayFossil} |
|---|
| 337 | |
|---|
| 338 | class IConferenceScheduleMgmtFossil(IFossil): |
|---|
| 339 | |
|---|
| 340 | def getEntries(self): |
|---|
| 341 | """ Schedule Entries """ |
|---|
| 342 | getEntries.result = {"LinkedTimeSchEntry": ILinkedTimeSchEntryMgmtFossil, |
|---|
| 343 | "BreakTimeSchEntry": IBreakTimeSchEntryMgmtFossil, |
|---|
| 344 | "ContribSchEntry": IContribSchEntryMgmtFossil} |
|---|