Charta Software
Back to the base
E-mail:
Wachtwoord:
Aangemaakt door op 2009-05-25 10:46:41
Laatst gewijzigd op 2009-05-25 11:35:53

Phasing out GetWebSiteTableAsHTML

The function GetWebSiteTableAsHTML currently is used to render a table on a web site page. This function has been deprecated and other techniques should be used instead.

Function GetWebSiteTableAsHTML was responsible for rendering a table model, encapsulated in a web site table, to HTML. However, directly using this function results in web site modules that hard code the structure of the resulting HTML page and need the deprecated TOldTableWebSiteModule to be present. The old table web site module has been deprecated because it needs the developer to register tables in a global registry and make the tables available through one global URI, bypassing the URI path to the web site module that shows the table. This leads to difficulties like name clashes and the problem to enforce the same authorization rules through both URIs.

We should remove calls to GetWebSiteTableAsHTML by using one of the following techniques.

Introducing a TTableWebSiteModule

The new TTableWebSiteModule can be used to create a proper child module which is able to render only one web site table. This child module gets its own URI. It can be rendered from its parent web site module using the RenderChildModule function. Please make sure to register the child module with its parent module first using ChildModules.Add().

An even better approach is to make the parent module a TCompoundWebSiteModule. This way all details of rendering child table modules is handled by this generic class. This would need other elements on the resulting web page to be encapsulated in child modules as well which is desirable. Please refer to Breaking up a web site module into its components for more information on this topic.

Introducing a TSimpleTableWebSiteModule

When possible it is often preferable to introduce a TSimpleTableWebSiteModule to replace the call to GetWebSiteTableAsHTML. By doing this one opens up the possibility of making the web site table editable. Please note that it is not necessary for a simple table web site module to have editing enabled. So when editing is disabled the result will look like the TTableWebSiteModule approach as described above. However, when using a TSimpleTableWebSiteModule one really should make the parent web site module a TCompoundWebSiteModule as making the simple table web site module function properly within any other parent module is too tricky. If it is too early to introduce a compound web site module then the TTableWebSiteModule would be a better choice.