Diff for /loncom/homework/optionresponse.pm between versions 1.162 and 1.167

version 1.162, 2010/02/05 23:02:39 version 1.167, 2010/08/23 04:43:04
Line 179  ENDTABLE Line 179  ENDTABLE
   }    }
   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') {      if($env{'form.pdfFormFields'} ne 'yes') {
       $result .= ' \renewcommand{\labelenumi}{\Alph{enumi}.}        $result .= ' \begin{itemize} ';
                    \begin{enumerate} ';  
     } else {      } else {
       $result .= "\\\\";        $result .= "\\\\";
     }      }
Line 259  sub end_foilgroup { Line 258  sub end_foilgroup {
     $responsestr;      $responsestr;
  $Apache::lonhomework::results{"resource.$part.$id.submissiongrading"}=$gradestr;   $Apache::lonhomework::results{"resource.$part.$id.submissiongrading"}=$gradestr;
   
  if ($Apache::lonhomework::type eq 'survey') {   if (($Apache::lonhomework::type eq 'survey') ||
               ($Apache::lonhomework::type eq 'surveycred') ||
               ($Apache::lonhomework::type eq 'anonsurvey') ||
               ($Apache::lonhomework::type eq 'anonsurveycred')) {
     if ($ignored == 0) {      if ($ignored == 0) {
  my $ad=$Apache::lonhomework::results{"resource.$part.$id.awarddetail"}='SUBMITTED';                  my $ad;
                   if ($Apache::lonhomework::type eq 'anonsurveycred') {
                       $ad=$Apache::lonhomework::results{"resource.$part.$id.awarddetail"}='ANONYMOUS_CREDIT';
                   } elsif ($Apache::lonhomework::type eq 'anonsurvey') {
                       $ad=$Apache::lonhomework::results{"resource.$part.$id.awarddetail"}='ANONYMOUS';
                   } elsif ($Apache::lonhomework::type eq 'surveycred') {
                       $ad=$Apache::lonhomework::results{"resource.$part.$id.awarddetail"}='SUBMITTED_CREDIT';
                   } else {
       $ad=$Apache::lonhomework::results{"resource.$part.$id.awarddetail"}='SUBMITTED';
                   }
  &Apache::response::handle_previous(\%previous,$ad);   &Apache::response::handle_previous(\%previous,$ad);
     } elsif ($wrong==0 && $right==0) {      } elsif ($wrong==0 && $right==0) {
     } else {      } else {
Line 315  sub end_foilgroup { Line 326  sub end_foilgroup {
   }    }
   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') {      if($env{'form.pdfFormFields'} ne 'yes') {
       $result .= '\end{enumerate}';        $result .= '\end{itemize}'; 
     } else {      } else {
       $result .= "\\\\";        $result .= "\\\\";
     }      }
Line 423  sub displayfoils { Line 434  sub displayfoils {
     my $temp=1;      my $temp=1;
     foreach $name (@whichopt) {      foreach $name (@whichopt) {
  my $text=$Apache::response::foilgroup{$name.'.text'};   my $text=$Apache::response::foilgroup{$name.'.text'};
  my %lastresponse=&Apache::lonnet::str2hash($Apache::lonhomework::history{"resource.$part.$id.submission"});          my $lastresp;
           unless ((($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurvey') || ($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurveycred')) && (defined($env{'form.grade_symb'}))) {
               $lastresp = $Apache::lonhomework::history{"resource.$part.$id.submission"};
           }
    my %lastresponse=&Apache::lonnet::str2hash($lastresp);
  my $lastopt=$lastresponse{$name};   my $lastopt=$lastresponse{$name};
  if ($text!~/^\s*$/) { $break='<br />'; }   if ($text!~/^\s*$/) { $break='<br />'; }
  $result.=$break;   $result.=$break;
Line 451  sub displayfoils { Line 466  sub displayfoils {
     my $internal_counter=$Apache::lonxml::counter;      my $internal_counter=$Apache::lonxml::counter;
     my $checkboxopt=&check_box_opt($target,$checkboxvalue,@opt);      my $checkboxopt=&check_box_opt($target,$checkboxvalue,@opt);
     if ($checkboxopt) {      if ($checkboxopt) {
        $result.='<br />'.&mt('Choices: ').'<b>'.$opt[0].','.$opt[1].'</b>. '.         $result.='<br />'.&mt('Select all that are <b>[_1]</b>.',$checkboxopt);
                 &mt('Select all that are <b>[_1]</b>.',$checkboxopt);  
     }      }
     foreach $name (@whichopt) {      foreach $name (@whichopt) {
       my $text=$Apache::response::foilgroup{$name.'.text'};        my $text=$Apache::response::foilgroup{$name.'.text'};
Line 476  sub displayfoils { Line 490  sub displayfoils {
   my $escopt=&HTML::Entities::encode($option,'\'"&<>');    my $escopt=&HTML::Entities::encode($option,'\'"&<>');
           if ($option eq $lastopt) {            if ($option eq $lastopt) {
               if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes'                if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes'
                   && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {                    && $Apache::inputtags::status[-1] eq 'CAN_ANSWER'
                     && $Apache::lonhomework::type ne 'exam') {
                   $optionlist .= &Apache::lonxml::print_pdf_add_combobox_option($option);                    $optionlist .= &Apache::lonxml::print_pdf_add_combobox_option($option);
               } else {                } else {
                   $optionlist.="<option value='".$escopt."' selected=\"selected\">$option</option>\n";                    $optionlist.="<option value='".$escopt."' selected=\"selected\">$option</option>\n";
               }                }
           } else {            } else {
               if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes'                if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes'
                   && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {                    && $Apache::inputtags::status[-1] eq 'CAN_ANSWER'
                     && $Apache::lonhomework::type ne 'exam') {
                   $optionlist .= &Apache::lonxml::print_pdf_add_combobox_option($option);                    $optionlist .= &Apache::lonxml::print_pdf_add_combobox_option($option);
               } else {                } else {
                   $optionlist.="<option value='".$escopt."'>$option</option>\n";                    $optionlist.="<option value='".$escopt."'>$option</option>\n";
Line 565  sub displayfoils { Line 581  sub displayfoils {
       }        }
   }    }
   if ($Apache::lonhomework::type eq 'exam') {    if ($Apache::lonhomework::type eq 'exam') {
       $result.='\vskip -1 mm\noindent\begin{enumerate}\item[\textbf{'.        $result.='\vskip -1 mm\noindent';
   $internal_counter.'}.]'.&bubbles(\@alphabet,\@opt).                $result.= '\textbf{'. $internal_counter.'}. \vskip -3mm'.&bubbles(\@alphabet,\@opt).
   '\end{enumerate} \vskip -8 mm \strut ';                   ' \strut ';
       $internal_counter++;        $internal_counter++;
   }    }
           if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes'            if ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes'
               && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {                && $Apache::inputtags::status[-1] eq 'CAN_ANSWER'
                 && $Apache::lonhomework::type ne 'exam') {
               $text =~ s/\\item//m;                $text =~ s/\\item//m;
               $result .= " $optionlist ". &Apache::lonxml::print_pdf_end_combobox($text).'\strut \\\\';                $result .= " $optionlist ". &Apache::lonxml::print_pdf_end_combobox($text).'\strut \\\\';
               $temp++;                $temp++;
Line 673  sub bubbles { Line 690  sub bubbles {
   
  $current_length += (length($opt[$ind])+length($alphabet[$ind])+4)*2;   $current_length += (length($opt[$ind])+length($alphabet[$ind])+4)*2;
  if ($current_length<($textwidth-$leftmargin) and $ind!=$number_of_bubbles) {   if ($current_length<($textwidth-$leftmargin) and $ind!=$number_of_bubbles) {
     $line.='\hskip -1 mm {\small \textbf{'.$alphabet[$ind].'}}$\bigcirc$\hskip -1 mm & \hskip -3 mm {\small '.$opt[$ind].'} & ';      $line.='\hskip 1pc {\small \textbf{'.$alphabet[$ind].'}}$\bigcirc$\hskip -1 mm & \hskip -3 mm {\small '.$opt[$ind].'} & ';
     $head.='lr';      $head.='lr';
  } else {   } else {
     $line=~s/\&\s*$//;      $line=~s/\&\s*$//;

Removed from v.1.162  
changed lines
  Added in v.1.167


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