version 1.16, 2003/04/30 19:23:48
|
version 1.18, 2003/05/05 15:17:25
|
Line 149 of the information used is persistent be
|
Line 149 of the information used is persistent be
|
and -maintain code. |
and -maintain code. |
|
|
It is possible to do some of the work with an XML fragment parsed by |
It is possible to do some of the work with an XML fragment parsed by |
lonxml; again, see lonprintout.pm for an example. |
lonxml; again, see lonprintout.pm for an example. In that case it is |
|
imperative that you call B<Apache::lonhelper::registerHelperTags()> |
|
before parsing XML fragments and B<Apache::lonhelper::unregisterHelperTags()> |
|
when you are done. See lonprintout.pm for examples of this usage in the |
|
printHelper subroutine. |
|
|
=cut |
=cut |
|
|
Line 462 sub process {
|
Line 466 sub process {
|
|
|
# Phase 2: Preprocess current state |
# Phase 2: Preprocess current state |
my $startState = $self->{STATE}; |
my $startState = $self->{STATE}; |
my $state = $self->{STATES}{$startState}; |
my $state = $self->{STATES}->{$startState}; |
|
|
# For debugging, print something here to determine if you're going |
# For debugging, print something here to determine if you're going |
# to an undefined state. |
# to an undefined state. |
Line 473 sub process {
|
Line 477 sub process {
|
|
|
# Phase 3: While the current state is different from the previous state, |
# Phase 3: While the current state is different from the previous state, |
# keep processing. |
# keep processing. |
while ( $startState ne $self->{STATE} ) |
while ( $startState ne $self->{STATE} && |
|
defined($self->{STATES}->{$self->{STATE}}) ) |
{ |
{ |
$startState = $self->{STATE}; |
$startState = $self->{STATE}; |
$state = $self->{STATES}{$startState}; |
$state = $self->{STATES}->{$startState}; |
$state->preprocess(); |
$state->preprocess(); |
} |
} |
|
|
Line 495 sub display {
|
Line 500 sub display {
|
|
|
my $result = ""; |
my $result = ""; |
|
|
|
if (!defined($state)) { |
|
$result = "<font color='#ff0000'>Error: state '$state' not defined!</font>"; |
|
return $result; |
|
} |
|
|
# Phase 4: Display. |
# Phase 4: Display. |
my $stateTitle = $state->title(); |
my $stateTitle = $state->title(); |
my $bodytag = &Apache::loncommon::bodytag("$self->{TITLE}",'',''); |
my $bodytag = &Apache::loncommon::bodytag("$self->{TITLE}",'',''); |
Line 987 sub render {
|
Line 997 sub render {
|
if ($self->{'multichoice'}) { |
if ($self->{'multichoice'}) { |
$result .= <<SCRIPT; |
$result .= <<SCRIPT; |
<script> |
<script> |
function checkall(value) { |
function checkall(value, checkName) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
document.forms.helpform.elements[i].checked=value; |
ele = document.forms.helpform.elements[i]; |
|
if (ele.name == checkName + '.forminput') { |
|
document.forms.helpform.elements[i].checked=value; |
|
} |
} |
} |
} |
} |
</script> |
</script> |
SCRIPT |
SCRIPT |
$buttons = <<BUTTONS; |
$buttons = <<BUTTONS; |
<br /> |
<br /> |
<input type="button" onclick="checkall(true)" value="Select All" /> |
<input type="button" onclick="checkall(true, '$var')" value="Select All" /> |
<input type="button" onclick="checkall(false)" value="Unselect All" /> |
<input type="button" onclick="checkall(false, '$var')" value="Unselect All" /> |
<br /> |
<br /> |
BUTTONS |
BUTTONS |
} |
} |
Line 1295 the user can manipulate the folders.
|
Line 1308 the user can manipulate the folders.
|
|
|
<resource> takes the standard variable attribute to control what helper |
<resource> takes the standard variable attribute to control what helper |
variable stores the results. It also takes a "multichoice" attribute, |
variable stores the results. It also takes a "multichoice" attribute, |
which controls whether the user can select more then one resource. |
which controls whether the user can select more then one resource. The |
|
"toponly" attribute controls whether the resource display shows just the |
|
resources in that sequence, or recurses into all sub-sequences, defaulting |
|
to false. |
|
|
B<SUB-TAGS> |
B<SUB-TAGS> |
|
|
Line 1356 sub start_resource {
|
Line 1372 sub start_resource {
|
$paramHash->{'variable'} = $token->[2]{'variable'}; |
$paramHash->{'variable'} = $token->[2]{'variable'}; |
$helper->declareVar($paramHash->{'variable'}); |
$helper->declareVar($paramHash->{'variable'}); |
$paramHash->{'multichoice'} = $token->[2]{'multichoice'}; |
$paramHash->{'multichoice'} = $token->[2]{'multichoice'}; |
|
$paramHash->{'toponly'} = $token->[2]{'toponly'}; |
return ''; |
return ''; |
} |
} |
|
|
Line 1460 sub render {
|
Line 1477 sub render {
|
if ($self->{'multichoice'}) { |
if ($self->{'multichoice'}) { |
$result = <<SCRIPT; |
$result = <<SCRIPT; |
<script> |
<script> |
function checkall(value) { |
function checkall(value, checkName) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
ele = document.forms.helpform.elements[i]; |
ele = document.forms.helpform.elements[i]; |
if (ele.type == "checkbox") { |
if (ele.name == checkName + '.forminput') { |
document.forms.helpform.elements[i].checked=value; |
document.forms.helpform.elements[i].checked=value; |
} |
} |
} |
} |
Line 1472 sub render {
|
Line 1489 sub render {
|
SCRIPT |
SCRIPT |
$buttons = <<BUTTONS; |
$buttons = <<BUTTONS; |
<br /> |
<br /> |
<input type="button" onclick="checkall(true)" value="Select All" /> |
<input type="button" onclick="checkall(true, '$var')" value="Select All Resources" /> |
<input type="button" onclick="checkall(false)" value="Unselect All" /> |
<input type="button" onclick="checkall(false, '$var')" value="Unselect All Resources" /> |
<br /> |
<br /> |
BUTTONS |
BUTTONS |
} |
} |
Line 1516 BUTTONS
|
Line 1533 BUTTONS
|
} |
} |
}; |
}; |
|
|
$ENV{'form.condition'} = 1; |
$ENV{'form.condition'} = !$self->{'toponly'}; |
$result .= |
$result .= |
&Apache::lonnavmaps::render( { 'cols' => [$renderColFunc, |
&Apache::lonnavmaps::render( { 'cols' => [$renderColFunc, |
Apache::lonnavmaps::resource()], |
Apache::lonnavmaps::resource()], |
Line 1613 sub render {
|
Line 1630 sub render {
|
my $self = shift; |
my $self = shift; |
my $result = ''; |
my $result = ''; |
my $buttons = ''; |
my $buttons = ''; |
|
my $var = $self->{'variable'}; |
|
|
if ($self->{'multichoice'}) { |
if ($self->{'multichoice'}) { |
$result = <<SCRIPT; |
$result = <<SCRIPT; |
<script> |
<script> |
function checkall(value) { |
function checkall(value, checkName) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
document.forms.helpform.elements[i].checked=value; |
ele = document.forms.helpform.elements[i]; |
|
if (ele.name == checkName + '.forminput') { |
|
document.forms.helpform.elements[i].checked=value; |
|
} |
} |
} |
} |
} |
</script> |
</script> |
SCRIPT |
SCRIPT |
$buttons = <<BUTTONS; |
$buttons = <<BUTTONS; |
<br /> |
<br /> |
<input type="button" onclick="checkall(true)" value="Select All" /> |
<input type="button" onclick="checkall(true, '$var')" value="Select All Students" /> |
<input type="button" onclick="checkall(false)" value="Unselect All" /> |
<input type="button" onclick="checkall(false, '$var')" value="Unselect All Students" /> |
<br /> |
<br /> |
BUTTONS |
BUTTONS |
} |
} |
Line 1818 sub render {
|
Line 1839 sub render {
|
if ($self->{'multichoice'}) { |
if ($self->{'multichoice'}) { |
$result = <<SCRIPT; |
$result = <<SCRIPT; |
<script> |
<script> |
function checkall(value) { |
function checkall(value, checkName) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
for (i=0; i<document.forms.helpform.elements.length; i++) { |
ele = document.forms.helpform.elements[i]; |
ele = document.forms.helpform.elements[i]; |
if (ele.type == "checkbox") { |
if (ele.name == checkName + '.forminput') { |
document.forms.helpform.elements[i].checked=value; |
document.forms.helpform.elements[i].checked=value; |
} |
} |
} |
} |
Line 1830 sub render {
|
Line 1851 sub render {
|
SCRIPT |
SCRIPT |
$buttons = <<BUTTONS; |
$buttons = <<BUTTONS; |
<br /> |
<br /> |
<input type="button" onclick="checkall(true)" value="Select All" /> |
<input type="button" onclick="checkall(true, '$var')" value="Select All Files" /> |
<input type="button" onclick="checkall(false)" value="Unselect All" /> |
<input type="button" onclick="checkall(false, '$var')" value="Unselect All Files" /> |
<br /> |
<br /> |
BUTTONS |
BUTTONS |
} |
} |