[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm

bisitz bisitz at source.lon-capa.org
Fri Jan 10 12:03:30 EST 2014


bisitz		Fri Jan 10 17:03:30 2014 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm 
  Log:
  Bug #6689: Do not provide example link for templates which contain nothing to display.
  
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.340 loncom/homework/lonhomework.pm:1.341
--- loncom/homework/lonhomework.pm:1.340	Wed Aug 21 16:07:49 2013
+++ loncom/homework/lonhomework.pm	Fri Jan 10 17:03:30 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.340 2013/08/21 16:07:49 bisitz Exp $
+# $Id: lonhomework.pm,v 1.341 2014/01/10 17:03:30 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1133,6 +1133,7 @@
                       &mt(&Apache::lonnet::metadata($_, 'help'))]} (@files);
     @files = sort {$a->[2].$a->[1] cmp $b->[2].$b->[1]} (@files);
     my ($midpoint,$seconddiv,$numfiles);
+    my @noexamplelink = ('blank.problem','blank.library','script.library');
     $numfiles = 0;
     foreach my $file (@files) {
         next if ($file->[1] !~ /\S/);
@@ -1171,11 +1172,16 @@
         if ($file->[3]) {
            $result.=&Apache::loncommon::help_open_topic($file->[3]);
         }
+        # Provide example link
         my $filename=$file->[0];
         $filename=~s{^\Q$londocroot\E}{};
-        $result.=' <span class="LC_fontsize_small">'
-                .&Apache::loncommon::modal_link($filename.'?inhibitmenu=yes',&mt('Example'),600,420,'sample')
-                .'</span><br />'."\n";
+         if (!(grep $filename =~ $_, @noexamplelink)) {
+           $result .= ' <span class="LC_fontsize_small">'
+                     .&Apache::loncommon::modal_link(
+                          $filename.'?inhibitmenu=yes',&mt('Example'),600,420,'sample')
+                     .'</span>';
+        };
+        $result .= '<br />'."\n";
         $count ++;
     }
     if ($numfiles > 0) {




More information about the LON-CAPA-cvs mailing list