Index: openacs-4/packages/xowiki/xowiki.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v
diff -u -r1.62 -r1.63
--- openacs-4/packages/xowiki/xowiki.info 13 Aug 2007 13:52:10 -0000 1.62
+++ openacs-4/packages/xowiki/xowiki.info 3 Sep 2007 21:07:53 -0000 1.63
@@ -8,11 +8,11 @@
f
xowiki
-
+
Gustaf Neumann
A more generic xotcl-based wikis example with object types
and subtypes based on the content repository (with category support)
- 2007-08-12
+ 2007-09-03
Gustaf Neumann
<pre>
XoWiki is a Wiki implementation for OpenACS in XOTcl. Instead of
@@ -54,12 +54,12 @@
BSD-Style
0
-
+
-
+
Index: openacs-4/packages/xowiki/tcl/link-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/link-procs.tcl,v
diff -u -r1.33 -r1.34
--- openacs-4/packages/xowiki/tcl/link-procs.tcl 14 Aug 2007 08:18:45 -0000 1.33
+++ openacs-4/packages/xowiki/tcl/link-procs.tcl 3 Sep 2007 21:07:53 -0000 1.34
@@ -43,7 +43,7 @@
if {![regexp {(.*?)(\#|%23)+(.*)$} [my name] full_name name anchor_tag anchor]} {
set name [my name]
}
- ::Generic::CrItem lookup -name $name -parent_id [my folder_id]
+ ::xo::db::CrClass lookup -name $name -parent_id [my folder_id]
}
Link instproc render_found {href label} {
return "$label"
@@ -202,7 +202,7 @@
set item_id [next]
# my log "-- file, lookup of [my name] returned $item_id"
if {$item_id == 0 && [regsub {^file:} [my name] image: name]} {
- set item_id [::Generic::CrItem lookup -name $name -parent_id [my folder_id]]
+ set item_id [::xo::db::CrClass lookup -name $name -parent_id [my folder_id]]
}
return $item_id
}
@@ -245,7 +245,7 @@
set item_id [next]
my log "--file, lookup of [my name] returned $item_id"
if {$item_id == 0 && [regsub {^swf:} [my name] file: name]} {
- set item_id [::Generic::CrItem lookup -name $name -parent_id [my folder_id]]
+ set item_id [::xo::db::CrClass lookup -name $name -parent_id [my folder_id]]
my log "--file, 2nd lookup of $name returned $item_id"
}
return $item_id
@@ -288,7 +288,7 @@
#::xowiki::Package initialize -package_id $id
my log "--u setting package_id to $id"
# lookup the item from the found folder
- return [::Generic::CrItem lookup -name [my name] -parent_id [$id set folder_id]]
+ return [::xo::db::CrClass lookup -name [my name] -parent_id [$id set folder_id]]
}
#my log "--LINK no page found [my name], [my lang], type=[my type]."
return 0
Index: openacs-4/packages/xowiki/tcl/package-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/package-procs.tcl,v
diff -u -r1.83 -r1.84
--- openacs-4/packages/xowiki/tcl/package-procs.tcl 14 Aug 2007 08:04:31 -0000 1.83
+++ openacs-4/packages/xowiki/tcl/package-procs.tcl 3 Sep 2007 21:07:53 -0000 1.84
@@ -23,9 +23,9 @@
when testing e.g. from the developer shell
} {
#TODO can most probably further simplified
- set page [::Generic::CrItem instantiate -item_id $item_id -revision_id $revision_id]
+ set page [::xo::db::CrClass get_instance_from_db -item_id $item_id -revision_id $revision_id]
- #my log "--I instantiate i=$item_id revision_id=$revision_id page=$page"
+ #my log "--I get_instance_from_db i=$item_id revision_id=$revision_id page=$page"
$page folder_id [$page set parent_id]
if {[apm_version_names_compare [ad_acs_version] 5.2] <= -1} {
@@ -397,12 +397,12 @@
$page destroy_on_cleanup
$page set_content [string trim [$page text] " \n"]
$page initialize_loaded_object
- set item_id [::Generic::CrItem lookup -name $name -parent_id $folder_id]
+ set item_id [::xo::db::CrClass lookup -name $name -parent_id $folder_id]
if {$item_id == 0} {
$page save_new
} else {
# get the page from the CR with all variables
- set p [::Generic::CrItem instantiate -item_id $item_id]
+ set p [::xo::db::CrClass get_instance_from_db -item_id $item_id]
$p destroy_on_cleanup
# copy all variables from the prototype page
# into the instantiated page
@@ -456,35 +456,35 @@
if {$path ne ""} {
- set item_id [::Generic::CrItem lookup -name $path -parent_id $folder_id]
+ set item_id [::xo::db::CrClass lookup -name $path -parent_id $folder_id]
my log "--try $path -> $item_id"
if {$item_id == 0} {
my get_name_and_lang_from_path $path lang local_name
set name ${lang}:$local_name
- set item_id [::Generic::CrItem lookup -name $name -parent_id $folder_id]
- #my log "--try $name -> $item_id // ::Generic::CrItem lookup -name $name -parent_id $folder_id"
+ set item_id [::xo::db::CrClass lookup -name $name -parent_id $folder_id]
+ #my log "--try $name -> $item_id // ::xo::db::CrClass lookup -name $name -parent_id $folder_id"
if {$item_id == 0 && $lang eq "download"
&& [regexp {^([^/]+)/(.*)$} $local_name _ prefix base_name]} {
- set item_id [::Generic::CrItem lookup -name ${prefix}:$base_name -parent_id $folder_id]
+ set item_id [::xo::db::CrClass lookup -name ${prefix}:$base_name -parent_id $folder_id]
if {$item_id == 0} {
- set item_id [::Generic::CrItem lookup -name image:$base_name -parent_id $folder_id]
+ set item_id [::xo::db::CrClass lookup -name image:$base_name -parent_id $folder_id]
}
if {$item_id != 0} {
upvar $method_var method
set method download
}
}
if {$item_id == 0 && $lang eq "file"} {
- set item_id [::Generic::CrItem lookup -name swf:$local_name -parent_id $folder_id]
+ set item_id [::xo::db::CrClass lookup -name swf:$local_name -parent_id $folder_id]
if {$item_id == 0} {
- set item_id [::Generic::CrItem lookup -name image:$local_name -parent_id $folder_id]
+ set item_id [::xo::db::CrClass lookup -name image:$local_name -parent_id $folder_id]
}
my log "--try image:$local_name -> $item_id"
}
if {$item_id == 0} {
set nname [my normalize_name $name]
- set item_id [::Generic::CrItem lookup -name $nname -parent_id $folder_id]
+ set item_id [::xo::db::CrClass lookup -name $nname -parent_id $folder_id]
my log "--try $nname -> $item_id"
}
}
@@ -493,7 +493,7 @@
set revision_id [my query_parameter revision_id 0]
set [expr {$revision_id ? "item_id" : "revision_id"}] 0
#my log "--instantiate item_id $item_id revision_id $revision_id"
- set r [::Generic::CrItem instantiate -item_id $item_id -revision_id $revision_id]
+ set r [::xo::db::CrClass get_instance_from_db -item_id $item_id -revision_id $revision_id]
$r destroy_on_cleanup
#my log "--instantiate done CONTENT\n[$r serialize]"
$r set package_id [namespace tail [self]]
@@ -520,7 +520,7 @@
if {[catch {eval [nsv_get xotcl_object_cache ::$folder_id]}]} {
while {1} {
set item_id [ns_cache eval xotcl_object_type_cache item_id-of-$folder_id {
- set myid [CrItem lookup -name ::$folder_id -parent_id $folder_id]
+ set myid [::xo::db::CrClass lookup -name ::$folder_id -parent_id $folder_id]
if {$myid == 0} break; # don't cache ID if invalid
return $myid
}]
@@ -634,14 +634,14 @@
# page instances have references to page templates, add these first
if {[$o istype ::xowiki::PageInstance]} continue
- set item_id [CrItem lookup -name [$o set name] -parent_id $folder_id]
+ set item_id [::xo::db::CrClass lookup -name [$o set name] -parent_id $folder_id]
if {$item_id != 0} {
if {$replace} { ;# we delete the original
- ::Generic::CrItem delete -item_id $item_id
+ ::xo::db::CrClass delete -item_id $item_id
set item_id 0
incr replaced
} else {
- ::Generic::CrItem instantiate -item_id $item_id
+ ::xo::db::CrClass get_instance_from_db -item_id $item_id
$item_id copy_content_vars -from_object $o
$item_id save
incr updated
@@ -656,18 +656,18 @@
foreach o $objects {
if {[$o istype ::xowiki::PageInstance]} {
set old_template_id [$o set page_template]
- set template_id [CrItem lookup \
+ set template_id [::xo::db::CrClass lookup \
-name [::$old_template_id set name] \
-parent_id $folder_id]
db_transaction {
- set item_id [CrItem lookup -name [$o set name] -parent_id $folder_id]
+ set item_id [::xo::db::CrClass lookup -name [$o set name] -parent_id $folder_id]
if {$item_id != 0} {
if {$replace} { ;# we delete the original
- ::Generic::CrItem delete -item_id $item_id
+ ::xo::db::CrClass delete -item_id $item_id
set item_id 0
incr replaced
} else {
- ::Generic::CrItem instantiate -item_id $item_id
+ ::xo::db::CrClass get_instance_from_db -item_id $item_id
$item_id copy_content_vars -from_object $o
$item_id set page_template $template_id
$item_id save
@@ -851,7 +851,7 @@
set source_item_id [$id query_parameter source_item_id ""]
if {$source_item_id ne ""} {
- set source [$object_type instantiate -item_id $source_item_id]
+ set source [$object_type get_instance_from_db -item_id $source_item_id]
$source destroy_on_cleanup
$page copy_content_vars -from_object $source
set name ""
@@ -894,7 +894,7 @@
}
if {$item_id ne ""} {
#my log "--D trying to delete $item_id $name"
- set object_type [::Generic::CrItem get_object_type -item_id $item_id]
+ set object_type [::xo::db::CrClass get_object_type -item_id $item_id]
# in case of PageTemplate and subtypes, we need to check
# for pages using this template
set classes [concat $object_type [$object_type info heritage]]
Index: openacs-4/packages/xowiki/tcl/weblog-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/weblog-procs.tcl,v
diff -u -r1.19 -r1.20
--- openacs-4/packages/xowiki/tcl/weblog-procs.tcl 29 Jul 2007 20:17:01 -0000 1.19
+++ openacs-4/packages/xowiki/tcl/weblog-procs.tcl 3 Sep 2007 21:07:53 -0000 1.20
@@ -136,16 +136,19 @@
if {$summary} {
# we need always: package_id item_id name title creator creation_user pretty_date
- set p [Page new -package_id $package_id -item_id $item_id \
+ set p [Page new \
+ -package_id $package_id \
+ -item_id $item_id -revision_id $revision_id \
-name $name -title $title -creator $creator]
$p set creation_user $creation_user
$p set description [expr {$description eq "" && $body ne ""? \
- "[string range $body 0 $summary_chars]..." : $description}]
+ "[string range $body 0 $summary_chars]..." : \
+ $description}]
$p set instance_attributes $instance_attributes
} else {
# do full instantiation and rendering
# ns_log notice "--Render object revision_id = $revision_id $name $title ::$revision_id?[my isobject ::$revision_id]"
- set p [::Generic::CrItem instantiate -item_id 0 -revision_id $revision_id]
+ set p [::xo::db::CrClass get_instance_from_db -item_id 0 -revision_id $revision_id]
# in cases, the revision was created already earlier, drop the mixins
if {[$p info mixin] ne ""} {$p mixin {}}
if {[my exists entry_flag]} {$p set [my entry_flag] 1}
Index: openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl,v
diff -u -r1.32 -r1.33
--- openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl 16 Aug 2007 09:46:57 -0000 1.32
+++ openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl 3 Sep 2007 21:07:53 -0000 1.33
@@ -50,7 +50,7 @@
-package_id $package_id \
-content_types ::xowki::Page* \
-name xowiki]
- set r [::CrWikiPage instantiate_all -folder_id $folder_id]
+ set r [::CrWikiPage get_instances_from_db -folder_id $folder_id]
db_transaction {
array set map {
::CrWikiPage ::xowiki::Page
@@ -151,7 +151,7 @@
where page_title != '' and revision_id = p.page_id"
db_list delete_deprecated_types_from_ancient_versions \
- "select [::xo::db::function_name content_item__delete(i.item_id)] from cr_items i \
+ "select [::xo::db::sql map_function_name content_item__delete(i.item_id)] from cr_items i \
where content_type in ('CrWikiPage', 'CrWikiPlainPage', \
'PageInstance', 'PageTemplate','CrNote', 'CrSubNote')"
}
@@ -322,11 +322,30 @@
}
}
- if {[apm_version_names_compare $from_version_name "0.65"] == -1 &&
- [apm_version_names_compare $to_version_name "0.65"] > -1} {
- ns_log notice "-- upgrading to 0.65"
+ set v 0.70
+ if {[apm_version_names_compare $from_version_name $v] == -1 &&
+ [apm_version_names_compare $to_version_name $v] > -1} {
+ ns_log notice "-- upgrading to $v"
+ # for all xowiki package instances
+ foreach package_id [::xowiki::Package instances] {
+ ::xowiki::Package initialize -package_id $package_id -init_url false
+ $package_id import_prototype_page categories-portlet
+ }
+ # perform the upgrate of 0.62 for the s5 package as well
+ if {[info command ::s5::Package] ne ""} {
+ foreach package_id [::s5::Package instances] {
+ ::s5::Package initialize -package_id $package_id -init_url false
+ # rename swf:name and image:name to file:name
+ db_dml change_swf \
+ "update cr_items set name = 'file' || substr(name,4) \
+ where name like 'swf:%' and parent_id = [$package_id folder_id]"
+ db_dml change_image \
+ "update cr_items set name = 'file' || substr(name,6) \
+ where name like 'image:%' and parent_id = [$package_id folder_id]"
+ }
+ }
catch {
- # for new installs, the old column might not exist
+ # for new installs, the old column might not exist, therefor the catch
db_dml drop_old_column \
"alter table xowiki_page_instance drop column old_page_template"
}
Index: openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl,v
diff -u -r1.87 -r1.88
--- openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 14 Aug 2007 08:04:31 -0000 1.87
+++ openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 3 Sep 2007 21:07:53 -0000 1.88
@@ -232,7 +232,7 @@
|| [$data form_parameter __object_name] ne $name
} {
set folder_id [$data parent_id]
- return [expr {[CrItem lookup -name $name -parent_id $folder_id] == 0}]
+ return [expr {[::xo::db::CrClass lookup -name $name -parent_id $folder_id] == 0}]
}
return 1
}
@@ -657,10 +657,10 @@
if {$page_template_id eq ""} {
set page_template_id [$data set page_template]
}
- set template [::Generic::CrItem instantiate -item_id $page_template_id]
+ set template [::xo::db::CrClass get_instance_from_db -item_id $page_template_id]
$template destroy_on_cleanup
- set dont_edit [concat [[$data info class] edit_atts] [list title] \
- [::Generic::CrClass set common_query_atts]]
+ set dont_edit [concat [[$data info class] array names db_slot] \
+ [::xo::db::CrClass set common_query_atts]]
set category_spec [$data get_short_spec @categories]
foreach f [split $category_spec ,] {
Index: openacs-4/packages/xowiki/tcl/xowiki-portlet-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/Attic/xowiki-portlet-procs.tcl,v
diff -u -r1.88 -r1.89
--- openacs-4/packages/xowiki/tcl/xowiki-portlet-procs.tcl 14 Aug 2007 15:22:22 -0000 1.88
+++ openacs-4/packages/xowiki/tcl/xowiki-portlet-procs.tcl 3 Sep 2007 21:07:53 -0000 1.89
@@ -370,7 +370,7 @@
set content ""
set folder_id [$package_id folder_id]
set open_item_id [expr {$open_page ne "" ?
- [CrItem lookup -name $open_page -parent_id $folder_id] : 0}]
+ [::xo::db::CrClass lookup -name $open_page -parent_id $folder_id] : 0}]
foreach {locale locale_clause} \
[my locale_clause -revisions r -items ci $package_id $locale] break
@@ -602,7 +602,7 @@
if {$allow_edit} {
#set page_link [$package_id pretty_link $name]
#set edit_link [$package_id make_link $page_link edit return_url]
- set p [::Generic::CrItem instantiate -item_id 0 -revision_id $page_id]
+ set p [::xo::db::CrClass get_instance_from_db -item_id 0 -revision_id $page_id]
$p destroy_on_cleanup
set page_link [$package_id pretty_link $name]
set edit_link [$package_id make_link -link $page_link $p edit return_url]
@@ -611,7 +611,7 @@
}
if {$allow_delete} {
if {![info exists p]} {
- set p [::Generic::CrItem instantiate -item_id 0 -revision_id $page_id]
+ set p [::xo::db::CrClass get_instance_from_db -item_id 0 -revision_id $page_id]
$p destroy_on_cleanup
}
set page_link [$package_id pretty_link $name]
@@ -1544,7 +1544,7 @@
$o instvar page_order title page_id name title
set level [expr {[regsub {[.]} $page_order . page_order] + 1}]
set edit_markup ""
- set p [::Generic::CrItem instantiate -item_id 0 -revision_id $page_id]
+ set p [::xo::db::CrClass get_instance_from_db -item_id 0 -revision_id $page_id]
$p destroy_on_cleanup
$p set unresolved_references 0
@@ -1671,7 +1671,7 @@
foreach o [$pages children] {
$o instvar page_order title page_id name title
set level [expr {[regsub {[.]} $page_order . page_order] + 1}]
- set p [::Generic::CrItem instantiate -item_id 0 -revision_id $page_id]
+ set p [::xo::db::CrClass get_instance_from_db -item_id 0 -revision_id $page_id]
$p destroy_on_cleanup
$p set unresolved_references 0
@@ -2224,7 +2224,7 @@
set base [$package_id pretty_link [$__including_page name]]
set new_link [$package_id make_link -link $base $__including_page create-new return_url]
set answer_link [$package_id make_link -link $base $__including_page list return_url]
- set template [::Generic::CrItem instantiate -item_id $form_item_id]
+ set template [::xo::db::CrClass get_instance_from_db -item_id $form_item_id]
set count [$template count_usages]
set links [list]
foreach l [list new_link answer_link] {
@@ -2281,7 +2281,7 @@
if {$form_item_id == 0} {error "Cannot lookup page $form"}
}
- set form_item [::xowiki::Form instantiate -item_id $form_item_id]
+ set form_item [::xowiki::Form get_instance_from_db -item_id $form_item_id]
$form_item destroy_on_cleanup
if {![info exists field_names]} {
@@ -2295,7 +2295,7 @@
}
set sql_atts [list instance_attributes ci.name]
- foreach att [::xowiki::FormPage edit_atts] {set __att($att) 1}
+ foreach att [::xowiki::FormPage array names db_slot] {set __att($att) 1}
set common_atts [list last_modified creation_user]
foreach att $common_atts {
lappend sql_atts p.$att
@@ -2382,7 +2382,7 @@
# maybe this could be slightly faster by using instantiate_objects
#
set publish_status_clause [expr {$all ? "" : " and ci.publish_status <> 'production' "}]
- set items [::xowiki::FormPage instantiate_all \
+ set items [::xowiki::FormPage get_instances_from_db \
-select_attributes $sql_atts \
-from_clause ", xowiki_form_pagei p" \
-with_subtypes false \
Index: openacs-4/packages/xowiki/tcl/xowiki-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-procs.tcl,v
diff -u -r1.165 -r1.166
--- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 13 Aug 2007 13:52:11 -0000 1.165
+++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 3 Sep 2007 21:07:53 -0000 1.166
@@ -10,38 +10,44 @@
#
# create classes for different kind of pages
#
- ::Generic::CrClass create Page -superclass ::Generic::CrItem \
+ ::xo::db::CrClass create Page -superclass ::xo::db::CrItem \
-pretty_name "XoWiki Page" -pretty_plural "XoWiki Pages" \
-table_name "xowiki_page" -id_column "page_id" \
-mime_type text/html \
- -cr_attributes {
+ -slots {
if {[::xo::db::has_ltree]} {
- ::Generic::Attribute new -attribute_name page_order -datatype text \
- -sqltype ltree -validator page_order
+ ::xo::db::CrAttribute create page_order \
+ -sqltype ltree -validator page_order -default ""
}
- ::Generic::Attribute new -attribute_name creator -datatype text
+ ::xo::db::CrAttribute create creator
+ # The following slots are defined elsewhere, but we override
+ # some default values, such as pretty_names, required state,
+ # help text etc.
+ ::xo::Attribute create name \
+ -required true \
+ -help_text #xowiki.Page-name-help_text# \
+ -validator name
+ ::xo::Attribute create title \
+ -required true
+ ::xo::Attribute create descripion \
+ -spec "textarea,cols=80,rows=2"
+ ::xo::Attribute create text \
+ -spec "richtext"
+ ::xo::Attribute create nls_language \
+ -spec {select,options=[xowiki::locales]}
+ ::xo::Attribute create last_modified \
+ -spec date
+ ::xo::Attribute create creation_user \
+ -spec user_id
} \
-parameter {
- page_id
- {revision_id 0}
- item_id
- object_type
- parent_id
- package_id
- name
- title
- text
- description
- nls_language
- {folder_id -100}
{lang en}
{render_adp 1}
{absolute_links 0}
- last_modified
- creation_user
} \
-form ::xowiki::WikiForm
+ ::xowiki::Page log "--slots [::xo::slotobjects ::xowiki::Page]"
# TODO: the following slot definitions are not meant to stay this way.
# when we change to the xotcl 1.5.0+ slots, this will go away
if {$::xotcl::version < 1.5} {
@@ -55,104 +61,85 @@
}
}
- ::xowiki::Page::slot::name set pretty_name #xowiki.Page-name#
- ::xowiki::Page::slot::name set required true
- ::xowiki::Page::slot::name set help_text #xowiki.Page-name-help_text#
- ::xowiki::Page::slot::name set datatype text
- ::xowiki::Page::slot::name set validator name
-
- ::xowiki::Page::slot::title set pretty_name #xowiki.Page-title#
- ::xowiki::Page::slot::title set required true
- ::xowiki::Page::slot::title set datatype text
-
- ::xowiki::Page::slot::description set pretty_name #xowiki.Page-description#
- ::xowiki::Page::slot::description set spec "textarea,cols=80,rows=2"
- ::xowiki::Page::slot::description set datatype text
-
- ::xowiki::Page::slot::text set pretty_name #xowiki.Page-text#
- ::xowiki::Page::slot::text set spec "richtext"
- ::xowiki::Page::slot::text set datatype text
-
- ::xowiki::Page::slot::nls_language set pretty_name #xowiki.Page-nls_language#
- ::xowiki::Page::slot::nls_language set datatype text
- ::xowiki::Page::slot::nls_language set spec {select,options=[xowiki::locales]}
-
- ::xowiki::Page::slot::last_modified set pretty_name #xowiki.Page-last_modified#
- ::xowiki::Page::slot::last_modified set spec date
-
- ::xowiki::Page::slot::creation_user set spec user_id
-
- ::Generic::CrClass create PlainPage -superclass Page \
+ ::xo::db::CrClass create PlainPage -superclass Page \
-pretty_name "XoWiki Plain Page" -pretty_plural "XoWiki Plain Pages" \
-table_name "xowiki_plain_page" -id_column "ppage_id" \
-mime_type text/plain \
-form ::xowiki::PlainWikiForm
- ::Generic::CrClass create File -superclass Page \
+ ::xo::db::CrClass create File -superclass Page \
-pretty_name "XoWiki File" -pretty_plural "XoWiki Files" \
-table_name "xowiki_file" -id_column "file_id" \
-storage_type file \
-form ::xowiki::FileForm
- ::Generic::CrClass create PodcastItem -superclass File \
+ ::xo::db::CrClass create PodcastItem -superclass File \
-pretty_name "Podcast Item" -pretty_plural "Podcast Items" \
-table_name "xowiki_podcast_item" -id_column "podcast_item_id" \
- -cr_attributes {
- ::Generic::Attribute new -attribute_name pub_date -datatype date \
- -sqltype timestamp -spec "date,format=YYYY_MM_DD_HH24_MI"
- ::Generic::Attribute new -attribute_name duration -datatype text \
- -help_text "#xowiki.PodcastItem-duration-help_text#"
- ::Generic::Attribute new -attribute_name subtitle -datatype text
- ::Generic::Attribute new -attribute_name keywords -datatype text \
- -help_text "#xowiki.PodcastItem-keywords-help_text#"
+ -slots {
+ ::xo::db::CrAttribute create pub_date \
+ -datatype date \
+ -sqltype timestamp \
+ -spec "date,format=YYYY_MM_DD_HH24_MI"
+ ::xo::db::CrAttribute create duration \
+ -help_text "#xowiki.PodcastItem-duration-help_text#"
+ ::xo::db::CrAttribute create subtitle
+ ::xo::db::CrAttribute create keywords \
+ -help_text "#xowiki.PodcastItem-keywords-help_text#"
} \
-storage_type file \
-form ::xowiki::PodcastForm
-
- ::Generic::CrClass create PageTemplate -superclass Page \
+
+ ::xo::db::CrClass create PageTemplate -superclass Page \
-pretty_name "XoWiki Page Template" -pretty_plural "XoWiki Page Templates" \
-table_name "xowiki_page_template" -id_column "page_template_id" \
- -cr_attributes {
- ::Generic::Attribute new -attribute_name anon_instances -datatype boolean \
+ -slots {
+ ::xo::db::CrAttribute create anon_instances \
+ -datatype boolean \
-sqltype boolean -default "f"
} \
-form ::xowiki::PageTemplateForm
- ::Generic::CrClass create PageInstance -superclass Page \
+ ::xo::db::CrClass create PageInstance -superclass Page \
-pretty_name "XoWiki Page Instance" -pretty_plural "XoWiki Page Instances" \
-table_name "xowiki_page_instance" -id_column "page_instance_id" \
- -cr_attributes {
- ::Generic::Attribute new -attribute_name page_template \
- -datatype integer -sqltype integer -references cr_items(item_id)
- ::Generic::Attribute new -attribute_name instance_attributes \
- -datatype text -sqltype long_text -default ""
+ -slots {
+ ::xo::db::CrAttribute create page_template \
+ -datatype integer \
+ -references cr_items(item_id)
+ ::xo::db::CrAttribute create instance_attributes \
+ -sqltype long_text \
+ -default ""
} \
-form ::xowiki::PageInstanceForm \
-edit_form ::xowiki::PageInstanceEditForm
- ::Generic::CrClass create Object -superclass PlainPage \
+ ::xo::db::CrClass create Object -superclass PlainPage \
-pretty_name "XoWiki Object" -pretty_plural "XoWiki Objects" \
-table_name "xowiki_object" -id_column "xowiki_object_id" \
- -mime_type text/xotcl \
+ -mime_type text/plain \
-form ::xowiki::ObjectForm
- ::Generic::CrClass create Form -superclass PageTemplate \
+ ::xo::db::CrClass create Form -superclass PageTemplate \
-pretty_name "XoWiki Form" -pretty_plural "XoWiki Forms" \
-table_name "xowiki_form" -id_column "xowiki_form_id" \
- -cr_attributes {
- ::Generic::Attribute new -attribute_name form \
- -datatype text -sqltype long_text -default ""
- ::Generic::Attribute new -attribute_name form_constraints \
- -datatype text -sqltype long_text -default "" \
- -validator form_constraints -spec "textarea,cols=100,rows=2"
+ -slots {
+ ::xo::db::CrAttribute create form \
+ -sqltype long_text \
+ -default ""
+ ::xo::db::CrAttribute create form_constraints \
+ -sqltype long_text \
+ -default "" \
+ -validator form_constraints \
+ -spec "textarea,cols=100,rows=2"
} \
-form ::xowiki::FormForm
- ::Generic::CrClass create FormPage -superclass PageInstance \
+ ::xo::db::CrClass create FormPage -superclass PageInstance \
-pretty_name "XoWiki FormPage" -pretty_plural "XoWiki FormPages" \
-table_name "xowiki_form_page" -id_column "xowiki_form_page_id"
- #::Generic::CrClass create FormInstance -superclass PageInstance \
+ #::xo::db::CrClass create FormInstance -superclass PageInstance \
# -pretty_name "XoWiki FormInstance" -pretty_plural "XoWiki FormInstances" \
# -table_name "xowiki_form_instance" -id_column "xowiki_form_instance_id"
@@ -466,8 +453,7 @@
# do we have a wellformed list?
if {[catch {set page_name [lindex $arg 0]} errMsg]} {
- #my log "--S arg='$arg'"
- # there is something syntactically wrong
+ # there must be something syntactically wrong
return [my error_in_includelet $arg [_ xowiki.error-includelet-dash_syntax_invalid]]
}
@@ -508,6 +494,7 @@
#my log "--resolve --> $page"
} else {
$package_id context [::xo::Context new -volatile]
+ my log "--setting context of $package_id to [[$package_id context] serialize]"
set page [$package_id resolve_page $page_name __m]
}
$package_id context $last_context
@@ -731,7 +718,7 @@
Page instproc adp_subst {content} {
#my log "--adp_subst in [my name]"
- set __ignorelist [list RE __defaults name_method object_type_key]
+ set __ignorelist [list RE __defaults name_method object_type_key db_slot]
foreach __v [my info vars] {
if {[info exists $__v]} continue
my instvar $__v
@@ -1140,7 +1127,7 @@
PageInstance instproc get_from_template {var} {
my instvar page_template
#my log "-- fetching page_template = $page_template"
- ::Generic::CrItem instantiate -item_id $page_template
+ ::xo::db::CrClass get_instance_from_db -item_id $page_template
$page_template destroy_on_cleanup
return [$page_template set $var]
}
@@ -1284,7 +1271,6 @@
return 1
}
-
#
# Methods of ::xowiki::FormPage
#
@@ -1301,8 +1287,8 @@
# this method returns the form attributes (including _*)
#
my instvar page_template
- set dont_edit [concat [[my info class] edit_atts] [list title] \
- [::Generic::CrClass set common_query_atts]]
+ set dont_edit [concat [[my info class] array names db_slot] [list title] \
+ [::xo::db::CrClass set common_query_atts]]
set template [lindex [my get_from_template text] 0]
#set field_names [list _name _title _description _creator _nls_language _page_order]
Index: openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl,v
diff -u -r1.96 -r1.97
--- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 10 Aug 2007 18:39:22 -0000 1.96
+++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 3 Sep 2007 21:07:53 -0000 1.97
@@ -697,7 +697,12 @@
if {[my is_new_entry [my name]]} {
my set creator [::xo::get_user_name [::xo::cc user_id]]
my set nls_language [ad_conn locale]
- my set name [$package_id query_parameter name ""]
+ #my set name [$package_id query_parameter name ""]
+ # TODO: maybe use __object_name to for POST url to make code
+ # more straightworward
+ set n [$package_id query_parameter name \
+ [::xo::cc form_parameter __object_name ""]]
+ if {$n ne ""} { my set name $n }
}
array set __ia [my set instance_attributes]
@@ -722,7 +727,9 @@
# for named entries, just set the entry fields to empty,
# without changing the instance variables
if {[my is_new_entry [my name]]} {
- if {![$ff(_title) istype ::xowiki::FormField::hidden]} {$ff(_title) value ""}
+ if {![$ff(_title) istype ::xowiki::FormField::hidden]} {
+ $ff(_title) value ""
+ }
if {!$anon_instances} {$ff(_name) value ""}
}
}
@@ -997,7 +1004,7 @@
# set name [::$package_id normalize_name $name]
# set suffix ""; set i 0
# set folder_id [my parent_id]
-# while {[CrItem lookup -name $name$suffix -parent_id $folder_id] != 0} {
+# while {[::xo::db::CrClass lookup -name $name$suffix -parent_id $folder_id] != 0} {
# set suffix -[incr i]
# }
# set name $name$suffix
@@ -1050,7 +1057,7 @@
set source_item_id [$package_id query_parameter source_item_id ""]
if {$source_item_id ne ""} {
- set source [FormPage instantiate -item_id $source_item_id]
+ set source [FormPage get_instance_from_db -item_id $source_item_id]
$source destroy_on_cleanup
$f copy_content_vars -from_object $source
#$f set __autoname_prefix "[my name] - "
Index: openacs-4/packages/xowiki/www/admin/export.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/export.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/xowiki/www/admin/export.tcl 4 Jun 2007 12:33:57 -0000 1.5
+++ openacs-4/packages/xowiki/www/admin/export.tcl 3 Sep 2007 21:07:53 -0000 1.6
@@ -20,23 +20,23 @@
db_foreach instance_select $sql { lappend item_ids $item_id }
} else {
foreach o $objects {
- if {[set id [CrItem lookup -name $o -parent_id $folder_id]] != 0} {
+ if {[set id [::xo::db::CrClass lookup -name $o -parent_id $folder_id]] != 0} {
lappend item_ids $id
}
}
}
set content ""
foreach item_id $item_ids {
- ::Generic::CrItem instantiate -item_id $item_id
+ ::xo::db::CrClass get_instance_from_db -item_id $item_id
#
# if the page belongs to an Form/PageTemplate, include it as well
#
if {[$item_id istype ::xowiki::PageInstance]} {
set template_id [$item_id page_template]
if {[lsearch $item_ids $template_id] == -1 &&
![info exists included($template_id)]} {
- ::Generic::CrItem instantiate -item_id $template_id
+ ::xo::db::CrClass get_instance_from_db -item_id $template_id
$template_id volatile
append content [$template_id marshall] \n
set included($template_id) 1
Index: openacs-4/packages/xowiki/www/admin/permissions.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/permissions.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/xowiki/www/admin/permissions.tcl 17 Aug 2006 11:21:20 -0000 1.2
+++ openacs-4/packages/xowiki/www/admin/permissions.tcl 3 Sep 2007 21:07:53 -0000 1.3
@@ -10,7 +10,7 @@
}
if {[info exists item_id]} {
- set page [::Generic::CrItem instantiate -item_id $item_id]
+ set page [::xo::db::CrClass get_instance_from_db -item_id $item_id]
$page volatile
set object_id $item_id
set page_title "Manage Permissions for Page: [$page name]"
Index: openacs-4/packages/xowiki/www/admin/portal-element-add.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/portal-element-add.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/xowiki/www/admin/portal-element-add.tcl 21 Mar 2007 14:16:42 -0000 1.5
+++ openacs-4/packages/xowiki/www/admin/portal-element-add.tcl 3 Sep 2007 21:07:53 -0000 1.6
@@ -13,8 +13,8 @@
}
-set page_id [$package_id resolve_request -path $page_name method]
-set page_id [::Generic::CrItem lookup -name $page_name -parent_id [$package_id folder_id]]
+#set page_id [$package_id resolve_request -path $page_name method]
+set page_id [::xo::db::CrClass lookup -name $page_name -parent_id [$package_id folder_id]]
set page_title [$page_id title]
# for the time being, we add the portlet on the first page (page 0)
Index: openacs-4/packages/xowiki/www/admin/test.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/Attic/test.tcl,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/xowiki/www/admin/test.tcl 29 Jul 2007 17:21:18 -0000 1.9
+++ openacs-4/packages/xowiki/www/admin/test.tcl 3 Sep 2007 21:07:53 -0000 1.10
@@ -365,7 +365,7 @@
? {db_string count "select count(*) from cr_items where parent_id=[$package_id folder_id]"} 4 \
"folder contains: folder object, index and weblog page (+1 includelet)"
-test subsection "Create a test page named hello"
+test subsection "Create a test page named hello with package_id $package_id"
set page [::xowiki::Page new \
-title "Hello World" \
@@ -379,6 +379,7 @@
$page set_content [string trim [$page text] " \n"]
$page initialize_loaded_object
$page save_new
+? {$page set package_id} $package_id "package_id $package_id not modified"
? {db_string count "select count(*) from cr_items where parent_id=[$package_id folder_id]"} 5 \
"folder contains: folder object, index and weblog, hello page (+1 includelet)"
? {expr {[$page revision_id]>0}} 1 "revision_id given"
Index: openacs-4/packages/xowiki/www/prototypes/categories-portlet.page
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/categories-portlet.page,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/xowiki/www/prototypes/categories-portlet.page 7 Jul 2007 15:49:10 -0000 1.2
+++ openacs-4/packages/xowiki/www/prototypes/categories-portlet.page 3 Sep 2007 21:07:53 -0000 1.3
@@ -30,7 +30,7 @@
set folder_id [$package_id folder_id]
set open_item_id [expr {$open_page ne "" ?
- [CrItem lookup -name $open_page -parent_id $folder_id] : 0}]
+ [::xo::db::CrClass lookup -name $open_page -parent_id $folder_id] : 0}]
set content ""
foreach tree [category_tree::get_mapped_trees $package_id] {
Index: openacs-4/packages/xowiki/www/prototypes/weblog-portlet.page
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/Attic/weblog-portlet.page,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/xowiki/www/prototypes/weblog-portlet.page 25 Jul 2007 23:59:24 -0000 1.9
+++ openacs-4/packages/xowiki/www/prototypes/weblog-portlet.page 3 Sep 2007 21:07:53 -0000 1.10
@@ -20,6 +20,7 @@
#
Class create EntryRenderer -instproc render {} {
my instvar package_id name title creator creation_user pretty_date description
+ my log "--W entry [self] [my name] package_id $package_id"
[my set __parent] instvar weblog_obj
# We get the instance_attributes, if these are available. For the
@@ -75,6 +76,7 @@
my proc content {} {
my get_parameters
+ my log "--get_parameters returned package_id=$package_id"
set page [my info parent]
if {[$page exists __including_page]} {
Index: openacs-4/packages/xowiki/www/resources/weblog.css
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/weblog.css,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/xowiki/www/resources/weblog.css 3 Jan 2007 14:03:58 -0000 1.2
+++ openacs-4/packages/xowiki/www/resources/weblog.css 3 Sep 2007 21:07:53 -0000 1.3
@@ -3,6 +3,10 @@
font-size: 85%;
color: #9a9a9b;
}
+div.post {
+ clear: both;
+ background: #f8f8f8;
+}
.post p.auth {
padding: 0 0 0 12px;
font-size: 85%;