2014-10-01 01:02:36 +08:00
# --------------------------------------------------------------------------------------------
# Private methods on server
# --------------------------------------------------------------------------------------------
@addPresentationToCollection = (meetingId, presentationObject, requester_id, requesterUserId) ->
requester = Meteor . Users . findOne ( { _id: requester_id , userId: requesterUserId } )
if requester ? and ( requester . presenter or requester . role is " MODERATOR " )
#check if the presentation is already in the collection
unless Meteor . Presentations . findOne ( { meetingId: meetingId , ' presentation.id ' : presentationObject . id } ) ?
entry =
meetingId: meetingId
presentation:
id: presentationObject . id
name: presentationObject . name
current: presentationObject . current
2014-09-26 03:20:00 +08:00
2014-10-01 01:02:36 +08:00
pointer: #initially we have no data about the cursor
x: 0.0
y: 0.0
2014-07-30 05:30:16 +08:00
2014-10-01 01:02:36 +08:00
id = Meteor . Presentations . insert ( entry )
console . log " presentation added id =[ #{ id } ]: #{ presentationObject . id } in #{ meetingId } . Presentations.size is now #{ Meteor . Presentations . find ( { meetingId: meetingId } ).count()} "
2014-08-12 04:54:16 +08:00
2014-10-01 01:02:36 +08:00
@removePresentationFromCollection = (meetingId, presentationId, requester_id, requesterUserId) ->
requester = Meteor . Users . findOne ( { _id: requester_id , userId: requesterUserId } )
if requester ? and ( requester . presenter or requester . role is " MODERATOR " )
if meetingId ? and presentationId ? and Meteor . Presentations . findOne ( { meetingId: meetingId , " presentation.id " : presentationId } ) ?
id = Meteor . Presentations . findOne ( { meetingId: meetingId , " presentation.id " : presentationId } )
if id ?
Meteor . Presentations . remove ( id . _id )
console . log " ----removed presentation[ " + presentationId + " ] from " + meetingId
# --------------------------------------------------------------------------------------------
# end Private methods on server
# --------------------------------------------------------------------------------------------