def dashlet_snapin(nr, dashlet): import sidebar # FIXME: HACK, clean this up somehow snapin = sidebar.sidebar_snapins.get(dashlet['snapin']) if not snapin: raise MKUserError(None, _('The configured snapin does not exist.')) dashlet_type = dashlet_types[dashlet['type']] overflow = '' scroll_x, scroll_y = dashlet_type.get("iframe_scroll", (False, False)) if not scroll_x: overflow += 'overflow-x: hidden;\n' else: overflow += 'overflow-x: auto;\n' if not scroll_y: overflow += 'overflow-y: hidden;\n' else: overflow += 'overflow-y: auto;\n' html.set_browser_reload(dashlet_type['refresh']) html.html_head(_('Snapin Dashlet'), javascripts=['sidebar'], stylesheets=['sidebar', 'status']) html.write('''<style> #side_content { height: auto; top: 0; padding-top: 4px; padding-left: 4px; } div.snapin:last-child { margin-bottom: 0; } div.snapin div.content { background-image: none; background-color: #508AA1; } div.snapin { margin: 0; padding: 0; } body.side { %s } </style>''' % overflow) html.write('<body class="side">\n') html.write('<div id="check_mk_sidebar">\n') html.write('<div id="side_content">\n') html.write("<div id=\"snapin_container_%s\" class=snapin>\n" % dashlet['snapin']) html.write("<div id=\"snapin_%s\" class=\"content\">\n" % (dashlet['snapin'])) sidebar.render_snapin_styles(snapin) snapin['render']() html.write('</div>\n') html.write('</div>\n') html.write('</div>\n') html.write('</div>\n') html.body_end()
def dashlet_snapin(nr, dashlet): import sidebar # FIXME: HACK, clean this up somehow snapin = sidebar.sidebar_snapins.get(dashlet["snapin"]) if not snapin: raise MKUserError(None, _("The configured snapin does not exist.")) dashlet_type = dashlet_types[dashlet["type"]] overflow = "" scroll_x, scroll_y = dashlet_type.get("iframe_scroll", (False, False)) if not scroll_x: overflow += "overflow-x: hidden;\n" else: overflow += "overflow-x: auto;\n" if not scroll_y: overflow += "overflow-y: hidden;\n" else: overflow += "overflow-y: auto;\n" html.set_browser_reload(dashlet_type["refresh"]) html.html_head(_("Snapin Dashlet"), javascripts=["sidebar"], stylesheets=["sidebar", "status"]) html.write( """<style> #side_content { height: auto; top: 0; padding-top: 4px; padding-left: 4px; } div.snapin:last-child { margin-bottom: 0; } div.snapin div.content { background-image: none; background-color: #508AA1; } div.snapin { margin: 0; padding: 0; } body.side { %s } </style>""" % overflow ) html.write('<body class="side">\n') html.write('<div id="check_mk_sidebar">\n') html.write('<div id="side_content">\n') html.write('<div id="snapin_container_%s" class=snapin>\n' % dashlet["snapin"]) html.write('<div id="snapin_%s" class="content">\n' % (dashlet["snapin"])) sidebar.render_snapin_styles(snapin) snapin["render"]() html.write("</div>\n") html.write("</div>\n") html.write("</div>\n") html.write("</div>\n") html.body_end()