--- loncom/publisher/lonrights.pm 2003/03/14 02:26:12 1.1
+++ 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.1 2003/03/14 02:26:12 www Exp $
+# $Id: lonrights.pm,v 1.36 2023/07/13 22:21:26 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -32,20 +32,369 @@ package Apache::lonrights;
use strict;
use Apache::Constants qw(:common :http);
-use Apache::lonnet();
+use Apache::lonnet;
use Apache::loncommon();
+use HTML::LCParser;
+use Apache::File;
+use Apache::lonlocal;
sub handler {
my $r=shift;
- $r->content_type('text/html');
+ my $target = $env{'form.grade_target'};
+ if ($target eq 'meta') {
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->send_http_header;
+ $env{'request.uri'}=$r->uri;
+ my $file = &Apache::lonnet::filelocation("",$r->uri);
+ my $content=&Apache::lonnet::getfile($file);
+ my $result=&Apache::lonxml::xmlparse(undef,'meta',$content);
+ $r->print($result);
+ return OK;
+ }
+ &Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
- $r->print('
LON-CAPA Custom Distribution Rights');
+ 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' => $text,
+ 'href' => $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' => '',});
+ }
- $r->print(&Apache::loncommon::bodytag('Custom Distribution Rights'));
+ my $js = &Apache::loncommon::coursebrowser_javascript().
+ &Apache::loncommon::studentbrowser_javascript();
+ # Breadcrumbs are included by &start_page
+ $r->print(&Apache::loncommon::start_page('Custom Distribution Rights',$js)
+ .&Apache::loncommon::head_subbox(
+ &Apache::loncommon::CSTR_pageheader())
+ );
+ $r->rflush();
- $r->print('