def page_add_snapin() -> None: if not user.may("general.configure_sidebar"): raise MKGeneralException( _("You are not allowed to change the sidebar.")) title = _("Add sidebar element") breadcrumb = make_simple_page_breadcrumb( mega_menu_registry.menu_customize(), title) html.header(title, breadcrumb, _add_snapins_page_menu(breadcrumb)) used_snapins = _used_snapins() html.open_div(class_=["add_snapin"]) for name, snapin_class in sorted(snapin_registry.items()): if name in used_snapins: continue if not snapin_class.may_see(): continue # not allowed for this user html.open_div( class_="snapinadder", onmouseover="this.style.cursor='pointer';", onclick="window.top.cmk.sidebar.add_snapin('%s')" % name, ) html.open_div(class_=["snapin_preview"]) html.div("", class_=["clickshield"]) SidebarRenderer().render_snapin( UserSidebarSnapin.from_snapin_type_id(name)) html.close_div() html.div(snapin_class.description(), class_=["description"]) html.close_div() html.close_div() html.footer()
def page_add_snapin() -> None: if not config.user.may("general.configure_sidebar"): raise MKGeneralException( _("You are not allowed to change the sidebar.")) html.header(_("Available snapins")) html.begin_context_buttons() CustomSnapins.context_button_list() html.end_context_buttons() used_snapins = _used_snapins() html.open_div(class_=["add_snapin"]) for name, snapin_class in sorted(snapin_registry.items()): if name in used_snapins: continue if not config.user.may(snapin_class.permission_name()): continue # not allowed for this user html.open_div(class_="snapinadder", onmouseover="this.style.cursor=\'pointer\';", onclick="window.top.cmk.sidebar.add_snapin('%s')" % name) html.open_div(class_=["snapin_preview"]) html.div('', class_=["clickshield"]) SidebarRenderer().render_snapin( UserSidebarSnapin.from_snapin_type_id(name)) html.close_div() html.div(snapin_class.description(), class_=["description"]) html.close_div() html.close_div() html.footer()
def _show_builtin_snapins(self): # type: () -> None used_snapins = self._used_snapins() html.open_div(class_=["add_snapin"]) for name, snapin_class in sorted(snapin_registry.items()): if name in used_snapins: continue if not config.user.may(snapin_class.permission_name()): continue # not allowed for this user transid = html.transaction_manager.get() url = 'sidebar_add_snapin.py?name=%s&_transid=%s&pos=top' % (name, transid) html.open_div(class_="snapinadder", onmouseover="this.style.cursor=\'pointer\';", onmousedown="window.location.href=\'%s\'; return false;" % url) html.open_div(class_=["snapin_preview"]) html.div('', class_=["clickshield"]) SidebarRenderer().render_snapin(UserSidebarSnapin.from_snapin_type_id(name)) html.close_div() html.div(snapin_class.description(), class_=["description"]) html.close_div() html.close_div() html.footer()