[LON-CAPA-cvs] cvs: doc /loncapafiles loncapafiles.lpml loncom/cgi randomlabel.png loncom/homework randomlabel.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 07 Nov 2002 19:48:51 -0000
albertel Thu Nov 7 14:48:51 2002 EDT
Added files:
/loncom/cgi randomlabel.png
Modified files:
/loncom/homework randomlabel.pm
/doc/loncapafiles loncapafiles.lpml
Log:
- <randomlabel> online now server generated on the file rather than use Java
(Maybe make it a runtime switchable item?)
- doesn't yet support subimage <randomlabel>
- (need to support fontsize selection)
Index: loncom/homework/randomlabel.pm
diff -u loncom/homework/randomlabel.pm:1.38 loncom/homework/randomlabel.pm:1.39
--- loncom/homework/randomlabel.pm:1.38 Tue Oct 22 17:25:34 2002
+++ loncom/homework/randomlabel.pm Thu Nov 7 14:48:51 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# random labelling tool
#
-# $Id: randomlabel.pm,v 1.38 2002/10/22 21:25:34 sakharuk Exp $
+# $Id: randomlabel.pm,v 1.39 2002/11/07 19:48:51 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -82,6 +82,7 @@
sub start_randomlabel {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result='';
+ &Apache::lonxml::startredirection();
push (@Apache::lonxml::extlinks, '/res/adm/includes/GLabel.class');
push (@Apache::lonxml::namespace,'randomlabel');
my $bgimg= &Apache::lonxml::get_param('bgimg',$parstack,$safeeval);
@@ -93,7 +94,7 @@
} elsif ($bgimg =~ m:^/home/.*/public_html:) {
$bgimg =~ s:^/home/(.*)/public_html:/~$1:;
}
- $bgimg='http://'.$ENV{'SERVER_NAME'}.$bgimg;
+# $bgimg='http://'.$ENV{'SERVER_NAME'}.$bgimg;
}
my $code = &Apache::lonxml::get_param('code',$parstack,$safeeval);
my $codebase = &Apache::lonxml::get_param('codebase',$parstack,$safeeval);
@@ -105,8 +106,8 @@
$Apache::randomlabel::tlabel_cnt=0;
$Apache::randomlabel::ilabel_cnt=0;
if ($target eq 'web') {
- $result.="<applet code=\"$code\" codebase=\"$codebase\" width=\"$w\" height=\"$h\">\n";
- $result.="<param name=\"bgimg\" value=\"$bgimg\">\n";
+ $result.='<img src="/cgi-bin/randomlabel.png?';
+ $result.="BGIMG=".&Apache::lonnet::escape('/home/httpd/html/'.$bgimg);
} elsif ($target eq 'tex') {
my $newbgimg = $bgimg;
$bgimg=~s/(.gif|.jpg)$/.eps/;
@@ -171,13 +172,16 @@
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result='';
my $count;
+ $result=&Apache::lonxml::endredirection();
+ $result=~s/\s*&/&/g;
+ $result=~s/\s*$//;
pop @Apache::lonxml::namespace;
if ($target eq 'web') {
$count = $Apache::randomlabel::tlabel_cnt;
- if( $count != 0) { $result.= "<param name=\"COUNT\" value=\"$count\">\n"; }
+ if( $count != 0) { $result.= "&COUNT=$count"; }
$count = $Apache::randomlabel::ilabel_cnt;
- if( $count != 0) { $result.= "<param name=\"ICOUNT\" value=\"$count\">\n"; }
- $result .= "</applet>\n<BR />";
+ if( $count != 0) { $result.= "&ICOUNT=$count"; }
+ $result.='" /><br />'."\n";
} elsif ($target eq 'tex') {
$result='\end{picture}\\\\';
@$parstack[-1]=~/\$height\s*=\s*?"(.+)?"/;
@@ -279,9 +283,9 @@
&Apache::lonxml::error('Unknown type of label :'.$type.':');
}
if ($target eq 'web') {
- $result .= '<param name="' . $str . '" value="'.$label.'">';
- $result .= '<param name="' . $xstr . '" value="'.$x.'">';
- $result .= '<param name="' . $ystr . '" value="'.$y.'">'."\n";
+ $result .= '&'. $str .'='.$label;
+ $result .= '&'. $xstr .'='.$x;
+ $result .= '&'. $ystr .'='.$y;
}
}
} elsif ($target eq 'tex') {
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.183 doc/loncapafiles/loncapafiles.lpml:1.184
--- doc/loncapafiles/loncapafiles.lpml:1.183 Tue Oct 29 15:21:32 2002
+++ doc/loncapafiles/loncapafiles.lpml Thu Nov 7 14:48:51 2002
@@ -3,7 +3,7 @@
<!-- loncapafiles.lpml -->
<!-- Scott Harrison -->
-<!-- $Id: loncapafiles.lpml,v 1.183 2002/10/29 20:21:32 www Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.184 2002/11/07 19:48:51 albertel Exp $ -->
<!--
@@ -787,6 +787,14 @@
<categoryname>static conf</categoryname>
<description>
Descriptive list of file extensions and broad categorization.
+</description>
+</file>
+<file>
+<source>loncom/cgi/randomlabel.png</source>
+<target dist='default'>home/httpd/cgi-bin/randomlabel.png</target>
+<categoryname>script</categoryname>
+<description>
+Dynamically annotates and composites together images
</description>
</file>
<file>