--- loncom/interface/lontemplate.pm 2010/04/27 02:44:57 1.44 +++ loncom/interface/lontemplate.pm 2012/12/18 15:46:34 1.46 @@ -1,7 +1,7 @@ # The LearningOnline Network # "Template" Functions to generate html output # -# $Id: lontemplate.pm,v 1.44 2010/04/27 02:44:57 faziophi Exp $ +# $Id: lontemplate.pm,v 1.46 2012/12/18 15:46:34 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -128,9 +128,9 @@ sub print_end_template { sub print_editbox_template { my ($r,$content,$field) = @_; $r->print('
'); + &HTML::Entities::encode($content,'"&<>'). + '
'."\n"); + &print_saveall_template($r); } sub print_textarea_template { @@ -170,14 +170,18 @@ sub print_template_fields { $r->print("
"); &Apache::lontemplate::print_textarea_template($r, $data{$field}, $field, $default_rich_text); - &Apache::lontemplate::print_saveall_template($r); + &print_saveall_template($r); $r->print("
"); } &Apache::lontemplate::print_end_template($r); } else { my $safeinit; - $r->print(&Apache::lonxml::xmlparse($r,'tex','

'.$fields{$field}.'

')); - $r->print(&Apache::lonxml::xmlparse($r,'tex',$message)); + if ($fields{$field}=~/\w/) { + $r->print(&Apache::lonxml::xmlparse($r,'tex','

'.$fields{$field}.'

')); + } else { + $r->print(&Apache::lonxml::xmlparse($r,'tex','
')); + } + $r->print(&Apache::lonxml::xmlparse($r,'tex',$message)); } push(@html_ids,$field); }