[IMP] Vidyo cloning checked by default
[cds-indico.git] / indico / MaKaC / plugins / Collaboration / Vidyo / components.py
blobea7387bc5bf1a7091126bd67f6ddf6f82614ead9
1 # -*- coding: utf-8 -*-
2 ##
3 ##
4 ## This file is part of CDS Indico.
5 ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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.
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.
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.
22 from MaKaC.common.utils import *
24 from indico.core.extpoint import Component
25 from indico.core.extpoint.events import INavigationContributor
26 from MaKaC.plugins.util import PluginsWrapper
28 import zope.interface
30 class VidyoContributor(Component):
32 zope.interface.implements(INavigationContributor)
34 @classmethod
35 def addCheckBox2CloneConf(cls, obj, list):
36 """ we show the clone checkbox if:
37 * The Vidyo Plugin is active.
38 * There are vydio services in the event created by the user who wants to clone
39 """
40 #list of creators of the chat rooms
41 if PluginsWrapper('Collaboration', 'Vidyo').isActive() and len(obj._conf.getCSBookingManager().getBookingList(filterByType="Vidyo")) !=0:
42 list['cloneOptions'] += _("""<li><input type="checkbox" name="cloneVidyo" id="cloneVidyo" value="1" checked/>Vidyo</li>""")
44 @classmethod
45 def fillCloneDict(self, obj, params):
46 options = params['options']
47 paramNames = params['paramNames']
48 options['vydio'] = 'cloneVidyo' in paramNames
50 @classmethod
51 def cloneEvent(cls, confToClone, params):
52 """ we'll clone only the vidyo services created by the user who is cloning the conference"""
53 conf = params['conf']
54 options = params['options']
56 if options.get("vydio", True):
57 for vs in confToClone.getCSBookingManager().getBookingList(filterByType="Vidyo"):
58 newBooking = vs.clone(conf)
59 conf.getCSBookingManager().addBooking(newBooking)