--- loncom/interface/lonhelper.pm 2006/05/30 12:46:09 1.152 +++ loncom/interface/lonhelper.pm 2006/07/03 11:12:24 1.156 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # .helper XML handler to implement the LON-CAPA helper # -# $Id: lonhelper.pm,v 1.152 2006/05/30 12:46:09 www Exp $ +# $Id: lonhelper.pm,v 1.156 2006/07/03 11:12:24 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -185,7 +185,6 @@ use Apache::lonlocal; use Apache::lonnet; use Apache::longroup; use Apache::lonselstudent; -use lib '/home/httpd/lib/perl/'; use LONCAPA; # Register all the tags with the helper, so the helper can @@ -365,6 +364,7 @@ use Apache::loncommon; use Apache::File; use Apache::lonlocal; use Apache::lonnet; +use LONCAPA; sub new { my $proto = shift; @@ -470,9 +470,8 @@ sub _saveVars { sub _varsInFile { my $self = shift; my @vars = (); - for my $key (keys %{$self->{VARS}}) { - push @vars, &escape($key) . '=' . - &escape($self->{VARS}->{$key}); + for my $key (keys(%{$self->{VARS}})) { + push(@vars, &escape($key) . '=' . &escape($self->{VARS}->{$key})); } return join ('&', @vars); } @@ -1024,6 +1023,81 @@ sub postprocess { } 1; +package Apache::lonhelper::skip; + +=pod + +=head1 Elements + +=head2 Element: skipX + +The tag allows you define conditions under which the current state +should be skipped over and define what state to skip to. + + + + + #some code that decides whether to skip the state or not + + FINISH + + A possibly skipped state + + +=cut + +no strict; +@ISA = ("Apache::lonhelper::element"); +use strict; + +BEGIN { + &Apache::lonhelper::register('Apache::lonhelper::skip', + ('skip')); +} + +sub new { + my $ref = Apache::lonhelper::element->new(); + bless($ref); +} + +sub start_skip { + my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; + + if ($target ne 'helper') { + return ''; + } + # let know what text to skip to + $paramHash->{SKIPTAG}='/skip'; + return ''; +} + +sub end_skip { + my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; + + if ($target ne 'helper') { + return ''; + } + Apache::lonhelper::skip->new(); + return ''; +} + +sub render { + my $self = shift; + return ''; +} +# If a NEXTSTATE is set, switch to it +sub preprocess { + my ($self) = @_; + + if (defined($self->{NEXTSTATE})) { + $helper->changeState($self->{NEXTSTATE}); + } + + return 1; +} + +1; + package Apache::lonhelper::choices; =pod @@ -1611,8 +1685,6 @@ sub render { $date->min(0); } - &Apache::lonnet::logthis("date mode "); - if ($anytime) { $onclick = "onclick=\"javascript:updateCheck(this.form,'${var}anytime',false)\""; } @@ -2344,7 +2416,8 @@ sub render { my ($course_personnel, $current_members, $expired_members, - $future_members) = &Apache::lonselstudent::get_people_in_class(); + $future_members) = + &Apache::lonselstudent::get_people_in_class($env{'request.course.sec'}); @@ -2357,6 +2430,7 @@ sub render { # Current personel + $result .= '

Select Currently Enrolled Students and Active Course Personnel

'; $result .= &Apache::lonselstudent::render_student_list( $current_members, "helpform", "current", @@ -2372,6 +2446,8 @@ sub render { # And future. + $result .= '

Select Future Enrolled Students and Future Course Personnel

'; + $result .= &Apache::lonselstudent::render_student_list( $future_members, "helpform", "future", @@ -2381,6 +2457,7 @@ sub render { 0); # Past + $result .= '

Select Previously Enrolled Students and Inactive Course Personnel

'; $result .= &Apache::lonselstudent::render_student_list($expired_members, "helpform", "past", @@ -3130,7 +3207,8 @@ sub start_clause { die 'Error in clause of condition, Perl said: ' . $@ if $@; if (!&$clause($helper, $paramHash)) { # Discard all text until the /condition. - &Apache::lonxml::get_all_text('/condition', $parser); + my $end_tag = $paramHash->{SKIPTAG} || '/condition'; + &Apache::lonxml::get_all_text($end_tag, $parser); } }