1 # This file is part of Indico.
2 # Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
4 # Indico is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 3 of the
7 # License, or (at your option) any later version.
9 # Indico is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with Indico; if not, see <http://www.gnu.org/licenses/>.
17 from persistent
import Persistent
19 from MaKaC
.common
import log
20 from MaKaC
.common
.timezoneUtils
import nowutc
21 import MaKaC
.webinterface
.urlHandlers
as urlHandlers
22 from MaKaC
.webinterface
.mail
import GenericMailer
23 from MaKaC
.webinterface
.mail
import GenericNotification
24 from MaKaC
.common
import utils
25 from MaKaC
.i18n
import _
26 from indico
.core
import signals
27 from indico
.core
.config
import Config
28 from MaKaC
.common
.fossilize
import fossilizes
, Fossilizable
29 from MaKaC
.fossils
.participant
import IParticipantMinimalFossil
31 from indico
.modules
.users
.legacy
import AvatarUserWrapper
32 from indico
.util
.contextManager
import ContextManager
35 class Participation(Persistent
):
37 def __init__(self
, conference
):
38 self
._conference
= conference
39 self
._obligatory
= False
40 self
._addedInfo
= False
41 self
._allowedForApplying
= False
42 self
._autoAccept
= False
43 self
._participantList
= {}
44 self
._pendingParticipantList
= {}
45 self
._declinedParticipantList
= {}
46 self
._participantIdGenerator
= 0
47 self
._pendingIdGenerator
= 0
48 self
._declinedIdGenerator
= 0
49 self
._displayParticipantList
= True
50 self
._numMaxParticipants
= 0
51 self
._notifyMgrNewParticipant
= False
53 def clone(self
, conference
, options
, eventManager
=None):
54 newParticipation
= conference
.getParticipation()
55 newParticipation
._obligatory
= self
._obligatory
56 newParticipation
._allowedForApplying
= self
._allowedForApplying
57 newParticipation
._autoAccept
= self
.isAutoAccept()
58 newParticipation
._notifyMgrNewParticipant
= self
.isNotifyMgrNewParticipant()
59 newParticipation
._displayParticipantList
= self
._displayParticipantList
60 if options
.get("addedInfo", False) :
61 newParticipation
._addedInfo
= True
62 clonedStatuses
= ["added", "excused", "refused"]
63 for p
in self
._participantList
.values():
64 if p
.getStatus() in clonedStatuses
:
65 newParticipation
.addParticipant(p
.clone(conference
), eventManager
)
66 return newParticipation
68 def getConference(self
):
69 return self
._conference
71 def isObligatory(self
):
72 return self
._obligatory
74 def setObligatory(self
, responsibleUser
= None):
75 self
._obligatory
= True
77 logData
["subject"] = "Event set to MANDATORY"
78 self
._conference
.getLogHandler().logAction(logData
,
79 log
.ModuleNames
.PARTICIPANTS
)
81 def setInobligatory(self
, responsibleUser
= None):
82 self
._obligatory
= False
84 logData
["subject"] = "Event set to NON MANDATORY"
85 self
._conference
.getLogHandler().logAction(logData
,
86 log
.ModuleNames
.PARTICIPANTS
)
88 def isAddedInfo(self
):
89 return self
._addedInfo
91 def setAddedInfo(self
, responsibleUser
= None):
92 self
._addedInfo
= True
94 logData
["subject"] = "Info about adding WILL be sent to participants"
95 self
._conference
.getLogHandler().logAction(logData
,
96 log
.ModuleNames
.PARTICIPANTS
)
98 def setNoAddedInfo(self
, responsibleUser
= None):
99 self
._addedInfo
= False
101 logData
["subject"] = "Info about adding WON'T be sent to participants"
102 self
._conference
.getLogHandler().logAction(logData
,
103 log
.ModuleNames
.PARTICIPANTS
)
105 def isAllowedForApplying(self
):
107 if self
._allowedForApplying
:
109 except AttributeError :
110 self
._allowedForApplying
= False
111 return self
._allowedForApplying
113 def setAllowedForApplying(self
, responsibleUser
=None):
114 self
._allowedForApplying
= True
116 logData
["subject"] = "Applying for participation is ALLOWED"
117 self
._conference
.getLogHandler().logAction(logData
,
118 log
.ModuleNames
.PARTICIPANTS
)
119 self
.notifyModification()
121 def setNotAllowedForApplying(self
, responsibleUser
=None):
122 self
._allowedForApplying
= False
124 logData
["subject"] = "Applying for participation is NOT ALLOWED"
125 self
._conference
.getLogHandler().logAction(logData
,
126 log
.ModuleNames
.PARTICIPANTS
)
127 self
.notifyModification()
129 def isAutoAccept(self
):
131 return self
._autoAccept
132 except AttributeError :
133 self
._autoAccept
= False
136 def setAutoAccept(self
, value
, responsibleUser
= None):
137 self
._autoAccept
= value
139 "subject": "Auto accept of participation.",
142 self
._conference
.getLogHandler().logAction(logData
,
143 log
.ModuleNames
.PARTICIPANTS
)
144 self
.notifyModification()
146 def getNumMaxParticipants(self
):
148 return self
._numMaxParticipants
149 except AttributeError :
150 self
._numMaxParticipants
= 0
153 def setNumMaxParticipants(self
, value
, responsibleUser
= None):
154 self
._numMaxParticipants
= value
156 "subject": "Num max of participants.",
159 self
._conference
.getLogHandler().logAction(logData
,
160 log
.ModuleNames
.PARTICIPANTS
)
161 self
.notifyModification()
163 def isNotifyMgrNewParticipant(self
):
165 return self
._notifyMgrNewParticipant
166 except AttributeError:
167 self
._notifyMgrNewParticipant
= False
170 def setNotifyMgrNewParticipant(self
, value
):
171 currentUser
= ContextManager
.get('currentUser')
172 self
._notifyMgrNewParticipant
= value
176 logData
["subject"] = _("Manager notification of participant application has been enabled")
178 logData
["subject"] = _("Manager notification of participant application has been disabled")
180 self
._conference
.getLogHandler().logAction(logData
,
181 log
.ModuleNames
.PARTICIPANTS
)
182 self
.notifyModification()
185 if self
.getNumMaxParticipants() != 0:
186 return len(self
.getParticipantList()) >= self
.getNumMaxParticipants()
189 def alreadyParticipating(self
, participant
):
190 if participant
is None :
192 if participant
.getConference().getId() != self
.getConference().getId() :
194 if participant
.getId() in self
._participantList
.keys() :
196 if participant
.getEmail().strip() == "":
198 for p
in self
._participantList
.values() :
199 pString
= p
.getEmail()
200 newString
= participant
.getEmail()
201 if pString
== newString
:
205 def alreadyPending(self
, pending
):
208 if pending
.getConference().getId() != self
.getConference().getId() :
210 if pending
.getId() in self
._pendingParticipantList
.keys() :
212 if pending
.getEmail().strip() == "":
214 for p
in self
._pendingParticipantList
.values() :
215 if p
.getEmail() == pending
.getEmail() :
219 def getParticipantList(self
):
220 participants
= self
._participantList
.values()
221 participants
.sort(utils
.sortUsersByName
)
224 def getPresentParticipantListText(self
):
226 for p
in self
.getParticipantList():
227 if p
.isPresent() and p
.isConfirmed():
230 return "; ".join(text
)
232 def getParticipantById(self
, participantId
):
233 if participantId
is not None:
234 return self
._participantList
.get(participantId
, None)
238 def getPendingParticipantList(self
):
239 return self
._pendingParticipantList
241 def getPendingParticipantByKey(self
, key
):
243 return self
._pendingParticipantList
.get(key
, None)
247 def prepareAddedInfo(self
, participant
, eventManager
):
248 if participant
is None :
250 if eventManager
is None :
259 refuseURL
= urlHandlers
.UHConfParticipantsRefusal
.getURL( self
._conference
)
260 refuseURL
.addParam("participantId","%d"%self
._lastParticipantId
())
261 eventURL
= urlHandlers
.UHConferenceDisplay
.getURL( self
._conference
)
264 if participant
.getAvatar() is not None :
265 toList
.append(participant
.getAvatar().getEmail())
266 data
["toList"] = toList
267 title
= participant
.getAvatar().getTitle()
268 familyName
= participant
.getAvatar().getFamilyName()
269 firstName
= participant
.getAvatar().getFirstName()
271 toList
.append(participant
.getEmail())
272 data
["toList"] = toList
273 title
= participant
.getTitle()
274 familyName
= participant
.getFamilyName()
275 firstName
= participant
.getFamilyName()
276 if data
["toList"] is None or len(data
["toList"]) == 0 :
279 if title
is None or title
== "" :
281 if not self
._obligatory
:
283 If you are not interested in taking part in this event
284 or cannot participate due to any reason, please indicate your decline
285 to the event organisers at %s
289 Due to decision of the organisers, presence in the event
290 is obligatory for all participants.
293 data
["fromAddr"] = eventManager
.getEmail()
294 data
["subject"] = "Invitation to '%s'" % self
._conference
.getTitle()
298 you have been added to the list of '%s' participants.
299 Further information on this event are avaliable at %s.
301 Looking forward to meeting you at %s
304 """ % (title
, familyName
,
305 self
._conference
.getTitle(),
307 self
._conference
.getTitle(),
308 eventManager
.getFirstName(), eventManager
.getFamilyName())
312 def getDeclinedParticipantList(self
):
314 return self
._declinedParticipantList
315 except AttributeError :
316 self
._declinedParticipantList
= {}
317 return self
._declinedParticipantList
319 def declineParticipant(self
, participant
, responsibleUser
= None):
320 if participant
.getConference().getId() != self
._conference
.getId() :
322 self
.removePendingParticipant(participant
)
323 self
.getDeclinedParticipantList()["%d"%self
._newDeclinedId
()] = participant
324 logData
= participant
.getParticipantData()
325 logData
["subject"] = _("Participant declined : %s")%participant
.getWholeName()
326 self
._conference
.getLogHandler().logAction(logData
,
327 log
.ModuleNames
.PARTICIPANTS
)
328 self
.notifyModification()
331 def getDeclinedParticipantByKey(self
, key
):
333 return self
.getDeclinedParticipantList().get(key
, None)
337 def addParticipant(self
, participant
, eventManager
= None):
338 # check if it's worth to add the participant
339 if participant
.getConference().getId() != self
._conference
.getId() :
341 self
.removePendingParticipant(participant
)
342 if not participant
.setId(self
._newParticipantId
()):
344 if self
.alreadyParticipating(participant
) != 0 :
346 self
._participantList
["%d"%self
._lastParticipantId
()] = participant
348 # remove him from the "pending" list
349 if participant
in self
._pendingParticipantList
.values() :
350 for k
in self
._pendingParticipantList
.keys() :
351 if self
._pendingParticipantList
[k
] == participant
:
352 del self
._pendingParticipantList
[k
]
355 logData
= participant
.getParticipantData()
356 logData
["subject"] = _("New participant added : %s")%participant
.getWholeName()
357 self
._conference
.getLogHandler().logAction(logData
,
358 log
.ModuleNames
.PARTICIPANTS
)
360 participant
.setStatusAdded()
362 # check if an e-mail should be sent...
364 # to notify the user of his/her addition
365 if eventManager
is None :
367 data
= self
.prepareAddedInfo(participant
, eventManager
)
368 GenericMailer
.sendAndLog(GenericNotification(data
),
370 log
.ModuleNames
.PARTICIPANTS
)
372 avatar
= participant
.getAvatar()
375 # or to encourage him/her to register at Indico
376 #self.sendEncouragementToCreateAccount(participant)
379 # OK, if we have an avatar, let's keep things consistent
380 avatar
.linkTo(self
._conference
,"participant")
382 self
.notifyModification()
385 def inviteParticipant(self
, participant
, eventManager
):
386 if participant
.getConference().getId() != self
._conference
.getId() :
388 if not participant
.setId(self
._newParticipantId
()):
390 if eventManager
is None :
392 if self
.alreadyParticipating(participant
) != 0 :
394 self
._participantList
["%d"%self
._lastParticipantId
()] = participant
395 logData
= participant
.getParticipantData()
396 logData
["subject"] = _("New participant invited : %s")%participant
.getWholeName()
397 self
._conference
.getLogHandler().logAction(logData
,
398 log
.ModuleNames
.PARTICIPANTS
)
399 participant
.setStatusInvited()
400 if participant
.getAvatar() is not None:
401 if not participant
.getAvatar().getEmail():
404 if not participant
.getEmail() or participant
.getEmail() == "":
406 self
.notifyModification()
409 def removeParticipant(self
, participant
, responsibleUser
=None):
410 if participant
is None:
412 # If 'participant' is an object from Participant
413 if isinstance(participant
, Participant
):
414 # remove all entries with participant
415 for key
, value
in self
._participantList
.items():
416 if value
== participant
:
417 del self
._participantList
[key
]
418 # If 'participant' is a key
421 if key
not in self
._participantList
:
423 participant
= self
._participantList
[key
]
424 del self
._participantList
[key
]
426 logData
= participant
.getParticipantData()
427 logData
["subject"] = _("Removed participant %s %s (%s)")%(participant
.getFirstName(),participant
.getFamilyName(),participant
.getEmail())
428 self
._conference
.getLogHandler().logAction(logData
,
429 log
.ModuleNames
.PARTICIPANTS
)
431 avatar
= participant
.getAvatar()
433 avatar
.unlinkTo(self
._conference
,"participant")
434 if participant
._status
in {'added', 'accepted'}:
435 signals
.event
.participant_changed
.send(self
._conference
, user
=avatar
, participant
=participant
,
436 old_status
=participant
._status
, action
='removed')
437 self
.notifyModification()
440 def setParticipantAccepted(self
, participantId
):
441 participant
= self
.getParticipantById(participantId
)
443 status
= participant
.setStatusAccepted()
444 self
.notifyModification()
448 def setParticipantRejected(self
, participantId
):
449 participant
= self
.getParticipantById(participantId
)
451 status
= participant
.setStatusRejected()
452 self
.notifyModification()
456 def addPendingParticipant(self
, participant
):
457 if participant
.getConference().getId() != self
._conference
.getId() :
459 if participant
.getId() is not None :
461 if self
.alreadyParticipating(participant
) != 0 :
463 if self
.isAutoAccept():
464 self
.addParticipant(participant
)
466 self
._pendingParticipantList
["%d"%self
._newPendingId
()] = participant
468 logData
= participant
.getParticipantData()
469 logData
["subject"] = _("New pending participant : %s")%participant
.getWholeName()
470 self
._conference
.getLogHandler().logAction(logData
,
471 log
.ModuleNames
.PARTICIPANTS
)
473 participant
.setStatusPending()
475 profileURL
= urlHandlers
.UHConfModifParticipantsPending
.getURL(self
._conference
)
478 creator
=self
._conference
.getCreator()
479 if isinstance(creator
, AvatarUserWrapper
):
480 toList
.append(creator
.getEmail())
481 for manager
in self
._conference
.getAccessController().getModifierList() :
482 if isinstance(manager
, AvatarUserWrapper
):
483 toList
.append(manager
.getEmail())
486 data
["toList"] = toList
487 data
["fromAddr"] = Config
.getInstance().getSupportEmail()
488 data
["subject"] = _("New pending participant for %s")%self
._conference
.getTitle()
492 a new person is asking for participation in %s.
493 Personal profile of this pending participant is available at %s
494 Please take this candidature into consideration and accept or reject it
497 """%(self
._conference
.getTitle(), profileURL
)
499 GenericMailer
.send(GenericNotification(data
))
500 self
.notifyModification()
503 def removePendingParticipant(self
, participant
, responsibleUser
=None):
504 if participant
is None:
506 if isinstance(participant
, Participant
):
507 # remove all entries with participant
508 for key
, value
in self
._pendingParticipantList
.items():
509 if value
== participant
:
510 del self
._pendingParticipantList
[key
]
515 participant
= self
._pendingParticipantList
[key
]
516 del self
._pendingParticipantList
[key
]
518 logData
= participant
.getParticipantData()
519 logData
["subject"] = _("Pending participant removed : %s")%participant
.getWholeName()
520 self
._conference
.getLogHandler().logAction(logData
,
521 log
.ModuleNames
.PARTICIPANTS
)
523 self
.notifyModification()
526 def setPendingDeclined(self
, pendingId
):
527 return self
._pendingParticipantList
[pendingId
].setStatusDeclined()
528 self
.notifyModification()
530 def setPendingAdded(self
, pendingId
):
531 return self
.addParticipant(self
._pendingParticipantList
[pendingId
])
532 self
.notifyModification()
534 def prepareAskForExcuse(self
, eventManager
, toIdList
):
535 if eventManager
is None :
537 if toIdList
is None :
539 if not self
._obligatory
:
542 if nowutc() < self
._conference
.getEndDate() :
547 p
= self
._participantList
[id]
548 if not p
.isPresent() :
550 if len(toList
) == 0 :
554 data
["toList"] = toList
555 data
["fromAddr"] = eventManager
.getEmail()
556 data
["subject"] = _("Please excuse your absence to %s")%self
._conference
.getTitle()
560 you were absent to %s, which was mandatory for you to attend.
561 Therefore %s %s, the organiser of this event is kindly asking you to provide reasons
562 for your absence, so that it could be excused - simply by replying to
567 """%(self
._conference
.getTitle(), \
568 eventManager
.getFirstName(), eventManager
.getFamilyName(), \
569 eventManager
.getFirstName(), eventManager
.getFamilyName())
573 def askForExcuse(self
, eventManager
, toIdList
):
574 data
= self
.prepareAskForExcuse(eventManager
, toIdList
)
578 GenericMailer
.sendAndLog(GenericNotification(data
), self
._conference
,
579 log
.ModuleNames
.PARTICIPANTS
)
582 def sendSpecialEmail(self
, participantsIdList
, eventManager
, data
):
583 if participantsIdList
is None :
585 if eventManager
is None :
587 if len(participantsIdList
) == 0:
589 if data
.get("subject", None) is None :
591 if data
.get("body", None) is None :
593 data
["fromAddr"] = eventManager
.getEmail()
596 for userId
in participantsIdList
:
597 participant
= self
._participantList
.get(userId
, None)
598 if participant
is not None :
599 toList
.append(participant
.getEmail())
600 data
["toList"] = toList
601 GenericMailer
.sendAndLog(GenericNotification(data
), self
._conference
,
602 log
.ModuleNames
.PARTICIPANTS
)
605 def getPresentNumber(self
):
607 for p
in self
._participantList
.values() :
608 if p
.isPresent() and p
.isConfirmed():
612 def getAbsentNumber(self
):
614 for p
in self
._participantList
.values() :
615 if not p
.isPresent() and p
.isConfirmed():
619 def getExcusedNumber(self
):
621 for p
in self
._participantList
.values() :
622 if "excused" == p
.getStatus() :
626 def getInvitedNumber(self
):
628 for p
in self
._participantList
.values() :
629 if "invited" == p
.getStatus() :
633 def getRejectedNumber(self
):
635 for p
in self
._participantList
.values() :
636 if "rejected" == p
.getStatus() :
640 def getAddedNumber(self
):
642 for p
in self
._participantList
.values() :
643 if "added" == p
.getStatus() :
647 def getRefusedNumber(self
):
649 for p
in self
._participantList
.values() :
650 if "excused" == p
.getStatus() :
654 def getPendingNumber(self
):
656 for part
in self
._pendingParticipantList
.values():
657 if not part
.getStatus() == "declined":
661 def getDeclinedNumber(self
):
662 return len(self
.getDeclinedParticipantList())
664 def _newParticipantId(self
):
665 self
._participantIdGenerator
+= 1
666 return self
._participantIdGenerator
668 def _lastParticipantId(self
):
669 return self
._participantIdGenerator
671 def _newPendingId(self
):
672 self
._pendingIdGenerator
+= 1
673 return self
._pendingIdGenerator
675 def _lastPendingId(self
):
676 return self
._pendingIdGenerator
678 def _newDeclinedId(self
):
680 self
._declinedIdGenerator
+= 1
681 except AttributeError:
682 self
._declinedIdGenerator
= 1
683 return self
._declinedIdGenerator
685 def _lastDeclinedId(self
):
687 return self
._declinedIdGenerator
688 except AttributeError:
689 self
._declinedIdGenerator
= 0
690 return self
._declinedIdGenerator
692 def displayParticipantList(self
):
694 if self
._displayParticipantList
:
696 except AttributeError :
697 self
._displayParticipantList
= True
698 return self
._displayParticipantList
700 def participantListDisplay(self
):
701 self
.displayParticipantList()
702 self
._displayParticipantList
= True
703 self
.notifyModification()
705 def participantListHide(self
):
706 self
.displayParticipantList()
707 self
._displayParticipantList
= False
708 self
.notifyModification()
710 def notifyModification(self
):
711 if self
._conference
!= None:
712 self
._conference
.notifyModification()
715 #---------------------------------------------------------------------------------
718 class Participant(Persistent
, Fossilizable
):
720 Class collecting data about person taking part in meeting / lecture
722 fossilizes(IParticipantMinimalFossil
)
724 def __init__(self
, conference
, avatar
=None):
725 if avatar
is not None:
727 self
._avatar
= avatar
728 self
._firstName
= avatar
.getFirstName()
729 self
._familyName
= avatar
.getFamilyName()
730 if self
._firstName
.strip() == "" and self
._familyName
.strip() == "":
731 self
._firstName
= "Undefined name"
732 self
._title
= avatar
.getTitle()
733 self
._address
= avatar
.getAddress()
734 self
._affiliation
= avatar
.getAffiliation()
735 self
._telephone
= avatar
.getTelephone()
736 self
._fax
= avatar
.getFax()
737 self
._email
= avatar
.getEmail()
741 self
._participation
= None
742 if conference
is not None :
743 self
._participation
= conference
.getParticipation()
748 self
._familyName
= ""
751 self
._affiliation
= ""
758 self
._participation
= None
759 if conference
is not None:
760 self
._participation
= conference
.getParticipation()
762 def clone(self
, conference
):
763 newPart
= Participant(conference
)
764 newPart
._avatar
= self
._avatar
765 newPart
._firstName
= self
._firstName
766 newPart
._familyName
= self
._familyName
767 newPart
._title
= self
._title
768 newPart
._address
= self
._address
769 newPart
._affiliation
= self
._affiliation
770 newPart
._telephone
= self
._telephone
771 newPart
._fax
= self
._fax
772 newPart
._email
= self
._email
773 newPart
._status
= None
774 newPart
._present
= True
783 if self
._id
is not None :
794 def setTitle(self
, title
):
797 def getFirstName(self
):
798 return self
._firstName
800 def setFirstName(self
, firstName
):
801 self
._firstName
= firstName
803 def getFamilyName(self
):
804 return self
._familyName
806 def setFamilyName(self
, familyName
):
807 self
._familyName
= familyName
809 def getWholeName(self
):
810 return "%s %s %s"%(self
._title
,self
._firstName
,self
._familyName
)
812 def getFullName(self
):
813 return self
.getWholeName()
816 return "%s %s"%(self
.getFirstName(),self
.getFamilyName())
818 def getAddress(self
):
821 def setAddress(self
, address
):
822 self
._address
= address
824 def getAffiliation(self
):
825 return self
._affiliation
827 def setAffiliation(self
, affiliation
):
828 self
._affiliation
= affiliation
830 def getTelephone(self
):
831 return self
._telephone
833 def setTelephone(self
, telephone
):
834 self
._telephone
= telephone
839 def setFax(self
, fax
):
845 def setEmail(self
, email
):
848 def getParticipantData(self
):
850 data
["Title"] = self
.getTitle()
851 data
["Family name"] = self
.getFamilyName()
852 data
["First name"] = self
.getFirstName()
853 data
["Affiliation"] = self
.getAffiliation()
854 data
["Address"] = self
.getAddress()
855 data
["Email"] = self
.getEmail()
856 data
["Phone"] = self
.getTelephone()
857 data
["Fax"] = self
.getFax()
858 data
["Participant status"] = self
.getStatus()
865 def setPresent(self
):
869 self
._present
= False
871 def getParticipation(self
):
872 return self
._participation
874 def getConference(self
):
875 return self
._participation
.getConference()
880 def isConfirmed(self
):
881 return self
._status
in ["accepted", "added"]
883 def setStatusAdded(self
, responsibleUser
=None):
884 old_status
= self
._status
885 self
._status
= "added"
886 #if self._status is None or self._status == "pending" :
887 # self._status = "added"
889 # logData = self.getParticipantData()
890 # logData["subject"] = _("%s : status set to ADDED")%self.getWholeName()
891 # self.getConference().getLogHandler().logAction(logData,"participants",responsibleUser)
893 signals
.event
.participant_changed
.send(self
.getConference(), user
=self
._avatar
, participant
=self
,
894 old_status
=old_status
, action
='added')
895 logData
= self
.getParticipantData()
896 logData
["subject"] = "%s : status set to ADDED"%self
.getWholeName()
897 self
.getConference().getLogHandler().logAction(logData
,
898 log
.ModuleNames
.PARTICIPANTS
)
902 def setStatusRefused(self
, responsibleUser
=None):
903 if self
._status
!= "added":
905 old_status
= self
._status
906 self
._status
= "refused"
908 signals
.event
.participant_changed
.send(self
.getConference(), user
=self
._avatar
, participant
=self
,
909 old_status
=old_status
, action
='removed')
910 logData
= self
.getParticipantData()
911 logData
["subject"] = _("%s : status set to REFUSED")%self
.getWholeName()
912 self
.getConference().getLogHandler().logAction(logData
,
913 log
.ModuleNames
.PARTICIPANTS
)
917 def setStatusExcused(self
, responsibleUser
=None):
918 if not self
.isConfirmed() or self
._present
:
920 self
._status
= "excused"
922 logData
= self
.getParticipantData()
923 logData
["subject"] = _("%s : status set to EXCUSED")%self
.getWholeName()
924 self
.getConference().getLogHandler().logAction(logData
,
925 log
.ModuleNames
.PARTICIPANTS
)
929 def setStatusInvited(self
, responsibleUser
=None):
930 if self
._status
is not None :
932 self
._status
= "invited"
934 logData
= self
.getParticipantData()
935 logData
["subject"] = _("%s : status set to INVITED")%self
.getWholeName()
936 self
.getConference().getLogHandler().logAction(logData
,
937 log
.ModuleNames
.PARTICIPANTS
)
941 def setStatusAccepted(self
, responsibleUser
=None):
942 if self
._status
not in ('invited', 'added'):
944 old_status
= self
._status
945 self
._status
= "accepted"
947 if old_status
!= 'added':
948 signals
.event
.participant_changed
.send(self
.getConference(), user
=self
._avatar
, participant
=self
,
949 old_status
=old_status
, action
='added')
950 logData
= self
.getParticipantData()
951 logData
["subject"] = _("%s : status set to ACCEPTED")%self
.getWholeName()
952 self
.getConference().getLogHandler().logAction(logData
,
953 log
.ModuleNames
.PARTICIPANTS
)
957 def setStatusRejected(self
, responsibleUser
=None):
958 if self
._status
not in ('invited', 'added'):
960 old_status
= self
._status
961 self
._status
= "rejected"
963 if old_status
== 'added':
964 signals
.event
.participant_changed
.send(self
.getConference(), user
=self
._avatar
, participant
=self
,
965 old_status
=old_status
, action
='removed')
966 logData
= self
.getParticipantData()
967 logData
["subject"] = _("%s : status set to REJECTED")%self
.getWholeName()
968 self
.getConference().getLogHandler().logAction(logData
,
969 log
.ModuleNames
.PARTICIPANTS
)
973 def setStatusPending(self
, responsibleUser
=None):
974 if self
._status
is not None :
976 self
._status
= "pending"
978 logData
= self
.getParticipantData()
979 logData
["subject"] = _("%s : status set to PENDING")%self
.getWholeName()
980 self
.getConference().getLogHandler().logAction(logData
,
981 log
.ModuleNames
.PARTICIPANTS
)
985 def setStatusDeclined(self
, responsibleUser
=None):
986 if self
._status
!= "pending" :
988 self
._status
= "declined"
990 logData
= self
.getParticipantData()
991 logData
["subject"] = _("%s : status set to DECLINED")%self
.getWholeName()
992 self
.getConference().getLogHandler().logAction(logData
,
993 log
.ModuleNames
.PARTICIPANTS
)
998 #---------------------------------------------------------------------------------