--- loncom/interface/loncommon.pm	2002/08/28 19:42:49	1.63
+++ loncom/interface/loncommon.pm	2002/12/26 15:38:54	1.73
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.63 2002/08/28 19:42:49 www Exp $
+# $Id: loncommon.pm,v 1.73 2002/12/26 15:38:54 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -493,7 +493,7 @@ sub help_open_topic {
 
     if (!$stayOnPage)
     {
-	$link = "javascript:void(open('/adm/help/${filename}.hlp', 'Help_for_$topic', 'menubar=0,toolbar=1,scrollbars=1,width=$width,height=$height'))";
+	$link = "javascript:void(open('/adm/help/${filename}.hlp', 'Help_for_$topic', 'menubar=0,toolbar=1,scrollbars=1,width=$width,height=$height,resizable=yes'))";
     }
     else
     {
@@ -974,6 +974,26 @@ sub plainname {
     return $name;
 }
 
+# -------------------------------------------------------------------- Nickname
+
+
+sub nickname {
+    my ($uname,$udom)=@_;
+    my %names=&Apache::lonnet::get('environment',
+  ['nickname','firstname','middlename','lastname','generation'],$udom,$uname);
+    my $name=$names{'nickname'};
+    if ($name) {
+       $name='"'.$name.'"'; 
+    } else {
+       $name=$names{'firstname'}.' '.$names{'middlename'}.' '.
+	     $names{'lastname'}.' '.$names{'generation'};
+       $name=~s/\s+$//;
+       $name=~s/\s+/ /g;
+    }
+    return $name;
+}
+
+
 # ------------------------------------------------------------------ Screenname
 
 sub screenname {
@@ -993,15 +1013,16 @@ sub messagewrapper {
 # ------------------------------------------------------------- Aboutme Wrapper
 
 sub aboutmewrapper {
-    my ($link,$un,$do)=@_;
-    return "<a href='/adm/$do/$un/aboutme'>$link</a>";
+    my ($link,$username,$domain)=@_;
+    return "<a href='/adm/$domain/$username/aboutme'>$link</a>";
 }
 
 # ------------------------------------------------------------ Syllabus Wrapper
 
 
 sub syllabuswrapper {
-    my ($link,$un,$do)=@_;
+    my ($link,$un,$do,$tf)=@_;
+    if ($tf) { $link='<font color="'.$tf.'">'.$link.'</font>'; }
     return "<a href='/public/$do/$un/syllabus'>$link</a>";
 }
 
@@ -1134,7 +1155,7 @@ sub get_previous_attempt {
 }
 
 sub get_student_view {
-  my ($symb,$username,$domain,$courseid) = @_;
+  my ($symb,$username,$domain,$courseid,$target) = @_;
   my ($map,$id,$feedurl) = split(/___/,$symb);
   my (%old,%moreenv);
   my @elements=('symb','courseid','domain','username');
@@ -1142,6 +1163,7 @@ sub get_student_view {
     $old{$element}=$ENV{'form.grade_'.$element};
     $moreenv{'form.grade_'.$element}=eval '$'.$element #'
   }
+  if ($target eq 'tex') {$moreenv{'form.grade_target'} = 'tex';}
   &Apache::lonnet::appenv(%moreenv);
   my $userview=&Apache::lonnet::ssi('/res/'.$feedurl);
   &Apache::lonnet::delenv('form.grade_');
@@ -1201,6 +1223,22 @@ sub maketime {
 }
 
 
+#########################################
+#
+# Retro-fixing of un-backward-compatible time format
+
+sub unsqltime {
+    my $timestamp=shift;
+    if ($timestamp=~/^(\d+)\-(\d+)\-(\d+)\s+(\d+)\:(\d+)\:(\d+)$/) {
+       $timestamp=&maketime(
+	   'year'=>$1,'month'=>$2,'day'=>$3,
+           'hours'=>$4,'minutes'=>$5,'seconds'=>$6);
+    }
+    return $timestamp;
+}
+
+#########################################
+
 sub findallcourses {
     my %courses=();
     my $now=time;
@@ -1262,7 +1300,8 @@ sub domainlogo {
     my $domain = &determinedomain(shift);    
      # See if there is a logo
     if (-e '/home/httpd/html/adm/lonDomLogos/'.$domain.'.gif') {
-        return '<img src="/adm/lonDomLogos/'.$domain.'.gif" />';
+        return '<img src="http://'.$ENV{'HTTP_HOST'}.':8080/adm/lonDomLogos/'.
+               $domain.'.gif" />';
     } elsif(exists($Apache::lonnet::domaindescription{$domain})) {
         return $Apache::lonnet::domaindescription{$domain};
     } else {
@@ -1366,7 +1405,7 @@ END
 $bodytag
 <table width="100%" cellspacing="0" border="0" cellpadding="0">
 <tr><td bgcolor="$font">
-<img src="$img" /></td>
+<img src="http://$ENV{'HTTP_HOST'}:8080/$img" /></td>
 <td bgcolor="$font"><font color='$sidebg'>$messages</font></td>
 </tr>
 <tr>
@@ -1780,7 +1819,7 @@ will result in $ENV{'form.uname'} and $E
 
 returns cache-controlling header code
 
-=item nocache() 
+=item no_cache($r) 
 
 specifies header code to not have cache