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

version 1.149.2.5.2.3, 2022/10/05 22:54:00 version 1.169, 2022/10/04 20:39:57
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 492  sub error_detail { Line 504  sub error_detail {
                 } else {                  } else {
                     $errinfo .= &mt('To rectify this problem, create and publish the missing file');                      $errinfo .= &mt('To rectify this problem, create and publish the missing file');
                 }                  }
                 my $fileurl = $uri;  
                 $fileurl =~s{^/res/}{/priv/};  
                 if ($fileswitch) {                  if ($fileswitch) {
                     my $rolename = &Apache::lonnet::plaintext($filerole);                      my $rolename = &Apache::lonnet::plaintext($filerole);
                     my $rolecode;                      my $rolecode;
Line 503  sub error_detail { Line 513  sub error_detail {
                         $rolecode = $filerole.'./'.$audomfile.'/'.$aunamefile;                          $rolecode = $filerole.'./'.$audomfile.'/'.$aunamefile;
                     }                      }
                     $errinfo .= '.<br />'.&mt('You will need to [_1]switch server[_2].',                      $errinfo .= '.<br />'.&mt('You will need to [_1]switch server[_2].',
                                              '<a href="/adm/switchserver?otherserver='.$switchserver.'&amp;role='.$rolecode.                                               '<a href="/adm/switchserver?otherserver='.$switchserver.'&amp;role='.$rolecode.'">','</a>');
                                              '&amp;origurl='.&escape($fileurl).'">','</a>');  
                 } else {                  } else {
                     &js_escape(\$fileurl);                      my $fileurl = $uri;
                       $fileurl =~s{^/res/}{/priv/};
                     $errinfo .= ':&nbsp;<a href="javascript:go('."'$fileurl'".');">'.&mt('Create the missing file').'</a>';                      $errinfo .= ':&nbsp;<a href="javascript:go('."'$fileurl'".');">'.&mt('Create the missing file').'</a>';
                 }                  }
             }              }
Line 527  sub error_detail { Line 537  sub error_detail {
                     } else {                      } else {
                         $errinfo .= &mt('To rectify this problem edit the parent map to remove the reference to the missing file');                          $errinfo .= &mt('To rectify this problem edit the parent map to remove the reference to the missing file');
                     }                      }
                     my $mapurl = $hash{'map_id_'.$parent_pc};  
                     $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.'">','</a>');
                           } else {
                               $errinfo .= &mt('Session switch required but prohibited.');
                           }
                     } else {                      } else {
                         &js_escape(\$mapurl);                          my $mapurl = $hash{'map_id_'.$parent_pc};
                           $mapurl =~s{^/res/}{/priv/};
                         $errinfo .= ':&nbsp;<a href="javascript:go('."'$mapurl'".');">'.&mt('Edit the map').'</a>';                          $errinfo .= ':&nbsp;<a href="javascript:go('."'$mapurl'".');">'.&mt('Edit the map').'</a>';
                     }                      }
                 } elsif ($uploaded && $courseid) {                  } elsif ($uploaded && $courseid) {
Line 1713  sub readmap { Line 1726  sub readmap {
         if ($redirect) {          if ($redirect) {
             $retfurl = $url;              $retfurl = $url;
         }          }
     }       }
     return ($retfurl,$errtext);      return ($retfurl,$errtext);
 }  }
   
Line 2030  sub get_mapparam { Line 2043  sub get_mapparam {
                     last;                      last;
                 }                  }
             }              }
               my $recursechk=$usercourseprefix.'.'.$item.'___(rec).'.$what;
               if (defined($$useropt{$recursechk})) {
                   return $$useropt{$recursechk};
               }
         }          }
     }      }
   
Line 2051  sub get_mapparam { Line 2068  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 2093  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 2140  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.169


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