[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm outputtags.pm /lonnet/perl lonnet.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 28 Mar 2005 21:49:31 -0000


albertel		Mon Mar 28 16:49:31 2005 EDT

  Modified files:              
    /loncom/homework	outputtags.pm bridgetask.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  - fixing up the studentphot to have a lonnet command
  - making bridgetasks and outputtags use this command
  
  
Index: loncom/homework/outputtags.pm
diff -u loncom/homework/outputtags.pm:1.36 loncom/homework/outputtags.pm:1.37
--- loncom/homework/outputtags.pm:1.36	Fri Nov 12 16:15:05 2004
+++ loncom/homework/outputtags.pm	Mon Mar 28 16:49:31 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # tags that create controlled output
 #
-# $Id: outputtags.pm,v 1.36 2004/11/12 21:15:05 albertel Exp $
+# $Id: outputtags.pm,v 1.37 2005/03/28 21:49:31 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -186,9 +186,7 @@
     my $result;
     my (undef,undef,$domain,$user) = &Apache::lonxml::whichuser();
     if ($target eq 'web' && $user eq $ENV{'user.name'}) {
-	my $ret=&Apache::lonnet::reply("studentphoto:$domain:$user:gif",&Apache::lonnet::homeserver($user,$domain));
-	my $url="/uploaded/$domain/$user/internal/studentphoto.gif";
-	my $tokenurl=&Apache::lonnet::tokenwrapper($url);
+	my $url=&Apache::lonnet::studentphoto($domain,$user,"gif");
 	my $args;
 	my $width=&Apache::lonxml::get_param('width',$parstack,$safeeval);
 	if ($width) { $args.=" width=\"$width\" "; }
@@ -196,14 +194,12 @@
 	if ($height) { $args.=" height=\"$height\" "; }
 	my $align=&Apache::lonxml::get_param('align',$parstack,$safeeval);
 	if ($align) { $args.=" align=\"$align\" "; }
-	$result.=" <img $args src=\"$tokenurl\" alt=\"$user\@$domain\" />";
+	$result.=" <img $args src=\"$url\" alt=\"$user\@$domain\" />";
     }
     if ($target eq 'tex' && $ENV{'request.role'} =~ /^cc/) {
-	my $ret=&Apache::lonnet::reply("studentphoto:$domain:$user:eps",&Apache::lonnet::homeserver($user,$domain));
-	my $url="/uploaded/$domain/$user/internal/studentphoto.eps";
-	my $tokenurl=&Apache::lonnet::tokenwrapper($url);
+	my $url=&Apache::lonnet::studentphoto($domain,$user,"eps");
 	my $ua=new LWP::UserAgent;
-	my $request=new HTTP::Request('GET',$tokenurl);
+	my $request=new HTTP::Request('GET',$url);
 	my $response=$ua->request($request);
 	if ($response->is_success) {
 	    my $file=$user."_".$domain."_studentphoto.eps";
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.4 loncom/homework/bridgetask.pm:1.5
--- loncom/homework/bridgetask.pm:1.4	Mon Mar 28 14:26:10 2005
+++ loncom/homework/bridgetask.pm	Mon Mar 28 16:49:31 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.4 2005/03/28 19:26:10 albertel Exp $
+# $Id: bridgetask.pm,v 1.5 2005/03/28 21:49:31 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -294,9 +294,7 @@
 sub proctor_validation_screen {
     my ($slot) = @_;
     my (undef,undef,$domain,$user) = &Apache::lonxml::whichuser();
-    my $ret=&Apache::lonnet::reply("studentphoto:$domain:$user:gif",&Apache::lonnet::homeserver($user,$domain));
-    my $url="/uploaded/$domain/$user/internal/studentphoto.gif";
-    my $tokenurl=&Apache::lonnet::tokenwrapper($url);
+    my $url=&Apache::lonnet::studentphoto($domain,$user,'jpg');
     my $dom=(&Apache::lonxml::whichuser())[2];
     my $user=$ENV{'form.proctorname'};
     if ($ENV{'form.proctordomain'}) { $dom=$ENV{'form.proctordomain'}; }
@@ -319,7 +317,7 @@
 </table>
 <input type="submit" name="checkoutbutton" value="Validate"  /><br />
 Student who should be logged in is:<br />
-<img src="$tokenurl" /><br />
+<img src="$url" /><br />
 </form>
 ENDCHECKOUT
     return $result;
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.616 loncom/lonnet/perl/lonnet.pm:1.617
--- loncom/lonnet/perl/lonnet.pm:1.616	Mon Mar 28 12:54:06 2005
+++ loncom/lonnet/perl/lonnet.pm	Mon Mar 28 16:49:31 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.616 2005/03/28 17:54:06 albertel Exp $
+# $Id: lonnet.pm,v 1.617 2005/03/28 21:49:31 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -931,6 +931,19 @@
     return %returnhash;
 }
 
+# ---------------------------------------------------------- Get a studentphoto
+sub studentphoto {
+    my ($udom,$unam,$ext) = @_;
+    my $home=&Apache::lonnet::homeserver($unam,$udom);
+    my $ret=&Apache::lonnet::reply("studentphoto:$udom:$unam:$ext",$home);
+    my $url="/uploaded/$udom/$unam/internal/studentphoto.".$ext;
+    if ($ret ne 'ok') {
+	return '/adm/lonKaputt/lonlogo_broken.gif';
+    }
+    my $tokenurl=&Apache::lonnet::tokenwrapper($url);
+    return $tokenurl;
+}
+
 # -------------------------------------------------------------------- New chat
 
 sub chatsend {