Diff for /loncom/interface/loncommon.pm between versions 1.1075.2.161.2.24 and 1.1075.2.161.2.25

version 1.1075.2.161.2.24, 2024/03/29 00:45:24 version 1.1075.2.161.2.25, 2024/08/17 23:31:37
Line 6069  sub nocodemirror { Line 6069  sub nocodemirror {
 Input: $uri (optional)  Input: $uri (optional)
   
 Returns: %editors hash in which keys are editors  Returns: %editors hash in which keys are editors
          permitted in current Authoring Space.           permitted in current Authoring Space,
            or in current course for web pages
            created in a course.
   
          Value for each key is 1. Possible keys           Value for each key is 1. Possible keys
          are: edit, xml, and daxe. If no specific           are: edit, xml, and daxe. 
   
            For a regular Authoring Space, if no specific
          set of editors has been set for the Author           set of editors has been set for the Author
          who owns the Authoring Space, then the           who owns the Authoring Space, then the
          domain default will be used.  If no domain           domain default will be used.  If no domain
          default has been set, then the keys will be           default has been set, then the keys will be
          edit and xml.           edit and xml.
   
            For a course author, or for web pages created
            in a course, if no specific set of editors has
            been set for the course, then the domain
            course default will be used. If no domain
            course default has been set, then the keys
            will be edit and xml.
   
 =cut  =cut
   
 sub permitted_editors {  sub permitted_editors {
     my ($uri) = @_;      my ($uri) = @_;
     my ($is_author,$is_coauthor,$auname,$audom,%editors);      my ($is_author,$is_coauthor,$is_course,$auname,$audom,%editors);
     if ($env{'request.role'} =~ m{^au\./}) {      if ($env{'request.role'} =~ m{^au\./}) {
         $is_author = 1;          $is_author = 1;
     } elsif ($env{'request.role'} =~ m{^(?:ca|aa)\./($match_domain)/($match_username)}) {      } elsif ($env{'request.role'} =~ m{^(?:ca|aa)\./($match_domain)/($match_username)}) {
Line 6096  sub permitted_editors { Line 6108  sub permitted_editors {
             }              }
         }          }
     } elsif ($env{'request.course.id'}) {      } elsif ($env{'request.course.id'}) {
         if ($env{'request.editurl'} =~ m{^/priv/($match_domain)/($match_username)/}) {          my ($cdom,$cnum);
           $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
           $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
           if (($env{'request.editurl'} =~ m{^/priv/\Q$cdom/$cnum\E/}) ||
               ($env{'request.editurl'} =~ m{^/uploaded/\Q$cdom/$cnum\E/(docs|supplemental)/}) ||
               ($uri =~ m{^/uploaded/\Q$cdom/$cnum\E/(docs|supplemental)/})) {
               $is_course = 1;
           } elsif ($env{'request.editurl'} =~ m{^/priv/($match_domain)/($match_username)/}) {
             ($audom,$auname) = ($1,$2);              ($audom,$auname) = ($1,$2);
         } elsif ($env{'request.uri'} =~ m{^/priv/($match_domain)/($match_username)/}) {          } elsif ($env{'request.uri'} =~ m{^/priv/($match_domain)/($match_username)/}) {
             ($audom,$auname) = ($1,$2);              ($audom,$auname) = ($1,$2);
         } elsif (($uri eq '/daxesave') &&          } elsif (($uri eq '/daxesave') &&
                    (($env{'form.path'} =~ m{^/daxeopen/priv/\Q$cdom/$cnum\E/}) ||
                     ($env{'form.path'} =~ m{^/daxeopen/uploaded/\Q$cdom/$cnum\E/(docs|supplemental)/}))) {
               $is_course = 1;
           } elsif (($uri eq '/daxesave') &&
                  ($env{'form.path'} =~ m{^/daxeopen/priv/($match_domain)/($match_username)/})) {                   ($env{'form.path'} =~ m{^/daxeopen/priv/($match_domain)/($match_username)/})) {
             ($audom,$auname) = ($1,$2);              ($audom,$auname) = ($1,$2);
         }          }
         if (($audom ne '') && ($auname ne '')) {          unless ($is_course) {
             if (($env{'user.domain'} eq $audom) &&              if (($audom ne '') && ($auname ne '')) {
                 ($env{'user.name'} eq $auname)) {                  if (($env{'user.domain'} eq $audom) &&
                 $is_author = 1;                      ($env{'user.name'} eq $auname)) {
             } else {                      $is_author = 1;
                 $is_coauthor = 1;                  } else {
                       $is_coauthor = 1;
                   }
             }              }
         }          }
     }      }
Line 6129  sub permitted_editors { Line 6154  sub permitted_editors {
                          xml => 1,                           xml => 1,
                        );                         );
         }          }
       } elsif ($is_course) {
           if (exists($env{'course.'.$env{'request.course.id'}.'.internal.crseditors'})) {
               map { $editors{$_} = 1; } split(/,/,$env{'course.'.$env{'request.course.id'}.'.internal.crseditors'});
           } else {
               my %domdefaults = &Apache::lonnet::get_domain_defaults($env{'course.'.$env{'request.course.id'}.'.domain'});
               if (exists($domdefaults{'crseditors'})) {
                   map { $editors{$_} = 1; } split(/,/,$domdefaults{'crseditors'});
               } else {
                   %editors = ( edit => 1,
                                xml => 1,
                              );
               }
           }
     } else {      } else {
         %editors = ( edit => 1,          %editors = ( edit => 1,
                      xml => 1,                       xml => 1,
Line 9046  OFFLOAD Line 9084  OFFLOAD
  $title = 'The LearningOnline Network with CAPA';   $title = 'The LearningOnline Network with CAPA';
     }      }
     if (!$args->{'no_auto_mt_title'}) { $title = &mt($title); }      if (!$args->{'no_auto_mt_title'}) { $title = &mt($title); }
     $result .= '<title> LON-CAPA '.$title.'</title>'      if ($title =~ /^LON-CAPA\s+/) {
  .'<link rel="stylesheet" type="text/css" href="'.$url.'"';          $result .= '<title> '.$title.'</title>';
       } else {
           $result .= '<title> LON-CAPA '.$title.'</title>';  
       }
       $result .= "\n".'<link rel="stylesheet" type="text/css" href="'.$url.'"';
     if (!$args->{'frameset'}) {      if (!$args->{'frameset'}) {
         $result .= ' /';          $result .= ' /';
     }      }
Line 17276  sub init_user_environment { Line 17318  sub init_user_environment {
                 } else {                  } else {
                     $userenv{'editors'} = 'edit,xml';                      $userenv{'editors'} = 'edit,xml';
                 }                  }
                   if ($userenv{'authorarchive'}) {
                       $userenv{'canarchive'} = 1;
                   } elsif (($userenv{'authorarchive'} eq '') &&
                            ($domdef{'archive'})) {
                       $userenv{'canarchive'} = 1;
                   }
             }              }
   
             $userenv{'canrequest.author'} =              $userenv{'canrequest.author'} =

Removed from v.1.1075.2.161.2.24  
changed lines
  Added in v.1.1075.2.161.2.25


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