version 1.31, 2003/05/16 17:20:51
|
version 1.37, 2003/06/12 13:52:06
|
Line 1160 BUTTONS
|
Line 1160 BUTTONS
|
if (defined($self->{DEFAULT_VALUE})) { |
if (defined($self->{DEFAULT_VALUE})) { |
$checkedChoicesFunc = eval ($self->{DEFAULT_VALUE}); |
$checkedChoicesFunc = eval ($self->{DEFAULT_VALUE}); |
die 'Error in default value code for variable ' . |
die 'Error in default value code for variable ' . |
{'variable'} . ', Perl said:' . $@ if $@; |
$self->{'variable'} . ', Perl said: ' . $@ if $@; |
} else { |
} else { |
$checkedChoicesFunc = sub { return ''; }; |
$checkedChoicesFunc = sub { return ''; }; |
} |
} |
Line 1694 BUTTONS
|
Line 1694 BUTTONS
|
$col .= "checked "; |
$col .= "checked "; |
$checked = 1; |
$checked = 1; |
} |
} |
|
if ($multichoice) { # all resources start checked; see bug 1174 |
|
$col .= "checked "; |
|
$checked = 1; |
|
} |
$col .= "value='" . |
$col .= "value='" . |
HTML::Entities::encode(&$valueFunc($resource)) |
HTML::Entities::encode(&$valueFunc($resource)) |
. "' /></td>"; |
. "' /></td>"; |
Line 1922 no strict;
|
Line 1926 no strict;
|
@ISA = ("Apache::lonhelper::element"); |
@ISA = ("Apache::lonhelper::element"); |
use strict; |
use strict; |
|
|
|
use Apache::lonpubdir; # for getTitleString |
|
|
BEGIN { |
BEGIN { |
&Apache::lonhelper::register('Apache::lonhelper::files', |
&Apache::lonhelper::register('Apache::lonhelper::files', |
('files', 'filechoice', 'filefilter')); |
('files', 'filechoice', 'filefilter')); |
Line 2078 BUTTONS
|
Line 2084 BUTTONS
|
$color = ''; |
$color = ''; |
} |
} |
|
|
|
# Get the title |
|
my $title = Apache::lonpubdir::getTitleString($fileName); |
|
|
# Netscape 4 is stupid and there's nowhere to put the |
# Netscape 4 is stupid and there's nowhere to put the |
# information on the input tag that the file is Published, |
# information on the input tag that the file is Published, |
# Unpublished, etc. In *real* browsers we can just say |
# Unpublished, etc. In *real* browsers we can just say |
Line 2104 BUTTONS
|
Line 2113 BUTTONS
|
if (!$self->{'multichoice'} && $choices == 0) { |
if (!$self->{'multichoice'} && $choices == 0) { |
$result .= ' checked'; |
$result .= ' checked'; |
} |
} |
$result .= "/></td><td bgcolor='$color'>" . $file . |
$result .= "/></td><td bgcolor='$color'>" . $file . "</td>" . |
"</td><td bgcolor='$color'>$status</td></tr>\n"; |
"<td bgcolor='$color'>$title</td>" . |
|
"<td bgcolor='$color'>$status</td>" . "</tr>\n"; |
$choices++; |
$choices++; |
} |
} |
} |
} |
Line 2244 sub end_section {
|
Line 2254 sub end_section {
|
} |
} |
1; |
1; |
|
|
|
package Apache::lonhelper::string; |
|
|
|
=pod |
|
|
|
=head2 Element: string |
|
|
|
string elements provide a string entry field for the user. string elements |
|
take the usual 'variable' and 'nextstate' parameters. string elements |
|
also pass through 'maxlength' and 'size' attributes to the input tag. |
|
|
|
string honors the defaultvalue tag, if given. |
|
|
|
=cut |
|
|
|
no strict; |
|
@ISA = ("Apache::lonhelper::element"); |
|
use strict; |
|
|
|
BEGIN { |
|
&Apache::lonhelper::register('Apache::lonhelper::string', |
|
('string')); |
|
} |
|
|
|
sub new { |
|
my $ref = Apache::lonhelper::element->new(); |
|
bless($ref); |
|
} |
|
|
|
# CONSTRUCTION: Construct the message element from the XML |
|
sub start_string { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
|
|
if ($target ne 'helper') { |
|
return ''; |
|
} |
|
|
|
$paramHash->{'variable'} = $token->[2]{'variable'}; |
|
$helper->declareVar($paramHash->{'variable'}); |
|
$paramHash->{'nextstate'} = $token->[2]{'nextstate'}; |
|
$paramHash->{'maxlength'} = $token->[2]{'maxlength'}; |
|
$paramHash->{'size'} = $token->[2]{'size'}; |
|
|
|
return ''; |
|
} |
|
|
|
sub end_string { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
|
|
if ($target ne 'helper') { |
|
return ''; |
|
} |
|
Apache::lonhelper::string->new(); |
|
return ''; |
|
} |
|
|
|
sub render { |
|
my $self = shift; |
|
my $result = '<input type="string" name="' . $self->{'variable'} . '.forminput"'; |
|
|
|
if (defined($self->{'size'})) { |
|
$result .= ' size="' . $self->{'size'} . '"'; |
|
} |
|
if (defined($self->{'maxlength'})) { |
|
$result .= ' maxlength="' . $self->{'maxlength'} . '"'; |
|
} |
|
|
|
if (defined($self->{DEFAULT_VALUE})) { |
|
my $valueFunc = eval($self->{DEFAULT_VALUE}); |
|
die 'Error in default value code for variable ' . |
|
$self->{'variable'} . ', Perl said: ' . $@ if $@; |
|
$result .= ' value="' . &$valueFunc($helper, $self) . '"'; |
|
} |
|
|
|
$result .= ' />'; |
|
|
|
return $result; |
|
} |
|
|
|
# If a NEXTSTATE was given, switch to it |
|
sub postprocess { |
|
my $self = shift; |
|
if (defined($self->{NEXTSTATE})) { |
|
$helper->changeState($self->{NEXTSTATE}); |
|
} |
|
|
|
return 1; |
|
} |
|
|
|
1; |
|
|
package Apache::lonhelper::general; |
package Apache::lonhelper::general; |
|
|
=pod |
=pod |
Line 2388 tag. It goes through all the states and
|
Line 2488 tag. It goes through all the states and
|
snippets and collecting the results. Finally, it takes the user out of the |
snippets and collecting the results. Finally, it takes the user out of the |
helper, going to a provided page. |
helper, going to a provided page. |
|
|
|
If the parameter "restartCourse" is true, this will override the buttons and |
|
will make a "Finish Helper" button that will re-initialize the course for them, |
|
which is useful for the Course Initialization helper so the users never see |
|
the old values taking effect. |
|
|
=cut |
=cut |
|
|
no strict; |
no strict; |
Line 2404 sub new {
|
Line 2509 sub new {
|
bless($ref); |
bless($ref); |
} |
} |
|
|
sub start_final { return ''; } |
sub start_final { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
|
|
if ($target ne 'helper') { |
|
return ''; |
|
} |
|
|
|
$paramHash->{'restartCourse'} = $token->[2]{'restartCourse'}; |
|
|
|
return ''; |
|
} |
|
|
sub end_final { |
sub end_final { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
Line 2467 sub render {
|
Line 2582 sub render {
|
for my $re (@results) { |
for my $re (@results) { |
$result .= ' <li>' . $re . "</li>\n"; |
$result .= ' <li>' . $re . "</li>\n"; |
} |
} |
|
|
|
if (!@results) { |
|
$result .= ' <li>No changes were made to current settings.</li>'; |
|
} |
|
|
|
if ($self->{'restartCourse'}) { |
|
$result .= "<center>\n" . |
|
"<form action='/adm/roles' method='post' target='loncapaclient'>\n" . |
|
"<input type='button' onclick='history.go(-1)' value='<- Previous' />" . |
|
"<input type='hidden' name='orgurl' value='/adm/menu' />" . |
|
"<input type='hidden' name='selectrole' value='1' />\n" . |
|
"<input type='hidden' name='" . $ENV{'request.role'} . |
|
"' value='1' />\n<input type='submit' value='Finish Course Initialization' />\n" . |
|
"</form></center>"; |
|
} |
|
|
return $result . '</ul>'; |
return $result . '</ul>'; |
} |
} |
|
|
|
sub overrideForm { |
|
my $self = shift; |
|
return $self->{'restartCourse'}; |
|
} |
|
|
1; |
1; |
|
|
package Apache::lonhelper::parmwizfinal; |
package Apache::lonhelper::parmwizfinal; |
Line 2537 sub render {
|
Line 2673 sub render {
|
my $navmap = Apache::lonnavmaps::navmap->new( |
my $navmap = Apache::lonnavmaps::navmap->new( |
$ENV{"request.course.fn"}.".db", |
$ENV{"request.course.fn"}.".db", |
$ENV{"request.course.fn"}."_parms.db", 0, 0); |
$ENV{"request.course.fn"}."_parms.db", 0, 0); |
my $res = $navmap->getById($vars->{RESOURCE_ID}); |
my $res = $navmap->getByMapPc($vars->{RESOURCE_ID}); |
my $title = $res->compTitle(); |
my $title = $res->compTitle(); |
$symb = $res->symb(); |
$symb = $res->symb(); |
$navmap->untieHashes(); |
$navmap->untieHashes(); |