--- loncom/homework/edit.pm 2008/12/10 21:02:01 1.119 +++ loncom/homework/edit.pm 2010/06/04 23:03:55 1.126 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # edit mode helpers # -# $Id: edit.pm,v 1.119 2008/12/10 21:02:01 raeburn Exp $ +# $Id: edit.pm,v 1.126 2010/06/04 23:03:55 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -26,6 +26,8 @@ # http://www.lon-capa.org/ # +=pod + =head1 NAME Apache::edit - edit mode helpers @@ -202,7 +204,7 @@ sub start_table { $Apache::edit::colordepth++; push(@Apache::edit::inserttag,$token->[1]); my $result='<div align="right">'; - $result.='<table bgcolor="'.$color.'" width="97%" border="0" cellspacing="5" cellpadding="3">'; + $result.='<table bgcolor="'.$color.'" width="97%" border="0" cellspacing="3" cellpadding="2">'; return $result; } @@ -230,7 +232,7 @@ sub end_table { return $result; } -sub start_spanning_row { return '<tr><td colspan="5" bgcolor="#DDDDDD">';} +sub start_spanning_row { return '<tr><td colspan="5" bgcolor="#F0F0F0">';} sub start_row { return '<tr><td bgcolor="#DDDDDD">'; } sub end_row { return '</td></tr>'; } @@ -355,7 +357,7 @@ sub do_insert { my $depth = scalar(@Apache::lonxml::depthcounter); $depth -- if ($after); my $inset = "\t"x$depth; - $result.="\n$inset<$newtag>\n$inset</$newtag>"; + $result.="\n$inset<$newtag></$newtag>"; } else { if (defined(&$func)) { { @@ -612,6 +614,18 @@ sub insert_numericalhint { </numericalhint>'; } +sub insert_reactionhint { + return ' +<reactionhint> +</reactionhint>'; +} + +sub insert_organichint { + return ' +<organichint> +</organichint>'; +} + sub insert_stringhint { return ' <stringhint> @@ -871,23 +885,25 @@ sub select_arg { my $result; my $optionlist=""; my $selected=$token->[2]{$name}; - foreach my $option (@$list) { - my ($text,$value); - if ( ref($option) eq 'ARRAY') { - $value='value="'.&HTML::Entities::encode($$option[0]).'"'; - $text=$$option[1]; - $option=$$option[0]; - } else { - $text=$option; - $value='value="'.&HTML::Entities::encode($option,'\'"&<>').'"'; - } - if ( $selected eq $option ) { - $optionlist.="<option $value selected=\"selected\">".&mt($text)."</option>\n"; - } else { - $optionlist.="<option $value >".&mt($text)."</option>\n"; - } + if (ref($list) eq 'ARRAY') { + foreach my $option (@{$list}) { + my ($text,$value); + if (ref($option) eq 'ARRAY') { + $value='value="'.&HTML::Entities::encode($option->[0]).'"'; + $text=$option->[1]; + $option=$option->[0]; + } else { + $text=$option; + $value='value="'.&HTML::Entities::encode($option,'\'"&<>').'"'; + } + if ( $selected eq $option ) { + $optionlist.="<option $value selected=\"selected\">".&mt($text)."</option>\n"; + } else { + $optionlist.="<option $value >".&mt($text)."</option>\n"; + } + } } - $result.='<span class="LC_nobreak>'.&mt($description).' <select name="'. + $result.='<span class="LC_nobreak">'.&mt($description).' <select name="'. &html_element_name($name).'" '.&element_change_detection().' > '.$optionlist.' </select></span>'; @@ -900,22 +916,24 @@ sub select_or_text_arg { my $optionlist=""; my $found=0; my $selected=$token->[2]{$name}; - foreach my $option (@$list) { - my ($text,$value); - if ( ref($option) eq 'ARRAY') { - $value='value="'.&HTML::Entities::encode($$option[0]).'"'; - $text=$$option[1]; - $option=$$option[0]; - } else { - $text=$option; - $value='value="'.&HTML::Entities::encode($option,'\'"&<>').'"'; - } - if ( $selected eq $option ) { - $optionlist.="<option $value selected=\"selected\">$text</option>\n"; - $found=1; - } else { - $optionlist.="<option $value>$text</option>\n"; - } + if (ref($list) eq 'ARRAY') { + foreach my $option (@{$list}) { + my ($text,$value); + if (ref($option) eq 'ARRAY') { + $value='value="'.&HTML::Entities::encode($option->[0]).'"'; + $text=$option->[1]; + $option=$option->[0]; + } else { + $text=$option; + $value='value="'.&HTML::Entities::encode($option,'\'"&<>').'"'; + } + if ( $selected eq $option ) { + $optionlist.="<option $value selected=\"selected\">$text</option>\n"; + $found=1; + } else { + $optionlist.="<option $value>$text</option>\n"; + } + } } $optionlist.="<option value=\"TYPEDINVALUE\"". ((!$found)?' selected="selected"':''). @@ -1023,7 +1041,7 @@ sub entercoord { } sub deletecoorddata { - &Apache::lonnet::delenv("imagechoice\\."); + &Apache::lonnet::delenv('imagechoice.'); } #----------------------------------------------------- browse