Top Banner
cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields
16

cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields.

Jan 13, 2016

Download

Documents

Philip Cain
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields.

cognovís 2008

]project-open[ meets XoTCL

]po[dynfields

XoDynfields

]po[contacts

XoTCL

]po[projects

]po[categories

OpenACS

XoDynfields

Page 2: cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields.

cognovís 2008

XoDynfields is an extenstion to the intranet-dynfield package of ]po[ providing enhanced data manage- ment for existing business objects.

It integrates XoTCL with the attribute mangement of Dynfields and adds automated form generation as well as extended search capabilities into the mix.

Providing the backend for the intranet-contacts package it is also in use with the new intranet-sco (supply chain optimization) and is set to make it‘s way into other packages as well.

a

XoDynfields in a Nutshell

Page 3: cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields.

cognovís 2008

Attribute Management System is meta table approach to handling OpenACS attributes. It was written as a foundation for the contacts module.

Contacts is a module to manage contact data (of persons / organizations) and provides basic CRM functionalities to OpenACS

Contacts has been using AMS to dynamically allow the manipulation of attributes associated with persons and organizations from the web frontend without the need for further coding

Put to usage, the meta table approach has proven to be a performance hindrance and also made future changes based on attribute data cumbersome.

a

History

AMS & Contacts

Page 4: cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields.

cognovís 2008

Dynfields is a further development of the AMS system though it extends the primary object_type table to manage additional attributes

Dynfields also makes good use of extension tables, allowing for the gathering of object_type related attributes from many sources (read: tables)

::xo::db is a set of XoTCL classes which provide an XoTCL layer to the asc_attribute and object_type system.

It allows for automated generation of classes based on the information stored in the acs_attributes and object_types tables and provides methods based for handling and storing objects as acs_objects in the database.

a

History

Dynfields & ::xo::db

Page 5: cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields.

cognovís 2008

Integrating the contacts module with ]po[ required the rewriting of the underlying use of AMS to Dynfields, which is the method of choice for ]po[ handling of attributes.

Additionally, depending on the object_type, behaviour of methods to handle the contact objects were different in ]po[ core, providing the need for overlaying functionality

As part of a research project cognovís needed to interface the contacts data with external sources using webservices

=> Enhance Dynfields with XoTCL and use XORB for integration of the webservices

a

History

XoDynfields & intranet-contacts

Page 6: cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields.

cognovís 2008

To understand the background, let’s do a quick mapping of OpenACS and XoTCL terms first (keeping it very simple):

::xo::db classes represent OpenACS object_types

The classes contain Slots, which resemble acs_attributes

The ::xo::db classes have class hierarchy resembling the supertype structure of OpenACS

Default methods for the classes are “save” and “save_new”, resembling update and insert statements into the database

a

Attribute Management

OpenACS & XoTCL

Page 7: cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields.

cognovís 2008

Dynfields extends acs_attributes and object_types with a couple of concepts:

Widgets: A widget is a definition on how to display the value of an attribute both in display and edit mode (of a form)

Layouts: Define in what order and position attributes of a form are to be displayed

Extension Tables: In addition to the main table for storing object_type information it allows to define extension tables which contain columns to hold the potential attribute values

Web based: Dynfields allows the web based editing of attributes, which Frank can display you.

a

Attribute Management

Dynfields

Page 8: cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields.

cognovís 2008

From a code perspective Dynfields and ::xo::db have a couple of drawbacks, complemented by the other

::xo::db does not work with extension tables, Dynfields does not respect object_type hierarchies

Neither contained lists, which allow the grouping of attributes for a certain context (though Dynfields went halfway with the layout)

::xo::db did not contain methods to automatically create forms for the classes

Neither supported relationships between object_types (as was needed by contacts)

a

Attribute Management

XoDynfields

Page 9: cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields.

cognovís 2008

XoDynfields therefore provides classes build upon ::xo::db to achieve the previously mentioned goals

::im::dynfield::Class enhances ::xo::db::Class with the object information from Dynfields as well as support extension tables

::im::dynfield::Widget contains all the information how to display an attribute and provide the form field.

::im::dynfield::Attribute and ::im::dynfield::Element enhances ::xo::db::Attribute with the widget information as well as positioning data and lists (context)

::im::dynfield::Form provides generator methods for creating form classes per object type to generate forms (using ad_form)

a

XoDynfields

Class structure

Page 10: cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields.

cognovís 2008

XoDynfields makes use of the same functionality that is inherent in ::xo::db . It generates classes out of the database

::im::dynfield::Class creates one class per object_type, typically named ::im::dynfield::Class::object_type

Objects are instances of this object type specific class.

::im::dynfield::Form also creates one class per object_type.

The individual form is an instance of the object type specific class, which is potentially passed an object for manipulation

XoDynfields

Generating classes

Page 11: cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields.

cognovís 2008

Usage and development of XoDynfields was not only driven by the need for contacts, but should also bring benefits in development in general

Using XoTCL concepts makes it easier to inject custom code into the processing, preventing code forks. An example is saving person information (but not company) in an external HR database upon saving it in contacts

Form generation is much shorter in code and the form can be manipulated using the web frontend by the end user admin.

Forms can be displayed in context and the elements for each context defined by the end user admin.

XoDynfields Benefits

Forms

Page 12: cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields.

cognovís 2008

set party [::im::dynfield::Class get_instance_from_db -id $party_id]multirow create attributes section attribute value set list_ids [$party list_ids]foreach dynfield_id [::im::dynfield::Attribute dynfield_attributes -list_ids $list_ids -privilege "read"] {  # Initialize the Attribute set element [im::dynfield::Element get_instance_from_db -id [lindex $dynfield_id 0] -list_id [lindex $dynfield_id 1]] set value [$party value [$element attribute_name]] if {[$element multiple_p] && $value ne ""} { set value "<ul><li>[join $value "</li><li>"]</li></ul>" } if {$value ne ""} { multirow append attributes [$element section_heading] [$element pretty_name] $value }}

XoDynfields Code

Code for display

Page 13: cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields.

cognovís 2008

set class "[::im::dynfield::Class object_type_to_class ${object_type}]“if {[exists_and_not_null party_id] && [acs_object::object_p -id $party_id]} { set party [::im::dynfield::Class get_instance_from_db -id $party_id] set class [$party class] set object_type [$party object_type]} else { set party [$class create ::party ] $party set object_type $object_type} set list_ids [$party list_ids]if {[exists_and_not_null rel_type]} { lappend list_ids [ams::list::get_list_id -object_type "$rel_type" -list_name "$rel_type"]}set form [::im::dynfield::Form create ::im_company_form -class "$class" -list_ids $list_ids -name "party_ae" -data $party -key "party_id" -submit_link "/intranet-contacts/contact" -export [list [list rel_type $rel_type] [list object_id_two $object_id_two] [list role_two $role_two]]] $form generate

XoDynfields Code

Code for form generation

Page 14: cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields.

cognovís 2008

XoDynfields also provides custom searches based e.g. on object attributes and relationships to answer questions like:

Show me all persons living in Canada between 20-30 years age

From the above search, show me all the work in the US (relationship to a US company)

In addition to that the, results (usually a table) can be extended dynamically with attributes, e.g. you could display the companies turnover for the list of young Canadians working in the US.

Please head over to http://projop.cognovis.biz/intranet-contacts/search and start a search (standard ]po[ logins)

XoDynfields Benefits

Searches

Page 15: cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields.

cognovís 2008

Although a lot of code already exists, help from smarter developers is needed for implementing new features:

Multi Value Support. Although multi values can be saved correctly in XoDynfields (and displayed), using them in searches is still an outstanding issue

At the moment searches are still based on the object types. In the future they should be based on lists (context).

Part of the search functionality still needs testing and bug fixing

Search needs to be extracted from contacts and put into XoDynfields proper

Combined objects over relationships (acs_rels as well as foreign keys) need to be implemented

XoDynfields

Help needed

Page 16: cognovís 2008 ]project-open[ meets XoTCL ]po[ dynfields XoDynfields ]po[ contacts XoTCL ]po[ projects ]po[ categories OpenACS XoDynfields.

cognovís 2008

Schrödersweg 2722453 HamburgGermany

Tel: +49 40 553 70 83Cell: +49 179 2408964Fax: +49 40 553 70 84

[email protected]

Thanks for your attention