version 1.150, 2006/05/16 20:45:26
|
version 1.170, 2009/02/13 20:20:30
|
Line 81 State tags are also required to have an
|
Line 81 State tags are also required to have an
|
human name of the state, and will be displayed as the header on top of |
human name of the state, and will be displayed as the header on top of |
the screen for the user. |
the screen for the user. |
|
|
|
State tags may also optionally have an attribute "help" which should be |
|
the filename of a help file, this will add a blue ? to the title. |
|
|
=head2 Example Helper Skeleton |
=head2 Example Helper Skeleton |
|
|
An example of the tags so far: |
An example of the tags so far: |
|
|
<helper title="Example Helper"> |
<helper title="Example Helper"> |
<state name="START" title="Demonstrating the Example Helper"> |
<state name="START" title="Demonstrating the Example Helper"> |
<!-- notice this is the START state the wizard requires --> |
<!-- notice this is the START state the helper requires --> |
</state> |
</state> |
<state name="GET_NAME" title="Enter Student Name"> |
<state name="GET_NAME" title="Enter Student Name"> |
</state> |
</state> |
</helper> |
</helper> |
|
|
Of course this does nothing. In order for the wizard to do something, it is |
Of course this does nothing. In order for the helper to do something, it is |
necessary to put actual elements into the wizard. Documentation for each |
necessary to put actual elements into the helper. Documentation for each |
of these elements follows. |
of these elements follows. |
|
|
=head1 Creating a Helper With Code, Not XML |
=head1 Creating a Helper With Code, Not XML |
|
|
In some situations, such as the printing wizard (see lonprintout.pm), |
In some situations, such as the printing helper (see lonprintout.pm), |
writing the helper in XML would be too complicated, because of scope |
writing the helper in XML would be too complicated, because of scope |
issues or the fact that the code actually outweighs the XML. It is |
issues or the fact that the code actually outweighs the XML. It is |
possible to create a helper via code, though it is a little odd. |
possible to create a helper via code, though it is a little odd. |
Line 183 use Apache::File;
|
Line 186 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 332 sub start_state {
|
Line 337 sub start_state {
|
} |
} |
|
|
Apache::lonhelper::state->new($token->[2]{'name'}, |
Apache::lonhelper::state->new($token->[2]{'name'}, |
$token->[2]{'title'}); |
$token->[2]{'title'}, |
|
$token->[2]{'help'}); |
return ''; |
return ''; |
} |
} |
|
|
Line 362 use Apache::loncommon;
|
Line 368 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 474 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 484 sub declareVar {
|
Line 490 sub declareVar {
|
$self->{VARS}->{$var} = ''; |
$self->{VARS}->{$var} = ''; |
} |
} |
|
|
my $envname = 'form.' . $var . '.forminput'; |
my $envname = 'form.' . $var . '_forminput'; |
if (defined($env{$envname})) { |
if (defined($env{$envname})) { |
if (ref($env{$envname})) { |
if (ref($env{$envname})) { |
$self->{VARS}->{$var} = join('|||', @{$env{$envname}}); |
$self->{VARS}->{$var} = join('|||', @{$env{$envname}}); |
Line 523 sub process {
|
Line 529 sub process {
|
# Phase 1: Post processing for state of previous screen (which is actually |
# Phase 1: Post processing for state of previous screen (which is actually |
# the "current state" in terms of the helper variables), if it wasn't the |
# the "current state" in terms of the helper variables), if it wasn't the |
# beginning state. |
# beginning state. |
if ($self->{STATE} ne "START" || $env{"form.SUBMIT"} eq &mt("Next ->")) { |
if ($self->{STATE} ne "START" || $env{"form.SUBMIT"} eq &mt("Next")) { |
my $prevState = $self->{STATES}{$self->{STATE}}; |
my $prevState = $self->{STATES}{$self->{STATE}}; |
$prevState->postprocess(); |
$prevState->postprocess(); |
} |
} |
Line 575 sub display {
|
Line 581 sub display {
|
|
|
# Phase 4: Display. |
# Phase 4: Display. |
my $stateTitle=&mt($state->title()); |
my $stateTitle=&mt($state->title()); |
|
my $stateHelp= $state->help(); |
my $browser_searcher_js = |
my $browser_searcher_js = |
'<script type="text/javascript">'."\n". |
'<script type="text/javascript">'."\n". |
&Apache::loncommon::browser_and_searcher_javascript(). |
&Apache::loncommon::browser_and_searcher_javascript(). |
Line 583 sub display {
|
Line 590 sub display {
|
$result .= &Apache::loncommon::start_page($self->{TITLE}, |
$result .= &Apache::loncommon::start_page($self->{TITLE}, |
$browser_searcher_js); |
$browser_searcher_js); |
|
|
my $previous = HTML::Entities::encode(&mt("<- Previous"), '<>&"'); |
my $previous = HTML::Entities::encode(&mt("Back"), '<>&"'); |
my $next = HTML::Entities::encode(&mt("Next ->"), '<>&"'); |
my $next = HTML::Entities::encode(&mt("Next"), '<>&"'); |
# FIXME: This should be parameterized, not concatenated - Jeremy |
# FIXME: This should be parameterized, not concatenated - Jeremy |
|
|
|
|
if (!$state->overrideForm()) { $result.="<form name='helpform' method='POST'>"; } |
if (!$state->overrideForm()) { $result.="<form name='helpform' method='POST'>"; } |
|
if ($stateHelp) { |
|
$stateHelp = &Apache::loncommon::help_open_topic($stateHelp); |
|
} |
$result .= <<HEADER; |
$result .= <<HEADER; |
<table border="0" width='100%'><tr><td> |
<table border="0" width='100%'><tr><td> |
<h2><i>$stateTitle</i></h2> |
<h2><i>$stateTitle</i>$stateHelp</h2> |
HEADER |
HEADER |
|
|
$result .= "<table cellpadding='10' width='100%'><tr><td rowspan='2' valign='top'>"; |
$result .= "<table cellpadding='10' width='100%'><tr><td rowspan='2' valign='top'>"; |
Line 614 HEADER
|
Line 624 HEADER
|
$result .= "<a href=\"$returnPage\">" . &mt("End Helper") . "</a>"; |
$result .= "<a href=\"$returnPage\">" . &mt("End Helper") . "</a>"; |
} |
} |
else { |
else { |
$result .= '<nobr><input name="back" type="button" '; |
$result .= '<span class="LC_nobreak"><input name="back" type="button" '; |
$result .= 'value="' . $previous . '" onclick="history.go(-1)" /> '; |
$result .= 'value="' . $previous . '" onclick="history.go(-1)" /> '; |
$result .= '<input name="SUBMIT" type="submit" value="' . $next . '" /></nobr>'; |
$result .= '<input name="SUBMIT" type="submit" value="' . $next . '" /></span>'; |
} |
} |
} |
} |
|
|
Line 633 HEADER
|
Line 643 HEADER
|
$result .= "<a href=\"$returnPage\">" . &mt('End Helper') . "</a>"; |
$result .= "<a href=\"$returnPage\">" . &mt('End Helper') . "</a>"; |
} |
} |
else { |
else { |
$result .= '<nobr><input name="back" type="button" '; |
$result .= '<span class="LC_nobreak"><input name="back" type="button" '; |
$result .= 'value="' . $previous . '" onclick="history.go(-1)" /> '; |
$result .= 'value="' . $previous . '" onclick="history.go(-1)" /> '; |
$result .= '<input name="SUBMIT" type="submit" value="' . $next . '" /></nobr>'; |
$result .= '<input name="SUBMIT" type="submit" value="' . $next . '" /></span>'; |
} |
} |
} |
} |
|
|
Line 678 sub new {
|
Line 688 sub new {
|
|
|
$self->{NAME} = shift; |
$self->{NAME} = shift; |
$self->{TITLE} = shift; |
$self->{TITLE} = shift; |
|
$self->{HELP} = shift; |
$self->{ELEMENTS} = []; |
$self->{ELEMENTS} = []; |
|
|
bless($self, $class); |
bless($self, $class); |
Line 699 sub title {
|
Line 710 sub title {
|
return $self->{TITLE}; |
return $self->{TITLE}; |
} |
} |
|
|
|
sub help { |
|
my $self = shift; |
|
return $self->{HELP}; |
|
} |
|
|
sub preprocess { |
sub preprocess { |
my $self = shift; |
my $self = shift; |
for my $element (@{$self->{ELEMENTS}}) { |
for my $element (@{$self->{ELEMENTS}}) { |
Line 790 the element. How this value is interpret
|
Line 806 the element. How this value is interpret
|
the element itself, and possibly the settings the element has (such as |
the element itself, and possibly the settings the element has (such as |
multichoice vs. single choice for <choices> tags). |
multichoice vs. single choice for <choices> tags). |
|
|
This is also intended for things like the course initialization wizard, where the |
This is also intended for things like the course initialization helper, where the |
user is setting various parameters. By correctly grabbing current settings |
user is setting various parameters. By correctly grabbing current settings |
and including them into the helper, it allows the user to come back to the |
and including them into the helper, it allows the user to come back to the |
helper later and re-execute it, without needing to worry about overwriting |
helper later and re-execute it, without needing to worry about overwriting |
Line 992 sub start_message {
|
Line 1008 sub start_message {
|
if (defined($token->[2]{'nextstate'})) { |
if (defined($token->[2]{'nextstate'})) { |
$paramHash->{NEXTSTATE} = $token->[2]{'nextstate'}; |
$paramHash->{NEXTSTATE} = $token->[2]{'nextstate'}; |
} |
} |
|
if (defined($token->[2]{'type'})) { |
|
$paramHash->{TYPE} = $token->[2]{'type'}; |
|
} |
return ''; |
return ''; |
} |
} |
|
|
Line 1007 sub end_message {
|
Line 1026 sub end_message {
|
|
|
sub render { |
sub render { |
my $self = shift; |
my $self = shift; |
|
|
return &mtn($self->{MESSAGE_TEXT}); |
if ($self->{TYPE} =~ /^\s*warning\s*$/i) { |
|
$self->{MESSAGE_TEXT} = |
|
'<span class="LC_warning">'. $self->{MESSAGE_TEXT}.'</span>'; |
|
} |
|
if ($self->{TYPE} =~ /^\s*error\s*$/i) { |
|
$self->{MESSAGE_TEXT} = |
|
'<span class="LC_error">'. $self->{MESSAGE_TEXT}.'</span>'; |
|
} |
|
return $self->{MESSAGE_TEXT}; |
} |
} |
# If a NEXTSTATE was given, switch to it |
# If a NEXTSTATE was given, switch to it |
sub postprocess { |
sub postprocess { |
Line 1021 sub postprocess {
|
Line 1048 sub postprocess {
|
} |
} |
1; |
1; |
|
|
|
package Apache::lonhelper::helpicon; |
|
|
|
=pod |
|
|
|
=head1 Elements |
|
|
|
=head2 Element: helpiconX<helpicon, helper element> |
|
|
|
Helpicon elements add a help icon at the current location. |
|
Example: |
|
|
|
<helpicon file="Help"> |
|
General Help |
|
</helpicon> |
|
|
|
In this example will generate a help icon to the Help.hlp url with a |
|
description of 'General Help'. The description is not required and if |
|
left out (Example: <helpicon file="Help" /> only the icon will be |
|
added.) |
|
|
|
=head3 Localization |
|
|
|
The description text will be run through the normalize_string function |
|
and that will be used as a call to &mt. |
|
|
|
=cut |
|
|
|
no strict; |
|
@ISA = ("Apache::lonhelper::element"); |
|
use strict; |
|
use Apache::lonlocal; |
|
|
|
BEGIN { |
|
&Apache::lonhelper::register('Apache::lonhelper::helpicon', |
|
('helpicon')); |
|
} |
|
|
|
sub new { |
|
my $ref = Apache::lonhelper::element->new(); |
|
bless($ref); |
|
} |
|
|
|
# CONSTRUCTION: Construct the message element from the XML |
|
sub start_helpicon { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
|
|
if ($target ne 'helper') { |
|
return ''; |
|
} |
|
|
|
$paramHash->{HELP_TEXT} = &mtn(&Apache::lonxml::get_all_text('/helpicon', |
|
$parser)); |
|
|
|
$paramHash->{HELP_TEXT} =~s/^\s+//; |
|
$paramHash->{HELP_TEXT} =~s/\s+$//; |
|
|
|
if (defined($token->[2]{'file'})) { |
|
$paramHash->{HELP_FILE} = $token->[2]{'file'}; |
|
} |
|
return ''; |
|
} |
|
|
|
sub end_helpicon { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
|
|
if ($target ne 'helper') { |
|
return ''; |
|
} |
|
Apache::lonhelper::helpicon->new(); |
|
return ''; |
|
} |
|
|
|
sub render { |
|
my $self = shift; |
|
|
|
my $text; |
|
if ( $self->{HELP_TEXT} ne '') { |
|
$text=&mtn($self->{HELP_TEXT}); |
|
} |
|
|
|
return &Apache::loncommon::help_open_topic($self->{HELP_FILE}, |
|
$text); |
|
} |
|
sub postprocess { |
|
my $self = shift; |
|
if (defined($self->{NEXTSTATE})) { |
|
$helper->changeState($self->{NEXTSTATE}); |
|
} |
|
|
|
return 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 1203 sub render {
|
Line 1399 sub render {
|
function checkall(value, checkName) { |
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.name == checkName + '.forminput') { |
if (ele.name == checkName + '_forminput') { |
document.forms.helpform.elements[i].checked=value; |
document.forms.helpform.elements[i].checked=value; |
} |
} |
} |
} |
Line 1276 BUTTONS
|
Line 1472 BUTTONS
|
foreach my $choice (@{$self->{CHOICES}}) { |
foreach my $choice (@{$self->{CHOICES}}) { |
my $id = &new_id(); |
my $id = &new_id(); |
$result .= "<tr>\n<td width='20'> </td>\n"; |
$result .= "<tr>\n<td width='20'> </td>\n"; |
$result .= "<td valign='top'><input type='$type' name='$var.forminput'" |
$result .= "<td valign='top'><input type='$type' name='${var}_forminput'" |
. " value='" . |
. " value='" . |
HTML::Entities::encode($choice->[1],"<>&\"'") |
HTML::Entities::encode($choice->[1],"<>&\"'") |
. "'"; |
. "'"; |
Line 1292 BUTTONS
|
Line 1488 BUTTONS
|
$choiceLabel = &$choiceLabel($helper, $self); |
$choiceLabel = &$choiceLabel($helper, $self); |
} |
} |
$result .= "/></td><td> ".qq{<label for="id$id">}. |
$result .= "/></td><td> ".qq{<label for="id$id">}. |
$choiceLabel. "</label></td>"; |
$choiceLabel. "</label></td>"; |
if ($choice->[4]) { |
if ($choice->[4]) { |
$result .='<td><input type="text" size="5" name="' |
$result .='<td><input type="text" size="5" name="' |
.$choice->[4].'.forminput" value="' |
.$choice->[4].'_forminput" value="' |
.$choice->[5].'" /></td>'; |
.$choice->[5].'" /></td>'; |
} |
} |
$result .= "</tr>\n"; |
$result .= "</tr>\n"; |
Line 1310 BUTTONS
|
Line 1506 BUTTONS
|
# given, switch to it |
# given, switch to it |
sub postprocess { |
sub postprocess { |
my $self = shift; |
my $self = shift; |
my $chosenValue = $env{'form.' . $self->{'variable'} . '.forminput'}; |
my $chosenValue = $env{'form.' . $self->{'variable'} . '_forminput'}; |
|
|
if (!defined($chosenValue) && !$self->{'allowempty'}) { |
if (!defined($chosenValue) && !$self->{'allowempty'}) { |
$self->{ERROR_MSG} = |
$self->{ERROR_MSG} = |
Line 1334 sub postprocess {
|
Line 1530 sub postprocess {
|
} |
} |
if ($choice->[4]) { |
if ($choice->[4]) { |
my $varname = $choice->[4]; |
my $varname = $choice->[4]; |
$helper->{'VARS'}->{$varname} = $env{'form.'."$varname.forminput"}; |
$helper->{'VARS'}->{$varname} = $env{'form.'."${varname}_forminput"}; |
} |
} |
} |
} |
return 1; |
return 1; |
Line 1443 sub render {
|
Line 1639 sub render {
|
$checkedChoices{$self->{CHOICES}->[0]->[1]} = 1; |
$checkedChoices{$self->{CHOICES}->[0]->[1]} = 1; |
} |
} |
|
|
$result .= "<select name='${var}.forminput'>\n"; |
$result .= "<select name='${var}_forminput'>\n"; |
foreach my $choice (@{$self->{CHOICES}}) { |
foreach my $choice (@{$self->{CHOICES}}) { |
$result .= "<option value='" . |
$result .= "<option value='" . |
HTML::Entities::encode($choice->[1],"<>&\"'") |
HTML::Entities::encode($choice->[1],"<>&\"'") |
Line 1469 sub render {
|
Line 1665 sub render {
|
# given, switch to it |
# given, switch to it |
sub postprocess { |
sub postprocess { |
my $self = shift; |
my $self = shift; |
my $chosenValue = $env{'form.' . $self->{'variable'} . '.forminput'}; |
my $chosenValue = $env{'form.' . $self->{'variable'} . '_forminput'}; |
|
|
if (!defined($chosenValue) && !$self->{'allowempty'}) { |
if (!defined($chosenValue) && !$self->{'allowempty'}) { |
$self->{ERROR_MSG} = "You must choose one or more choices to" . |
$self->{ERROR_MSG} = "You must choose one or more choices to" . |
Line 1529 no strict;
|
Line 1725 no strict;
|
use strict; |
use strict; |
use Apache::lonlocal; # A localization nightmare |
use Apache::lonlocal; # A localization nightmare |
use Apache::lonnet; |
use Apache::lonnet; |
use Time::localtime; |
use DateTime; |
|
|
BEGIN { |
BEGIN { |
&Apache::lonhelper::register('Apache::lonhelper::date', |
&Apache::lonhelper::register('Apache::lonhelper::date', |
Line 1579 sub render {
|
Line 1775 sub render {
|
my $time=time; |
my $time=time; |
my ($anytime,$onclick); |
my ($anytime,$onclick); |
|
|
|
|
# first check VARS for a valid new value from the user |
# first check VARS for a valid new value from the user |
# then check DEFAULT_VALUE for a valid default time value |
# then check DEFAULT_VALUE for a valid default time value |
# otherwise pick now as reasonably good time |
# otherwise pick now as reasonably good time |
|
|
if (defined($helper->{VARS}{$var}) |
if (defined($helper->{VARS}{$var}) |
&& $helper->{VARS}{$var} > 0) { |
&& $helper->{VARS}{$var} > 0) { |
$date = localtime($helper->{VARS}{$var}); |
$date = &get_date_object($helper->{VARS}{$var}); |
} elsif (defined($self->{DEFAULT_VALUE})) { |
} elsif (defined($self->{DEFAULT_VALUE})) { |
my $valueFunc = eval($self->{DEFAULT_VALUE}); |
my $valueFunc = eval($self->{DEFAULT_VALUE}); |
die('Error in default value code for variable ' . |
die('Error in default value code for variable ' . |
Line 1594 sub render {
|
Line 1789 sub render {
|
$time = &$valueFunc($helper, $self); |
$time = &$valueFunc($helper, $self); |
if (lc($time) eq 'anytime') { |
if (lc($time) eq 'anytime') { |
$anytime=1; |
$anytime=1; |
$date = localtime(time); |
$date = &get_date_object(time); |
$date->min(0); |
$date->min(0); |
} elsif (defined($time) && $time ne 0) { |
} elsif (defined($time) && $time ne 0) { |
$date = localtime($time); |
$date = &get_date_object($time); |
} else { |
} else { |
# leave date undefined so it'll default to now |
# leave date undefined so it'll default to now |
} |
} |
} |
} |
|
|
if (!defined($date)) { |
if (!defined($date)) { |
$date = localtime(time); |
$date = &get_date_object(time); |
$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 1623 sub render {
|
Line 1816 sub render {
|
my $i; |
my $i; |
$result .= "<select $onclick name='${var}month'>\n"; |
$result .= "<select $onclick name='${var}month'>\n"; |
for ($i = 0; $i < 12; $i++) { |
for ($i = 0; $i < 12; $i++) { |
if ($i == $date->mon) { |
if (($i + 1) == $date->mon) { |
$result .= "<option value='$i' selected='selected'>"; |
$result .= "<option value='$i' selected='selected'>"; |
} else { |
} else { |
$result .= "<option value='$i'>"; |
$result .= "<option value='$i'>"; |
} |
} |
$result .= &mt($months[$i]) . "</option>\n"; |
$result .= &mt($months[$i])."</option>\n"; |
} |
} |
$result .= "</select>\n"; |
$result .= "</select>\n"; |
|
|
Line 1647 sub render {
|
Line 1840 sub render {
|
# Year |
# Year |
$result .= "<select $onclick name='${var}year'>\n"; |
$result .= "<select $onclick name='${var}year'>\n"; |
for ($i = 2000; $i < 2030; $i++) { # update this after 64-bit dates |
for ($i = 2000; $i < 2030; $i++) { # update this after 64-bit dates |
if ($date->year + 1900 == $i) { |
if ($date->year == $i) { |
$result .= "<option selected='selected'>"; |
$result .= "<option selected='selected'>"; |
} else { |
} else { |
$result .= "<option>"; |
$result .= "<option>"; |
Line 1702 sub render {
|
Line 1895 sub render {
|
} |
} |
$result .= "</select>\n"; |
$result .= "</select>\n"; |
} |
} |
|
$result .= ' '.$date->time_zone_short_name().' '; |
if ($self->{'anytime'}) { |
if ($self->{'anytime'}) { |
$result.=(<<CHECK); |
$result.=(<<CHECK); |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 1729 sub postprocess {
|
Line 1923 sub postprocess {
|
if ($env{'form.' . $var . 'anytime'}) { |
if ($env{'form.' . $var . 'anytime'}) { |
$helper->{VARS}->{$var} = undef; |
$helper->{VARS}->{$var} = undef; |
} else { |
} else { |
my $month = $env{'form.' . $var . 'month'}; |
my $month = $env{'form.' . $var . 'month'}; |
|
$month ++; |
my $day = $env{'form.' . $var . 'day'}; |
my $day = $env{'form.' . $var . 'day'}; |
my $year = $env{'form.' . $var . 'year'}; |
my $year = $env{'form.' . $var . 'year'}; |
my $min = 0; |
my $min = 0; |
Line 1739 sub postprocess {
|
Line 1934 sub postprocess {
|
$hour = $env{'form.' . $var . 'hour'}; |
$hour = $env{'form.' . $var . 'hour'}; |
} |
} |
|
|
my $chosenDate; |
my ($chosenDate,$checkDate); |
eval {$chosenDate = Time::Local::timelocal(0, $min, $hour, $day, $month, $year);}; |
my $timezone = &Apache::lonlocal::gettimezone(); |
|
my $dt; |
|
eval { |
|
$dt = DateTime->new( year => $year, |
|
month => $month, |
|
day => $day, |
|
hour => $hour, |
|
minute => $min, |
|
second => 0, |
|
time_zone => $timezone, |
|
); |
|
}; |
|
|
my $error = $@; |
my $error = $@; |
|
if (!$error) { |
|
$chosenDate = $dt->epoch; |
|
$checkDate = &get_date_object($chosenDate); |
|
} |
|
|
# Check to make sure that the date was not automatically co-erced into a |
# Check to make sure that the date was not automatically co-erced into a |
# valid date, as we want to flag that as an error |
# valid date, as we want to flag that as an error |
# This happens for "Feb. 31", for instance, which is coerced to March 2 or |
# This happens for "Feb. 31", for instance, which is coerced to March 2 or |
# 3, depending on if it's a leap year |
# 3, depending on if it's a leap year |
my $checkDate = localtime($chosenDate); |
|
|
|
if ($error || $checkDate->mon != $month || $checkDate->mday != $day || |
if ($error || $checkDate->mon != $month || $checkDate->mday != $day || |
$checkDate->year + 1900 != $year) { |
$checkDate->year != $year) { |
unless (Apache::lonlocal::current_language()== ~/^en/) { |
unless (Apache::lonlocal::current_language()== ~/^en/) { |
$self->{ERROR_MSG} = &mt("Invalid date entry"); |
$self->{ERROR_MSG} = &mt("Invalid date entry"); |
return 0; |
return 0; |
} |
} |
# LOCALIZATION FIXME: Needs to be parameterized |
# LOCALIZATION FIXME: Needs to be parameterized |
$self->{ERROR_MSG} = "Can't use " . $months[$month] . " $day, $year as a " |
$self->{ERROR_MSG} = "Can't use ".$months[$env{'form.'.$var.'month'}]. " $day, $year as a ". |
. "date because it doesn't exist. Please enter a valid date."; |
"date because it doesn't exist. Please enter a valid date."; |
|
|
return 0; |
return 0; |
} |
} |
Line 1780 sub postprocess {
|
Line 1990 sub postprocess {
|
|
|
return 1; |
return 1; |
} |
} |
|
|
|
sub get_date_object { |
|
my ($epoch) = @_; |
|
my $dt = DateTime->from_epoch(epoch => $epoch) |
|
->set_time_zone(&Apache::lonlocal::gettimezone()); |
|
my $lang = Apache::lonlocal::current_language(); |
|
if ($lang ne '') { |
|
eval { |
|
$dt->set_locale($lang); |
|
}; |
|
} |
|
return $dt; |
|
} |
|
|
1; |
1; |
|
|
package Apache::lonhelper::resource; |
package Apache::lonhelper::resource; |
Line 1806 folders that have all of their contained
|
Line 2030 folders that have all of their contained
|
be filtered out. The 'addstatus' attribute, if true, will add the icon |
be filtered out. The 'addstatus' attribute, if true, will add the icon |
and long status display columns to the display. The 'addparts' |
and long status display columns to the display. The 'addparts' |
attribute will add in a part selector beside problems that have more |
attribute will add in a part selector beside problems that have more |
than 1 part. |
than 1 part. The 'includecourse' attribute if true, will include |
|
the toplevel default.sequence in the results. |
|
|
=head3 SUB-TAGS |
=head3 SUB-TAGS |
|
|
Line 1879 sub start_resource {
|
Line 2104 sub start_resource {
|
$helper->declareVar($paramHash->{'variable'}.'_part'); |
$helper->declareVar($paramHash->{'variable'}.'_part'); |
} |
} |
$paramHash->{'closeallpages'} = $token->[2]{'closeallpages'}; |
$paramHash->{'closeallpages'} = $token->[2]{'closeallpages'}; |
|
$paramHash->{'include_top_level_map'} = $token->[2]{'includecourse'}; |
return ''; |
return ''; |
} |
} |
|
|
Line 2024 sub render {
|
Line 2250 sub render {
|
function checkall(value, checkName) { |
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.name == checkName + '.forminput') { |
if (ele.name == checkName + '_forminput') { |
document.forms.helpform.elements[i].checked=value; |
document.forms.helpform.elements[i].checked=value; |
} |
} |
} |
} |
Line 2123 BUTTONS
|
Line 2349 BUTTONS
|
} |
} |
$col .= |
$col .= |
"<td align='center'><input type='checkbox' name ='$option_var". |
"<td align='center'><input type='checkbox' name ='$option_var". |
".forminput' value='". |
"_forminput' value='". |
$resource_name . "' $checked /> </td>"; |
$resource_name . "' $checked /> </td>"; |
} |
} |
} |
} |
|
|
$col .= "<td align='center'><input type='$inputType' name='${var}.forminput' "; |
$col .= "<td align='center'><input type='$inputType' name='${var}_forminput' "; |
if (%defaultSymbs) { |
if (%defaultSymbs) { |
my $symb=$resource->symb(); |
my $symb=$resource->symb(); |
if (exists($defaultSymbs{$symb})) { |
if (exists($defaultSymbs{$symb})) { |
Line 2157 BUTTONS
|
Line 2383 BUTTONS
|
my $resource_name = |
my $resource_name = |
&HTML::Entities::encode(&$valueFunc($resource),"<>&\"'"); |
&HTML::Entities::encode(&$valueFunc($resource),"<>&\"'"); |
if ($addparts && (scalar(@{$resource->parts}) > 1)) { |
if ($addparts && (scalar(@{$resource->parts}) > 1)) { |
$col .= "<select onclick=\"javascript:updateRadio(this.form,'${var}.forminput','$resource_name');updateHidden(this.form,'$id','${var}');\" name='part_$id.forminput'>\n"; |
$col .= "<select onclick=\"javascript:updateRadio(this.form,'${var}_forminput','$resource_name');updateHidden(this.form,'$id','${var}');\" name='part_${id}_forminput'>\n"; |
$col .= "<option value=\"$part\">All Parts</option>\n"; |
$col .= "<option value=\"$part\">All Parts</option>\n"; |
foreach my $part (@{$resource->parts}) { |
foreach my $part (@{$resource->parts}) { |
$col .= "<option value=\"$part\">Part: $part</option>\n"; |
$col .= "<option value=\"$part\">Part: $part</option>\n"; |
Line 2179 BUTTONS
|
Line 2405 BUTTONS
|
} |
} |
} |
} |
function updateHidden(form,id,name) { |
function updateHidden(form,id,name) { |
var select=form['part_'+id+'.forminput']; |
var select=form['part_'+id+'_forminput']; |
var hidden=form[name+'_part.forminput']; |
var hidden=form[name+'_part_forminput']; |
var which=select.selectedIndex; |
var which=select.selectedIndex; |
hidden.value=select.options[which].value; |
hidden.value=select.options[which].value; |
} |
} |
// --> |
// --> |
</script> |
</script> |
<input type="hidden" name="${var}_part.forminput" /> |
<input type="hidden" name="${var}_part_forminput" /> |
|
|
RADIO |
RADIO |
$env{'form.condition'} = !$self->{'toponly'}; |
$env{'form.condition'} = !$self->{'toponly'}; |
Line 2204 RADIO
|
Line 2430 RADIO
|
'resource_no_folder_link' => 1, |
'resource_no_folder_link' => 1, |
'closeAllPages' => $self->{'closeallpages'}, |
'closeAllPages' => $self->{'closeallpages'}, |
'suppressEmptySequences' => $self->{'suppressEmptySequences'}, |
'suppressEmptySequences' => $self->{'suppressEmptySequences'}, |
|
'include_top_level_map' => $self->{'include_top_level_map'}, |
'iterator_map' => $mapUrl } |
'iterator_map' => $mapUrl } |
); |
); |
|
|
Line 2341 sub render {
|
Line 2568 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 2582 sub render {
|
|
|
# Current personel |
# Current personel |
|
|
|
$result .= '<h4>'.&mt('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 2365 sub render {
|
Line 2594 sub render {
|
|
|
# If activeonly is not set then we can also give the expired students: |
# If activeonly is not set then we can also give the expired students: |
# |
# |
if (!$self->{'activeonly'} && ((scalar @$expired_members) > 0)) { |
if (!$self->{'activeonly'} && ((scalar(@$future_members)) > 0)) { |
|
|
# And future. |
# And future. |
|
|
|
$result .= '<h4>'.&mt('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 2376 sub render {
|
Line 2607 sub render {
|
$self->{'multichoice'}, |
$self->{'multichoice'}, |
$self->{'variable'}, |
$self->{'variable'}, |
0); |
0); |
|
} |
|
if (!$self->{'activeonly'} && ((scalar(@$expired_members)) > 0)) { |
# Past |
# Past |
|
|
|
$result .= '<h4>'.&mt('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 2395 sub render {
|
Line 2629 sub render {
|
sub postprocess { |
sub postprocess { |
my $self = shift; |
my $self = shift; |
|
|
my $result = $env{'form.' . $self->{'variable'} . '.forminput'}; |
my $result = $env{'form.' . $self->{'variable'} . '_forminput'}; |
if (!$result && !$self->{'emptyallowed'}) { |
if (!$result && !$self->{'emptyallowed'}) { |
if ($self->{'coursepersonnel'}) { |
if ($self->{'coursepersonnel'}) { |
$self->{ERROR_MSG} = |
$self->{ERROR_MSG} = |
Line 2580 sub render {
|
Line 2814 sub render {
|
function checkall(value, checkName) { |
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.name == checkName + '.forminput') { |
if (ele.name == checkName + '_forminput') { |
document.forms.helpform.elements[i].checked=value; |
document.forms.helpform.elements[i].checked=value; |
} |
} |
} |
} |
Line 2628 BUTTONS
|
Line 2862 BUTTONS
|
&Apache::loncacc::constructaccess($subdir, |
&Apache::loncacc::constructaccess($subdir, |
$Apache::lonnet::perlvar{'lonDefDomain'}); |
$Apache::lonnet::perlvar{'lonDefDomain'}); |
$metadir='/res/'.$domain.'/'.$user.'/'.$2; |
$metadir='/res/'.$domain.'/'.$user.'/'.$2; |
@fileList = &Apache::lonnet::dirlist($subdir, $domain, $user, ''); |
@fileList = &Apache::lonnet::dirlist($subdir,$domain,$user,undef,undef,'/'); |
} elsif ($subdir =~ m|^~([^/]+)/(.*)$|) { |
} elsif ($subdir =~ m|^~([^/]+)/(.*)$|) { |
$subdir='/home/'.$1.'/public_html/'.$2; |
$subdir='/home/'.$1.'/public_html/'.$2; |
my ($user,$domain)= |
my ($user,$domain)= |
&Apache::loncacc::constructaccess($subdir, |
&Apache::loncacc::constructaccess($subdir, |
$Apache::lonnet::perlvar{'lonDefDomain'}); |
$Apache::lonnet::perlvar{'lonDefDomain'}); |
$metadir='/res/'.$domain.'/'.$user.'/'.$2; |
$metadir='/res/'.$domain.'/'.$user.'/'.$2; |
@fileList = &Apache::lonnet::dirlist($subdir, $domain, $user, ''); |
@fileList = &Apache::lonnet::dirlist($subdir,$domain,$user,undef,undef,'/'); |
} else { |
} else { |
# local library server resource space |
# local library server resource space |
@fileList = &Apache::lonnet::dirlist($subdir, $env{'user.domain'}, $env{'user.name'}, ''); |
@fileList = &Apache::lonnet::dirlist($subdir,$env{'user.domain'},$env{'user.name'},undef,undef,'/'); |
} |
} |
|
|
# Sort the fileList into order |
# Sort the fileList into order |
Line 2697 BUTTONS
|
Line 2931 BUTTONS
|
my $id = &new_id(); |
my $id = &new_id(); |
$result .= '<tr><td align="right"' . " bgcolor='$color'>" . |
$result .= '<tr><td align="right"' . " bgcolor='$color'>" . |
"<input $onclick type='$type' name='" . $var |
"<input $onclick type='$type' name='" . $var |
. ".forminput' ".qq{id="$id"}." value='" . HTML::Entities::encode($fileName,"<>&\"'"). |
. "_forminput' ".qq{id="$id"}." value='" . HTML::Entities::encode($fileName,"<>&\"'"). |
"'"; |
"'"; |
if (!$self->{'multichoice'} && $choices == 0) { |
if (!$self->{'multichoice'} && $choices == 0) { |
$result .= ' checked="checked"'; |
$result .= ' checked="checked"'; |
Line 2758 sub fileState {
|
Line 2992 sub fileState {
|
|
|
sub postprocess { |
sub postprocess { |
my $self = shift; |
my $self = shift; |
my $result = $env{'form.' . $self->{'variable'} . '.forminput'}; |
my $result = $env{'form.' . $self->{'variable'} . '_forminput'}; |
if (!$result) { |
if (!$result) { |
$self->{ERROR_MSG} = 'You must choose at least one file '. |
$self->{ERROR_MSG} = 'You must choose at least one file '. |
'to continue.'; |
'to continue.'; |
Line 2848 sub start_section {
|
Line 3082 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 3146 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 2994 sub render {
|
Line 3228 sub render {
|
$result .= '<p><font color="#FF0000">' . $self->{ERROR_MSG} . '</font></p>'; |
$result .= '<p><font color="#FF0000">' . $self->{ERROR_MSG} . '</font></p>'; |
} |
} |
|
|
$result .= '<input type="string" name="' . $self->{'variable'} . '.forminput"'; |
$result .= '<input type="string" name="' . $self->{'variable'} . '_forminput"'; |
|
|
if (defined($self->{'size'})) { |
if (defined($self->{'size'})) { |
$result .= ' size="' . $self->{'size'} . '"'; |
$result .= ' size="' . $self->{'size'} . '"'; |
Line 3127 sub start_clause {
|
Line 3361 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); |
} |
} |
} |
} |
|
|
Line 3307 sub render {
|
Line 3542 sub render {
|
} |
} |
my $finish=&mt('Finish Course Initialization'); |
my $finish=&mt('Finish Course Initialization'); |
} |
} |
my $previous = HTML::Entities::encode(&mt("<- Previous"), '<>&"'); |
my $previous = HTML::Entities::encode(&mt("Back"), '<>&"'); |
my $next = HTML::Entities::encode(&mt("Next ->"), '<>&"'); |
my $next = HTML::Entities::encode(&mt("Next"), '<>&"'); |
my $target = " target='loncapaclient'"; |
my $target = " target='loncapaclient'"; |
if (($env{'browser.interface'} eq 'textual') || |
if (($env{'browser.interface'} eq 'textual') || |
($env{'environment.remote'} eq 'off')) { $target=''; } |
($env{'environment.remote'} eq 'off')) { $target=''; } |
Line 3332 sub overrideForm {
|
Line 3567 sub overrideForm {
|
|
|
package Apache::lonhelper::parmwizfinal; |
package Apache::lonhelper::parmwizfinal; |
|
|
# This is the final state for the parmwizard. It is not generally useful, |
# This is the final state for the parm helper. It is not generally useful, |
# so it is not perldoc'ed. It does its own processing. |
# so it is not perldoc'ed. It does its own processing. |
# It is represented with <parmwizfinal />, and |
# It is represented with <parmwizfinal />, and |
# should later be moved to lonparmset.pm . |
# should later be moved to lonparmset.pm . |
Line 3398 sub render {
|
Line 3633 sub render {
|
|
|
# Print the granularity, depending on the action |
# Print the granularity, depending on the action |
if ($vars->{GRANULARITY} eq 'whole_course') { |
if ($vars->{GRANULARITY} eq 'whole_course') { |
$resourceString .= '<li>'.&mt('for <b>all resources in the course</b>').'</li>'; |
$resourceString .= '<li>'.&mt('for [_1]all resources in the course[_2]','<b>','</b>').'</li>'; |
if ($vars->{TARGETS} eq 'course') { |
if ($vars->{TARGETS} eq 'course') { |
$level = 14; # general course, see lonparmset.pm perldoc |
$level = 14; # general course, see lonparmset.pm perldoc |
} elsif ($vars->{TARGETS} eq 'section') { |
} elsif ($vars->{TARGETS} eq 'section') { |
Line 3413 sub render {
|
Line 3648 sub render {
|
$paramlevel = 'general'; |
$paramlevel = 'general'; |
} elsif ($vars->{GRANULARITY} eq 'map') { |
} elsif ($vars->{GRANULARITY} eq 'map') { |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $res = $navmap->getByMapPc($vars->{RESOURCE_ID}); |
if (defined($navmap)) { |
my $title = $res->compTitle(); |
my $res = $navmap->getByMapPc($vars->{RESOURCE_ID}); |
$symb = $res->symb(); |
my $title = $res->compTitle(); |
$resourceString .= '<li>'.&mt('for the map named [_1]',"<b>$title</b>").'</li>'; |
$symb = $res->symb(); |
|
$resourceString .= '<li>'.&mt('for the map named [_1]',"<b>$title</b>").'</li>'; |
|
} else { |
|
$resourceString .= '<li>'.&mt('for the map ID [_1] (name unavailable)','<b>'.$vars->{RESOURCE_ID}.'</b>').'</li>'; |
|
&Apache::lonnet::logthis('Retrieval of map title failed in lonhelper.pm - could not create navmap object for course.'); |
|
|
|
} |
if ($vars->{TARGETS} eq 'course') { |
if ($vars->{TARGETS} eq 'course') { |
$level = 13; # general course, see lonparmset.pm perldoc |
$level = 13; # general course, see lonparmset.pm perldoc |
} elsif ($vars->{TARGETS} eq 'section') { |
} elsif ($vars->{TARGETS} eq 'section') { |
Line 3429 sub render {
|
Line 3670 sub render {
|
$affectedResourceId = $vars->{RESOURCE_ID}; |
$affectedResourceId = $vars->{RESOURCE_ID}; |
$paramlevel = 'map'; |
$paramlevel = 'map'; |
} else { |
} else { |
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
my $res = $navmap->getById($vars->{RESOURCE_ID}); |
|
my $part = $vars->{RESOURCE_ID_part}; |
my $part = $vars->{RESOURCE_ID_part}; |
if ($part ne 'All Parts' && $part) { $parm_name=~s/^0/$part/; } else { $part=&mt('All Parts'); } |
if ($part ne 'All Parts' && $part) { $parm_name=~s/^0/$part/; } else { $part=&mt('All Parts'); } |
$symb = $res->symb(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $title = $res->compTitle(); |
if (defined($navmap)) { |
$resourceString .= '<li>'.&mt('for the resource named [_1] part [_2]',"<b>$title</b>","<b>$part</b>").'</li>'; |
my $res = $navmap->getById($vars->{RESOURCE_ID}); |
|
$symb = $res->symb(); |
|
my $title = $res->compTitle(); |
|
$resourceString .= '<li>'.&mt('for the resource named [_1] part [_2]',"<b>$title</b>","<b>$part</b>").'</li>'; |
|
} else { |
|
$resourceString .= '<li>'.&mt('for the resource ID [_1] (name unavailable) part [_2]','<b>'.$vars->{RESOURCE_ID}.'</b>',"<b>$part</b>").'</li>'; |
|
&Apache::lonnet::logthis('Retrieval of resource title failed in lonhelper.pm - could not create navmap object for course.'); |
|
} |
if ($vars->{TARGETS} eq 'course') { |
if ($vars->{TARGETS} eq 'course') { |
$level = 10; # general course, see lonparmset.pm perldoc |
$level = 10; # general course, see lonparmset.pm perldoc |
} elsif ($vars->{TARGETS} eq 'section') { |
} elsif ($vars->{TARGETS} eq 'section') { |
Line 3514 sub render {
|
Line 3760 sub render {
|
|
|
# Print targets |
# Print targets |
if ($vars->{TARGETS} eq 'course') { |
if ($vars->{TARGETS} eq 'course') { |
$result .= '<li>'.&mt('for <b>all students in course</b>').'</li>'; |
$result .= '<li>'.&mt('for [_1]all students in course[_2]','<b>','</b>').'</li>'; |
} elsif ($vars->{TARGETS} eq 'section') { |
} elsif ($vars->{TARGETS} eq 'section') { |
my $section = $vars->{SECTION_NAME}; |
my $section = $vars->{SECTION_NAME}; |
$result .= '<li>'.&mt('for section [_1]',"<b>$section</b>").'</li>'; |
$result .= '<li>'.&mt('for section [_1]',"<b>$section</b>").'</li>'; |
Line 3539 sub render {
|
Line 3785 sub render {
|
|
|
# Print value |
# Print value |
if ($vars->{ACTION_TYPE} ne 'tries' && $vars->{ACTION_TYPE} ne 'weight') { |
if ($vars->{ACTION_TYPE} ne 'tries' && $vars->{ACTION_TYPE} ne 'weight') { |
$result .= '<li>'.&mt('to [_1] ([_2])',"<b>".ctime($vars->{PARM_DATE})."</b>",Apache::lonnavmaps::timeToHumanString($vars->{PARM_DATE}))."</li>\n"; |
my $showdate = &Apache::lonlocal::locallocaltime($vars->{PARM_DATE}); |
|
$result .= '<li>'.&mt('to [_1] ([_2])',"<b>".$showdate."</b>",Apache::lonnavmaps::timeToHumanString($vars->{PARM_DATE}))."</li>\n"; |
} |
} |
|
|
# print pres_marker |
# print pres_marker |