[LON-CAPA-cvs] cvs: loncom /interface lonhtmlcommon.pm lonmeta.pm /publisher loncfile.pm lonpubdir.pm

www lon-capa-cvs@mail.lon-capa.org
Mon, 29 Dec 2003 19:01:27 -0000


This is a MIME encoded message

--www1072724487
Content-Type: text/plain

www		Mon Dec 29 14:01:27 2003 EDT

  Modified files:              
    /loncom/interface	lonhtmlcommon.pm lonmeta.pm 
    /loncom/publisher	loncfile.pm lonpubdir.pm 
  Log:
  Correct language headers in loncfile
  Improved filename crumbs
  Better prettyprint
  
  
--www1072724487
Content-Type: text/plain
Content-Disposition: attachment; filename="www-20031229140127.txt"

Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.35 loncom/interface/lonhtmlcommon.pm:1.36
--- loncom/interface/lonhtmlcommon.pm:1.35	Mon Dec 29 12:11:53 2003
+++ loncom/interface/lonhtmlcommon.pm	Mon Dec 29 14:01:27 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.35 2003/12/29 17:11:53 www Exp $
+# $Id: lonhtmlcommon.pm,v 1.36 2003/12/29 19:01:27 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -842,15 +842,16 @@
     my ($uri,$target,$prefix)=@_;
     my $output='<br /><tt><b><font size="+2">'.$prefix.'/';
     if ($ENV{'user.adv'}) {
-	my $path=$prefix.'/';
+	my $path=$prefix;
 	foreach (split('/',$uri)) {
 	    unless ($_) { next; }
-	    $path.=$_.'/';
+	    $path.='/'.$_;
 	    $output.='<a href="'.$path.'"'.($target?' target="'.$target.'"':'').'>'.$_.'</a>/';
 	}
     } else {
 	$output.=$uri;
     }
+    unless ($uri=~/\/$/) { $output=~s/\/$//; }
     return $output.'</font></b></tt><br />';
 }
 
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.46 loncom/interface/lonmeta.pm:1.47
--- loncom/interface/lonmeta.pm:1.46	Mon Dec 29 12:11:53 2003
+++ loncom/interface/lonmeta.pm	Mon Dec 29 14:01:27 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.46 2003/12/29 17:11:53 www Exp $
+# $Id: lonmeta.pm,v 1.47 2003/12/29 19:01:27 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -108,6 +108,9 @@
     #
     # Deal with 'count' separately
     $returnhash{'count'} = &access_count($url,$aauthor,$adomain);
+    # since "usage" is reserved word in MySQL ...
+    $returnhash{'sequsage'}=$returnhash{'usage'};
+    $returnhash{'sequsage_list'}=$returnhash{'usage_list'};
 
     return %returnhash;
 }
@@ -117,7 +120,7 @@
     my %countdata=&Apache::lonnet::dump('nohist_accesscount',$adomain,
                                         $author,$src);
     if (! exists($countdata{$src})) {
-        return 'Not Available';
+        return &mt('Not Available');
     } else {
         return $countdata{$src};
     }
@@ -137,7 +140,7 @@
     $alttag=~s/\s+$//gs;
     $alttag=~s/^\s+//gs;
     if ($alttag) { return $alttag; } else 
-                 { return 'No information available'; }
+                 { return &mt('No information available'); }
 }
 
 # -------------------------------------------------------------- Author display
@@ -226,9 +229,13 @@
 				   'obsoletereplacement' => 'Suggested Replacement for Obsolete File',
 				   'count'      => 'Network-wide number of accesses (hits)',
 				   'course'     => 'Network-wide number of courses using resource',
-				   'usage'      => 'Number of resources using or importing resource',
+				   'course_list' => 'Network-wide courses using resource',
+				   'sequsage'      => 'Number of resources using or importing resource',
+				   'sequsage_list' => 'Resources using or importing resource',
 				   'goto'       => 'Number of resources that follow this resource in maps',
+				   'goto_list'  => 'Resources that follow this resource in maps',
 				   'comefrom'   => 'Number of resources that lead up to this resource in maps',
+				   'comefrom_list' => 'Resources that lead up to this resource in maps',
 				   'clear'      => 'Material presented in clear way',
 				   'depth'      => 'Material covered with sufficient depth',
 				   'helpful'    => 'Material is helpful',
@@ -276,6 +283,8 @@
 	$value=~s/(\w+)(\:|\@)(\w+)/&authordisplay($1,$3)/gse;
 	return $value;
     }
+# Only for advance users below
+    unless ($ENV{'user.adv'}) { return '<i>- '.&mt('not displayed').' -</i>' };
 # File
     if (($type eq 'customdistributionfile') ||
 	($type eq 'obsoletereplacement') ||
@@ -351,14 +360,6 @@
   foreach (split(/\,/,&Apache::lonnet::metadata($uri,'keys'))) {
       $content{$_}=&Apache::lonnet::metadata($uri,$_);
   }
-# ------------------------------------------------------------------ Hide stuff
-
-  unless ($ENV{'user.adv'}) {
-      foreach ('keywords','notes','abstract','subject') {
-          $content{$_}='<i>- '.&mt('not displayed').' -</i>';
-      }
-  }
-
 # --------------------------------------------------------------- Render Output
 # displayed url
     my ($thisversion)=($uri=~/\.(\d+)\.(\w+)\.meta$/);
@@ -370,7 +371,8 @@
     my $versiondisplay='';
     if ($thisversion) {
 	$versiondisplay=&mt('Version').': '.$thisversion.
-	    ' ('.&mt('most recent version').': '.$currentversion.')';
+	    ' ('.&mt('most recent version').': '.
+	    ($currentversion>0?$currentversion:&mt('information not available')).')';
     } else {
 	$versiondisplay='Version: '.$currentversion;
     }
@@ -420,103 +422,79 @@
 ENDHEAD
   if ($ENV{'user.adv'}) {
 # ------------------------------------------------------------ Dynamic Metadata
-   $r->print(
-   '<h3>'.&mt('Dynamic Metadata').' ('.
-	     &mt('updated periodically').')</h3>'.&mt('Processing').
-	     ' ...<br>');
-   $r->rflush();
-   my %items=&fieldnames();
-   my %dynmeta=&dynamicmeta($uri);
-   $r->print(
-'</table><h4>'.&mt('Access and Usage Statistics').'</h4><table cellspacing=2 border=0>');
-   foreach ('count') {
-       $r->print(
-'<tr><td bgcolor="#AAAAAA">'.$items{$_}.'</td><td bgcolor="#CCCCCC">'.
-$dynmeta{$_}."&nbsp;</td></tr>\n");
-   }
-   foreach my $cat ('usage','comefrom','goto') {
-       $r->print(
-'<tr><td bgcolor="#AAAAAA">'.$items{$cat}.'</td><td bgcolor="#CCCCCC">'.
-$dynmeta{$cat}.'<font size="-1"><ul>'.join("\n",
-      map { my $murl=$_; 
- '<li><a href="'.&Apache::lonnet::clutter($murl).'" target="preview">'.
-                        &Apache::lonnet::gettitle($murl).' [<tt>'.$murl
-                        .'</tt>]</a></li>' }
-      split(/\,/,$dynmeta{$cat.'_list'}))."</ul></font></td></tr>\n");
-   }
-   foreach my $cat ('course') {
-       $r->print(
-'<tr><td bgcolor="#AAAAAA">'.$items{$cat}.'</td><td bgcolor="#CCCCCC">'.
-$dynmeta{$cat}.'<font size="-1"><ul>'.join("\n",
-      map { my %courseinfo=&Apache::lonnet::coursedescription($_);  
- '<li><a href="/public/'.
-  $courseinfo{'domain'}.'/'.$courseinfo{'num'}.'/syllabus" target="preview">'.
-  $courseinfo{'description'}.'</a></li>' }
-      split(/\,/,$dynmeta{$cat.'_list'}))."</ul></font></td></tr>\n");
-   }
-       $r->print('</table>');
-   if ($uri=~/\.(problem|exam|quiz|assess|survey|form)\.meta$/) {
       $r->print(
-'<h4>'.&mt('Assessment Statistical Data').'</h4><table cellspacing=2 border=0>');
-      foreach ('stdno','avetries') {
-          $r->print(
-'<tr><td bgcolor="#AAAAAA">'.$items{$_}.'</td><td bgcolor="#CCCCCC">'.
-$dynmeta{$_}."&nbsp;</td></tr>\n");
+		'<h3>'.&mt('Dynamic Metadata').' ('.
+		&mt('updated periodically').')</h3>'.&mt('Processing').
+		' ...<br />');
+      $r->rflush();
+      my %items=&fieldnames();
+      my %dynmeta=&dynamicmeta($uri);
+# General Access and Usage Statistics
+      $r->print('<h4>'.&mt('Access and Usage Statistics').'</h4><table cellspacing=2 border=0>');
+      foreach ('count',
+	       'sequsage','sequsage_list',
+	       'comefrom','comefrom_list',
+	       'goto','goto_list',
+	       'course','course_list') {
+	  $r->print('<tr><td bgcolor="#AAAAAA">'.$lt{$_}.'</td><td bgcolor="#CCCCCC">'.
+		    &prettyprint($dynmeta{$_})."</td></tr>\n");
       }
-      foreach ('difficulty') {
-         $r->print(
-'<tr><td bgcolor="#AAAAAA">'.$items{$_}.'</td><td bgcolor="#CCCCCC">'.
-&diffgraph($dynmeta{$_})."</td></tr>\n");
+      $r->print('</table>');
+      if ($uri=~/\.(problem|exam|quiz|assess|survey|form)\.meta$/) {
+# This is an assessment, print assessment data
+	  $r->print(
+		    '<h4>'.&mt('Assessment Statistical Data').'</h4><table cellspacing=2 border=0>');
+	  foreach ('stdno','avetries','difficulty') {
+	      $r->print('<tr><td bgcolor="#AAAAAA">'.$lt{$_}.'</td><td bgcolor="#CCCCCC">'.
+			&prettyprint($dynmeta{$_})."</td></tr>\n");
+	  }
+	  $r->print('</table>');    
+      }
+      $r->print('<h4>'.&mt('Evaluation Data').'</h4><table cellspacing=2 border=0>');
+      foreach ('clear','depth','helpful','correct','technical') {
+	  $r->print('<tr><td bgcolor="#AAAAAA">'.$lt{$_}.'</td><td bgcolor="#CCCCCC">'.
+		    &prettyprint($dynmeta{$_})."</td></tr>\n");
+     }    
+      $r->print('</table>');
+      $disuri=~/^(\w+)\/(\w+)\//;   
+      if ((($ENV{'user.domain'} eq $1) && ($ENV{'user.name'} eq $2))
+	  || ($ENV{'user.role.ca./'.$1.'/'.$2})) {
+	  $r->print(
+		    '<h4>'.&mt('Evaluation Comments').' ('.&mt('visible to author and co-authors only').')</h4>'.
+		    '<blockquote>'.$dynmeta{'comments'}.'</blockquote>');
+	  $r->print('<h4>'.&mt('Error Messages').' ('.
+		    &mt('visible to author and co-authors only').')</h4>');
+	  my %errormsgs=&Apache::lonnet::dump('nohist_res_msgs',$1,$2);
+	  foreach (keys %errormsgs) {
+	      if ($_=~/^\Q$disuri\E\_\d+$/) {
+		  my %content=&Apache::lonmsg::unpackagemsg($errormsgs{$_});
+		  $r->print('<b>'.$content{'time'}.'</b>: '.$content{'message'}.
+			    '<br />');
+	      }
+	  }      
       }
-      $r->print('</table>');    
-   }
-   $r->print('<h4>'.&mt('Evaluation Data').'</h4><table cellspacing=2 border=0>');
-   foreach ('clear','depth','helpful','correct','technical') {
-       $r->print(
-'<tr><td bgcolor="#AAAAAA">'.$items{$_}.'</td><td bgcolor="#CCCCCC">'.
-&evalgraph($dynmeta{$_})."</td></tr>\n");
-   }    
-   $r->print('</table>');
-   $disuri=~/^(\w+)\/(\w+)\//;   
-   if ((($ENV{'user.domain'} eq $1) && ($ENV{'user.name'} eq $2))
-       || ($ENV{'user.role.ca./'.$1.'/'.$2})) {
-      $r->print(
-  '<h4>'.&mt('Evaluation Comments').' ('.&mt('visible to author and co-authors only').')</h4>'.
-      '<blockquote>'.$dynmeta{'comments'}.'</blockquote>');
-      $r->print(
-   '<h4>'.&mt('Error Messages').' ('.
-          &mt('visible to author and co-authors only').')</h4>');
-      my %errormsgs=&Apache::lonnet::dump('nohist_res_msgs',$1,$2);
-      foreach (keys %errormsgs) {
-	if ($_=~/^\Q$disuri\E\_\d+$/) {
-          my %content=&Apache::lonmsg::unpackagemsg($errormsgs{$_});
-	  $r->print('<b>'.$content{'time'}.'</b>: '.$content{'message'}.
-                    '<br />');
-        }
-      }      
-   }
 # ------------------------------------------------------------- All other stuff
-   $r->print(
- '<h3>'.&mt('Additional Metadata (non-standard, parameters, exports)').'</h3>');
-   foreach (sort keys %content) {
-      my $name=$_;
-      unless ($name=~/\.display$/) {
-	  my $display=&Apache::lonnet::metadata($uri,$name.'.display');
-	  unless ($display) { $display=$name; };
-	  my $otherinfo='';
-	  foreach ('name','part','type','default') {
-	      if (defined(&Apache::lonnet::metadata($uri,$name.'.'.$_))) {
-		  $otherinfo.=' '.$_.'='.
-		      &Apache::lonnet::metadata($uri,$name.'.'.$_).'; ';
+      $r->print(
+		'<h3>'.&mt('Additional Metadata (non-standard, parameters, exports)').'</h3>');
+      foreach (sort keys %content) {
+	  my $name=$_;
+	  unless ($name=~/\.display$/) {
+	      my $display=&Apache::lonnet::metadata($uri,$name.'.display');
+	      unless ($display) { $display=$name; };
+	      my $otherinfo='';
+	      foreach ('name','part','type','default') {
+		  if (defined(&Apache::lonnet::metadata($uri,$name.'.'.$_))) {
+		      $otherinfo.=' '.$_.'='.
+			  &Apache::lonnet::metadata($uri,$name.'.'.$_).'; ';
+		  }
 	      }
+	      $r->print('<b>'.$display.':</b> '.$content{$name});
+	      if ($otherinfo) {
+		  $r->print(' ('.$otherinfo.')');
+	      }
+	      $r->print("<br />\n");
 	  }
-	  $r->print('<b>'.$display.':</b> '.$content{$name});
-	  if ($otherinfo) {
-	      $r->print(' ('.$otherinfo.')');
-	  }
-	  $r->print("<br>\n");
       }
-   }
   }
 # ===================================================== End Resource Space Call
  } else {
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.48 loncom/publisher/loncfile.pm:1.49
--- loncom/publisher/loncfile.pm:1.48	Mon Dec 15 17:01:14 2003
+++ loncom/publisher/loncfile.pm	Mon Dec 29 14:01:27 2003
@@ -9,7 +9,7 @@
 #  and displays a page showing the results of the action.
 #
 #
-# $Id: loncfile.pm,v 1.48 2003/12/15 22:01:14 taceyjo1 Exp $
+# $Id: loncfile.pm,v 1.49 2003/12/29 19:01:27 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1154,7 +1154,7 @@
   }
 
 
-  $r->content_type('text/html');
+  &Apache::loncommon::content_type($r,'text/html');
   $r->send_http_header;
 
   $r->print('<html><head><title>LON-CAPA Construction Space</title></head>');
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.48 loncom/publisher/lonpubdir.pm:1.49
--- loncom/publisher/lonpubdir.pm:1.48	Mon Dec 22 14:30:25 2003
+++ loncom/publisher/lonpubdir.pm	Mon Dec 29 14:01:27 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construction Space Directory Lister
 #
-# $Id: lonpubdir.pm,v 1.48 2003/12/22 19:30:25 www Exp $
+# $Id: lonpubdir.pm,v 1.49 2003/12/29 19:01:27 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -222,7 +222,7 @@
 		  '</h3>');
     }
     $r->print(
-       &Apache::lonhtmlcommon::crumbs($thisdisfn,'_top','/priv/'.$uname));
+       &Apache::lonhtmlcommon::crumbs($thisdisfn.'/','_top','/priv/'.$uname));
 }
 
 #

--www1072724487--