Index: openacs-4/packages/xowiki/xowiki.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v diff -u -r1.90 -r1.91 --- openacs-4/packages/xowiki/xowiki.info 2 Sep 2008 22:18:28 -0000 1.90 +++ openacs-4/packages/xowiki/xowiki.info 4 Sep 2008 23:34:33 -0000 1.91 @@ -8,7 +8,7 @@ f xowiki - + Gustaf Neumann A more generic xotcl-based wikis example with object types and subtypes based on the content repository (with category support) @@ -54,7 +54,7 @@ BSD-Style 0 - + Index: openacs-4/packages/xowiki/tcl/includelet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/includelet-procs.tcl,v diff -u -r1.47 -r1.48 --- openacs-4/packages/xowiki/tcl/includelet-procs.tcl 2 Sep 2008 16:16:32 -0000 1.47 +++ openacs-4/packages/xowiki/tcl/includelet-procs.tcl 4 Sep 2008 23:34:33 -0000 1.48 @@ -2652,17 +2652,20 @@ my get_parameters my instvar __including_page if {![info exists button_objs]} { - set form [::xo::db::CrClass get_instance_from_db -item_id $form_item_id] - set form_package_id [$form package_id] - # - # "Package require" is just a part of "Package initialize" creating - # the package object if needed - # - ::xowiki::Package require $form_package_id - set base [[$form package_id] pretty_link [$form name]] foreach b $buttons { - set obj [form-menu-button-$b new -volatile -package_id $package_id \ - -base $base -form $form] + if {[llength $b]>1} { + foreach {button id} $b break + } else { + foreach {button id} [list $b $form_item_id] break + } + set form [::xo::db::CrClass get_instance_from_db -item_id $id] + # + # "Package require" is just a part of "Package initialize" creating + # the package object if needed + # + ::xowiki::Package require [$form package_id] + set obj [form-menu-button-$button new -volatile -package_id $package_id \ + -base [[$form package_id] pretty_link [$form name]] -form $form] if {[info exists return_url]} {$obj return_url $return_url} lappend button_objs $obj } @@ -2708,7 +2711,8 @@ } set form_item [::xo::db::CrClass get_instance_from_db -item_id $form_item_id] - set form_constraints [$form_item get_form_constraints] + set form_constraints [$form_item get_form_constraints -trylocal true] + #my msg fc=[$form_item get_form_constraints] if {![info exists field_names]} { set fn [::xowiki::PageInstance get_short_spec_from_form_constraints \ @@ -2948,7 +2952,7 @@ $f destroy set action created } else { - ::xowiki::Form get_instance_from_db -item_id $item_id + ::xo::db::CrClass get_instance_from_db -item_id $item_id if {$form_form_id == 0} { $item_id form $form } else { 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.37 -r1.38 --- openacs-4/packages/xowiki/tcl/weblog-procs.tcl 20 Jun 2008 21:40:20 -0000 1.37 +++ openacs-4/packages/xowiki/tcl/weblog-procs.tcl 4 Sep 2008 23:34:33 -0000 1.38 @@ -94,19 +94,22 @@ set filter_msg "Filtered by category [join $cnames {, }]" set query_parm "&category_id=$category_id" } +#my msg "tag=$tag" if {$tag ne ""} { set filter_msg "Filtered by your tag $tag" append extra_from_clause ",xowiki_tags tags " append extra_where_clause "and tags.item_id = ci.item_id and tags.tag = :tag and \ tags.user_id = [::xo::cc user_id]" set query_parm "&tag=[ad_urlencode $tag]" } +#my msg "ptag=$ptag" if {$ptag ne ""} { set filter_msg "Filtered by popular tag $ptag" append extra_from_clause ",xowiki_tags tags " append extra_where_clause "and tags.item_id = ci.item_id and tags.tag = :ptag " set query_parm "&ptag=[ad_urlencode $ptag]" } +#my msg filter_msg=$filter_msg if {$name_filter ne ""} { append extra_where_clause "and ci.name ~ E'$name_filter' " } 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.266 -r1.267 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 2 Sep 2008 22:18:28 -0000 1.266 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 4 Sep 2008 23:34:33 -0000 1.267 @@ -1478,6 +1478,7 @@ my instvar page_template #set form_constraints [my get_from_template form_constraints] set form_constraints [my get_form_constraints] + #my msg "fc of [my name] = $form_constraints" if {$form_constraints ne ""} { set s [::xowiki::PageInstance get_short_spec_from_form_constraints \ -name $name -form_constraints $form_constraints] @@ -1537,9 +1538,14 @@ return [my page_template] } - PageInstance instproc get_form_constraints {} { + PageInstance instproc get_form_constraints {{-trylocal false}} { # We define it as a method to ease overloading. - return [my get_from_template form_constraints] + #my msg "is_form=[my isform]" + if {$trylocal && [my isform]} { + return [my property form_constraints] + } else { + return [my get_from_template form_constraints] + } } PageInstance instproc get_from_template {var} { @@ -1551,7 +1557,11 @@ ::xo::db::CrClass get_instance_from_db -item_id $form_id } #my msg "form_id=$form_id ([$form_id name]), $var ?[::$form_id exists $var] page instance=[::$form_id istype ::xowiki::PageInstance] -> [$form_id info class]" - if {[::$form_id istype ::xowiki::PageInstance]} {return [::$form_id property $var]} + #my msg "self=[my name], parent=[$form_id name] [::$form_id istype ::xowiki::PageInstance]" + if {[::$form_id istype ::xowiki::PageInstance]} { + #my msg "returning [::$form_id property $var]" + return [::$form_id property $var] + } if {[::$form_id exists $var]} {return [::$form_id set $var]} return "" } @@ -1676,7 +1686,7 @@ return $content } - Form instproc get_form_constraints {} { + Form instproc get_form_constraints args { # We define it as a method to ease overloading. return [my form_constraints] } @@ -1838,13 +1848,20 @@ return $items } - - FormPage instproc property {name {default ""}} { - if {[string match "_*" $name]} { - set key [string range $name 1 end] + FormPage instproc property_key {name} { + if {[regexp {^_([^_].*)$} $name _ varname]} { + return $varname } { - set key __ia($name) + return __ia($name) } + } + FormPage instproc exists_property {name} { + return [my exists [my property_key $name]] + } + + FormPage instproc property {name {default ""}} { + set key [my property_key $name] + # my msg "$key [my exists $key] //[my array names __ia]//" if {[my exists $key]} { return [my set $key] } @@ -1875,11 +1892,21 @@ return [$page property $name $default] } + FormPage instproc isform {} { + return [my exists_property form_constraints] + } + FormPage instproc footer {} { if {[my exists __no_form_page_footer]} { next } else { - return [my include [list form-menu -form_item_id [my page_template] -buttons form]] + set is_form [my property is_form__ 0] + if {[my isform]} { + return [my include [list form-menu -form_item_id [my item_id] \ + -buttons [list new answers [list form [my page_template]]]]] + } else { + return [my include [list form-menu -form_item_id [my page_template] -buttons form]] + } } } 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.160 -r1.161 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 1 Sep 2008 09:23:09 -0000 1.160 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 4 Sep 2008 23:34:33 -0000 1.161 @@ -88,8 +88,9 @@ namespace eval ::xowiki { Page instproc view {{content ""}} { - # view is used only for the toplevel call, when the xowiki page is viewed - # this is not intended for embedded wiki pages + # The method view is used primarily for the toplevel call, when + # the xowiki page is viewed. It is not intended for e.g. embedded + # wiki pages (see include). my instvar package_id item_id $package_id instvar folder_id ;# this is the root folder ::xowiki::Page set recursion_count 0 @@ -153,7 +154,7 @@ #if {[my exists_query_parameter "edit_return_url"]} { # set return_url [my query_parameter "edit_return_url"] #} - my log "--after options" + #my log "--after options master=$master" if {$master} { set context [list $title] @@ -206,8 +207,8 @@ ns_return 200 text/html $content } } else { - # use adp file + #my log "use adp" foreach css [$package_id get_parameter extra_css ""] {::xo::Page requireCSS -order 10 $css} # refetch it, since it might have been changed via set-parameter set template_file [my query_parameter "template_file" \ @@ -333,7 +334,7 @@ -variables {item_id edit_form_page_title context formTemplate view_link back_link rev_link index_link}] template::util::lpop parse_level - #my log "--e html length [string length $html]" + #my log "--edit html length [string length $html]" return $html } @@ -844,7 +845,7 @@ } Page instproc create_form_fields {field_names} { - set form_fields [my create_category_fields] + set form_fields [my create_category_fields] foreach att $field_names { if {[string match "__*" $att]} continue lappend form_fields [my create_form_field $att] @@ -970,7 +971,6 @@ -use_given_publish_date [expr {[lsearch $field_names _publish_date] > -1}] \ [::xo::cc form_parameter __object_name ""] $category_ids } - #my log "--forminstance redirect to [$package_id pretty_link [my name]]" $package_id returnredirect \ [my query_parameter "return_url" [$package_id pretty_link [my name]]] return @@ -1115,9 +1115,9 @@ if {$redirect_method eq "__none"} { return } else { - #my log "--forminstance redirect to [$package_id pretty_link [my name]]" set url [$package_id pretty_link [my name]]?m=$redirect_method $package_id returnredirect [my query_parameter "return_url" $url] + return } } } else { @@ -1256,7 +1256,7 @@ {(^|[^\\])\x003([a-zA-Z0-9_:]+)\x003} $html \ {my form_field_as_html "\\\1" "\2" $form_fields}] - #my msg result=$html + #my log "calling VIEW with HTML [string length $html]" my view $html }