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

raeburn raeburn at source.lon-capa.org
Tue May 12 00:24:57 EDT 2026


raeburn		Tue May 12 04:24:57 2026 EDT

  Modified files:              
    /loncom/interface	lonhelper.pm 
  Log:
  - Remove trailing white space.  No code changes.
  
  
-------------- next part --------------
Index: loncom/interface/lonhelper.pm
diff -u loncom/interface/lonhelper.pm:1.209 loncom/interface/lonhelper.pm:1.210
--- loncom/interface/lonhelper.pm:1.209	Thu Apr 23 16:56:43 2026
+++ loncom/interface/lonhelper.pm	Tue May 12 04:24:57 2026
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # .helper XML handler to implement the LON-CAPA helper
 #
-# $Id: lonhelper.pm,v 1.209 2026/04/23 16:56:43 raeburn Exp $
+# $Id: lonhelper.pm,v 1.210 2026/05/12 04:24:57 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -208,7 +208,7 @@
 }
 
 BEGIN {
-    Apache::lonxml::register('Apache::lonhelper', 
+    Apache::lonxml::register('Apache::lonhelper',
                              ('helper'));
       register('Apache::lonhelper', ('state'));
 }
@@ -223,7 +223,7 @@
 # To collect parameters, the contents of the subtags are collected
 # into this paramHash, then passed to the element object when the 
 # end of the element tag is located.
-my $paramHash; 
+my $paramHash;
 
 # Note from Jeremy 5-8-2003: It is *vital* that the real handler be called
 # as a subroutine from the handler, or very mysterious things might happen.
@@ -324,7 +324,7 @@
 
 sub end_helper {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
-    
+
     if ($target ne 'helper') {
         return '';
     }
@@ -508,7 +508,7 @@
 sub allowedCheck {
     my $self = shift;
 
-    if (!defined($self->{REQUIRED_PRIV})) { 
+    if (!defined($self->{REQUIRED_PRIV})) {
         return 1;
     }
     my ($priv,$modifier) = split(/\&/,$self->{REQUIRED_PRIV});
@@ -543,7 +543,7 @@
 	my $prevState = $self->{STATES}{$self->{STATE}};
         $prevState->postprocess();
     }
-    
+
     # Note, to handle errors in a state's input that a user must correct,
     # do not transition in the postprocess, and force the user to correct
     # the error.
@@ -551,7 +551,7 @@
     # Phase 2: Preprocess current state
     my $startState = $self->{STATE};
     my $state = $self->{STATES}->{$startState};
-    
+
     # For debugging, print something here to determine if you're going
     # to an undefined state.
     if (!defined($state)) {
@@ -561,7 +561,7 @@
 
     # Phase 3: While the current state is different from the previous state,
     # keep processing.
-    while ( $startState ne $self->{STATE} && 
+    while ( $startState ne $self->{STATE} &&
             defined($self->{STATES}->{$self->{STATE}}) )
     {
 	$startState = $self->{STATE};
@@ -570,7 +570,7 @@
     }
 
     return;
-} 
+}
 
 # 1: Do the post processing for the previous state.
 # 2: Do the preprocessing for the current state.
@@ -592,7 +592,7 @@
     # Phase 4: Display.
     my $stateTitle=&mt($state->title());
     my $stateHelp=     $state->help();
-    my $browser_searcher_js = 
+    my $browser_searcher_js =
 	'<script type="text/javascript">'."\n".
 	&Apache::loncommon::browser_and_searcher_javascript().
 	"\n".'</script>';
@@ -770,7 +770,7 @@
 sub addElement {
     my $self = shift;
     my $element = shift;
-    
+
     push @{$self->{ELEMENTS}}, $element;
 }
 
@@ -860,12 +860,12 @@
     $self->{PARAMS} = $paramHash;
     $self->{STATE} = $state;
     $state->addElement($self);
-    
+
     # Ensure param hash is not reused
     $paramHash = {};
 
     return $self;
-}   
+}
 
 sub start_nextstate {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
@@ -873,7 +873,7 @@
     if ($target ne 'helper') {
         return '';
     }
-    
+ 
     $paramHash->{NEXTSTATE} = &Apache::lonxml::get_all_text('/nextstate',
                                                              $parser);
     return '';
@@ -887,7 +887,7 @@
     if ($target ne 'helper') {
         return '';
     }
-    
+ 
     $paramHash->{FINAL_CODE} = &Apache::lonxml::get_all_text('/finalcode',
                                                              $parser);
     return '';
@@ -901,7 +901,7 @@
     if ($target ne 'helper') {
         return '';
     }
-    
+ 
     $paramHash->{DEFAULT_VALUE} = &Apache::lonxml::get_all_text('/defaultvalue',
                                                              $parser);
     $paramHash->{DEFAULT_VALUE} = 'sub { my $helper = shift; my $state = shift;' .
@@ -918,7 +918,7 @@
     if ($target ne 'helper') {
         return '';
     }
-    
+ 
     $paramHash->{VALIDATOR} = &Apache::lonxml::get_all_text('/validator',
                                                              $parser);
     $paramHash->{VALIDATOR} = 'sub { my $helper = shift; my $state = shift; my $element = shift; my $val = shift;' .
@@ -1035,13 +1035,13 @@
 
 sub render {
     my $self = shift;
-    
+
     if ($self->{TYPE} =~ /^\s*warning\s*$/i) {
-	 $self->{MESSAGE_TEXT} = 
+	 $self->{MESSAGE_TEXT} =
 	     '<span class="LC_warning">'. $self->{MESSAGE_TEXT}.'</span>';
     }
     if ($self->{TYPE} =~ /^\s*error\s*$/i) {
-	 $self->{MESSAGE_TEXT} = 
+	 $self->{MESSAGE_TEXT} =
 	     '<span class="LC_error">'. $self->{MESSAGE_TEXT}.'</span>';
     }
     return $self->{MESSAGE_TEXT};
@@ -1382,7 +1382,7 @@
     my $evalFlag   = $token->[2]{'eval'};
     my $relatedVar = $token->[2]{'relatedvalue'}; 
     my $relatedDefault = $token->[2]{'relateddefault'};
-    push @{$paramHash->{CHOICES}}, [&mtn($human), $computer, $nextstate, 
+    push @{$paramHash->{CHOICES}}, [&mtn($human), $computer, $nextstate,
                                     $evalFlag, $relatedVar, $relatedDefault];
     return '';
 }
@@ -1392,7 +1392,7 @@
 }
 
 {
-    # used to generate unique id attributes for <input> tags. 
+    # used to generate unique id attributes for <input> tags.
     # internal use only.
     my $id = 0;
     sub new_id { return $id++; }
@@ -1450,7 +1450,7 @@
 
     if (defined($self->{DEFAULT_VALUE})) {
         $checkedChoicesFunc = eval ($self->{DEFAULT_VALUE});
-        die 'Error in default value code for variable ' . 
+        die 'Error in default value code for variable ' .
             $self->{'variable'} . ', Perl said: ' . $@ if $@;
     } else {
         $checkedChoicesFunc = sub { return ''; };
@@ -1464,9 +1464,9 @@
     } else {
         # single choice
         my $selectedChoice = &$checkedChoicesFunc($helper, $self);
-        
+
         my $foundChoice = 0;
-        
+
         # check that the choice is in the list of choices.
         for my $choice (@{$self->{CHOICES}}) {
             if ($choice->[1] eq $selectedChoice) {
@@ -1474,8 +1474,8 @@
                 $foundChoice = 1;
             }
         }
-        
-        # If we couldn't find the choice, pick the first one 
+
+        # If we couldn't find the choice, pick the first one
         if (!$foundChoice) {
             $checkedChoices{$self->{CHOICES}->[0]->[1]} = 1;
         }
@@ -1488,7 +1488,7 @@
         $result .= "<div role=\"row\" class=\"LC_grid_row\" style=\"line-height: 160%;\">\n"
                   ."<div role=\"gridcell\" class=\"LC_grid_cell\"> </div>\n"
                   ."<div role=\"gridcell\" class=\"LC_grid_cell\"><input type='$type' name='${var}_forminput'"
-                  ." value='".HTML::Entities::encode($choice->[1],"<>&\"'") 
+                  ." value='".HTML::Entities::encode($choice->[1],"<>&\"'")
                   ."'";
         if ($checkedChoices{$choice->[1]}) {
             $result .= " checked='checked'";
@@ -1530,7 +1530,7 @@
 
 
     if (!defined($chosenValue) && !$self->{'allowempty'}) {
-        $self->{ERROR_MSG} = 
+        $self->{ERROR_MSG} =
 	    &mt("You must choose one or more choices to continue.");
         return 0;
     }
@@ -1544,7 +1544,7 @@
     if (defined($self->{NEXTSTATE})) {
         $helper->changeState($self->{NEXTSTATE});
     }
-    
+ 
     foreach my $choice (@{$self->{CHOICES}}) {
         if ($choice->[1] eq $chosenValue) {
             if (defined($choice->[2])) {
@@ -1643,7 +1643,7 @@
 
     if (defined($self->{DEFAULT_VALUE})) {
         $checkedChoicesFunc = eval ($self->{DEFAULT_VALUE});
-        die 'Error in default value code for variable ' . 
+        die 'Error in default value code for variable ' .
             $self->{'variable'} . ', Perl said: ' . $@ if $@;
     } else {
         $checkedChoicesFunc = sub { return ''; };
@@ -1651,9 +1651,9 @@
 
     # single choice
     my $selectedChoice = &$checkedChoicesFunc($helper, $self);
-    
+ 
     my $foundChoice = 0;
-    
+ 
     # check that the choice is in the list of choices.
     for my $choice (@{$self->{CHOICES}}) {
 	if ($choice->[1] eq $selectedChoice) {
@@ -1661,8 +1661,8 @@
 	    $foundChoice = 1;
 	}
     }
-    
-    # If we couldn't find the choice, pick the first one 
+ 
+    # If we couldn't find the choice, pick the first one
     if (!$foundChoice) {
 	$checkedChoices{$self->{CHOICES}->[0]->[1]} = 1;
     }
@@ -1672,8 +1672,8 @@
 
     $result .= "<select name='${var}_forminput'$id>\n";
     foreach my $choice (@{$self->{CHOICES}}) {
-        $result .= "<option value='" . 
-            HTML::Entities::encode($choice->[1],"<>&\"'") 
+        $result .= "<option value='" .
+            HTML::Entities::encode($choice->[1],"<>&\"'")
             . "'";
         if ($checkedChoices{$choice->[1]}) {
             $result .= " selected='selected' ";
@@ -1707,7 +1707,7 @@
     if (defined($self->{NEXTSTATE})) {
         $helper->changeState($self->{NEXTSTATE});
     }
-    
+ 
     foreach my $choice (@{$self->{CHOICES}}) {
         if ($choice->[1] eq $chosenValue) {
             if (defined($choice->[2])) {
@@ -1813,10 +1813,10 @@
 
     if (defined($helper->{VARS}{$var})
 	&&  $helper->{VARS}{$var} > 0) {
-        $date = &get_date_object($helper->{VARS}{$var}); 
+        $date = &get_date_object($helper->{VARS}{$var});
     } elsif (defined($self->{DEFAULT_VALUE})) {
         my $valueFunc = eval($self->{DEFAULT_VALUE});
-        die('Error in default value code for variable ' . 
+        die('Error in default value code for variable ' .
             $self->{'variable'} . ', Perl said: ' . $@) if $@;
         $time = &$valueFunc($helper, $self);
 	if (lc($time) eq 'anytime') {
@@ -1958,7 +1958,7 @@
         if (($var eq 'startreserve') || ($var eq 'endreserve')) {
             $anytimetext = &mt('Any time before slot starts');
         } elsif (($var eq 'startunique') || ($var eq 'endunique')) {
-            $anytimetext = &mt('No restriction on uniqueness');     
+            $anytimetext = &mt('No restriction on uniqueness');
         }
 	$result.="name='${var}anytime'/>".$anytimetext.'</label>'
     }
@@ -1974,9 +1974,9 @@
     } else {
 	my $month = $env{'form.' . $var . 'month'};
         $month ++;
-	my $day = $env{'form.' . $var . 'day'}; 
-	my $year = $env{'form.' . $var . 'year'}; 
-	my $min = 0; 
+	my $day = $env{'form.' . $var . 'day'};
+	my $year = $env{'form.' . $var . 'year'};
+	my $min = 0;
 	my $hour = 0;
 	if ($self->{'hoursminutes'}) {
 	    $min = $env{'form.' . $var . 'minute'};
@@ -3347,7 +3347,7 @@
     foreach my $group_name (sort(keys(%curr_groups))) {
 	push(@{$paramHash->{CHOICES}}, [$group_name, $group_name]);
     }
-}    
+}
 
 sub end_section {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;


More information about the LON-CAPA-cvs mailing list