2013-06-27 10:42:06 +00:00
|
|
|
import simplejson
|
|
|
|
import urllib
|
2013-10-08 07:28:41 +00:00
|
|
|
import openerp
|
2013-07-03 06:07:54 +00:00
|
|
|
import openerp.addons.web.http as http
|
|
|
|
from openerp.addons.web.http import request
|
2013-06-27 10:42:06 +00:00
|
|
|
import openerp.addons.web.controllers.main as webmain
|
2013-10-08 07:28:41 +00:00
|
|
|
SUPERUSER_ID = 1
|
2013-06-27 10:42:06 +00:00
|
|
|
|
2013-10-08 07:28:41 +00:00
|
|
|
class meetting_invitation(http.Controller):
|
|
|
|
|
|
|
|
@http.route('/meeting_invitation/accept', type='http', auth="none")
|
|
|
|
def accept(self, db, token, action, id):
|
|
|
|
# http://hostname:8069/meeting_invitation/accept/id=1&token=&db=
|
|
|
|
registry = openerp.modules.registry.RegistryManager.get(db)
|
|
|
|
attendee_pool = registry.get('calendar.attendee')
|
|
|
|
with registry.cursor() as cr:
|
|
|
|
attendee_ids = attendee_pool.search(cr, SUPERUSER_ID, [('access_token','=',token)])
|
|
|
|
attendee_pool.do_accept(cr, SUPERUSER_ID, attendee_ids)
|
|
|
|
return self.view(db, token, action, id, view='form')
|
|
|
|
|
|
|
|
|
|
|
|
@http.route('/meeting_invitation/decline', type='http', auth="none")
|
|
|
|
def declined(self, db, token, id):
|
|
|
|
# http://hostname:8069/meeting_invitation/accept/id=1&token=&db=
|
|
|
|
registry = openerp.modules.registry.RegistryManager.get(db)
|
|
|
|
attendee_pool = registry.get('calendar.attendee')
|
|
|
|
with registry.cursor() as cr:
|
|
|
|
attendee_ids = attendee_pool.search(cr, SUPERUSER_ID, [('access_token','=',token)])
|
|
|
|
attendee_pool.do_decline(cr, SUPERUSER_ID, attendee_ids)
|
|
|
|
return self.view(db, token, action, id, view='form')
|
|
|
|
|
|
|
|
@http.route('/meeting_invitation/view', type='http', auth="none")
|
|
|
|
def view(self, db, token, action, id, view='calendar'):
|
|
|
|
# http://hostname:8069/meeting_invitation/view/id=1&token=&db=&view=
|
2013-07-03 06:07:54 +00:00
|
|
|
js = "\n ".join('<script type="text/javascript" src="%s"></script>' % i for i in webmain.manifest_list('js', db=db))
|
|
|
|
css = "\n ".join('<link rel="stylesheet" href="%s">' % i for i in webmain.manifest_list('css',db=db))
|
2013-06-27 10:42:06 +00:00
|
|
|
return webmain.html_template % {
|
|
|
|
'js': js,
|
|
|
|
'css': css,
|
2013-07-03 06:07:54 +00:00
|
|
|
'modules': simplejson.dumps(webmain.module_boot(db)),
|
2013-10-08 07:28:41 +00:00
|
|
|
'init': 's.base_calendar.event("%s", "%s", "%s", "%s");' % (db, action, id, view),
|
2013-06-27 10:42:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|