Sednterp User Modules
Sednterp Web and Desktop can load user created modules, written in HTML and Javascript. Both Sednterp Web and Desktop provide an editable display which the user has complete control of and platform tools to help create the module in the form of developer tools. The Sednterp distribution comes with an example module which can be edited so users can use it as a base to create their own modules.
This page shall provide documentation on how to create a user module from scratch.
The basic underlying tool you will need to know is JavaScript, you should not need to be an expert but some underlying fundamentals should be enough to create your own module.
First to create your own module you will need to place it in modules/QtScript under where you have Sednterp installed on your system. If you used the windows installer to install Sednterp you will most likely be able to find it in C:\Program Files\Sednterp
Therefore you should be saving your created modules in C:\Program Files\Sednterp\modules\QtScript
Your module file will be broken up into two parts JavaScript and HTML for the UI.
Part one: JavaScript
- Your JavaScript will need to include the following 6 different functions
/* Required Accessor Functions */ function getModuleName() { return "ModuleName"; } function getModuleVersion() { return "20120604"; } function getModuleInteractionXml() { return "No Interactions"; } function getModuleDate() { return "2010/06/22"; } function getModuleUI() { return "qt_sednterp.ui"; } function getModuleHTMLUI() { return "./modules/QtScript/module1.html"; }
- This is all you should need for Sednterp to recognize your module and try load it.
- When creating your own module you will need to edit this code. The function getModuleName tells sednterp the name of your unique module, the function getModuleVersion tells sednterp the version number of the module, getModuleHTMLUI tells sednterp the full path location of your HTML Module UI you need to be careful when you set it otherwise your module will not load properly in the desktop version of sednterp. The module path should relative location of HTML file from the location where Sednterp is installed on your system. The other functions don't have a particular use yet however they are still necessary for sednterp to run your module so just leave them as the are.
Part two: HTML UI
- The HTML should be standard HTML it can include script in the head of the document and can be created any way you want for example you could create it using dreamweaver or many of the other tools out there to create HTML files. For the purpose of this tutorial I will show you how to do it without such tools.
Sednterp Developer Tools:
- Developer tools are provided in the Sednterp Desktop application automatically, similar functionality maybe offer in Sednterp Web application but this would depend on the browser you employ to view the web version, therefore I will only discuss the developer tools that come with desktop application.
- Load a your user module and right click on the module display like so and click "Inspect", you should see the following dialog appear. If you are familiar with the developer tools offered with google chrome this dialog should look familiar.
How to Access the Sednterp Database:
- The module provides you with two javascript objects you can use to query the sednterp database called "query1" and "query2".
- For complete documentation on the query objects consult Sednterp Database Query Objects
- These 2 objects regular javascript objects that allow you preform any SQLite command on the Sednterp database. For more on SQLite visit [SQLite Documentation]. The query objects are limited in scope compared to the desktop application currently this will probably change in the future as web application is developed further. But you can currently get any information from the web application out of the database that you can from the desktop application though for security reason you cannot commit any changes to the web application using the query object as you can with the desktop.
Module Window Graphics options:
jQuery:
- jQuery is a JavaScript library that is available for use with Sednterp, you do not need to include it in your HTML UI file, actually it is recomended that you do not because A: it will most likely not load properly on the web version, B: it will be just another file you will have have to keep track of with your module if you link it locally, C: because it is already provided for use.
- For more about jQuery visit:
jqPlot:
- jqPlot is a JavaScript library that is available for use with Sednterp for creating graphs, chart, etc, it also automatically provided in both Sednterp web and desktop applications to learn about how to use it visit for more.