comparison libervia.tac @ 110:dfc02690deb4

browser side: CSS: header, unibox, tabs + drag'n' drop reworked
author Adrien Vigneron <adrienvigneron@mailoo.org>
date Wed, 29 Jun 2011 23:52:00 +0200
parents c3fb3292f582
children 2e2e10785c33
comparison
equal deleted inserted replaced
109:5c363b638127 110:dfc02690deb4
51 from zope.interface import Interface, Attribute, implements 51 from zope.interface import Interface, Attribute, implements
52 52
53 TIMEOUT = 10 #Session's time out, after that the user will be disconnected 53 TIMEOUT = 10 #Session's time out, after that the user will be disconnected
54 LIBERVIA_DIR = "output/" 54 LIBERVIA_DIR = "output/"
55 MEDIA_DIR = "media/" 55 MEDIA_DIR = "media/"
56 AVATARS_DIR = "avatars/"
56 CARDS_DIR = "games/cards/tarot" 57 CARDS_DIR = "games/cards/tarot"
57 58
58 class ISATSession(Interface): 59 class ISATSession(Interface):
59 profile = Attribute("Sat profile") 60 profile = Attribute("Sat profile")
60 jid = Attribute("JID associated with the profile") 61 jid = Attribute("JID associated with the profile")
259 260
260 def jsonrpc_tarotGamePlayCards(self, player_nick, referee, cards): 261 def jsonrpc_tarotGamePlayCards(self, player_nick, referee, cards):
261 """Tell to the server that we are ready to start the game""" 262 """Tell to the server that we are ready to start the game"""
262 profile = ISATSession(self.session).profile 263 profile = ISATSession(self.session).profile
263 self.sat_host.bridge.tarotGamePlayCards(player_nick, referee, cards, profile) 264 self.sat_host.bridge.tarotGamePlayCards(player_nick, referee, cards, profile)
265
266 def jsonrpc_getAvatar(self, jid):
267 """Get the avatar of a contact
268 @param jid: jid of contact from who we want the avatar
269 @return: path to the avatar image"""
270 cache = self.bridge.getCardCache(jid)
271 if cache.has_key('avatar'):
272 return self.bridge.getAvatarFile(cache['avatar'])
264 273
265 class Register(jsonrpc.JSONRPC): 274 class Register(jsonrpc.JSONRPC):
266 """This class manage the registration procedure with SàT 275 """This class manage the registration procedure with SàT
267 It provide an api for the browser, check password and setup the web server""" 276 It provide an api for the browser, check password and setup the web server"""
268 277
611 root.putChild('json_api', MethodHandler(self)) 620 root.putChild('json_api', MethodHandler(self))
612 root.putChild('register_api', _register) 621 root.putChild('register_api', _register)
613 root.putChild('blog', MicroBlog(self)) 622 root.putChild('blog', MicroBlog(self))
614 root.putChild('css', ProtectedFile("server_css/")) 623 root.putChild('css', ProtectedFile("server_css/"))
615 root.putChild(os.path.dirname(MEDIA_DIR), ProtectedFile(self.media_dir)) 624 root.putChild(os.path.dirname(MEDIA_DIR), ProtectedFile(self.media_dir))
625 root.putChild(os.path.dirname(AVATARS_DIR), ProtectedFile(os.path.join(self.local_dir, AVATARS_DIR)))
616 self.site = server.Site(root) 626 self.site = server.Site(root)
617 self.site.sessionFactory = LiberviaSession 627 self.site.sessionFactory = LiberviaSession
618 628
619 def startService(self): 629 def startService(self):
620 reactor.listenTCP(8080, self.site) 630 reactor.listenTCP(8080, self.site)