version 1.46, 2003/09/16 20:00:57
|
version 1.54, 2003/10/09 14:37:48
|
Line 926 package Apache::lonhelper::message;
|
Line 926 package Apache::lonhelper::message;
|
|
|
=pod |
=pod |
|
|
=head1 Element: messageX<message, helper element> |
=head1 Elements |
|
|
|
=head2 Element: messageX<message, helper element> |
|
|
Message elements display their contents, and |
Message elements display their contents, and |
transition directly to the state in the <nextstate> attribute. Example: |
transition directly to the state in the <nextstate> attribute. Example: |
Line 1696 and long status display columns to the d
|
Line 1698 and long status display columns to the d
|
default, the value will be the resource ID of the object ($res->{ID}). |
default, the value will be the resource ID of the object ($res->{ID}). |
|
|
=item * <mapurl>X<mapurl>: If the URL of a map is given here, only that map |
=item * <mapurl>X<mapurl>: If the URL of a map is given here, only that map |
will be displayed, instead of the whole course. |
will be displayed, instead of the whole course. If the attribute |
|
"evaluate" is given and is true, the contents of the mapurl will be |
|
evaluated with "sub { my $helper = shift; my $state = shift;" and |
|
"}", with the return value used as the mapurl. |
|
|
=back |
=back |
|
|
Line 1808 sub start_mapurl {
|
Line 1813 sub start_mapurl {
|
|
|
my $contents = Apache::lonxml::get_all_text('/mapurl', |
my $contents = Apache::lonxml::get_all_text('/mapurl', |
$parser); |
$parser); |
|
$paramHash->{EVAL_MAP_URL} = $token->[2]{'evaluate'}; |
$paramHash->{MAP_URL} = $contents; |
$paramHash->{MAP_URL} = $contents; |
} |
} |
|
|
Line 1863 BUTTONS
|
Line 1869 BUTTONS
|
my $filterFunc = $self->{FILTER_FUNC}; |
my $filterFunc = $self->{FILTER_FUNC}; |
my $choiceFunc = $self->{CHOICE_FUNC}; |
my $choiceFunc = $self->{CHOICE_FUNC}; |
my $valueFunc = $self->{VALUE_FUNC}; |
my $valueFunc = $self->{VALUE_FUNC}; |
my $mapUrl = $self->{MAP_URL}; |
|
my $multichoice = $self->{'multichoice'}; |
my $multichoice = $self->{'multichoice'}; |
|
|
|
# Evaluate the map url as needed |
|
my $mapUrl; |
|
if ($self->{EVAL_MAP_URL}) { |
|
my $mapUrlFunc = eval('sub { my $helper = shift; my $state = shift; ' . |
|
$self->{MAP_URL} . '}'); |
|
$mapUrl = &$mapUrlFunc($helper, $self); |
|
} else { |
|
$mapUrl = $self->{MAP_URL}; |
|
} |
|
|
# Create the composite function that renders the column on the nav map |
# Create the composite function that renders the column on the nav map |
# have to admit any language that lets me do this can't be all bad |
# have to admit any language that lets me do this can't be all bad |
# - Jeremy (Pythonista) ;-) |
# - Jeremy (Pythonista) ;-) |
Line 1942 package Apache::lonhelper::student;
|
Line 1957 package Apache::lonhelper::student;
|
Student elements display a choice of students enrolled in the current |
Student elements display a choice of students enrolled in the current |
course. Currently it is primitive; this is expected to evolve later. |
course. Currently it is primitive; this is expected to evolve later. |
|
|
Student elements take three attributes: "variable", which means what |
Student elements take the following attributes: |
it usually does, "multichoice", which if true allows the user |
|
to select multiple students, and "coursepersonnel" which if true |
=over 4 |
adds the course personnel to the top of the student selection. |
|
|
=item * B<variable>: |
|
|
|
Does what it usually does: declare which helper variable to put the |
|
result in. |
|
|
|
=item * B<multichoice>: |
|
|
|
If true allows the user to select multiple students. Defaults to false. |
|
|
|
=item * B<coursepersonnel>: |
|
|
|
If true adds the course personnel to the top of the student |
|
selection. Defaults to false. |
|
|
|
=item * B<activeonly>: |
|
|
|
If true, only active students and course personnel will be |
|
shown. Defaults to false. |
|
|
|
=back |
|
|
=cut |
=cut |
|
|
Line 1976 sub start_student {
|
Line 2011 sub start_student {
|
$helper->declareVar($paramHash->{'variable'}); |
$helper->declareVar($paramHash->{'variable'}); |
$paramHash->{'multichoice'} = $token->[2]{'multichoice'}; |
$paramHash->{'multichoice'} = $token->[2]{'multichoice'}; |
$paramHash->{'coursepersonnel'} = $token->[2]{'coursepersonnel'}; |
$paramHash->{'coursepersonnel'} = $token->[2]{'coursepersonnel'}; |
|
$paramHash->{'sctiveonly'} = $token->[2]{'activeonly'}; |
if (defined($token->[2]{'nextstate'})) { |
if (defined($token->[2]{'nextstate'})) { |
$paramHash->{NEXTSTATE} = $token->[2]{'nextstate'}; |
$paramHash->{NEXTSTATE} = $token->[2]{'nextstate'}; |
} |
} |
Line 2008 sub render {
|
Line 2044 sub render {
|
} |
} |
} |
} |
} |
} |
|
function checksec(value) { |
|
for (i=0; i<document.forms.helpform.elements.length; i++) { |
|
comp = document.forms.helpform.elements.chksec.value; |
|
if (document.forms.helpform.elements[i].value.indexOf(':'+comp+':') != -1) { |
|
document.forms.helpform.elements[i].checked=value; |
|
} |
|
} |
|
} |
|
function checkactive() { |
|
for (i=0; i<document.forms.helpform.elements.length; i++) { |
|
if (document.forms.helpform.elements[i].value.indexOf(':Active') != -1) { |
|
document.forms.helpform.elements[i].checked=true; |
|
} |
|
} |
|
} |
</script> |
</script> |
SCRIPT |
SCRIPT |
$buttons = <<BUTTONS; |
$buttons = <<BUTTONS; |
<br /> |
<br /> |
|
<input type="button" onclick="checkactive()" value="Select Only Current Students" /> |
<input type="button" onclick="checkall(true, '$var')" value="Select All Students" /> |
<input type="button" onclick="checkall(true, '$var')" value="Select All Students" /> |
<input type="button" onclick="checkall(false, '$var')" value="Unselect All Students" /> |
<input type="button" onclick="checkall(false, '$var')" value="Unselect All Students" /> |
<br /> |
<br /> |
|
<input type="button" onclick="checksec(true)" value="Select for Section/Group"> |
|
<input type="text" size="5" name="chksec"> |
|
<input type="button" onclick="checksec(false)" value="Unselect for Section/Group"> |
|
|
|
<br /> |
BUTTONS |
BUTTONS |
} |
} |
|
|
Line 2048 BUTTONS
|
Line 2105 BUTTONS
|
# Constants |
# Constants |
my $section = Apache::loncoursedata::CL_SECTION(); |
my $section = Apache::loncoursedata::CL_SECTION(); |
my $fullname = Apache::loncoursedata::CL_FULLNAME(); |
my $fullname = Apache::loncoursedata::CL_FULLNAME(); |
|
my $status = Apache::loncoursedata::CL_STATUS(); |
|
|
# Load up the students |
# Load up the students |
my $classlist = &Apache::loncoursedata::get_classlist(); |
my $classlist = &Apache::loncoursedata::get_classlist(); |
Line 2062 BUTTONS
|
Line 2120 BUTTONS
|
|
|
# username, fullname, section, type |
# username, fullname, section, type |
for (@keys) { |
for (@keys) { |
push @$choices, [$_, $classlist->{$_}->[$fullname], |
# Filter out inactive students if we've set "activeonly" |
$classlist->{$_}->[$section], 'Student']; |
if (!$self->{'activeonly'} || $classlist->{$_}->[$status] eq |
|
'Active') { |
|
push @$choices, [$_, $classlist->{$_}->[$fullname], |
|
$classlist->{$_}->[$section], |
|
$classlist->{$_}->[$status], 'Student']; |
|
} |
} |
} |
|
|
my $name = $self->{'coursepersonnel'} ? 'Name' : 'Student Name'; |
my $name = $self->{'coursepersonnel'} ? 'Name' : 'Student Name'; |
Line 2072 BUTTONS
|
Line 2135 BUTTONS
|
$result .= "<table cellspacing='2' cellpadding='2' border='0'>\n"; |
$result .= "<table cellspacing='2' cellpadding='2' border='0'>\n"; |
$result .= "<tr><td></td><td align='center'><b>$name</b></td>". |
$result .= "<tr><td></td><td align='center'><b>$name</b></td>". |
"<td align='center'><b>Section</b></td>" . |
"<td align='center'><b>Section</b></td>" . |
"<td align='center'><b>Role</b></td></tr>"; |
"<td align='center'><b>Status</b></td>" . |
|
"<td align='center'><b>Role</b></td>" . |
|
"<td align='center'><b>Username:Domain</b></td></tr>"; |
|
|
my $checked = 0; |
my $checked = 0; |
for my $choice (@$choices) { |
for my $choice (@$choices) { |
Line 2084 BUTTONS
|
Line 2149 BUTTONS
|
$checked = 1; |
$checked = 1; |
} |
} |
$result .= |
$result .= |
" value='" . HTML::Entities::encode($choice->[0] . ':' . $choice->[2]) |
" value='" . HTML::Entities::encode($choice->[0] . ':' . $choice->[2] . ':' . $choice->[1] . ':' . $choice->[3]) |
. "' /></td><td>" |
. "' /></td><td>" |
. HTML::Entities::encode($choice->[1]) |
. HTML::Entities::encode($choice->[1]) |
. "</td><td align='center'>" |
. "</td><td align='center'>" |
. HTML::Entities::encode($choice->[2]) |
. HTML::Entities::encode($choice->[2]) |
. "</td>\n<td>" |
. "</td>\n<td>" |
. HTML::Entities::encode($choice->[3]) . "</td></tr>\n"; |
. HTML::Entities::encode($choice->[3]) |
|
. "</td>\n<td>" |
|
. HTML::Entities::encode($choice->[4]) |
|
. "</td>\n<td>" |
|
. HTML::Entities::encode($choice->[0]) |
|
. "</td></tr>\n"; |
} |
} |
|
|
$result .= "</table>\n\n"; |
$result .= "</table>\n\n"; |
Line 2308 BUTTONS
|
Line 2378 BUTTONS
|
my @fileList; |
my @fileList; |
|
|
# If the subdirectory is in local CSTR space |
# If the subdirectory is in local CSTR space |
if ($subdir =~ m|/home/([^/]+)/public_html|) { |
my $metadir; |
|
if ($subdir =~ m|/home/([^/]+)/public_html/(.*)|) { |
|
my $user = $1; |
|
my $domain = $Apache::lonnet::perlvar{'lonDefDomain'}; |
|
$metadir='/res/'.$domain.'/'.$user.'/'.$2; |
|
@fileList = &Apache::lonnet::dirlist($subdir, $domain, $user, ''); |
|
} elsif ($subdir =~ m|^~([^/]+)/(.*)$|) { |
|
$subdir='/home/'.$1.'/public_html/'.$2; |
my $user = $1; |
my $user = $1; |
my $domain = $Apache::lonnet::perlvar{'lonDefDomain'}; |
my $domain = $Apache::lonnet::perlvar{'lonDefDomain'}; |
|
$metadir='/res/'.$domain.'/'.$user.'/'.$2; |
@fileList = &Apache::lonnet::dirlist($subdir, $domain, $user, ''); |
@fileList = &Apache::lonnet::dirlist($subdir, $domain, $user, ''); |
} else { |
} else { |
# local library server resource space |
# local library server resource space |
Line 2349 BUTTONS
|
Line 2427 BUTTONS
|
} |
} |
|
|
# Get the title |
# Get the title |
my $title = Apache::lonpubdir::getTitleString($fileName); |
my $title = Apache::lonpubdir::getTitleString(($metadir?$metadir:$subdir) .'/'. $file); |
|
|
# 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, |
Line 2387 BUTTONS
|
Line 2465 BUTTONS
|
$result .= "</table>\n"; |
$result .= "</table>\n"; |
|
|
if (!$choices) { |
if (!$choices) { |
$result .= '<font color="#FF0000">There are no files available to select in this directory. Please go back and select another option.</font><br /><br />'; |
$result .= '<font color="#FF0000">There are no files available to select in this directory ('.$subdir.'). Please go back and select another option.</font><br /><br />'; |
} |
} |
|
|
$result .= $buttons; |
$result .= $buttons; |
Line 2937 sub render {
|
Line 3015 sub render {
|
my $vars = $helper->{VARS}; |
my $vars = $helper->{VARS}; |
|
|
# FIXME: Unify my designators with the standard ones |
# FIXME: Unify my designators with the standard ones |
my %dateTypeHash = ('open_date' => "Opening Date", |
my %dateTypeHash = ('open_date' => "opening date", |
'due_date' => "Due Date", |
'due_date' => "due date", |
'answer_date' => "Answer Date", |
'answer_date' => "answer date", |
'tries' => 'Number of Tries' |
'tries' => 'number of tries', |
|
'weight' => 'problem weight' |
); |
); |
my %parmTypeHash = ('open_date' => "0_opendate", |
my %parmTypeHash = ('open_date' => "0_opendate", |
'due_date' => "0_duedate", |
'due_date' => "0_duedate", |
'answer_date' => "0_answerdate", |
'answer_date' => "0_answerdate", |
'tries' => '0_maxtries' ); |
'tries' => '0_maxtries', |
|
'weight' => '0_weight' ); |
|
|
my $affectedResourceId = ""; |
my $affectedResourceId = ""; |
my $parm_name = $parmTypeHash{$vars->{ACTION_TYPE}}; |
my $parm_name = $parmTypeHash{$vars->{ACTION_TYPE}}; |
Line 2991 sub render {
|
Line 3071 sub render {
|
if ($vars->{ACTION_TYPE} eq 'tries') { |
if ($vars->{ACTION_TYPE} eq 'tries') { |
$result .= ' to <b>' . $vars->{TRIES} . '</b>'; |
$result .= ' to <b>' . $vars->{TRIES} . '</b>'; |
} |
} |
|
if ($vars->{ACTION_TYPE} eq 'weight') { |
|
$result .= ' to <b>' . $vars->{WEIGHT} . '</b>'; |
|
} |
$result .= "</li>\n"; |
$result .= "</li>\n"; |
if ($vars->{ACTION_TYPE} eq 'due_date' || |
if ($vars->{ACTION_TYPE} eq 'due_date' || |
$vars->{ACTION_TYPE} eq 'answer_date') { |
$vars->{ACTION_TYPE} eq 'answer_date') { |
Line 3011 sub render {
|
Line 3094 sub render {
|
} elsif ($vars->{ACTION_TYPE} eq 'tries') { |
} elsif ($vars->{ACTION_TYPE} eq 'tries') { |
$result .= "<input type='hidden' name='pres_value' " . |
$result .= "<input type='hidden' name='pres_value' " . |
"value='" . $vars->{TRIES} . "' />\n"; |
"value='" . $vars->{TRIES} . "' />\n"; |
|
} elsif ($vars->{ACTION_TYPE} eq 'weight') { |
|
$result .= "<input type='hidden' name='pres_value' " . |
|
"value='" . $vars->{WEIGHT} . "' />\n"; |
} |
} |
|
|
$result .= $resourceString; |
$result .= $resourceString; |
Line 3041 sub render {
|
Line 3127 sub render {
|
} |
} |
|
|
# Print value |
# Print value |
if ($vars->{ACTION_TYPE} ne 'tries') { |
if ($vars->{ACTION_TYPE} ne 'tries' && $vars->{ACTION_TYPE} ne 'weight') { |
$result .= "<li>to <b>" . ctime($vars->{PARM_DATE}) . "</b> (" . |
$result .= "<li>to <b>" . ctime($vars->{PARM_DATE}) . "</b> (" . |
Apache::lonnavmaps::timeToHumanString($vars->{PARM_DATE}) |
Apache::lonnavmaps::timeToHumanString($vars->{PARM_DATE}) |
. ")</li>\n"; |
. ")</li>\n"; |