--- loncom/publisher/lonrights.pm 2013/06/04 22:20:16 1.35 +++ loncom/publisher/lonrights.pm 2023/07/13 22:21:26 1.36 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to show and edit custom distribution rights # -# $Id: lonrights.pm,v 1.35 2013/06/04 22:20:16 raeburn Exp $ +# $Id: lonrights.pm,v 1.36 2023/07/13 22:21:26 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -55,16 +55,34 @@ sub handler { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; + my $text = 'Authoring Space'; + my $href = &Apache::loncommon::authorspace($r->uri); + my ($crsauthor,$cdom,$cnum); + if ($env{'request.course.id'}) { + $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + if ($href eq "/priv/$cdom/$cnum/") { + $crsauthor = 1; + $text = 'Course Authoring Space'; + } + } # Breadcrumbs &Apache::lonhtmlcommon::clear_breadcrumbs(); &Apache::lonhtmlcommon::add_breadcrumb({ - 'text' => 'Authoring Space', - 'href' => &Apache::loncommon::authorspace($r->uri), + 'text' => $text, + 'href' => $href, }); - &Apache::lonhtmlcommon::add_breadcrumb({ - 'text' => 'Custom Rights Editor', - 'title' => 'Custom Distribution Rights Editor', - 'href' => '',}); + if ($crsauthor) { + &Apache::lonhtmlcommon::add_breadcrumb({ + 'text' => 'Custom Rights', + 'title' => 'Custom Distribution Rights', + 'href' => '',}); + } else { + &Apache::lonhtmlcommon::add_breadcrumb({ + 'text' => 'Custom Rights Editor', + 'title' => 'Custom Distribution Rights Editor', + 'href' => '',}); + } my $js = &Apache::loncommon::coursebrowser_javascript(). &Apache::loncommon::studentbrowser_javascript(); @@ -79,6 +97,11 @@ sub handler { my $fn=&Apache::lonnet::filelocation('',$uri); my $contents=''; my $constructmode=($uri=~ m{^/priv/}); + if ($constructmode) { + if (($crsauthor) && ($uri eq "/priv/$cdom/$cnum/default.rights")) { + undef($constructmode); + } + } # ============================================================ Modify and store if ($constructmode && $env{'form.store'}) {