Forum OpenACS Q&A: Question regarding XOTcl-Tutorial for OpenACS

I am using the tutorial [1] to define my first package. I realized that data model changes are not followed automatically. What do I need to do to make xotcl/oacs update the data model? From what I see two tables, one view, some rules and a function is created. Do I have to delete then all?
Collapse
Posted by Gustaf Neumann on
The tutorial shows how to create XOTcl classes from the data model and vice versa, but does not address changes in the data model (adding attributes, changing attribute types, ...), data migration, etc.

For creating acs_types from XOTcl classes, everything needed in OpenACS is created automatically, where "everything" includes among other things the views *i and *r and the function *f (e.g. xowiki_pagei, ...).

For handling data model changes, i would recommend to check what xowiki does (look at ::xowiki::upgrade_callback in xowiki/tcl/xowiki-callback-procs.tcl). In many situations (just adding some columns), a call to ::xowiki::update_views is sufficient (see e.g. upgrade to 0.56 for a more complex case), maybe for your problem as well.

Collapse
Posted by Malte Sussdorff on
I have written a new version of intranet-dynfields (or AMS), which combines the ::xo::db::Class and ::xo::db::Object Classes with extension tables (if you use acs_object_type_tables properly) along with relationships (where relationships can have attributes).

This is combined with Element and Form Classes, allowing you to write your form like:

=========
set party [::im::dynfield::Class get_instance_from_db -id $party_id]

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"]

$form generate -export [list [list object_type [$party object_type]] [list rel_type $rel_type] [list object_id_two $object_id_two] [list
role_two $role_two]]
========

I can go into more details if anyone wants, especially how this meta model allows you to dynamically extend acs_object_types with additional attributes and associate widgets with them, reducing the need for writing ad_form to a less than bare minimum. Obviously it allows you to change the datamodel of an object_type 😊.

Collapse
Posted by Mark Aufflick on
Hi Malte,

I'm interested in both how you are dealing with the datamodel changes and also about associating form widgets.

Sounds time saving!

Collapse
Posted by Malte Sussdorff on
Hi Mark,

I just prepared those two topics for the conference in Valencia and I will record a screencast if I am to speak there. Maybe this will help you further and you can check it out.

I would love to find others participating in this effort especially as I am more and more involved in business consulting and training and don't get around to do much coding anymore (which some people in the community will definitely rejoice over 😊).

All the best
Malte

XoDynfields
==========

XoDynfields is a ]po[ extension which allows to automatically use dynfield enabled object types as an XoTCL class. In this talk I will describe briefly the goals (have a generic class and command interface for dynfield enabled object types), design ideas (connection between xotcl and intranet-dynfields) as well as the search extension (based on work done for intranet-contacts) which allow systematic search for objects based on their attribute values. An introduction is given into intranet-dynfields and it is demonstrated how you can add new attributes as well as assign and create form widgets from the web interface, allowing end users to change the look and feel of forms dynamically (without the need to change code). Last but not least coding examples are given so developers can quickly pick up this method and try it in their own work. An outlook of the missing features and a call for participants in finishing these efforts will end the session on this topic.

Customer Relationship Management with intranet-contacts
===============

Based (if wanted) on the previous talk about XoDynfields we will look into intranet-contacts and see how the dynamic methods of XoDynfields have been put into use in the CRM environment. A generic introduction into the functionality is followed by a quick tour of the application based on a membership organisation for doctors. As part of this the integration of OpenOffice based PDF generation and mailings will be presented and the code shared with the community. Some more time will be spend on the idea of expert searches and how these searches can be used not only for CRM based object types but also for others like projects and tasks. Best practices on data import round off this talk on the CRM system with the possibility to show small code pieces which demonstrate the ease of use of the XoDynfields methods as well as the code used to create the custom searches and dynamic tables. An outlook where the CRM can be used in typical OpenACS and .LRN environments brings us to the end of the session.