git://git.onelab.eu
/
plstackapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c1fc36a
)
iframe view support
author
Scott Baker
<smbaker@gmail.com>
Thu, 19 Jun 2014 01:26:45 +0000
(18:26 -0700)
committer
Scott Baker
<smbaker@gmail.com>
Thu, 19 Jun 2014 01:26:45 +0000
(18:26 -0700)
planetstack/core/dashboard/views/home.py
patch
|
blob
|
history
diff --git
a/planetstack/core/dashboard/views/home.py
b/planetstack/core/dashboard/views/home.py
index
06e2c5f
..
6cb25a0
100644
(file)
--- a/
planetstack/core/dashboard/views/home.py
+++ b/
planetstack/core/dashboard/views/home.py
@@
-25,7
+25,7
@@
class DashboardDynamicView(TemplateView):
else:
return self.singleDashboardView(request, name, context)
else:
return self.singleDashboardView(request, name, context)
- def read
Dashboard
(self, fn):
+ def read
Template
(self, fn):
try:
template= open("/opt/planetstack/templates/admin/dashboard/%s.html" % fn, "r").read()
if (fn=="tenant"):
try:
template= open("/opt/planetstack/templates/admin/dashboard/%s.html" % fn, "r").read()
if (fn=="tenant"):
@@
-35,6
+35,13
@@
class DashboardDynamicView(TemplateView):
except:
return "failed to open %s" % fn
except:
return "failed to open %s" % fn
+ def embedDashboard(self, url):
+ if url.startswith("template:"):
+ fn = url[9:]
+ return self.readTemplate(fn)
+ elif url.startswith("http"):
+ return '<iframe src="%s" width="100%%" height="100%%" style="min-height: 1024px;" frameBorder="0"></iframe>' % url
+
def multiDashboardView(self, request, context):
head_template = self.head_template
tail_template = self.tail_template
def multiDashboardView(self, request, context):
head_template = self.head_template
tail_template = self.tail_template
@@
-59,9
+66,7
@@
class DashboardDynamicView(TemplateView):
for i,view in enumerate(dashboards):
url = view.url
body = body + '<div id="dashtab-%d">\n' % i
for i,view in enumerate(dashboards):
url = view.url
body = body + '<div id="dashtab-%d">\n' % i
- if url.startswith("template:"):
- fn = url[9:]
- body = body + self.readDashboard(fn)
+ body = body + self.embedDashboard(url)
body = body + '</div>\n'
body=body+"</div>\n"
body = body + '</div>\n'
body=body+"</div>\n"
@@
-80,7
+85,7
@@
class DashboardDynamicView(TemplateView):
head_template = self.head_template
tail_template = self.tail_template
head_template = self.head_template
tail_template = self.tail_template
- t = template.Template(head_template + self.read
Dashboard
(name) + self.tail_template)
+ t = template.Template(head_template + self.read
Template
(name) + self.tail_template)
response_kwargs = {}
response_kwargs.setdefault('content_type', self.content_type)
response_kwargs = {}
response_kwargs.setdefault('content_type', self.content_type)