Index: openacs-4/packages/forums/tcl/form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/form-procs.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/forums/tcl/form-procs.tcl 8 Nov 2017 12:05:55 -0000 1.13 +++ openacs-4/packages/forums/tcl/form-procs.tcl 3 Sep 2024 15:37:38 -0000 1.14 @@ -22,25 +22,24 @@ # Form definition # + set optional_switch [list] if { $optional_p } { - set optional_switch "-optional" - } else { - set optional_switch "" + lappend optional_switch -optional } template::element create $form_name ${prefix}subject \ -label [_ forums.Subject] \ -datatype text \ -widget text \ - -html {size 60} \ - $optional_switch + -html {maxlength 200 size 60} \ + {*}$optional_switch template::element create $form_name ${prefix}message_body \ -label [_ forums.Body] \ -datatype richtext \ -widget richtext \ -html {rows 20 cols 60 style {width:100%}} \ - $optional_switch + {*}$optional_switch } @@ -75,7 +74,7 @@ template::element create $form_name ${prefix}anonymous_p \ -label [_ forums.Anonymous] \ -datatype integer \ - -widget [ad_decode $show_anonymous_p 0 "hidden" "checkbox"] \ + -widget [expr {$show_anonymous_p ? "checkbox" : "hidden"}] \ -options $options \ -optional @@ -84,7 +83,7 @@ template::element create $form_name ${prefix}attach_p \ -label [_ forums.Attach] \ -datatype text \ - -widget [ad_decode $show_attachments_p 0 "hidden" "radio"] \ + -widget [expr {$show_attachments_p ? "radio" : "hidden"}] \ -options $options if {$optional_p} { @@ -123,7 +122,7 @@ {-prefix {}} form_name } { - Constructs the elements of a form for searching for a term + Constructs the elements of a form for searching for a term optionally in a particular forum } { template::element create $form_name ${prefix}search_text \ @@ -145,19 +144,19 @@ Constructs the elements of a form for creating/editing a forum } { template::element create $form_name ${prefix}name \ - -label [_ forums.Name] \ - -datatype text \ - -widget text \ - -html {size 60} \ - -validate { {expr {[string trim $value] ne ""}} {Forum Name can not be blank} } + -label [_ forums.Name] \ + -datatype text \ + -widget text \ + -html {size 60} \ + -validate { {expr {[string trim $value] ne ""}} {Forum Name can not be blank} } template::element create $form_name ${prefix}charter \ - -label [_ forums.Charter] \ - -datatype richtext \ - -widget richtext \ - -html {cols 60 rows 10 style {width: 100%}} \ - -validate { {expr {[string length $value] <= 4000} } {\#forums.charter_max_chars#} } \ - -optional + -label [_ forums.Charter] \ + -datatype richtext \ + -widget richtext \ + -html {cols 60 rows 10 style {width: 100%}} \ + -validate { {expr {[string length $value] <= 4000} } {\#forums.charter_max_chars#} } \ + -optional template::element create $form_name ${prefix}presentation_type \ -label [_ forums.Presentation] \ @@ -185,6 +184,14 @@ -widget radio \ -help_text [_ forums.help_new_threads] \ -options [list [list [_ forums.Yes] t] [list [_ forums.No] f] ] + + if {[forum::attachments_enabled_p]} { + template::element create $form_name ${prefix}attachments_allowed_p \ + -label [_ forums.lt_Users_Can_Add_Attachments] \ + -datatype text \ + -widget radio \ + -options [list [list [_ forums.Yes] t] [list [_ forums.No] f] ] + } } # Local variables: