[LON-CAPA-cvs] cvs: loncom /interface lonparmset.pm

matthew lon-capa-cvs@mail.lon-capa.org
Mon, 12 Aug 2002 18:54:16 -0000


matthew		Mon Aug 12 14:54:16 2002 EDT

  Modified files:              
    /loncom/interface	lonparmset.pm 
  Log:
  (failed) attempt to address bug 166.  Added the usual POD nonsense.
  More to come.
  
  
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.58 loncom/interface/lonparmset.pm:1.59
--- loncom/interface/lonparmset.pm:1.58	Mon Aug 12 14:21:42 2002
+++ loncom/interface/lonparmset.pm	Mon Aug 12 14:54:16 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set parameters for assessments
 #
-# $Id: lonparmset.pm,v 1.58 2002/08/12 18:21:42 albertel Exp $
+# $Id: lonparmset.pm,v 1.59 2002/08/12 18:54:16 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -25,27 +25,31 @@
 #
 # http://www.lon-capa.org/
 #
-# (Handler to resolve ambiguous file locations
-#
-# (TeX Content Handler
-#
-# YEAR=2000
-# 05/29/00,05/30,10/11 Gerd Kortemeyer)
-#
-# 10/11,10/12,10/16 Gerd Kortemeyer)
-#
-# 11/20,11/21,11/22,11/23,11/24,11/25,11/27,11/28,
-# 12/08,12/12,
-# YEAR=2001
-# 16/01/01,02/08,03/20,03/23,03/24,03/26,05/09,
-# 07/05,07/06,08/08,08/09,09/01,09/21 Gerd Kortemeyer
-# 12/17 Scott Harrison
-# 12/19 Guy Albertelli
-# 12/26,12/27 Gerd Kortemeyer
-#
-# YEAR=2002
-# 7/19 Jeremy Bowers
-###
+###################################################################
+###################################################################
+
+=pod
+
+=head1 NAME
+
+lonparmset - Handler to set parameters for assessments and course
+
+=head1 SYNOPSIS
+
+lonparmset provides an interface to setting course parameters. 
+
+=head1 DESCRIPTION
+
+This module sets coursewide and assessment parameters.
+
+=head1 INTERNAL SUBROUTINES
+
+=over 4
+
+=cut
+
+###################################################################
+###################################################################
 
 package Apache::lonparmset;
 
@@ -74,8 +78,23 @@
 my $csec;
 my $coursename;
 
-# -------------------------------------------- Figure out a cascading parameter
+##################################################
+##################################################
+
+=pod
+
+=item parmval
+
+Figure out a cascading parameter.
+
+Inputs:  $what $id $def
+
+Returns: I am not entirely sure.
 
+=cut
+
+##################################################
+##################################################
 sub parmval {
     my ($what,$id,$def)=@_;
     my $result='';
@@ -157,15 +176,58 @@
     return ($result,@outpar);
 }
 
-# ------------------------------------------------------------ Output for value
+##################################################
+##################################################
+
+=pod
+
+=item valout
+
+Format a value for output.
+
+Inputs:  $value, $type
+
+Returns: $value, formatted for output.  If $type indicates it is a date,
+localtime($value) is returned.
 
+=cut
+
+##################################################
+##################################################
 sub valout {
     my ($value,$type)=@_;
-    return ($value?(($type=~/^date/)?localtime($value):$value):'  ');
+    my $result = '';
+    # Values of zero are valid.
+    if (! $value && $value ne '0') {
+        $result = '  ';
+    } else {
+        if ($type=~/^date/) {
+            $result = localtime($value);
+        } else {
+            $result = $value;
+        }
+    }
+    return $result;
 }
 
-# -------------------------------------------------------- Produces link anchor
+##################################################
+##################################################
+
+=pod
 
+=item plink
+
+Produces a link anchor.
+
+Inputs: $type,$dis,$value,$marker,$return,$call
+
+Returns: scalar with html code for a link which will envoke the 
+javascript function 'pjump'.
+
+=cut
+
+##################################################
+##################################################
 sub plink {
     my ($type,$dis,$value,$marker,$return,$call)=@_;
     my $winvalue=$value;
@@ -341,10 +403,9 @@
     } # end of $parmlev if/else
 
     if ($parmlev eq 'full' || $parmlev eq 'brief') {
-    $r->print('<td bgcolor=#CCCCFF align="center">'.
-        &valout($outpar[$result],$$type{$which}).'</td>');
-
-}
+        $r->print('<td bgcolor=#CCCCFF align="center">'.
+                  &valout($outpar[$result],$$type{$which}).'</td>');
+    }
     my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}.
                                         '.'.$$name{$which},$symbp{$rid});
     $r->print('<td bgcolor=#999999 align="center"><font color=#FFFFFF>'.
@@ -353,6 +414,7 @@
     $r->print('</tr>');
     $r->print("\n");
 }
+
 sub print_td {
     my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$type,$display)=@_;
     $r->print('<td bgcolor='.(($result==$which)?'"#AAFFAA"':$defbg).
@@ -375,6 +437,24 @@
     return(@values);
 }
 
+##################################################
+##################################################
+
+=pod
+
+=item assessparms
+
+Show assessment data and parameters.  This is a large routine that should
+be simplified and shortened... someday.
+
+Inputs: $r
+
+Returns: nothing
+
+=cut
+
+##################################################
+##################################################
 sub assessparms {
 
     my $r=shift;
@@ -1121,7 +1201,25 @@
     untie(%parmhash);
 } # end sub assessparms
 
-# ------------------------------------------- Set course environment parameters
+
+##################################################
+##################################################
+
+=pod
+
+=item crsenv
+
+Show course data and parameters.  This is a large routine that should
+be simplified and shortened... someday.
+
+Inputs: $r
+
+Returns: nothing
+
+=cut
+
+##################################################
+##################################################
 sub crsenv {
     my $r=shift;
     my $setoutput='';
@@ -1281,8 +1379,19 @@
 ENDENV
 }
 
-# ================================================================ Main Handler
+##################################################
+##################################################
 
+=pod
+
+=item handler
+
+Main handler.  Calls &assessparms and &crsenv subroutines.
+
+=cut
+
+##################################################
+##################################################
 sub handler {
     my $r=shift;
 
@@ -1318,70 +1427,7 @@
 1;
 __END__
 
-
-=head1 NAME
-
-Apache::lonparmset - Handler to set parameters for assessments
-
-=head1 SYNOPSIS
-
-Invoked by /etc/httpd/conf/srm.conf:
-
- <Location /adm/parmset>
- PerlAccessHandler       Apache::lonacc
- SetHandler perl-script
- PerlHandler Apache::lonparmset
- ErrorDocument     403 /adm/login
- ErrorDocument     406 /adm/roles
- ErrorDocument	  500 /adm/errorhandler
- </Location>
-
-=head1 INTRODUCTION
-
-This module sets assessment parameters.
-
-This is part of the LearningOnline Network with CAPA project
-described at http://www.lon-capa.org.
-
-=head1 HANDLER SUBROUTINE
-
-This routine is called by Apache and mod_perl.
-
-=over 4
-
-=item *
-
-need to be in course
-
-=item *
-
-bring up assessment screen or course environment
-
-=back
-
-=head1 OTHER SUBROUTINES
-
-=over 4
-
-=item *
-
-parmval() : figure out a cascading parameter
-
-=item *
-
-valout() : format a value for output
-
-=item *
-
-plink() : produces link anchor
-
-=item *
-
-assessparms() : show assess data and parameters
-
-=item *
-
-crsenv() : for the course environment
+=pod
 
 =back