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

www lon-capa-cvs@mail.lon-capa.org
Tue, 30 Dec 2003 22:19:18 -0000


www		Tue Dec 30 17:19:18 2003 EDT

  Modified files:              
    /loncom/interface	lonmeta.pm lonmsg.pm 
    /loncom/publisher	lonpubdir.pm 
  Log:
  Bug #2444: show bombs in construction space.
  
  
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.50 loncom/interface/lonmeta.pm:1.51
--- loncom/interface/lonmeta.pm:1.50	Tue Dec 30 15:39:30 2003
+++ loncom/interface/lonmeta.pm	Tue Dec 30 17:19:18 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.50 2003/12/30 20:39:30 www Exp $
+# $Id: lonmeta.pm,v 1.51 2003/12/30 22:19:18 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -532,9 +532,9 @@
 	  $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').' ('.
+	  $r->print('<a name="bombs" /><h4>'.&mt('Error Messages').' ('.
 		    &mt('visible to author and co-authors only').')</h4>'.
-		    &Apache::lonmsg::retrieve_author_res_msg($2,$1,$uri));
+		    &Apache::lonmsg::retrieve_author_res_msg($uri));
       }
 # ------------------------------------------------------------- All other stuff
       $r->print(
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.74 loncom/interface/lonmsg.pm:1.75
--- loncom/interface/lonmsg.pm:1.74	Tue Dec 30 15:39:30 2003
+++ loncom/interface/lonmsg.pm	Tue Dec 30 17:19:18 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.74 2003/12/30 20:39:30 www Exp $
+# $Id: lonmsg.pm,v 1.75 2003/12/30 22:19:18 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -25,23 +25,8 @@
 #
 # http://www.lon-capa.org/
 #
-#
-# (Routines to control the menu
-#
-# (TeX Conversion Module
-#
-# 05/29/00,05/30 Gerd Kortemeyer)
-#
-# 10/05 Gerd Kortemeyer)
-#
-# 10/19,10/20,10/30,
-# 02/06/01 Gerd Kortemeyer
-# 07/27 Guy Albertelli
-# 07/27,07/28,07/30,08/03,08/06,08/08,08/09,08/10,8/13,8/15,
-# 10/1,11/5 Gerd Kortemeyer
-# YEAR=2002
-# 1/1,3/18 Gerd Kortemeyer
-#
+
+
 package Apache::lonmsg;
 
 =pod
@@ -287,8 +272,9 @@
 # =========================================== Retrieve author resource messages
 
 sub retrieve_author_res_msg {
-    my ($author,$domain,$url)=@_;
+    my $url=shift;
     $url=&Apache::lonnet::declutter($url);
+    my ($domain,$author)=($url=~/^(\w+)\/(\w+)\//);
     my %errormsgs=&Apache::lonnet::dump('nohist_res_msgs',$1,$2);
     my $msgs='';
     foreach (keys %errormsgs) {
@@ -306,7 +292,7 @@
 # =============================== Delete all author messages related to one URL
 
 sub del_url_author_res_msg {
-    my ($author,$domain,$url)=@_;
+    my $url=shift;
     $url=&Apache::lonnet::declutter($url);
 }
 
@@ -314,6 +300,12 @@
 
 sub all_url_author_res_msg {
     my ($author,$domain)=@_;
+    my %returnhash=();
+    foreach (&Apache::lonnet::getkeys('nohist_res_msgs')) {
+	$_=~/^(.+)\_\d+/;
+	$returnhash{$1}=1;
+    }
+    return %returnhash;
 }
 
 # ================================================== Critical message to a user
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.49 loncom/publisher/lonpubdir.pm:1.50
--- loncom/publisher/lonpubdir.pm:1.49	Mon Dec 29 14:01:27 2003
+++ loncom/publisher/lonpubdir.pm	Tue Dec 30 17:19:18 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construction Space Directory Lister
 #
-# $Id: lonpubdir.pm,v 1.49 2003/12/29 19:01:27 www Exp $
+# $Id: lonpubdir.pm,v 1.50 2003/12/30 22:19:18 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -37,6 +37,7 @@
 use Apache::loncommon();
 use Apache::lonhtmlcommon();
 use Apache::lonlocal;
+use Apache::lonmsg;
 
 sub handler {
 
@@ -85,11 +86,11 @@
   my $targetdir=$udom.'/'.$uname.$thisdisfn; # Publiction target directory.
   my $linkdir='/priv/'.$uname.$thisdisfn;      # Full URL name of constr space.
 
-
+  my %bombs=&Apache::lonmsg::all_url_author_res_msg($uname,$udom);
 
   &startpage($r, $uname, $udom, $thisdisfn);   # Put out the start of page.
   
-  # Start off the diretory table.
+  # Start off the directory table.
 
   $r->print('<table border=2>'.
 	    '<tr><th>'.&mt('Actions').'</th><th>'.&mt('Name').'</th><th>'.
@@ -111,10 +112,10 @@
      my $extension='';
      if ($filename=~/\.(\w+)$/) { $extension=$1; }
      if ($cmode&$dirptr) {
-	 putdirectory($r, $thisdisfn, $linkdir, $filename, $cmtime);
+	 putdirectory($r, $thisdisfn, $linkdir, $filename, $cmtime,$targetdir,\%bombs);
      } elsif (&Apache::loncommon::fileembstyle($extension) ne 'hdn') {
 	 putresource($r, $uname, $filename, $thisdisfn, $resdir, 
-		     $targetdir, $linkdir, $cmtime);
+		     $targetdir, $linkdir, $cmtime,\%bombs);
      } else {
 	# "hidden" extension and not a directory, so hide it away.
      }
@@ -222,7 +223,7 @@
 		  '</h3>');
     }
     $r->print(
-       &Apache::lonhtmlcommon::crumbs($thisdisfn.'/','_top','/priv/'.$uname));
+       &Apache::lonhtmlcommon::crumbs($uname.'/'.$thisdisfn.'/','_top','/priv'));
 }
 
 #
@@ -255,7 +256,7 @@
 #      modtime - Encoded modification time.
 # 
 sub putdirectory {
-    my ($r, $reqfile, $here, $dirname, $modtime) = @_;
+    my ($r, $reqfile, $here, $dirname, $modtime, $resdir, $bombs) = @_;
   
     # construct the display filename: the directory name unless ..:
     
@@ -265,11 +266,15 @@
     }
     unless (( ($dirname eq '..') && ($reqfile eq '')) ||
 	    ($dirname eq '.')) {
+	my $kaputt=0;
+	foreach (keys %{$bombs}) {
+	    if ($_=~/^$resdir\/$disfilename\//) { $kaputt=1; last; }
+	}
 	$r->print('<tr bgcolor="#CCCCFF">'.
 		  '<td>'.&mt('Go to ...').'</td>'.
 		  '<td><a href="'.$here.'/'.$dirname.'/" target="_top">'.
 		  $disfilename.'</a></td>'.
-		        '<td>&nbsp;</td>'.
+		        '<td>'.($kaputt?'<img src="/adm/lonMisc/bomb.gif" />':'&nbsp;').'</td>'.
 		  '<td>&nbsp;</td>'.
 		  '<td>'.&Apache::lonlocal::locallocaltime($modtime).'</td>'.
 		  "</tr>\n");
@@ -282,7 +287,7 @@
 sub putresource {
     my ($r, $uname, $filename, $thisdisfn, 
 	$resdir, $targetdir, $linkdir,
-	$cmtime) = @_;
+	$cmtime,$bombs) = @_;
 
     my $status=&mt('Unpublished');
     my $bgcolor='#FFCCCC';
@@ -301,11 +306,13 @@
 	    }
 	    $title='<a href="/res/'.$targetdir.'/'.$filename.
 		'.meta" target=cat>'.
+		($$bombs{$targetdir.'/'.$filename}?'<img src="/adm/lonMisc/bomb.gif" />':'').
 		getTitleString($targetdir.'/'.$filename, 'title').'</a>';
 	} else {
 	    $status=&mt('Modified');
             $bgcolor='#FFFFCC';
 	    $title='<a href="/res/'.$targetdir.'/'.$filename.'.meta" target=cat>'.
+		($$bombs{$targetdir.'/'.$filename}?'<img src="/adm/lonMisc/bomb.gif" />':'').
 		getTitleString($targetdir.'/'.$filename,'title').'</a>';
 	    if (&Apache::loncommon::fileembstyle(($filename=~/\.(\w+)$/)) eq 'ssi') {
 		$status.='<br><a href="/adm/diff?filename=/~'.$uname.