-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandlers.py
164 lines (141 loc) · 5.82 KB
/
handlers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
"""
Handlers
"""
import tornado.web
from tornado.escape import json_encode
# files to store handlers
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.redirect("/static/frontend/callcenter_dashboard/test.html")
class AjaxHandler(tornado.web.RequestHandler):
data = {
"index":[
{ "url" : "/", "name" : "Index" },
{ "url" : "hero", "name" : "Hero" },
{ "url" : "fluid", "name" : "Fluid" },
{ "url" : "signin", "name" : "Sign In" },
{ "url" : "sticky-footer", "name" : "Sticky-Footer" },
{ "url" : "sfn", "name" : "Sticky-Footer Navbar" },
{ "url" : "justified-nav", "name" : "Justified Navbar" },
{ "url" : "carousel", "name" : "Carousel" },
{ "url" : "market-narrow", "name" : "Market Narrow" },
{ "url" : "static-grid", "name" : "Static Grid" },
{ "url" : "ajax-grid", "name" : "Ajax Grid" },
{ "url" : "angular-ui", "name" : "Angular UI" },
{ "url" : "gen", "name" : "Socket.io gen" },
],
"grid": {
"head": [
{"key":"name", "desc":"Name"},
{"key":"creator", "desc":"Creator"},
{"key":"engine", "desc":"Engine"},
{"key":"license", "desc":"Software License"},
],
"body": [
{"name":"Chrome", "creator":"Google", "engine":"Webkit", "license":"BSD"},
{"name":"Firefox", "creator":"Mozilla", "engine":"Gecko", "license":"MPL/GPL/LGPL"},
{"name":"Internet Explorer", "creator":"Microsoft", "engine":"Trident", "license":"Proprietary"},
]
}
}
def get(self):
call_type = self.get_argument('type')
content = self.get_argument('content', [])
data = {}
if (content == 'detail'):
data = {
"detail" : ("This is %s detail inform generated via Ajax call by AngularJS." % call_type )
}
else:
data = self.data[call_type]
self.write(json_encode(data))
class SigninHandler(tornado.web.RequestHandler):
def get(self):
self.render("signin.tpl",
project_name=self.settings["globals"]["project_name"],
moduleName=""
)
class HeroHandler(tornado.web.RequestHandler):
def get(self):
self.render("hero.tpl",
project_name=self.settings["globals"]["project_name"],
moduleName=""
)
class SFNHandler(tornado.web.RequestHandler):
def get(self):
self.render("sfn.tpl",
project_name=self.settings["globals"]["project_name"],
moduleName=""
)
class StickyFooterHandler(tornado.web.RequestHandler):
def get(self):
self.render("sticky-footer.tpl",
project_name=self.settings["globals"]["project_name"],
moduleName=""
)
class JustifiedNavHandler(tornado.web.RequestHandler):
def get(self):
self.render("justified-nav.tpl",
project_name=self.settings["globals"]["project_name"],
moduleName=""
)
class CarouselHandler(tornado.web.RequestHandler):
def get(self):
self.render("carousel.tpl",
project_name=self.settings["globals"]["project_name"],
moduleName=""
)
class MarketNarrowHandler(tornado.web.RequestHandler):
def get(self):
self.render("market-narrow.tpl",
project_name=self.settings["globals"]["project_name"],
moduleName=""
)
class FluidHandler(tornado.web.RequestHandler):
def get(self):
self.render("fluid.tpl",
project_name=self.settings["globals"]["project_name"],
username="Unknown",
moduleName="",
)
def post(self):
#self.set_header("Content-Type", "text/plain")
self.render("fluid.tpl",
project_name=self.settings["globals"]["project_name"],
username=self.get_argument("address"),
moduleName="",
)
#static grid handler
class StaticGridHandler(tornado.web.RequestHandler):
data = [
{"name":"Chrome", "creator":"Google", "engine":"Webkit", "license":"BSD"},
{"name":"Firefox", "creator":"Mozilla", "engine":"Gecko", "license":"MPL/GPL/LGPL"},
{"name":"Internet Explorer", "creator":"Microsoft", "engine":"Trident", "license":"Proprietary"},
]
def get(self):
self.render("grid.tpl",
project_name=self.settings["globals"]["project_name"],
data=self.data,
moduleName="",
)
#ajax grid handler
class AjaxGridHandler(tornado.web.RequestHandler):
def get(self):
self.render("ajax-grid.tpl",
project_name=self.settings["globals"]["project_name"],
moduleName="",
)
#angular UI handler
class AngularUIHandler(tornado.web.RequestHandler):
def get(self):
self.render("angularUI.tpl",
project_name=self.settings["globals"]["project_name"],
moduleName="myApp",
)
class SocketIOGenHandler(tornado.web.RequestHandler):
"""Regular HTTP handler to serve the chatroom page"""
def get(self):
self.render('gen.tpl',
project_name=self.settings["globals"]["project_name"],
moduleName="",
)