Forum OpenACS Development: Updated xotcl packages + more oo version of the notes example
here is an improved the xotcl packages and added functionality for a generic handling of cr-items with classes and subclasses. Essentially, one can generate the data model (object-type, views, tables, queries) by defining an instance of CrClass. The following two statements (from xotcl-note/tcl/note-data-model-procs.tcl) generate a CrNote and a subclass of CrNote named CrSubNote (which has one attribute more) with its relevant tables during startup, if these do not exist already.
::Generic::CrClass create CrNote \ -pretty_name "Note" -pretty_plural "Notes" \ -table_name "generic_cr_note" -id_column "note_id" ::Generic::CrClass create CrSubNote -superclass CrNote \ -pretty_name "SubNote" -pretty_plural "SubNotes" \ -table_name "generic_cr_subnote" -id_column "subnote_id" \ -sql_attributes {{number integer}}The www/index.tcl file contains in essence the following fragment, through which a listing of the existing instances of CrNote and CrSubNote and edit buttons can be obtained.
::Generic::List index \ -object_type CrNote \ -with_subtypes true \ -object_types {CrNote CrSubNote} \ -fields { EDIT {} title {label "Title"} object_type {label "Object Type"} DELETE {} } index generate -order_by titleThe editing magic in www/edit.tcl using ad_form is hidden by:
::Generic::Form form1 \ -object_type CrNote \ -fields { {item_id:key} {title:text {label Title}} {description:text,optional {label Description}} {number:text {label Number}} {text:richtext(richtext),optional {label Content}} } form1 generateSome admin functionality is provided in the admin/ directory.
Alltogether, these simple classes can be used to
- create and delete the schema
- add, edit, delete instances
- provide a polymorphic listing (containing content repository items of different types) where the appropriate editing forms are choosen based on the object type)
This package serves mostly as programming example but might be useful for simple kind of applications already. i have developed and tested it with dotlrn 2.1.3b. It can be dowloaded from: http://media.wu-wien.ac.at/download/xotcl-note-0.2.apm
Please, obtain as well the updated version of xotcl-core for this. If you have not installed xotcl yet, but you want to try this out, please read: http://media.wu-wien.ac.at/download/README-xotcl-oacs. Below is as well an improved version of the request monitor.
-
http://media.wu-wien.ac.at/download/xotcl-core-0.12.apm
xotcl core support for oacs. this includes thread management, documentation interfaces, an implementation of ad_proc and ad_instproc, some trace functionality, generic cr handling... - http://media.wu-wien.ac.at/download/xotcl-request-monitor-0.20.apm
request monitor + faster replacement for "who is online". - http://media.wu-wien.ac.at/download/acs-api-documentation-procs.patch
Patch for providing a hook into the api browser, same as earlier in the thread. - http://media.wu-wien.ac.at/download/acs-bootstrap-installer.patch
Patch for loading xotcl support code before the application classes, same as earlier in this thread.