--- loncom/interface/lonhtmlcommon.pm	2005/04/07 06:56:23	1.104
+++ loncom/interface/lonhtmlcommon.pm	2005/08/05 18:14:40	1.111
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.104 2005/04/07 06:56:23 albertel Exp $
+# $Id: lonhtmlcommon.pm,v 1.111 2005/08/05 18:14:40 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -100,7 +100,7 @@ sub store_recent {
     my ($area,$name,$value)=@_;
     my $file=&recent_filename($area);
     my %recent=&Apache::lonnet::dump($file);
-    if (scalar(keys(%recent))>10) {
+    if (scalar(keys(%recent))>20) {
 # remove oldest value
 	my $oldest=time;
 	my $delkey='';
@@ -258,18 +258,23 @@ The method used to restrict user input w
 ##############################################
 sub date_setter {
     my ($formname,$dname,$currentvalue,$special,$includeempty,$state,
-        $no_hh_mm_ss) = @_;
+        $no_hh_mm_ss,$defhour,$defmin,$defsec) = @_;
+    my $wasdefined=1;
     if (! defined($state) || $state ne 'disabled') {
         $state = '';
     }
     if (! defined($no_hh_mm_ss)) {
         $no_hh_mm_ss = 0;
     }
-    if (! defined($currentvalue) || $currentvalue eq 'now') {
-	unless ($includeempty) {
-	    $currentvalue = time;
-	} else {
+    if ($currentvalue eq 'now') {
+	$currentvalue=time;
+    }
+    if ((!defined($currentvalue)) || ($currentvalue eq '')) {
+	$wasdefined=0;
+	if ($includeempty) {
 	    $currentvalue = 0;
+	} else {
+	    $currentvalue = time;
 	}
     }
     # other potentially useful values:     wkday,yrday,is_daylight_savings
@@ -279,6 +284,20 @@ sub date_setter {
 	    localtime($currentvalue);
 	$year += 1900;
     }
+    unless ($wasdefined) {
+	if (($defhour) || ($defmin) || ($defsec)) {
+	    ($sec,$min,$hour,$mday,$month,$year,undef,undef,undef) = 
+		localtime(time);
+	    $year += 1900;
+	    $sec=($defsec?$defsec:0);
+	    $min=($defmin?$defmin:0);
+	    $hour=($defhour?$defhour:0);
+	} elsif (!$includeempty) {
+	    $sec=0;
+	    $min=0;
+	    $hour=0;
+	}
+    }
     my $result = "\n<!-- $dname date setting form -->\n";
     $result .= <<ENDJS;
 <script language="Javascript">
@@ -506,11 +525,13 @@ parameter setting wizard.
 ##############################################
 sub pjump_javascript_definition {
     my $Str = <<END;
-    function pjump(type,dis,value,marker,ret,call) {
+    function pjump(type,dis,value,marker,ret,call,hour,min,sec) {
         parmwin=window.open("/adm/rat/parameter.html?type="+escape(type)
                  +"&value="+escape(value)+"&marker="+escape(marker)
                  +"&return="+escape(ret)
-                 +"&call="+escape(call)+"&name="+escape(dis),"LONCAPAparms",
+                 +"&call="+escape(call)+"&name="+escape(dis)
+                 +"&defhour="+escape(hour)+"&defmin="+escape(min)
+                 +"&defsec="+escape(sec),"LONCAPAparms",
                  "height=350,width=350,scrollbars=no,menubar=no");
     }
 END
@@ -932,13 +953,14 @@ sub crumbs {
 
 sub spellheader {
     my $html=&Apache::lonxml::xmlbegin();
+    my $nothing=&javascript_nothing();
     return (<<ENDCHECK);
 <script type="text/javascript"> 
 //<!-- BEGIN LON-CAPA Internal
 var checkwin;
 
 function spellcheckerwindow() {
-    checkwin=window.open('/adm/rat/empty.html','spellcheckwin','height=320,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
+    checkwin=window.open($nothing,'spellcheckwin','height=320,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
     checkwin.document.writeln('$html<head></head><body bgcolor="#DDDDDD"><form name="spellcheckform" action="/adm/spellcheck" method="post"><input type="hidden" name="text" value="" /></form></body></html>');
     checkwin.document.close();
 }
@@ -953,7 +975,7 @@ sub spelllink {
     my ($form,$field)=@_;
     my $linktext=&mt('Check Spelling');
     return (<<ENDLINK);
-<a href="javascript:if (typeof(document.$form.onsubmit)!='undefined') { document.$form.onsubmit();};spellcheckerwindow();checkwin.document.forms.spellcheckform.text.value=this.document.forms.$form.$field.value;checkwin.document.forms.spellcheckform.submit();">$linktext</a>
+<a href="javascript:if (typeof(document.$form.onsubmit)!='undefined') { if (document.$form.onsubmit!=null) { document.$form.onsubmit();}};spellcheckerwindow();checkwin.document.forms.spellcheckform.text.value=this.document.forms.$form.$field.value;checkwin.document.forms.spellcheckform.submit();">$linktext</a>
 ENDLINK
 }
 
@@ -1111,6 +1133,7 @@ returns: nothing
         # Make the faq and bug data cascade
         my $faq = '';
         my $bug = '';
+	my $help='';
         # The last breadcrumb does not have a link, so handle it separately.
         my $last = pop(@Crumbs);
         #
@@ -1135,6 +1158,7 @@ returns: nothing
                  map {
                      $faq = $_->{'faq'} if (exists($_->{'faq'}));
                      $bug = $_->{'bug'} if (exists($_->{'bug'}));
+                     $help = $_->{'help'} if (exists($_->{'help'}));
                      my $result = '<a href="'.$_->{'href'}.'" ';
                      if (defined($_->{'target'}) && $_->{'target'} ne '') {
                          $result .= 'target="'.$_->{'target'}.'" ';
@@ -1150,6 +1174,8 @@ returns: nothing
         my $icons = '';
         $faq = $last->{'faq'} if (exists($last->{'faq'}));
         $bug = $last->{'bug'} if (exists($last->{'bug'}));
+        $help = $last->{'help'} if (exists($last->{'help'}));
+        $component_help=($component_help?$component_help:$help);
 #        if ($faq ne '') {
 #            $icons .= &Apache::loncommon::help_open_faq($faq);
 #        }