| ]project-open[ Core : Home
]project-open[ Core

# Dynamic Components

### Requirements

Similar to menus and views, extension modules may want to add information to "core" business objects. For example, the ]project-open[ Forum module may want to add this box with discussions and incidents to the ProjectViewPage.

Forum Items |  |  |  |  |
P | Type | Subject | Due | Own | Ass |
3 |  | Proyectos Proof Only - no se crean carpetas | 2004-01-07 | NG | FB |
3 |  | Error al cargar los CV de traductores freelance | 2004-02-16 | AA | FB |
4 |  | Assignación de Freelance y funciona! | 2003-12-05 | NG | FB |
5 |  | Usuario freelance existente pero ausente | 2003-12-04 | JA | FB |
5 |  | Freelance Information Marcela Adad | 2004-02-11 | AA | FB |
5 |  | Autoassignment - No funciona | 2003-12-05 | NG | FB |
7 |  | No puedo acceder a la info de un Freelance!? | 2004-01-27 | JA | FB |

### Design

The implementation of Dynamic Components consists of "Component Plugins" and "Component Bays".

##### Component Plugins

Component Plugins represent HTML widgets. They are implemented using a database table containing the TCL code to render the HTML widgets and API calls in the busines objects .adp pages:

- Plugin Name:
  A unique name that identifies the plugin in case an error occurs and to avoid the duplicate installation of plugins.
- Package Name:
  The name of the package that creates the plugin. This field is used to cleanup when uninstalling a package.
- Sort Order:
  An integer inicating the order of the component in a component bay. Values should go like 10, 20, 30 etc. (like old Basic) to allow future modules to insert its components.
- Page URL:
  A URL starting with /intranet/, but without the '.tcl' extension. Page_url currently depends on where the module is mounted. Bad but no better idea around yet...
- Location:
  An identifier (left, right or bottom) where in the page the component should be displayed.
- Component TCL:
  (Relatively) plain TCL code to call the component. See below.

    create table im_component_plugins (
            plugin_id               integer
                                    constraint im_component_plugin_id_pk
                                    primary key
                                    constraint im_component_plugin_id_fk
                                    references acs_objects,

            plugin_name             varchar(200) not null,

            package_name            varchar(200) not null,

            sort_order              integer not null,

            page_url                varchar(200) not null,
                                    -- One of "left", "right" or "bottom".
            location                varchar(100) not null
                                    constraint im_comp_plugin_location_check
                                    check(location in ('left','right','bottom')),
            component_tcl           varchar(4000),
                    constraint im_component_plugins_un
                    unique (plugin_name, package_name)
    );

##### Component Bays

"Component bays" are the places where "Component Plugins" can be executed. They are implemented using as calls like `[im_component_bay left]`, that check the database for suitable Component Plugins by comparing the "page url" (derived from the connection) and the "location" (left, right or bottom).

    <master src="../master">
    <property name="title">Project</property>
    <!-- left - right - bottom  design -->
    <table cellpadding=0 cellspacing=0 border=0 width=100%>
      <tr>
        <td valign=top>
          @project_base_data_html;noquote@
          <%= [im_component_bay left] %>
        </td>
        <td valign=top>
          @admin_html;noquote@
          @hierarchy_html;noquote@
          <%= [im_component_bay right] %>
        </td>
      </tr>
    </table>
    <br>
    <table cellpadding=0 cellspacing=0 border=0>
      <tr><td>
        <%= [im_component_bay bottom] %>
      </td>
    </tr>
    </table>