[LON-CAPA-cvs] cvs: loncom /interface londocs.pm

raeburn raeburn at source.lon-capa.org
Mon Jan 8 13:17:50 EST 2024


raeburn		Mon Jan  8 18:17:50 2024 EDT

  Modified files:              
    /loncom/interface	londocs.pm 
  Log:
  - Access to a course's "Authoring Space" (where enabled) from:
    Course Editor > Content Utilities > "Enter Course Authoring Space"
  
  
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.707 loncom/interface/londocs.pm:1.708
--- loncom/interface/londocs.pm:1.707	Thu Dec 28 19:29:38 2023
+++ loncom/interface/londocs.pm	Mon Jan  8 18:17:50 2024
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Documents
 #
-# $Id: londocs.pm,v 1.707 2023/12/28 19:29:38 raeburn Exp $
+# $Id: londocs.pm,v 1.708 2024/01/08 18:17:50 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -6503,7 +6503,7 @@
 
   if ($allowed && $toolsflag) {
       $r->print(&startContentScreen('tools'));
-      $r->print(&generate_admin_menu($crstype,$canedit));
+      $r->print(&generate_admin_menu($crstype,$canedit,$coursenum,$coursedom));
       $r->print(&endContentScreen());
   } elsif ((!$showdoc) && (!$uploadphase)) {
 # -----------------------------------------------------------------------------
@@ -7597,7 +7597,7 @@
 }
 
 sub generate_admin_menu {
-    my ($crstype,$canedit) = @_;
+    my ($crstype,$canedit,$coursenum,$coursedom) = @_;
     my $lc_crstype = lc($crstype);
     my ($home,$other,%outhash)=&authorhosts();
     my %lt= ( # do not translate here
@@ -7605,6 +7605,7 @@
                                          'cv'   => 'Check/Set Resource Versions',
                                          'ls'   => 'List Resource Identifiers',
                                          'ct'   => 'Display/Set Shortened URLs for Deep-linking',
+                                         'ca'   => "Enter $crstype Authoring Space",
                                          'imse' => 'Export contents to IMS Archive',
                                          'dcd'  => "Copy $crstype Content to Authoring Space",
             );
@@ -7665,6 +7666,31 @@
                 ]
         });
     if ($canedit) {
+        my ($crsauname,$crsaudom,$crshome);
+        if (($coursenum ne '') && ($coursedom ne '')) {
+            my $crsauthorurl = "/priv/$coursedom/$coursenum/";
+            ($crsauname,$crsaudom,$crshome) = &Apache::lonnet::constructaccess($crsauthorurl);
+            if (($crsauname eq $coursenum) && ($crsaudom eq $coursedom)) {
+                my @ids=&Apache::lonnet::current_machine_ids();
+                my $linkurl;
+                if (grep(/^\Q$crshome\E$/, at ids)) {
+                    $linkurl = $crsauthorurl;
+                } else {
+                    $linkurl =
+                        &Apache::lonhtmlcommon::jump_to_editres($crsauthorurl,$crshome,1);
+                }
+                if ((ref($menu[0]) eq 'HASH') && (ref($menu[0]->{'items'}) eq 'ARRAY')) {
+                     push(@{$menu[0]->{items}},
+                     {   linktext   => $lt{'ca'},
+                         url        => $linkurl,
+                         permission => 'F',
+                         help       => 'Docs_Course_Authorspace',
+                         icon       => 'impcrsau.png',
+                         linktitle  => $lt{'ca'},
+                     });
+                }
+            }
+        }
         push(@menu,
         {   categorytitle=>'Export',
             items =>[




More information about the LON-CAPA-cvs mailing list