Diff for /loncom/interface/loncommon.pm between versions 1.1425 and 1.1429

version 1.1425, 2023/12/31 23:03:40 version 1.1429, 2024/04/14 17:12:27
Line 2437  sub show_crsfiles_js { Line 2437  sub show_crsfiles_js {
 END  END
 }  }
   
   sub crsauthor_rights {
       my ($rightsfile,$path,$docroot,$cnum,$cdom) = @_;
       my $sourcerights = "$path/$rightsfile";
       my $now = time;
       if (!-e $sourcerights) {
           my $cid = $cdom.'_'.$cnum;
           if (!-e "$docroot/priv/$cdom") {
               mkdir("$docroot/priv/$cdom",0755);
           }
           if (!-e "$docroot/priv/$cdom/$cnum") {
               mkdir("$docroot/priv/$cdom/$cnum",0755);
           }
           if (open(my $fh,">$sourcerights")) {
               print $fh <<END;
   <accessrule effect="deny" realm="" type="course" role="" />
   <accessrule effect="allow" realm="$cid" type="course" role="" />
   END
               close($fh);
           }
       }
       if (!-e "$sourcerights.meta") {
           if (open(my $fh,">$sourcerights.meta")) {
               my $author=$env{'environment.firstname'}.' '.
                          $env{'environment.middlename'}.' '.
                          $env{'environment.lastname'}.' '.
                          $env{'environment.generation'};
               $author =~ s/\s+$//;
               print $fh <<"END";
   
   <abstract></abstract>
   <author>$author</author>
   <authorspace>$cnum:$cdom</authorspace>
   <copyright>private</copyright>
   <creationdate>$now</creationdate>
   <customdistributionfile></customdistributionfile>
   <dependencies></dependencies>
   <domain>$cdom</domain>
   <highestgradelevel>0</highestgradelevel>
   <keywords></keywords>
   <language>notset </language>
   <lastrevisiondate>$now</lastrevisiondate>
   <lowestgradelevel>0</lowestgradelevel>
   <mime>rights</mime>
   <modifyinguser>$env{'user.name'}:$env{'user.domain'}</modifyinguser>
   <notes></notes>
   <obsolete></obsolete>
   <obsoletereplacement></obsoletereplacement>
   <owner>$cnum:$cdom</owner>
   <rule>deny:::course,allow:$cid::course</rule>
   <sourceavail></sourceavail>
   <standards></standards>
   <subject></subject>
   <title>Course Authoring Rights</title>
   END
               close($fh);
           }
       }
       return;
   }
   
 =pod  =pod
   
 =item * &iframe_wrapper_headjs()  =item * &iframe_wrapper_headjs()
Line 6596  sub nocodemirror { Line 6656  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 6623  sub permitted_editors { Line 6695  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)/})) {
               $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 6656  sub permitted_editors { Line 6740  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 6890  sub bodytag { Line 6987  sub bodytag {
         $bodytag .= Apache::lonhtmlcommon::scripttag(          $bodytag .= Apache::lonhtmlcommon::scripttag(
             Apache::lonmenu::utilityfunctions($httphost), 'start');              Apache::lonmenu::utilityfunctions($httphost), 'start');
   
           my $collapsible;
         if ($args->{'collapsible_header'} ne '') {          if ($args->{'collapsible_header'} ne '') {
             my $alttext = &mt('menu state: collapsed');              $collapsible = 1;
             my $tooltip = &mt('display standard menus');              my ($menustate,$tiptext,$divclass);
               if ($args->{'start_collapsed'}) {
                   $menustate = 'collapsed';
                   $tiptext = 'display';
                   $divclass = 'hidden';
               } else {
                   $menustate = 'expanded';
                   $tiptext = 'hide';
                   $divclass = 'shown';
               }
               my $alttext = &mt('menu state: '.$menustate);
               my $tooltip = &mt($tiptext.' standard menus');
             $bodytag .= <<"END";              $bodytag .= <<"END";
 <div id="LC_expandingContainer" style="display:inline;">  <div id="LC_expandingContainer" style="display:inline;">
 <div id="LC_collapsible" class="LC_collapse_trigger" style="position: absolute;top: -5px;left: 0px; z-index:101; display:inline;">  <div id="LC_collapsible" class="LC_collapse_trigger" style="position: absolute;top: -5px;left: 0px; z-index:101; display:inline;">
 <a href="#" style="text-decoration:none;"><img class="LC_collapsible_indicator" alt="$alttext" title="$tooltip" src="/res/adm/pages/collapsed.png" style="border:0;margin:0;padding:0;max-width:100%;height:auto" /></a></div>  <a href="#" style="text-decoration:none;"><img class="LC_collapsible_indicator" alt="$alttext" title="$tooltip" src="/res/adm/pages/$menustate.png" style="border:0;margin:0;padding:0;max-width:100%;height:auto" /></a></div>
 <div class="LC_menus_content hidden">  <div class="LC_menus_content $divclass">
 END  END
         }          }
         unless ($args->{'no_primary_menu'}) {          unless ($args->{'no_primary_menu'}) {
             my ($left,$right) = Apache::lonmenu::primary_menu($crstype,$ltimenu,$menucoll,$menuref,              my ($left,$right) = Apache::lonmenu::primary_menu($crstype,$ltimenu,$menucoll,$menuref,
                                                               $args->{'links_disabled'},                                                                $args->{'links_disabled'},
                                                               $args->{'links_target'},                                                                $args->{'links_target'},
                                                               $args->{'collapsible_header'});                                                                $collapsible);
   
             if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) {              if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) {
                 if ($dc_info) {                  if ($dc_info) {
Line 7161  form, .inline { Line 7270  form, .inline {
 }  }
   
 .LC_menus_content.shown{  .LC_menus_content.shown{
   display: inline;    display: block;
 }  }
   
 .LC_menus_content.hidden {  .LC_menus_content.hidden {

Removed from v.1.1425  
changed lines
  Added in v.1.1429


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