[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm /interface lonmenu.pm

raeburn raeburn at source.lon-capa.org
Thu May 9 01:24:42 EDT 2013


raeburn		Thu May  9 05:24:42 2013 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm 
    /loncom/auth	lonroles.pm 
  Log:
  - Don't show Syllabus item in secondary menu in course context to students
    unless syllabus has been edited.
  - Information about active course feeds and syllabus modification time
    stored in %env with keys starting: 'request.tem[0] .= '?register=1';
  >                     }
  >                 } else {
  >                     $$menuitem[0] =~ s{\?register=1}{};
  >                 }
  >             }
  [raeburn at raeburn-53 auth]$ cd ../interface
  [raeburn at raeburn-53 interface]$ cvs commit lonmenu.pm ../auth/lonroles.pm
  
  - Don't show Syllabus item in secondary menu in course context to students
    unless syllabus has been edited.
  - Information about active course feeds and syllabus modification time
    stored in %env with keys starting: 'request.' '  
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.413 loncom/interface/lonmenu.pm:1.414
--- loncom/interface/lonmenu.pm:1.413	Mon May  6 15:02:49 2013
+++ loncom/interface/lonmenu.pm	Thu May  9 05:24:36 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.413 2013/05/06 15:02:49 raeburn Exp $
+# $Id: lonmenu.pm,v 1.414 2013/05/09 05:24:36 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -333,12 +333,17 @@
             $showsyllabus = 1;
             $showfeeds = 1;
         } else {
-            unless (&Apache::lonnet::is_on_map("public/$cdom/$cnum",'syllabus')) {
-                $showsyllabus = 1;
+            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;
             }
-            if ($env{'course.'.$env{'request.course.id'}.'.feeds'}) {
-                $showfeeds = 1; 
-            } 
         }
     }
 
@@ -403,6 +408,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);
         }
     }
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.283 loncom/auth/lonroles.pm:1.284
--- loncom/auth/lonroles.pm:1.283	Mon May  6 16:16:03 2013
+++ loncom/auth/lonroles.pm	Thu May  9 05:24:42 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.283 2013/05/06 16:16:03 raeburn Exp $
+# $Id: lonroles.pm,v 1.284 2013/05/09 05:24:42 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -519,16 +519,26 @@
                         my $msg;
 			my ($furl,$ferr)=
 			    &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
-                        unless (($ferr) || ($env{'form.switchrole'}) ||
-                                ($env{"environment.internal.$cdom.$cnum.$role.adhoc"})) {
-                            &Apache::lonnet::put('nohist_crslastlogin',
-                                {$env{'user.name'}.':'.$env{'user.domain'}.
-                                ':'.$csec.':'.$role => $now},$cdom,$cnum);
-                            my $feeds;
+                        unless ($ferr) {
+                            unless (($env{'form.switchrole'}) || 
+                                    ($env{"environment.internal.$cdom.$cnum.$role.adhoc"})) {
+                                &Apache::lonnet::put('nohist_crslastlogin',
+                                    {$env{'user.name'}.':'.$env{'user.domain'}.
+                                     ':'.$csec.':'.$role => $now},$cdom,$cnum);
+                            }
+                            my ($feeds,$syllabus_time);
                             &Apache::lonrss::advertisefeeds($cnum,$cdom,undef,\$feeds);
-                            &Apache::lonnet::appenv(
-                                                   {'course.'.$cdom.'_'.$cnum.'.feeds' => $feeds}
-                                                    );
+                            &Apache::lonnet::appenv({'request.course.feeds' => $feeds});
+                            unless ($env{'course.'.$cdom.'_'.$cnum.'.updatedsyllabus'}) {
+                                unless (($env{'course.'.$cdom.'_'.$cnum.'.externalsyllabus'}) ||
+                                        ($env{'course.'.$cdom.'_'.$cnum.'.uploadedsyllabus'})) {
+                                    my %syllabus=&Apache::lonnet::dump('syllabus',$cdom,$cnum);
+                                    $syllabus_time = $syllabus{'uploaded.lastmodified'};
+                                    if ($syllabus_time) {
+                                        &Apache::lonnet::appenv({'request.course.syllabustime' => $syllabus_time});
+                                    }
+                                }
+                            }
                         }
 			if (($env{'form.orgurl'}) && 
 			    ($env{'form.orgurl'}!~/^\/adm\/flip/)) {




More information about the LON-CAPA-cvs mailing list