2015-06-29 02:54:05 -05:00
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
|
|
#
|
2020-01-02 08:43:50 -06:00
|
|
|
# Copyright (C) 2013 - 2020, The pgAdmin Development Team
|
2015-06-29 02:54:05 -05:00
|
|
|
# This software is released under the PostgreSQL Licence
|
|
|
|
#
|
|
|
|
##########################################################################
|
|
|
|
|
|
|
|
"""A blueprint module implementing the pgAdmin help system."""
|
2016-06-21 08:12:14 -05:00
|
|
|
from flask import url_for
|
2018-04-04 04:47:01 -05:00
|
|
|
from flask_babelex import gettext
|
2015-06-29 02:54:05 -05:00
|
|
|
from pgadmin.utils import PgAdminModule
|
|
|
|
from pgadmin.utils.menu import MenuItem, Panel
|
2016-06-21 08:12:14 -05:00
|
|
|
from pgadmin.utils.preferences import Preferences
|
2015-06-29 02:54:05 -05:00
|
|
|
import config
|
|
|
|
|
2018-02-26 09:58:48 -06:00
|
|
|
MODULE_NAME = 'help'
|
|
|
|
|
2015-06-29 02:54:05 -05:00
|
|
|
|
|
|
|
class HelpModule(PgAdminModule):
|
|
|
|
def get_own_menuitems(self):
|
2018-02-19 05:12:35 -06:00
|
|
|
"""Return a (set) of dicts of help menu items, with name, priority,
|
|
|
|
URL, target and onclick code."""
|
2016-06-21 08:21:06 -05:00
|
|
|
return {'help_items': [
|
2015-06-29 02:54:05 -05:00
|
|
|
MenuItem(name='mnu_online_help',
|
|
|
|
label=gettext('Online Help'),
|
|
|
|
priority=100,
|
2019-02-12 10:07:38 -06:00
|
|
|
target='pgadmin_help',
|
2016-04-15 07:29:57 -05:00
|
|
|
icon='fa fa-question',
|
2015-06-29 02:54:05 -05:00
|
|
|
url=url_for('help.static', filename='index.html')),
|
|
|
|
|
|
|
|
MenuItem(name='mnu_pgadmin_website',
|
2016-06-21 08:21:06 -05:00
|
|
|
label=gettext('pgAdmin Website'),
|
|
|
|
priority=200,
|
2019-02-12 10:07:38 -06:00
|
|
|
target='pgadmin_website',
|
2016-04-15 07:29:57 -05:00
|
|
|
icon='fa fa-external-link',
|
2016-06-21 08:21:06 -05:00
|
|
|
url='https://www.pgadmin.org/'),
|
2015-06-29 02:54:05 -05:00
|
|
|
|
2016-06-21 08:21:06 -05:00
|
|
|
MenuItem(name='mnu_postgresql_website',
|
|
|
|
label=gettext('PostgreSQL Website'),
|
|
|
|
priority=300,
|
2019-02-12 10:07:38 -06:00
|
|
|
target='postgres_website',
|
2016-04-15 07:29:57 -05:00
|
|
|
icon='fa fa-external-link',
|
2017-10-10 03:16:23 -05:00
|
|
|
url='https://www.postgresql.org/')]}
|
2015-06-29 02:54:05 -05:00
|
|
|
|
2016-04-12 07:35:47 -05:00
|
|
|
def register_preferences(self):
|
|
|
|
"""
|
|
|
|
register_preferences
|
|
|
|
Register preferences for this module.
|
|
|
|
"""
|
|
|
|
# Register options for the PG and PPAS help paths
|
|
|
|
self.help_preference = Preferences('paths', gettext('Paths'))
|
|
|
|
|
|
|
|
self.pg_help_path = self.help_preference.register(
|
|
|
|
'help', 'pg_help_path',
|
|
|
|
gettext("PostgreSQL Help Path"), 'text',
|
2019-03-22 09:09:24 -05:00
|
|
|
'https://www.postgresql.org/docs/$VERSION$/',
|
2016-04-12 07:35:47 -05:00
|
|
|
category_label=gettext('Help'),
|
2016-06-21 08:21:06 -05:00
|
|
|
help_str=gettext(
|
2018-02-19 05:12:35 -06:00
|
|
|
'Path to the PostgreSQL documentation. $VERSION$ will be '
|
|
|
|
'replaced with the major.minor version number.'
|
|
|
|
)
|
2016-06-21 08:21:06 -05:00
|
|
|
)
|
2016-04-12 07:35:47 -05:00
|
|
|
|
|
|
|
self.edbas_help_path = self.help_preference.register(
|
|
|
|
'help', 'edbas_help_path',
|
|
|
|
gettext("EDB Advanced Server Help Path"), 'text',
|
2020-05-22 03:41:35 -05:00
|
|
|
'https://www.enterprisedb.com/edb-docs/d/postgresql/reference/'
|
|
|
|
'manual/$VERSION$/',
|
2016-04-12 07:35:47 -05:00
|
|
|
category_label=gettext('Help'),
|
2016-06-21 08:21:06 -05:00
|
|
|
help_str=gettext(
|
2018-02-19 05:12:35 -06:00
|
|
|
'Path to the EDB Advanced Server documentation. $VERSION$ '
|
|
|
|
'will be replaced with the major.minor version number.'
|
|
|
|
)
|
2016-06-21 08:21:06 -05:00
|
|
|
)
|
|
|
|
|
2017-06-12 01:31:22 -05:00
|
|
|
def get_exposed_url_endpoints(self):
|
|
|
|
"""
|
|
|
|
Returns the list of URLs exposed to the client.
|
|
|
|
"""
|
|
|
|
return ['help.static']
|
|
|
|
|
2015-06-29 02:54:05 -05:00
|
|
|
|
|
|
|
# Initialise the module
|
2018-02-19 05:12:35 -06:00
|
|
|
blueprint = HelpModule(
|
|
|
|
MODULE_NAME, __name__,
|
|
|
|
static_url_path='/help',
|
|
|
|
static_folder=config.HELP_PATH
|
|
|
|
)
|