Diff for /loncom/homework/optionresponse.pm between versions 1.151.2.1 and 1.152

version 1.151.2.1, 2008/12/11 01:59:01 version 1.152, 2008/09/11 17:38:14
Line 45  sub start_optionresponse { Line 45  sub start_optionresponse {
   %Apache::hint::option=();    %Apache::hint::option=();
   undef(%Apache::response::foilnames);    undef(%Apache::response::foilnames);
   if ($target eq 'edit') {    if ($target eq 'edit') {
     $result.=&Apache::edit::start_table($token)      $result.=&Apache::edit::start_table($token).
        .'<tr><td><span class="LC_nobreak">'.&mt('Multiple Option Response Question').'</span> '   "<tr><td>Multiple Option Response Question ".
        .&Apache::loncommon::help_open_topic('Option_Response_Problems')."</td>"   &Apache::loncommon::help_open_topic('Option_Response_Problems')."</td><td>Delete:".
        .'<td><span class="LC_nobreak">'.&mt('Delete?').' '   &Apache::edit::deletelist($target,$token)
        .&Apache::edit::deletelist($target,$token)   ."</td><td>&nbsp;".
        .'</span></td>'          &Apache::edit::end_row().
        ."<td>&nbsp;"          &Apache::edit::start_spanning_row().
        .&Apache::edit::end_row()          "\n";
        .&Apache::edit::start_spanning_row()  
        ."\n";  
     $result.=&Apache::edit::text_arg('Max Number Of Shown Foils:','max',      $result.=&Apache::edit::text_arg('Max Number Of Shown Foils:','max',
      $token,'4').       $token,'4').
         &Apache::edit::select_arg('Randomize Foil Order:','randomize',          &Apache::edit::select_arg('Randomize Foil Order','randomize',
   ['yes','no'],$token).    ['yes','no'],$token).
         &Apache::edit::select_arg(&mt('Display of options when printed'),'TeXlayout',          &Apache::edit::select_arg(&mt('Display of options when printed'),'TeXlayout',
   [['horizontal','Normal list'],    [['horizontal',&mt('Normal list')],
    ['vertical','Listed in a vertical column']],$token).     ['vertical',&mt('Listed in a vertical column')]],$token).
         &Apache::edit::end_row().&Apache::edit::start_spanning_row();          &Apache::edit::end_row().&Apache::edit::start_spanning_row();
   } elsif ($target eq 'modified') {    } elsif ($target eq 'modified') {
     my $constructtag=&Apache::edit::get_new_args($token,$parstack,      my $constructtag=&Apache::edit::get_new_args($token,$parstack,
Line 161  ENDTABLE Line 159  ENDTABLE
     } # else nothing changed so just use the default mechanism      } # else nothing changed so just use the default mechanism
   }    }
   if ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') {    if ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') {
       if($env{'form.pdfFormFields'} ne 'yes') {
       $result .= ' \renewcommand{\labelenumi}{\Alph{enumi}.}        $result .= ' \renewcommand{\labelenumi}{\Alph{enumi}.}
                    \begin{enumerate} ';                     \begin{enumerate} ';
       } else {
         $result .= "\\\\";
       }
   }    }
   return $result;    return $result;
 }  }
Line 292  sub end_foilgroup { Line 294  sub end_foilgroup {
     $result.=&Apache::edit::end_table();      $result.=&Apache::edit::end_table();
   }    }
   if ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') {    if ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') {
       if($env{'form.pdfFormFields'} ne 'yes') {
       $result .= '\end{enumerate}';        $result .= '\end{enumerate}';
       } else {
         $result .= "\\\\";
       }
   }    }
   &Apache::response::poprandomnumber();    &Apache::response::poprandomnumber();
   return $result;    return $result;
Line 425  sub displayfoils { Line 431  sub displayfoils {
       }        }
       my $lastopt=$lastresponse{$name};        my $lastopt=$lastresponse{$name};
       my $optionlist="<option></option>\n";        my $optionlist="<option></option>\n";
   
         if($target eq 'tex' and $env{'form.pdfFormFields'} eq 'yes') {
             my $fieldname = $env{'request.symb'}.'&part_'.$Apache::inputtags::part.'&optionresponse'.'&HWVAL_'.$Apache::inputtags::response['-1'].':'.$temp;
             $optionlist =  &Apache::lonxml::print_pdf_start_combobox($fieldname);
         }
   
       foreach my $option (@opt) {        foreach my $option (@opt) {
   my $escopt=&HTML::Entities::encode($option,'\'"&<>');    my $escopt=&HTML::Entities::encode($option,'\'"&<>');
   if ($option eq $lastopt) {            if ($option eq $lastopt) {
       $optionlist.="<option value='".$escopt."' selected=\"selected\">$option</option>\n";                if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes') {
   } else {                    $optionlist .= &Apache::lonxml::print_pdf_add_combobox_option($option);
       $optionlist.="<option value='".$escopt."'>$option</option>\n";                } else {
   }                    $optionlist.="<option value='".$escopt."' selected=\"selected\">$option</option>\n";
                 }
             } else {
                 if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes') {
                     $optionlist .= &Apache::lonxml::print_pdf_add_combobox_option($option);
                 } else {
                     $optionlist.="<option value='".$escopt."'>$option</option>\n";
                 }
             }
       }        }
       if ($target ne 'tex') {        if ($target ne 'tex') {
   if ($Apache::lonhomework::type ne 'exam') {    if ($Apache::lonhomework::type ne 'exam') {
Line 469  sub displayfoils { Line 489  sub displayfoils {
   if ($text=~m/\\item /) {    if ($text=~m/\\item /) {
       if ($Apache::lonhomework::type eq 'exam') {        if ($Apache::lonhomework::type eq 'exam') {
           $text=~s/\\item/\\vskip 2 mm/;            $text=~s/\\item/\\vskip 2 mm/;
       }        } elsif ($env{'form.pdfFormFields'} ne 'yes') {
       $result.= $texoptionlist.$text;                    $result.= $texoptionlist.$text;
   } else {                }
             } else {
       if ($Apache::lonhomework::type eq 'exam') {        if ($Apache::lonhomework::type eq 'exam') {
   $result.= $texoptionlist.'  '.$text;    $result.= $texoptionlist.'  '.$text;
       } else {        } elsif ($env{'form.pdfFormFields'} ne 'yes') {
   if ($text=~/\S/) {$result.= $texoptionlist.'\vspace*{-2 mm}\item '.$text;} else {$result.= $texoptionlist;}    if ($text=~/\S/) {
                         $result.= $texoptionlist.'\vspace*{-2 mm}\item '.$text;
                     } else {
                         $result.= $texoptionlist;
                     }
       }        }
   }    }
   if ($Apache::lonhomework::type eq 'exam') {    if ($Apache::lonhomework::type eq 'exam') {
Line 484  sub displayfoils { Line 509  sub displayfoils {
   '\end{enumerate} \vskip -8 mm \strut ';    '\end{enumerate} \vskip -8 mm \strut ';
       $internal_counter++;        $internal_counter++;
   }    }
             if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes') {
                 $text =~ s/.*indent(.*)$/$1/;
                 $text = $1;
                 $result .= " $optionlist ". &Apache::lonxml::print_pdf_end_combobox($text).'\strut \\\\';
                 $temp++;
             }
   $displayoptionintex=0;    $displayoptionintex=0;
       }        }
     }      }

Removed from v.1.151.2.1  
changed lines
  Added in v.1.152


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