PageRenderTime 27ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/indico/MaKaC/plugins/Collaboration/fossils.py

https://github.com/flannery/indico-flannery
Python | 207 lines | 183 code | 3 blank | 21 comment | 2 complexity | 6e5a80067b3f9e0defa00a0975d0f5f9 MD5 | raw file
  1. # -*- coding: utf-8 -*-
  2. ##
  3. ## This file is part of CDS Indico.
  4. ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 CERN.
  5. ##
  6. ## CDS Indico is free software; you can redistribute it and/or
  7. ## modify it under the terms of the GNU General Public License as
  8. ## published by the Free Software Foundation; either version 2 of the
  9. ## License, or (at your option) any later version.
  10. ##
  11. ## CDS Indico is distributed in the hope that it will be useful, but
  12. ## WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. ## General Public License for more details.
  15. ##
  16. ## You should have received a copy of the GNU General Public License
  17. ## along with CDS Indico; if not, write to the Free Software Foundation, Inc.,
  18. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
  19. """ This file has the common fossils for Collaboration
  20. There are 3 groups of fossils:
  21. -base fossils for the plugin's CSBooking classes,
  22. -base fossils for the plugin's CSError classes,
  23. -fossils used by the core for the Video Services Overview page (they are not base fossils for plugins)
  24. """
  25. from MaKaC.common.fossilize import IFossil
  26. from MaKaC.fossils.conference import IConferenceMinimalFossil
  27. from MaKaC.common.Conversion import Conversion
  28. ##################### Booking fossils #####################
  29. class ICSBookingBaseFossil(IFossil):
  30. def getId(self):
  31. """ Returns the internal, per-conference id of the booking. """
  32. def getType(self):
  33. """ Returns the type of the booking, as a string: EVO, CERNMCU, etc. """
  34. def getAdjustedCreationDate(self):
  35. """ Returns the booking creation date, adjusted to a given timezone """
  36. getAdjustedCreationDate.name = "creationDate"
  37. getAdjustedCreationDate.convert = Conversion.datetime
  38. def getAdjustedModificationDate(self):
  39. """ Returns the booking last modification date, adjusted to a given timezone """
  40. getAdjustedModificationDate.name = "modificationDate"
  41. getAdjustedModificationDate.convert = Conversion.datetime
  42. def getStatusMessage(self):
  43. """ Returns the status message as a string. """
  44. def getStatusClass(self):
  45. """ Returns the status message CSS class as a string. """
  46. def getAcceptRejectStatus(self):
  47. """ Returns the Accept/Reject status of the booking """
  48. def getBookingParams(self):
  49. """ Returns a dictionary with the booking params. """
  50. class ICSBookingBaseConfModifFossil(ICSBookingBaseFossil):
  51. def getWarning(self):
  52. """ Returns a warning object attached to this booking. (self._warning) """
  53. getWarning.result = None #whatever the object's default fossil is, it will be used
  54. def getRejectReason(self):
  55. """ Returns the rejection reason. """
  56. def hasStart(self):
  57. """ Returns if this booking belongs to a plugin who has a "start" concept. """
  58. def hasStartStopAll(self):
  59. """ Returns if this booking belongs to a plugin who has a "start" concept, and all of its bookings for a conference
  60. can be started simultanously.
  61. """
  62. def hasStop(self):
  63. """ Returns if this booking belongs to a plugin who has a "start" concept. """
  64. def hasCheckStatus(self):
  65. """ Returns if this booking belongs to a plugin who has a "check status" concept. """
  66. def hasAcceptReject(self):
  67. """ Returns if this booking belongs to a plugin who has a "accept or reject" concept. """
  68. def requiresServerCallForStart(self):
  69. """ Returns if this booking belongs to a plugin who requires a server call when the start button is pressed."""
  70. requiresServerCallForStart.name = "requiresServerCallForStart"
  71. def requiresServerCallForStop(self):
  72. """ Returns if this booking belongs to a plugin who requires a server call when the stop button is pressed. """
  73. requiresServerCallForStop.name = "requiresServerCallForStop"
  74. def requiresClientCallForStart(self):
  75. """ Returns if this booking belongs to a plugin who requires a client call when the start button is pressed. """
  76. requiresClientCallForStart.name = "requiresClientCallForStart"
  77. def requiresClientCallForStop(self):
  78. """ Returns if this booking belongs to a plugin who requires a client call when the stop button is pressed. """
  79. requiresClientCallForStop.name = "requiresClientCallForStop"
  80. def canBeDeleted(self):
  81. """ Returns if this booking can be deleted, in the sense that the "Remove" button will be active and able to be pressed. """
  82. canBeDeleted.name = "canBeDeleted"
  83. def canBeStarted(self):
  84. """ Returns if this booking can be started, in the sense that the "Start" button will be active and able to be pressed. """
  85. canBeStarted.name = "canBeStarted"
  86. def canBeStopped(self):
  87. """ Returns if this booking can be stopped, in the sense that the "Stop" button will be active and able to be pressed. """
  88. canBeStopped.name = 'canBeStopped'
  89. def isPermittedToStart(self):
  90. """ Returns if this booking is allowed to start, in the sense that it will be started after the "Start" button is pressed.
  91. For example a booking should not be permitted to start before a given time, even if the button is active. """
  92. isPermittedToStart.name = "permissionToStart"
  93. def isPermittedToStop(self):
  94. """ Returns if this booking is allowed to stop, in the sense that it will be started after the "Stop" button is pressed."""
  95. isPermittedToStop.name = "permissionToStop"
  96. def canBeNotifiedOfEventDateChanges(self):
  97. """ Returns if bookings of this type should be able to be notified
  98. of their owner Event changing start date, end date or timezone. """
  99. canBeNotifiedOfEventDateChanges.name = "canBeNotifiedOfEventDateChanges"
  100. def isAllowMultiple(self):
  101. """ Returns if this booking belongs to a type that allows multiple bookings per event. """
  102. class ICSBookingBaseIndexingFossil(ICSBookingBaseFossil):
  103. def getConference(self):
  104. """ Returns a fossil of the Conference this booking is attached to """
  105. getConference.result = IConferenceMinimalFossil
  106. def getModificationURL(self):
  107. pass
  108. getModificationURL.name = "modificationURL"
  109. getModificationURL.convert = lambda url: str(url)
  110. ##################### Error fossils #####################
  111. class ICSErrorBaseFossil(IFossil):
  112. def getError(self):
  113. """ Always returns True"""
  114. getError.produce = lambda self: True
  115. class ICSSanitizationErrorFossil(ICSErrorBaseFossil):
  116. def invalidFields(self):
  117. pass
  118. invalidFields.name = "invalidFields"
  119. ##################### Indexing core fossils #####################
  120. class IIndexInformationFossil(IFossil):
  121. def getName(self):
  122. pass
  123. def getPlugins(self):
  124. pass
  125. def hasShowOnlyPending(self):
  126. pass
  127. def hasViewByStartDate(self):
  128. pass
  129. class IQueryResultFossil(IFossil):
  130. def getResults(self):
  131. pass
  132. getResults.result = None
  133. #the .result tag will be updated at run time because it is a dictionary whose values
  134. #depend on the loaded plugins, therefore, on the database state
  135. def getNumberOfBookings(self):
  136. pass
  137. getNumberOfBookings.name = 'nBookings'
  138. def getNumberOfGroups(self):
  139. pass
  140. getNumberOfGroups.name = 'nGroups'
  141. def getTotalInIndex(self):
  142. pass
  143. def getNPages(self):
  144. pass