codekingpro/portable-devtools
114k
1##########################################################################2#3# pgAdmin 4 - PostgreSQL Tools4#5# Copyright (C) 2013 - 2024, The pgAdmin Development Team6# This software is released under the PostgreSQL Licence7#8##########################################################################9 10"""A blueprint module implementing the pgAdmin help system."""11from flask import url_for12from flask_babel import gettext13from pgadmin.utils import PgAdminModule14from pgadmin.utils.menu import MenuItem, Panel15from pgadmin.utils.preferences import Preferences16import config17 18MODULE_NAME = 'help'19 20 21class HelpModule(PgAdminModule):22 def get_own_menuitems(self):23 """Return a (set) of dicts of help menu items, with name, priority,24 URL, target and onclick code."""25 return {'help_items': [26 MenuItem(name='mnu_quick_search_help',27 label=gettext('Quick Search'),28 priority=99,29 target='pgadmin_quick_search_help',30 icon='fa fa-question',31 url='#'),32 MenuItem(name='mnu_online_help',33 label=gettext('Online Help'),34 priority=100,35 target='pgadmin_help',36 icon='fa fa-question',37 url=url_for('help.static', filename='index.html')),38 39 MenuItem(name='mnu_pgadmin_website',40 label=gettext('pgAdmin Website'),41 priority=200,42 target='pgadmin_website',43 icon='fa fa-external-link-alt',44 url='https://www.pgadmin.org/'),45 46 MenuItem(name='mnu_postgresql_website',47 label=gettext('PostgreSQL Website'),48 priority=300,49 target='postgres_website',50 icon='fa fa-external-link-alt',51 url='https://www.postgresql.org/')]}52 53 def register_preferences(self):54 """55 register_preferences56 Register preferences for this module.57 """58 # Register options for the PG and PPAS help paths59 self.help_preference = Preferences('paths', gettext('Paths'))60 61 self.pg_help_path = self.help_preference.register(62 'help', 'pg_help_path',63 gettext("PostgreSQL Help Path"), 'text',64 'https://www.postgresql.org/docs/$VERSION$/',65 category_label=gettext('Help'),66 help_str=gettext(67 'Path to the PostgreSQL documentation. $VERSION$ will be '68 'replaced with the major.minor version number.'69 )70 )71 72 def get_exposed_url_endpoints(self):73 """74 Returns the list of URLs exposed to the client.75 """76 return ['help.static']77 78 79# Initialise the module80blueprint = HelpModule(81 MODULE_NAME, __name__,82 static_url_path='/help',83 static_folder=config.HELP_PATH84)85 