version 1.150, 2006/05/16 20:45:26
|
version 1.156, 2006/07/03 11:12:24
|
Line 183 use Apache::File;
|
Line 183 use Apache::File;
|
use Apache::lonxml; |
use Apache::lonxml; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonnet; |
use Apache::lonnet; |
|
use Apache::longroup; |
use Apache::lonselstudent; |
use Apache::lonselstudent; |
|
use LONCAPA; |
|
|
# Register all the tags with the helper, so the helper can |
# Register all the tags with the helper, so the helper can |
# push and pop them |
# push and pop them |
Line 362 use Apache::loncommon;
|
Line 364 use Apache::loncommon;
|
use Apache::File; |
use Apache::File; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonnet; |
use Apache::lonnet; |
|
use LONCAPA; |
|
|
sub new { |
sub new { |
my $proto = shift; |
my $proto = shift; |
Line 467 sub _saveVars {
|
Line 470 sub _saveVars {
|
sub _varsInFile { |
sub _varsInFile { |
my $self = shift; |
my $self = shift; |
my @vars = (); |
my @vars = (); |
for my $key (keys %{$self->{VARS}}) { |
for my $key (keys(%{$self->{VARS}})) { |
push @vars, &Apache::lonnet::escape($key) . '=' . |
push(@vars, &escape($key) . '=' . &escape($self->{VARS}->{$key})); |
&Apache::lonnet::escape($self->{VARS}->{$key}); |
|
} |
} |
return join ('&', @vars); |
return join ('&', @vars); |
} |
} |
Line 1021 sub postprocess {
|
Line 1023 sub postprocess {
|
} |
} |
1; |
1; |
|
|
|
package Apache::lonhelper::skip; |
|
|
|
=pod |
|
|
|
=head1 Elements |
|
|
|
=head2 Element: skipX<skip> |
|
|
|
The <skip> tag allows you define conditions under which the current state |
|
should be skipped over and define what state to skip to. |
|
|
|
<state name="SKIP"> |
|
<skip> |
|
<clause> |
|
#some code that decides whether to skip the state or not |
|
</clause> |
|
<nextstate>FINISH</nextstate> |
|
</skip> |
|
<message nextstate="FINISH">A possibly skipped state</message> |
|
</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 <cluase> 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; |
package Apache::lonhelper::choices; |
|
|
=pod |
=pod |
Line 1608 sub render {
|
Line 1685 sub render {
|
$date->min(0); |
$date->min(0); |
} |
} |
|
|
&Apache::lonnet::logthis("date mode "); |
|
|
|
if ($anytime) { |
if ($anytime) { |
$onclick = "onclick=\"javascript:updateCheck(this.form,'${var}anytime',false)\""; |
$onclick = "onclick=\"javascript:updateCheck(this.form,'${var}anytime',false)\""; |
} |
} |
Line 2341 sub render {
|
Line 2416 sub render {
|
my ($course_personnel, |
my ($course_personnel, |
$current_members, |
$current_members, |
$expired_members, |
$expired_members, |
$future_members) = &Apache::lonselstudent::get_people_in_class(); |
$future_members) = |
|
&Apache::lonselstudent::get_people_in_class($env{'request.course.sec'}); |
|
|
|
|
|
|
Line 2354 sub render {
|
Line 2430 sub render {
|
|
|
# Current personel |
# Current personel |
|
|
|
$result .= '<h4>Select Currently Enrolled Students and Active Course Personnel</h4>'; |
$result .= &Apache::lonselstudent::render_student_list( $current_members, |
$result .= &Apache::lonselstudent::render_student_list( $current_members, |
"helpform", |
"helpform", |
"current", |
"current", |
Line 2369 sub render {
|
Line 2446 sub render {
|
|
|
# And future. |
# And future. |
|
|
|
$result .= '<h4>Select Future Enrolled Students and Future Course Personnel</h4>'; |
|
|
$result .= &Apache::lonselstudent::render_student_list( $future_members, |
$result .= &Apache::lonselstudent::render_student_list( $future_members, |
"helpform", |
"helpform", |
"future", |
"future", |
Line 2378 sub render {
|
Line 2457 sub render {
|
0); |
0); |
# Past |
# Past |
|
|
|
$result .= '<h4>Select Previously Enrolled Students and Inactive Course Personnel</h4>'; |
$result .= &Apache::lonselstudent::render_student_list($expired_members, |
$result .= &Apache::lonselstudent::render_student_list($expired_members, |
"helpform", |
"helpform", |
"past", |
"past", |
Line 2848 sub start_section {
|
Line 2928 sub start_section {
|
return if ($token->[2]{'onlysections'}); |
return if ($token->[2]{'onlysections'}); |
|
|
# add in groups to the end of the list |
# add in groups to the end of the list |
my %curr_groups = &Apache::loncommon::coursegroups(); |
my %curr_groups = &Apache::longroup::coursegroups(); |
foreach my $group_name (sort(keys(%curr_groups))) { |
foreach my $group_name (sort(keys(%curr_groups))) { |
push(@{$paramHash->{CHOICES}}, [$group_name, $group_name]); |
push(@{$paramHash->{CHOICES}}, [$group_name, $group_name]); |
} |
} |
Line 2912 sub start_group {
|
Line 2992 sub start_group {
|
# Populate the CHOICES element |
# Populate the CHOICES element |
my %choices; |
my %choices; |
|
|
my %curr_groups = &Apache::loncommon::coursegroups(); |
my %curr_groups = &Apache::longroup::coursegroups(); |
foreach my $group_name (sort {lc($a) cmp lc($b)} (keys(%curr_groups))) { |
foreach my $group_name (sort {lc($a) cmp lc($b)} (keys(%curr_groups))) { |
push(@{$paramHash->{CHOICES}}, [$group_name, $group_name]); |
push(@{$paramHash->{CHOICES}}, [$group_name, $group_name]); |
} |
} |
Line 3127 sub start_clause {
|
Line 3207 sub start_clause {
|
die 'Error in clause of condition, Perl said: ' . $@ if $@; |
die 'Error in clause of condition, Perl said: ' . $@ if $@; |
if (!&$clause($helper, $paramHash)) { |
if (!&$clause($helper, $paramHash)) { |
# Discard all text until the /condition. |
# 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); |
} |
} |
} |
} |
|
|