[LON-CAPA-cvs] cvs: loncom /interface lonhtmlcommon.pm lonindexer.pm lonmeta.pm

www lon-capa-cvs@mail.lon-capa.org
Thu, 17 Jun 2004 18:22:13 -0000


www		Thu Jun 17 14:22:13 2004 EDT

  Modified files:              
    /loncom/interface	lonhtmlcommon.pm lonindexer.pm lonmeta.pm 
  Log:
  "People who got this also get that" now works. Still needs stats.
  
  
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.77 loncom/interface/lonhtmlcommon.pm:1.78
--- loncom/interface/lonhtmlcommon.pm:1.77	Fri Jun 11 21:09:31 2004
+++ loncom/interface/lonhtmlcommon.pm	Thu Jun 17 14:22:13 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.77 2004/06/12 01:09:31 www Exp $
+# $Id: lonhtmlcommon.pm,v 1.78 2004/06/17 18:22:13 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -841,11 +841,13 @@
 # ------------------------------------------------------- Puts directory header
 
 sub crumbs {
-    my ($uri,$target,$prefix,$form,$size)=@_;
+    my ($uri,$target,$prefix,$form,$size,$noformat)=@_;
     if (! defined($size)) {
         $size = '+2';
     }
-    my $output='<br /><tt><b><font size="'.$size.'">'.$prefix.'/';
+    my $output='';
+    unless ($noformat) { $output.='<br /><tt><b>'; }
+    $output.='<font size="'.$size.'">'.$prefix.'/';
     if ($ENV{'user.adv'}) {
 	my $path=$prefix.'/';
 	foreach (split('/',$uri)) {
@@ -862,7 +864,7 @@
 	$output.=$uri;
     }
     unless ($uri=~/\/$/) { $output=~s/\/$//; }
-    return $output.'</font></b></tt><br />';
+    return $output.'</font>'.($noformat?'':'</b></tt><br />');
 }
 
 # ------------------------------------------------- Output headers for HTMLArea
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.112 loncom/interface/lonindexer.pm:1.113
--- loncom/interface/lonindexer.pm:1.112	Wed Jun 16 21:44:34 2004
+++ loncom/interface/lonindexer.pm	Thu Jun 17 14:22:13 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Directory Indexer
 #
-# $Id: lonindexer.pm,v 1.112 2004/06/17 01:44:34 www Exp $
+# $Id: lonindexer.pm,v 1.113 2004/06/17 18:22:13 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -60,7 +60,7 @@
 my %dirs; # keys are directories, values are the open/close status
 my %language; # has the reference information present in language.tab
 my %dynhash; # hash of hashes for dynamic metadata
-
+my %fieldnames; # Metadata fieldnames
 # ----- Values which are set by the handler subroutine and are accessible to
 # -----     other methods.
 my $extrafield; # default extra table cell
@@ -87,6 +87,7 @@
     # these global to this package?  It is just so wrong....)
     undef (@Only);
     undef (@Omit);
+    %fieldnames=&Apache::lonmeta::fieldnames();
 
 # ------------------------------------- read in machine configuration variables
     my $iconpath= $r->dir_config('lonIconsURL') . "/";
@@ -136,7 +137,7 @@
        my $extra='';
        if (defined($ENV{'form.titleelement'})) {
 	   my $verify_title = &Apache::lonnet::gettitle($ENV{'form.acts'});
-	   &Apache::lonnet::logthis("Hrrm $ENV{'form.acts'} -- $verify_title");
+#	   &Apache::lonnet::logthis("Hrrm $ENV{'form.acts'} -- $verify_title");
 	   $verify_title=~s/'/\\'/g;
 	   $extra='window.opener.document.forms["'.$ENV{'form.form'}.'"].elements["'.$ENV{'form.titleelement'}.'"].value=\''.$verify_title.'\';';
        }
@@ -684,7 +685,6 @@
     if (($hash{'display_attrs_8'}==1) || ($hash{'display_attrs_11'}==1)) {
 	%dynhash=
 	    (%dynhash,&Apache::lonmeta::get_dynamic_metadata_from_sql($uri));
-	&Apache::lonnet::logthis('Found: '.$uri." : ".join(',',keys %dynhash));
     } 
 }
 
@@ -1037,17 +1037,20 @@
 	}
 	if ($hash{'display_attrs_11'} == 1) {
 # links
-	    $r->print("<td>$filelink");
-	    if ($dynhash{$filelink}->{'goto_list'}) {
-		$r->print(&mt('Number of students: ').
-			  $dynhash{$filelink}->{'goto_list'}.'<br />');
-	    }
-	    if ($dynhash{$filelink}->{'comefrom_list'}) {
-		$r->print(&mt('Number of students: ').
-			  $dynhash{$filelink}->{'comefrom_list'}.'<br />');
-	    }
-	    $r->print("&nbsp;</td>\n");
-	}
+	   $r->print('<td>');
+	   &dynmetaprint($r,$filelink,'goto_list');
+	   &dynmetaprint($r,$filelink,'comefrom_list');
+	   &dynmetaprint($r,$filelink,'sequsage_list');
+	   my $dependencies=&Apache::lonnet::metadata($filelink,'dependencies');
+	   if ($dependencies=~/\w/) {
+	       $r->print(&mt('Links to:').
+		     &Apache::lonmeta::prettyprint('linkto_list',&Apache::lonnet::metadata($filelink,'dependencies'),
+		  (($ENV{'form.catalogmode'} ne 'groupimport')?'preview':''),
+		  '',
+		  (($ENV{'form.catalogmode'} eq 'groupimport')?'document.forms.fileattr':''),1));
+	   }
+	   $r->print('</td>');
+	   }
 	$r->print("</tr>\n");
     }
 
@@ -1135,6 +1138,18 @@
 
 }
 
+sub dynmetaprint {
+    my ($r,$filelink,$item)=@_;
+    if ($dynhash{$filelink}->{$item}) {
+	$r->print($fieldnames{$item}.': '.
+		  &Apache::lonmeta::prettyprint($item,
+						$dynhash{$filelink}->{$item},
+		  (($ENV{'form.catalogmode'} ne 'groupimport')?'preview':''),
+		  '',
+		  (($ENV{'form.catalogmode'} eq 'groupimport')?'document.forms.fileattr':''),1));
+    }
+}
+
 # ------------------- prints the beginning of a form for directory or file link
 sub begin_form {
     my ($r,$uri) = @_;
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.81 loncom/interface/lonmeta.pm:1.82
--- loncom/interface/lonmeta.pm:1.81	Thu Jun 17 11:05:59 2004
+++ loncom/interface/lonmeta.pm	Thu Jun 17 14:22:13 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Metadata display handler
 #
-# $Id: lonmeta.pm,v 1.81 2004/06/17 15:05:59 www Exp $
+# $Id: lonmeta.pm,v 1.82 2004/06/17 18:22:13 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -283,7 +283,8 @@
 # Pretty printing of metadata field
 
 sub prettyprint {
-    my ($type,$value)=@_;
+    my ($type,$value,$target,$prefix,$form,$noformat)=@_;
+# $target,$prefix,$form are optional and for filecrumbs only
     if (! defined($value)) { 
         return '&nbsp;'; 
     }
@@ -337,8 +338,9 @@
 	($type eq 'obsoletereplacement') ||
 	($type eq 'goto_list') ||
 	($type eq 'comefrom_list') ||
-	($type eq 'sequsage_list')) {
-	return join('<br />',map {
+	($type eq 'sequsage_list') ||
+	($type eq 'linkto_list')) {
+	return '<ul><font size="-1">'.join("\n",map {
             my $url = &Apache::lonnet::clutter($_);
             my $title = &Apache::lonnet::gettitle($url);
             if ($title eq '') {
@@ -355,11 +357,10 @@
                     $title .= ' Syllabus';
                 } 
             }
-            $_ = '<b>'.$title.'</b> '.
-                '<a href="'.$url.'" target="preview">'.
-                '<font size="-1">'.$url.'</font>'.
-                '</a>'
-        } split(/\s*\,\s*/,$value));
+            $_ = '<li>'.$title.' '.
+		&Apache::lonhtmlcommon::crumbs($url,$target,$prefix,$form,'-1',$noformat).
+                '</li>'
+	    } split(/\s*\,\s*/,$value)).'</ul></font>';
     }
     # Evaluations
     if (($type eq 'clear') ||