source: indico/indico/MaKaC/fossils/schedule.py @ 791f15

hello-world-walkthroughipv6v0.98-seriesv0.98.2v0.98.3v0.99v1.0v1.1
Last change on this file since 791f15 was 791f15, checked in by Pedro Ferreira <jose.pedro.ferreira@…>, 16 months ago

[FTR] Drag and drop for contributions/breaks

  • Sessions, contributions, breaks are draggable.
  • Sessions, contributions, breaks are resizable.
  • Contributions, breaks are droppable INTO sessions.
  • Shifting later entries while dragging (hold shift while dragging..)
  • Undo functionality for Dragging + Resizing
  • Property mode set to 100644
File size: 10.8 KB
Line 
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
21from MaKaC.common.fossilize import IFossil
22from MaKaC.common.Conversion import Conversion
23from MaKaC.fossils.conference import IMaterialMinimalFossil,\
24        IConferenceParticipationFossil, IConferenceParticipationMinimalFossil
25from MaKaC.fossils.contribution import IContributionParticipationTTDisplayFossil,\
26    IContributionParticipationTTMgmtFossil
27
28class 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
46class 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
100class 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
123class IContribSchEntryFossil(ISchEntryFossil):
124
125    def getEntryType(self):
126        """ Entry Type """
127    getEntryType.produce = lambda s: "Contribution"
128
129    def getSessionId(self):
130        """ Entry Session Id """
131    getSessionId.produce = Conversion.parentSession
132
133    def getSessionSlotId(self):
134        """ Entry Session Id """
135    getSessionSlotId.produce = Conversion.parentSlot
136
137    def getContributionId(self):
138        """ Entry Contribution Id """
139    getContributionId.produce = lambda s: s.getOwner().getId()
140
141    def getDescription(self):
142        """ Entry Description """
143    getDescription.produce = lambda s: s.getOwner().getDescription()
144
145    def getRoom(self):
146        """ Entry Room """
147    getRoom.convert = Conversion.roomName
148
149    def getLocation(self):
150        """ Entry Location """
151    getLocation.convert = Conversion.locationName
152
153    def getAdjustedStartDate(self):
154        """ Entry Start Date """
155    getAdjustedStartDate.convert = Conversion.datetime
156    getAdjustedStartDate.name = "startDate"
157
158    def getAdjustedEndDate(self):
159        """ Entry End Date """
160    getAdjustedEndDate.convert = Conversion.datetime
161    getAdjustedEndDate.name = "endDate"
162
163    def getConferenceId(self):
164        """ Entry Conference id """
165    getConferenceId.produce = lambda s: s.getOwner().getConference().getId()
166
167
168class IContribSchEntryDisplayFossil(IContribSchEntryFossil):
169
170    def getMaterial(self):
171        """ Entry Material """
172    getMaterial.produce = lambda s: s.getOwner().getAllMaterialList()
173    getMaterial.result = IMaterialMinimalFossil
174
175    def getPresenters(self):
176        """ Entry Presenters """
177    getPresenters.produce = lambda x: x.getOwner().getSpeakerList()
178    getPresenters.result = IContributionParticipationTTDisplayFossil
179
180
181class IContribSchEntryMgmtFossil(IContribSchEntryFossil):
182
183    def getPresenters(self):
184        """ Entry Presenters """
185    getPresenters.produce = lambda x: x.getOwner().getSpeakerList()
186    getPresenters.result = IContributionParticipationTTMgmtFossil
187
188    def getId(self):
189        """ Default Id """
190    getId.name = "scheduleEntryId"
191
192    def getInheritLoc(self):
193        """ Inherited Loc """
194    getInheritLoc.produce = lambda x: x.getOwner().getOwnLocation() is None
195
196    def getInheritRoom(self):
197        """ Inherited Room """
198    getInheritRoom.produce = lambda x: x.getOwner().getOwnRoom() is None
199
200    def getDuration(self):
201        """ Entry End Date """
202    getDuration.convert = Conversion.duration
203
204
205class ILinkedTimeSchEntryFossil(ISchEntryFossil):
206
207    def getTitle(self):
208        """ Title """
209    getTitle.produce = lambda s: s.getOwner().getSession().getTitle()
210
211    def getDescription(self):
212        """ Entry Description """
213    getDescription.produce = lambda s: s.getOwner().getSession().getDescription()
214
215    def getSlotTitle(self):
216        """ Slot Title """
217    getSlotTitle.produce = lambda s: s.getOwner().getTitle()
218
219    def getSessionId(self):
220        """ Session Id """
221    getSessionId.produce = lambda s: s.getOwner().getSession().getId()
222
223    def getSessionSlotId(self):
224        """ Session Slot Id """
225    getSessionSlotId.produce = lambda s: s.getOwner().getId()
226
227    def getEntryType(self):
228        """ Entry Type """
229    getEntryType.produce = lambda s: "Session"
230
231    def getColor(self):
232        """ Entry Background color """
233    getColor.produce = lambda s: s.getOwner().getColor()
234
235    def getTextColor(self):
236        """ Entry Text color """
237    getTextColor.produce = lambda s: s.getOwner().getTextColor()
238
239    def getAdjustedStartDate(self):
240        """ Entry Start Date """
241    getAdjustedStartDate.convert = Conversion.datetime
242    getAdjustedStartDate.name = "startDate"
243
244    def getAdjustedEndDate(self):
245        """ Entry End Date """
246    getAdjustedEndDate.convert = Conversion.datetime
247    getAdjustedEndDate.name = "endDate"
248
249    def isPoster(self):
250        """ Is self a Poster Session ? """
251    isPoster.produce = lambda s: s.getOwner().getSession().getScheduleType() == 'poster'
252
253    def getDuration(self):
254        """ Entry Duration """
255    getDuration.convert = Conversion.timedelta
256
257    def getRoom(self):
258        """ Entry Room """
259    getRoom.produce = lambda s: s.getOwner().getRoom()
260    getRoom.convert = Conversion.roomName
261
262    def getLocation(self):
263        """ Entry Location """
264    getLocation.produce = lambda s: s.getOwner().getLocation()
265    getLocation.convert = Conversion.locationName
266
267    def getConferenceId(self):
268        """ Entry Conference id """
269    getConferenceId.produce = lambda s: s.getOwner().getConference().getId()
270
271
272    def getContribDuration(self):
273        """ Default duration for contribs """
274    getContribDuration.produce = lambda s: s.getOwner().getSession().getContribDuration()
275    getContribDuration.convert = Conversion.timedelta
276
277    def getInheritLoc(self):
278        """ Inherited Loc """
279    getInheritLoc.produce = lambda x: x.getOwner().getOwnLocation() is None
280
281    def getInheritRoom(self):
282        """ Inherited Room """
283    getInheritRoom.produce = lambda x: x.getOwner().getOwnRoom() is None
284
285
286class ILinkedTimeSchEntryDisplayFossil(ILinkedTimeSchEntryFossil):
287
288    def getEntries(self):
289        """ Entries contained inside the session """
290    getEntries.produce = lambda s: s.getOwner().getSchedule().getEntries()
291    getEntries.result = {"MaKaC.schedule.ContribSchEntry": IContribSchEntryDisplayFossil,
292                         "MaKaC.schedule.BreakTimeSchEntry": IBreakTimeSchEntryFossil}
293
294    def getMaterial(self):
295        """ Entry Material """
296    getMaterial.produce = lambda s: s.getOwner().getSession().getAllMaterialList()
297    getMaterial.result = IMaterialMinimalFossil
298
299    def getConveners(self):
300        """ Entry Conveners """
301    getConveners.produce = lambda s: s.getOwner().getOwnConvenerList()
302    getConveners.result = IConferenceParticipationMinimalFossil
303
304
305class ILinkedTimeSchEntryMgmtFossil(ILinkedTimeSchEntryFossil):
306
307    def getEntries(self):
308        """ Entries contained inside the session """
309    getEntries.produce = lambda s: s.getOwner().getSchedule().getEntries()
310    getEntries.result = {"MaKaC.schedule.ContribSchEntry": IContribSchEntryMgmtFossil,
311                         "MaKaC.schedule.BreakTimeSchEntry": IBreakTimeSchEntryMgmtFossil}
312
313    def getConveners(self):
314        """ Entry Conveners """
315    getConveners.produce = lambda s: s.getOwner().getOwnConvenerList()
316    getConveners.result = IConferenceParticipationFossil
317
318    def getId(self):
319        """ Default Id """
320    getId.name = "scheduleEntryId"
321
322
323class IConferenceScheduleDisplayFossil(IFossil):
324
325    def getEntries(self):
326        """ Schedule Entries """
327    getEntries.result = {"LinkedTimeSchEntry": ILinkedTimeSchEntryDisplayFossil,
328                         "BreakTimeSchEntry": IBreakTimeSchEntryFossil,
329                         "ContribSchEntry": IContribSchEntryDisplayFossil}
330
331class IConferenceScheduleMgmtFossil(IFossil):
332
333    def getEntries(self):
334        """ Schedule Entries """
335    getEntries.result = {"LinkedTimeSchEntry": ILinkedTimeSchEntryMgmtFossil,
336                         "BreakTimeSchEntry": IBreakTimeSchEntryMgmtFossil,
337                         "ContribSchEntry": IContribSchEntryMgmtFossil}
Note: See TracBrowser for help on using the repository browser.