Diff for /loncom/interface/loncommon.pm between versions 1.1199 and 1.1203

version 1.1199, 2014/11/08 18:26:06 version 1.1203, 2014/12/20 15:35:40
Line 3837  sub get_previous_attempt { Line 3837  sub get_previous_attempt {
               }                }
           } elsif ($data eq 'regrader') {            } elsif ($data eq 'regrader') {
               if (($identifier ne '') && (@parts)) {                if (($identifier ne '') && (@parts)) {
                   $regraded{$parts[-1]} = 1;                    my $id = join(',',@parts);
                     $regraded{$ign.'.'.$id} = 1;
               }                }
           }             } 
  } else {   } else {
Line 3851  sub get_previous_attempt { Line 3852  sub get_previous_attempt {
       $prevattempts.=&end_data_table_header_row();        $prevattempts.=&end_data_table_header_row();
       if ($getattempt eq '') {        if ($getattempt eq '') {
         my (%solved,%resets,%probstatus);          my (%solved,%resets,%probstatus);
  for ($version=1;$version<=$returnhash{'version'};$version++) {          if (($identifier ne '') && (keys(%regraded) > 0)) {
             if ($identifier ne '') {              for ($version=1;$version<=$returnhash{'version'};$version++) {
                 foreach my $part (keys(%regraded)) {                  foreach my $id (keys(%regraded)) {
                     if (($returnhash{$version.':resource.'.$part.'.regrader'}) &&                      if (($returnhash{$version.':'.$id.'.regrader'}) &&
                         ($returnhash{$version.':resource.'.$part.'.tries'} eq '') &&                          ($returnhash{$version.':'.$id.'.tries'} eq '') &&
                         ($returnhash{$version.':resource.'.$part.'.award'} eq '')) {                          ($returnhash{$version.':'.$id.'.award'} eq '')) {
                         push(@{$resets{$part}},$version);                          push(@{$resets{$id}},$version);
                     }                      }
                 }                  }
             }              }
           }
    for ($version=1;$version<=$returnhash{'version'};$version++) {
             my (@hidden,@unsolved);              my (@hidden,@unsolved);
             if (%typeparts) {              if (%typeparts) {
                 foreach my $id (keys(%typeparts)) {                  foreach my $id (keys(%typeparts)) {
Line 3871  sub get_previous_attempt { Line 3874  sub get_previous_attempt {
                         unless (($returnhash{$version.':'.$id.'.type'} eq 'survey') ||                          unless (($returnhash{$version.':'.$id.'.type'} eq 'survey') ||
                                 ($returnhash{$version.':'.$id.'.type'} eq 'surveycred') ||                                  ($returnhash{$version.':'.$id.'.type'} eq 'surveycred') ||
                                 ($hidestatus{$id})) {                                  ($hidestatus{$id})) {
                             next if ((ref($resets{$id}) eq 'ARRAY') && grep(/^\Q$id\E$/,@{$resets{$id}}));                              next if ((ref($resets{$id}) eq 'ARRAY') && grep(/^\Q$version\E$/,@{$resets{$id}}));
                             if ($returnhash{$version.':'.$id.'.solved'} eq 'correct_by_student') {                              if ($returnhash{$version.':'.$id.'.solved'} eq 'correct_by_student') {
                                 push(@{$solved{$id}},$version);                                  push(@{$solved{$id}},$version);
                             } elsif (($returnhash{$version.':'.$id.'.solved'} ne '') &&                              } elsif (($returnhash{$version.':'.$id.'.solved'} ne '') &&
Line 4736  END_BLOCK Line 4739  END_BLOCK
 ###############################################  ###############################################
   
 sub check_ip_acc {  sub check_ip_acc {
     my ($acc)=@_;      my ($acc,$clientip)=@_;
     &Apache::lonxml::debug("acc is $acc");      &Apache::lonxml::debug("acc is $acc");
     if (!defined($acc) || $acc =~ /^\s*$/ || $acc =~/^\s*no\s*$/i) {      if (!defined($acc) || $acc =~ /^\s*$/ || $acc =~/^\s*no\s*$/i) {
         return 1;          return 1;
     }      }
     my $allowed=0;      my $allowed=0;
     my $ip=$env{'request.host'} || $ENV{'REMOTE_ADDR'};      my $ip=$env{'request.host'} || $ENV{'REMOTE_ADDR'} || $clientip;
   
     my $name;      my $name;
     foreach my $pattern (split(',',$acc)) {      foreach my $pattern (split(',',$acc)) {
Line 7730  function set_wishlistlink(title, path) { Line 7733  function set_wishlistlink(title, path) {
         title = title.replace(/^LON-CAPA /,'');          title = title.replace(/^LON-CAPA /,'');
     }      }
     title = encodeURIComponent(title);      title = encodeURIComponent(title);
       title = title.replace("'","\\\'");
     if (!path) {      if (!path) {
         path = location.pathname;          path = location.pathname;
     }      }
     path = encodeURIComponent(path);      path = encodeURIComponent(path);
       path = path.replace("'","\\\'");
     Win = window.open('/adm/wishlist?mode=newLink&setTitle='+title+'&setPath='+path,      Win = window.open('/adm/wishlist?mode=newLink&setTitle='+title+'&setPath='+path,
                       'wishlistNewLink','width=560,height=350,scrollbars=0');                        'wishlistNewLink','width=560,height=350,scrollbars=0');
 }  }
Line 7776  var modalWindow = { Line 7781  var modalWindow = {
 };  };
  var openMyModal = function(source,width,height,scrolling,transparency,style)   var openMyModal = function(source,width,height,scrolling,transparency,style)
  {   {
                   source = source.replace("'","&#39;");
  modalWindow.windowId = "myModal";   modalWindow.windowId = "myModal";
  modalWindow.width = width;   modalWindow.width = width;
  modalWindow.height = height;   modalWindow.height = height;
Line 8383  role status: active, previous or future. Line 8389  role status: active, previous or future.
 sub check_user_status {  sub check_user_status {
     my ($udom,$uname,$cdom,$crs,$role,$sec) = @_;      my ($udom,$uname,$cdom,$crs,$role,$sec) = @_;
     my %userinfo = &Apache::lonnet::dump('roles',$udom,$uname);      my %userinfo = &Apache::lonnet::dump('roles',$udom,$uname);
     my @uroles = keys %userinfo;      my @uroles = keys(%userinfo);
     my $srchstr;      my $srchstr;
     my $active_chk = 'none';      my $active_chk = 'none';
     my $now = time;      my $now = time;
Line 14549  sub escape_url { Line 14555  sub escape_url {
     my ($url)   = @_;      my ($url)   = @_;
     my @urlslices = split(/\//, $url,-1);      my @urlslices = split(/\//, $url,-1);
     my $lastitem = &escape(pop(@urlslices));      my $lastitem = &escape(pop(@urlslices));
     return join('/',@urlslices).'/'.$lastitem;      return &HTML::Entities::encode(join('/',@urlslices),"'").'/'.$lastitem;
 }  }
   
 sub compare_arrays {  sub compare_arrays {
Line 15323  sub search_courses { Line 15329  sub search_courses {
     return %courses;      return %courses;
 }  }
   
   
 =pod  =pod
   
 =back  =back

Removed from v.1.1199  
changed lines
  Added in v.1.1203


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