File:  [LON-CAPA] / loncom / interface / lonhtmlcommon.pm
Revision 1.14: download - view: text, annotated - select for diffs
Mon Mar 3 21:52:24 2003 UTC (21 years, 3 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- adding timing info to the popwin, and adding new functionality,
- converted stats to use new interface

    1: # The LearningOnline Network with CAPA
    2: # a pile of common html routines
    3: #
    4: # $Id: lonhtmlcommon.pm,v 1.14 2003/03/03 21:52:24 albertel Exp $
    5: #
    6: # Copyright Michigan State University Board of Trustees
    7: #
    8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    9: #
   10: # LON-CAPA is free software; you can redistribute it and/or modify
   11: # it under the terms of the GNU General Public License as published by
   12: # the Free Software Foundation; either version 2 of the License, or
   13: # (at your option) any later version.
   14: #
   15: # LON-CAPA is distributed in the hope that it will be useful,
   16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   18: # GNU General Public License for more details.
   19: #
   20: # You should have received a copy of the GNU General Public License
   21: # along with LON-CAPA; if not, write to the Free Software
   22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   23: #
   24: # /home/httpd/html/adm/gpl.txt
   25: #
   26: # http://www.lon-capa.org/
   27: #
   28: ######################################################################
   29: ######################################################################
   30: 
   31: =pod
   32: 
   33: =head1 NAME
   34: 
   35: Apache::lonhtmlcommon - routines to do common html things
   36: 
   37: =head1 SYNOPSIS
   38: 
   39: Referenced by other mod_perl Apache modules.
   40: 
   41: =head1 INTRODUCTION
   42: 
   43: lonhtmlcommon is a collection of subroutines used to present information
   44: in a consistent html format, or provide other functionality related to
   45: html.
   46: 
   47: =head2 General Subroutines
   48: 
   49: =over 4
   50: 
   51: =cut 
   52: 
   53: ######################################################################
   54: ######################################################################
   55: 
   56: package Apache::lonhtmlcommon;
   57: 
   58: use Time::Local;
   59: use strict;
   60: 
   61: ##############################################
   62: ##############################################
   63: 
   64: =pod
   65: 
   66: =item &date_setter
   67: 
   68: Inputs
   69: 
   70: =over 4
   71: 
   72: =item $dname 
   73: 
   74: The name to prepend to the form elements.  
   75: The form elements defined will be dname_year, dname_month, dname_day,
   76: dname_hour, dname_min, and dname_sec.
   77: 
   78: =item $currentvalue
   79: 
   80: The current setting for this time parameter.  A unix format time
   81: (time in seconds since the beginning of Jan 1st, 1970, GMT.  
   82: An undefined value is taken to indicate the value is the current time.
   83: Also, to be explicit, a value of 'now' also indicates the current time.
   84: 
   85: =cut
   86: 
   87: ##############################################
   88: ##############################################
   89: sub date_setter {
   90:     my ($formname,$dname,$currentvalue) = @_;
   91:     if (! defined($currentvalue) || $currentvalue eq 'now') {
   92:         $currentvalue = time;
   93:     }
   94:     # other potentially useful values:     wkday,yrday,is_daylight_savings
   95:     my ($sec,$min,$hour,$mday,$month,$year,undef,undef,undef) = 
   96:         localtime($currentvalue);
   97:     $year += 1900;
   98:     my $result = "\n<!-- $dname date setting form -->\n";
   99:     $result .= <<ENDJS;
  100: <script language="Javascript">
  101:     function $dname\_checkday() {
  102:         var day   = document.$formname.$dname\_day.value;
  103:         var month = document.$formname.$dname\_month.value;
  104:         var year  = document.$formname.$dname\_year.value;
  105:         var valid = true;
  106:         if (day < 1) {
  107:             document.$formname.$dname\_day.value = 1;
  108:         } 
  109:         if (day > 31) {
  110:             document.$formname.$dname\_day.value = 31;
  111:         }
  112:         if ((month == 1)  || (month == 3)  || (month == 5)  ||
  113:             (month == 7)  || (month == 8)  || (month == 10) ||
  114:             (month == 12)) {
  115:             if (day > 31) {
  116:                 document.$formname.$dname\_day.value = 31;
  117:                 day = 31;
  118:             }
  119:         } else if (month == 2 ) {
  120:             if ((year % 4 == 0) && (year % 100 != 0)) {
  121:                 if (day > 29) {
  122:                     document.$formname.$dname\_day.value = 29;
  123:                 }
  124:             } else if (day > 29) {
  125:                 document.$formname.$dname\_day.value = 28;
  126:             }
  127:         } else if (day > 30) {
  128:             document.$formname.$dname\_day.value = 30;
  129:         }
  130:     }
  131: </script>
  132: ENDJS
  133:     $result .= "  <select name=\"$dname\_month\" ".
  134:         "onChange=\"javascript:$dname\_checkday()\" >\n";
  135:     my @Months = qw/January February  March     April   May      June 
  136:                     July    August    September October November December/;
  137:     # Pad @Months with a bogus value to make indexing easier
  138:     unshift(@Months,'If you can read this an error occurred');
  139:     for(my $m = 1;$m <=$#Months;$m++) {
  140:         $result .= "      <option value=\"$m\" ";
  141:         $result .= "selected " if ($m-1 == $month);
  142:         $result .= "> $Months[$m] </option>\n";
  143:     }
  144:     $result .= "  </select>\n";
  145:     $result .= "  <input type=\"text\" name=\"$dname\_day\" ".
  146:             "value=\"$mday\" size=\"3\" ".
  147:             "onChange=\"javascript:$dname\_checkday()\" />\n";
  148:     $result .= "  <input type=\"year\" name=\"$dname\_year\" ".
  149:             "value=\"$year\" size=\"5\" ".
  150:             "onChange=\"javascript:$dname\_checkday()\" />\n";
  151:     $result .= "&nbsp;&nbsp;";
  152:     $result .= "  <select name=\"$dname\_hour\" >\n";
  153:     for (my $h = 0;$h<24;$h++) {
  154:         $result .= "      <option value=\"$h\" ";
  155:         $result .= "selected " if ($hour == $h);
  156:         $result .= "> ";
  157:         if ($h == 0) {
  158:             $result .= "12 am";
  159:         } elsif($h == 12) {
  160:             $result .= "12 noon";
  161:         } elsif($h < 12) {
  162:             $result .= "$h am";
  163:         } else {
  164:             $result .= $h-12 ." pm";
  165:         }
  166:         $result .= " </option>\n";
  167:     } 
  168:     $result .= "  </select>\n";
  169:     $result .= "  <input type=\"text\" name=\"$dname\_minute\" ".
  170:         "value=\"$min\" size=\"3\" /> m\n";
  171:     $result .= "  <input type=\"text\" name=\"$dname\_second\" ".
  172:         "value=\"$sec\" size=\"3\" /> s\n";
  173:     $result .= "<!-- end $dname date setting form -->\n";
  174:     return $result;
  175: }
  176: 
  177: ##############################################
  178: ##############################################
  179: 
  180: =item &get_date_from_form
  181: 
  182: Inputs:
  183: 
  184: =over 4
  185: 
  186: =item $dname
  187: 
  188: The name passed to &datesetter, which prefixes the form elements.
  189: 
  190: =item $defaulttime
  191: 
  192: The unix time to use as the default in case of poor inputs.
  193: 
  194: =back
  195: 
  196: Returns: Unix time represented in the form.
  197: 
  198: =cut
  199: 
  200: ##############################################
  201: ##############################################
  202: sub get_date_from_form {
  203:     my ($dname) = @_;
  204:     my ($sec,$min,$hour,$day,$month,$year);
  205:     #
  206:     if (defined($ENV{'form.'.$dname.'_second'})) {
  207:         my $tmpsec = $ENV{'form.'.$dname.'_second'};
  208:         if (($tmpsec =~ /^\d+$/) && ($tmpsec >= 0) && ($tmpsec < 60)) {
  209:             $sec = $tmpsec;
  210:         }
  211:     }
  212:     if (defined($ENV{'form.'.$dname.'_minute'})) {
  213:         my $tmpmin = $ENV{'form.'.$dname.'_minute'};
  214:         if (($tmpmin =~ /^\d+$/) && ($tmpmin >= 0) && ($tmpmin < 60)) {
  215:             $min = $tmpmin;
  216:         }
  217:     }
  218:     if (defined($ENV{'form.'.$dname.'_hour'})) {
  219:         my $tmphour = $ENV{'form.'.$dname.'_hour'};
  220:         if (($tmphour =~ /^\d+$/) && ($tmphour > 0) && ($tmphour < 32)) {
  221:             $hour = $tmphour;
  222:         }
  223:     }
  224:     if (defined($ENV{'form.'.$dname.'_day'})) {
  225:         my $tmpday = $ENV{'form.'.$dname.'_day'};
  226:         if (($tmpday =~ /^\d+$/) && ($tmpday > 0) && ($tmpday < 32)) {
  227:             $day = $tmpday;
  228:         }
  229:     }
  230:     if (defined($ENV{'form.'.$dname.'_month'})) {
  231:         my $tmpmonth = $ENV{'form.'.$dname.'_month'};
  232:         if (($tmpmonth =~ /^\d+$/) && ($tmpmonth > 0) && ($tmpmonth < 13)) {
  233:             $month = $tmpmonth - 1;
  234:         }
  235:     }
  236:     if (defined($ENV{'form.'.$dname.'_year'})) {
  237:         my $tmpyear = $ENV{'form.'.$dname.'_year'};
  238:         if (($tmpyear =~ /^\d+$/) && ($tmpyear > 1900)) {
  239:             $year = $tmpyear - 1900;
  240:         }
  241:     }
  242:     if (eval(&timelocal($sec,$min,$hour,$day,$month,$year))) {
  243:         return &timelocal($sec,$min,$hour,$day,$month,$year);
  244:     } else {
  245:         return undef;
  246:     }
  247: }
  248: 
  249: ##############################################
  250: ##############################################
  251: 
  252: sub AscendOrderOptions {
  253:     my ($order, $page, $formName)=@_;
  254: 
  255:     my $OpSel1 = '';
  256:     my $OpSel2 = '';
  257: 
  258:     if($order eq 'Ascending') {
  259:         $OpSel1 = ' selected';
  260:     } else {
  261:         $OpSel2 = ' selected';
  262:     }
  263: 
  264:     my $Str = '';
  265:     $Str .= '<select name="'.(($page)?$page:'').'Ascend"';
  266:     if($formName) {
  267:         $Str .= ' onchange="document.'.$formName.'.submit()"';
  268:     }
  269:     $Str .= '>'."\n";
  270:     $Str .= '<option'.$OpSel1.'>Ascending</option>'."\n".
  271: 	    '<option'.$OpSel2.'>Descending</option>'."\n";
  272:     $Str .= '</select>'."\n";
  273: 
  274:     return $Str;
  275: }
  276: 
  277: sub MapOptions {
  278:     my ($data, $page, $formName)=@_;
  279:     my $Str = '';
  280:     $Str .= '<select name="';
  281:     $Str .= (($page)?$page:'').'Maps"';
  282:     if($formName) {
  283:         $Str .= ' onchange="document.'.$formName.'.submit()"';
  284:     }
  285:     $Str .= '>'."\n";
  286: 
  287:     my $selected = 0;
  288:     foreach my $sequence (split(':',$data->{'orderedSequences'})) {
  289: 	$Str .= '<option';
  290:         if($data->{$page.'Maps'} eq $data->{$sequence.':title'}) {
  291:             $Str .= ' selected';
  292:             $selected = 1;
  293:         }
  294: 	$Str .= '>'.$data->{$sequence.':title'}.'</option>'."\n";	     
  295:     }
  296:     $Str .= '<option';
  297:     if(!$selected) {
  298:         $Str .= ' selected';
  299:     }
  300:     $Str .= '>All Maps</option>'."\n";
  301: 
  302:     $Str .= '</select>'."\n";
  303: 
  304:     return $Str;
  305: }
  306: 
  307: sub ProblemOptions {
  308:     my ($data, $page, $map, $formName)=@_;
  309:     my $Str = '';
  310:     $Str .= '<select name="';
  311:     $Str .= (($page)?$page:'').'ProblemSelect"';
  312:     if($formName) {
  313:         $Str .= ' onchange="document.'.$formName.'.submit()"';
  314:     }
  315:     $Str .= '>'."\n";
  316: 
  317:     my $selected = 0;
  318:     foreach my $sequence (split(':',$data->{'orderedSequences'})) {
  319: 	if($data->{$sequence.':title'} eq $map || $map eq 'All Maps') {
  320: 	    foreach my $problem (split(':', $data->{$sequence.':problems'})) {
  321: 		$Str .= '<option';
  322: 		if($data->{$page.'ProblemSelect'} eq 
  323: 		   $data->{$problem.':title'}) {
  324: 		    $Str .= ' selected';
  325: 		    $selected = 1;
  326: 		}
  327: 		$Str .= '>'.$data->{$problem.':title'}.'</option>'."\n";
  328: 	    }
  329: 	}
  330:     }
  331:     $Str .= '<option';
  332:     if(!$selected) {
  333:         $Str .= ' selected';
  334:     }
  335:     $Str .= '>All Problems</option>'."\n";
  336: 
  337:     $Str .= '</select>'."\n";
  338: 
  339:     return $Str;
  340: }
  341: 
  342: sub PartOptions {
  343:     my ($data, $page, $parts, $formName)=@_;
  344:     my $Str = '';
  345: 
  346:     if(!defined($parts)) {
  347: 	return '';
  348:     }
  349: 
  350:     $Str .= '<select name="';
  351:     $Str .= (($page)?$page:'').'PartSelect"';
  352:     if($formName) {
  353:         $Str .= ' onchange="document.'.$formName.'.submit()"';
  354:     }
  355:     $Str .= '>'."\n";
  356: 
  357:     my $selected = 0;
  358:     foreach my $part (@$parts) {
  359: 	$Str .= '<option';
  360: 	if($data->{$page.'PartSelect'} eq $part) {
  361: 	    $Str .= ' selected';
  362: 	    $selected = 1;
  363: 	}
  364: 	$Str .= '>'.$part.'</option>'."\n";	     
  365:     }
  366:     $Str .= '<option';
  367:     if(!$selected) {
  368:         $Str .= ' selected';
  369:     }
  370:     $Str .= '>All Parts</option>'."\n";
  371: 
  372:     $Str .= '</select>'."\n";
  373: 
  374:     return $Str;
  375: }
  376: 
  377: sub StudentOptions {
  378:     my ($cache, $students, $selectedName, $page, $formName)=@_;
  379: 
  380:     my $Str = '';
  381:     $Str .= '<select name="'.(($page)?$page:'').'Student"';
  382:     if($formName) {
  383:         $Str .= ' onchange="document.'.$formName.'.submit()"';
  384:     }
  385:     $Str .= '>'."\n";
  386: 
  387:     my $selected=0;
  388: 
  389:     foreach (@$students) {
  390: 	$Str .= '<option';
  391: 	if($selectedName eq $_) {
  392:             $Str .= ' selected';
  393:             $selected = 1;
  394:         }
  395:         $Str .= '>';
  396:         $Str .= $cache->{$_.':fullname'};
  397:         $Str .= '</option>'."\n";	     
  398:     }
  399: 
  400:     $Str .= '<option';
  401:     if($selectedName eq 'No Student Selected') {
  402:         $Str .= ' selected';
  403:         $selected = 1;
  404:     }
  405:     $Str .= '>No Student Selected</option>'."\n";
  406: 
  407:     $Str .= '<option';
  408:     if(!$selected) {
  409:         $Str .= ' selected';
  410:     }
  411:     $Str .= '>All Students</option>'."\n";
  412: 
  413:     $Str .= '</select>'."\n";
  414: 
  415:     return $Str;
  416: }
  417: 
  418: sub StatusOptions {
  419:     my ($status, $formName)=@_;
  420: 
  421:     my $OpSel1 = '';
  422:     my $OpSel2 = '';
  423:     my $OpSel3 = '';
  424: 
  425:     if($status eq 'Any')         { $OpSel3 = ' selected'; }
  426:     elsif($status eq 'Expired' ) { $OpSel2 = ' selected'; }
  427:     else                         { $OpSel1 = ' selected'; }
  428: 
  429:     my $Str = '';
  430:     $Str .= '<select name="Status"';
  431:     if(defined($formName) && $formName ne '') {
  432:         $Str .= ' onchange="document.'.$formName.'.submit()"';
  433:     }
  434:     $Str .= '>'."\n";
  435:     $Str .= '<option'.$OpSel1.'>Active</option>'."\n";
  436:     $Str .= '<option'.$OpSel2.'>Expired</option>'."\n";
  437:     $Str .= '<option'.$OpSel3.'>Any</option>'."\n";
  438:     $Str .= '</select>'."\n";
  439: }
  440: 
  441: 
  442: ########################################################
  443: ########################################################
  444: 
  445: =pod
  446: 
  447: =item &MultipleSectionSelect()
  448: 
  449: Inputs: 
  450: 
  451: =over 4
  452: 
  453: =item $sections A references to an array containing the names of all the
  454: sections used in a class.
  455: 
  456: =item $selectedSections A reference to an array containing the names of the
  457: currently selected sections.
  458: 
  459: =back 
  460: 
  461: Returns: a string containing HTML for a multiple select box for
  462: selecting sections of a course.  
  463: 
  464: The form element name is 'Section'.  @$sections is sorted prior to output.
  465: 
  466: =cut
  467: 
  468: ########################################################
  469: ########################################################
  470: sub MultipleSectionSelect {
  471:     my ($sections,$selectedSections)=@_;
  472: 
  473:     my $Str = '';
  474:     $Str .= '<select name="Section" multiple="true" size="4">'."\n";
  475: 
  476:     foreach (sort @$sections) {
  477:         $Str .= '<option';
  478:         foreach my $selected (@$selectedSections) {
  479:             if($_ eq $selected) {
  480:                 $Str .= ' selected=""';
  481:             }
  482:         }
  483:         $Str .= '>'.$_.'</option>'."\n";
  484:     }
  485:     $Str .= '</select>'."\n";
  486:     
  487:     return $Str;
  488: }
  489: 
  490: ########################################################
  491: ########################################################
  492: 
  493: =pod
  494: 
  495: =item &Title()
  496: 
  497: Inputs: $pageName a string containing the name of the page to be sent
  498: to &Apache::loncommon::bodytag.
  499: 
  500: Returns: string containing being <html> and complete <head> and <title>
  501: as well as a <script> to focus the current window and change its width
  502: and height to 500.  Why?  I do not know.  If you find out, please update
  503: this documentation.
  504: 
  505: =cut
  506: 
  507: ########################################################
  508: ########################################################
  509: sub Title {
  510:     my ($pageName)=@_;
  511: 
  512:     my $Str = '';
  513: 
  514:     $Str .= '<html><head><title>'.$pageName.'</title></head>'."\n";
  515:     $Str .= &Apache::loncommon::bodytag($pageName)."\n";
  516:     $Str .= '<script>window.focus(); window.width=500;window.height=500;';
  517:     $Str .= '</script>'."\n";
  518: 
  519:     return $Str;
  520: }
  521: 
  522: ########################################################
  523: ########################################################
  524: 
  525: =pod
  526: 
  527: =item &CreateHeadings()
  528: 
  529: This function generates the column headings for the chart.
  530: 
  531: =over 4
  532: 
  533: Inputs: $CacheData, $keyID, $headings, $spacePadding
  534: 
  535: $CacheData: pointer to a hash tied to the cached data database
  536: 
  537: $keyID: a pointer to an array containing the names of the data 
  538: held in a column and is used as part of a key into $CacheData
  539: 
  540: $headings: The names of the headings for the student information
  541: 
  542: $spacePadding: The spaces to go between columns
  543: 
  544: Output: $Str
  545: 
  546: $Str: A formatted string of the table column headings.
  547: 
  548: =back
  549: 
  550: =cut
  551: 
  552: ########################################################
  553: ########################################################
  554: sub CreateHeadings {
  555:     my ($data,$keyID,$headings,$displayString,$format)=@_;
  556:     my $Str='';
  557:     my $formatting = '';
  558: 
  559:     for(my $index=0; $index<(scalar @$headings); $index++) {
  560:  	my $currentHeading=$headings->[$index];
  561:         if($format eq 'preformatted') {
  562:             my @dataLength=split(//,$currentHeading);
  563:             my $length=scalar @dataLength;
  564:             $formatting = (' 'x
  565:                       ($data->{$keyID->[$index].':columnWidth'}-$length));
  566:         }
  567:         my $linkdata=$keyID->[$index];
  568: 
  569:         my $tempString = $displayString;
  570:         $tempString =~ s/LINKDATA/$linkdata/;
  571:         $tempString =~ s/DISPLAYDATA/$currentHeading/;
  572:         $tempString =~ s/FORMATTING/$formatting/;
  573: 
  574:         $Str .= $tempString;
  575:     }
  576: 
  577:     return $Str;
  578: }
  579: 
  580: ########################################################
  581: ########################################################
  582: 
  583: =pod
  584: 
  585: =item &FormatStudentInformation()
  586: 
  587: This function produces a formatted string of the student\'s information:
  588: username, domain, section, full name, and PID.
  589: 
  590: =over 4
  591: 
  592: Input: $cache, $name, $keyID, $spacePadding
  593: 
  594: $cache: This is a pointer to a hash that is tied to the cached data
  595: 
  596: $name:  The name and domain of the current student in name:domain format
  597: 
  598: $keyID: A pointer to an array holding the names used to
  599: 
  600: remove data from the hash.  They represent the name of the data to be removed.
  601: 
  602: $spacePadding: Extra spaces that represent the space between columns
  603: 
  604: Output: $Str
  605: 
  606: $Str: Formatted string.
  607: 
  608: =back
  609: 
  610: =cut
  611: 
  612: ########################################################
  613: ########################################################
  614: sub FormatStudentInformation {
  615:     my ($data,$name,$keyID,$displayString,$format)=@_;
  616:     my $Str='';
  617:     my $currentColumn;
  618: 
  619:     for(my $index=0; $index<(scalar @$keyID); $index++) {
  620:         $currentColumn=$data->{$name.':'.$keyID->[$index]};
  621: 
  622:         if($format eq 'preformatted') {
  623:             my @dataLength=split(//,$currentColumn);
  624:             my $length=scalar @dataLength;
  625:             $currentColumn.= (' 'x
  626:                      ($data->{$keyID->[$index].':columnWidth'}-$length));
  627:         }
  628: 
  629:         my $tempString = $displayString;
  630:         $tempString =~ s/DISPLAYDATA/$currentColumn/;
  631: 
  632:         $Str .= $tempString;
  633:     }
  634: 
  635:     return $Str;
  636: }
  637: 
  638: ########################################################
  639: ########################################################
  640: 
  641: # Create progress
  642: sub Create_PrgWin {
  643:     my ($r, $title, $heading, $number_to_do)=@_;
  644:     $r->print('<script>'.
  645:     "popwin=open(\'\',\'popwin\',\'width=400,height=100\');".
  646:     "popwin.document.writeln(\'<html><head><title>$title</title></head>".
  647: 	      "<body bgcolor=\"#88DDFF\">".
  648:               "<h4>$heading</h4>".
  649:               "<form name=popremain>".
  650:               "<input type=text size=55 name=remaining value=Starting></form>".
  651:               "</body></html>\');".
  652:     "popwin.document.close();".
  653:     "</script>");
  654: 
  655:     my %prog_state;
  656:     $prog_state{'now'}=0;
  657:     $prog_state{'since'}=time;
  658:     $prog_state{'started'}=time;
  659:     $prog_state{'total'}=$number_to_do;
  660: 
  661:     $r->rflush();
  662:     return %prog_state;
  663: }
  664: 
  665: # update progress
  666: sub Update_PrgWin {
  667:     my ($r,$prog_state,$displayString)=@_;
  668:     $r->print('<script>popwin.document.popremain.remaining.value="'.
  669:               $displayString.'";</script>');
  670:     $$prog_state{'started'}=time;
  671:     $r->rflush();
  672: }
  673: 
  674: # increment progress state
  675: sub Increment_PrgWin {
  676:     my ($r,$prog_state,$extraInfo)=@_;
  677:     $$prog_state{'now'}++;
  678:     $r->print('<script>popwin.document.popremain.remaining.value="'.
  679: 	      $$prog_state{'now'}.'/'.$$prog_state{'total'}.
  680: 	      ': '.int((time-$$prog_state{'since'})/
  681: 	      $$prog_state{'now'}*($$prog_state{'total'}-$$prog_state{'now'})).
  682: 	      ' secs remaining ('.(time-$$prog_state{'started'}).
  683: 	      ' seconds for '.$extraInfo.')";'.'</script>');
  684:     $$prog_state{'started'}=time;
  685:     sleep 1;
  686:     $r->rflush();
  687: }
  688: 
  689: # close Progress Line
  690: sub Close_PrgWin {
  691:     my ($r,$prog_state)=@_;
  692:     $r->print('<script>popwin.close()</script>'."\n");
  693:     undef(%$prog_state);
  694:     $r->rflush(); 
  695: }
  696: 
  697: 1;
  698: __END__

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>