FreedomSoft - "the future is freedom"
Web Enablement Tutorial - Print Version

Please Note: Before printing, you may need to adjust the Print Size within your browser to 100%.


Web Enablement - Introduction

The Web browser has become the standard, universal, intuitive interface, replacing both GUI and text based interfaces as the interface of choice. Yet there are many applications written using GUI or text based interfaces, and those applications represent a huge investment in time and money. Many businesses are completely reliant on those applications, yet are under pressure to provide or use the new browser based interface instead.

Redeveloping those applications into the browser environment, allows those applications to be rejuvenated, and allows the time, money and investment that those applications represent to be retained. Yet attempting to Web enable those applications, without using a powerful, effective, and affordable toolkit, is very time consuming and expensive.

Freedombase allows those existing applications to be ported to the Web in a fast, effective, and affordable manner. When ported using Freedombase, the existing GUI or text interfaces can still be used, and can still be extended if necessary. The Web browser interface can also be developed and extended as required, without requiring changes to the GUI or text interface. The browser interface can be developed rapidly to replace the existing GUI or text interface, or can be developed more slowly over time as resources become available.

Porting existing applications to the Web can be an important step to rejuvenating those applications, and making certain they remain saleable or useable well into the 21st Century. This tutorial introduces Web enabling existing applications using Freedombase.

Please be aware that you can also create entirely new browser based applications, using Freedombase. This tutorial only looks at Web enabling existing applications. Please see the other tutorials for information on creating new applications.

Please also be aware that the terminology used within Freedombase, and generally within these tutorials, may be a little different to the terminology you are used to using. Generally Class means Table or File; Attribute means Field or Column; and System is similar to Application or Account. This tutorial mixes the terminology.

It is recommended that you work your way through the Introduction to the Freedombase Designer tutorial first, and the Getting Started tutorial second, before working your way through any other tutorials. These two tutorials introduce you to the fundamental principles of Freedombase, and will make it easier and faster to understand the other tutorials.



Web Enablement - Basic Principles - Introduction

Freedombase Web enables existing applications, by connecting to and interpreting the existing table structures, porting existing OpenInsight forms and popups to the Web, and by providing before and after (pre and post) code tie-ins, allowing existing subroutines and functions to be reused as appropriate. Freedombase also applies all standard and essential Web functionality, such as user and session management, optimistic locking, audit trail, and security.

Freedombase will connect to, and interpret the structure of, existing tables. All business logic required for Web access to those tables can then be applied in one place through Freedombase. The business logic can be applied through Freedombase’s powerful expressions (a bit like spreadsheet calculations), through writing custom code, or through tying in existing subroutines or functions – or any combination of these. Once defined in one place through Freedombase, that business logic is then applied automatically, consistently and reliably, everywhere that each table is accessed via the Web – even if there are many different pages that access or update that table.

Existing OpenInsight forms and popups can be ported to the Web, including the primary functionality of the form and popup. Once ported, those forms and popups can be modified as required to meet different format, style or functional requirements. The ported forms and popups are turned into Freedombase Templates, HTML pages that can be edited through any HTML editor, providing the developer with absolute control over the format, style, and function of each page. Embedded tags tell Freedombase how to integrate the templates.

Before and after code can be applied to both tables and templates; and in addition, ‘during’ or embedded code can be applied within templates, providing developers with absolute control, and providing an easy means to integrate Freedombase in with existing applications.

Please note that the first steps in Web enabling an application would probably be porting existing forms or popups. When Freedombase ports a form or popup, Freedombase finds any tables referenced within those forms or popups and connects to those tables first. This tutorial will cover connecting to existing tables as the first step, and then move onto porting forms and popups, as this is how it occurs ‘behind the scenes’



Web Enablement - Existing Tables - Introduction

Freedombase can connect to existing tables, deriving their structure and some of the business rules associated with those tables, and providing a Web interface into those tables.

Probably, when Web enabling existing applications, the first step would be to port existing forms and popups. When Freedombase ports existing forms or popups, it derives the table structure first automatically and transparently. We will cover deriving table structures first in this tutorial, to help provide more of a foundation before moving on to porting forms and popups.



Web Enablement - Existing Tables - New Fields

IMPORTANT – When attaching to an existing table, Freedombase will add several new fields into the dictionary. You do not need to modify existing programs to reference or update these new fields; you can just ignore them. However, the field positions must not be used for any other data. If you need to add new fields to a table that Freedombase has connected to, simply use the next available field position, after the field positions that Freedombase allocates for those new fields.



Web Enablement - Existing Tables - Names

Freedombase uses a hierarchical tree structure, to enable multiple records from multiple tables to be output to, and returned from, one Web page at one go. This naming convention requires that System, Class and Attribute names used within Freedombase contain only letters and numbers. Other characters, such as full stops and underscores, cannot be used within Freedombase.

When connecting to existing tables, Freedombase will remove illegal characters from the System, Class and Attributes names used within Freedombase. The characters will still exist within the table and field names actually used. However, when referring to the tables and fields via Freedombase, the character and number only versions – without underscore or full stop - must be used instead. This will become more obvious once you see Freedombase connect to an existing table for the first time.



Web Enablement - Existing Tables - Connecting

Freedombase knows whether you want to create a new table, or to attach to an existing table, based on the entry in the (Class) Alias For field in the Freedombase Designer. If you leave the Alias For field blank, Freedombase will create a new table. If you enter an existing table name in the Alias For field, Freedombase will know that this System and Class combination is an alias for that existing table, and will connect to that existing table instead of creating a new table.



Web Enablement - Existing Tables - Deriving

Freedombase needs to know the structure of the existing table, so it will derive the structure, and store the derived structure, including data types and multi valued fields. Freedombase achieves this by both working through the dictionary definitions, and by sampling the data in the existing table.

Freedombase can determine which fields are multi valued. However, in addition, Freedombase requires a controlling field for each multi valued field. By default each field is set as the controlling field for itself. After Freedombase has derived the structure of a table, you will need to replace any non controlling field names in the Control Attribute field, with the appropriate controlling field name.



Web Enablement - Existing Tables - Changing Tables

You can make changes to existing table structures through the Freedombase Designer, and the changes will be reflected in the table dictionary.

If you make changes directly to the table dictionary, you may need to tell Freedombase to derive the structure of the table again, to pick up those changes or new fields and to make them available via the Web interface. To tell Freedombase to derive the structure again, bring up the Class in the Freedombase Designer Class page, and click on the Derive option in the Utilities menu. This can be performed any number of times without causing any harm.



Web Enablement - Existing Tables - Relationships

Relationships between tables can be defined within the Class page, against each table, in the Freedombase Designer. Once these relationships are defined, popup windows, drilling to related data, select/drop down lists, and displaying related records on one page, can all be applied very easily through Freedombase.

We recommend defining relationships within Freedombase whenever practical; relationships are defined, or ‘attached’ to, the ‘child’ attribute or field, pointing up at the ‘parent’ attribute or field on the ‘parent’ table.

For example, to define a relationship from the CUSTOMER table STATE field, to the STATE table key field, you would bring up the CUSTOMER table in the Designer Customer page, and in the Relationship section, enter STATE as the ‘from’ Attribute, STATE as the Points At Class, and KEY as the Points At Attribute. This tells Freedombase that the CUSTOMER STATE field ‘points at’ the STATE KEY field. (You would also need to enter or select a couple of other items, but those details have been left out here, in an attempt to make the principle of applying relationships more obvious.)



Web Enablement - Existing Tables - Business Logic

Generally, when using Freedombase, business logic is applied against the Class itself. This means that updates to that Class will be applied consistently, regardless of what Web page the updates came from.

While it is possible to apply business logic via the Web templates, this should only occur as the exception, not the rule.

Business logic can be applied via calculations or expressions, which are a lot like spreadsheet calculations. If relationships have been defined between tables, these calculations can reference data in other tables, without requiring code to be written to do so. These calculations are a very quick, easy, powerful and flexible way to apply most business logic.

Calculations can be used to set the value of an attribute every time a record is updated through the Web interface. They can also be used to determine whether attribute values are valid or not, and to create custom error messages.

Calculations also allow the powerful Freedombase Cascade processing to occur – a very fast and effective method of cascading updates across the database, as a result of data changes made via the Web interface.

Please see the Calculation section in the Freedombase Help for more information on applying business logic using calculations.

Business logic can also be applied via Before or After (Pre or Post) custom code. This could be new code, or could include calls to existing subroutines or functions, or a mixture of the two.

Please see the separate Custom Code tutorial for more information on applying business logic using custom code.



Web Enablement - Porting Forms - Introduction

OpenInsight forms can be ported to Freedombase templates, which are integrated with the database, via the command line FBTEMPLATEOIFORM command, or via the Freedombase GUI form provided within the Freedombase application on OpenInsight.

Forms are ported with full database integration, including view (read), save, delete, search, and Query By Form functionality. Any or all of this functionality can be removed from the templates once ported as required.

Some functionality, such as multi page tab controls will be ported in a fully functional manner; however, in general, business logic applied via scripts on a form will not be ported, and may require developer intervention to create the equivalent JavaScript within the Template, or to apply the business logic via Before or After custom code. To make this easier, all Scripts on the page are ported into the Template, but commented out. The scripts are called at appropriate times by the controls on the page, for example ‘OnChange’. All that is required is for the developer to replace the commented out script with the appropriate JavaScript, for the functions where JavaScript is required.

Generally we recommend creating and using Freedombase Templates that do NOT use absolute positioning; HTML, and Web browsers, are designed to adjust the information on the page to display in the best manner possible given the available space, and absolute positioning prevents that from occurring. However, when porting OpenInsight Forms to Templates, Freedombase retains the absolute positioning from the Form. If you intend to make large changes to a Template once the Form has been ported, we recommend taking the time to replace the absolute positioning within the Template with an HTML Table structure instead.



Web Enablement - Porting Forms - Tables

Freedombase will automatically connect to, and derive the structure of, any tables referenced within any form being ported. As described previously within this tutorial, we recommend checking the controlling attributes set by Freedombase against multi valued fields. We also recommend setting relationships between tables. Both of these tasks are ideally performed immediately after the first time the table is connected to and derived.

IMPORTANT – Before porting any form, ensure that any tables referenced within the form are attached to/available within the Freedombase application. If they are not attached to the Freedombase application, the porting of the form will fail.



Web Enablement - Porting Forms - Command Method

There are two methods for running the Freedombase OpenInsight Form to Template porting program. Via the command line, and via the Freedombase GUI form provided within the Freedombase application.

Generally, for new developers, we recommend using the Freedombase GUI form within the Freedombase application to port forms. However, the command line equivalent described here, and within the Command section of the Freedombase Help, can be used instead.

The format of the command is:

FBTEMPLATEOIFORM ‘ApplicationName’,’FormName’[,’SystemName’]

ApplicationName is the name of the OpenInsight Application that the Form resides within.

PopupName is the name of the OpenInsight Popup.

SystemName is optional. If Freedombase finds a table referenced within the Popup, that Freedombase has not attached to previously, then Freedombase needs to know what Freedombase System to load the Table within. If SystemName is passed, then Freedombase will use that system. If SystemName is not passed, then Freedombase will create the system name by taking the ApplicationName and removing any underscores.

The ported form will be saved as a Freedombase Template, with the name ApplicationName_FormName.htm. The Template can then be modified as appropriate.

Please see the Templates tutorial, or the Templates section with the Freedombase Help for details of how Templates work.

Examples:

FBTEMPLATEOIFORM ‘EXAMPLES’,’CUST_ENTRY’

Will port the CUST_ENTRY form from within the EXAMPLES application, to a Freedombase Template called EXAMPLES_CUST_ENTRY.htm. Any tables referenced within the form will be ported to a Freedombase system name of EXAMPLES.

FBTEMPLATEOIFORM "’EXAMPLES’,’CUST_ENTRY’,’CUSTDATA’

Will port the CUST_ENTRY form from within the EXAMPLES application, to a Freedombase Template called EXAMPLES_CUST_ENTRY.htm. Any tables referenced within the form will be ported to a Freedombase system name of CUSTDATA.



Web Enablement - Porting Forms - GUI Form Method

Forms can be ported via the Freedombase GUI form, provided within the Freedombase application. This may be an easier method for porting forms than the command line version provided above.

The Freedombase form allows the developer to select what form to port, via a popup, and then to port the selected form.

The end result of the port will be the same regardless of which method of porting – command line or form based – is used.



Web Enablement - Porting Forms - Templates

Once ported, the Template version of the form can then be modified within an HTML editor, to make the form look, feel, and work however is desired.

Please see the separate Template tutorial, or Template section within the Freedombase Help, for details on modifying Freedombase Templates, and on adding extra commands into the Templates.



Web Enablement - Porting Popups - Introduction

OpenInsight popups can be ported to Freedombase templates, which are integrated with the database, via the command line FBTEMPLATEOIPOPUP command, or via the Freedombase GUI form provided within the Freedombase application on OpenInsight.

Popups that allows users to select from records within a table, or that allow users to select from a ‘hard coded’ list within the popups, will be ported with full functionality. Popups that rely on a script or code to populate the list to select from, will not function when ported, and will need to be modified to use Before, During or After custom code to provide the functionality. Please see the Custom Code tutorial, the Template tutorial, or the Freedombase Help for more details.



Web Enablement - Porting Popups - Tables

Freedombase will automatically connect to, and derive the structure of, any tables referenced within any popup being ported. As described previously within this tutorial, we recommend checking the controlling attributes set by Freedombase against multi valued fields. We also recommend setting relationships between tables. Both of these tasks are ideally performed immediately after the first time the table is connected to and derived.

IMPORTANT – Before porting any popup, ensure that any tables referenced within the popup are attached to/available within the Freedombase application. If they are not attached to the Freedombase application, the porting of the popup will fail.



Web Enablement - Porting Popups - Command Method

There are two methods for running the Freedombase OpenInsight Popup to Template porting program. Via the command line, and via the Freedombase GUI form provided within the Freedombase application.

Generally, for new developers, we recommend using the Freedombase GUI form within the Freedombase application to port popups. However, the command line equivalent described here, and within the Command section of the Freedombase Help, can be used instead.

The format of the command is:

FBTEMPLATEOIPOPUP ‘ApplicationName’,’PopupName’[,‘SystemName’]

ApplicationName is the name of the OpenInsight Application that the Popup resides within.

PopupName is the name of the OpenInsight Popup.

SystemName is optional. If Freedombase finds a table referenced within the Popup, that Freedombase has not attached to previously, then Freedombase needs to know what Freedombase System to load the Table within. If SystemName is passed, then Freedombase will use that system. If SystemName is not passed, then Freedombase will create the system name by taking the ApplicationName and removing any underscores.

This is the command line equivalent of the Popup porting option available within the FREEDOMBASE GUI form provided in the FREEDOMBASE application. New users are likely to find the Popup porting option available within the FREEDOMBASE GUI form easier to use.

The ported popup will be saved as a Freedombase Template, with the name ApplicationName_PopupName.htm. The Template can then be modified as appropriate.

Please see the Templates section for details of how Templates work.

IMPORTANT NOTE: Before porting any popup, any tables referenced by the popup must be attached to/available within the FREEDOMBASE application. Porting a popup will fail if tables referenced within the popup are not attached to the FREEDOMBASE application.

Examples

FBTEMPLATEOIPOPUP ‘EXAMPLES’,’STATES_POPUP’

Will port the STATES_POPUP popup from within the EXAMPLES application, to a Freedombase Template called EXAMPLES_STATES_POPUP.htm. Any tables references within the popup will be ported to a Freedombase system name of EXAMPLES.

FBTEMPLATEOIPOPUP ‘EXAMPLES’,’STATES_POPUP’,’CUSTDATA’

Will port the STATES_POPUP popup from within the EXAMPLES application, to a Freedombase Template called EXAMPLES_STATES_POPUP.htm. Any tables references within the popup will be ported to a Freedombase system name of CUSTDATA.



Web Enablement - Porting Popups - GUI Form Method

Popups can be ported via the Freedombase GUI form, provided within the Freedombase application. This may be an easier method for porting popups than the command line version provided above.

The Freedombase GUI form allows the developer to select what popup to port, via a popup, and then to port the selected popup.

The end result of the port will be the same regardless of which method of porting – command line or form based – is used.



Web Enablement - Porting Popups - Templates

Once ported, the Template version of the popup can then be modified within an HTML editor, to make the popup look, feel, and work however is desired.

Please see the separate Template tutorial, or Template section within the Freedombase Help, for details on modifying Freedombase Templates, and on adding extra commands into the Templates.



Web Enablement - Porting Popups - Linking

Generally, the following JavaScript command can be embedded into a Template, in order to make the ported popup operate from that Template:

FreedombasePopUp('View All PopupName.htm',0,'System_Class','')

PopupName.htm is the name of the Popup template, eg EXAMPLES_STATES_POPUP.htm.

System_Class is the name of the System and Class (generally Application and Table without underscores) on the current Template, that the selected data should be placed into; for example, if a popup was being run to select a state, so the state could be set in the CUSTOMER STATE field in the Examples system, the System_Class would be EXAMPLES_CUSTOMER. As long as a relationship has been defined within Freedombase, linking the CUSTOMER STATE attribute to the STATE KEY attribute, Freedombase will provide appropriate JavaScript to update the selected data from the popup into the STATE field on the current page.

For example:

FreedombasePopUp('View All EXAMPLES_CUSTOMER_ID_POPUP.htm',0,'EXAMPLES_CUSTOMERS','')

Please note that System_Class must be the Freedombase System and Class names, not the OpenInsight Table name.

IMPORTANT – The Template must be rebuilt (re-integrated with Freedombase) after the relationship has been entered between the Classes in Freedombase. If it is not rebuilt after the relationship is set, then the popup will be unable to set the selected data into the page that called the popup. Beginning developers may find it easier to port the popup, then set the relationship, then port the popup again.

Similar code to the above, is used within the Freedombase Designer to manage popups. Please see the code within the Designer Templates, to see working examples of popups that have been linked into pages.



    navigate