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.8 -r1.9 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 28 Jan 2006 01:31:25 -0000 1.8 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 28 Jan 2006 23:28:22 -0000 1.9 @@ -1,5 +1,4 @@ namespace eval ::xowiki { - ::Generic::CrClass create Page -superclass ::Generic::CrItem \ -pretty_name "XoWiki Page" -pretty_plural "XoWiki Pages" \ -table_name "xowiki_page" -id_column "page_id" \ @@ -30,6 +29,17 @@ -form ::xowiki::PageInstanceForm \ -edit_form ::xowiki::PageInstanceEditForm + ::Generic::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 \ + -form ::xowiki::ObjectForm + + Object instproc save_new {} { + #my set text [::Serializer deepSerialize [self]] + next + } + } # the following block is legacy code @@ -235,6 +245,9 @@ return $item_id } + # + # PlainWiki Form + # Class create PlainWikiForm -superclass WikiForm \ -parameter { @@ -244,6 +257,40 @@ {html {cols 80 rows 10}}}} } + # + # Object Form + # + + Class create ObjectForm -superclass PlainWikiForm \ + -parameter { + {f.title {title:text(inform)}} + {f.text + {text:text(textarea),nospell,optional + {label #xowiki.content#} + {html {cols 80 rows 15}}}} + {validate + {}} + {with_categories false} + } + + ObjectForm instproc edit_request {item_id} { + my instvar data + permission::require_permission \ + -party_id [ad_conn user_id] -object_id [$data set parent_id] \ + -privilege "admin" + next + } + + ObjectForm instproc edit_data {} { + my instvar data + $data package_info [$data set text] + next + } + + # + # PageInstance Forms + # + Class create PageInstanceForm -superclass WikiForm \ -parameter { {field_list {item_id title page_template description nls_language}} @@ -269,7 +316,6 @@ my log "-- 1 $data, cl=[$data info class] [[$data info class] object_type]" set item_id [next] my log "-- 2 $data, cl=[$data info class] [[$data info class] object_type]" - my log "-- new data next DONE item_id=$item_id" my set_submit_link_edit return $item_id } @@ -311,6 +357,7 @@ } } + PageInstanceEditForm instproc edit_data {} { my log "-- " my instvar page_instance_form_atts data @@ -357,6 +404,35 @@ namespace eval ::xowiki { + Page ad_proc require_folder_object { + -folder_id + -package_id + } { + } { + if {![::xotcl::Object isobject ::$folder_id]} { + set item_id [CrItem lookup -title ::$folder_id -parent_id $folder_id] + if {$item_id != 0} { + my log "--f fetch folder object" + set o [::xowiki::Object create ::$folder_id] + ::xowiki::Object fetch_object -object $o -item_id $item_id + $o package_info [$o set text] + } else { + my log "--f save new folder object" + set o [::xowiki::Object create ::$folder_id] + $o set text "set package_id $package_id\nset index_page {}\n" + $o set parent_id $folder_id + $o set title ::$folder_id + $o save_new + $o package_info [$o set text] + } + $o proc destroy {} {my log "--f "; next} + my log "--f exists $o -> [::xotcl::Object isobject $o]" + uplevel #0 [list $o volatile] + } else { + my log "--f reuse folder object [::Serializer deepSerialize ::$folder_id]" + } + } + # # data definitions # @@ -621,4 +697,17 @@ } next } + + Object instproc package_info {cmd} { + set package_info [self]::package_info + if {![my isobject $package_info]} {::xotcl::Object create $package_info} + if {[catch {$package_info eval $cmd} error ]} { + ns_log error "XoWiki folder object: content lead to error: $error" + } + } + Object instproc get_package_info {var} { + set package_info [self]::package_info + if {![my isobject $package_info]} {::xotcl::Object create $package_info} + expr {[$package_info exists $var] ? [$package_info set $var] : ""} + } } \ No newline at end of file Index: openacs-4/packages/xowiki/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/Attic/index.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/xowiki/www/index.tcl 26 Jan 2006 01:30:46 -0000 1.6 +++ openacs-4/packages/xowiki/www/index.tcl 28 Jan 2006 23:28:23 -0000 1.7 @@ -12,12 +12,23 @@ folder_id:optional } -set path [ad_conn path_info] -ns_log notice "-- path=<$path>" - set context [list] set supertype ::xowiki::Page +if {![info exists folder_id] && ![info exists object_type]} { + set folder_id [$supertype require_folder -name xowiki] + set index_page [$folder_id get_package_info index_page] + if {$index_page ne ""} { + set item_id [Generic::CrItem lookup -title $index_page -parent_id $folder_id] + if {$item_id != 0} { + rp_form_put item_id $item_id + rp_form_put folder_id $folder_id + rp_internal_redirect "/packages/xowiki/www/view" + ad_script_abort + } + } +} + # if object_type is specified, only list entries of this type; # otherwise show types and subtypes of $supertype if {![info exists object_type]} { Index: openacs-4/packages/xowiki/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/index.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/xowiki/www/admin/index.adp 14 Dec 2005 16:12:59 -0000 1.1 +++ openacs-4/packages/xowiki/www/admin/index.adp 28 Jan 2006 23:28:23 -0000 1.2 @@ -1,6 +1,6 @@ @page_title;noquote@ @context;noquote@ +@t1;noquote@ - Index: openacs-4/packages/xowiki/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/index.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/xowiki/www/admin/index.tcl 19 Jan 2006 23:01:58 -0000 1.4 +++ openacs-4/packages/xowiki/www/admin/index.tcl 28 Jan 2006 23:28:23 -0000 1.5 @@ -1,67 +1,46 @@ ad_page_contract { - This is the admin page for the package. It displays all of the types for - Notes and provides links to delete them + This is the admin page for the package. It displays all of the types + of wiki pages provides links to delete them - @author Your Name (you@example.com) - @cvs-id $Id$ + @author Gustaf Neumann neumann@wu-wien.ac.at + @cvs-id $Id$ } -query { object_type:optional } set context [list] set supertype ::xowiki::Page -set object_type_key [$supertype set object_type_key] - set page_title "Administer all kind of [$supertype set pretty_plural]" -template::list::create \ - -name admin_index \ +set object_type_key [$supertype set object_type_key] +set folder_id [$supertype require_folder -name xowiki] +set object_types [$supertype object_types] + +TableWidget t1 -volatile \ -actions { - export export export - import import import + Action new -label export -url export + Action new -label import -url import } \ - -elements { - delete { - link_url_col delete_url - display_template { - Delete object type with all subtypes and instances - delete - } - sub_class narrow - } - nr_instances { - link_url_col instances_url - label Instances - } - object_type { - label "Object Type" - } + -columns { + Field object_type -label [_ xowiki.page_type] + AnchorField instances -label Instances -html {align center} + ImageField_AddIcon edit -label "Add" -html {align center} + ImageField_DeleteIcon delete -label "Delete" -html {align center} } -db_multirow \ - -extend { - delete_url - instances_url - nr_instances - } admin_index type_index_select " - select object_type from acs_object_types where +db_foreach type_select \ + "select object_type from acs_object_types where tree_sortkey between :object_type_key and tree_right(:object_type_key) " { - - set delete_url [export_vars -base delete-type {object_type}] - if {[$object_type info class] eq "::xotcl::Class"} { - # for backward comatibility with 5.1, since we define PageTemplate as plain xotcl class; - # only necessary to avoid crash, when entries are already in the database - continue - #set nr_instances 0 - } else { - set nr_instances [db_list count [$object_type instance_select_query \ - -count 1 \ - -with_subtypes false]] - } - set instances_url [export_vars -base ../index {object_type}] + t1 add \ + -object_type $object_type \ + -instances [db_list count [$object_type instance_select_query \ + -folder_id $folder_id -count 1 -with_subtypes false]] \ + -instances.href [export_vars -base ../index {object_type}] \ + -edit.href [export_vars -base ../edit {object_type folder_id}] \ + -delete.href [export_vars -base delete-type {object_type}] \ + -edit.title [_ xotcl-core.add [list type [$object_type pretty_name]]] \ + -delete.title "Delete Type [$object_type pretty_name]" } -set template admin_index \ No newline at end of file +set t1 [t1 asHTML] Index: openacs-4/packages/xowiki/www/pages/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/pages/Attic/index.vuh,v diff -u -r1.3 -r1.4 --- openacs-4/packages/xowiki/www/pages/index.vuh 27 Jan 2006 19:04:58 -0000 1.3 +++ openacs-4/packages/xowiki/www/pages/index.vuh 28 Jan 2006 23:28:23 -0000 1.4 @@ -32,7 +32,6 @@ rp_form_put item_id $item_id rp_form_put folder_id $folder_id rp_internal_redirect "/packages/xowiki/www/view" - # ad_returnredirect [export_vars -base ../view {item_id folder_id}] - ad_abort_script + ad_script_abort } } Index: openacs-4/packages/xowiki/www/portlets/categories.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/portlets/Attic/categories.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/xowiki/www/portlets/categories.tcl 27 Jan 2006 19:04:59 -0000 1.2 +++ openacs-4/packages/xowiki/www/portlets/categories.tcl 28 Jan 2006 23:28:23 -0000 1.3 @@ -6,6 +6,8 @@ set folder_id [$__including_page set parent_id] set package_id [db_string get_package_id \ "select package_id from acs_objects where object_id = $folder_id"] +set url_prefix [site_node::get_url_from_object_id -object_id $package_id] + set content "" foreach tree [category_tree::get_mapped_trees $package_id] { foreach {tree_id my_tree_name ...} $tree {break} @@ -26,7 +28,7 @@ # we could check for certain page types as well continue } - append cat_content "$title
\n" + append cat_content "$title
\n" } if {$cat_content ne ""} { append content "

$category_label

" $cat_content "
\n"