--- loncom/interface/loncommon.pm 2023/12/31 23:03:40 1.1425 +++ loncom/interface/loncommon.pm 2024/03/03 00:08:37 1.1427 @@ -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.1427 2024/03/03 00:08: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() @@ -6890,21 +6950,33 @@ sub bodytag { $bodytag .= Apache::lonhtmlcommon::scripttag( Apache::lonmenu::utilityfunctions($httphost), 'start'); + my $collapsible; if ($args->{'collapsible_header'} ne '') { - my $alttext = &mt('menu state: collapsed'); - my $tooltip = &mt('display standard menus'); + $collapsible = 1; + 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";
-$alttext
- +
END } unless ($args->{'no_primary_menu'}) { my ($left,$right) = Apache::lonmenu::primary_menu($crstype,$ltimenu,$menucoll,$menuref, $args->{'links_disabled'}, $args->{'links_target'}, - $args->{'collapsible_header'}); + $collapsible); if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { if ($dc_info) {