version 1.184, 2011/10/25 22:27:11
|
version 1.195, 2015/08/15 20:11:57
|
Line 64 messages, resource selections, or date q
|
Line 64 messages, resource selections, or date q
|
|
|
The helper tag is required to have one attribute, "title", which is the name |
The helper tag is required to have one attribute, "title", which is the name |
of the helper itself, such as "Parameter helper". The helper tag may optionally |
of the helper itself, such as "Parameter helper". The helper tag may optionally |
have a "requiredpriv" attribute, specifying the priviledge a user must have |
have a "requiredpriv" attribute, specifying the privilege a user must have |
to use the helper, or get denied access. See loncom/auth/rolesplain.tab for |
to use the helper, or get denied access. See loncom/auth/rolesplain.tab for |
useful privs. Default is full access, which is often wrong! |
useful privs. You may add the modifier &S at the end of the three letter priv |
|
if you want to grant access to users for whom the corresponding privilege is |
|
section-specific. The default is full access, which is often wrong! |
|
|
=head2 State tags |
=head2 State tags |
|
|
Line 261 sub real_handler {
|
Line 263 sub real_handler {
|
my $uri = shift; |
my $uri = shift; |
if (!defined($uri)) { $uri = $r->uri(); } |
if (!defined($uri)) { $uri = $r->uri(); } |
$env{'request.uri'} = $uri; |
$env{'request.uri'} = $uri; |
my $filename = '/home/httpd/html' . $uri; |
my $filename = $r->dir_config('lonDocRoot').$uri; |
my $fh = Apache::File->new($filename); |
my $fh = Apache::File->new($filename); |
my $file; |
my $file; |
read $fh, $file, 100000000; |
read $fh, $file, 100000000; |
Line 283 sub real_handler {
|
Line 285 sub real_handler {
|
|
|
my $allowed = $helper->allowedCheck(); |
my $allowed = $helper->allowedCheck(); |
if (!$allowed) { |
if (!$allowed) { |
$env{'user.error.msg'} = $env{'request.uri'}.':'.$helper->{REQUIRED_PRIV}. |
my ($priv,$modifier) = split(/\&/,$helper->{REQUIRED_PRIV}); |
|
$env{'user.error.msg'} = $env{'request.uri'}.':'.$priv. |
":0:0:Permission denied to access this helper."; |
":0:0:Permission denied to access this helper."; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
Line 508 sub allowedCheck {
|
Line 511 sub allowedCheck {
|
if (!defined($self->{REQUIRED_PRIV})) { |
if (!defined($self->{REQUIRED_PRIV})) { |
return 1; |
return 1; |
} |
} |
|
my ($priv,$modifier) = split(/\&/,$self->{REQUIRED_PRIV}); |
return Apache::lonnet::allowed($self->{REQUIRED_PRIV}, $env{'request.course.id'}); |
my $allowed = &Apache::lonnet::allowed($priv,$env{'request.course.id'}); |
|
if ((!$allowed) && ($modifier eq 'S') && ($env{'request.course.sec'} ne '')) { |
|
$allowed = &Apache::lonnet::allowed($priv,$env{'request.course.id'}.'/'. |
|
$env{'request.course.sec'}); |
|
} |
|
return $allowed; |
} |
} |
|
|
sub changeState { |
sub changeState { |
Line 651 sub display {
|
Line 659 sub display {
|
$result .= $buttons; |
$result .= $buttons; |
|
|
|
|
#foreach my $key (keys %{$self->{VARS}}) { |
#foreach my $key (keys(%{$self->{VARS}})) { |
# $result .= "|$key| -> " . $self->{VARS}->{$key} . "<br />"; |
# $result .= "|$key| -> " . $self->{VARS}->{$key} . "<br />"; |
#} |
#} |
|
|
Line 1913 CHECK
|
Line 1921 CHECK
|
if ($anytime) { |
if ($anytime) { |
$result.=' checked="checked" ' |
$result.=' checked="checked" ' |
} |
} |
$result.="name='${var}anytime'/>".&mt('Any time').'</label>' |
my $anytimetext = &mt('Any time'); |
|
if (($var eq 'startreserve') || ($var eq 'endreserve')) { |
|
$anytimetext = &mt('Any time before slot starts'); |
|
} elsif (($var eq 'startunique') || ($var eq 'endunique')) { |
|
$anytimetext = &mt('No restriction on uniqueness'); |
|
} |
|
$result.="name='${var}anytime'/>".$anytimetext.'</label>' |
} |
} |
return $result; |
return $result; |
|
|
Line 2390 BUTTONS
|
Line 2404 BUTTONS
|
$result .= "<th>$text</th>"; |
$result .= "<th>$text</th>"; |
} |
} |
} |
} |
$result .= "<th>Select</th>"; |
$result .= '<th>'.&Apache::lonlocal::mt('Select').'</th>'; |
$result .= "</tr><tr>"; # Close off the extra row and start a new one. |
$result .= "</tr><tr>"; # Close off the extra row and start a new one. |
$headings_done = 1; |
$headings_done = 1; |
} |
} |
Line 2487 BUTTONS
|
Line 2501 BUTTONS
|
&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\">".&Apache::lonlocal::mt('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\">".&Apache::lonlocal::mt('Part: [_1]',$part)."</option>\n"; |
} |
} |
$col .= "</select>"; |
$col .= "</select>"; |
} |
} |
Line 2534 RADIO
|
Line 2548 RADIO
|
'closeAllPages' => $self->{'closeallpages'}, |
'closeAllPages' => $self->{'closeallpages'}, |
'suppressEmptySequences' => $self->{'suppressEmptySequences'}, |
'suppressEmptySequences' => $self->{'suppressEmptySequences'}, |
'include_top_level_map' => $self->{'include_top_level_map'}, |
'include_top_level_map' => $self->{'include_top_level_map'}, |
'iterator_map' => $mapUrl } |
'iterator_map' => $mapUrl, |
|
'map_no_edit_link' => 1, } |
); |
); |
|
|
$result .= $buttons; |
$result .= $buttons; |
Line 2682 sub render {
|
Line 2697 sub render {
|
delete($defaultUsers{''}); |
delete($defaultUsers{''}); |
} |
} |
|
|
|
|
my ($course_personnel, |
my ($course_personnel, |
$current_members, |
$current_members, |
$expired_members, |
$expired_members, |
$future_members) = |
$future_members) = |
&Apache::lonselstudent::get_people_in_class($env{'request.course.sec'}); |
&Apache::lonselstudent::get_people_in_class($env{'request.course.sec'}); |
|
|
|
|
|
|
# Load up the non-students, if necessary |
# Load up the non-students, if necessary |
|
|
if ($self->{'coursepersonnel'}) { |
if ($self->{'coursepersonnel'}) { |
Line 2975 BUTTONS
|
Line 2987 BUTTONS
|
|
|
# If the subdirectory is in local CSTR space |
# If the subdirectory is in local CSTR space |
my $metadir; |
my $metadir; |
if ($subdir =~ m|^/home/httpd/html/priv/[^/]+/[^/]+/(.*)$|) { |
my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'}; |
|
if ($subdir =~ m{^(?:\Q$londocroot\E)*/priv/[^/]+/[^/]+/(.*)$}) { |
my $innerpath=$1; |
my $innerpath=$1; |
|
unless ($subdir=~m{^\Q$londocroot\E}) { |
|
$subdir=$londocroot.$subdir; |
|
} |
my ($user,$domain)= |
my ($user,$domain)= |
&Apache::loncacc::constructaccess($subdir); |
&Apache::lonnet::constructaccess($subdir); |
$metadir='/res/'.$domain.'/'.$user.'/'.$innerpath; |
$metadir='/res/'.$domain.'/'.$user.'/'.$innerpath; |
($listref,$listerror) = |
($listref,$listerror) = |
&Apache::lonnet::dirlist($subdir,$domain,$user,undef,undef,'/'); |
&Apache::lonnet::dirlist($subdir,$domain,$user,undef,undef,'/'); |
Line 3086 sub fileState {
|
Line 3102 sub fileState {
|
} |
} |
my $docroot = $Apache::lonnet::perlvar{'lonDocRoot'}; |
my $docroot = $Apache::lonnet::perlvar{'lonDocRoot'}; |
my $subdirpart = $constructionSpaceDir; |
my $subdirpart = $constructionSpaceDir; |
$subdirpart =~ s/^\/home\/httpd\/html\/priv\/\Q$udom\E\/\Q$uname\E//; |
$subdirpart =~ s{^\Q$docroot/priv/$udom/$uname\E}{}; |
my $resdir = $docroot . '/res/' . $udom . '/' . $uname . |
my $resdir = $docroot . '/res/' . $udom . '/' . $uname . |
$subdirpart; |
$subdirpart; |
|
|
Line 3174 sub start_section {
|
Line 3190 sub start_section {
|
|
|
# Populate the CHOICES element |
# Populate the CHOICES element |
my %choices; |
my %choices; |
|
my $usersec = $Apache::lonnet::env{'request.course.sec'}; |
|
|
my $section = Apache::loncoursedata::CL_SECTION(); |
if ($usersec ne '') { |
my $classlist = Apache::loncoursedata::get_classlist(); |
$choices{$usersec} = $usersec; |
foreach my $user (keys(%$classlist)) { |
} else { |
my $section_name = $classlist->{$user}[$section]; |
my $section = Apache::loncoursedata::CL_SECTION(); |
if (!$section_name) { |
my $classlist = Apache::loncoursedata::get_classlist(); |
$choices{"No section assigned"} = ""; |
foreach my $user (keys(%$classlist)) { |
} else { |
my $section_name = $classlist->{$user}[$section]; |
$choices{$section_name} = $section_name; |
if (!$section_name) { |
|
$choices{"No section assigned"} = ""; |
|
} else { |
|
$choices{$section_name} = $section_name; |
|
} |
|
} |
|
|
|
if (exists($choices{"No section assigned"})) { |
|
push(@{$paramHash->{CHOICES}}, |
|
['No section assigned','No section assigned']); |
|
delete($choices{"No section assigned"}); |
} |
} |
} |
|
|
|
if (exists($choices{"No section assigned"})) { |
|
push(@{$paramHash->{CHOICES}}, |
|
['No section assigned','No section assigned']); |
|
delete($choices{"No section assigned"}); |
|
} |
} |
for my $section_name (sort {lc($a) cmp lc($b) } (keys(%choices))) { |
for my $section_name (sort {lc($a) cmp lc($b) } (keys(%choices))) { |
push @{$paramHash->{CHOICES}}, [$section_name, $section_name]; |
push @{$paramHash->{CHOICES}}, [$section_name, $section_name]; |
Line 3623 sub render {
|
Line 3644 sub render {
|
my @results; |
my @results; |
|
|
# Collect all the results |
# Collect all the results |
for my $stateName (keys %{$helper->{STATES}}) { |
for my $stateName (keys(%{$helper->{STATES}})) { |
my $state = $helper->{STATES}->{$stateName}; |
my $state = $helper->{STATES}->{$stateName}; |
|
|
for my $element (@{$state->{ELEMENTS}}) { |
for my $element (@{$state->{ELEMENTS}}) { |