PageRenderTime 50ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/indico/MaKaC/fossils/conference.py

https://github.com/flannery/indico-flannery
Python | 205 lines | 181 code | 4 blank | 20 comment | 0 complexity | ec854b5dca2a5a0fad2f7477b7abab21 MD5 | raw file
  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. from MaKaC.common.fossilize import IFossil
  21. from MaKaC.common.Conversion import Conversion
  22. from MaKaC.webinterface import urlHandlers
  23. class IConferenceMinimalFossil(IFossil):
  24. def getId(self):
  25. """Conference id"""
  26. def getType(self):
  27. """ Event type: 'conference', 'meeting', 'simple_event' """
  28. def getTitle(self):
  29. """Conference title"""
  30. def getDescription(self):
  31. """Conference description"""
  32. def getLocation(self):
  33. """ Location (CERN/...) """
  34. getLocation.convert = lambda l: l and l.getName()
  35. def getRoom(self):
  36. """ Room (inside location) """
  37. getRoom.convert = lambda r: r and r.getName()
  38. def getStartDate(self):
  39. """ Start Date """
  40. getStartDate.convert = Conversion.datetime
  41. def getEndDate(self):
  42. """ End Date """
  43. getEndDate.convert = Conversion.datetime
  44. def getSupportEmail(self):
  45. """ Support Email """
  46. class IConferenceParticipationMinimalFossil(IFossil):
  47. def getFirstName( self ):
  48. """ Conference Participation First Name """
  49. def getFamilyName( self ):
  50. """ Conference Participation Family Name """
  51. class IConferenceParticipationFossil(IConferenceParticipationMinimalFossil):
  52. def getId( self ):
  53. """ Conference Participation Id """
  54. def getFullName( self ):
  55. """ Conference Participation Full Name """
  56. def getFullNameNoTitle(self):
  57. """ Conference Participation Full Name """
  58. getFullNameNoTitle.name = "name"
  59. def getAffiliation(self):
  60. """Conference Participation Affiliation """
  61. def getAddress(self):
  62. """Conference Participation Address """
  63. def getEmail(self):
  64. """Conference Participation Email """
  65. def getFax(self):
  66. """Conference Participation Fax """
  67. def getTitle(self):
  68. """Conference Participation Title """
  69. def getPhone(self):
  70. """Conference Participation Phone """
  71. class IResourceFossil(IFossil):
  72. def getName(self):
  73. """ Name of the Resource """
  74. class ILinkFossil(IResourceFossil):
  75. def getURL(self):
  76. """ URL of the file pointed by the link """
  77. getURL.name = "url"
  78. class ILocalFileFossil(IResourceFossil):
  79. def getURL(self):
  80. """ URL of the Local File """
  81. getURL.produce = lambda s: str(urlHandlers.UHFileAccess.getURL(s))
  82. getURL.name = "url"
  83. class IMaterialFossil(IFossil):
  84. def getTitle( self ):
  85. """ Material Title """
  86. def getResourceList(self):
  87. """ Material Resource List """
  88. getResourceList.result = {"MaKaC.conference.Link": ILinkFossil, "MaKaC.conference.LocalFile": ILocalFileFossil}
  89. getResourceList.name = "resources"
  90. class ISessionFossil(IFossil):
  91. def getTitle(self):
  92. """ Session Title """
  93. def getId(self):
  94. """ Session Id """
  95. getId.name = "sessionId"
  96. def getDescription(self):
  97. """ Session Description """
  98. def getAllMaterialList(self):
  99. """ Session List of all material """
  100. getAllMaterialList.result = IMaterialFossil
  101. getAllMaterialList.name = "material"
  102. def getColor(self):
  103. """ Session Color """
  104. def getTextColor(self):
  105. """ Session Text Color """
  106. def isPoster(self):
  107. """ Is self a Poster Session ? """
  108. isPoster.produce = lambda s: s.getScheduleType() == 'poster'
  109. class ISessionSlotFossil(IFossil):
  110. def getSession(self):
  111. """ Slot Session """
  112. getSession.result = ISessionFossil
  113. def getId(self):
  114. """ Session Slot Id """
  115. getId.name = "sessionSlotId"
  116. def getTitle(self):
  117. """ Session Slot Title """
  118. getTitle.name = "slotTitle"
  119. def getConference(self):
  120. """ Session Slot Conference """
  121. getConference.result = IConferenceMinimalFossil
  122. def getRoom(self):
  123. """ Session Slot Room """
  124. getRoom.convert = Conversion.roomName
  125. def getLocationName(self):
  126. """ Session Slot Location Name """
  127. getLocationName.produce = lambda s: s.getLocation()
  128. getLocationName.convert = Conversion.locationName
  129. getLocationName.name = "location"
  130. def getLocationAddress(self):
  131. """ Session Slot Location Address """
  132. getLocationAddress.produce = lambda s: s.getLocation()
  133. getLocationAddress.convert = Conversion.locationAddress
  134. getLocationAddress.name = "address"
  135. def inheritRoom(self):
  136. """ Does the Session inherit a Room ?"""
  137. inheritRoom.produce = lambda s: s.getOwnRoom() is None
  138. inheritRoom.name = "inheritRoom"
  139. def inheritLocation(self):
  140. """ Does the Session inherit a Location ?"""
  141. inheritLocation.produce = lambda s: s.getOwnLocation() is None
  142. inheritLocation.name = "inheritLoc"
  143. def getOwnConvenerList(self):
  144. """ Session Slot Conveners List """
  145. getOwnConvenerList.result = IConferenceParticipationFossil
  146. getOwnConvenerList.name = "conveners"