Diff for /loncom/homework/structuretags.pm between versions 1.301 and 1.306

version 1.301, 2005/09/23 18:39:55 version 1.306, 2005/10/18 21:46:42
Line 74  sub body_tag_start { Line 74  sub body_tag_start {
  'onunload="'.&Apache::lonmenu::unloadevents().'" ';   'onunload="'.&Apache::lonmenu::unloadevents().'" ';
     if ($env{'browser.imagesuppress'} eq 'on') { $background=''; }      if ($env{'browser.imagesuppress'} eq 'on') { $background=''; }
     if ($background) {      if ($background) {
  $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=   &Apache::lonxml::extlink($background);
     $background;  
  $body_tag_start.='background="'.$background.'" ';   $body_tag_start.='background="'.$background.'" ';
     } else {      } else {
  if (($bgcolor) && ($env{'browser.blackwhite'} ne 'on')) {   if (($bgcolor) && ($env{'browser.blackwhite'} ne 'on')) {
Line 436  sub init_problem_globals { Line 435  sub init_problem_globals {
  @Apache::inputtags::partlist=();   @Apache::inputtags::partlist=();
  $Apache::lonhomework::problemstatus='';   $Apache::lonhomework::problemstatus='';
  $Apache::lonhomework::ignore_response_errors=1;   $Apache::lonhomework::ignore_response_errors=1;
       } elsif ($type eq 'Task') {
    $Apache::inputtags::part='0';
    @Apache::inputtags::partlist=('0');
    $Apache::lonhomework::problemstatus='';
    $Apache::lonhomework::ignore_response_errors=1;
     }      }
     @Apache::inputtags::responselist = ();      @Apache::inputtags::responselist = ();
     @Apache::inputtags::importlist = ();      @Apache::inputtags::importlist = ();
Line 645  sub start_problem { Line 649  sub start_problem {
     }      }
     my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries");      my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries");
     if (defined($maxtries) && $maxtries < 0) { $allow_print_points=0; }      if (defined($maxtries) && $maxtries < 0) { $allow_print_points=0; }
       if (lc($env{'course.'.$env{'request.course.id'}.
       '.disableexampointprint'}) eq 'yes') {
    $allow_print_points=0;
       }
     my $duedate = &Apache::lonnet::EXT("resource.$id.duedate");       my $duedate = &Apache::lonnet::EXT("resource.$id.duedate"); 
     $duedate = POSIX::strftime("%c",localtime($duedate));      $duedate = POSIX::strftime("%c",localtime($duedate));
     my $temp_file;      my $temp_file;
Line 658  sub start_problem { Line 666  sub start_problem {
     my $due_file_content = $due_file_content[$#due_file_content];      my $due_file_content = $due_file_content[$#due_file_content];
     chomp $due_file_content;      chomp $due_file_content;
     my $name_of_resourse= &Apache::lonxml::latex_special_symbols(&get_resource_name($parstack,$safeeval),'header');      my $name_of_resourse= &Apache::lonxml::latex_special_symbols(&get_resource_name($parstack,$safeeval),'header');
       my $begin_doc='\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$env{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent ';
       my $toc_line='\vskip 1 mm\noindent '.$startminipage.
    '\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}';
     if ($due_file_content ne $duedate) {      if ($due_file_content ne $duedate) {
  $temp_file = Apache::File->new('>'.$filename);   $temp_file = Apache::File->new('>'.$filename);
  print $temp_file "$duedate\n";   print $temp_file "$duedate\n";
  if (not $env{'request.symb'} =~ m/\.page_/) {   if (not $env{'request.symb'} =~ m/\.page_/) {
     if(not $duedate=~m/1969/ and $Apache::lonhomework::type ne 'exam') {      if(not $duedate=~m/1969/ and $Apache::lonhomework::type ne 'exam') {
  $result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$env{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent\textit{Due date: '.$duedate.'} \vskip 1 mm\noindent '.$startminipage.'\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}';   $result .= $begin_doc.
       '\textit{Due date: '.$duedate.'} '.$toc_line;
     } else {      } else {
  $result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$env{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent \vskip 1 mm \noindent'.$startminipage.'\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}';   $result .= $begin_doc.$toc_line;
  if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) { $result .= '\fbox{\textit{'.$weight.' pt}}';}   if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
     }      }
  } else {   } else {
Line 673  sub start_problem { Line 685  sub start_problem {
  }   }
     } else {      } else {
  if (not $env{'request.symb'} =~ m/\.page_/) {   if (not $env{'request.symb'} =~ m/\.page_/) {
     $result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource <h2>"'.$name_of_resourse.'"</h2> located in <br /><small><b>'.$env{'request.uri'}.'</b></small><br /> STAMPOFPASSEDRESOURCEEND} \noindent \vskip 1 mm\noindent'.$startminipage.'\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}';      $result .= $begin_doc.$toc_line;
     if (($Apache::lonhomework::type eq 'exam') and ($allow_print_points==1)) { $result .= '\fbox{\textit{'.$weight.' pt}}';}      if (($Apache::lonhomework::type eq 'exam') and ($allow_print_points==1)) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
  } else {   } else {
     $result .= '\vskip 1mm \\\\\\\\';      $result .= '\vskip 1mm \\\\\\\\';
Line 1050  sub start_randomlist { Line 1062  sub start_randomlist {
     if ($target eq 'answer' || $target eq 'grade' || $target eq 'web' ||      if ($target eq 'answer' || $target eq 'grade' || $target eq 'web' ||
  $target eq 'tex' || $target eq 'analyze') {   $target eq 'tex' || $target eq 'analyze') {
  my $body= &Apache::lonxml::get_all_text("/randomlist",$parser);   my $body= &Apache::lonxml::get_all_text("/randomlist",$parser);
  my $b_parser= HTML::TokeParser->new(\$body);   my $b_parser= HTML::LCParser->new(\$body);
    $b_parser->xml_mode(1);
    $b_parser->marked_sections(1);
  my $b_tok;   my $b_tok;
  my @randomlist;   my @randomlist;
  my $list_item;   my $list_item;
Line 1074  sub start_randomlist { Line 1088  sub start_randomlist {
     #  print "<b>END-TAG $b_tok->[1]</b><br />";      #  print "<b>END-TAG $b_tok->[1]</b><br />";
     # }      # }
  }   }
  my @idx_arr = (0 .. $#randomlist);   if (@randomlist) {
  &Apache::structuretags::shuffle(\@idx_arr);      my @idx_arr = (0 .. $#randomlist);
  my $bodytext = '';      &Apache::structuretags::shuffle(\@idx_arr);
  my $show=$#randomlist;      my $bodytext = '';
  my $showarg=&Apache::lonxml::get_param('show',$parstack,$safeeval);      my $show=$#randomlist;
  $showarg--;      my $showarg=&Apache::lonxml::get_param('show',$parstack,$safeeval);
  if ( ($showarg >= 0) && ($showarg < $show) ) { $show = $showarg; }      $showarg--;
  for(0 .. $show) {      if ( ($showarg >= 0) && ($showarg < $show) ) { $show = $showarg; }
     $bodytext .= "$randomlist[ $idx_arr[$_] ]";      for(0 .. $show) {
    $bodytext .= "$randomlist[ $idx_arr[$_] ]";
       }
       &Apache::lonxml::newparser($parser,\$bodytext);
  }   }
  &Apache::lonxml::newparser($parser,\$bodytext);  
     } elsif ($target eq 'edit' ) {      } elsif ($target eq 'edit' ) {
  $result .=&Apache::edit::tag_start($target,$token);   $result .=&Apache::edit::tag_start($target,$token);
  $result .=&Apache::edit::text_arg('Maximum Tags to Show:','show',   $result .=&Apache::edit::text_arg('Maximum Tags to Show:','show',
Line 1101  sub start_randomlist { Line 1117  sub start_randomlist {
 sub shuffle {  sub shuffle {
     my $a=shift;      my $a=shift;
     my $i;      my $i;
     if (defined(@$a)) {      if (ref($a) eq 'ARRAY' && @$a) {
  &Apache::response::pushrandomnumber();   &Apache::response::pushrandomnumber();
  for($i=@$a;--$i;) {   for($i=@$a;--$i;) {
     my $j=int(&Math::Random::random_uniform() * ($i+1));      my $j=int(&Math::Random::random_uniform() * ($i+1));
Line 1207  sub start_part { Line 1223  sub start_part {
     if (defined($maxtries) && $maxtries < 0) {      if (defined($maxtries) && $maxtries < 0) {
  $allow_print_points=0;   $allow_print_points=0;
     }      }
       if (lc($env{'course.'.$env{'request.course.id'}.
       '.disableexampointprint'}) eq 'yes') {
    $allow_print_points=0;
       }
     if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';}      if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
  } elsif ($target eq 'web') {   } elsif ($target eq 'web') {
     $result.='<a name="'.&Apache::lonnet::escape($Apache::inputtags::part).'" />';      $result.='<a name="'.&Apache::lonnet::escape($Apache::inputtags::part).'" />';

Removed from v.1.301  
changed lines
  Added in v.1.306


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