[LON-CAPA-cvs] cvs: loncom /interface lonmeta.pm /localize/localize newphrases.txt

matthew lon-capa-cvs@mail.lon-capa.org
Wed, 14 Apr 2004 20:45:14 -0000


matthew		Wed Apr 14 16:45:14 2004 EDT

  Modified files:              
    /loncom/localize/localize	newphrases.txt 
    /loncom/interface	lonmeta.pm 
  Log:
  &print_dynamic_metadata:
  Now test to see if we should output some dynamic data before we bother 
  generating html tables to hold it.
  &prettyprint:
  Made output for goto_list, comefrom_list, etc, more concise and not use
  &lonhtmlcommon::crumbs.  Now just use a simple link.
  &report_bombs: Use simple link instead of lonhtmlcommon::crumbs.
  
  
Index: loncom/localize/localize/newphrases.txt
diff -u loncom/localize/localize/newphrases.txt:1.44 loncom/localize/localize/newphrases.txt:1.45
--- loncom/localize/localize/newphrases.txt:1.44	Thu Apr  1 10:29:40 2004
+++ loncom/localize/localize/newphrases.txt	Wed Apr 14 16:45:14 2004
@@ -81,4 +81,10 @@
 #[_1] is the foil name
 Foil name <b><tt>[_1]</tt></b> appears more than once. Foil names need to be unique.
 TeX unconverted due to errors
-Modify deadlines, etc, for this resource
\ No newline at end of file
+Modify deadlines, etc, for this resource
+Dynamic Metadata (updated periodically)
+No Access or Usages Statistics are available for this resource.
+No Assessment Statistical Data is available for this resource
+No Evaluation Data is available for this resource.
+There are no Evaluation Comments on this resource.
+There are currently no Error Messages for this resource.
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.69 loncom/interface/lonmeta.pm:1.70
--- loncom/interface/lonmeta.pm:1.69	Wed Apr 14 14:56:36 2004
+++ loncom/interface/lonmeta.pm	Wed Apr 14 16:45:14 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.69 2004/04/14 18:56:36 matthew Exp $
+# $Id: lonmeta.pm,v 1.70 2004/04/14 20:45:14 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -252,9 +252,11 @@
 	($type eq 'comefrom_list') ||
 	($type eq 'sequsage_list')) {
 	return join('<br />',map {
-            my $url=&Apache::lonnet::clutter($_);
-            '<b>'.&Apache::lonnet::gettitle($url).'</b>'.
-                &Apache::lonhtmlcommon::crumbs($url,'preview','',undef,'+0');
+            my $url = &Apache::lonnet::clutter($_);
+            $_ = '<b>'.&Apache::lonnet::gettitle($url).'</b> '.
+                '<a href="'.$url.'" target="preview">'.
+                '<font size="-1">'.$url.'</font>'.
+                '</a>'
         } split(/\s*\,\s*/,$value));
     }
     # Evaluations
@@ -450,10 +452,10 @@
             &Apache::lonmsg::all_url_author_res_msg($author,$domain);
         foreach (sort(keys(%brokenurls))) {
             if ($_=~/^\Q$uri\E/) {
-                $r->print(&Apache::lonhtmlcommon::crumbs
-                          (&Apache::lonnet::clutter($_)).
-                          &Apache::lonmsg::retrieve_author_res_msg($_).
-                          '<hr />');
+                $r->print
+                    ('<a href="'.&Apache::lonnet::clutter($_).'">'.$_.'</a>'.
+                     &Apache::lonmsg::retrieve_author_res_msg($_).
+                     '<hr />');
             }
         }
     } else {
@@ -554,27 +556,38 @@
     #
     my $description = 'Dynamic Metadata (updated periodically)';
     $r->print('<h3>'.&mt($description).'</h3>'.
-              &mt('Processing').' ...<br />');
+              &mt('Processing'));
     $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");
+    if (exists($dynmeta{'count'}) ||
+        exists($dynmeta{'sequsage'}) ||
+        exists($dynmeta{'comefrom'}) ||
+        exists($dynmeta{'goto'}) ||
+        exists($dynmeta{'course'})) {
+        $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");
+        }
+        $r->print('</table>');
+    } else {
+        $r->print('<h4>'.&mt('No Access or Usages Statistics are available for this resource.').'</h4>');
     }
-    $r->print('</table>');
     #
     # Assessment statistics
-    if ($uri=~/\.(problem|exam|quiz|assess|survey|form)$/) {
+    if ($uri=~/\.(problem|exam|quiz|assess|survey|form)$/ &&
+        (exists($dynmeta{'stdno'}) ||
+         exists($dynmeta{'avetries'}) ||
+         exists($dynmeta{'difficulty'}))) {
         # This is an assessment, print assessment data
         $r->print(
                   '<h4>'.&mt('Assessment Statistical Data').'</h4>'.
@@ -585,27 +598,44 @@
                       &prettyprint($_,$dynmeta{$_})."</td></tr>\n");
         }
         $r->print('</table>');    
+    } else {
+        $r->print('<h4>'.&mt('No Assessment Statistical Data is available for this resource').'</h4>');
     }
-    
-    $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");
+    if (exists($dynmeta{'clear'})   || 
+        exists($dynmeta{'depth'})   || 
+        exists($dynmeta{'helpful'}) || 
+        exists($dynmeta{'correct'}) || 
+        exists($dynmeta{'technical'})){ 
+        $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>');
+    } else {
+        $r->print('<h4>'.&mt('No Evaluation Data is available for this resource.').'</h4>');
     }
-    $r->print('</table>');
     $uri=~/^\/res\/(\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('<a name="bombs" /><h4>'.&mt('Error Messages').' ('.
-                  &mt('visible to author and co-authors only').')'.
-                  '</h4>'.
-                  &Apache::lonmsg::retrieve_author_res_msg($uri));
+        if (exists($dynmeta{'comments'})) {
+            $r->print('<h4>'.&mt('Evaluation Comments').' ('.
+                      &mt('visible to author and co-authors only').
+                      ')</h4>'.
+                      '<blockquote>'.$dynmeta{'comments'}.'</blockquote>');
+        } else {
+            $r->print('<h4>'.&mt('There are no Evaluation Comments on this resource.').'</h4>');
+        }
+        my $bombs = &Apache::lonmsg::retrieve_author_res_msg($uri);
+        if (defined($bombs) && $bombs ne '') {
+            $r->print('<a name="bombs" /><h4>'.&mt('Error Messages').' ('.
+                      &mt('visible to author and co-authors only').')'.
+                      '</h4>'.$bombs);
+        } else {
+            $r->print('<h4>'.&mt('There are currently no Error Messages for this resource.').'</h4>');
+        }
     }
     #
     # All other stuff