Diff for /loncom/homework/lonsimpleproblemedit.pm between versions 1.28 and 1.29

version 1.28, 2009/10/16 17:23:51 version 1.29, 2009/10/19 15:15:03
Line 71  sub questiontext { Line 71  sub questiontext {
     return (<<ENDQUESTION);      return (<<ENDQUESTION);
 <table bgcolor="#dddd22" cellspacing="4" cellpadding="2" style="width:100%">  <table bgcolor="#dddd22" cellspacing="4" cellpadding="2" style="width:100%">
 <tr><td><b>$qt</b><br />  <tr><td><b>$qt</b><br />
 <textarea style="width:100%" name="questiontext" cols="80" rows="8">$text</textarea>  <textarea style="width:99%" name="questiontext" cols="80" rows="8">$text</textarea>
 <br />$spell_link  <br />$spell_link
 </td></tr>  </td></tr>
 </table>  </table>
Line 85  sub hint { Line 85  sub hint {
     my $spell_link=      my $spell_link=
  &Apache::lonhtmlcommon::spelllink('simpleedit','hinttext');   &Apache::lonhtmlcommon::spelllink('simpleedit','hinttext');
     return (<<ENDHINT);      return (<<ENDHINT);
 <table bgcolor="#accacc" cellspacing="4" cellpadding="2">  <table bgcolor="#accacc" cellspacing="4" cellpadding="2" style="width:100%">
 <tr><td><b>$ht</b><br />  <tr><td><b>$ht</b><br />
 <textarea style="width:100%" name="hinttext" cols="80" rows="4">$text</textarea>  <textarea style="width:99%" name="hinttext" cols="80" rows="4">$text</textarea>
 <br />$spell_link  <br />$spell_link
 </td></tr>  </td></tr>
 </table>  </table>
Line 99  sub script { Line 99  sub script {
     my $text=$qparms{$prefix.'numericalscript'};      my $text=$qparms{$prefix.'numericalscript'};
     my $ht=&mt('Scripting (optional)');      my $ht=&mt('Scripting (optional)');
     return (<<ENDSCRIPT);      return (<<ENDSCRIPT);
 <table bgcolor="#ccccaa" cellspacing="4" cellpadding="2">  <table bgcolor="#ccccaa" cellspacing="4" cellpadding="2" style="width:100%">
 <tr><td><b>$ht</b><br />  <tr><td><b>$ht</b><br />
 <textarea style="width:100%" name="numericalscript" cols="80" rows="4">$text</textarea>  <textarea style="width:99%" name="numericalscript" cols="80" rows="4">$text</textarea>
 </td></tr>  </td></tr>
 </table>  </table>
 <br />  <br />
Line 141  sub foil { Line 141  sub foil {
     my $spell_link=      my $spell_link=
  &Apache::lonhtmlcommon::spelllink('simpleedit',"text$number");   &Apache::lonhtmlcommon::spelllink('simpleedit',"text$number");
     return (<<ENDFOIL);      return (<<ENDFOIL);
 <table bgcolor="#E8D8EE" cellspacing="2" cellpadding="1">  <table bgcolor="#E8D8EE" cellspacing="2" cellpadding="1" style="width:100%">
 <tr><td colspan="2"><b>$lt{'foil'}</b></td></tr>  <tr><td colspan="2"><b>$lt{'foil'}</b></td></tr>
 <tr><td>$lt{'value'}: $selectvalue</td><td>$lt{'pos'}: $selectposition</td></tr>  <tr><td>$lt{'value'}: $selectvalue</td><td>$lt{'pos'}: $selectposition</td></tr>
 <tr><td colspan="2">$lt{'text'}:<br />  <tr><td colspan="2">$lt{'text'}:<br />
Line 251  sub handler { Line 251  sub handler {
     $r->print(&Apache::loncommon::start_page('Simple Problem Editor',      $r->print(&Apache::loncommon::start_page('Simple Problem Editor',
      $spell_header));       $spell_header));
     if ($symb) {      if ($symb) {
  $r->print('<h1>'.&Apache::lonnet::gettitle($symb).'</h1>');      my $title='<h1>'.&Apache::lonnet::gettitle($symb).'</h1>';
         my $displaylink = &get_parent_uri($symb);          my $displaylink = &get_parent_uri($symb);
         if ($displaylink ne '') {          if ($displaylink ne '') {
             my $functions=&Apache::lonhtmlcommon::start_funclist()              my $functions=&Apache::lonhtmlcommon::start_funclist()
Line 259  sub handler { Line 259  sub handler {
                               '<a href="'.$displaylink.'">'                                '<a href="'.$displaylink.'">'
                              .&mt('Student View').'</a>')                               .&mt('Student View').'</a>')
                              .&Apache::lonhtmlcommon::end_funclist();                               .&Apache::lonhtmlcommon::end_funclist();
             $r->print(&Apache::loncommon::head_subbox($functions));              $r->print(&Apache::loncommon::head_subbox($functions)
                        .$title);
         } else {          } else {
             $r->print('<p class="LC_error">'              $r->print($title
                        .'<p class="LC_error">'
                      .&mt('An error occurred retrieving the link to this problem.')                       .&mt('An error occurred retrieving the link to this problem.')
                      .'<br />'                       .'<br />'
                      .&mt('You may need to [_1]re-select the course[_2] and then return to this resource to view it.'                       .&mt('You may need to [_1]re-select the course[_2] and then return to this resource to view it.'
Line 275  sub handler { Line 277  sub handler {
                  .'</p>'                   .'</p>'
         );          );
   
  $r->print('<table border="2" bgcolor="#FFFFFF" width="100%"><tr><td>'.          $r->print(
                   &rawrendering($symb).              '<div class="LC_Box">'
                   '</td></tr></table><br />');             .&rawrendering($symb)
              .'</div>'
           );
         $r->print('<form name="simpleedit" method="post">');          $r->print('<form name="simpleedit" method="post">');
 # Question Type          # Question Type        
  my %questiontypes=('radio'  =>    my %questiontypes=('radio'  => 
Line 289  sub handler { Line 293  sub handler {
         $qtype=$qparms{$prefix.'questiontype'};          $qtype=$qparms{$prefix.'questiontype'};
         unless (defined($qtype)) { $qtype='radio'; }          unless (defined($qtype)) { $qtype='radio'; }
         unless ($questiontypes{$qtype}) { $qtype='radio'; }          unless ($questiontypes{$qtype}) { $qtype='radio'; }
         $r->print('<b>'.&mt('Question Type').          $r->print(
   ': '.&Apache::loncommon::select_form              '<fieldset style="width:400px;">'
                                ($qtype,'questiontype',%questiontypes).             .'<legend>'.&mt('Question Type').'</legend>'
   '</b><br /><input type="submit" value="'.&mt('Save and Edit').             .&Apache::loncommon::select_form
   '" /><p>&nbsp;</p>');              ($qtype,'questiontype',%questiontypes)
              .'</fieldset>'
           );
           $r->print(
               '<p>'
              .'<input type="submit" value="'.&mt('Save and Edit').'" />'
              .'</p>'
           );
 # Script  # Script
         if ($qtype eq 'numerical') {          if ($qtype eq 'numerical') {
            $r->print(&script());             $r->print(&script());
Line 313  sub handler { Line 324  sub handler {
             unless (defined($randomize)) { $randomize='yes'; }              unless (defined($randomize)) { $randomize='yes'; }
             unless ($randomizes{$randomize}) { $randomize='yes'; }              unless ($randomizes{$randomize}) { $randomize='yes'; }
     $r->print(      $r->print(
   '<table bgcolor="#00ee44" cellspacing="4" cellpadding="2">'.    '<table bgcolor="#00ee44" cellspacing="4" cellpadding="2" style="width:100%">'.
           '<tr><td>'.&mt('Max number of foils displayed').            '<tr><td>'.&mt('Max number of foils displayed').
 ': <input type="text" size="3" name="maxfoils" value="'.$maxfoils.'" />&nbsp;&nbsp;'.  ': <input type="text" size="3" name="maxfoils" value="'.$maxfoils.'" />&nbsp;&nbsp;'.
       &Apache::loncommon::select_form        &Apache::loncommon::select_form
Line 325  sub handler { Line 336  sub handler {
                 unless (defined($options)) { $options="('true','false')"; }                  unless (defined($options)) { $options="('true','false')"; }
                 my %optionshash=&evaloptionhash($options);                  my %optionshash=&evaloptionhash($options);
  $r->print(   $r->print(
   '<table bgcolor="#ffcc22" cellspacing="4" cellpadding="2">'.    '<table bgcolor="#ffcc22" cellspacing="4" cellpadding="2" style="width:100%">'.
   '<tr><td><input type="hidden" name="options" value="'.    '<tr><td><input type="hidden" name="options" value="'.
                   $options.'" />'.&mt('Add new option').': '.                    $options.'" />'.&mt('Add new option').': '.
           '<input type="text" name="newopt" size="15" />'.            '<input type="text" name="newopt" size="15" />'.
Line 358  sub handler { Line 369  sub handler {
             unless (defined($stringtype)) { $stringtype='cs'; }              unless (defined($stringtype)) { $stringtype='cs'; }
             unless ($stringtypes{$stringtype}) { $stringtype='cs'; }              unless ($stringtypes{$stringtype}) { $stringtype='cs'; }
     $r->print(      $r->print(
   '<table bgcolor="#00ee44" cellspacing="4" cellpadding="2">'.    '<table bgcolor="#00ee44" cellspacing="4" cellpadding="2" style="width:100%">'.
           '<tr><td><label>'.&mt('Correct answer').': <input type="text" size="20" name="stringanswer" value="'.$stringanswer.'" /></label>&nbsp;&nbsp;'.            '<tr><td><label>'.&mt('Correct answer').': <input type="text" size="20" name="stringanswer" value="'.$stringanswer.'" /></label>&nbsp;&nbsp;'.
       &Apache::loncommon::select_form        &Apache::loncommon::select_form
       ($stringtype,'stringtype',%stringtypes).        ($stringtype,'stringtype',%stringtypes).
Line 375  sub handler { Line 386  sub handler {
            unless (defined($numericalsigfigs)) { $numericalsigfigs='1,15'; }             unless (defined($numericalsigfigs)) { $numericalsigfigs='1,15'; }
   
            $r->print(             $r->print(
                   '<table bgcolor="#00ee44" cellspacing="4" cellpadding="2">'.                    '<table bgcolor="#00ee44" cellspacing="4" cellpadding="2" style="width:100%">'.
                   '<tr><td><label>'.&mt('Correct answer').': <input type="text" size="20" name="numericalanswer" value="'.$numericalanswer.'" /></label>&nbsp;&nbsp;'.                    '<tr><td><label>'.&mt('Correct answer').': <input type="text" size="20" name="numericalanswer" value="'.$numericalanswer.'" /></label>&nbsp;&nbsp;'.
                   '<label>'.&mt('Unit').':  <input type="text" size="5" name="numericalunit" value="'.$qparms{$prefix.'numericalunit'}.'" /></label>&nbsp;&nbsp;'.                    '<label>'.&mt('Unit').':  <input type="text" size="5" name="numericalunit" value="'.$qparms{$prefix.'numericalunit'}.'" /></label>&nbsp;&nbsp;'.
                   '<label>'.&mt('Format').':  <input type="text" size="5" name="numericalformat" value="'.$qparms{$prefix.'numericalformat'}.'" /></label>&nbsp;&nbsp;'.                    '<label>'.&mt('Format').':  <input type="text" size="5" name="numericalformat" value="'.$qparms{$prefix.'numericalformat'}.'" /></label>&nbsp;&nbsp;'.

Removed from v.1.28  
changed lines
  Added in v.1.29


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>