Hitachi Vantara Pentaho Community Wiki
Child pages
  • Providing Javascript Plugins via External Resources

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

Generic Script Provider Mechanism for Modular Javascript Development

The 4.0 version of the platform ships with a new sub-system allowing plugins to “provide” new scripts and css files to areas of the platform. This is now the preferred way of implementing Javascript based plugins for content area, replacing existing undocumented systems.

Providing New Scripts

Scirpts and CSS are provided through tags in the plugin.xml file of your plugin. Below is a declaration registering a script and css file to be loaded in the User Console:

Code Block
    <file context="mantle">content/my-plugin/resources/plugins/mantle_script.js</file>
    <file context="mantle">content/my-plugin/resources/plugins/mantle_styles.css</file>

The User Console is the only non-plugin area of the platform that participates in this system. You’ll note that it’s context name is “mantle”. For plugins the name of the context should be the id of the plugin.

How to receive provided scripts

Similar to the Theme System, provided Scripts and CSS are injected automatically into web-pages by including the webcontext.js script tag in the head of the page:

Code Block
  <script language="javascript" type="text/javascript" src="webcontext.js?context=my-plugin"></script>