--- loncom/homework/edit.pm 2004/08/19 21:03:23 1.84.2.1 +++ loncom/homework/edit.pm 2005/03/17 13:56:32 1.91 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # edit mode helpers # -# $Id: edit.pm,v 1.84.2.1 2004/08/19 21:03:23 albertel Exp $ +# $Id: edit.pm,v 1.91 2005/03/17 13:56:32 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -68,10 +68,9 @@ sub tag_start { # "</tr><tr><td colspan=\"3\">\n"; my @help = Apache::lonxml::helpinfo($token); if ($help[0]) { - $result .= '<td align="right" valign="top">' . - Apache::loncommon::help_open_topic(@help) . - '</td>'; - } else { $result .= "<td> </td>"; } + $result .= '</td><td align="right" valign="top">' . + Apache::loncommon::help_open_topic(@help); + } else { $result .= "</td><td> "; } $result .= &end_row().&start_spanning_row(); } return $result; @@ -191,7 +190,7 @@ sub get_insert_list { $descrip."</option>\n"; } foreach my $option (sort(keys(%options))) {$result.=$options{$option};} - if ($result) { $result='<option selected="on"></option>'.$result; } + if ($result) { $result='<option selected="selected"></option>'.$result; } } return $result; } @@ -240,7 +239,7 @@ sub handle_insert { } } else { my $newtag=$Apache::lonxml::insertlist{"$tagnum.tag"}; - &Apache::lonxml::error("Unable to insert tag $newtag, $func was not defined."); + &Apache::lonxml::error("Unable to insert tag ".$Apache::lonxml::curdepth." ($tagnum) $newtag, func was not defined."); } } return $result; @@ -282,6 +281,11 @@ sub insert_responseparam { <responseparam />'; } +sub insert_parameter { + return ' + <parameter />'; +} + sub insert_formularesponse { return ' <formularesponse answer="" samples=""> @@ -296,6 +300,8 @@ sub insert_formularesponse { sub insert_numericalresponse { return ' <numericalresponse answer=""> +<responseparam type="tolerance" default="5%" name="tol" description="Numerical Tolerance" /> +<responseparam name="sig" type="int_range,0-16" default="0,15" description="Significant Figures" /> <textline /> <hintgroup> <startouttext /><endouttext /> @@ -324,6 +330,8 @@ sub insert_imageresponse { return ' <imageresponse max="1"> <foilgroup> + <foil> + </foil> </foilgroup> <hintgroup> <startouttext /><endouttext /> @@ -335,6 +343,9 @@ sub insert_optionresponse { return ' <optionresponse max="10"> <foilgroup options=""> + <foil> + <startouttext /><endouttext /> + </foil> </foilgroup> <hintgroup> <startouttext /><endouttext /> @@ -362,6 +373,9 @@ sub insert_radiobuttonresponse { return ' <radiobuttonresponse max="10"> <foilgroup> + <foil> + <startouttext /><endouttext /> + </foil> </foilgroup> <hintgroup> <startouttext /><endouttext /> @@ -383,6 +397,9 @@ sub insert_rankresponse { return ' <rankresponse max="10"> <foilgroup options=""> + <foil> + <startouttext /><endouttext /> + </foil> </foilgroup> <hintgroup> <startouttext /><endouttext /> @@ -396,6 +413,9 @@ sub insert_matchresponse { <foilgroup options=""> <itemgroup> </itemgroup> + <foil> + <startouttext /><endouttext /> + </foil> </foilgroup> <hintgroup> <startouttext /><endouttext /> @@ -408,8 +428,7 @@ sub insert_displaytitle { return '<dis sub insert_hintpart { return ' <hintpart on="default"> - <startouttext/> - <endouttext /> + <startouttext/><endouttext /> </hintpart>'; } @@ -501,11 +520,13 @@ sub editfield { push @Apache::lonxml::htmlareafields,'homework_edit_'. $Apache::lonxml::curdepth; } - return $description."\n".' <textarea rows="'.$rows. + return $description."\n".' <textarea style="width:100%" rows="'.$rows. '" cols="'.$cols.'" name="homework_edit_'. $Apache::lonxml::curdepth.'" id="homework_edit_'. $Apache::lonxml::curdepth.'">'. - &HTML::Entities::encode($data,'<>&"').'</textarea>'."\n"; + &HTML::Entities::encode($data,'<>&"').'</textarea>'. + ($usehtmlarea?&Apache::lonhtmlcommon::spelllink('lonhomework', + 'homework_edit_'.$Apache::lonxml::curdepth):'')."\n"; } sub modifiedfield { @@ -606,7 +627,7 @@ sub checked_arg { &html_element_name($name)."'"; foreach my $selected (split(/,/,$allselected)) { if ( $selected eq $option ) { - $result.=" checked='on' "; + $result.=" checked='checked' "; last; } } @@ -641,7 +662,7 @@ sub select_arg { $value='value="'.$option.'"'; } if ( $selected eq $option ) { - $optionlist.="<option $value selected=\"on\">$text</option>\n"; + $optionlist.="<option $value selected=\"selected\">$text</option>\n"; } else { $optionlist.="<option $value >$text</option>\n"; } @@ -670,14 +691,14 @@ sub select_or_text_arg { $value='value="'.$option.'"'; } if ( $selected eq $option ) { - $optionlist.="<option $value selected=\"on\">$text</option>\n"; + $optionlist.="<option $value selected=\"selected\">$text</option>\n"; $found=1; } else { $optionlist.="<option $value>$text</option>\n"; } } $optionlist.="<option value=\"TYPEDINVALUE\"". - ((!$found)?' selected="on"':''). + ((!$found)?' selected="selected"':''). ">".&mt('Type-in value')."</option>\n"; # my $element=&html_element_name($name);