[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonmenu.pm

raeburn raeburn at source.lon-capa.org
Sat May 11 20:40:24 EDT 2013


raeburn		Sun May 12 00:40:24 2013 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonmenu.pm 
  Log:
  - For 2.11
    - Backport 1.411, 1.412, 1.413, 1.414.
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.369.2.38 loncom/interface/lonmenu.pm:1.369.2.39
--- loncom/interface/lonmenu.pm:1.369.2.38	Tue Mar 19 23:31:15 2013
+++ loncom/interface/lonmenu.pm	Sun May 12 00:40:24 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.369.2.38 2013/03/19 23:31:15 raeburn Exp $
+# $Id: lonmenu.pm,v 1.369.2.39 2013/05/12 00:40:24 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -345,6 +345,28 @@
     my $canmgr        = &Apache::lonnet::allowed('mgr', $crs_sec);
     my $author        = &getauthor();
 
+    my ($cdom,$cnum,$showsyllabus,$showfeeds);
+    if ($env{'request.course.id'}) {
+        $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+        $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+        if ($canedit) {
+            $showsyllabus = 1;
+            $showfeeds = 1;
+        } else {
+            unless (&Apache::lonnet::is_on_map("public/$cdom/$cnum/syllabus")) {
+                if (($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'}) ||
+                    ($env{'course.'.$env{'request.course.id'}.'.uploadedsyllabus'}) ||
+                    ($env{'course.'.$env{'request.course.id'}.'.updatedsyllabus'}) ||
+                    ($env{'request.course.syllabustime'})) {
+                    $showsyllabus = 1;
+                }
+            }
+            if ($env{'request.course.feeds'}) {
+                $showfeeds = 1;
+            }
+        }
+    }
+
     my ($canmodifycoauthor);
     if ($env{'request.role'} eq "au./$env{'user.domain'}/") {
         my $extent = "$env{'user.domain'}/$env{'user.name'}";
@@ -391,6 +413,10 @@
                 && !$canmodpara;
         next if    $$menuitem[4]   eq 'nvcg'
                 && ($canviewgrps || !%groups);
+        next if    $$menuitem[4]   eq 'showsyllabus'
+                && !$showsyllabus;
+        next if    $$menuitem[4]   eq 'showfeeds'
+                && !$showfeeds;
         next if    $$menuitem[4]    eq 'author'
                 && !$author;
         next if    $$menuitem[4]    eq 'cca'
@@ -432,6 +458,17 @@
                 );
             $menu .= $switcher;
         } else {
+            if ($$menuitem[3] eq 'Syllabus' && $env{'request.course.id'}) {
+                my $url = $$menuitem[0];
+                $url =~ s{\[cdom\]/\[cnum\]}{$cdom/$cnum};
+                if (&Apache::lonnet::is_on_map($url)) {
+                    unless ($$menuitem[0] =~ /\?register=1/) {
+                        $$menuitem[0] .= '?register=1';
+                    }
+                } else {
+                    $$menuitem[0] =~ s{\?register=1}{};
+                }
+            }
             $menu .= &prep_menuitem(\@$menuitem);
         }
     }
@@ -604,6 +641,14 @@
                         &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
                 }
                 return $trail;
+            } elsif ($resurl =~ m{^\Q/uploaded$courseurl/portfolio/syllabus/}) {
+                &Apache::lonhtmlcommon::clear_breadcrumbs();
+                &prepare_functions('/public'.$courseurl."/syllabus",
+                                   $forcereg,$group,undef,undef,1);
+                $title = &mt('Syllabus File');
+                my ($trail) =
+                    &Apache::lonhtmlcommon::docs_breadcrumbs(undef,$crstype,undef,$title,1);
+                return $trail;
             }
             unless ($env{'request.state'} eq 'construct') {
                 &Apache::lonhtmlcommon::clear_breadcrumbs();
@@ -1292,24 +1337,18 @@
 #
 # This applies in course context
 #
-        if (($resurl eq "/public/$cdom/$cnum/syllabus") && ($perms{'mdc'})) {
-            if ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ /\w/) {
-                &switch('','',6,1,'pcstr.png','Edit',
-                        'resource[_2]',
-                        "go('/adm/courseprefs?phase=display&actions=courseinfo')",
-                        'Edit this resource','','',1);
-                $editbutton = 1;
+        if (($perms{'mdc'}) &&
+            (($resurl eq "/public/$cdom/$cnum/syllabus") ||
+            ($resurl =~ m{^/uploaded/$cdom/$cnum/portfolio/syllabus/}))) {
+            $cfile = $resurl;
+            $home = &Apache::lonnet::homeserver($cnum,$cdom);
+            if ($env{'form.forceedit'}) {
+                $forceview = 1;
             } else {
-                $cfile = $resurl;
-                $home = &Apache::lonnet::homeserver($cnum,$cdom);
-                if ($env{'form.forceedit'}) {
-                    $forceview = 1;
-                } else {
-                    $forceedit = 1;
-                }
-                $editbutton = &get_editbutton($cfile,$home,$switchserver,
-                                              $forceedit,$forceview,$forcereg);
+                $forceedit = 1;
             }
+            $editbutton = &get_editbutton($cfile,$home,$switchserver,
+                                          $forceedit,$forceview,$forcereg);
         } elsif (($resurl eq '/adm/extresedit') &&
                  (($env{'form.symb'}) || ($env{'form.folderpath'}))) {
             ($cfile,$home,$switchserver,$forceedit,$forceview) =




More information about the LON-CAPA-cvs mailing list