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.8 -r1.9 --- openacs-4/packages/xowiki/tcl/form-field-procs.tcl 5 Jul 2007 10:55:08 -0000 1.8 +++ openacs-4/packages/xowiki/tcl/form-field-procs.tcl 6 Jul 2007 13:35:12 -0000 1.9 @@ -174,7 +174,7 @@ } } - FormField instproc renderValue {v} { + FormField instproc pretty_value {v} { if {[my exists options]} { foreach o [my set options] { foreach {label value} $o break @@ -293,6 +293,7 @@ Class FormField::month -superclass FormField -superclass FormField::select FormField::month instproc initialize {} { + # localized values are in acs-lang.localization-mon my options { {January 1} {February 2} {March 3} {April 4} {May 5} {June 6} {July 7} {August 8} {September 9} {October 10} {November 11} {December 12} @@ -302,7 +303,9 @@ Class FormField::boolean -superclass FormField -superclass FormField::radio FormField::boolean instproc initialize {} { - my options {{No f} {Yes t}} + # should be with cvs head message catalogs: + # my options {{#acs-kernel.common_No# f} {#acs-kernel.common_Yes# t}} + my options {{No f} {#acs-kernel.common_Yes# t}} next } 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.66 -r1.67 --- openacs-4/packages/xowiki/tcl/xowiki-portlet-procs.tcl 6 Jul 2007 10:14:43 -0000 1.66 +++ openacs-4/packages/xowiki/tcl/xowiki-portlet-procs.tcl 6 Jul 2007 13:35:12 -0000 1.67 @@ -1112,12 +1112,10 @@ toc instproc page_name {p} {return [my set page_name($p)]} toc proc anchor {name} { - if {![regexp {^.*:([^:]+)$} $name _ anchor]} { - # we might have an unnamed entry, which has no language prefix - set anchor $name - } + # try to strip the language prefix from the name + regexp {^.*:([^:]+)$} $name _ name # anchor is used between single quotes - regsub -all ' $anchor {\'} anchor + regsub -all ' $name {\'} anchor return $anchor } 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.130 -r1.131 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 4 Jul 2007 11:29:04 -0000 1.130 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 6 Jul 2007 13:35:12 -0000 1.131 @@ -776,7 +776,13 @@ Page instproc validate_name {name} { upvar nls_language nls_language my set data [self] ;# for the time being; change clobbering when validate_name becomes a method - return [::xowiki::validate_name] + set success [::xowiki::validate_name] + if {$success} { + # set the instance variable with a potentially prefixed name + # the classical validators do just an upvar + my set name $name + } + return $success } Page instproc update_references {page_id references} { @@ -969,6 +975,7 @@ # 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. @@ -977,17 +984,28 @@ foreach name_and_spec [$page_template form_constraints] { foreach {spec_name short_spec} [split $name_and_spec :] break if {$spec_name eq $name} { + #my msg "get_short_spec $name returns 1 $short_spec" return $short_spec } } + # in case not found, look for name prefixed with _, in cases + # we refer to instance variables of the page + #foreach name_and_spec [$page_template form_constraints] { + # foreach {spec_name short_spec} [split $name_and_spec :] break + # if {"_$spec_name" eq $name} { + # my msg "get_short_spec $name returns 2 $short_spec" + # return $short_spec + # } + #} } return "" } + PageInstance instproc get_field_label {name value} { set short_spec [my get_short_spec $name] if {$short_spec ne ""} { set f [FormField new -volatile -name $name -spec $short_spec] - return [$f renderValue $value] + return [$f pretty_value $value] } return $value } @@ -1154,13 +1172,26 @@ [my query_parameter "return_url" [$package_id pretty_link [$f name]]?m=edit] } + Form proc disable_input_fields {form} { + dom parse -simple -html $form doc + $doc documentElement root + # TODO: other input fields (select, textarea) + set fields [$root selectNodes "//*\[@name != ''\]"] + foreach field $fields { + if {[$field nodeName] ne "input"} continue + $field setAttribute disabled "disabled" + } + return [$root asHTML] + } + Form instproc get_content {} { my instvar text - my log "-- text='$text'" + #my log "-- text='$text'" if {[lindex $text 0] ne ""} { set content [my substitute_markup [my set text]] } else { - set content [lindex [my set form] 0] + set form [lindex [my set form] 0] + set content [[self class] disable_input_fields $form] } return $content } @@ -1216,7 +1247,7 @@ dom parse -simple -html $form doc $doc documentElement root my set_form_data - return [$root asHTML] + return [Form disable_input_fields [$root asHTML]] } }