[LON-CAPA-cvs] cvs: loncom /publisher lonrights.pm

raeburn raeburn at source.lon-capa.org
Thu Jul 13 18:21:26 EDT 2023


raeburn		Thu Jul 13 22:21:26 2023 EDT

  Modified files:              
    /loncom/publisher	lonrights.pm 
  Log:
  - Breadcrumbs text when displaying rights file in Course Authoring Space.
  - Editing of default.rights file at top level of Course Authoring Space
    disabled.
  
  
Index: loncom/publisher/lonrights.pm
diff -u loncom/publisher/lonrights.pm:1.35 loncom/publisher/lonrights.pm:1.36
--- loncom/publisher/lonrights.pm:1.35	Tue Jun  4 22:20:16 2013
+++ loncom/publisher/lonrights.pm	Thu Jul 13 22:21:26 2023
@@ -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 @@
   &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 @@
   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'}) {




More information about the LON-CAPA-cvs mailing list