[LON-CAPA-cvs] cvs: loncom /xml londefdef.pm

sakharuk lon-capa-cvs@mail.lon-capa.org
Tue, 11 May 2004 18:41:24 -0000


sakharuk		Tue May 11 14:41:24 2004 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
  Changes to dynamically produce eps counterpart for gif/... picture which was uploaded in the simple page.
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.212 loncom/xml/londefdef.pm:1.213
--- loncom/xml/londefdef.pm:1.212	Mon May 10 14:33:31 2004
+++ loncom/xml/londefdef.pm	Tue May 11 14:41:24 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.212 2004/05/10 18:33:31 sakharuk Exp $
+# $Id: londefdef.pm,v 1.213 2004/05/11 18:41:24 sakharuk Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -1904,7 +1904,6 @@
 	    $space_neeeded=$space_neeeded+$max_len[$jn];
 	}
 	if ($space_neeeded<=$available_space) {
-##	    &Apache::lonnet::logthis("I am in position 1: $space_neeeded <= $available_space");
 	    for (my $jn=0;$jn<=$#max_len;$jn++) {
 		if ($fwidth[$jn]==0) {
 		    $fwidth[$jn]=$max_len[$jn];
@@ -1917,7 +1916,6 @@
 		$space_neeeded+=$min_len[$jn];
 	    }
 	    if ($space_neeeded>$available_space) {
-##		&Apache::lonnet::logthis("I am in position 2");
 		$WARNING=' \textbf{NOT ENOUGH SPACE FOR TABLE} ';
 		for (my $jn=0;$jn<=$#max_len;$jn++) {
 		    if ($fwidth[$jn]==0) {
@@ -1926,7 +1924,6 @@
 		}
 	    } else {
 	      #step 3. adjustment over minimal + corrections
-##		&Apache::lonnet::logthis("I am in position 3");
 		my $enlarge_coef=$available_space/$space_neeeded;
 		my $acsessive=0;
 		for (my $jn=0;$jn<=$#min_len;$jn++) {
@@ -2271,6 +2268,11 @@
 	}
     } elsif ($target eq 'tex') {
 	$src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);
+        #if uploaded restore the path
+	if ($src=~/^\/uploaded\//) {
+ 	    $src=~s/\/(\w)(\w)(\w)([^\/]*)\/simplepage\//\/$1\/$2\/$3\/$1$2$3$4\/userfiles\/simplepage\//;
+	    $src=~s/uploaded/home\/httpd\/lonUsers/;
+	}
 	#if original gif/jpg/png file exist do following:
 	if (-e $src) {
 	    #what is the image size?
@@ -3540,6 +3542,10 @@
     $newsrc=~s/\/home\/([^\/]*)\/public_html\//\/$1\//;
     $newsrc=~s/\/\.\//\//;
     $newsrc=~s/\/([^\/]+)\.(ps|eps)/\//;
+    if ($newsrc=~/\/home\/httpd\/lonUsers\//) {
+	$newsrc=~s/\/home\/httpd\/lonUsers//;
+	$newsrc=~s/\/([^\/]+)\/(\w)\/(\w)\/(\w)\//\/$1\//;
+    }
     return ' \graphicspath{{/home/httpd/prtspool'.$newsrc.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} ';
 }