--- loncom/interface/loncommon.pm 2023/12/31 23:03:40 1.1425 +++ loncom/interface/loncommon.pm 2024/01/10 20:07:37 1.1426 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.1425 2023/12/31 23:03:40 raeburn Exp $ +# $Id: loncommon.pm,v 1.1426 2024/01/10 20:07:37 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -2437,6 +2437,66 @@ sub show_crsfiles_js { 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 + 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"; + + +$author +$cnum:$cdom +private +$now + + +$cdom +0 + +notset +$now +0 +rights +$env{'user.name'}:$env{'user.domain'} + + + +$cnum:$cdom +deny:::course,allow:$cid::course + + + +Course Authoring Rights +END + close($fh); + } + } + return; +} + =pod =item * &iframe_wrapper_headjs()