--- loncom/interface/lonhtmlcommon.pm	2006/05/12 16:45:41	1.128
+++ loncom/interface/lonhtmlcommon.pm	2006/06/01 19:30:49	1.131
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.128 2006/05/12 16:45:41 albertel Exp $
+# $Id: lonhtmlcommon.pm,v 1.131 2006/06/01 19:30:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -60,6 +60,8 @@ use Time::Local;
 use Time::HiRes;
 use Apache::lonlocal;
 use Apache::lonnet;
+use lib '/home/httpd/lib/perl/';
+use LONCAPA;
 
 ##############################################
 ##############################################
@@ -93,7 +95,7 @@ sub authorbombs {
 
 sub recent_filename {
     my $area=shift;
-    return 'nohist_recent_'.&Apache::lonnet::escape($area);
+    return 'nohist_recent_'.&escape($area);
 }
 
 sub store_recent {
@@ -115,7 +117,7 @@ sub store_recent {
     }
 # store new value
     &Apache::lonnet::put($file,{ $name => 
-				 time.'&'.&Apache::lonnet::escape($value) });
+				 time.'&'.&escape($value) });
 }
 
 sub remove_recent {
@@ -134,7 +136,7 @@ sub select_recent {
 	unless ($_=~/^error\:/) {
 	    my $escaped = &Apache::loncommon::escape_url($_);
 	    $return.="\n<option value='$escaped'>".
-		&Apache::lonnet::unescape((split(/\&/,$recent{$_}))[1]).
+		&unescape((split(/\&/,$recent{$_}))[1]).
 		'</option>';
 	}
     }
@@ -158,7 +160,7 @@ sub get_recent {
     my $idx = 1;
     foreach (reverse sort keys %time_hash) {
        $return_hash{$time_hash{$_}} =
-                  &Apache::lonnet::unescape((split(/\&/,$recent{$_}))[1]);
+                  &unescape((split(/\&/,$recent{$_}))[1]);
        if ($n && ($idx++ >= $n)) {last;}
     }
 
@@ -818,10 +820,10 @@ sub Create_PrgWin {
          function openpopwin () {
          popwin=open(\'\',\'popwin\',\'width=400,height=100\');".
         "popwin.document.writeln(\'".$start_page.
-              "<h4>$heading</h4>".
-              "<form name=popremain>".
+              "<h4>$heading<\/h4>".
+              "<form name=\"popremain\" method=\"post\">".
               '<input type="text" size="'.$width.'" name="remaining" value="'.
-	      &mt('Starting').'"></form>'.$end_page.
+	      &mt('Starting').'" /><\\/form>'.$end_page.
               "\');".
         "popwin.document.close();}".
         "\nwindow.setTimeout(openpopwin,0)</script>");
@@ -996,7 +998,7 @@ var checkwin;
 
 function spellcheckerwindow() {
     checkwin=window.open($nothing,'spellcheckwin','height=320,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
-    checkwin.document.writeln('$start_page<form name="spellcheckform" action="/adm/spellcheck" method="post"><input type="hidden" name="text" value="" /></form>$end_page');
+    checkwin.document.writeln('$start_page<form name="spellcheckform" action="/adm/spellcheck" method="post"><input type="hidden" name="text" value="" /><\\/form>$end_page');
     checkwin.document.close();
 }
 // END LON-CAPA Internal -->
@@ -1079,7 +1081,7 @@ sub disablelink {
     if (defined($#fields)) {
 	unless ($#fields>=0) { return ''; }
     }
-    return '<a href="'.&HTML::Entities::encode('/adm/preferences?action=set_wysiwyg&wysiwyg=off&returnurl=','<>&"').&Apache::lonnet::escape($ENV{'REQUEST_URI'}).'">'.&mt('Disable WYSIWYG Editor').'</a>';
+    return '<a href="'.&HTML::Entities::encode('/adm/preferences?action=set_wysiwyg&wysiwyg=off&returnurl=','<>&"').&escape($ENV{'REQUEST_URI'}).'">'.&mt('Disable WYSIWYG Editor').'</a>';
 }
 
 sub enablelink {
@@ -1087,7 +1089,7 @@ sub enablelink {
     if (defined($#fields)) {
 	unless ($#fields>=0) { return ''; }
     }
-    return '<a href="'.&HTML::Entities::encode('/adm/preferences?action=set_wysiwyg&wysiwyg=on&returnurl=','<>&"').&Apache::lonnet::escape($ENV{'REQUEST_URI'}).'">'.&mt('Enable WYSIWYG Editor').'</a>';
+    return '<a href="'.&HTML::Entities::encode('/adm/preferences?action=set_wysiwyg&wysiwyg=on&returnurl=','<>&"').&escape($ENV{'REQUEST_URI'}).'">'.&mt('Enable WYSIWYG Editor').'</a>';
 }
 
 # ----------------------------------------- Script to activate only some fields
@@ -1430,11 +1432,11 @@ sub course_select_row {
     |;
     my $courseform='<b>'.&Apache::loncommon::selectcourse_link
                      ($formname,'pickcourse','pickdomain','coursedesc','',1).'</b>';
+        $output .= '<input type="radio" name="coursepick" value="all" onclick="coursePick(this.form)" />'.&mt('All courses').'<br />';
     if ($totcodes > 0) {
-        $output .= '<input type="radio" name="coursepick" value="all" onclick="coursePick(this.form)" />'.&mt('All courses');
         my $numtitles = @$codetitles;
         if ($numtitles > 0) {
-            $output .= '<br /><input type="radio" name="coursepick" value="category" onclick="coursePick(this.form);alert('."'".&mt('Choose categories, from left to right')."'".')" />'.&mt('Pick courses by category:').' <br />';
+            $output .= '<input type="radio" name="coursepick" value="category" onclick="coursePick(this.form);alert('."'".&mt('Choose categories, from left to right')."'".')" />'.&mt('Pick courses by category:').' <br />';
             $output .= '<table><tr><td>'.$$codetitles[0].'<br />'."\n".
                '<select name="'.$$codetitles[0].
                '" onChange="setPick(this.form);courseSet('."'$$codetitles[0]'".')">'."\n".