--- loncom/interface/lonhelper.pm 2006/03/07 16:09:59 1.133 +++ loncom/interface/lonhelper.pm 2006/03/19 23:09:20 1.135 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # .helper XML handler to implement the LON-CAPA helper # -# $Id: lonhelper.pm,v 1.133 2006/03/07 16:09:59 albertel Exp $ +# $Id: lonhelper.pm,v 1.135 2006/03/19 23:09:20 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -573,26 +573,20 @@ sub display { } # Phase 4: Display. - my $html=&Apache::lonxml::xmlbegin(); my $stateTitle=&mt($state->title()); - my $helperTitle = &mt($self->{TITLE}); - my $browser_searcher_js = &Apache::loncommon::browser_and_searcher_javascript(); - my $bodytag = &Apache::loncommon::bodytag($helperTitle,'',''); + my $browser_searcher_js = + ''; + + $result .= &Apache::loncommon::start_page($self->{TITLE}, + $browser_searcher_js); + my $previous = HTML::Entities::encode(&mt("<- Previous"), '<>&"'); my $next = HTML::Entities::encode(&mt("Next ->"), '<>&"'); # FIXME: This should be parameterized, not concatenated - Jeremy - my $loncapaHelper = &mt("LON-CAPA Helper:"); - $result .= < - $loncapaHelper: $helperTitle - - - $bodytag -HEADER + if (!$state->overrideForm()) { $result.="
"; } $result .= < @@ -655,10 +649,9 @@ HEADER - - FOOTER + $result .= &Apache::loncommon::end_page(); # Handle writing out the vars to the file my $file = Apache::File->new('>'.$self->{FILENAME}); print $file $self->_varsInFile(); @@ -2996,8 +2989,12 @@ package Apache::lonhelper::section;
allows the user to choose one or more sections from the current course. -It takes the standard attributes "variable", "multichoice", and -"nextstate", meaning what they do for most other elements. +It takes the standard attributes "variable", "multichoice", +"allowempty" and "nextstate", meaning what they do for most other +elements. + +also takes a boolean 'onlysections' whcih will restrict this to only +have sections and not include groups =cut @@ -3047,8 +3044,16 @@ sub start_section { } for my $sectionName (sort(keys(%choices))) { - - push @{$paramHash->{CHOICES}}, [$sectionName, $sectionName]; + push @{$paramHash->{CHOICES}}, [$sectionName, $sectionName]; + } + return if ($token->[2]{'onlysections'}); + + # add in groups to the end of the list + my %curr_groups; + if (&Apache::loncommon::coursegroups(\%curr_groups)) { + foreach my $group_name (sort(keys(%curr_groups))) { + push(@{$paramHash->{CHOICES}}, [$group_name, $group_name]); + } } } @@ -3068,10 +3073,12 @@ package Apache::lonhelper::group; =head2 Element: groupX -
allows the user to choose one or more groups from the current course. + allows the user to choose one or more groups from the current course. + +It takes the standard attributes "variable", "multichoice", + "allowempty" and "nextstate", meaning what they do for most other + elements. -It takes the standard attributes "variable", "multichoice", and "nextstate", meaning what they do for most other elements. - =cut no strict; @@ -3108,18 +3115,14 @@ sub start_group { # Populate the CHOICES element my %choices; - my $numgroups; my %curr_groups; if (&Apache::loncommon::coursegroups(\%curr_groups)) { - foreach my $group_name (keys %curr_groups) { - $choices{$group_name} = $group_name; - } - } - foreach my $group_name (sort(keys(%choices))) { - push @{$paramHash->{CHOICES}}, [$group_name, $group_name]; + foreach my $group_name (sort(keys(%curr_groups))) { + push(@{$paramHash->{CHOICES}}, [$group_name, $group_name]); + } } } - + sub end_group { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;