View · Index

Unit 2 / Define a Package-specific Content Type

# We are still in the Tcl namespace ::demo in file note-procs.tcl

  ...
  # The class ::demo::Note has an additional attribute "number" in

  # addition to the common attributes of CrItems. Since Note is a

  # subclass of content repository items, the additional attributes

  # are versioned, this means that when an entry is modified and

  # saved, the old revisions with the old values are still continue to

  # exist.


  ::xo::db::CrClass create Note -superclass ::xo::db::CrItem \
      -pretty_name "Demo Note"  -pretty_plural "Demo Notes" \
      -slots {
         ::xo::db::CrAttribute create number \
           -datatype integer -default 0
      }
}
# end of file note-procs.tcl

ns_log Notice "note-procs.tcl loaded"