diff --git a/docs/en_US/Makefile.sphinx b/docs/en_US/Makefile.sphinx new file mode 100644 index 000000000..5e3f3b137 --- /dev/null +++ b/docs/en_US/Makefile.sphinx @@ -0,0 +1,130 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + -rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/pgAdminIII.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/pgAdminIII.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/pgAdminIII" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/pgAdminIII" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + make -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." diff --git a/docs/en_US/browser.rst b/docs/en_US/browser.rst new file mode 100644 index 000000000..c047371e6 --- /dev/null +++ b/docs/en_US/browser.rst @@ -0,0 +1,5 @@ +Browser +======= + +The Browser is the main window used in pgAdmin. It allows you to connect to +database servers and browse the objects on them. \ No newline at end of file diff --git a/docs/en_US/code-overview.rst b/docs/en_US/code-overview.rst new file mode 100644 index 000000000..0e91eccac --- /dev/null +++ b/docs/en_US/code-overview.rst @@ -0,0 +1,154 @@ +Code Overview +============= + +The bulk of pgAdmin is a Python web application written using the Flask framework +on the backend, and HTML5 with CSS3, Bootstrap and jQuery on the front end. A +desktop runtime is also included for users that prefer a desktop application to +a web application, which is written in C++ using the QT framework. + +Runtime +------- + +The runtime is essentially a Python webserver and browser in a box. Found in the +**/runtime** directory in the source tree, it is a relatively simple QT +application that is most easily modified using the **QT Creator** application. + +Web Application +--------------- + +The web application forms the bulk of pgAdmin and can be found in the **/web** +directory in the source tree. The main file is **pgAdmin4.py** which can be used +to run the built-in standalone web server, or as a WSGI application for production +use. + +Configuration +************* + +The core application configuration is found in **config.py**. This file includes +all configurable settings for the application, along with descriptions of their +use. It is essential that various settings are configured prior to deployent on +a web server; these can be overriden in **config_local.py** to avoid modifying +the main configuration file. + +User Settings +************* + +When running in desktop mode, pgAdmin has a single, default user account that is +used for the desktop user. When running in server mode, there may be unlimited +users who are required to login prior to using the application. pgAdmin utilised +the **Flask-Security** module to manage application security and users, and +provides options for self-service password reset and password changes etc. + +Whether in desktop or server mode, each user's settings are stored in a SQLite +database which is also used to store the user accounts. This is initially +created using the **setup.py** script which will create the database file and +schema within it, and add the first user account (with administrative +privileges) and a default server group for them. A **settings** table is also +used to store user configuration settings in a key-value fashion. Although not +required, setting keys (or names) are typically formatted using forward slashes +to artificially namespace values, much like the pgAdmin 3 settings files on Linux +or Mac. + +Note that the local configuration must be setup prior to **setup.py** being run. +The local configuration will determine how the script sets up the database, +particularly with regard to desktop vs. server mode. + +pgAdmin Core +************ + +The heart of pgAdmin is the **pgadmin** package. This contains the globally +available HTML templates used by the Jinja engine, as well as any global static +files such as images, Javascript and CSS files that are used in multiple modules. + +The work of the package is handled in it's constructor, **__init__.py**. This +is responsible for setting up logging and authentication, dynamically loading +other modules, and a few other tasks. + +Modules +******* + +Units of functionality are added to pgAdmin through the addition of modules. Theses +are Python packages that implement Flask Blueprints, and provide various hook +points for other modules to utilise (primarily the default module - the browser). + +To be recognised as a module, a Python package must be created. This must: + +1) Be placed within the **web/pgadmin/** directory, and +2) Contain a Python module called **views**, and +3) Contain within the views module, a **blueprint** variable representing the + Flask Blueprint + +Each module may define a **template** and **static** directory for the Blueprint +that it implements. To avoid name collisions, templates should be stored under +a directory within the specified template directory, named after the module itself. +For example, the **browser** module stores it's templates in +**web/pgadmin/browser/templates/browser/**. This does not apply to static files +which may omit the second module name. + +In addition to defining the Blueprint, the **views** module is typically +responsible for defining all the views that will be rendered in response to +client requests. These must include appropriate route and security decorators. + +Most pgAdmin modules will also implement a **hooks** Python module. This is +responsible for providing hook points to integrate the module into the rest of +the application - for example, a hook might tell the caller what CSS files need +to be included on the rendered page, or what menu options to include and what +they should do. Hook points need not exist if they are not required. It is the +responsiblity of the caller to ensure they are present before attempting to +utilise them. + +Hooks currently implemented are: + +.. code-block:: python + + def register_submodules(app): + """Register any child module or node blueprints""" + + def get_file_menu_items(): + def get_edit_menu_items(): + def get_tools_menu_items(): + def get_management_menu_items(): + def get_help_menu_items(): + """Return a (set) of dicts of menu items, with name, priority, URL, target and onclick code.""" + + def get_scripts(): + """Return a list of script URLs to include in the rendered page header""" + + def get_stylesheets(): + """Return a list of stylesheet URLs to include in the rendered page header""" + +pgAdmin Modules may include any additional Python modules that are required to +fulfill their purpose, as required. They may also reference other dynamically +loaded modules, but must use the defined hook points and fail gracefully in the +event that a particular module is not present. + +Nodes +===== + +Nodes are very similar to modules, but implement individual nodes on the browser +treeview. To be recognised as a module, a Python package must be created. This +must: + +1) Be placed within the **web/pgadmin/browser/** directory, and +2) Contain a Python module called **views**, and +3) Contain within the views module, a **blueprint** variable representing the + Flask Blueprint + +The hook points currently defined for nodes are: + +.. code-block:: python + + def register_submodules(app): + """Register any child node blueprints""" + + def get_file_menu_items(): + """Return a (set) of dicts of menu items, with name, priority, URL, target and onclick code.""" + + def get_context_menu_items(): + """Return a (set) of dicts of content menu items with name, label, priority and JS""" + + def get_script_snippets(): + """Return the script snippets needed to handle treeview node operations.""" + + def get_css_snippets(): + """Return the CSS needed to display the treeview node image.""" \ No newline at end of file diff --git a/docs/en_US/coding-standards.rst b/docs/en_US/coding-standards.rst new file mode 100644 index 000000000..021184fec --- /dev/null +++ b/docs/en_US/coding-standards.rst @@ -0,0 +1,187 @@ +Coding Standards +================ + +pgAdmin uses multiple technologies and multiple languages, each of which have +their own coding standards. + +General +------- + +In all languages, indentations should be made with 4 spaces, and excessively long +lines wrapped where appropriate to ensure they can be read on smaller displays +(80 characters is used in many places, but this is not a required maximum size +as it's quite wasteful on modern displays). Typically lines should not be longer +than 120 characters. + +Comments should be included in all code where required to explain its +purpose or how it works if not obvious from a quick review of the code itself. + +CSS 3 +----- + +CSS3 is used for styling and layout throughout the application. Extensive use is +made of the Bootstrap Framework to aid in that process, however additional +styles must still be created from time to time. + +Most custom styling comes from individual modules which may advertise static +stylesheets to be included in the module that is loading them via hooks. + +Styling overrides (for example, to alter the Bootstrap look and feel) will +typically be found in the **overrides.css** file in the main static file +directory for the application. + +Styling should never be applied inline in HTML, always through an external +stylesheet, which should contain comments as appropriate to explain the usage +or purpose for the style. + +Styles should be specified clearly, one per line. For example: + +.. code-block:: css + + /* iFrames should have no border */ + iframe { + border-width: 0; + } + + /* Ensure the codemirror editor displays full height gutters when resized */ + .CodeMirror, .CodeMirror-gutters { + height: 100% !important; + } + +All stylesheets must be CSS3 compliant. + +HTML 5 +------ + +HTML 5 is used for page structure throughout the application, in most cases +being rendered from templates by the Jinja2 template engine in Flask. + +All HTML must be HTML 5 compliant. + +Javascript +---------- + +Client-side code is written in Javascript using jQuery and various plugins. +Whilst much of the code is rendered from static files, there is also code that +is rendered from templates using Jinja2 (often to inject the users settings) or +constructed on the fly from module hooks. + +A typical Javascript function might be formatted like this (this snipped is from +a template): + +.. code-block:: javascript + + // Delete a server group + function delete_server_group(item) { + alertify.confirm( + 'Delete server group?', + 'Are you sure you wish to delete the server group "{0}"?'.replace('{0}', tree.getLabel(item)), + function() { + var id = tree.getId(item) + $.post("{{ url_for('NODE-server-group.delete') }}", { id: id }) + .done(function(data) { + if (data.success == 0) { + report_error(data.errormsg, data.info); + } else { + var next = tree.next(item); + var prev = tree.prev(item); + tree.remove(item); + if (next.length) { + tree.select(next); + } else if (prev.length) { + tree.select(prev); + } + } + } + ) + }, + null + ) + } + +Note the use of a descriptive function name, using the underscore character to +separate words in all lower case, and short but descriptive lower case variable +names. + +C++ +--- + +C++ code is used in the desktop runtime for the application, primarily with the +QT framework and an embedded Python interpreter. Note the use of hanging braces, +which may be omitted if on a single statement is present: + +.. code-block:: c++ + + // Ping the application server to see if it's alive + bool PingServer(QUrl url) + { + QNetworkAccessManager manager; + QEventLoop loop; + QNetworkReply *reply; + QVariant redirectUrl; + + url.setPath("/utils/ping"); + + do + { + reply = manager.get(QNetworkRequest(url)); + + QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit())); + loop.exec(); + + redirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); + url = redirectUrl.toUrl(); + + if (!redirectUrl.isNull()) + delete reply; + + } while (!redirectUrl.isNull()); + + if (reply->error() != QNetworkReply::NoError) + return false; + + QString response = reply->readAll(); + + if (response != "PING") + { + qDebug() << "Failed to connect, server response: " << response; + return false; + } + + return true; + } + +Python +------ + +Python is used for the backend web server. All code must be compatible with +Python 2.7 and should include PyDoc comments whilst following the official +Python coding standards. An example function along with the file header is +shown below:: + + ########################################################################## + # + # pgAdmin 4 - PostgreSQL Tools + # + # Copyright (C) 2013 - 2015, The pgAdmin Development Team + # This software is released under the PostgreSQL Licence + # + ########################################################################## + + """Integration hooks for server groups.""" + + from flask import render_template, url_for + from flask.ext.security import current_user + + from pgadmin.settings.settings_model import db, ServerGroup + + def get_nodes(): + """Return a JSON document listing the server groups for the user""" + groups = ServerGroup.query.filter_by(user_id=current_user.id) + + value = '' + for group in groups: + value += '{"id":%d,"label":"%s","icon":"icon-server-group","inode":true},' % (group.id, group.name) + value = value[:-1] + + return value \ No newline at end of file diff --git a/docs/en_US/conf.py b/docs/en_US/conf.py new file mode 100644 index 000000000..0eb95e392 --- /dev/null +++ b/docs/en_US/conf.py @@ -0,0 +1,219 @@ +# -*- coding: utf-8 -*- +# +# pgAdmin III documentation build configuration file, created by +# sphinx-quickstart on Sat Jul 9 15:58:11 2011. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys, os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ----------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = [] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'pgAdmin 4' +copyright = u'2013 - 2015, The pgAdmin Development Team' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '1.0' +# The full version, including alpha/beta/rc tags. +release = '1.0.0-dev' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['images'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} +html_sidebars = { + '**': ['localtoc.html', 'globaltoc.html', 'searchbox.html'] +} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'pgadmin4' + + +# -- Options for LaTeX output -------------------------------------------------- + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + ('index', 'pgadmin4.tex', u'pgAdmin 4 Documentation', + u'The pgAdmin Development Team', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output -------------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'pgadmin4', u'pgAdmin 4 Documentation', + [u'The pgAdmin Development Team'], 1) +] diff --git a/docs/en_US/debugger.rst b/docs/en_US/debugger.rst new file mode 100644 index 000000000..68e1917f0 --- /dev/null +++ b/docs/en_US/debugger.rst @@ -0,0 +1,4 @@ +Debugger +======== + +The Debugger allows you to debug PL/PGSQL functions interactively. \ No newline at end of file diff --git a/docs/en_US/images/logo-128.png b/docs/en_US/images/logo-128.png new file mode 100644 index 000000000..af43ced3a Binary files /dev/null and b/docs/en_US/images/logo-128.png differ diff --git a/docs/en_US/images/logo-right-128.png b/docs/en_US/images/logo-right-128.png new file mode 100644 index 000000000..830523509 Binary files /dev/null and b/docs/en_US/images/logo-right-128.png differ diff --git a/docs/en_US/index.rst b/docs/en_US/index.rst new file mode 100644 index 000000000..9bc65fc3a --- /dev/null +++ b/docs/en_US/index.rst @@ -0,0 +1,96 @@ +pgAdmin 4 +========= + +.. image:: images/logo-right-128.png + :align: right + :alt: pgAdmin Logo + +Welcome to pgAdmin 4. pgAdmin is the leading Open Source management tool for +PostgreSQL, the world's most advanced Open Source database. + +pgAdmin 4 is built on the experiences learnt over two decades of developing it's +predecessors, pgAdmin, pgAdmin II and pgAdmin III. Its designed to meet the +needs of both novice and experienced PostgreSQL users alike. + +******** +Features +******** + +pgAdmin is designed to allow users to manage and develop multiple Postgres +databases at once. It may be run either as a web application in which case it +supports multiple users, each with their own settings, or as a desktop +application for individual users. + +The main application environment centres around a tree control on the left hand +side. Users register one or more Postgres servers in the application which are +displayed in groups on the treeview. Through opening a server, the user is +connected to the selected database server and the tree is populated with high +level objects, under the server node, including databases, roles and +tablespaces. The user is then able to open a database node to see the schemas +within that database, and a schema node to see the tables and other objects in +that schema and so on. + +Selecting a node in the tree will cause its Properties to be displayed in the +tab set to the right of the display. Additional tabs may be selected to view +statistics about the selected object, or lists of objects on which the selected +object is dependent on, or that are dependent upon the selected object. A +dashboard tab is also present which may be used to view high-level information +about the server that the selected object is on, such as the current sessions +and lock information. + +Right-clicking a node on the tree will display a context sensistive menu giving +options for different operations that may be executed on the object the node +represents. + +A third panel is show below the tabset. For any object within the database, +this will display the SQL that may be used to create or drop the object. + +Other features include a tool for developing executing arbitrary SQL queries and +visually editing the results (where possible), and debugger for pl/pgsql +function development, and various tools for performing routine and bulk database +maintenance activities. + +Please see the appropriate documentation sections for details on the usage of +individual features. + +.. toctree:: + :maxdepth: 2 + + browser + debugger + query-tool + +*********** +Development +*********** + +pgAdmin is an Open Source project and accepts code contributions from anyone, +provided they implement desirable features and are written to the required +standard. Please read the development sections of the documentation carefully to +learn how pgAdmin works, and how to develop improvements and new features. + +.. toctree:: + :maxdepth: 2 + + coding-standards + code-overview + submitting-patches + +******* +Website +******* + +The pgAdmin website can be found at `here `_, and +downloads are hosted on the +`PostgreSQL Website `_. + +******* +Licence +******* + +pgAdmin is released under the +`PostgreSQL Licence `_, which is a +liberal Open Source licence similar to BSD or MIT, and approved by the Open +Source Initiative. The copyright for the project source code, website and +documentation is attributed to the +`pgAdmin Development Team `_. \ No newline at end of file diff --git a/docs/en_US/query-tool.rst b/docs/en_US/query-tool.rst new file mode 100644 index 000000000..f2619c83a --- /dev/null +++ b/docs/en_US/query-tool.rst @@ -0,0 +1,5 @@ +Query Tool +========== + +The Query Tool allows you to compose and execute arbitrary SQL statements and +view the results. \ No newline at end of file diff --git a/docs/en_US/submitting-patches.rst b/docs/en_US/submitting-patches.rst new file mode 100644 index 000000000..7e6bbb610 --- /dev/null +++ b/docs/en_US/submitting-patches.rst @@ -0,0 +1,31 @@ +Submitting Patches +================== + +Before developing a patch for pgAdmin you should always contact the developers +on the `mailing list ` to discuss your +plans. This ensures that others know if you're fixing a bug and can then avoid +duplicating your work, and in the case of large patches, gives the community +the chance to discuss and refine your ideas before investing too much time +writing code that may later be rejected. + +You should always develop patches against a checkout of the source code from the +GIT source code repository, and not a release tarball. This ensures that you're +working with the latest code on the branch and makes it easier to generate +patches correctly. You can checkout the source code with a command like:: + + $ git clone git://git.postgresql.org/git/pgadmin4.git + +Once you've made the changes you wish to make, commit them to a private +development branch in your local repository. Then create a patch containing the +changes in your development branch against the upstream branch on which your +work is based. For example, if your current branch contains your changes, you +might run:: + + $ git diff origin/master > my_cool_feature.diff + +to create a patch between your development branch and the public master branch. + +Once you have your patch, mail it to the +`mailing list `. Please ensure you +include a full description of what the patch does, as well as the rationale for +any important design decisions. \ No newline at end of file diff --git a/web/config.py b/web/config.py index 5dcfc80c9..445f49c09 100644 --- a/web/config.py +++ b/web/config.py @@ -31,6 +31,9 @@ APP_SUFFIX = 'dev' # Copyright string for display in the app APP_COPYRIGHT = 'Copyright 2014 - 2015, The pgAdmin Development Team' +# Path to the online help. +HELP_PATH = '../../../docs/en_US/_build/html/' + # DO NOT CHANGE! # The application version string, constructed from the components APP_VERSION = '%s.%s.%s-%s' % (APP_MAJOR, APP_MINOR, APP_REVISION, APP_SUFFIX) diff --git a/web/pgadmin/about/hooks.py b/web/pgadmin/about/hooks.py index 7d7048aaf..8cf728c32 100644 --- a/web/pgadmin/about/hooks.py +++ b/web/pgadmin/about/hooks.py @@ -2,7 +2,7 @@ # # pgAdmin 4 - PostgreSQL Tools # -# Copyright (C) 2013 - 2014, The pgAdmin Development Team +# Copyright (C) 2013 - 2015, The pgAdmin Development Team # This software is released under the PostgreSQL Licence # ########################################################################## @@ -14,8 +14,8 @@ from flask import render_template, url_for import config def get_help_menu_items(): - """Return a (set) of dicts of help menu items, with name, priority, URL and - onclick code.""" + """Return a (set) of dicts of help menu items, with name, priority, URL, + target and onclick code.""" return [{'name': 'mnu_about', 'label': 'About %s' % (config.APP_NAME), 'priority': 999, diff --git a/web/pgadmin/browser/nodes/CollectionNode.py b/web/pgadmin/browser/nodes/CollectionNode.py new file mode 100644 index 000000000..ae0cc7c9c --- /dev/null +++ b/web/pgadmin/browser/nodes/CollectionNode.py @@ -0,0 +1,14 @@ +########################################################################## +# +# pgAdmin 4 - PostgreSQL Tools +# +# Copyright (C) 2013 - 2015, The pgAdmin Development Team +# This software is released under the PostgreSQL Licence +# +########################################################################## + +"""Base class for Collection Nodes on the browser treeview""" + +def get_name(): + """Returns the display name of the collection""" + return "" \ No newline at end of file diff --git a/web/pgadmin/browser/nodes/ObjectNode.py b/web/pgadmin/browser/nodes/ObjectNode.py new file mode 100644 index 000000000..0212fee7b --- /dev/null +++ b/web/pgadmin/browser/nodes/ObjectNode.py @@ -0,0 +1,15 @@ +########################################################################## +# +# pgAdmin 4 - PostgreSQL Tools +# +# Copyright (C) 2013 - 2015, The pgAdmin Development Team +# This software is released under the PostgreSQL Licence +# +########################################################################## + +"""Base class for Object Nodes on the browser treeview""" + +def get_name(): + """Returns the object's name""" + return "" + diff --git a/web/pgadmin/browser/nodes/server_groups/hooks.py b/web/pgadmin/browser/nodes/server_groups/hooks.py index e427a1b6d..a1095c46e 100644 --- a/web/pgadmin/browser/nodes/server_groups/hooks.py +++ b/web/pgadmin/browser/nodes/server_groups/hooks.py @@ -27,7 +27,8 @@ def get_nodes(): def get_file_menu_items(): - """Return a (set) of dicts of file menu items, with name, label, priority and URL.""" + """Return a (set) of dicts of file menu items, with name, priority, URL, + target and onclick code.""" return [ {'name': 'mnu_add_server_group', 'label': 'Add a server group...', 'priority': 10, 'url': '#', 'onclick': 'add_server_group()'}, {'name': 'mnu_delete_server_group', 'label': 'Delete server group', 'priority': 20, 'url': '#', 'onclick': 'delete_server_group()'}, diff --git a/web/pgadmin/browser/templates/browser/index.html b/web/pgadmin/browser/templates/browser/index.html index 3a638484f..b93a736f8 100644 --- a/web/pgadmin/browser/templates/browser/index.html +++ b/web/pgadmin/browser/templates/browser/index.html @@ -20,35 +20,35 @@ {% if file_items is defined and file_items|count > 0 %}{% endif %} {% if edit_items is defined and edit_items|count > 0 %}{% endif %} {% if tools_items is defined and tools_items|count > 0 %}{% endif %} {% if management_items is defined and management_items|count > 0 %}{% endif %} {% if help_items is defined and help_items|count > 0 %}{% endif %} diff --git a/web/pgadmin/help/__init__.py b/web/pgadmin/help/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/web/pgadmin/help/hooks.py b/web/pgadmin/help/hooks.py new file mode 100644 index 000000000..3d73561d3 --- /dev/null +++ b/web/pgadmin/help/hooks.py @@ -0,0 +1,23 @@ +########################################################################## +# +# pgAdmin 4 - PostgreSQL Tools +# +# Copyright (C) 2013 - 2015, The pgAdmin Development Team +# This software is released under the PostgreSQL Licence +# +########################################################################## + +"""Browser integration functions for the Help module.""" + +from flask import url_for + +import config + +def get_help_menu_items(): + """Return a (set) of dicts of help menu items, with name, priority, URL, + target and onclick code.""" + return [{'name': 'mnu_contents', + 'label': 'Contents', + 'priority': 1, + 'target': '_new', + 'url': url_for('help.static', filename='index.html') }] \ No newline at end of file diff --git a/web/pgadmin/help/views.py b/web/pgadmin/help/views.py new file mode 100644 index 000000000..9d658bc1e --- /dev/null +++ b/web/pgadmin/help/views.py @@ -0,0 +1,22 @@ +########################################################################## +# +# pgAdmin 4 - PostgreSQL Tools +# +# Copyright (C) 2013 - 2015, The pgAdmin Development Team +# This software is released under the PostgreSQL Licence +# +########################################################################## + +"""A blueprint module implementing the pgAdmin help system.""" +MODULE_NAME = 'help' + +from flask import Blueprint +from flaskext.gravatar import Gravatar +from flask.ext.security import login_required +from flask.ext.login import current_user +from inspect import getmoduleinfo, getmembers + +import config + +# Initialise the module +blueprint = Blueprint(MODULE_NAME, __name__, static_url_path='/help', static_folder=config.HELP_PATH) diff --git a/web/pgadmin/test/hooks.py b/web/pgadmin/test/hooks.py index d7d8e0013..12a501858 100644 --- a/web/pgadmin/test/hooks.py +++ b/web/pgadmin/test/hooks.py @@ -12,7 +12,8 @@ from flask import render_template, url_for def get_file_menu_items(): - """Return a (set) of dicts of file menu items, with name, label, priority and URL.""" + """Return a (set) of dicts of file menu items, with name, priority, URL, + target and onclick code.""" return [ {'name': 'mnu_generate_test_html', 'label': 'Generated Test HTML', 'priority': 100, 'url': url_for('test.generated')}, {'name': 'mnu_test_alert', 'label': 'Test Alert', 'priority': 200, 'url': '#', 'onclick': 'test_alert()'},