Diff for /rat/lonuserstate.pm between versions 1.149.2.5.2.3 and 1.170

version 1.149.2.5.2.3, 2022/10/05 22:54:00 version 1.170, 2022/10/05 16:11:25
Line 42  use Safe::Hole; Line 42  use Safe::Hole;
 use Opcode;  use Opcode;
 use Apache::lonenc;  use Apache::lonenc;
 use Fcntl qw(:flock);  use Fcntl qw(:flock);
 use LONCAPA qw(:DEFAULT :match);    use LONCAPA qw(:DEFAULT :match);
 use File::Basename;  use File::Basename;
   
     
Line 260  sub loadmap { Line 260  sub loadmap {
  push(@map_ids, $resource_id);   push(@map_ids, $resource_id);
                 if ($hash{'src_'.$lpc.'.'.$resource_id}) {                  if ($hash{'src_'.$lpc.'.'.$resource_id}) {
                     $rescount{$lpc} ++;                      $rescount{$lpc} ++;
                     if (($hash{'src_'.$lpc.'.'.$resource_id}=~/\.sequence$/) ||                      if (($hash{'src_'.$lpc.'.'.$resource_id}=~/\.sequence$/) || 
                         ($hash{'src_'.$lpc.'.'.$resource_id}=~/\.page$/)) {                          ($hash{'src_'.$lpc.'.'.$resource_id}=~/\.page$/)) {
                         $mapcount{$lpc} ++;                          $mapcount{$lpc} ++; 
                     }                      }
                 }                  }
                 unless ($codechecked) {                  unless ($codechecked) {
Line 405  sub error_detail { Line 405  sub error_detail {
             if (($parent_pc eq '0') && ($hash{'map_id_1'} =~ m{^/res/($match_domain)/($match_username)/.+\.(sequence|page)$})) {              if (($parent_pc eq '0') && ($hash{'map_id_1'} =~ m{^/res/($match_domain)/($match_username)/.+\.(sequence|page)$})) {
                 ($audomfile,$aunamefile) = ($1,$2);                  ($audomfile,$aunamefile) = ($1,$2);
                 ($editfile,$filerole,$fileswitch) = &canedit_published($audomfile,$aunamefile);                  ($editfile,$filerole,$fileswitch) = &canedit_published($audomfile,$aunamefile);
                   if ($fileswitch) {
                       unless ((&Apache::lonnet::will_trust('othcoau',$env{'user.domain'},$audomfile)) &&
                               (&Apache::lonnet::will_trust('coaurem',$audomfile,$env{'user.domain'}))) {
                           undef($editfile);
                       }
                   }
                 $errinfo = &mt('Top level published sequence file is missing.');                  $errinfo = &mt('Top level published sequence file is missing.');
             } else {              } else {
                 if ($parent_pc eq '1') {                  if ($parent_pc eq '1') {
Line 478  sub error_detail { Line 484  sub error_detail {
                 if ($uri =~ m{^/res/($match_domain)/($match_username)/.+\.(sequence|page)$}) {                  if ($uri =~ m{^/res/($match_domain)/($match_username)/.+\.(sequence|page)$}) {
                     ($audomfile,$aunamefile) = ($1,$2);                      ($audomfile,$aunamefile) = ($1,$2);
                     ($editfile,$filerole,$fileswitch) = &canedit_published($audomfile,$aunamefile);                      ($editfile,$filerole,$fileswitch) = &canedit_published($audomfile,$aunamefile);
                       if ($fileswitch) {
                           unless ((&Apache::lonnet::will_trust('othcoau',$env{'user.domain'},$audomfile)) &&
                                   (&Apache::lonnet::will_trust('coaurem',$audomfile,$env{'user.domain'}))) {
                               undef($editfile);
                           }
                       }
                 }                  }
             }              }
             if ($errinfo) {              if ($errinfo) {
Line 530  sub error_detail { Line 542  sub error_detail {
                     my $mapurl = $hash{'map_id_'.$parent_pc};                      my $mapurl = $hash{'map_id_'.$parent_pc};
                     $mapurl =~s{^/res/}{/priv/};                      $mapurl =~s{^/res/}{/priv/};
                     if ($switchserver) {                      if ($switchserver) {
                         $errinfo .= '.<br />'.                          $errinfo .= '.<br />';
                                     &mt('You will need to [_1]switch server[_2].',                          if ((&Apache::lonnet::will_trust('othcoau',$env{'user.domain'},$audom)) &&
                                         '<a href="/adm/switchserver?otherserver='.$switchserver.'&amp;role='.$rolecode.                              (&Apache::lonnet::will_trust('coaurem',$audom,$env{'user.domain'}))) {
                                         '&amp;origurl='.&escape($mapurl).'">','</a>');                              $errinfo .= &mt('You will need to [_1]switch server[_2].',
                                               '<a href="/adm/switchserver?otherserver='.$switchserver.'&amp;role='.$rolecode.
                                               '&amp;origurl='.&escape($mapurl).'">','</a>');
                           } else {
                               $errinfo .= &mt('Session switch required but prohibited.');
                           }
                     } else {                      } else {
                         &js_escape(\$mapurl);                          &js_escape(\$mapurl);
                         $errinfo .= ':&nbsp;<a href="javascript:go('."'$mapurl'".');">'.&mt('Edit the map').'</a>';                          $errinfo .= ':&nbsp;<a href="javascript:go('."'$mapurl'".');">'.&mt('Edit the map').'</a>';
Line 1713  sub readmap { Line 1730  sub readmap {
         if ($redirect) {          if ($redirect) {
             $retfurl = $url;              $retfurl = $url;
         }          }
     }       }
     return ($retfurl,$errtext);      return ($retfurl,$errtext);
 }  }
   
Line 2030  sub get_mapparam { Line 2047  sub get_mapparam {
                     last;                      last;
                 }                  }
             }              }
               my $recursechk=$usercourseprefix.'.'.$item.'___(rec).'.$what;
               if (defined($$useropt{$recursechk})) {
                   return $$useropt{$recursechk};
               }
         }          }
     }      }
   
Line 2051  sub get_mapparam { Line 2072  sub get_mapparam {
                     last;                      last;
                 }                  }
             }              }
               my $recursechk=$usercourseprefix.'.['.$cgroup.'].'.$item.'___(rec).'.$what;
               if (defined($$courseopt{$recursechk})) {
                   return $$courseopt{$recursechk};
               }
         }          }
     }      }
   
Line 2072  sub get_mapparam { Line 2097  sub get_mapparam {
                     last;                      last;
                 }                  }
             }              }
               my $recursechk=$usercourseprefix.'.['.$csec.'].'.$item.'___(rec).'.$what;
               if (defined($$courseopt{$recursechk})) {
                   return $$courseopt{$recursechk};
               }
         }          }
     }      }
   
Line 2115  sub get_mapparam { Line 2144  sub get_mapparam {
                         last;                          last;
                     }                      }
                 }                  }
                   my $recursechk=$usercourseprefix.'.'.$item.'___(rec).'.$what;
                   if (defined($$courseopt{$recursechk})) {
                       return $$courseopt{$recursechk};
                   }
             }              }
         }          }
     }      }

Removed from v.1.149.2.5.2.3  
changed lines
  Added in v.1.170


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