def test_get_panel_id(self): self.assertEqual( get_panel_id("Users Panel"), "hud_users_panel" ) self.assertEqual( get_panel_id("Users_Panel"), "hud_users_panel" )
def unregister_hud_panel(name): """Unregister HUD panel by the same name used for registering.""" config_tool = api.portal.get_tool(name='portal_controlpanel') if not config_tool: return None configlet_id = get_panel_id(name) config_tool.unregisterConfiglet(configlet_id) return configlet_id
def register_hud_panel(name): """Register HUD panel by name.""" config_tool = api.portal.get_tool(name='portal_controlpanel') if not config_tool: return None configlet_id = get_panel_id(name) configlet_label = get_panel_label(name) configlet = { 'id': configlet_id, 'name': configlet_label, 'action': 'string:${{portal_url}}/{0}'.format(configlet_id), 'condition': '', 'category': CONFIGLET_CATEGORY, 'visible': 1, 'appId': PROJECT_NAME, 'permission': 'ManagePortal', 'imageUrl': '' } config_tool.registerConfiglet(**configlet) return configlet_id