--- loncom/homework/randomlabel.pm	2008/12/19 14:28:14	1.94
+++ loncom/homework/randomlabel.pm	2016/07/01 19:59:15	1.97
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # random labelling tool
 #
-# $Id: randomlabel.pm,v 1.94 2008/12/19 14:28:14 raeburn Exp $
+# $Id: randomlabel.pm,v 1.97 2016/07/01 19:59:15 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -175,7 +175,7 @@ sub start_randomlabel {
     if ( defined($bgimg) && $bgimg !~ /^https?\:/ ) {
 	$bgimg=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$bgimg);
 	if (&Apache::lonnet::repcopy($bgimg) ne 'ok') {
-	    $bgimg='/home/httpd/html/adm/lonKaputt/lonlogo_broken.gif';
+	    $bgimg=$Apache::lonnet::perlvar{'lonDocRoot'}.'/adm/lonKaputt/lonlogo_broken.gif';
 	}
     }
     $Apache::randomlabel::obj_cnt=0;
@@ -193,9 +193,9 @@ sub start_randomlabel {
 	$Apache::edit::bgimgsrc=
 	    &Apache::lonxml::get_param('bgimg',$parstack,$safeeval);
 	$Apache::edit::bgimgsrccurdepth=$Apache::lonxml::curdepth;
-	$result.=&Apache::edit::text_arg('Image:','bgimg',$token,75).' ';
-	$result.=&Apache::edit::browse('bgimg',undef,undef,$only).' ';
-	$result.=&Apache::edit::search('bgimg').'<br />'.
+	$result.=&Apache::edit::text_arg('Image:','bgimg',$token,75).' '.
+	         &Apache::edit::browse_or_search('bgimg',undef,undef,$only,undef,1).
+	         '<br />'.
 	    &Apache::edit::text_arg('Width(pixel):' ,'width'   ,$token,6).
 	    &Apache::edit::text_arg('Height(pixel):','height'  ,$token,6).
 	    &Apache::edit::text_arg('TeXWidth(mm):' ,'texwidth',$token,6).
@@ -223,7 +223,7 @@ sub end_randomlabel {
 	&Apache::lonnet::appenv(\%args);
     } elsif ($target eq 'tex') {
 	$result='\end{picture}\\\\';
-	$result.= ' \vskip -'.$height_param.' mm }  \\\\ ';
+	$result.= ' \vskip -'.$height_param.' mm } \\newline ';
     } elsif ($target eq 'edit') {
 	$result.=&Apache::edit::end_table;
     }