[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm structuretags.pm /xml londefdef.pm lonxml.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 18 Oct 2005 21:46:43 -0000


albertel		Tue Oct 18 17:46:43 2005 EDT

  Modified files:              
    /loncom/xml	londefdef.pm lonxml.pm 
    /loncom/homework	inputtags.pm structuretags.pm 
  Log:
  - rework how extlink is used
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.289 loncom/xml/londefdef.pm:1.290
--- loncom/xml/londefdef.pm:1.289	Tue Oct 18 17:30:49 2005
+++ loncom/xml/londefdef.pm	Tue Oct 18 17:46:19 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.289 2005/10/18 21:30:49 albertel Exp $
+# $Id: londefdef.pm,v 1.290 2005/10/18 21:46:19 albertel Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -2531,8 +2531,7 @@
 	my $inside = &Apache::lonxml::get_all_text("/img",$parser);
 	return '';
     }
-    push(@Apache::lonxml::extlinks,
-	 &Apache::lonnet::clutter(&Apache::lonnet::hreflocation($Apache::lonxml::pwd[-1],$src)));
+    &Apache::lonxml::extlink($src);
     my $currentstring = '';
     my $scaling = .3;
 
@@ -2742,12 +2741,10 @@
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     
     my $code=&Apache::lonxml::get_param('code',$parstack,$safeeval,undef,1);
-    $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=$code;
-    
+    &Apache::lonxml::extlink($code);
     my $archive=&Apache::lonxml::get_param('archive',$parstack,$safeeval,
 					   undef,1);
-    $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=$archive;
-    
+    &Apache::lonxml::extlink($archive);
     my $currentstring = '';
     if ($target eq 'web') {
 	if ($env{'browser.appletsuppress'} ne 'on') {
@@ -2793,7 +2790,7 @@
 sub start_embed {    
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $src=&Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1);
-    $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=$src;
+    &Apache::lonxml::extlink($src);
     my $currentstring = '';
     if ($target eq 'web') {
 	if ($env{'browser.embedsuppress'} ne 'on') {
@@ -2824,13 +2821,15 @@
 #-- <param> tag (end tag forbidden)
 sub start_param {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
-    if (&Apache::lonxml::get_param
-	('name',$parstack,$safeeval,undef,1)=~/^cabbase$/i) {
-	$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
-	    &Apache::lonxml::get_param('value',$parstack,$safeeval,undef,1);
-    }   
-    $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=   
-	&Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1);
+    if (&Apache::lonxml::get_param('name',$parstack,
+				   $safeeval,undef,1)=~/^cabbase$/i) {
+	my $value=&Apache::lonxml::get_param('value',$parstack,
+					     $safeeval,undef,1);
+	&Apache::lonxml::extlink($value);
+    } 
+  
+    my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1);
+    &Apache::lonxml::extlink($src);
     my $currentstring = '';
     if ($target eq 'web') {
 	my %toconvert;
@@ -2862,9 +2861,8 @@
 sub start_allow {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_;
     my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval,undef,1);
-    $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);
-    $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
-	&Apache::lonnet::clutter($src);
+    &Apache::lonxml::extlink($src);
+
     if ($target eq 'tex') { &image_replication($src); }
     my $result;
     if ($target eq 'edit') {
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.383 loncom/xml/lonxml.pm:1.384
--- loncom/xml/lonxml.pm:1.383	Mon Sep 26 17:39:53 2005
+++ loncom/xml/lonxml.pm	Tue Oct 18 17:46:19 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.383 2005/09/26 21:39:53 albertel Exp $
+# $Id: lonxml.pm,v 1.384 2005/10/18 21:46:19 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1109,6 +1109,14 @@
   return $temp;
 }
 
+sub extlink {
+    my ($res,$exact)=@_;
+    if (!$exact) {
+	$res=&Apache::lonnet::hreflocation($Apache::lonxml::pwd[-1],$res);
+    }
+    push(@Apache::lonxml::extlinks,$res)	 
+}
+
 sub writeallows {
     unless ($#extlinks>=0) { return; }
     my $thisurl = &Apache::lonnet::clutter(shift);
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.175 loncom/homework/inputtags.pm:1.176
--- loncom/homework/inputtags.pm:1.175	Fri Sep  9 14:45:56 2005
+++ loncom/homework/inputtags.pm	Tue Oct 18 17:46:42 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.175 2005/09/09 18:45:56 albertel Exp $
+# $Id: inputtags.pm,v 1.176 2005/10/18 21:46:42 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -330,7 +330,7 @@
 
 	if ($uploadedfile) {
 	    my $url=$Apache::lonhomework::history{"resource.$part.$id.uploadedurl"};
-	    push (@Apache::lonxml::extlinks,$url);
+	    &Apache::lonxml::extlink($url);
 	    &Apache::lonnet::allowuploaded('/adm/essayresponse',$url);
 	    my $icon=&Apache::loncommon::icon($url);
 	    my $curfile='<a href="'.$url.'"><img src="'.$icon.
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.305 loncom/homework/structuretags.pm:1.306
--- loncom/homework/structuretags.pm:1.305	Mon Oct 17 12:06:32 2005
+++ loncom/homework/structuretags.pm	Tue Oct 18 17:46:42 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.305 2005/10/17 16:06:32 albertel Exp $
+# $Id: structuretags.pm,v 1.306 2005/10/18 21:46:42 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -74,8 +74,7 @@
 	'onunload="'.&Apache::lonmenu::unloadevents().'" ';
     if ($env{'browser.imagesuppress'} eq 'on') { $background=''; }
     if ($background) {
-	$Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
-	    $background;
+	&Apache::lonxml::extlink($background);
 	$body_tag_start.='background="'.$background.'" ';
     } else {
 	if (($bgcolor) && ($env{'browser.blackwhite'} ne 'on')) {