source: indico/indico/web/http_api/fossils.py @ b51bde

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

[IMP] Added popup in sessions and contributions.

  • Created two HTTPHooks for session and contributions.
  • Added two new fossils.
  • Added json services in order to obtain the popup when click.
  • Some small changes to adapt to the export popup.
  • Property mode set to 100644
File size: 8.1 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
21"""
22Basic fossils for data export
23"""
24
25from indico.util.fossilize import IFossil, fossilize
26from indico.util.fossilize.conversion import Conversion
27from MaKaC.webinterface import urlHandlers
28from MaKaC.fossils.conference import ISessionFossil
29
30
31class IHTTPAPIErrorFossil(IFossil):
32    def getMessage(self):
33        pass
34
35
36class IHTTPAPIResultFossil(IFossil):
37    def getTS(self):
38        pass
39    getTS.name = 'ts'
40
41    def getURL(self):
42        pass
43    getURL.name = 'url'
44
45    def getResults(self):
46        pass
47
48
49class IHTTPAPIExportResultFossil(IHTTPAPIResultFossil):
50    def getCount(self):
51        pass
52
53    def getComplete(self):
54        pass
55
56    def getAdditionalInfo(self):
57        pass
58
59
60class IPeriodFossil(IFossil):
61    def startDT(self):
62        pass
63    startDT.convert = Conversion.datetime
64
65    def endDT(self):
66        pass
67    endDT.convert = Conversion.datetime
68
69
70class ICategoryMetadataFossil(IFossil):
71    def getId(self):
72        pass
73
74    def getName(self):
75        pass
76
77    def getLocator(self):
78        pass
79    getLocator.convert = Conversion.url(urlHandlers.UHCategoryDisplay)
80    getLocator.name = 'url'
81
82class ICategoryProtectedMetadataFossil(ICategoryMetadataFossil):
83    def getName(self):
84        pass
85    getName.produce = lambda x: None
86
87
88class IConferenceChairMetadataFossil(IFossil):
89
90    def getId(self):
91        pass
92
93    def getFullName(self):
94        pass
95
96    def getEmail(self):
97        pass
98
99    def getAffiliation(self):
100        pass
101
102
103class IConferenceMetadataFossil(IFossil):
104
105    def getId(self):
106        pass
107
108    def getStartDate(self):
109        pass
110    getStartDate.convert = Conversion.datetime
111
112    def getEndDate(self):
113        pass
114    getEndDate.convert = Conversion.datetime
115
116    def getTitle(self):
117        pass
118
119    def getDescription(self):
120        pass
121
122    def getType(self):
123        pass
124
125    def getOwner(self):
126        pass
127    getOwner.convert = lambda x: x.getTitle()
128    getOwner.name = 'category'
129
130    def getCategoryId(self):
131        pass
132    getCategoryId.produce = lambda x: x.getOwner().getId()
133
134    def getTimezone(self):
135        pass
136
137    def getChairList(self):
138        pass
139    getChairList.name = 'chairs'
140    getChairList.result = IConferenceChairMetadataFossil
141
142    def getLocation(self):
143        """ Location (CERN/...) """
144    getLocation.convert = lambda l: l and l.getName()
145
146    def getLocator(self):
147        pass
148    getLocator.convert = Conversion.url(urlHandlers.UHConferenceDisplay)
149    getLocator.name = 'url'
150
151    def getRoom(self):
152        """ Room (inside location) """
153    getRoom.convert = lambda r: r and r.getName()
154
155
156class IContributionParticipationMetadataFossil(IFossil):
157
158    def getId(self):
159        pass
160
161    def getFullName(self):
162        pass
163
164    def getEmail(self):
165        pass
166
167    def getAffiliation(self):
168        pass
169
170
171class IResourceMetadataFossil(IFossil):
172
173    def getName(self):
174        pass
175
176
177class ILocalFileMetadataFossil(IResourceMetadataFossil):
178
179    def getURL(self):
180        pass
181    getURL.produce = lambda s: str(urlHandlers.UHFileAccess.getURL(s))
182    getURL.name = 'url'
183
184
185class ILinkMetadataFossil(IResourceMetadataFossil):
186
187    def getURL(self):
188        pass
189    getURL.name = 'url'
190
191class IMaterialMetadataFossil(IFossil):
192
193    def getId(self):
194        pass
195
196    def getTitle( self ):
197        pass
198
199    def getResourceList(self):
200        pass
201    getResourceList.result = {'MaKaC.conference.Link': ILinkMetadataFossil, 'MaKaC.conference.LocalFile': ILocalFileMetadataFossil}
202    getResourceList.name = 'resources'
203
204
205class _IncludeMaterialFossil(IFossil):
206
207    def getAllMaterialList(self):
208        pass
209    getAllMaterialList.name = 'material'
210    getAllMaterialList.result = IMaterialMetadataFossil
211
212
213class IContributionMetadataFossil(_IncludeMaterialFossil, IFossil):
214
215    def getId(self):
216        pass
217
218    def getTitle(self):
219        pass
220
221    def getLocation(self):
222        pass
223    getLocation.convert = lambda l: l and l.getName()
224
225    def getRoom(self):
226        pass
227    getRoom.convert = lambda r: r and r.getName()
228
229    def getStartDate(self):
230        pass
231    getStartDate.convert = Conversion.datetime
232
233    def getEndDate(self):
234        pass
235    getEndDate.convert = Conversion.datetime
236
237    def getDuration(self):
238        pass
239    getDuration.convert = Conversion.duration
240
241    def getDescription(self):
242        pass
243
244    def getSpeakerList(self):
245        pass
246    getSpeakerList.name = 'speakers'
247    getSpeakerList.result = IContributionParticipationMetadataFossil
248
249    def getTrack( self ):
250        pass
251    getTrack.convert = lambda t: t and t.getTitle()
252
253    def getSession( self ):
254        pass
255    getSession.convert = lambda s: s and s.getTitle()
256
257    def getType(self):
258        pass
259    getType.convert = lambda t: t and t.getName()
260
261    def getLocator(self):
262        pass
263    getLocator.convert = Conversion.url(urlHandlers.UHContributionDisplay)
264    getLocator.name = 'url'
265
266
267class ISubContributionMetadataFossil(IFossil):
268
269    def getId(self):
270        pass
271
272    def getTitle(self):
273        pass
274
275    def getDuration(self):
276        pass
277    getDuration.convert = Conversion.duration
278
279    def getSpeakerList(self):
280        pass
281    getSpeakerList.name = 'speakers'
282    getSpeakerList.result = IContributionParticipationMetadataFossil
283
284
285class IContributionMetadataWithSubContribsFossil(IContributionMetadataFossil):
286
287    def getSubContributionList(self):
288        pass
289    getSubContributionList.result = ISubContributionMetadataFossil
290    getSubContributionList.name = 'subContributions'
291
292
293class IConferenceMetadataWithContribsFossil(_IncludeMaterialFossil, IConferenceMetadataFossil):
294
295    def getContributionList(self):
296        pass
297    getContributionList.result = IContributionMetadataFossil
298    getContributionList.name = 'contributions'
299    getContributionList.filterBy = 'access'
300
301
302class IConferenceMetadataWithSubContribsFossil(_IncludeMaterialFossil, IConferenceMetadataFossil):
303
304    def getContributionList(self):
305        pass
306    getContributionList.result = IContributionMetadataWithSubContribsFossil
307    getContributionList.name = 'contributions'
308    getContributionList.filterBy = 'access'
309
310
311class ISessionMetadataFossil(ISessionFossil):
312
313    def getContributionList(self):
314        pass
315    getContributionList.result = IContributionMetadataWithSubContribsFossil
316    getContributionList.name = 'contributions'
317    getContributionList.filterBy = 'access'
318
319
320class ISessionMetadataWithContributionsFossil(ISessionFossil):
321
322    def getContributionList(self):
323        pass
324    getContributionList.result = IContributionMetadataFossil
325    getContributionList.name = 'contributions'
326
327class ISessionMetadataWithSubContribsFossil(ISessionFossil):
328
329    def getContributionList(self):
330        pass
331    getContributionList.result = IContributionMetadataWithSubContribsFossil
332    getContributionList.name = 'subcontributions'
333
334class IConferenceMetadataWithSessionsFossil(_IncludeMaterialFossil, IConferenceMetadataFossil):
335
336    def getSessionList(self):
337        pass
338    getSessionList.result = ISessionMetadataFossil
339    getSessionList.name = 'sessions'
340    getSessionList.filterBy = 'access'
341
342    def getContributionListWithoutSessions(self):
343        pass
344    getContributionListWithoutSessions.result = IContributionMetadataWithSubContribsFossil
345    getContributionListWithoutSessions.name = 'contributions'
346    getContributionListWithoutSessions.filterBy = 'access'
Note: See TracBrowser for help on using the repository browser.