version 1.6, 2003/04/11 17:21:18
|
version 1.7, 2003/04/11 17:45:37
|
Line 62 of the helper itself, such as "Parameter
|
Line 62 of the helper itself, such as "Parameter
|
=head2 State tags |
=head2 State tags |
|
|
State tags are required to have an attribute "name", which is the symbolic |
State tags are required to have an attribute "name", which is the symbolic |
name of the state and will not be directly seen by the user. The wizard is |
name of the state and will not be directly seen by the user. The helper is |
required to have one state named "START", which is the state the wizard |
required to have one state named "START", which is the state the helper |
will start with. By convention, this state should clearly describe what |
will start with. By convention, this state should clearly describe what |
the helper will do for the user, and may also include the first information |
the helper will do for the user, and may also include the first information |
entry the user needs to do for the helper. |
entry the user needs to do for the helper. |
Line 95 use Apache::Constants qw(:common);
|
Line 95 use Apache::Constants qw(:common);
|
use Apache::File; |
use Apache::File; |
use Apache::lonxml; |
use Apache::lonxml; |
|
|
|
# Register all the tags with the helper, so the helper can |
|
# push and pop them |
|
|
|
my @helperTags; |
|
|
|
sub register { |
|
my ($namespace, @tags) = @_; |
|
|
|
for my $tag (@tags) { |
|
push @helperTags, [$namespace, $tag]; |
|
} |
|
} |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::lonhelper', |
Apache::lonxml::register('Apache::lonhelper', |
('helper', 'state')); |
('helper')); |
|
register('Apache::lonhelper', ('state')); |
} |
} |
|
|
# Since all wizards are only three levels deep (wizard tag, state tag, |
# Since all helpers are only three levels deep (helper tag, state tag, |
# substate type), it's easier and more readble to explicitly track |
# substate type), it's easier and more readble to explicitly track |
# those three things directly, rather then futz with the tag stack |
# those three things directly, rather then futz with the tag stack |
# every time. |
# every time. |
Line 145 sub handler {
|
Line 159 sub handler {
|
&Apache::lonxml::xmlparse($r, 'helper', $file); |
&Apache::lonxml::xmlparse($r, 'helper', $file); |
|
|
$r->print($helper->display()); |
$r->print($helper->display()); |
return OK; |
return OK; |
} |
} |
|
|
sub start_helper { |
sub start_helper { |
Line 154 sub start_helper {
|
Line 168 sub start_helper {
|
if ($target ne 'helper') { |
if ($target ne 'helper') { |
return ''; |
return ''; |
} |
} |
|
|
|
for my $tagList (@helperTags) { |
|
Apache::lonxml::register($tagList->[0], $tagList->[1]); |
|
} |
|
|
$helper = Apache::lonhelper::helper->new($token->[2]{'title'}); |
$helper = Apache::lonhelper::helper->new($token->[2]{'title'}); |
return ''; |
return ''; |
Line 165 sub end_helper {
|
Line 183 sub end_helper {
|
if ($target ne 'helper') { |
if ($target ne 'helper') { |
return ''; |
return ''; |
} |
} |
|
|
|
for my $tagList (@helperTags) { |
|
Apache::lonxml::deregister($tagList->[0], $tagList->[1]); |
|
} |
|
|
return ''; |
return ''; |
} |
} |
|
|
Line 546 the helper variables, like this:
|
Line 568 the helper variables, like this:
|
=cut |
=cut |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::lonhelper::element', |
&Apache::lonhelper::register('Apache::lonhelper::element', |
('nextstate')); |
('nextstate')); |
} |
} |
|
|
# Because we use the param hash, this is often a sufficent |
# Because we use the param hash, this is often a sufficent |
Line 637 transition directly to the state in the
|
Line 659 transition directly to the state in the
|
</message> |
</message> |
|
|
This will display the HTML message and transition to the <nextstate> if |
This will display the HTML message and transition to the <nextstate> if |
given. The HTML will be directly inserted into the wizard, so if you don't |
given. The HTML will be directly inserted into the helper, so if you don't |
want text to run together, you'll need to manually wrap the <message_text> |
want text to run together, you'll need to manually wrap the <message_text> |
in <p> tags, or whatever is appropriate for your HTML. |
in <p> tags, or whatever is appropriate for your HTML. |
|
|
Line 657 no strict;
|
Line 679 no strict;
|
use strict; |
use strict; |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::lonhelper::message', |
&Apache::lonhelper::register('Apache::lonhelper::message', |
('message', 'message_text')); |
('message', 'message_text')); |
} |
} |
|
|
Line 781 no strict;
|
Line 803 no strict;
|
use strict; |
use strict; |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::lonhelper::choices', |
&Apache::lonhelper::register('Apache::lonhelper::choices', |
('choice', 'choices')); |
('choice', 'choices')); |
} |
} |
|
|
Line 960 use strict;
|
Line 982 use strict;
|
use Time::localtime; |
use Time::localtime; |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::lonhelper::date', |
&Apache::lonhelper::register('Apache::lonhelper::date', |
('date')); |
('date')); |
} |
} |
|
|
Line 1182 no strict;
|
Line 1204 no strict;
|
use strict; |
use strict; |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::lonhelper::resource', |
&Apache::lonhelper::register('Apache::lonhelper::resource', |
('resource', 'filterfunc', |
('resource', 'filterfunc', |
'choicefunc', 'valuefunc')); |
'choicefunc', 'valuefunc')); |
} |
} |
Line 1363 use strict;
|
Line 1385 use strict;
|
|
|
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::lonhelper::student', |
&Apache::lonhelper::register('Apache::lonhelper::student', |
('student')); |
('student')); |
} |
} |
|
|
Line 1527 no strict;
|
Line 1549 no strict;
|
use strict; |
use strict; |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::lonhelper::files', |
&Apache::lonhelper::register('Apache::lonhelper::files', |
('files', 'filechoice', 'filefilter')); |
('files', 'filechoice', 'filefilter')); |
} |
} |
|
|
sub new { |
sub new { |