Index: openacs-4/packages/xowiki/xowiki.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v diff -u -r1.75 -r1.76 --- openacs-4/packages/xowiki/xowiki.info 27 Feb 2008 09:52:01 -0000 1.75 +++ openacs-4/packages/xowiki/xowiki.info 10 Mar 2008 13:16:02 -0000 1.76 @@ -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) - 2008-02-27 + 2008-03-10 Gustaf Neumann, WU Wien <pre> XoWiki is a Wiki implementation for OpenACS in XOTcl. Instead of @@ -54,16 +54,16 @@ BSD-Style 0 - + - + - + Index: openacs-4/packages/xowiki/catalog/xowiki.de_DE.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/catalog/xowiki.de_DE.ISO-8859-1.xml,v diff -u -r1.29 -r1.30 --- openacs-4/packages/xowiki/catalog/xowiki.de_DE.ISO-8859-1.xml 2 Dec 2007 21:38:40 -0000 1.29 +++ openacs-4/packages/xowiki/catalog/xowiki.de_DE.ISO-8859-1.xml 10 Mar 2008 13:16:02 -0000 1.30 @@ -1,5 +1,5 @@ - + Zusammenfassung Verwalten @@ -21,8 +21,8 @@ Vortragstitel Formular Einschr�nkungen - Eintr�ge f�r dieses Formular - Formular ausf�llen + Eintr�ge f�r dieses Formular + Formular ausf�llen Index Neuer Eintrag Quelle @@ -55,7 +55,7 @@ Verlauf Suche Titel - Titel + Titel Ansehen mehr... Index: openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml,v diff -u -r1.35 -r1.36 --- openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml 2 Dec 2007 21:38:40 -0000 1.35 +++ openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml 10 Mar 2008 13:16:02 -0000 1.36 @@ -1,5 +1,5 @@ - + Abstract Admin @@ -39,8 +39,11 @@ Can be obtained from the name of the uploaded file Form Form Constraints - Entries for this form - Fill out + Entries for this form + Form %form_name% + Fill out + Workflow %form_name% + Instances of %form_name% OK Template %errorMsg% @@ -83,7 +86,7 @@ Revisions %errorMsg% Search - Title + Title View more... Index: openacs-4/packages/xowiki/catalog/xowiki.es_ES.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/catalog/xowiki.es_ES.ISO-8859-1.xml,v diff -u -r1.9 -r1.10 --- openacs-4/packages/xowiki/catalog/xowiki.es_ES.ISO-8859-1.xml 26 Nov 2007 09:14:43 -0000 1.9 +++ openacs-4/packages/xowiki/catalog/xowiki.es_ES.ISO-8859-1.xml 10 Mar 2008 13:16:02 -0000 1.10 @@ -1,5 +1,5 @@ - + Administrar Volver Index: openacs-4/packages/xowiki/tcl/form-field-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/form-field-procs.tcl,v diff -u -r1.53 -r1.54 --- openacs-4/packages/xowiki/tcl/form-field-procs.tcl 31 Jan 2008 19:19:26 -0000 1.53 +++ openacs-4/packages/xowiki/tcl/form-field-procs.tcl 10 Mar 2008 13:16:02 -0000 1.54 @@ -336,6 +336,10 @@ return $v } + FormField instproc value_if_nothing_is_returned_from_from {default} { + return $default + } + FormField instproc pretty_value {v} { if {[my exists options]} { foreach o [my set options] { @@ -1135,6 +1139,9 @@ Class FormField::boolean -superclass FormField::radio -parameter { {default t} } + FormField::boolean instproc value_if_nothing_is_returned_from_from {default} { + return f + } FormField::boolean instproc initialize {} { # should be with cvs head message catalogs: # my options {{#acs-kernel.common_No# f} {#acs-kernel.common_Yes# t}} 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.15 -r1.16 --- openacs-4/packages/xowiki/tcl/includelet-procs.tcl 28 Feb 2008 09:04:30 -0000 1.15 +++ openacs-4/packages/xowiki/tcl/includelet-procs.tcl 10 Mar 2008 13:16:02 -0000 1.16 @@ -2091,7 +2091,8 @@ } - ::xowiki::IncludeletClass create create-item-button -superclass ::xowiki::includelet::item-button \ + ::xowiki::IncludeletClass create create-item-button \ + -superclass ::xowiki::includelet::item-button \ -parameter { {__decoration none} {src /resources/acs-subsite/Add16.gif} @@ -2509,54 +2510,77 @@ namespace eval ::xowiki::includelet { ############################################################################# + Class create form-menu-button \ + -parameter { + form + method + link + package_id + base + return_url + {label_suffix ""} + } + form-menu-button instproc render {} { + my instvar package_id base form method return_url label_suffix link + if {![info exists link]} { + set link [$package_id make_link -link $base $form $method return_url] + } + if {$link eq ""} { + return "" + } + set msg_key [namespace tail [my info class]] + set label [_ xowiki.$msg_key [list form_name [$form name]]]$label_suffix + return "$label" + } + + Class form-menu-button-new -superclass form-menu-button -parameter { + {method create-new} + } + Class form-menu-button-answers -superclass form-menu-button -parameter { + {method list} + } + form-menu-button-answers instproc render {} { + set count [[my form] count_usages] + my label_suffix " ($count)" + next + } + + Class form-menu-button-form -superclass form-menu-button -parameter { + {method view} + } + + ::xowiki::IncludeletClass create form-menu \ -superclass ::xowiki::Includelet \ -parameter { {__decoration none} {parameter_declaration { - {-form_item_id:integer,required} + {-form_item_id:integer} + {-buttons {new answers}} + {-button_objs} + {-return_url} }} } form-menu instproc render {} { my get_parameters - # todo return_url my instvar __including_page - 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 [::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] { - if {[set $l] ne ""} { - set label #xowiki.form-menu-$l# - if {$l eq "answer_link"} {append label " ($count) "} - lappend links "$label" + if {![info exists button_objs]} { + set form [::xo::db::CrClass get_instance_from_db -item_id $form_item_id] + set base [$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 {[info exists return_url]} {$obj return_url $return_url} + lappend button_objs $obj } } + set links [list] + foreach b $button_objs { lappend links [$b render] } return "
[join $links { · }]
\n" } ############################################################################# - ::xowiki::IncludeletClass create form-entry-menu \ - -superclass ::xowiki::Includelet \ - -parameter { - {__decoration none} - {parameter_declaration { - }} - } - - form-entry-menu instproc render {} { - my get_parameters - my instvar __including_page - set form [$__including_page page_template] - set base [$package_id pretty_link [$form name]] - return "\n" - } - - ############################################################################# ::xowiki::IncludeletClass create form-usages \ -superclass ::xowiki::Includelet \ -parameter { @@ -2574,6 +2598,7 @@ form-usages instproc render {} { my get_parameters my instvar __including_page + set o $__including_page ::xo::Page requireCSS "/resources/acs-templating/lists.css" set return_url [::xo::cc url]?[::xo::cc actual_query] @@ -2584,12 +2609,12 @@ } set form_item [::xowiki::Form get_instance_from_db -item_id $form_item_id] - $form_item destroy_on_cleanup + set form_constraints [$form_item get_form_constraints $o] if {![info exists field_names]} { set fn [::xowiki::PageInstance get_short_spec_from_form_constraints \ -name @table \ - -form_constraints [$form_item form_constraints]] + -form_constraints $form_constraints] set field_names [split $fn ,] } if {$field_names eq ""} { @@ -2607,7 +2632,6 @@ #my msg sql_atts=$sql_atts #my msg field_names=$field_names - set form_constraints [$form_item form_constraints] # set cr_field_spec [::xowiki::PageInstance get_short_spec_from_form_constraints \ # -name @cr_fields \ # -form_constraints $form_constraints] 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.111 -r1.112 --- openacs-4/packages/xowiki/tcl/package-procs.tcl 29 Jan 2008 12:06:25 -0000 1.111 +++ openacs-4/packages/xowiki/tcl/package-procs.tcl 10 Mar 2008 13:16:02 -0000 1.112 @@ -175,7 +175,7 @@ # # conditional links # - Package ad_instproc make_link {{-with_entities 1} -privilege -link object method args} { + Package ad_instproc make_link {{-with_entities 0} -privilege -link object method args} { Creates conditionally a link for use in xowiki. When the generated link will be activated, the specified method of the object will be invoked. make_link checks in advance, wether the actual user has enough @@ -611,12 +611,17 @@ set added 0 set replaced 0 set updated 0 + set todo [list] foreach o $objects { $o demarshall -parent_id $folder_id -package_id $package_id -creation_user $user_id # page instances have references to page templates, add these first - if {[$o istype ::xowiki::PageInstance]} continue + if {[$o istype ::xowiki::PageInstance]} { + lappend todo $o + continue + } + my log "importing (1st round) $o [$o name] [$o info class]" set item_id [::xo::db::CrClass lookup -name [$o set name] -parent_id $folder_id] if {$item_id != 0} { @@ -637,33 +642,49 @@ } } - foreach o $objects { - if {[$o istype ::xowiki::PageInstance]} { + while {[llength $todo] > 0} { + my log "importing (2nd round) todo=$todo" + set c 0 + set found 0 + foreach o $todo { set old_template_id [$o set page_template] set template_id [::xo::db::CrClass lookup \ - -name [::$old_template_id set name] \ - -parent_id $folder_id] - db_transaction { - 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 - ::xo::db::CrClass delete -item_id $item_id - set item_id 0 - incr replaced - } else { - ::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 -use_given_publish_date [$item_id exists publish_date] - incr updated - } - } - if {$item_id == 0} { ;# the item does not exist -> update reference and save - $o set page_template $template_id - $o save_new -use_given_publish_date [$o exists publish_date] - incr added + -name [::$old_template_id set name] \ + -parent_id $folder_id ] + if {$template_id == 0} { + my log "importing (2nd round) delay import of $o" + incr c + } else { + set todo [lreplace $todo $c $c] + set found 1 + break + } + } + if {$found == 0} { + my log "can't resolve dependencies in $todo" + break + } + my log "importing (2nd round) process $o, todo=$todo" + db_transaction { + 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 + ::xo::db::CrClass delete -item_id $item_id + set item_id 0 + incr replaced + } else { + ::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 -use_given_publish_date [$item_id exists publish_date] + incr updated } } + if {$item_id == 0} { ;# the item does not exist -> update reference and save + $o set page_template $template_id + $o save_new -use_given_publish_date [$o exists publish_date] + incr added + } } } foreach o $objects {$o destroy} 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.209 -r1.210 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 1 Mar 2008 18:36:01 -0000 1.209 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 10 Mar 2008 13:16:02 -0000 1.210 @@ -353,6 +353,8 @@ publish_status 1 item_id 1 revision_id 1 last_modified 1 parent_id 1 } foreach var [$from_object info vars] { + # don't copy vars starting with "__" + if {[string match "__*" $var]} continue if {![info exists excluded_var($var)]} { my set $var [$from_object set $var] } @@ -1025,7 +1027,7 @@ } Page instproc lookup_form_field { - -name + -name:required form_fields } { set key ::_form_field_names($name) @@ -1039,6 +1041,17 @@ error "No form field with name $name found" } + Page instproc lookup_cached_form_field { + -name:required + } { + set key ::_form_field_names($name) + #my msg "FOUND($name)=[info exists $key]" + if {[info exists $key]} { + return [set $key] + } + error "No form field with name $name found" + } + Page instproc show_fields {form_fields} { # this method is for debugging only set msg "" @@ -1219,23 +1232,19 @@ } PageInstance instproc get_short_spec {name} { - #my msg "get_short_spec $name" my instvar page_template - # in the old-fashioned 2-form page-instance create, page_template - # might be non-existant or empty. - if {[info exists page_template] && $page_template ne "" && - [$page_template exists form_constraints]} { - set short_spec [::xowiki::PageInstance get_short_spec_from_form_constraints \ - -name $name -form_constraints [$page_template form_constraints]] - if {$short_spec ne ""} { - return $short_spec - } + set form_constraints [my get_from_template form_constraints] + #my msg "get_short_spec $name c=$form_constraints" + if {$form_constraints ne ""} { + return [::xowiki::PageInstance get_short_spec_from_form_constraints \ + -name $name -form_constraints $form_constraints] } return "" } PageInstance instproc get_field_label {name value} { set short_spec [my get_short_spec $name] + #my msg "short_spec for $name = '$short_spec'" if {$short_spec ne ""} { set f [FormField new -volatile -name $name -spec $short_spec] return [$f pretty_value $value] @@ -1272,14 +1281,26 @@ return $default_spec } + PageInstance instproc get_form_id {} { + return [my page_template] + } + + Page instproc get_form_constraints {form_item} { + # Whis method determines the form constraints typically + # from the form item object (::xowiki::Form) + # We define it as a method of Page to ease overloading. + return [$form_item form_constraints] + } + PageInstance instproc get_from_template {var} { my instvar page_template - if {[info command ::$page_template] eq ""} { + set form_id [my get_form_id] + if {![my isobject ::$form_id]} { #my log "-- fetching page_template = $page_template" - ::xo::db::CrClass get_instance_from_db -item_id $page_template - $page_template destroy_on_cleanup + ::xo::db::CrClass get_instance_from_db -item_id $form_id } - return [$page_template set $var] + if {[::$form_id exists $var]} {return [::$form_id set $var]} + return "" } PageInstance instproc get_content {} { @@ -1299,6 +1320,7 @@ array set __ia [my template_vars $content] # add extra variables as instance attributes array set __ia [my set instance_attributes] + foreach var [array names __ia] { #my log "-- set $var [list $__ia($var)]" # TODO: just for the lookup, whether a field is a richt text field, @@ -1315,6 +1337,10 @@ } next } + PageInstance instproc count_usages {{-all false}} { + # TODO: if we continue this approach, this method should go into Page + return [::xowiki::PageTemplate count_usages -item_id [my item_id] -all $all] + } # # Methods of ::xowiki::Object @@ -1386,7 +1412,9 @@ return $content } - Form instproc list {} { + + Page instproc list {} { + # todo move me my view [my include [list form-usages -form_item_id [my item_id]]] } @@ -1426,11 +1454,31 @@ # # Methods of ::xowiki::FormPage # + FormPage instproc initialize_loaded_object {} { + if {[my exists page_template]} { + ::xo::db::CrClass get_instance_from_db -item_id [my page_template] + } + my array set __ia [my instance_attributes] + next + } + + FormPage instproc property {name} { + if {[string match "_*" $name]} { + set key [string range $name 1 end] + } { + set key __ia($name) + } + if {[my exists $key]} { + return [my set $key] + } + return "" + } + FormPage instproc footer {} { if {[my exists __no_form_page_footer]} { next } else { - return [my include [list form-entry-menu]] + return [my include [list form-menu -form_item_id $form_item_id -buttons form]] } } @@ -1492,38 +1540,27 @@ my array unset field_in_form if {$form_vars} {foreach v $field_names {my set field_in_form($v) 1}} set form_fields [my create_form_fields $field_names] + my load_values_into_form_fields $form_fields set form [my regsub_eval \ [template::adp_variable_regexp] $form \ {my form_field_as_html -mode display "\\\1" "\2" $form_fields}] dom parse -simple -html $form doc $doc documentElement root - my set_form_data $form_fields + my set_form_data $form_fields return [Form disable_input_fields [$root asHTML]] } } FormPage instproc get_value {before varname} { #my msg "varname=$varname" - array set __ia [my set instance_attributes] - switch -glob $varname { - _* {set value [my set [string range $varname 1 end]]} - default { - if {[info exists __ia($varname)]} { - set value [set __ia($varname)] - } elseif {[my exists $varname]} { - set value [my $varname] - } else { - my log "**** unknown variable '$varname' ****" - #my msg "**** [my set instance_attributes]" - set value "" - } - } - } + set value [my property $varname] + # todo: might be more efficient to check, if it exists already set f [my create_raw_form_field -name $varname \ -slot [my find_slot [string trimleft $varname _]] \ -configuration [list -value $value]] + if {[$f hide_value]} { set value "" } else { @@ -1545,6 +1582,8 @@ Page instproc save_data {{-use_given_publish_date:boolean false} old_name category_ids} { #my log "-- [self args]" + # never cache __ia + my array unset __ia my instvar package_id name db_transaction { # 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.130 -r1.131 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 11 Feb 2008 02:18:35 -0000 1.130 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 10 Mar 2008 13:16:02 -0000 1.131 @@ -606,46 +606,51 @@ # foreach f $form_fields { #my msg "validate $f [$f name] [info exists processed([$f name])]" - set att [$f name] + set att [$f name] - # Certain form field types (e.g. checkboxes) are not transmitted, if not - # checked. Therefore, we have not processed these fields above and - # have to do it now. - - if {![info exists processed($att)]} { - #my msg "form field $att not yet processed" - switch -glob -- $att { - __* { - # other internal variables (like __object_name) are ignored - } - _* { - # instance attribute fields - set value [$f value ""] - set varname [string range $att 1 end] - if {![string match *.* $att]} {my set $varname $value} - } - default { - # user form content fields - if {[$f istype ::xowiki::FormField::boolean]} { - # boolean not "checked" means false - set value f - } else { - set value [$f value ""] - } - if {![string match *.* $att]} {set __ia($att) $value} - } + # Certain form field types (e.g. checkboxes) are not transmitted, if not + # checked. Therefore, we have not processed these fields above and + # have to do it now. + + if {![info exists processed($att)]} { + #my msg "form field $att not yet processed" + switch -glob -- $att { + __* { + # other internal variables (like __object_name) are ignored + } + _* { + # instance attribute fields + set varname [string range $att 1 end] + set preset "" + if {[my exists $varname]} {set preset [my set $varname]} + set v [$f value_if_nothing_is_returned_from_from $preset] + set value [$f value $v] + if {$v ne $preset} { + if {![string match *.* $att]} {my set $varname $value} + } + } + default { + # user form content fields + set preset "" + if {[info exists __ia($att)]} {set preset $__ia($att)} + set v [$f value_if_nothing_is_returned_from_from $preset] + set value [$f value $v] + if {$v ne $preset} { + if {![string match *.* $att]} {set __ia($att) $value} + } + } } - } - + } + # # Run validators # - set validation_error [$f validate [self]] - #my msg "validation of [$f name] with value '[$f value]' returns $validation_error" - if {$validation_error ne ""} { - $f error_msg $validation_error - incr validation_errors + set validation_error [$f validate [self]] + #my msg "validation of [$f name] with value '[$f value]' returns $validation_error" + if {$validation_error ne ""} { + $f error_msg $validation_error + incr validation_errors } } #my msg "--set instance attributes to [array get __ia]" @@ -661,7 +666,7 @@ if {!$found} { set f [my create_raw_form_field -name $name -slot [my find_slot $name]] } - #my msg "$name mode=$mode type=[$f set type]" + #my msg "$found $name mode=$mode type=[$f set type] value=[$f value]" if {$mode eq "edit" || [$f display_field]} { set html [$f asHTML] } else { @@ -810,7 +815,7 @@ } } else { # - # perform standard bult update (with revision) + # perform standard update (with revision) # my save_data \ -use_given_publish_date [expr {[lsearch $field_names _publish_date] > -1}] \ @@ -828,6 +833,27 @@ [my query_parameter "return_url" [$package_id pretty_link [my name]]] } + + FormPage instproc load_values_into_form_fields {form_fields} { + array set __ia [my set instance_attributes] + foreach f $form_fields { + set att [$f name] + switch -glob $att { + __* {} + _* { + set varname [string range $att 1 end] + $f value [my set $varname] + } + default { + if {[info exists __ia($att)]} { + #my msg "setting $f ([$f info class]) value $__ia($att)" + $f value $__ia($att) + } + } + } + } + } + FormPage instproc edit { {-validation_errors ""} } { @@ -915,26 +941,28 @@ } array set __ia [my set instance_attributes] - foreach att $field_names { - #my msg "setting HTML att $att" - switch -glob $att { - __* {} - _* { - set f [my lookup_form_field -name $att $form_fields] - set varname [string range $att 1 end] - $f value [my set $varname] - } - default { - set f [my lookup_form_field -name $att $form_fields] - #my msg "check $att f=$f [info exists __ia($att)]" - if {[info exists __ia($att)]} { - #my msg "setting $f ([$f info class]) value $__ia($att)" - $f value $__ia($att) - } - } - } - set ff($att) $f - } + my load_values_into_form_fields $form_fields + foreach f $form_fields {set ff([$f name]) $f } +# foreach att $field_names { +# #my msg "setting HTML att $att" +# switch -glob $att { +# __* {} +# _* { +# set f [my lookup_form_field -name $att $form_fields] +# set varname [string range $att 1 end] +# $f value [my set $varname] +# } +# default { +# set f [my lookup_form_field -name $att $form_fields] +# #my msg "check $att f=$f [info exists __ia($att)]" +# if {[info exists __ia($att)]} { +# #my msg "setting $f ([$f info class]) value $__ia($att)" +# $f value $__ia($att) +# } +# } +# } +# set ff($att) $f +# } # for named entries, just set the entry fields to empty, # without changing the instance variables @@ -1254,25 +1282,6 @@ # return $name # } -# Page instproc create-new {} { -# my instvar package_id -# set name [my new_name [::xo::cc form_parameter name ""]] -# set class [::xo::cc form_parameter class ::xowiki::Page] -# if {[::xotcl::Object isclass $class] && [$class info heritage ::xowiki::Page] ne ""} { -# set class [::xo::cc form_parameter class ::xowiki::Page] -# set f [$class new -destroy_on_cleanup \ -# -name $name \ -# -package_id $package_id \ -# -parent_id [my parent_id] \ -# -publish_status "production" \ -# -title [my title] \ -# -text [list [::xo::cc form_parameter content ""] text/html]] -# $f save_new -# $package_id returnredirect \ -# [my query_parameter "return_url" [$package_id pretty_link $name]?m=edit] -# } -# } - PageTemplate instproc delete {} { my instvar package_id item_id name set count [my count_usages -all true] @@ -1289,14 +1298,30 @@ } } - Form instproc create-new {} { + Page instproc default_instance_attributes {} { + # + # Provide the default list of instance attributes to derived + # FormPages. + # + # We want to be able to create FormPages from all pages. + # by defining this method, we allow derived applications + # to provide their own set of instance attributes + return [list] + } + + Page instproc create-new {} { my instvar package_id + set instance_attributes [my default_instance_attributes] + set f [FormPage new -destroy_on_cleanup \ -package_id $package_id \ -parent_id [my parent_id] \ -publish_status "production" \ + -instance_attributes $instance_attributes \ -page_template [my item_id]] - + # + # if we copy an item, we use source_item_id to provide defaults + # set source_item_id [$package_id query_parameter source_item_id ""] if {$source_item_id ne ""} { set source [FormPage get_instance_from_db -item_id $source_item_id] @@ -1306,7 +1331,9 @@ $f set name "" regexp {^.*:(.*)$} [$source set name] _ name } else { - # set some default values if they are provided + # + # set some default values from query parameters + # foreach key {name title page_order last_page_id} { if {[$package_id exists_query_parameter $key]} { $f set $key [$package_id query_parameter $key] Index: openacs-4/packages/xowiki/www/admin/list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/list.tcl,v diff -u -r1.19 -r1.20 --- openacs-4/packages/xowiki/www/admin/list.tcl 8 Jan 2008 17:07:24 -0000 1.19 +++ openacs-4/packages/xowiki/www/admin/list.tcl 10 Mar 2008 13:16:02 -0000 1.20 @@ -39,7 +39,8 @@ set actions "" foreach type $object_types { - set link [$package_id make_link $package_id edit-new {object_type $type} return_url autoname] + set link [$package_id make_link -with_entities 0 \ + $package_id edit-new {object_type $type} return_url autoname] if {$link eq ""} continue append actions [subst { Action new \