Plugin Dbui API Guide Release 1.0.1

Plugin Dbui API Guide Release 1.0.1

plugin_dbui API Guide Release 1.0.1 R. Le Gac Dec 09, 2019 CONTENTS 1 Constants 1 2 Database model 3 2.1 Initialisation...............................................3 2.2 Callbacks.................................................6 2.3 Filters...................................................6 3 User interface 9 3.1 Field...................................................9 3.2 Form................................................... 10 3.3 Grid.................................................... 13 3.4 Node................................................... 16 3.5 Store................................................... 18 3.6 Viewport................................................. 19 3.7 Convert database fields to widgets.................................... 20 3.8 Ext JS widget mappings......................................... 24 4 Controller 43 4.1 Selector.................................................. 43 4.2 Helper functions............................................. 45 5 Services, exception and base classes 53 5.1 Services.................................................. 53 5.2 Exceptions................................................ 58 5.3 Base classes............................................... 58 6 Indices and tables 63 i ii CHAPTER ONE CONSTANTS CALLBACK_ERRORS str _callback_errors DBUI str Dbui INLINE_ALERT str <script>Ext.Msg.alert('%s', '%s');</script> UNDEF str undefined UNDEF_ID int 1 UNKNOWN str ??? 1 plugin_dbui API Guide, Release 1.0.1 2 Chapter 1. Constants CHAPTER TWO DATABASE MODEL 2.1 Initialisation Dbui Set of tools to initialise the plugin Dbui. 2.1.1 plugin_dbui.Dbui class plugin_dbui.Dbui Bases: object Set of tools to initialise the plugin Dbui. Methods define_paths(**kwargs) define paths for the plugin dbui. initialise_ui() Initialise persistent storage for the plugin dbui. start_directSvc() Start services to interact with the database from the User Interface using the Ext JS Direct protocol. plugin_dbui.Dbui.define_paths static Dbui.define_paths(**kwargs) define paths for the plugin dbui. Paths are relative to the main directory of the application. They can target a file (static/myapp.css) or a directory (static/css). Note: The configuration of the plugin is persistent across the application. It can be accessed at any time using the syntax: from gluon.tools import PluginManager PluginManager("dbui").dbui Parameters • app_about (str) – relative path to the ABOUT file, e.g. static/ABOUT.html. 3 plugin_dbui API Guide, Release 1.0.1 • app_css (str or list) – relative path to CSS files for the application, e.g. static/myapp/ressources/css. Default is None • app_changelog (str) – relative path to the CHANGELOG, e.g. static/ CHANGELOG. • app_db_schema (str) – relative path to the database schema, e.g. static/docs/ database.png. • app_debug (str or list) – relative path to the debug version for the application library, e.g. static/myapp/src or static/myapp/myapp-debug.js. Default is None • app_git (str) – the URL of the git repository for the application, e.g. https:// gitlab.in2p3.fr/w2pext/plugin_dbui.git Default is None. • app_lg (str or list) – relative path to languages files for the application, e.g. static/myapp/locale/myapp-lang-fr.js. Default is None. • app_html_api (str) – relative path to the documentation for the python api, e.g. static/docs/api/index.html. The format is HTML. • app_html_jsduck (str) – relative path to the documentation for the javascript api, e.g. static/docs/jsduck/index.html. The format is HTML. • app_html_reference (str) – relative path to the documentation for developers, e.g. static/docs/reference/index.html. The format is HTML. • app_html_user (str) – relative path to the documentation for users, e.g. static/ docs/user/index.html. The format is HTML. • app_libmin (str or list) – relative path to the minified version for the application library, e.g. static/myapp-min.js. • app_license (str) – relative path to the license for the application. • app_pdf_api (str) – relative path to the documentation for the python api, e.g. static/docs/pdf/myapp_api.pdf. The format is PDF. • app_pdf_reference (str) – relative path to the documentation for developers, e.g. static/docs/pdf/myapp_reference.pdf. The format is PDF. • app_pdf_user (str) – relative path to the documentation for user, e.g. static/ docs/pdf/myapp_user.pdf. The format is PDF. • app_script (str) – relative path to the main script to run the application, e.g. static/myapp.js. • app_script_dir (str) – relative path to a directory containing a collection of JavaScript, e.g static/scripts. The script named foo can be run via the URL: https://myverver/myapp?script=foo. The default is None. • dbui_conf (str) – the ULR returning the configuration for the User Interface. The default is /myapp/plugin_dbui/dbui_conf, • dbui_conf_debug (str) – the URL returning the debug version of the configuration for the User Interface. The default is /myapp/plugin_dbui/dbui_conf?debug. • dbui_html_api (str) – relative path to the documentation for the python api. e.g. static/plugin_dbui/docs/api/index.html. The format is HTML. • dbui_html_jsduck (str) – relative path to the documentation for the javascript api, e.g. static/plugin_dbui/docs/jsduck/index.html. The format is HTML. 4 Chapter 2. Database model plugin_dbui API Guide, Release 1.0.1 • dbui_html_reference (str) – relative path to the documentation for develop- ers, e.g. static/plugin_dbui/docs/reference/index.html. The format is HTML. • dbui_license (str) – relative path to the license for the plugin dbui, e.g static/ plugin_dbui/LICENCE_UK.html. • dbui_pdf_api (str) – relative path to the documentation for the python api, e.g. static/plugin_dbui/docs/pdf/dbui_api.pdf. The format is PDF. • dbui_pdf_reference (str) – relative path to the documentation for developers, e.g. static/plugin_dbui/docs/pdf/dbui_reference.pdf. The format is PDF. • dbui_script (str) – default script to run the application: static/ plugin_dbui/main.js. It is used when the option app_script is not defined. • plugins_paths (dict) – contains paths defining javascript libraries for plugins. The key is the name of the plugin while the value is a dictionary with 4 keys (str or list or None): css relative path to CSS files: static/plugin_key/resources/css de- relative path to the debug version: static/plugin_key/dbui-debug. bug js lg relative path to languages files: static/plugin_key/locale/ key-lang-fr.js lib- relative path to minified version: static/plugin_key/locale/ min key-lang-fr.js By default, plugins ace, dbui, extjs and mathjax are configure. Note: It is possible to register others plugins by adding them to the plugins_paths dictio- nary. There libraries will be laod properly by the controller plugin_dbui/index. plugin_dbui.Dbui.initialise_ui static Dbui.initialise_ui() Initialise persistent storage for the plugin dbui. Note: The configuration of the plugin is persistent across the application. It can be accessed at any time using the syntax: from gluon.tools import PluginManager PluginManager("dbui").dbui modifier_fields Type dict plugin_dbui.modifier_forms Type dict plugin_dbui.modifier_grids Type dict plugin_dbui.modifier_stores 2.1. Initialisation 5 plugin_dbui API Guide, Release 1.0.1 Type dict plugin_dbui.modifier_viewports Type gluon.storage.Storage plugin_dbui.static_stores Type dict plugin_dbui.Dbui.start_directSvc static Dbui.start_directSvc() Start services to interact with the database from the User Interface using the Ext JS Direct protocol. Returns Return type directSvc 2.2 Callbacks INHIBIT_DELETE_UNDEF(setrows) Inhibit the delete of the record containing the undefined value. INHIBIT_UPDATE_UNDEF(setrows, values) Inhibit the update the row containing the undefined value. 2.2.1 plugin_dbui.callback.INHIBIT_DELETE_UNDEF plugin_dbui.callback.INHIBIT_DELETE_UNDEF(setrows) Inhibit the delete of the record containing the undefined value. Parameters setrows (gluon.dal.Set) – set of records used for deleted Returns true when the record contains the undefined value. 2.2.2 plugin_dbui.callback.INHIBIT_UPDATE_UNDEF plugin_dbui.callback.INHIBIT_UPDATE_UNDEF(setrows, values) Inhibit the update the row containing the undefined value. Parameters • setrows (gluon.dal.Set) – set of records for update • values (dict) – dictionary of database field used in the update. Returns true when the record contains the undefined value. 2.3 Filters CLEAN_COMMA(value) Remove trailing comma(s). CLEAN_SPACES(value) Remove leading as well as trailing spaces and keep a single space between words. 6 Chapter 2. Database model plugin_dbui API Guide, Release 1.0.1 2.3.1 plugin_dbui.filters.CLEAN_COMMA plugin_dbui.filters.CLEAN_COMMA(value) Remove trailing comma(s). Search patterns are: “,” or “, ” or ” „ ” . Parameters value (object)– Returns the return the value is unchanged when it is not a string. Return type object 2.3.2 plugin_dbui.filters.CLEAN_SPACES plugin_dbui.filters.CLEAN_SPACES(value) Remove leading as well as trailing spaces and keep a single space between words. Parameters value (object)– Returns the return the value is unchanged when it is not a string. Return type object 2.3. Filters 7 plugin_dbui API Guide, Release 1.0.1 8 Chapter 2. Database model CHAPTER THREE USER INTERFACE 3.1 Field FieldsModifier(tablename) Customise the widgets associated to the fields of the database table tablename. 3.1.1 plugin_dbui.fieldsmodifier.FieldsModifier class plugin_dbui.fieldsmodifier.FieldsModifier(tablename) Bases: plugin_dbui.modifier.Modifier Customise the widgets associated to the fields of the database table tablename. Parameters tablename

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    67 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us