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 -N -r1.25 -r1.26
--- openacs-4/packages/xowiki/tcl/form-field-procs.tcl 18 Jul 2007 11:36:28 -0000 1.25
+++ openacs-4/packages/xowiki/tcl/form-field-procs.tcl 18 Jul 2007 20:35:31 -0000 1.26
@@ -119,7 +119,6 @@
FormField instproc config_from_spec {spec} {
my instvar type options widget_type
-
if {[my info class] eq [self class]} {
# Check, wether the actual class of the formfield differs from the
# generic FromField class. If yes, the object was already
@@ -466,9 +465,8 @@
# Reclass the editor based on the attribute 'editor' if necessary
# and call initialize again in this case...
my display_field false
- if {[my editor] eq ""} {
- next
- } elseif {[my info class] ne "[self class]::[my editor]"} {
+
+ if {[my editor] ne "" && [my info class] ne "[self class]::[my editor]"} {
set editor_class [self class]::[my editor]
if {![my isclass $editor_class]} {
set editors [list]
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 -N -r1.14 -r1.15
--- openacs-4/packages/xowiki/tcl/weblog-procs.tcl 8 Jun 2007 17:35:22 -0000 1.14
+++ openacs-4/packages/xowiki/tcl/weblog-procs.tcl 18 Jul 2007 20:35:31 -0000 1.15
@@ -85,8 +85,8 @@
lappend form_items $form_item_id
}
append extra_where_clause " and p.page_template in ('[join $form_items ',']') and p.page_instance_id = cr.revision_id "
- set base_type ::xowiki::FormInstance
- set base_table xowiki_form_instancei
+ set base_type ::xowiki::FormPage
+ set base_table xowiki_form_pagei
lappend attributes instance_attributes
}
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 -N -r1.78 -r1.79
--- openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 18 Jul 2007 13:49:17 -0000 1.78
+++ openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 18 Jul 2007 20:35:31 -0000 1.79
@@ -31,10 +31,11 @@
{folderspec ""}
{autoname 0}
} -ad_doc {
- Form Class for XoWiki Pages.
+ Form Class for XoWiki Pages.
- You can manipulate the form elements shown by editing the field_list. The following elements are mandatory in field_list
- and should never be left out:
+ You can manipulate the form elements shown by editing the field_list.
+ The following elements are mandatory in field_list
+ and should never be left out:
- name
- item_id
@@ -646,25 +647,6 @@
#my log "--fields = [my fields]"
}
- Class create FormInstanceEditForm -superclass PageInstanceEditForm \
- -parameter {
- {f.name "= text"}
- }
-
- FormInstanceEditForm instproc edit_data {} {
- my log "-- "
- my instvar page_instance_form_atts data
- array set __ia [$data set instance_attributes]
- foreach var $page_instance_form_atts {
- set __ia($var) [my var $var]
- }
- my log "--edit_data ia = [array get __ia]"
- $data set instance_attributes [array get __ia]
- foreach __var [my form_vars] {$data set $__var [my var $__var]}
- set item_id [$data save_data [::xo::cc form_parameter __object_name ""]]
- return $item_id
- }
-
proc ::xowiki::validate_form_text {} {
upvar text text
if {$text eq ""} { return 1 }
@@ -674,9 +656,10 @@
set clean_content $content
regsub -all "
" $clean_content "" clean_content
regsub -all "?p */?>" $clean_content "" clean_content
- #ns_log notice "--vaidate_form_content '$content' clean='$clean_content', stripped='[string trim $clean_content]'"
+ #ns_log notice "--validate_form_content '$content' clean='$clean_content', \
+ # stripped='[string trim $clean_content]'"
if {[string trim $clean_content] eq ""} { set text [list "" $mime]}
- my msg "final text='$text'"
+ #my msg "final text='$text'"
return 1
}
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 -N -r1.69 -r1.70
--- openacs-4/packages/xowiki/tcl/xowiki-portlet-procs.tcl 11 Jul 2007 11:57:14 -0000 1.69
+++ openacs-4/packages/xowiki/tcl/xowiki-portlet-procs.tcl 18 Jul 2007 20:35:31 -0000 1.70
@@ -1951,7 +1951,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 sql [::xowiki::FormInstance instance_select_query \
+ set sql [::xowiki::FormPage instance_select_query \
-count true \
-with_subtypes false \
-from_clause ", xowiki_page_instance p" \
@@ -2019,7 +2019,7 @@
}
foreach {att order} [split $orderby ,] break
- set sql [::xowiki::FormInstance instance_select_query \
+ set sql [::xowiki::FormPage instance_select_query \
-select_attributes "publish_date creation_user revision_id" \
-from_clause ", xowiki_page_instance p" \
-with_subtypes 0 \
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 -N -r1.147 -r1.148
--- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 18 Jul 2007 13:49:17 -0000 1.147
+++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 18 Jul 2007 20:35:31 -0000 1.148
@@ -140,11 +140,13 @@
} \
-form ::xowiki::FormForm
+ ::Generic::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 \
-pretty_name "XoWiki FormInstance" -pretty_plural "XoWiki FormInstances" \
-table_name "xowiki_form_instance" -id_column "xowiki_form_instance_id"
-# -form ::xowiki::FormInstanceEditForm
-#TODO delete FormInstanceEditForm
#
# create various extra tables, indices and views
@@ -1254,13 +1256,13 @@
#
- # Methods of ::xowiki::FormInstance
+ # Methods of ::xowiki::FormPage
#
- FormInstance instproc footer {} {
+ FormPage instproc footer {} {
return [my include_portlet [list form-instance-menu]]
}
- FormInstance instproc form_attributes {} {
+ FormPage instproc form_attributes {} {
#
# this method returns the form attributes (including _*)
#
@@ -1277,6 +1279,7 @@
#if {[string match _* $var]} continue
if {[lsearch $dont_edit $var] == -1} {lappend field_names $var}
}
+ set form_vars 0
} else {
foreach {match 1 att} [regexp -all -inline [template::adp_variable_regexp] $form] {
#if {[string match _* $att]} continue
@@ -1297,12 +1300,13 @@
lappend field_names $att
}
}
+ set form_vars 1
}
- return $field_names
+ return [list $form_vars $field_names]
}
- FormInstance instproc get_content {} {
+ FormPage instproc get_content {} {
my instvar doc root package_id page_template
set text [lindex [my get_from_template text] 0]
if {$text ne ""} {
@@ -1312,7 +1316,7 @@
} else {
::xowiki::Form requireFormCSS
set form [lindex [my get_from_template form] 0]
- set field_names [my form_attributes]
+ foreach {form_vars field_names} [my form_attributes] break
set form_fields [my create_form_fields $field_names]
set form [my regsub_eval \
[template::adp_variable_regexp] $form \
@@ -1325,7 +1329,7 @@
}
}
- FormInstance instproc get_value {before varname} {
+ FormPage instproc get_value {before varname} {
#my msg "varname=$varname"
array set __ia [my set instance_attributes]
switch -glob $varname {
@@ -1354,18 +1358,18 @@
return $before$value
}
- FormInstance instproc adp_subst {content} {
+ FormPage instproc adp_subst {content} {
set content [my regsub_eval -noquote true \
- [template::adp_variable_regexp] $content {my get_value "\\\1" "\2"}]
+ [template::adp_variable_regexp] " $content" {my get_value "\\\1" "\2"}]
#regsub -all $content {\1@\2;noquote@} content
- return $content
+ return [string range $content 1 end]
}
- FormInstance instproc is_new_entry {old_name} {
+ FormPage instproc is_new_entry {old_name} {
return [expr {[my publish_status] eq "production" && $old_name eq [my revision_id]}]
}
- FormInstance instproc save_data {old_name category_ids} {
+ FormPage instproc save_data {old_name category_ids} {
my log "-- [self args]"
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 -N -r1.84 -r1.85
--- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 18 Jul 2007 12:29:03 -0000 1.84
+++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 18 Jul 2007 20:35:31 -0000 1.85
@@ -277,7 +277,7 @@
variable ::template::parse_level
lappend parse_level [info level]
set action_vars [expr {$new ? "{edit-new 1} object_type return_url" : "{m edit} return_url"}]
- my log "--formclass=[$object_type getFormClass -data [self]] ot=$object_type"
+ #my log "--formclass=[$object_type getFormClass -data [self]] ot=$object_type"
[$object_type getFormClass -data [self]] create ::xowiki::f1 -volatile \
-action [export_vars -base [$package_id url] $action_vars] \
-data [self] \
@@ -393,7 +393,7 @@
namespace eval ::xowiki {
- FormInstance instproc create_category_fields {} {
+ FormPage instproc create_category_fields {} {
set category_spec [my get_short_spec _categories]
foreach f [split $category_spec ,] {
if {$f eq "off"} {return [list]}
@@ -436,7 +436,7 @@
return $category_fields
}
- FormInstance instproc set_form_value {att value} {
+ FormPage instproc set_form_value {att value} {
my instvar root item_id
set fields [$root selectNodes "//*\[@name='$att'\]"]
#my msg "found field = $fields xp=//*\[@name='$att'\]"
@@ -464,7 +464,7 @@
namespace eval ::xowiki {
- FormInstance ad_instproc set_form_data {} {
+ FormPage ad_instproc set_form_data {} {
Store the instance attributes in the form.
} {
#my msg "set_form_value instance attributes = [my instance_attributes]"
@@ -478,7 +478,7 @@
namespace eval ::xowiki {
- FormInstance ad_instproc get_form_data {form_fields} {
+ FormPage ad_instproc get_form_data {form_fields} {
Get the values from the form and store it as
instance attributes.
} {
@@ -552,7 +552,7 @@
return [list $validation_errors $category_ids]
}
- FormInstance instproc form_field_as_html {{-mode edit} before name form_fields} {
+ FormPage instproc form_field_as_html {{-mode edit} before name form_fields} {
set found 0
foreach f $form_fields {
if {[$f name] eq $name} {set found 1; break}
@@ -573,7 +573,7 @@
namespace eval ::xowiki {
- FormInstance instproc create_form_fields {field_names} {
+ FormPage instproc create_form_fields {field_names} {
set form_fields [my create_category_fields]
set cr_field_spec [my get_short_spec _cr_fields]
@@ -598,7 +598,7 @@
return $form_fields
}
- FormInstance instproc edit {
+ FormPage instproc edit {
{-validation_errors ""}
} {
my instvar page_template doc root package_id
@@ -619,28 +619,32 @@
set formgiven 1
}
- set form_attributes [my form_attributes]
- #my msg form_attributes=$form_attributes
-
+ foreach {form_vars needed_attributes} [my form_attributes] break
+ #my msg "form_vars=$form_vars needed_attributes=$needed_attributes"
+ if {$form_vars} {foreach v $needed_attributes {set field_in_form($v) 1}}
+
#
- # Remove the fields already included in auto_fields form the form_attributes.
+ # Remove the fields already included in auto_fields form the needed_attributes.
# The final list field_names determines the order of the fields in the form.
#
set auto_fields [list _name _page_order _creator _title _text _description _nls_language]
- set reduced_form_attributes $form_attributes
+ set reduced_attributes $needed_attributes
foreach f $auto_fields {
- set p [lsearch $reduced_form_attributes $f]
+ set p [lsearch $reduced_attributes $f]
if {$p > -1} {
- set auto_field_in_form($f) 1
- set reduced_form_attributes [lreplace $reduced_form_attributes $p $p]
+ #if {$form_vars} {
+ #set auto_field_in_form($f) 1
+ #}
+ set reduced_attributes [lreplace $reduced_attributes $p $p]
}
}
- #my msg reduced_form_attributes=$reduced_form_attributes
+ #my msg reduced_attributes=$reduced_attributes
+ #my msg form_fields=[array names field_in_form]
set field_names [list _name]
if {[$package_id show_page_order]} { lappend field_names _page_order }
lappend field_names _title _creator
- foreach fn $reduced_form_attributes { lappend field_names $fn }
+ foreach fn $reduced_attributes { lappend field_names $fn }
foreach fn [list _text _description _nls_language] { lappend field_names $fn }
#my msg field_names=$field_names
@@ -649,7 +653,9 @@
set f [my lookup_form_field -name _name $form_fields]
$f config_from_spec hidden
}
- if {![info exists auto_field_in_form(_text)]} {
+ # include _text only, if explicitely needed (in form or template)
+ if {[lsearch $needed_attributes _text] == -1} {
+ #my msg "setting text hidden"
set f [my lookup_form_field -name _text $form_fields]
$f config_from_spec hidden
}
@@ -670,11 +676,10 @@
#
# we have no validation erros, so we can save the content
#
- my instvar name
my save_data [::xo::cc form_parameter __object_name ""] $category_ids
- #my log "--forminstance redirect to [$package_id pretty_link $name]"
+ #my log "--forminstance redirect to [$package_id pretty_link [my name]]"
$package_id returnredirect \
- [my query_parameter "return_url" [$package_id pretty_link $name]]
+ [my query_parameter "return_url" [$package_id pretty_link [my name]]]
return
}
} else {
@@ -719,8 +724,9 @@
#set form [my regsub_eval \
# [template::adp_variable_regexp] $form \
# {my form_field_as_html "\\\1" "\2" $form_fields}]
- # due to this bug, we postone the replacement after parseing.
- # TODO maybe we have to have a better escape mechanism for at characters. either in values or in the template
+ # due to this bug, we replace the at-character by \x003 to avoid conflict withe the
+ # input and we insert the fields in the result from tdom.
+
set form [string map [list @ \x003] $form]
#my msg form=$form
@@ -738,9 +744,10 @@
# insert automatic form fields on top
foreach att $field_names {
- if {$formgiven && ![string match _* $att]} continue
- if {[info exists auto_field_in_form($att)]} continue
+ #if {$formgiven && ![string match _* $att]} continue
+ if {[info exists field_in_form($att)]} continue
set f [my lookup_form_field -name $att $form_fields]
+ #my msg "insert auto_field $att"
$f render_item
}
} $fcn
@@ -999,7 +1006,7 @@
Form instproc create-new {} {
my instvar package_id
- set f [FormInstance new -destroy_on_cleanup \
+ set f [FormPage new -destroy_on_cleanup \
-package_id $package_id \
-parent_id [my parent_id] \
-publish_status "production" \