version 1.522.2.31, 2024/07/03 04:06:27
|
version 1.529, 2012/12/17 15:00:41
|
Line 36 lonparmset - Handler to set parameters f
|
Line 36 lonparmset - Handler to set parameters f
|
|
|
=head1 SYNOPSIS |
=head1 SYNOPSIS |
|
|
lonparmset provides an interface to setting content parameters in a |
lonparmset provides an interface to setting course parameters. |
course. |
|
|
|
=head1 DESCRIPTION |
=head1 DESCRIPTION |
|
|
Line 47 This module sets coursewide and assessme
|
Line 46 This module sets coursewide and assessme
|
|
|
=over |
=over |
|
|
|
=pod |
|
|
=item parmval() |
=item parmval() |
|
|
Figure out a cascading parameter. |
Figure out a cascading parameter. |
Line 130 javascript function 'pjump'.
|
Line 131 javascript function 'pjump'.
|
|
|
=item print_td() |
=item print_td() |
|
|
=item check_other_groups() |
=item print_usergroups() |
|
|
=item parm_control_group() |
=item parm_control_group() |
|
|
Line 138 javascript function 'pjump'.
|
Line 139 javascript function 'pjump'.
|
|
|
extractResourceInformation extracts lots of information about all of the the course's resources into a variety of hashes. |
extractResourceInformation extracts lots of information about all of the the course's resources into a variety of hashes. |
|
|
Input: See list below |
Input: See list below: |
|
|
=over 4 |
|
|
|
=item * B<env{'user.name'}> : Current username |
=item * B<env{'user.name'}> : Current username |
|
|
=item * B<env{'user.domain'}> : Domain of current user. |
=item * B<env{'user.domain'}> : Domain of current user. |
|
|
=item * B<env{"request.course.fn"}> : Course |
=item * b<env{"request.course.fn"} : Course |
|
|
=back |
|
|
|
Outputs: See list below |
|
|
|
=over 4 |
Outputs: See list below: |
|
|
=item * B<ids> (out) : An array that will contain all of the ids in the course. |
=item * B<ids> (out) : An array that will contain all of the ids in the course. |
|
|
Line 178 Outputs: See list below
|
Line 173 Outputs: See list below
|
|
|
=item * B<defkeytype> |
=item * B<defkeytype> |
|
|
=back |
|
|
|
=item isdateparm() |
=item isdateparm() |
|
|
=item parmmenu() |
=item parmmenu() |
Line 217 Returns: nothing
|
Line 210 Returns: nothing
|
|
|
Variables used (guessed by Jeremy): |
Variables used (guessed by Jeremy): |
|
|
=over |
|
|
|
=item * B<pscat>: ParameterS CATegories? ends up a list of the types of parameters that exist, e.g., tol, weight, acc, opendate, duedate, answerdate, sig, maxtries, type. |
=item * B<pscat>: ParameterS CATegories? ends up a list of the types of parameters that exist, e.g., tol, weight, acc, opendate, duedate, answerdate, sig, maxtries, type. |
|
|
=item * B<psprt>: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts? |
=item * B<psprt>: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts? |
Line 231 Variables used (guessed by Jeremy):
|
Line 222 Variables used (guessed by Jeremy):
|
When storing information, store as part 0 |
When storing information, store as part 0 |
When requesting information, request from full part |
When requesting information, request from full part |
|
|
=back |
|
|
|
=item tablestart() |
=item tablestart() |
|
|
=item tableend() |
=item tableend() |
Line 299 Set portfolio metadata
|
Line 288 Set portfolio metadata
|
|
|
Main handler. Calls &assessparms subroutine. |
Main handler. Calls &assessparms subroutine. |
|
|
|
|
=back |
=back |
|
|
=cut |
=cut |
Line 321 use Apache::lonnavmaps;
|
Line 311 use Apache::lonnavmaps;
|
use Apache::longroup; |
use Apache::longroup; |
use Apache::lonrss; |
use Apache::lonrss; |
use HTML::Entities; |
use HTML::Entities; |
use Text::Wrap(); |
|
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
|
|
|
|
|
sub startSettingsScreen { |
|
my ($r,$mode)=@_; |
|
|
|
$r->print("\n".'<ul class="LC_TabContentBigger" id="main">'); |
|
$r->print("\n".'<li'.($mode eq 'coursepref'?' class="active"':'').'><a href="/adm/courseprefs"><b> '. |
|
&mt('Course Settings'). |
|
' </b></a></li>'); |
|
|
|
$r->print("\n".'<li'.($mode eq 'parmset'?' class="active"':'').' id="tabbededitor"><a href="/adm/parmset"><b>'. |
|
&mt('Content and Problem Settings').'</b></a></li>'); |
|
$r->print("\n".'</ul>'."\n"); |
|
$r->print('<div class="LC_Box" style="clear:both;margin:0;" id="parameditor"><div id="maincoursedoc" style="margin:0 0;padding:0 0;"><div class="LC_ContentBox" id="mainCourseDocuments" style="display: block;">'); |
|
} |
|
|
|
sub endSettingsScreen { |
|
my ($r)=@_; |
|
$r->print('</div></div></div>'); |
|
} |
|
|
|
|
|
|
sub parmval { |
sub parmval { |
my ($what,$id,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; |
my ($what,$id,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; |
return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec, |
return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec, |
Line 762 sub valout {
|
Line 772 sub valout {
|
$result = |
$result = |
'<img src="/res/adm/pages/editmap.png"' |
'<img src="/res/adm/pages/editmap.png"' |
.' alt="'.&mt('Change').'"' |
.' alt="'.&mt('Change').'"' |
.' title="'.&mt('Change').'" style="border:0;" />'; |
.' title="'.&mt('Change').'" />'; |
} else { |
} else { |
$result=' '; |
$result=' '; |
} |
} |
Line 880 sub page_js {
|
Line 890 sub page_js {
|
var newWin = window.open(url, wdwName, options); |
var newWin = window.open(url, wdwName, options); |
newWin.focus(); |
newWin.focus(); |
} |
} |
|
|
// ]]> |
// ]]> |
|
|
</script> |
</script> |
$selscript |
$selscript |
ENDJS |
ENDJS |
Line 935 sub startpage {
|
Line 947 sub startpage {
|
</script> |
</script> |
'; |
'; |
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page('Set/Modify Course Parameters',$js, |
&Apache::loncommon::start_page('Set/Modify Course Parameters',$js, |
{'add_entries' => \%loaditems,}); |
{'add_entries' => \%loaditems,}); |
my $breadcrumbs = |
my $breadcrumbs = |
&Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode'); |
&Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode'); |
my $escfilter=&Apache::lonhtmlcommon::entity_encode($env{'form.filter'}); |
my $escfilter=&Apache::lonhtmlcommon::entity_encode($env{'form.filter'}); |
my $escpart=&Apache::lonhtmlcommon::entity_encode($env{'form.part'}); |
my $escpart=&Apache::lonhtmlcommon::entity_encode($env{'form.part'}); |
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
|
&startSettingsScreen($r,'parmset'); |
$r->print(<<ENDHEAD); |
$r->print(<<ENDHEAD); |
<form method="post" action="/adm/parmset?action=settable" name="parmform"> |
<form method="post" action="/adm/parmset?action=settable" name="parmform"> |
<input type="hidden" value="" name="pres_value" /> |
<input type="hidden" value="" name="pres_value" /> |
Line 956 ENDHEAD
|
Line 969 ENDHEAD
|
|
|
sub print_row { |
sub print_row { |
my ($r,$which,$part,$name,$symbp,$rid,$default,$defaulttype,$display,$defbgone, |
my ($r,$which,$part,$name,$symbp,$rid,$default,$defaulttype,$display,$defbgone, |
$defbgtwo,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups,$noeditgrp, |
$defbgtwo,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups)=@_; |
$readonly)=@_; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
Line 1002 sub print_row {
|
Line 1014 sub print_row {
|
if ($parmlev eq 'general') { |
if ($parmlev eq 'general') { |
|
|
if ($uname) { |
if ($uname) { |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} elsif ($cgroup) { |
} elsif ($cgroup) { |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} elsif ($csec) { |
} elsif ($csec) { |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} else { |
} else { |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} |
} |
} elsif ($parmlev eq 'map') { |
} elsif ($parmlev eq 'map') { |
|
|
if ($uname) { |
if ($uname) { |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} elsif ($cgroup) { |
} elsif ($cgroup) { |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} elsif ($csec) { |
} elsif ($csec) { |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} else { |
} else { |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} |
} |
} else { |
} else { |
if ($uname) { |
if ($uname) { |
if (@{$usersgroups} > 1) { |
if (@{$usersgroups} > 1) { |
my ($coursereply,$grp_parm,$controlgrp); |
my ($coursereply,$grp_parm,$controlgrp); |
($coursereply,$othergrp,$grp_parm,$controlgrp) = |
($coursereply,$othergrp,$grp_parm,$controlgrp) = |
&check_other_groups($$part{$which}.'.'.$$name{$which}, |
&print_usergroups($r,$$part{$which}.'.'.$$name{$which}, |
$rid,$cgroup,$defbgone,$usersgroups,$result,$courseopt); |
$rid,$cgroup,$defbgone,$usersgroups,$result,$courseopt); |
if ($coursereply && $result > 3) { |
if ($coursereply && $result > 3) { |
if (defined($controlgrp)) { |
if (defined($controlgrp)) { |
Line 1039 sub print_row {
|
Line 1051 sub print_row {
|
} |
} |
} |
} |
|
|
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
|
|
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
|
|
if ($csec) { |
if ($csec) { |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} |
} |
|
|
if ($cgroup) { |
if ($cgroup) { |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly); |
&print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} |
} |
|
|
if ($uname) { |
if ($uname) { |
if ($othergrp) { |
if ($othergrp) { |
$r->print($othergrp); |
$r->print($othergrp); |
} |
} |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
} |
} |
|
|
} # end of $parmlev if/else |
} # end of $parmlev if/else |
Line 1084 sub print_row {
|
Line 1096 sub print_row {
|
} |
} |
|
|
sub print_td { |
sub print_td { |
my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display,$noeditgrp,$readonly)=@_; |
my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_; |
$r->print('<td style="background-color:'.(($result==$which)?'#AAFFAA':$defbg). |
$r->print('<td style="background-color:'.(($result==$which)?'#AAFFAA':$defbg). |
';" align="center">'); |
';" align="center">'); |
my $nolink = 0; |
my $nolink = 0; |
if ($readonly) { |
if ($which == 11 || $which == 12) { |
$nolink = 1; |
$nolink = 1; |
} else { |
} elsif ($mprefix =~ /availablestudent\&$/) { |
if ($which == 11 || $which == 12) { |
if ($which > 3) { |
$nolink = 1; |
$nolink = 1; |
} elsif (($env{'request.course.sec'} ne '') && ($which > 9)) { |
|
$nolink = 1; |
|
} elsif ($which == 4 || $which == 5 || $which == 6) { |
|
if ($noeditgrp) { |
|
$nolink = 1; |
|
} |
|
} elsif ($mprefix =~ /availablestudent\&$/) { |
|
$nolink = 1; |
|
} elsif ($mprefix =~ /examcode\&$/) { |
|
unless ($which == 2) { |
|
$nolink = 1; |
|
} |
|
} |
} |
} |
} |
if ($nolink) { |
if ($nolink) { |
Line 1117 sub print_td {
|
Line 1117 sub print_td {
|
$r->print('</td>'."\n"); |
$r->print('</td>'."\n"); |
} |
} |
|
|
sub check_other_groups { |
sub print_usergroups { |
my ($what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_; |
my ($r,$what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_; |
my $courseid = $env{'request.course.id'}; |
my $courseid = $env{'request.course.id'}; |
my $output; |
my $output; |
my $symb = &symbcache($rid); |
my $symb = &symbcache($rid); |
Line 1133 sub check_other_groups {
|
Line 1133 sub check_other_groups {
|
if (($coursereply) && ($cgroup ne $resultgroup)) { |
if (($coursereply) && ($cgroup ne $resultgroup)) { |
if ($result > 3) { |
if ($result > 3) { |
$bgcolor = '#AAFFAA'; |
$bgcolor = '#AAFFAA'; |
|
$grp_parm = &valout($coursereply,$resulttype); |
} |
} |
$grp_parm = &valout($coursereply,$resulttype); |
$grp_parm = &valout($coursereply,$resulttype); |
$output = '<td style="background-color:'.$bgcolor.';" align="center">'; |
$output = '<td style="background-color:'.$bgcolor.';" align="center">'; |
Line 1258 sub extractResourceInformation {
|
Line 1259 sub extractResourceInformation {
|
$$mapp{$mapid}=$$mapp{$id}; |
$$mapp{$mapid}=$$mapp{$id}; |
$$allmaps{$mapid}=$$mapp{$id}; |
$$allmaps{$mapid}=$$mapp{$id}; |
if ($mapid eq '1') { |
if ($mapid eq '1') { |
$$maptitles{$mapid}=&mt('Main Content'); |
$$maptitles{$mapid}=&mt('Main Course Documents'); |
} else { |
} else { |
$$maptitles{$mapid}=&Apache::lonnet::gettitle($$mapp{$id}); |
$$maptitles{$mapid}=&Apache::lonnet::gettitle($$mapp{$id}); |
} |
} |
Line 1284 sub isdateparm {
|
Line 1285 sub isdateparm {
|
# from which you can select all desired parameters. |
# from which you can select all desired parameters. |
# |
# |
sub parmmenu { |
sub parmmenu { |
my ($r)=@_; |
my ($r,$allparms,$pscat,$keyorder)=@_; |
|
my $tempkey; |
$r->print(<<ENDSCRIPT); |
$r->print(<<ENDSCRIPT); |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 1363 sub parmmenu {
|
Line 1365 sub parmmenu {
|
ENDSCRIPT |
ENDSCRIPT |
|
|
$r->print('<hr />'); |
$r->print('<hr />'); |
&shortCuts($r); |
&shortCuts($r,$allparms,$pscat,$keyorder); |
$r->print('<hr />'); |
$r->print('<hr />'); |
} |
} |
# return a hash |
# return a hash |
Line 1391 sub lookUpTableParameter {
|
Line 1393 sub lookUpTableParameter {
|
'contentopen' => 'time_settings', |
'contentopen' => 'time_settings', |
'contentclose' => 'time_settings', |
'contentclose' => 'time_settings', |
'discussend' => 'time_settings', |
'discussend' => 'time_settings', |
'printstartdate' => 'time_settings', |
'printopendate' => 'time_settings', |
'printenddate' => 'time_settings', |
'printclosedate' => 'time_settings', |
'weight' => 'grading', |
'weight' => 'grading', |
'handgrade' => 'grading', |
'handgrade' => 'grading', |
'maxtries' => 'tries', |
'maxtries' => 'tries', |
Line 1427 sub lookUpTableParameter {
|
Line 1429 sub lookUpTableParameter {
|
'lenient' => 'grading', |
'lenient' => 'grading', |
'retrypartial' => 'tries', |
'retrypartial' => 'tries', |
'discussvote' => 'misc', |
'discussvote' => 'misc', |
'examcode' => 'high_level_randomization', |
|
); |
); |
} |
} |
|
|
sub whatIsMyCategory { |
sub whatIsMyCategory { |
Line 1500 sub parmboxes {
|
Line 1502 sub parmboxes {
|
&whatIsMyCategory($tempparameter, \%categoryList); |
&whatIsMyCategory($tempparameter, \%categoryList); |
} |
} |
#part to print the parm-list |
#part to print the parm-list |
$Text::Wrap::columns=60; |
|
$Text::Wrap::separator='<br />'; |
|
$r->print('<div class="LC_columnSection">'."\n"); |
$r->print('<div class="LC_columnSection">'."\n"); |
|
|
#Print parameters |
#Print parameters |
for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) { |
for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) { |
next if(@{$categoryList{$key}} == 0); |
if(@{$categoryList{$key}} == 0) { |
$r->print('<div class="LC_Box LC_400Box">' |
next; |
.'<h4 class="LC_hcell">' |
} else { |
.&mt($categories{$key}) |
$r->print('<div class="LC_Box LC_400Box">' |
.'</h4>'."\n"); |
.'<h4 class="LC_hcell">' |
foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { |
.&mt($categories{$key}) |
next if ($tempkey eq ''); |
.'</h4>'."\n"); |
$r->print('<span class="LC_nobreak">' |
foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { |
.'<label><input type="checkbox" name="pscat" ' |
$r->print('<span class="LC_nobreak">' |
.'value="'.$tempkey.'" '); |
.'<label><input type="checkbox" name="pscat" '); |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
$r->print('value="'.$tempkey.'" '); |
$r->print(' checked="checked"'); |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
} |
$r->print(' checked="checked"'); |
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? |
} |
Text::Wrap::wrap('',' 'x4,$$allparms{$tempkey}) |
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
: $tempkey) |
: $tempkey) |
.'</label></span><br />'."\n"); |
.'</label></span><br />'."\n"); |
|
} |
|
$r->print("</div>\n"); |
} |
} |
$r->print("</div>\n"); |
|
} |
} |
|
|
$r->print("</div>\n"); |
$r->print("</div>\n"); |
Line 1533 sub parmboxes {
|
Line 1534 sub parmboxes {
|
# This function offers some links on the parameter section to get with one click a group a parameters |
# This function offers some links on the parameter section to get with one click a group a parameters |
# |
# |
sub shortCuts { |
sub shortCuts { |
my ($r)=@_; |
my ($r,$allparms,$pscat,$keyorder)=@_; |
|
|
# Parameter Selection |
# Parameter Selection |
$r->print( |
$r->print( |
Line 1592 sub partmenu {
|
Line 1593 sub partmenu {
|
} |
} |
|
|
sub usermenu { |
sub usermenu { |
my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,$usersgroups,$pssymb)=@_; |
my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,$usersgroups)=@_; |
my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '. |
my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '. |
&Apache::loncommon::selectstudent_link('parmform','uname','udom','condition'). |
&Apache::loncommon::selectstudent_link('parmform','uname','udom'); |
&Apache::lonhtmlcommon::scripttag(<<ENDJS); |
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
function setCourseadv(form,caller) { |
|
if (caller.value == 'st') { |
|
form.courseadv.value = 'none'; |
|
} else { |
|
form.courseadv.value = ''; |
|
} |
|
return; |
|
} |
|
ENDJS |
|
|
|
my (%chkroles,$stuonly,$courseadv); |
|
if ($env{'form.userroles'} eq 'any') { |
|
$chkroles{'any'} = ' checked="checked"'; |
|
} else { |
|
$chkroles{'st'} = ' checked="checked"'; |
|
$courseadv = 'none'; |
|
} |
|
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
|
if ($crstype eq 'Community') { |
|
$stuonly = &mt('member only'); |
|
} else { |
|
$stuonly = &mt('student only'); |
|
} |
|
$chooseopt .= '<br /><span class="LC_cusr_subheading">'. |
|
&mt("User's role").': '. |
|
'<label><input type="radio" name="userroles" value="st"'.$chkroles{'st'}.' onclick="setCourseadv(this.form,this);" />'. |
|
$stuonly.'</label> '. |
|
'<label><input type="radio" name="userroles" value="any"'.$chkroles{'any'}.' onclick="setCourseadv(this.form,this);" />'. |
|
&mt('any role').'</label><input type="hidden" id="courseadv" name="courseadv" value="'.$courseadv.'" /></span>'; |
|
my $sections=''; |
my $sections=''; |
my %sectionhash = &Apache::loncommon::get_sections(); |
my %sectionhash = &Apache::loncommon::get_sections(); |
|
|
my $groups; |
my $groups; |
my %grouphash; |
my %grouphash = &Apache::longroup::coursegroups(); |
if (($pssymb) || &Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
|
%grouphash = &Apache::longroup::coursegroups(); |
|
} elsif ($env{'request.course.groups'} ne '') { |
|
map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'}); |
|
} |
|
|
|
my $g_s_header=''; |
my $g_s_header=''; |
my $g_s_footer=''; |
my $g_s_footer=''; |
|
|
my $currsec = $env{'request.course.sec'}; |
if (%sectionhash) { |
if ($currsec) { |
|
$sections=&mt('Section:').' '.$currsec; |
|
if (%grouphash) { |
|
$sections .= ';'.(' ' x2); |
|
} |
|
} elsif (%sectionhash && $currsec eq '') { |
|
$sections=&mt('Section:').' <select name="csec"'; |
$sections=&mt('Section:').' <select name="csec"'; |
if (%grouphash && $parmlev ne 'full') { |
if (%grouphash && $parmlev ne 'full') { |
$sections .= qq| onchange="group_or_section('csec')" |; |
$sections .= qq| onchange="group_or_section('csec')" |; |
Line 1659 ENDJS
|
Line 1621 ENDJS
|
$sections.='</select>'; |
$sections.='</select>'; |
} |
} |
|
|
if (%sectionhash && %grouphash && $parmlev ne 'full' && $currsec eq '') { |
if (%sectionhash && %grouphash && $parmlev ne 'full') { |
$sections .= ' '.&mt('or').' '; |
$sections .= ' '.&mt('or').' '; |
$sections .= qq| |
$sections .= qq| |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 1678 function group_or_section(caller) {
|
Line 1640 function group_or_section(caller) {
|
// ]]> |
// ]]> |
</script> |
</script> |
|; |
|; |
} elsif ($currsec eq '') { |
} else { |
$sections .= qq| |
$sections .= qq| |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 1692 function group_or_section(caller) {
|
Line 1654 function group_or_section(caller) {
|
|
|
if (%grouphash) { |
if (%grouphash) { |
$groups=&mt('Group:').' <select name="cgroup"'; |
$groups=&mt('Group:').' <select name="cgroup"'; |
if (%sectionhash && $env{'form.action'} eq 'settable' && $currsec eq '') { |
if (%sectionhash && $env{'form.action'} eq 'settable') { |
$groups .= qq| onchange="group_or_section('cgroup')" |; |
$groups .= qq| onchange="group_or_section('cgroup')" |; |
} |
} |
$groups .= '>'; |
$groups .= '>'; |
Line 1731 function group_or_section(caller) {
|
Line 1693 function group_or_section(caller) {
|
# This function shows on table Mode the available Parameters for the selected Resources |
# This function shows on table Mode the available Parameters for the selected Resources |
# |
# |
sub displaymenu { |
sub displaymenu { |
my ($r,$allparms,$pscat,$keyorder,$divid)=@_; |
my ($r,$allparms,$pscat,$psprt,$keyorder)=@_; |
|
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View'))); |
|
|
&parmmenu($r); |
&parmmenu($r,$allparms,$pscat,$keyorder); |
$r->print(&Apache::loncommon::start_scrollbox('480px','440px','200px',$divid)); |
$r->print(&Apache::loncommon::start_scrollbox()); |
&parmboxes($r,$allparms,$pscat,$keyorder); |
&parmboxes($r,$allparms,$pscat,$keyorder); |
$r->print(&Apache::loncommon::end_scrollbox()); |
$r->print(&Apache::loncommon::end_scrollbox()); |
|
|
Line 1747 sub displaymenu {
|
Line 1709 sub displaymenu {
|
} |
} |
|
|
sub mapmenu { |
sub mapmenu { |
my ($r,$allmaps,$pschp,$maptitles,$symbp,$parmlev)=@_; |
my ($r,$allmaps,$pschp,$maptitles,$symbp)=@_; |
my %allmaps_inverted = reverse %$allmaps; |
my %allmaps_inverted = reverse %$allmaps; |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $tree=[]; |
my $tree=[]; |
Line 1795 sub mapmenu {
|
Line 1757 sub mapmenu {
|
} |
} |
} |
} |
# Show it ... |
# Show it ... |
my $rowattr = ' id="mapmenu"'; |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'),'','',' id="mapmenu"')); |
if ($parmlev eq 'general') { |
|
$rowattr .= ' style="display:none"'; |
|
} |
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'),'','',$rowattr)); |
|
if ((ref($tree) eq 'ARRAY') && (ref($treeinfo) eq 'HASH')) { |
if ((ref($tree) eq 'ARRAY') && (ref($treeinfo) eq 'HASH')) { |
my $icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />'; |
my $icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />'; |
my $whitespace = |
my $whitespace = |
Line 1815 sub mapmenu {
|
Line 1773 sub mapmenu {
|
.'</div>' |
.'</div>' |
); |
); |
|
|
$r->print(&Apache::loncommon::start_scrollbox('700px','680px','400px','mapmenuscroll')); |
$r->print(&Apache::loncommon::start_scrollbox(undef,undef,undef,'mapmenuscroll')); |
$r->print(&Apache::loncommon::start_data_table(undef,'mapmenuinner')); |
$r->print(&Apache::loncommon::start_data_table(undef,'mapmenuinner')); |
|
|
# Display row: "All Maps or Folders" |
# Display row: "All Maps or Folders" |
Line 1834 sub mapmenu {
|
Line 1792 sub mapmenu {
|
.&Apache::loncommon::end_data_table_row() |
.&Apache::loncommon::end_data_table_row() |
); |
); |
|
|
# Display row: "Main Content" |
# Display row: "Main Course Documents" |
if (exists($$allmaps{1})) { |
if (exists($$allmaps{1})) { |
$r->print( |
$r->print( |
&Apache::loncommon::start_data_table_row() |
&Apache::loncommon::start_data_table_row() |
Line 1920 sub levelmenu {
|
Line 1878 sub levelmenu {
|
|
|
|
|
sub sectionmenu { |
sub sectionmenu { |
my ($selectedsections)=@_; |
my ($r,$selectedsections)=@_; |
my %sectionhash = &Apache::loncommon::get_sections(); |
my %sectionhash = &Apache::loncommon::get_sections(); |
return '' if (!%sectionhash); |
return if (!%sectionhash); |
|
|
my (@possibles,$disabled); |
$r->print('<select name="Section" multiple="multiple" size="8">'); |
if ($env{'request.course.sec'} ne '') { |
foreach my $s ('all',sort keys %sectionhash) { |
@possibles = ($env{'request.course.sec'}); |
$r->print(' <option value="'.$s.'"'); |
$selectedsections = [$env{'request.course.sec'}]; |
foreach (@{$selectedsections}) { |
$disabled = ' disabled="disabled"'; |
if ($s eq $_) { |
} else { |
$r->print(' selected="selected"'); |
@possibles = ('all',sort(keys(%sectionhash))); |
last; |
} |
|
my $output = '<select name="Section" multiple="multiple" size="8"'.$disabled.'>'; |
|
foreach my $s (@possibles) { |
|
$output .= ' <option value="'.$s.'"'; |
|
if ((@{$selectedsections}) && (grep(/^\Q$s\E$/,@{$selectedsections}))) { |
|
$output .= ' selected="selected"'; |
|
} |
} |
$output .= '>'."$s</option>\n"; |
|
} |
} |
$output .= "</select>\n"; |
$r->print('>'.$s."</option>\n"); |
return $output; |
} |
|
$r->print("</select>\n"); |
} |
} |
|
|
sub groupmenu { |
sub groupmenu { |
my ($selectedgroups)=@_; |
my ($r,$selectedgroups)=@_; |
my %grouphash; |
my %grouphash = &Apache::longroup::coursegroups(); |
if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
return if (!%grouphash); |
%grouphash = &Apache::longroup::coursegroups(); |
|
} elsif ($env{'request.course.groups'} ne '') { |
|
map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'}); |
|
} |
|
return '' if (!%grouphash); |
|
|
|
my $output = '<select name="Group" multiple="multiple" size="8">'; |
$r->print('<select name="Group" multiple="multiple" size="8">'); |
foreach my $group (sort(keys(%grouphash))) { |
foreach my $group (sort(keys(%grouphash))) { |
$output .= ' <option value="'.$group.'"'; |
$r->print(' <option value="'.$group.'"'); |
if ((@{$selectedgroups}) && (grep(/^\Q$group\E$/,\@{$selectedgroups}))) { |
foreach (@{$selectedgroups}) { |
$output .= ' selected="selected"'; |
if ($group eq $_) { |
|
$r->print(' selected="selected"'); |
|
last; |
} |
} |
$output .= '>'.$group."</option>\n"; |
|
} |
} |
$output .= "</select>\n"; |
$r->print('>'.$group."</option>\n"); |
return $output; |
} |
|
$r->print("</select>\n"); |
} |
} |
|
|
|
|
sub keysplit { |
sub keysplit { |
my $keyp=shift; |
my $keyp=shift; |
return (split(/\,/,$keyp)); |
return (split(/\,/,$keyp)); |
Line 2034 sub standardkeyorder {
|
Line 1984 sub standardkeyorder {
|
'parameter_0_discussend' => 19, |
'parameter_0_discussend' => 19, |
'parameter_0_discusshide' => 20, |
'parameter_0_discusshide' => 20, |
'parameter_0_discussvote' => 21, |
'parameter_0_discussvote' => 21, |
'parameter_0_printstartdate' => 22, |
'parameter_0_printopendate' => 22, |
'parameter_0_printenddate' => 23); |
'parameter_0_printclosedate' => 23); |
} |
} |
|
|
|
|
sub assessparms { |
sub assessparms { |
|
|
my ($r,$parm_permission) = @_; |
my $r=shift; |
|
|
|
|
|
|
# -------------------------------------------------------- Variable declaration |
# -------------------------------------------------------- Variable declaration |
Line 2084 sub assessparms {
|
Line 2035 sub assessparms {
|
my $message=''; |
my $message=''; |
|
|
$csec=$env{'form.csec'}; |
$csec=$env{'form.csec'}; |
if ($env{'request.course.sec'} ne '') { |
|
$csec = $env{'request.course.sec'}; |
|
} |
|
|
|
# Check group privs. |
|
$cgroup=$env{'form.cgroup'}; |
$cgroup=$env{'form.cgroup'}; |
my $noeditgrp; |
|
if ($cgroup ne '') { |
|
unless (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
|
if (($env{'request.course.groups'} eq '') || |
|
(!grep(/^\Q$cgroup\E$/,split(/:/,$env{'request.course.groups'})))) { |
|
$noeditgrp = 1; |
|
} |
|
} |
|
} |
|
|
|
if ($udom=$env{'form.udom'}) { |
if ($udom=$env{'form.udom'}) { |
} elsif ($udom=$env{'request.role.domain'}) { |
} elsif ($udom=$env{'request.role.domain'}) { |
Line 2113 sub assessparms {
|
Line 2050 sub assessparms {
|
|
|
|
|
my @psprt=&Apache::loncommon::get_env_multiple('form.psprt'); |
my @psprt=&Apache::loncommon::get_env_multiple('form.psprt'); |
if (!@psprt) { $psprt[0]='0'; } |
if (!@psprt) { $psprt[0]='all'; } |
if (($env{'form.part'}) && ($psprt[0] ne 'all')) { $psprt[0]=$env{'form.part'}; } |
if (($env{'form.part'}) && ($psprt[0] ne 'all')) { $psprt[0]=$env{'form.part'}; } |
|
|
my $pssymb=''; |
my $pssymb=''; |
Line 2170 sub assessparms {
|
Line 2107 sub assessparms {
|
$csec=&Apache::lonnet::getsection($udom,$uname, |
$csec=&Apache::lonnet::getsection($udom,$uname, |
$env{'request.course.id'}); |
$env{'request.course.id'}); |
if ($csec eq '-1') { |
if ($csec eq '-1') { |
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
$message='<span class="LC_error">'. |
if ($env{'form.userroles'} eq 'any') { |
&mt("User")." '$uname' ".&mt("at domain")." '$udom' ". |
if (($env{'user.name'} eq $uname) && ($env{'user.domain'} eq $udom)) { |
&mt("not in this course")."</span>"; |
$csec = $env{'request.course.sec'}; |
$uname=''; |
$message = '<span class="LC_info">'; |
$csec=$env{'form.csec'}; |
if ($crstype eq 'Community') { |
|
$message .= &mt('User [_1] at domain [_2] has a non-member role in this community', |
|
$uname,$udom); |
|
} else { |
|
$message .= &mt('User [_1] at domain [_2] has a non-student role in this course', |
|
$uname,$udom); |
|
} |
|
$message .= '</span>'; |
|
} else { |
|
my @possroles = ('in','ep','ta','cr'); |
|
if ($crstype eq 'Community') { |
|
unshift(@possroles,'co'); |
|
} else { |
|
unshift(@possroles,'cc'); |
|
} |
|
my %not_student_roles = |
|
&Apache::lonnet::get_my_roles($uname,$udom,'userroles',['active'], |
|
\@possroles,[$udom],1,1); |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my %sections_by_role; |
|
foreach my $role (keys(%not_student_roles)) { |
|
if ($role =~ /^\Q$cnum:$cdom:\E([^:]+):(|[^:]+)$/) { |
|
my ($rolename,$sec) = ($1,$2); |
|
if ($rolename =~ m{^cr/}) { |
|
$rolename = 'cr'; |
|
} |
|
push(@{$sections_by_role{$rolename}},$sec); |
|
} |
|
} |
|
my $numroles = scalar(keys(%sections_by_role)); |
|
if ($numroles) { |
|
foreach my $role (@possroles) { |
|
if (ref($sections_by_role{$role}) eq 'ARRAY') { |
|
my @secs = sort { $a <=> $b } @{$sections_by_role{$role}}; |
|
$csec = $secs[0]; |
|
last; |
|
} |
|
} |
|
} |
|
if ($csec eq '-1') { |
|
$message = '<span class="LC_warning">'; |
|
if ($crstype eq 'Community') { |
|
$message .= &mt('User [_1] at domain [_2] does not have a role in this community', |
|
$uname,$udom); |
|
} else { |
|
$message .= &mt('User [_1] at domain [_2] does not have a role in this course', |
|
$uname,$udom); |
|
} |
|
$message .= '</span>'; |
|
$uname=''; |
|
if ($env{'request.course.sec'} ne '') { |
|
$csec=$env{'request.course.sec'}; |
|
} else { |
|
$csec=$env{'form.csec'}; |
|
} |
|
$cgroup=$env{'form.cgroup'}; |
|
} else { |
|
$message = '<span class="LC_info">'; |
|
if ($crstype eq 'Community') { |
|
$message .= &mt('User [_1] at domain [_2] has a non-member role in this community', |
|
$uname,$udom); |
|
} else { |
|
$message .= &mt('User [_1] at domain [_2] has a non-student role in this course', |
|
$uname,$udom); |
|
} |
|
$message .= '</span>'; |
|
} |
|
} |
|
} else { |
|
$message = '<span class="LC_warning">'; |
|
if ($crstype eq 'Community') { |
|
$message .= &mt('User [_1] at domain [_2] does not have a member role in this community', |
|
$uname,$udom); |
|
} else { |
|
$message .= &mt('User [_1] at domain [_2] does not have a student role in this course', |
|
$uname,$udom); |
|
} |
|
$message .= '</span>'; |
|
$uname=''; |
|
if ($env{'request.course.sec'} ne '') { |
|
$csec=$env{'request.course.sec'}; |
|
} else { |
|
$csec=$env{'form.csec'}; |
|
} |
|
$cgroup=$env{'form.cgroup'}; |
|
} |
|
} elsif ($env{'request.course.sec'} ne '') { |
|
if ($csec ne $env{'request.course.sec'}) { |
|
$message='<span class="LC_warning">'. |
|
&mt("User '[_1]' at domain '[_2]' not in section '[_3]'", |
|
$uname,$udom,$env{'request.course.sec'}). |
|
'</span>'; |
|
$uname=''; |
|
$csec=$env{'request.course.sec'}; |
|
} |
|
$cgroup=$env{'form.cgroup'}; |
$cgroup=$env{'form.cgroup'}; |
} |
} else { |
if ($uname ne '') { |
|
my %name=&Apache::lonnet::userenvironment($udom,$uname, |
my %name=&Apache::lonnet::userenvironment($udom,$uname, |
('firstname','middlename','lastname','generation','id')); |
('firstname','middlename','lastname','generation','id')); |
$message .= "\n<p>\n".&mt('Full Name').': ' |
$message="\n<p>\n".&mt("Full Name").": ". |
.$name{'firstname'}.' '.$name{'middlename'}.' ' |
$name{'firstname'}.' '.$name{'middlename'}.' ' |
.$name{'lastname'}.' '.$name{'generation'} |
.$name{'lastname'}.' '.$name{'generation'}. |
."<br />\n".&mt('Student/Employee ID').': '.$name{'id'}.'</p>'; |
"<br />\n".&mt('Student/Employee ID').": ".$name{'id'}.'<p>'; |
@usersgroups = &Apache::lonnet::get_users_groups( |
} |
$udom,$uname,$env{'request.course.id'}); |
@usersgroups = &Apache::lonnet::get_users_groups( |
if (@usersgroups > 0) { |
$udom,$uname,$env{'request.course.id'}); |
unless (grep(/^\Q$cgroup\E$/,@usersgroups)) { |
if (@usersgroups > 0) { |
$cgroup = $usersgroups[0]; |
unless (grep(/^\Q$cgroup\E$/,@usersgroups)) { |
} |
$cgroup = $usersgroups[0]; |
} else { |
|
$cgroup = ''; |
|
} |
} |
} |
} |
} |
} |
Line 2305 sub assessparms {
|
Line 2143 sub assessparms {
|
$symbp{'0.0'} = ''; |
$symbp{'0.0'} = ''; |
|
|
# ---------------------------------------------------------- Anything to store? |
# ---------------------------------------------------------- Anything to store? |
if ($env{'form.pres_marker'} && $parm_permission->{'edit'}) { |
if ($env{'form.pres_marker'}) { |
my @markers=split(/\&\&\&/,$env{'form.pres_marker'}); |
my @markers=split(/\&\&\&/,$env{'form.pres_marker'}); |
my @values=split(/\&\&\&/,$env{'form.pres_value'}); |
my @values=split(/\&\&\&/,$env{'form.pres_value'}); |
my @types=split(/\&\&\&/,$env{'form.pres_type'}); |
my @types=split(/\&\&\&/,$env{'form.pres_type'}); |
Line 2314 sub assessparms {
|
Line 2152 sub assessparms {
|
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my $totalstored = 0; |
my $totalstored = 0; |
my $totalskippeduser = 0; |
|
my $now = time; |
|
for (my $i=0;$i<=$#markers;$i++) { |
for (my $i=0;$i<=$#markers;$i++) { |
my ($needsrelease,$needsnewer,$name); |
my ($needsrelease,$needsnewer,$name); |
if (($env{'request.course.sec'} ne '') && ($markers[$i] =~ /\&(7|8|9)$/)) { |
|
next if ($csec ne $env{'request.course.sec'}); |
|
} |
|
if ($markers[$i] =~ /\&(6|5|4)$/) { |
|
next if ($noeditgrp); |
|
} elsif ($markers[$i] =~ /\&(3|2|1)$/) { |
|
if ($uname eq '') { |
|
$totalskippeduser ++; |
|
next; |
|
} |
|
} |
|
if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) { |
if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) { |
my (@ok_slots,@fail_slots,@del_slots); |
my (@ok_slots,@fail_slots,@del_slots); |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); |
Line 2359 sub assessparms {
|
Line 2186 sub assessparms {
|
} |
} |
} |
} |
} |
} |
} elsif ($markers[$i] =~ /_(type|lenient|retrypartial|discussvote|examcode|printstartdate|printenddate)\&\d+$/) { |
} elsif ($markers[$i] =~ /_(type|lenient|retrypartial|discussvote)\&\d+$/) { |
$name = $1; |
$name = $1; |
my $val = $values[$i]; |
|
if ($name eq 'examcode') { |
|
if (&Apache::lonnet::validCODE($values[$i])) { |
|
$val = 'valid'; |
|
} |
|
} elsif ($name eq 'printstartdate') { |
|
if ($val =~ /^\d+$/) { |
|
if ($val > $now) { |
|
$val = 'future'; |
|
} |
|
} |
|
} elsif ($name eq 'printenddate') { |
|
if ($val =~ /^\d+$/) { |
|
if ($val < $now) { |
|
$val = 'past'; |
|
} |
|
} |
|
} |
|
$needsrelease = |
$needsrelease = |
$Apache::lonnet::needsrelease{"parameter:$name:$val"}; |
$Apache::lonnet::needsrelease{"parameter:$name:$values[$i]"}; |
if ($needsrelease) { |
if ($needsrelease) { |
unless ($got_chostname) { |
unless ($got_chostname) { |
($chostname,$cmajor,$cminor) = ¶meter_release_vars(); |
($chostname,$cmajor,$cminor) = ¶meter_release_vars(); |
$got_chostname = 1; |
$got_chostname = 1; |
} |
} |
$needsnewer = ¶meter_releasecheck($name,$val, |
$needsnewer = ¶meter_releasecheck($name,$values[$i], |
$needsrelease, |
$needsrelease, |
|
$chostname, |
$cmajor,$cminor); |
$cmajor,$cminor); |
} |
} |
} |
} |
Line 2405 sub assessparms {
|
Line 2215 sub assessparms {
|
# ---------------------------------------------------------------- Done storing |
# ---------------------------------------------------------------- Done storing |
if ($totalstored) { |
if ($totalstored) { |
$message.='<p class="LC_warning">' |
$message.='<p class="LC_warning">' |
.&mt('Changes for [quant,_1,parameter] saved.',$totalstored) |
|
.'<br />' |
|
.&mt('Changes can take up to 10 minutes before being active for all students.') |
.&mt('Changes can take up to 10 minutes before being active for all students.') |
.&Apache::loncommon::help_open_topic('Caching') |
.&Apache::loncommon::help_open_topic('Caching') |
.'</p>'; |
.'</p>'; |
} else { |
|
$message.='<p class="LC_info">'.&mt('No parameter changes saved.').'</p>'; |
|
} |
|
if ($totalskippeduser) { |
|
$message .= '<p class="LC_warning">'; |
|
if ($uhome eq 'no_host') { |
|
$message .= &mt('Changes for [quant,_1,user-specific parameter] not saved because the username or ID was invalid.', |
|
$totalskippeduser); |
|
} elsif ($env{'form.userroles'} eq 'any') { |
|
$message .= &mt('Changes for [quant,_1,user-specific parameter] not saved because the user does not have a course role.', |
|
$totalskippeduser); |
|
} else { |
|
$message .= &mt('Changes for [quant,_1,user-specific parameter] not saved because the user is not a student.', |
|
$totalskippeduser); |
|
} |
|
$message .= '</p>'; |
|
} |
} |
} |
} |
#----------------------------------------------- if all selected, fill in array |
#----------------------------------------------- if all selected, fill in array |
Line 2477 ENDPARMSELSCRIPT
|
Line 2269 ENDPARMSELSCRIPT
|
$r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel')); |
$r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel')); |
&levelmenu($r,\%alllevs,$parmlev); |
&levelmenu($r,\%alllevs,$parmlev); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp,$parmlev); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles, \%symbp); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
&partmenu($r,\%allparts,\@psprt); |
&partmenu($r,\%allparts,\@psprt); |
Line 2486 ENDPARMSELSCRIPT
|
Line 2278 ENDPARMSELSCRIPT
|
|
|
# Step 2 |
# Step 2 |
$r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2')); |
$r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2')); |
&displaymenu($r,\%allparms,\@pscat,\%keyorder,'parmmenuscroll'); |
&displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder); |
|
|
# Step 3 |
# Step 3 |
$r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3')); |
$r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3')); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups,$pssymb); |
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
|
Line 2524 ENDPARMSELSCRIPT
|
Line 2316 ENDPARMSELSCRIPT
|
'<br />'); |
'<br />'); |
$r->print(&Apache::lonhtmlcommon::topic_bar('',&mt('Additional Display Specification (optional)'))); |
$r->print(&Apache::lonhtmlcommon::topic_bar('',&mt('Additional Display Specification (optional)'))); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View')). |
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); |
'<label>'. |
|
'<input type="checkbox" name="psprt" value="all"'. |
|
($env{'form.psprt'}?' checked="checked"':'').' />'. |
|
&mt('Show all parts'). |
|
'</label></td></tr>'); |
|
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups,$pssymb); |
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print('<p>' |
$r->print('<p>' |
Line 2559 ENDPARMSELSCRIPT
|
Line 2345 ENDPARMSELSCRIPT
|
my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat; |
my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat; |
my $csuname=$env{'user.name'}; |
my $csuname=$env{'user.name'}; |
my $csudom=$env{'user.domain'}; |
my $csudom=$env{'user.domain'}; |
my $readonly = 1; |
|
if ($parm_permission->{'edit'}) { |
|
undef($readonly); |
|
} |
|
|
|
if ($parmlev eq 'full') { |
if ($parmlev eq 'full') { |
# |
# |
Line 2748 ENDTABLEHEADFOUR
|
Line 2530 ENDTABLEHEADFOUR
|
&print_row($r,$_,\%part,\%name,\%symbp,$rid,\%default, |
&print_row($r,$_,\%part,\%name,\%symbp,$rid,\%default, |
\%type,\%display,$defbgone,$defbgtwo, |
\%type,\%display,$defbgone,$defbgtwo, |
$defbgthree,$parmlev,$uname,$udom,$csec, |
$defbgthree,$parmlev,$uname,$udom,$csec, |
$cgroup,\@usersgroups,$noeditgrp,$readonly); |
$cgroup,\@usersgroups); |
} |
} |
} |
} |
} |
} |
Line 2772 ENDTABLEHEADFOUR
|
Line 2554 ENDTABLEHEADFOUR
|
|
|
#-------------------------------------------- for each map, gather information |
#-------------------------------------------- for each map, gather information |
my $mapid; |
my $mapid; |
foreach $mapid (sort { $a <=> $b } keys(%maplist)) { |
foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys %maplist) { |
my $maptitle = $maplist{$mapid}; |
my $maptitle = $maplist{$mapid}; |
|
|
#----------------------- loop through ids and get all parameter types for map |
#----------------------- loop through ids and get all parameter types for map |
Line 2871 ENDTABLEHEADFOUR
|
Line 2653 ENDTABLEHEADFOUR
|
$r->print(&Apache::loncommon::start_data_table_row()); |
$r->print(&Apache::loncommon::start_data_table_row()); |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
$parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp, |
$parmlev,$uname,$udom,$csec,$cgroup); |
$readonly); |
|
} |
} |
$r->print(&Apache::loncommon::end_data_table().'</p>' |
$r->print(&Apache::loncommon::end_data_table().'</p>' |
.'</div>' |
.'</div>' |
Line 2962 ENDMAPONE
|
Line 2743 ENDMAPONE
|
foreach (&keysinorder(\%name,\%keyorder)) { |
foreach (&keysinorder(\%name,\%keyorder)) { |
$r->print(&Apache::loncommon::start_data_table_row()); |
$r->print(&Apache::loncommon::start_data_table_row()); |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
&print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
\%type,\%display,$defbgone,$defbgtwo,$defbgthree, |
$parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp, |
$parmlev,$uname,$udom,$csec,$cgroup); |
$readonly); |
|
} |
} |
$r->print(&Apache::loncommon::end_data_table() |
$r->print(&Apache::loncommon::end_data_table() |
.'</p>' |
.'</p>' |
Line 2973 ENDMAPONE
|
Line 2753 ENDMAPONE
|
} # end of $parmlev eq general |
} # end of $parmlev eq general |
} |
} |
$r->print('</form>'); |
$r->print('</form>'); |
|
&endSettingsScreen($r); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} # end sub assessparms |
} # end sub assessparms |
|
|
Line 2982 ENDMAPONE
|
Line 2763 ENDMAPONE
|
my $tableopen; |
my $tableopen; |
|
|
sub tablestart { |
sub tablestart { |
my ($readonly) = @_; |
|
if ($tableopen) { |
if ($tableopen) { |
return ''; |
return ''; |
} else { |
} else { |
$tableopen=1; |
$tableopen=1; |
my $output = &Apache::loncommon::start_data_table().'<tr><th>'.&mt('Parameter').'</th>'; |
return &Apache::loncommon::start_data_table().'<tr><th>'.&mt('Parameter').'</th><th>'. |
if ($readonly) { |
&mt('Delete').'</th><th>'.&mt('Set to ...').'</th></tr>'; |
$output .= '<th>'.&mt('Current value').'</th>'; |
|
} else { |
|
$output .= '<th>'.&mt('Delete').'</th><th>'.&mt('Set to ...').'</th>'; |
|
} |
|
$output .= '</tr>'; |
|
return $output; |
|
} |
} |
} |
} |
|
|
Line 3027 sub readdata {
|
Line 2801 sub readdata {
|
} |
} |
} |
} |
} |
} |
if (wantarray) { |
return $resourcedata; |
return ($resourcedata,$classlist); |
|
} else { |
|
return $resourcedata; |
|
} |
|
} |
} |
|
|
|
|
Line 3047 sub storedata {
|
Line 2817 sub storedata {
|
my @deldata=(); |
my @deldata=(); |
undef @deldata; |
undef @deldata; |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my $now = time; |
|
foreach my $key (keys(%env)) { |
foreach my $key (keys(%env)) { |
if ($key =~ /^form\.([a-z]+)\_(.+)$/) { |
if ($key =~ /^form\.([a-z]+)\_(.+)$/) { |
my $cmd=$1; |
my $cmd=$1; |
Line 3058 sub storedata {
|
Line 2827 sub storedata {
|
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; |
} |
} |
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { |
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { |
my ($data, $typeof, $text, $name, $valchk); |
my ($data, $typeof, $text, $name); |
if ($cmd eq 'set') { |
if ($cmd eq 'set') { |
$data=$env{$key}; |
$data=$env{$key}; |
$valchk = $data; |
|
$typeof=$env{'form.typeof_'.$thiskey}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$text = &mt('Saved modified parameter for'); |
$text = &mt('Saved modified parameter for'); |
if ($typeof eq 'string_questiontype') { |
if ($typeof eq 'string_questiontype') { |
Line 3070 sub storedata {
|
Line 2838 sub storedata {
|
$name = 'lenient'; |
$name = 'lenient'; |
} elsif ($typeof eq 'string_discussvote') { |
} elsif ($typeof eq 'string_discussvote') { |
$name = 'discussvote'; |
$name = 'discussvote'; |
} elsif ($typeof eq 'string_examcode') { |
|
$name = 'examcode'; |
|
if (&Apache::lonnet::validCODE($data)) { |
|
$valchk = 'valid'; |
|
} |
|
} elsif ($typeof eq 'string_yesno') { |
} elsif ($typeof eq 'string_yesno') { |
if ($thiskey =~ /\.retrypartial$/) { |
if ($thiskey =~ /\.retrypartial$/) { |
$name = 'retrypartial'; |
$name = 'retrypartial'; |
} |
} |
} |
} |
} elsif ($cmd eq 'datepointer') { |
if ($name ne '') { |
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$key}); |
my ($needsrelease,$needsnewer); |
$typeof=$env{'form.typeof_'.$thiskey}; |
$needsrelease = $Apache::lonnet::needsrelease{"parameter:$name:$data"}; |
$text = &mt('Saved modified date for'); |
if ($needsrelease) { |
if ($typeof eq 'date_start') { |
unless ($got_chostname) { |
if ($thiskey =~ /\.printstartdate$/) { |
($chostname,$cmajor,$cminor)=¶meter_release_vars(); |
$name = 'printstartdate'; |
$got_chostname = 1; |
if (($data) && ($data > $now)) { |
|
$valchk = 'future'; |
|
} |
|
} |
|
} elsif ($typeof eq 'date_end') { |
|
if ($thiskey =~ /\.printenddate$/) { |
|
$name = 'printenddate'; |
|
if (($data) && ($data < $now)) { |
|
$valchk = 'past'; |
|
} |
} |
|
$needsnewer = ¶meter_releasecheck($name,$data, |
|
$needsrelease, |
|
$chostname,$cmajor, |
|
$cminor); |
} |
} |
} |
|
} elsif ($cmd eq 'dateinterval') { |
|
$data=&get_date_interval_from_form($thiskey); |
|
$typeof=$env{'form.typeof_'.$thiskey}; |
|
$text = &mt('Saved modified date for'); |
|
} |
|
if ($name ne '') { |
|
my ($needsrelease,$needsnewer); |
|
$needsrelease = $Apache::lonnet::needsrelease{"parameter:$name:$valchk"}; |
|
if ($needsrelease) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor)=¶meter_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
$needsnewer = ¶meter_releasecheck($name,$valchk, |
|
$needsrelease, |
|
$cmajor,$cminor); |
|
if ($needsnewer) { |
if ($needsnewer) { |
$r->print('<br />'.&oldversion_warning($name,$data, |
$r->print('<br />'.&oldversion_warning($name,$data, |
$chostname,$cmajor, |
$chostname,$cmajor, |
Line 3122 sub storedata {
|
Line 2863 sub storedata {
|
next; |
next; |
} |
} |
} |
} |
|
} elsif ($cmd eq 'datepointer') { |
|
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$key}); |
|
$typeof=$env{'form.typeof_'.$thiskey}; |
|
$text = &mt('Saved modified date for'); |
|
} elsif ($cmd eq 'dateinterval') { |
|
$data=&get_date_interval_from_form($thiskey); |
|
$typeof=$env{'form.typeof_'.$thiskey}; |
|
$text = &mt('Saved modified date for'); |
} |
} |
if (defined($data) and $$olddata{$thiskey} ne $data) { |
if (defined($data) and $$olddata{$thiskey} ne $data) { |
if ($tuname) { |
if ($tuname) { |
Line 3165 sub storedata {
|
Line 2914 sub storedata {
|
if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') { |
if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') { |
my %loghash=map { $_ => '' } @deldata; |
my %loghash=map { $_ => '' } @deldata; |
&log_parmset(\%loghash,1); |
&log_parmset(\%loghash,1); |
$r->print('<h2>'.&mt('Deleted [quant,_1,parameter]',$delentries/2).'</h2>'); |
$r->print('<h2>'.&mt('Deleted [_1] parameter(s)',$delentries).'</h2>'); |
} else { |
} else { |
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'. |
&mt('Error deleting parameters').'</div>'); |
&mt('Error deleting parameters').'</div>'); |
Line 3175 sub storedata {
|
Line 2924 sub storedata {
|
if ($putentries) { |
if ($putentries) { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
&log_parmset(\%newdata,0); |
&log_parmset(\%newdata,0); |
$r->print('<h3>'.&mt('Saved [quant,_1,parameter]',$putentries/2).'</h3>'); |
$r->print('<h3>'.&mt('Saved [_1] parameter(s)',$putentries/2).'</h3>'); |
} else { |
} else { |
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'. |
&mt('Error saving parameters').'</div>'); |
&mt('Error saving parameters').'</div>'); |
Line 3210 sub parse_listdata_key {
|
Line 2959 sub parse_listdata_key {
|
} |
} |
|
|
sub listdata { |
sub listdata { |
my ($r,$resourcedata,$listdata,$sortorder,$caller,$classlist,$readonly)=@_; |
my ($r,$resourcedata,$listdata,$sortorder)=@_; |
# Start list output |
# Start list output |
|
|
my $oldsection=''; |
my $oldsection=''; |
Line 3220 sub listdata {
|
Line 2969 sub listdata {
|
$tableopen=0; |
$tableopen=0; |
my $foundkeys=0; |
my $foundkeys=0; |
my %keyorder=&standardkeyorder(); |
my %keyorder=&standardkeyorder(); |
my $readonlyall = $readonly; |
|
|
|
my ($secidx,%grouphash); |
|
if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { |
|
$secidx = &Apache::loncoursedata::CL_SECTION(); |
|
if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
|
%grouphash = &Apache::longroup::coursegroups(); |
|
} elsif ($env{'request.course.groups'} ne '') { |
|
map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'}); |
|
} |
|
} |
|
|
|
foreach my $thiskey (sort { |
foreach my $thiskey (sort { |
my ($astudent,$ares,$apart,$aparm) = &parse_listdata_key($a,$listdata); |
my ($astudent,$ares,$apart,$aparm) = &parse_listdata_key($a,$listdata); |
Line 3274 sub listdata {
|
Line 3012 sub listdata {
|
} keys %{$listdata}) { |
} keys %{$listdata}) { |
|
|
if ($$listdata{$thiskey.'.type'}) { |
if ($$listdata{$thiskey.'.type'}) { |
my $thistype=$$listdata{$thiskey.'.type'}; |
my $thistype=$$listdata{$thiskey.'.type'}; |
if ($$resourcedata{$thiskey.'.type'}) { |
if ($$resourcedata{$thiskey.'.type'}) { |
$thistype=$$resourcedata{$thiskey.'.type'}; |
$thistype=$$resourcedata{$thiskey.'.type'}; |
} |
} |
my ($middle,$part,$name)= |
my ($middle,$part,$name)= |
($thiskey=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
($thiskey=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
my $section=&mt('All Students'); |
my $section=&mt('All Students'); |
$readonly = $readonlyall; |
|
my $userscope; |
|
my $showval = $$resourcedata{$thiskey}; |
|
if ($middle=~/^\[(.*)\]/) { |
if ($middle=~/^\[(.*)\]/) { |
my $issection=$1; |
my $issection=$1; |
if ($issection=~/^useropt\:($match_username)\:($match_domain)/) { |
if ($issection=~/^useropt\:($match_username)\:($match_domain)/) { |
my ($stuname,$studom) = ($1,$2); |
$section=&mt('User').": ".&Apache::loncommon::plainname($1,$2); |
if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { |
} else { |
if (ref($classlist) eq 'HASH') { |
$section=&mt('Group/Section').': '.$issection; |
if (ref($classlist->{$stuname.':'.$studom}) eq 'ARRAY') { |
} |
next unless ($classlist->{$stuname.':'.$studom}->[$secidx] eq $env{'request.course.sec'}); |
$middle=~s/^\[(.*)\]//; |
} |
|
} |
|
} |
|
$section=&mt('User').": ".&Apache::loncommon::plainname($1,$2); |
|
$userscope = 1; |
|
} else { |
|
if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { |
|
if (exists($grouphash{$issection})) { |
|
$section=&mt('Group').': '.$issection; |
|
} elsif ($issection eq $env{'request.course.sec'}) { |
|
$section = &mt('Section').': '.$issection; |
|
} else { |
|
next; |
|
} |
|
} else { |
|
$section=&mt('Group/Section').': '.$issection; |
|
} |
|
} |
|
$middle=~s/^\[(.*)\]//; |
|
} elsif (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { |
|
$readonly = 1; |
|
} |
} |
$middle=~s/\.+$//; |
$middle=~s/\.+$//; |
$middle=~s/^\.+//; |
$middle=~s/^\.+//; |
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
|
|
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
$realm='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><span class="LC_parm_folder">('.$1.')</span></span>'; |
$realm='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><span class="LC_parm_folder">('.$1.')</span></span>'; |
} elsif ($middle) { |
} elsif ($middle) { |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
next if (($url =~ /\.(page|sequence)$/) && ($parmlev eq 'full') && ($caller eq 'newoverview')); |
|
$realm='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>'; |
$realm='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>'; |
} |
} |
if ($sortorder eq 'realmstudent') { |
if ($sortorder eq 'realmstudent') { |
Line 3357 sub listdata {
|
Line 3069 sub listdata {
|
# Ready to print |
# Ready to print |
# |
# |
my $parmitem = &standard_parameter_names($name); |
my $parmitem = &standard_parameter_names($name); |
$r->print(&tablestart($readonly). |
$r->print(&tablestart(). |
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td><b>'.&mt($parmitem). |
'<td><b>'.&mt($parmitem). |
'</b></td>'); |
'</b></td><td><input type="checkbox" name="del_'. |
unless ($readonly) { |
$thiskey.'" /></td><td>'); |
my $disabled; |
|
if (($name eq 'availablestudent') && |
|
(($showval eq '') || ($userscope))) { |
|
$disabled = ' disabled="disabled"'; |
|
} |
|
$r->print('<td><input type="checkbox" name="del_'. |
|
$thiskey.'"'.$disabled.' /></td>'); |
|
} |
|
$r->print('<td>'); |
|
$foundkeys++; |
$foundkeys++; |
if (&isdateparm($thistype)) { |
if (&isdateparm($thistype)) { |
my $jskey='key_'.$pointer; |
my $jskey='key_'.$pointer; |
my $state; |
$pointer++; |
$pointer++; |
$r->print( |
if ($readonly) { |
&Apache::lonhtmlcommon::date_setter('parmform', |
$state = 'disabled'; |
$jskey, |
} |
$$resourcedata{$thiskey}, |
$r->print( |
'',1,'',''). |
&Apache::lonhtmlcommon::date_setter('parmform', |
|
$jskey, |
|
$$resourcedata{$thiskey}, |
|
'',1,$state)); |
|
unless ($readonly) { |
|
$r->print( |
|
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
(($$resourcedata{$thiskey}!=0)?'<span class="LC_nobreak"><a href="/adm/parmset?&action=dateshift1&timebase='.$$resourcedata{$thiskey}.'">'. |
(($$resourcedata{$thiskey}!=0)?'<span class="LC_nobreak"><a href="/adm/parmset?&action=dateshift1&timebase='.$$resourcedata{$thiskey}.'">'. |
&mt('Shift all dates based on this date').'</a></span>':''). |
&mt('Shift all dates based on this date').'</a></span>':''). |
&date_sanity_info($$resourcedata{$thiskey}) |
&date_sanity_info($$resourcedata{$thiskey}) |
); |
); |
} |
|
} elsif ($thistype eq 'date_interval') { |
} elsif ($thistype eq 'date_interval') { |
$r->print(&date_interval_selector($thiskey, |
$r->print(&date_interval_selector($thiskey, |
$$resourcedata{$thiskey},$readonly)); |
$$resourcedata{$thiskey})); |
} elsif ($thistype =~ m/^string/) { |
} elsif ($thistype =~ m/^string/) { |
if ($name eq 'availablestudent') { |
$r->print(&string_selector($thistype,$thiskey, |
$readonly = 1; |
$$resourcedata{$thiskey},$name)); |
} |
|
$r->print(&string_selector($thistype,$thiskey, |
|
$$resourcedata{$thiskey},$name,$readonly)); |
|
} else { |
} else { |
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey},$readonly)); |
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); |
} |
|
unless ($readonly) { |
|
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
|
$thistype.'" />'); |
|
} |
} |
|
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
|
$thistype.'" />'); |
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
} |
} |
} |
} |
Line 3416 sub listdata {
|
Line 3107 sub listdata {
|
|
|
|
|
sub date_interval_selector { |
sub date_interval_selector { |
my ($thiskey, $showval, $readonly) = @_; |
my ($thiskey, $showval) = @_; |
my $result; |
my $result; |
my $currval = $showval; |
|
foreach my $which (['days', 86400, 31], |
foreach my $which (['days', 86400, 31], |
['hours', 3600, 23], |
['hours', 3600, 23], |
['minutes', 60, 59], |
['minutes', 60, 59], |
['seconds', 1, 59]) { |
['seconds', 1, 59]) { |
my ($name, $factor, $max) = @{ $which }; |
my ($name, $factor, $max) = @{ $which }; |
my $amount = int($showval/$factor); |
my $amount = int($showval/$factor); |
$showval %= $factor; |
$showval %= $factor; |
my %select = ((map {$_ => $_} (0..$max)), |
my %select = ((map {$_ => $_} (0..$max)), |
'select_form_order' => [0..$max]); |
'select_form_order' => [0..$max]); |
if ($currval eq '') { |
$result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey, |
unshift(@{$select{'select_form_order'}},''); |
\%select); |
$select{''} = ''; |
$result .= ' '.&mt($name); |
$amount = ''; |
|
} |
|
$result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey, |
|
\%select,'',$readonly); |
|
$result .= ' '.&mt($name); |
|
} |
|
unless ($readonly) { |
|
$result .= '<input type="hidden" name="dateinterval_'.$thiskey.'" />'; |
|
} |
} |
|
$result .= '<input type="hidden" name="dateinterval_'.$thiskey.'" />'; |
return $result; |
return $result; |
|
|
} |
} |
Line 3447 sub date_interval_selector {
|
Line 3130 sub date_interval_selector {
|
sub get_date_interval_from_form { |
sub get_date_interval_from_form { |
my ($key) = @_; |
my ($key) = @_; |
my $seconds = 0; |
my $seconds = 0; |
my $numnotnull = 0; |
|
foreach my $which (['days', 86400], |
foreach my $which (['days', 86400], |
['hours', 3600], |
['hours', 3600], |
['minutes', 60], |
['minutes', 60], |
['seconds', 1]) { |
['seconds', 1]) { |
my ($name, $factor) = @{ $which }; |
my ($name, $factor) = @{ $which }; |
if (defined($env{'form.'.$name.'_'.$key})) { |
if (defined($env{'form.'.$name.'_'.$key})) { |
unless ($env{'form.'.$name.'_'.$key} eq '') { |
$seconds += $env{'form.'.$name.'_'.$key} * $factor; |
$numnotnull ++; |
} |
$seconds += $env{'form.'.$name.'_'.$key} * $factor; |
|
} |
|
} |
|
} |
} |
return if (!$numnotnull); |
|
return $seconds; |
return $seconds; |
} |
} |
|
|
|
|
sub default_selector { |
sub default_selector { |
my ($thiskey, $showval, $readonly) = @_; |
my ($thiskey, $showval) = @_; |
my $disabled; |
return '<input type="text" name="set_'.$thiskey.'" value="'.$showval.'" />'; |
if ($readonly) { |
|
$disabled = ' disabled="disabled"'; |
|
} |
|
return '<input type="text" name="set_'.$thiskey.'" value="'.$showval.'"'.$disabled.' />'; |
|
} |
} |
|
|
my %strings = |
my %strings = |
Line 3512 sub standard_string_options {
|
Line 3186 sub standard_string_options {
|
} |
} |
|
|
sub string_selector { |
sub string_selector { |
my ($thistype, $thiskey, $showval, $name, $readonly) = @_; |
my ($thistype, $thiskey, $showval, $name) = @_; |
|
|
if (!exists($strings{$thistype})) { |
if (!exists($strings{$thistype})) { |
return &default_selector($thiskey,$showval,$readonly); |
return &default_selector($thiskey,$showval); |
} |
} |
|
|
my %skiptype; |
my %skiptype; |
Line 3534 sub string_selector {
|
Line 3208 sub string_selector {
|
$got_chostname = 1; |
$got_chostname = 1; |
} |
} |
my $needsnewer=¶meter_releasecheck($name,$parmval,$needsrelease, |
my $needsnewer=¶meter_releasecheck($name,$parmval,$needsrelease, |
$cmajor,$cminor); |
$chostname,$cmajor, |
|
$cminor); |
if ($needsnewer) { |
if ($needsnewer) { |
$skiptype{$parmval} = 1; |
$skiptype{$parmval} = 1; |
} |
} |
} |
} |
} |
} |
} |
} |
|
|
my ($result,$disabled); |
|
|
|
if ($readonly) { |
my $result; |
$disabled = ' disabled="disabled"'; |
|
} |
|
my $numinrow = 3; |
my $numinrow = 3; |
if ($thistype eq 'string_problemstatus') { |
if ($thistype eq 'string_problemstatus') { |
$numinrow = 2; |
$numinrow = 2; |
Line 3572 sub string_selector {
|
Line 3244 sub string_selector {
|
$result .= '<td class="LC_left_item">'. |
$result .= '<td class="LC_left_item">'. |
'<span class="LC_nobreak"><label>'. |
'<span class="LC_nobreak"><label>'. |
'<input type="radio" name="set_'.$thiskey. |
'<input type="radio" name="set_'.$thiskey. |
'" value="'.$name.'"'.$disabled; |
'" value="'.$name.'"'; |
if ($showval eq $name) { |
if ($showval eq $name) { |
$result .= ' checked="checked"'; |
$result .= ' checked="checked"'; |
} |
} |
Line 3600 sub string_selector {
|
Line 3272 sub string_selector {
|
# |
# |
|
|
sub dateshift { |
sub dateshift { |
my ($shift,$numchanges)=@_; |
my ($shift)=@_; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $sec = $env{'request.course.sec'}; |
|
my $secgrpregex; |
|
if ($sec ne '') { |
|
my @groups; |
|
if ($env{'request.course.groups'} ne '') { |
|
@groups = split(/:/,$env{'request.course.groups'}); |
|
} |
|
if (@groups) { |
|
$secgrpregex = '(?:'.join('|',($sec,@groups)).')'; |
|
} else { |
|
$secgrpregex = $sec; |
|
} |
|
} |
|
my %data=&Apache::lonnet::dump('resourcedata',$dom,$crs); |
my %data=&Apache::lonnet::dump('resourcedata',$dom,$crs); |
# ugly retro fix for broken version of types |
# ugly retro fix for broken version of types |
foreach my $key (keys %data) { |
foreach my $key (keys %data) { |
Line 3630 sub dateshift {
|
Line 3289 sub dateshift {
|
# go through all parameters and look for dates |
# go through all parameters and look for dates |
foreach my $key (keys %data) { |
foreach my $key (keys %data) { |
if ($data{$key.'.type'}=~/^date_(start|end)$/) { |
if ($data{$key.'.type'}=~/^date_(start|end)$/) { |
if ($sec ne '') { |
|
next unless ($key =~ /^$env{'request.course.id'}\.\[$secgrpregex\]\./); |
|
} |
|
my $newdate=$data{$key}+$shift; |
my $newdate=$data{$key}+$shift; |
$$numchanges ++; |
|
$storecontent{$key}=$newdate; |
$storecontent{$key}=$newdate; |
} |
} |
} |
} |
Line 3648 sub dateshift {
|
Line 3303 sub dateshift {
|
} |
} |
|
|
sub newoverview { |
sub newoverview { |
my ($r,$parm_permission) = @_; |
my ($r) = @_; |
|
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $readonly = 1; |
|
if ($parm_permission->{'edit'}) { |
|
undef($readonly); |
|
} |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
text=>"Overview Mode"}); |
text=>"Overview Mode"}); |
|
|
Line 3675 sub newoverview {
|
Line 3326 sub newoverview {
|
{'add_entries' => \%loaditems,}); |
{'add_entries' => \%loaditems,}); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
|
&startSettingsScreen($r,'parmset'); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
<form method="post" action="/adm/parmset?action=newoverview" name="parmform"> |
<form method="post" action="/adm/parmset?action=newoverview" name="parmform"> |
ENDOVER |
ENDOVER |
Line 3703 ENDOVER
|
Line 3355 ENDOVER
|
my $pschp=$env{'form.pschp'}; |
my $pschp=$env{'form.pschp'}; |
|
|
my @psprt=&Apache::loncommon::get_env_multiple('form.psprt'); |
my @psprt=&Apache::loncommon::get_env_multiple('form.psprt'); |
if (!@psprt) { $psprt[0]='0'; } |
if (!@psprt) { $psprt[0]='all'; } |
|
|
my @selected_sections = |
my @selected_sections = |
&Apache::loncommon::get_env_multiple('form.Section'); |
&Apache::loncommon::get_env_multiple('form.Section'); |
Line 3713 ENDOVER
|
Line 3365 ENDOVER
|
@selected_sections = ('all'); |
@selected_sections = ('all'); |
} |
} |
} |
} |
if ($env{'request.course.sec'} ne '') { |
|
@selected_sections = ($env{'request.course.sec'}); |
|
} |
|
my @selected_groups = |
my @selected_groups = |
&Apache::loncommon::get_env_multiple('form.Group'); |
&Apache::loncommon::get_env_multiple('form.Group'); |
|
|
Line 3742 ENDOVER
|
Line 3391 ENDOVER
|
$r->print('<div>'); |
$r->print('<div>'); |
$r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel')); |
$r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel')); |
&levelmenu($r,\%alllevs,$parmlev); |
&levelmenu($r,\%alllevs,$parmlev); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
if ($parmlev ne 'general') { |
&mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp,$parmlev); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
|
&mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp); |
|
} |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print('</div></div>'); |
$r->print('</div></div>'); |
Line 3753 ENDOVER
|
Line 3404 ENDOVER
|
&displaymenu($r,\%allparms,\@pscat,\%keyorder); |
&displaymenu($r,\%allparms,\@pscat,\%keyorder); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
my $sectionselector = §ionmenu(\@selected_sections); |
|
my $groupselector = &groupmenu(\@selected_groups); |
|
$r->print('<table>'. |
$r->print('<table>'. |
'<tr><th>'.&mt('Parts').'</th>'); |
'<tr><th>'.&mt('Parts').'</th><th>'.&mt('Section(s)'). |
if ($sectionselector) { |
'</th><th>'.&mt('Group(s)').'</th></tr><tr><td>'); |
$r->print('<th>'.&mt('Section(s)').'</th>'); |
|
} |
|
if ($groupselector) { |
|
$r->print('<th>'.&mt('Group(s)').'</th>'); |
|
} |
|
$r->print('</tr><tr><td>'); |
|
&partmenu($r,\%allparts,\@psprt); |
&partmenu($r,\%allparts,\@psprt); |
$r->print('</td>'); |
$r->print('</td><td>'); |
if ($sectionselector) { |
§ionmenu($r,\@selected_sections); |
$r->print('<td>'.$sectionselector.'</td>'); |
$r->print('</td><td>'); |
} |
&groupmenu($r,\@selected_groups); |
if ($groupselector) { |
$r->print('</td></tr></table>'); |
$r->print('<td>'.$groupselector.'</td>'); |
#$r->print('</td></tr></table>'); |
} |
|
$r->print('</tr></table>'); |
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
$r->print('</div></div>'); |
$r->print('</div></div>'); |
Line 3806 ENDOVER
|
Line 3447 ENDOVER
|
|
|
# List data |
# List data |
|
|
&listdata($r,$resourcedata,$listdata,$sortorder,'newoverview',undef,$readonly); |
&listdata($r,$resourcedata,$listdata,$sortorder); |
} |
} |
$r->print(&tableend()); |
$r->print(&tableend(). |
unless ($readonly) { |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Save').'" /></p>':''). |
$r->print(((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Save').'" /></p>':'')); |
'</form>'); |
} |
&endSettingsScreen($r); |
$r->print('</form>'); |
|
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
|
Line 3852 sub secgroup_lister {
|
Line 3492 sub secgroup_lister {
|
} |
} |
|
|
sub overview { |
sub overview { |
my ($r,$parm_permission) = @_; |
my ($r) = @_; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $readonly = 1; |
|
if ($parm_permission->{'edit'}) { |
|
undef($readonly); |
|
} |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
text=>"Overview Mode"}); |
text=>"Overview Mode"}); |
my $start_page=&Apache::loncommon::start_page('Modify Parameters'); |
my $start_page=&Apache::loncommon::start_page('Modify Parameters'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
|
&startSettingsScreen($r,'parmset'); |
$r->print('<form method="post" action="/adm/parmset?action=setoverview" name="parmform">'); |
$r->print('<form method="post" action="/adm/parmset?action=setoverview" name="parmform">'); |
|
|
# Store modified |
# Store modified |
unless ($readonly) { |
|
&storedata($r,$crs,$dom); |
&storedata($r,$crs,$dom); |
} |
|
|
|
# Read modified data |
# Read modified data |
|
|
my ($resourcedata,$classlist)=&readdata($crs,$dom); |
my $resourcedata=&readdata($crs,$dom); |
|
|
|
|
my $sortorder=$env{'form.sortorder'}; |
my $sortorder=$env{'form.sortorder'}; |
unless ($sortorder) { $sortorder='realmstudent'; } |
unless ($sortorder) { $sortorder='realmstudent'; } |
&sortmenu($r,$sortorder); |
&sortmenu($r,$sortorder); |
|
|
my $submitbutton = '<input type="submit" value="'.&mt('Save').'" />'; |
|
|
|
if ($readonly) { |
|
$r->print('<p>'.$submitbutton.'</p>'); |
|
} |
|
|
|
|
|
# List data |
# List data |
|
|
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder,'overview',$classlist,$readonly); |
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder); |
|
|
$r->print(&tableend().'<p>'); |
$r->print(&tableend().'<p>'. |
if ($foundkeys) { |
($foundkeys?'<input type="submit" value="'.&mt('Save').'" />':'<span class="LC_info">'.&mt('There are no parameters.').'</span>').'</p></form>'. |
unless ($readonly) { |
&Apache::loncommon::end_page()); |
$r->print('<p>'.$submitbutton.'</p>'); |
|
} |
|
} else { |
|
$r->print('<p class="LC_info">'.&mt('There are no parameters.').'</p>'); |
|
} |
|
$r->print('</form>'.&Apache::loncommon::end_page()); |
|
} |
} |
|
|
sub clean_parameters { |
sub clean_parameters { |
Line 3961 ENDOVER
|
Line 3585 ENDOVER
|
$r->print(&mt('All users')); |
$r->print(&mt('All users')); |
} elsif ($data{'scope_type'} eq 'user') { |
} elsif ($data{'scope_type'} eq 'user') { |
$r->print(&mt('User: [_1]',join(':',@{$data{'scope'}}))); |
$r->print(&mt('User: [_1]',join(':',@{$data{'scope'}}))); |
} elsif ($data{'scope_type'} eq 'secgroup') { |
} elsif ($data{'scope_type'} eq 'section') { |
$r->print(&mt('Group/Section: [_1]',$data{'scope'})); |
$r->print(&mt('Section: [_1]',$data{'scope'})); |
|
} elsif ($data{'scope_type'} eq 'group') { |
|
$r->print(&mt('Group: [_1]',$data{'scope'})); |
} |
} |
$r->print('<br />'); |
$r->print('<br />'); |
if ($data{'realm_type'} eq 'all') { |
if ($data{'realm_type'} eq 'all') { |
Line 3973 ENDOVER
|
Line 3599 ENDOVER
|
my ($map,$resid,$url) = |
my ($map,$resid,$url) = |
&Apache::lonnet::decode_symb($data{'realm'}); |
&Apache::lonnet::decode_symb($data{'realm'}); |
$r->print(&mt('Resource: [_1]with ID: [_2]in folder [_3]', |
$r->print(&mt('Resource: [_1]with ID: [_2]in folder [_3]', |
$url.' <br /> ', |
$url.' <br /> ', |
$resid.' <br /> ',$map)); |
$resid.' <br /> ',$map)); |
} |
} |
$r->print(' <br /> '.&mt('Part: [_1]',$data{'parameter_part'})); |
$r->print(' <br /> '.&mt('Part: [_1]',$data{'parameter_part'})); |
$r->print('</td></tr>'); |
$r->print('</td></tr>'); |
Line 3984 ENDOVER
|
Line 3610 ENDOVER
|
$r->print(&Apache::loncommon::end_data_table().'<p>'. |
$r->print(&Apache::loncommon::end_data_table().'<p>'. |
'<input type="submit" value="'.&mt('Delete Selected').'" />'. |
'<input type="submit" value="'.&mt('Delete Selected').'" />'. |
'</p></form>'); |
'</p></form>'); |
|
&endSettingsScreen($r); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
|
Line 3991 sub date_shift_one {
|
Line 3618 sub date_shift_one {
|
my ($r) = @_; |
my ($r) = @_; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $sec = $env{'request.course.sec'}; |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
text=>"Shifting Dates"}); |
text=>"Shifting Dates"}); |
my $submit_text = &mt('Shift all dates accordingly'); |
|
if ($sec ne '') { |
|
my @groups; |
|
if ($env{'request.course.groups'} ne '') { |
|
@groups = split(/:/,$env{'request.course.groups'}); |
|
} |
|
if (@groups) { |
|
$submit_text = &mt("Shift dates set just for your section/group(s), accordingly"); |
|
} else { |
|
$submit_text = &mt("Shift dates set just for your section, accordingly"); |
|
} |
|
} |
|
my $start_page=&Apache::loncommon::start_page('Shift Dates'); |
my $start_page=&Apache::loncommon::start_page('Shift Dates'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
$r->print('<form name="shiftform" method="post" action="">'. |
&startSettingsScreen($r,'parmset'); |
|
$r->print('<form name="shiftform" method="post">'. |
'<table><tr><td>'.&mt('Currently set date:').'</td><td>'. |
'<table><tr><td>'.&mt('Currently set date:').'</td><td>'. |
&Apache::lonlocal::locallocaltime($env{'form.timebase'}).'</td></tr>'. |
&Apache::lonlocal::locallocaltime($env{'form.timebase'}).'</td></tr>'. |
'<tr><td>'.&mt('Shifted date:').'</td><td>'. |
'<tr><td>'.&mt('Shifted date:').'</td><td>'. |
&Apache::lonhtmlcommon::date_setter('shiftform', |
&Apache::lonhtmlcommon::dshowerfuck.net |
|
ate_setter('shiftform', |
'timeshifted', |
'timeshifted', |
$env{'form.timebase'},, |
$env{'form.timebase'},, |
''). |
''). |
'</td></tr></table>'. |
'</td></tr></table>'. |
'<input type="hidden" name="action" value="dateshift2" />'. |
'<input type="hidden" name="action" value="dateshift2" />'. |
'<input type="hidden" name="timebase" value="'.$env{'form.timebase'}.'" />'. |
'<input type="hidden" name="timebase" value="'.$env{'form.timebase'}.'" />'. |
'<input type="submit" value="'.$submit_text.'" /></form>'); |
'<input type="submit" value="'.&mt('Shift all dates accordingly').'" /></form>'); |
|
&endSettingsScreen($r); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
|
Line 4028 sub date_shift_two {
|
Line 3646 sub date_shift_two {
|
my ($r) = @_; |
my ($r) = @_; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $sec = $env{'request.course.sec'}; |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
text=>"Shifting Dates"}); |
text=>"Shifting Dates"}); |
my $start_page=&Apache::loncommon::start_page('Shift Dates'); |
my $start_page=&Apache::loncommon::start_page('Shift Dates'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
|
&startSettingsScreen($r,'parmset'); |
my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted'); |
my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted'); |
$r->print('<h2>'.&mt('Shift Dates').'</h2>'); |
$r->print(&mt('Shifting all dates such that [_1] becomes [_2]', |
if ($sec ne '') { |
&Apache::lonlocal::locallocaltime($env{'form.timebase'}), |
my @groups; |
&Apache::lonlocal::locallocaltime($timeshifted))); |
if ($env{'request.course.groups'} ne '') { |
|
@groups = split(/:/,$env{'request.course.groups'}); |
|
} |
|
if (@groups) { |
|
$r->print('<p>'. |
|
&mt("Shift dates set just for your section/group(s), such that [_1] becomes [_2]", |
|
&Apache::lonlocal::locallocaltime($env{'form.timebase'}), |
|
&Apache::lonlocal::locallocaltime($timeshifted)). |
|
'</p>'); |
|
} else { |
|
$r->print('<p>'. |
|
&mt("Shift dates set just for your section, such that [_1] becomes [_2]", |
|
&Apache::lonlocal::locallocaltime($env{'form.timebase'}), |
|
&Apache::lonlocal::locallocaltime($timeshifted)). |
|
'</p>'); |
|
} |
|
} else { |
|
$r->print('<p>'.&mt('Shifting all dates such that [_1] becomes [_2]', |
|
&Apache::lonlocal::locallocaltime($env{'form.timebase'}), |
|
&Apache::lonlocal::locallocaltime($timeshifted)). |
|
'</p>'); |
|
} |
|
my $delta=$timeshifted-$env{'form.timebase'}; |
my $delta=$timeshifted-$env{'form.timebase'}; |
my $numchanges = 0; |
&dateshift($delta); |
my $result = &dateshift($delta,\$numchanges); |
&endSettingsScreen($r); |
if ($result eq 'ok') { |
|
$r->print( |
|
&Apache::lonhtmlcommon::confirm_success(&mt('Completed shifting of [quant,_1,date setting]', |
|
$numchanges))); |
|
} elsif ($result eq 'con_delayed') { |
|
$r->print( |
|
&Apache::lonhtmlcommon::confirm_success(&mt('Queued shifting of [quant,_1,date setting]', |
|
$numchanges))); |
|
} else { |
|
$r->print( |
|
&Apache::lonhtmlcommon::confirm_success(&mt('An error occurred attempting to shift dates'),1)); |
|
} |
|
$r->print( |
|
'<br /><br />'. |
|
&Apache::lonhtmlcommon::actionbox( |
|
['<a href="/adm/parmset">'.&mt('Content and Problem Settings').'</a>'])); |
|
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
|
Line 4094 sub parse_key {
|
Line 3674 sub parse_key {
|
$data{'scope_type'} = 'user'; |
$data{'scope_type'} = 'user'; |
$data{'scope'} = [$1,$2]; |
$data{'scope'} = [$1,$2]; |
} else { |
} else { |
$data{'scope_type'} = 'secgroup'; |
#FIXME check for group scope |
|
$data{'scope_type'} = 'section'; |
} |
} |
$middle=~s/^\[(.*)\]//; |
$middle=~s/^\[(.*)\]//; |
} |
} |
Line 4122 sub parse_key {
|
Line 3703 sub parse_key {
|
|
|
|
|
sub header { |
sub header { |
return &Apache::loncommon::start_page('Content and Problem Settings'); |
return &Apache::loncommon::start_page('Settings'); |
} |
} |
|
|
|
|
Line 4132 sub print_main_menu {
|
Line 3713 sub print_main_menu {
|
# |
# |
$r->print(&header()); |
$r->print(&header()); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Content and Problem Settings')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Content and Problem Settings')); |
my $crstype = &Apache::loncommon::course_type(); |
&startSettingsScreen($r,'parmset'); |
my $lc_crstype = lc($crstype); |
|
|
|
$r->print(<<ENDMAINFORMHEAD); |
$r->print(<<ENDMAINFORMHEAD); |
<form method="post" enctype="multipart/form-data" |
<form method="post" enctype="multipart/form-data" |
action="/adm/parmset" name="studentform"> |
action="/adm/parmset" name="studentform"> |
Line 4145 ENDMAINFORMHEAD
|
Line 3724 ENDMAINFORMHEAD
|
my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
my $mgr = &Apache::lonnet::allowed('mgr',$env{'request.course.id'}); |
my $mgr = &Apache::lonnet::allowed('mgr',$env{'request.course.id'}); |
my $dcm = &Apache::lonnet::allowed('dcm',$env{'request.course.id'}); |
my $dcm = &Apache::lonnet::allowed('dcm',$env{'request.course.id'}); |
my $vcb = &Apache::lonnet::allowed('vcb',$env{'request.course.id'}); |
|
my $vpa = &Apache::lonnet::allowed('vpa',$env{'request.course.id'}); |
|
if ((!$dcm) && ($env{'request.course.sec'} ne '')) { |
if ((!$dcm) && ($env{'request.course.sec'} ne '')) { |
$dcm = &Apache::lonnet::allowed('dcm',$env{'request.course.id'}. |
$dcm = &Apache::lonnet::allowed('dcm',$env{'request.course.id'}. |
'/'.$env{'request.course.sec'}); |
'/'.$env{'request.course.sec'}); |
} |
} |
if ((!$vcb) && ($env{'request.course.sec'} ne '')) { |
|
$vcb = &Apache::lonnet::allowed('vcb',$env{'request.course.id'}. |
my $crstype = &Apache::loncommon::course_type(); |
'/'.$env{'request.course.sec'}); |
my $lc_crstype = lc($crstype); |
} |
|
my (%linktext,%linktitle,%url); |
|
if ($parm_permission->{'edit'}) { |
|
%linktext = ( |
|
newoverview => 'Edit Resource Parameters - Overview Mode', |
|
settable => 'Edit Resource Parameters - Table Mode', |
|
setoverview => 'Modify Resource Parameters - Overview Mode', |
|
); |
|
%linktitle = ( |
|
newoverview => 'Set/Modify resource parameters in overview mode.', |
|
settable => 'Set/Modify resource parameters in table mode.', |
|
setoverview => 'Set/Modify existing resource parameters in overview mode.', |
|
); |
|
} else { |
|
%linktext = ( |
|
newoverview => 'View Resource Parameters - Overview Mode', |
|
settable => 'View Resource Parameters - Table Mode', |
|
setoverview => 'View Resource Parameters - Overview Mode', |
|
); |
|
%linktitle = ( |
|
newoverview => 'Display resource parameters in overview mode.', |
|
settable => 'Display resource parameters in table mode.', |
|
setoverview => 'Display existing resource parameters in overview mode.', |
|
); |
|
} |
|
if ($mgr) { |
|
$linktext{'resettimes'} = 'Reset Student Access Times'; |
|
$linktitle{'resettimes'} = "Reset access times for folders/maps, resources or the $lc_crstype."; |
|
$url{'resettimes'} = '/adm/helper/resettimes.helper'; |
|
} elsif ($vgr) { |
|
$linktext{'resettimes'} = 'Display Student Access Times', |
|
$linktitle{'resettimes'} = "Display access times for folders/maps, resources or the $lc_crstype.", |
|
$url{'resettimes'} = '/adm/accesstimes'; |
|
} |
|
my @menu = |
my @menu = |
( { categorytitle=>"Content Settings for this $crstype", |
( { categorytitle=>"Content Settings for this $crstype", |
items => [ |
items => [ |
{ linktext => 'Portfolio Metadata', |
{ linktext => 'Portfolio Metadata', |
url => '/adm/parmset?action=setrestrictmeta', |
url => '/adm/parmset?action=setrestrictmeta', |
permission => $parm_permission->{'setrestrictmeta'}, |
permission => $parm_permission, |
linktitle => "Restrict metadata for this $lc_crstype." , |
linktitle => "Restrict metadata for this $lc_crstype." , |
icon =>'contact-new.png' , |
icon =>'contact-new.png' , |
}, |
}, |
{ linktext => $linktext{'resettimes'}, |
{ linktext => 'Reset Student Access Times', |
url => $url{'resettimes'}, |
url => '/adm/helper/resettimes.helper', |
permission => ($vgr || $mgr), |
permission => $mgr, |
linktitle => $linktitle{'resettimes'}, |
linktitle => "Reset access times for folders/maps, resources or the $lc_crstype." , |
icon => 'start-here.png', |
icon => 'start-here.png' , |
}, |
}, |
{ linktext => 'Blocking Communication/Resource Access', |
{ linktext => 'Blocking Communication/Resource Access', |
url => '/adm/setblock', |
url => '/adm/setblock', |
permission => ($vcb || $dcm), |
permission => $dcm, |
linktitle => 'Configure blocking of communication/collaboration and access to resources during an exam', |
linktitle => 'Configure blocking of communication/collaboration and access to resources during an exam', |
icon => 'comblock.png', |
icon => 'comblock.png', |
}, |
}, |
{ linktext => 'Set Parameter Setting Default Actions', |
{ linktext => 'Set Parameter Setting Default Actions', |
url => '/adm/parmset?action=setdefaults', |
url => '/adm/parmset?action=setdefaults', |
permission => $parm_permission->{'setdefaults'}, |
permission => $parm_permission, |
linktitle =>'Set default actions for parameters.' , |
linktitle =>'Set default actions for parameters.' , |
icon => 'folder-new.png' , |
icon => 'folder-new.png' , |
}]}, |
}]}, |
Line 4219 ENDMAINFORMHEAD
|
Line 3763 ENDMAINFORMHEAD
|
items => [ |
items => [ |
{ linktext => 'Edit Resource Parameters - Helper Mode', |
{ linktext => 'Edit Resource Parameters - Helper Mode', |
url => '/adm/helper/parameter.helper', |
url => '/adm/helper/parameter.helper', |
permission => $parm_permission->{'helper'}, |
permission => $parm_permission, |
linktitle =>'Set/Modify resource parameters in helper mode.' , |
linktitle =>'Set/Modify resource parameters in helper mode.' , |
icon => 'dialog-information.png' , |
icon => 'dialog-information.png' , |
#help => 'Parameter_Helper', |
#help => 'Parameter_Helper', |
}, |
}, |
{ linktext => $linktext{'newoverview'}, |
{ linktext => 'Edit Resource Parameters - Overview Mode', |
url => '/adm/parmset?action=newoverview', |
url => '/adm/parmset?action=newoverview', |
permission => $parm_permission->{'newoverview'}, |
permission => $parm_permission, |
linktitle => $linktitle{'newoverview'}, |
linktitle =>'Set/Modify resource parameters in overview mode.' , |
icon => 'edit-find.png', |
icon => 'edit-find.png' , |
#help => 'Parameter_Overview', |
#help => 'Parameter_Overview', |
}, |
}, |
{ linktext => $linktext{'settable'}, |
{ linktext => 'Edit Resource Parameters - Table Mode', |
url => '/adm/parmset?action=settable', |
url => '/adm/parmset?action=settable', |
permission => $parm_permission->{'settable'}, |
permission => $parm_permission, |
linktitle => $linktitle{'settable'}, |
linktitle =>'Set/Modify resource parameters in table mode.' , |
icon => 'edit-copy.png', |
icon => 'edit-copy.png' , |
#help => 'Table_Mode', |
#help => 'Table_Mode', |
}]}, |
}]}, |
{ categorytitle => 'Existing Parameter Settings for Resources', |
{ categorytitle => 'Existing Parameter Settings for Resources', |
items => [ |
items => [ |
{ linktext => $linktext{'setoverview'}, |
{ linktext => 'Modify Resource Parameters - Overview Mode', |
url => '/adm/parmset?action=setoverview', |
url => '/adm/parmset?action=setoverview', |
permission => $parm_permission->{'setoverview'}, |
permission => $parm_permission, |
linktitle => $linktitle{'setoverview'}, |
linktitle =>'Set/Modify existing resource parameters in overview mode.' , |
icon => 'preferences-desktop-wallpaper.png', |
icon => 'preferences-desktop-wallpaper.png' , |
#help => 'Parameter_Overview', |
#help => 'Parameter_Overview', |
}, |
}, |
{ linktext => 'Change Log', |
{ linktext => 'Change Log', |
url => '/adm/parmset?action=parameterchangelog', |
url => '/adm/parmset?action=parameterchangelog', |
permission => $parm_permission->{'parameterchangelog'}, |
permission => $parm_permission, |
linktitle =>"View parameter and $lc_crstype blog posting/user notification change log." , |
linktitle =>"View parameter and $lc_crstype blog posting/user notification change log." , |
icon => 'document-properties.png', |
icon => 'document-properties.png', |
}]} |
}]} |
); |
); |
$r->print(&Apache::lonhtmlcommon::generate_menu(@menu)); |
$r->print(&Apache::lonhtmlcommon::generate_menu(@menu)); |
$r->print('</form>'.&Apache::loncommon::end_page()); |
&endSettingsScreen($r); |
return; |
return; |
} |
} |
|
|
Line 4331 sub order_meta_fields {
|
Line 3875 sub order_meta_fields {
|
text=>"Restrict Metadata"}, |
text=>"Restrict Metadata"}, |
{text=>"Order Metadata"}); |
{text=>"Order Metadata"}); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Order Metadata')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Order Metadata')); |
|
&startSettingsScreen($r,'parmset'); |
if ($env{'form.storeorder'}) { |
if ($env{'form.storeorder'}) { |
my $newpos = $env{'form.newpos'} - 1; |
my $newpos = $env{'form.newpos'} - 1; |
my $currentpos = $env{'form.currentpos'} - 1; |
my $currentpos = $env{'form.currentpos'} - 1; |
Line 4384 sub order_meta_fields {
|
Line 3929 sub order_meta_fields {
|
foreach my $key (@fields_in_order) { |
foreach my $key (@fields_in_order) { |
$r->print('<tr><td>'); |
$r->print('<tr><td>'); |
$r->print('<form method="post" action="">'); |
$r->print('<form method="post" action="">'); |
$r->print('<select name="newpos" onchange="this.form.submit()">'); |
$r->print('<select name="newpos" onChange="this.form.submit()">'); |
for (my $i = 1;$i le $num_fields;$i ++) { |
for (my $i = 1;$i le $num_fields;$i ++) { |
if ($i eq $idx) { |
if ($i eq $idx) { |
$r->print('<option value="'.$i.'" SELECTED>('.$i.')</option>'); |
$r->print('<option value="'.$i.'" SELECTED>('.$i.')</option>'); |
Line 4400 sub order_meta_fields {
|
Line 3945 sub order_meta_fields {
|
$idx ++; |
$idx ++; |
} |
} |
$r->print('</table>'); |
$r->print('</table>'); |
|
&endSettingsScreen($r); |
return 'ok'; |
return 'ok'; |
} |
} |
|
|
Line 4408 sub continue {
|
Line 3954 sub continue {
|
my $output; |
my $output; |
$output .= '<form action="" method="post">'; |
$output .= '<form action="" method="post">'; |
$output .= '<input type="hidden" name="action" value="setrestrictmeta" />'; |
$output .= '<input type="hidden" name="action" value="setrestrictmeta" />'; |
$output .= '<input type="submit" value="'.&mt('Continue').'" />'; |
$output .= '<input type="submit" value="Continue" />'; |
return ($output); |
return ($output); |
} |
} |
|
|
Line 4419 sub addmetafield {
|
Line 3965 sub addmetafield {
|
text=>"Add Metadata Field"}); |
text=>"Add Metadata Field"}); |
$r->print(&Apache::loncommon::start_page('Add Metadata Field')); |
$r->print(&Apache::loncommon::start_page('Add Metadata Field')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Add Metadata Field')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Add Metadata Field')); |
|
&startSettingsScreen($r,'parmset'); |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
if (exists($env{'form.undelete'})) { |
if (exists($env{'form.undelete'})) { |
Line 4430 sub addmetafield {
|
Line 3977 sub addmetafield {
|
my $put_result = &Apache::lonnet::put('environment', |
my $put_result = &Apache::lonnet::put('environment', |
{'metadata.'.$meta_field.'.options'=>$options},$dom,$crs); |
{'metadata.'.$meta_field.'.options'=>$options},$dom,$crs); |
|
|
$r->print(&mt('Undeleted Metadata Field [_1] with result [_2]', |
$r->print('Undeleted Metadata Field <strong>'.$env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.added'}."</strong> with result ".$put_result.'<br />'); |
'<strong>'.$env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.added'}. |
|
'</strong>',$put_result). |
|
'<br />'); |
|
} |
} |
$r->print(&continue()); |
$r->print(&continue()); |
} elsif (exists($env{'form.fieldname'})) { |
} elsif (exists($env{'form.fieldname'})) { |
Line 4445 sub addmetafield {
|
Line 3989 sub addmetafield {
|
{'metadata.'.$meta_field.'.values'=>"", |
{'metadata.'.$meta_field.'.values'=>"", |
'metadata.'.$meta_field.'.added'=>"$display_field", |
'metadata.'.$meta_field.'.added'=>"$display_field", |
'metadata.'.$meta_field.'.options'=>""},$dom,$crs); |
'metadata.'.$meta_field.'.options'=>""},$dom,$crs); |
$r->print(&mt('Added new Metadata Field [_1] with result [_2]', |
$r->print('Added new Metadata Field <strong>'.$env{'form.fieldname'}."</strong> with result ".$put_result.'<br />'); |
'<strong>'.$env{'form.fieldname'}.'</strong>',$put_result). |
|
'<br />'); |
|
$r->print(&continue()); |
$r->print(&continue()); |
} else { |
} else { |
my $fields = &get_deleted_meta_fieldnames($env{'request.course.id'}); |
my $fields = &get_deleted_meta_fieldnames($env{'request.course.id'}); |
if ($fields) { |
if ($fields) { |
$r->print(&mt('You may undelete previously deleted fields.'). |
$r->print('You may undelete previously deleted fields.<br />Check those you wish to undelete and click Undelete.<br />'); |
'<br />'. |
|
&mt('Check those you wish to undelete and click Undelete.'). |
|
'<br />'); |
|
$r->print('<form method="post" action="">'); |
$r->print('<form method="post" action="">'); |
foreach my $key(keys(%$fields)) { |
foreach my $key(keys(%$fields)) { |
$r->print('<input type="checkbox" name="undeletefield" value="'.$key.'" />'.$$fields{$key}.'<br /'); |
$r->print('<input type="checkbox" name="undeletefield" value="'.$key.'" />'.$$fields{$key}.'<br /'); |
Line 4463 sub addmetafield {
|
Line 4002 sub addmetafield {
|
$r->print('<input type="submit" name="undelete" value="Undelete" />'); |
$r->print('<input type="submit" name="undelete" value="Undelete" />'); |
$r->print('</form>'); |
$r->print('</form>'); |
} |
} |
$r->print('<hr />'. |
$r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.<form method="post" action="/adm/parmset?action=addmetadata"'); |
&mt('[_1]Or[_2] you may enter a new metadata field name.', |
|
'<strong>','</strong>'). |
|
'<form method="post" action="/adm/parmset?action=addmetadata">'); |
|
$r->print('<input type="text" name="fieldname" /><br />'); |
$r->print('<input type="text" name="fieldname" /><br />'); |
$r->print('<input type="submit" value="'.&mt('Add Metadata Field').'" />'); |
$r->print('<input type="submit" value="Add Metadata Field" />'); |
} |
} |
$r->print('</form>'); |
$r->print('</form>'); |
|
&endSettingsScreen($r); |
} |
} |
|
|
|
|
Line 4485 sub setrestrictmeta {
|
Line 4022 sub setrestrictmeta {
|
text=>"Restrict Metadata"}); |
text=>"Restrict Metadata"}); |
$r->print(&Apache::loncommon::start_page('Restrict Metadata')); |
$r->print(&Apache::loncommon::start_page('Restrict Metadata')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata')); |
|
&startSettingsScreen($r,'parmset'); |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $key_base = $env{'course.'.$env{'request.course.id'}.'.'}; |
my $key_base = $env{'course.'.$env{'request.course.id'}.'.'}; |
my $save_field = ''; |
my $save_field = ''; |
my %lt = &Apache::lonlocal::texthash( |
|
addm => 'Add Metadata Field', |
|
ordm => 'Order Metadata Fields', |
|
save => 'Save', |
|
); |
|
if ($env{'form.restrictmeta'}) { |
if ($env{'form.restrictmeta'}) { |
foreach my $field (sort(keys(%env))) { |
foreach my $field (sort(keys(%env))) { |
if ($field=~m/^form.(.+)_(.+)$/) { |
if ($field=~m/^form.(.+)_(.+)$/) { |
Line 4532 sub setrestrictmeta {
|
Line 4065 sub setrestrictmeta {
|
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
# Now get possible added metadata fields |
# Now get possible added metadata fields |
my $added_metadata_fields = &get_added_meta_fieldnames($env{'request.course.id'}); |
my $added_metadata_fields = &get_added_meta_fieldnames($env{'request.course.id'}); |
|
my $row_alt = 1; |
$output .= &Apache::loncommon::start_data_table(); |
$output .= &Apache::loncommon::start_data_table(); |
foreach my $field (sort(keys(%metadata_fields))) { |
foreach my $field (sort(keys(%metadata_fields))) { |
if ($field ne 'courserestricted') { |
if ($field ne 'courserestricted') { |
|
$row_alt = $row_alt ? 0 : 1; |
$output.= &output_row($r, $field, $metadata_fields{$field}); |
$output.= &output_row($r, $field, $metadata_fields{$field}); |
} |
} |
} |
} |
my $buttons = (<<ENDButtons); |
my $buttons = (<<ENDButtons); |
<input type="submit" name="restrictmeta" value="$lt{'save'}" /> |
<input type="submit" name="restrictmeta" value="Save" /> |
</form><br /> |
</form><br /> |
<form method="post" action="/adm/parmset?action=addmetadata" name="form1"> |
<form method="post" action="/adm/parmset?action=addmetadata" name="form1"> |
<input type="submit" name="restrictmeta" value="$lt{'addm'}" /> |
<input type="submit" name="restrictmeta" value="Add a Metadata Field" /> |
</form> |
</form> |
<br /> |
<br /> |
<form method="post" action="/adm/parmset?action=ordermetadata" name="form2"> |
<form method="post" action="/adm/parmset?action=ordermetadata" name="form2"> |
<input type="submit" name="restrictmeta" value="$lt{'ordm'}" /> |
<input type="submit" name="restrictmeta" value="Order Metadata Fields" /> |
ENDButtons |
ENDButtons |
my $added_flag = 1; |
my $added_flag = 1; |
foreach my $field (sort(keys(%$added_metadata_fields))) { |
foreach my $field (sort(keys(%$added_metadata_fields))) { |
$output.= &output_row($r,$field,$$added_metadata_fields{$field},$added_flag); |
$row_alt = $row_alt ? 0 : 1; |
|
$output.= &output_row($r, $field, $$added_metadata_fields{$field},$added_flag, $row_alt); |
} |
} |
$output .= &Apache::loncommon::end_data_table(); |
$output .= &Apache::loncommon::end_data_table(); |
$r->print(<<ENDenv); |
$r->print(<<ENDenv); |
Line 4559 ENDButtons
|
Line 4095 ENDButtons
|
$buttons |
$buttons |
</form> |
</form> |
ENDenv |
ENDenv |
|
&endSettingsScreen($r); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return 'ok'; |
return 'ok'; |
} |
} |
Line 4603 sub defaultsetter {
|
Line 4140 sub defaultsetter {
|
&Apache::loncommon::start_page('Parameter Setting Default Actions'); |
&Apache::loncommon::start_page('Parameter Setting Default Actions'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Defaults'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Defaults'); |
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
|
&startSettingsScreen($r,'parmset'); |
$r->print('<form method="post" action="/adm/parmset?action=setdefaults" name="defaultform">'); |
$r->print('<form method="post" action="/adm/parmset?action=setdefaults" name="defaultform">'); |
|
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
Line 4749 ENDYESNO
|
Line 4287 ENDYESNO
|
$r->print(&Apache::loncommon::end_data_table(). |
$r->print(&Apache::loncommon::end_data_table(). |
"\n".'<input type="submit" name="storerules" value="'. |
"\n".'<input type="submit" name="storerules" value="'. |
&mt('Save').'" /></form>'."\n"); |
&mt('Save').'" /></form>'."\n"); |
|
&endSettingsScreen($r); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
Line 4795 my %standard_parms;
|
Line 4334 my %standard_parms;
|
my %standard_parms_types; |
my %standard_parms_types; |
|
|
sub load_parameter_names { |
sub load_parameter_names { |
open(my $config,"<","$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab"); |
open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab"); |
while (my $configline=<$config>) { |
while (my $configline=<$config>) { |
if ($configline !~ /\S/ || $configline=~/^\#/) { next; } |
if ($configline !~ /\S/ || $configline=~/^\#/) { next; } |
chomp($configline); |
chomp($configline); |
Line 4810 sub load_parameter_names {
|
Line 4349 sub load_parameter_names {
|
close($config); |
close($config); |
$standard_parms{'int_pos'} = 'Positive Integer'; |
$standard_parms{'int_pos'} = 'Positive Integer'; |
$standard_parms{'int_zero_pos'} = 'Positive Integer or Zero'; |
$standard_parms{'int_zero_pos'} = 'Positive Integer or Zero'; |
$standard_parms{'scoreformat'} = 'Format for display of score'; |
|
} |
} |
|
|
sub standard_parameter_names { |
sub standard_parameter_names { |
Line 4837 sub standard_parameter_types {
|
Line 4375 sub standard_parameter_types {
|
} |
} |
|
|
sub parm_change_log { |
sub parm_change_log { |
my ($r,$parm_permission)=@_; |
my ($r)=@_; |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
text=>"Parameter Change Log"}); |
text=>"Parameter Change Log"}); |
my $js = '<script type="text/javascript">'."\n". |
my $js = '<script type="text/javascript">'."\n". |
Line 4847 sub parm_change_log {
|
Line 4385 sub parm_change_log {
|
'</script>'."\n"; |
'</script>'."\n"; |
$r->print(&Apache::loncommon::start_page('Parameter Change Log',$js)); |
$r->print(&Apache::loncommon::start_page('Parameter Change Log',$js)); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Change Log')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Change Log')); |
|
&startSettingsScreen($r,'parmset'); |
my %parmlog=&Apache::lonnet::dump('nohist_parameterlog', |
my %parmlog=&Apache::lonnet::dump('nohist_parameterlog', |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
Line 4866 sub parm_change_log {
|
Line 4405 sub parm_change_log {
|
$r->print(&Apache::loncommon::display_filter('parmslog').' '."\n". |
$r->print(&Apache::loncommon::display_filter('parmslog').' '."\n". |
'<input type="submit" value="'.&mt('Display').'" />'. |
'<input type="submit" value="'.&mt('Display').'" />'. |
'</form></fieldset></div><br clear="all" />'); |
'</form></fieldset></div><br clear="all" />'); |
my $readonly = 1; |
|
if ($parm_permission->{'edit'}) { |
|
undef($readonly); |
|
} |
|
my $courseopt=&Apache::lonnet::get_courseresdata($env{'course.'.$env{'request.course.id'}.'.num'}, |
my $courseopt=&Apache::lonnet::get_courseresdata($env{'course.'.$env{'request.course.id'}.'.num'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}); |
$env{'course.'.$env{'request.course.id'}.'.domain'}); |
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). |
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). |
'<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Extent').'</th><th>'.&mt('Users').'</th><th>'. |
'<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Extent').'</th><th>'.&mt('Users').'</th><th>'. |
&mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th>'); |
&mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th><th>'.&mt('Announce').'</th>'. |
unless ($readonly) { |
&Apache::loncommon::end_data_table_header_row()); |
$r->print('<th>'.&mt('Announce').'</th>'); |
|
} |
|
$r->print(&Apache::loncommon::end_data_table_header_row()); |
|
my $shown=0; |
my $shown=0; |
my $folder=''; |
my $folder=''; |
if ($env{'form.displayfilter'} eq 'currentfolder') { |
if ($env{'form.displayfilter'} eq 'currentfolder') { |
Line 4890 sub parm_change_log {
|
Line 4423 sub parm_change_log {
|
} |
} |
if ($last) { ($folder) = &Apache::lonnet::decode_symb($last); } |
if ($last) { ($folder) = &Apache::lonnet::decode_symb($last); } |
} |
} |
my $numgroups = 0; |
|
my @groups; |
|
if ($env{'request.course.groups'} ne '') { |
|
@groups = split(/:/,$env{'request.course.groups'}); |
|
$numgroups = scalar(@groups); |
|
} |
|
foreach my $id (sort |
foreach my $id (sort |
{ |
{ |
if ($parmlog{$b}{'exe_time'} ne $parmlog{$a}{'exe_time'}) { |
if ($parmlog{$b}{'exe_time'} ne $parmlog{$a}{'exe_time'}) { |
Line 4917 sub parm_change_log {
|
Line 4444 sub parm_change_log {
|
$parmlog{$id}{'exe_uname'}, |
$parmlog{$id}{'exe_uname'}, |
$parmlog{$id}{'exe_udom'}); |
$parmlog{$id}{'exe_udom'}); |
my $send_msg_link=''; |
my $send_msg_link=''; |
if ((!$readonly) && |
if ((($parmlog{$id}{'exe_uname'} ne $env{'user.name'}) |
(($parmlog{$id}{'exe_uname'} ne $env{'user.name'}) |
|
|| ($parmlog{$id}{'exe_udom'} ne $env{'user.domain'}))) { |
|| ($parmlog{$id}{'exe_udom'} ne $env{'user.domain'}))) { |
$send_msg_link ='<br />'. |
$send_msg_link ='<br />'. |
&Apache::loncommon::messagewrapper(&mt('Send message'), |
&Apache::loncommon::messagewrapper(&mt('Send message'), |
Line 4935 sub parm_change_log {
|
Line 4461 sub parm_change_log {
|
!exists($parmlog{$id}{'logentry'}{$changed.'.type'})); |
!exists($parmlog{$id}{'logentry'}{$changed.'.type'})); |
my ($realm,$section,$parmname,$part,$what,$middle,$uname,$udom,$issection,$realmdescription)= |
my ($realm,$section,$parmname,$part,$what,$middle,$uname,$udom,$issection,$realmdescription)= |
&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'},undef,undef,$typeflag); |
&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'},undef,undef,$typeflag); |
if ($env{'request.course.sec'} ne '') { |
|
next if (($issection ne '') && (!(($issection eq $env{'request.course.sec'}) || |
|
($numgroups && (grep(/^\Q$issection\E$/,@groups)))))); |
|
if ($uname ne '') { |
|
my $stusection = &Apache::lonnet::getsection($uname,$udom,$env{'request.course.id'}); |
|
next if (($stusection ne '-1') && ($stusection ne $env{'request.course.sec'})); |
|
} |
|
} |
|
if ($env{'form.displayfilter'} eq 'currentfolder') { |
if ($env{'form.displayfilter'} eq 'currentfolder') { |
if ($folder) { |
if ($folder) { |
if ($middle!~/^\Q$folder\E/) { next; } |
if ($middle!~/^\Q$folder\E/) { next; } |
Line 4996 sub parm_change_log {
|
Line 4514 sub parm_change_log {
|
} |
} |
} |
} |
} |
} |
$output .= '</td>'; |
$output .= '</td><td>'; |
|
|
unless ($readonly) { |
if ($stillactive) { |
$output .= '<td>'; |
my $parmitem = &standard_parameter_names($parmname); |
if ($stillactive) { |
$parmitem = &mt($parmitem); |
my $parmitem = &standard_parameter_names($parmname); |
my $title=&mt('Changed [_1]',$parmitem); |
$parmitem = &mt($parmitem); |
my $description=&mt('Changed [_1] for [_2] to [_3]', |
my $title=&mt('Changed [_1]',$parmitem); |
$parmitem,$realmdescription, |
my $description=&mt('Changed [_1] for [_2] to [_3]', |
(&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value)); |
$parmitem,$realmdescription, |
if (($uname) && ($udom)) { |
(&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value)); |
$output .= |
if (($uname) && ($udom)) { |
&Apache::loncommon::messagewrapper('Notify User', |
$output .= |
$uname,$udom,$title, |
&Apache::loncommon::messagewrapper('Notify User', |
$description); |
$uname,$udom,$title, |
} else { |
$description); |
$output .= |
} else { |
&Apache::lonrss::course_blog_link($id,$title, |
$output .= |
$description); |
&Apache::lonrss::course_blog_link($id,$title, |
} |
$description); |
} |
} |
$output .= '</td>'.&Apache::loncommon::end_data_table_row(); |
} |
|
$output .= '</td>'; |
|
} |
|
$output .= &Apache::loncommon::end_data_table_row(); |
|
} |
} |
if ($env{'form.displayfilter'} eq 'containing') { |
if ($env{'form.displayfilter'} eq 'containing') { |
my $wholeentry=$about_me_link.':'. |
my $wholeentry=$about_me_link.':'. |
Line 5040 sub parm_change_log {
|
Line 4554 sub parm_change_log {
|
|| $shown<=$env{'form.show'})) { last; } |
|| $shown<=$env{'form.show'})) { last; } |
} |
} |
$r->print(&Apache::loncommon::end_data_table()); |
$r->print(&Apache::loncommon::end_data_table()); |
|
&endSettingsScreen($r); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
|
Line 5088 sub update_slots {
|
Line 4603 sub update_slots {
|
context => 'parameter', |
context => 'parameter', |
); |
); |
&Apache::lonnet::write_log('course','slotreservationslog',\%storehash, |
&Apache::lonnet::write_log('course','slotreservationslog',\%storehash, |
'',$uname,$udom,$cnum,$cdom); |
'',$uname,$udom,$cnum,$cdom); |
|
|
&Apache::lonnet::write_log('course',$cdom.'_'.$cnum.'_slotlog',\%storehash, |
&Apache::lonnet::write_log('course',$cdom.'_'.$cnum.'_slotlog',\%storehash, |
'',$uname,$udom,$uname,$udom); |
'',$uname,$udom,$uname,$udom); |
} |
} |
return $success; |
return $success; |
} |
} |
Line 5122 sub delete_slots {
|
Line 4637 sub delete_slots {
|
context => 'parameter', |
context => 'parameter', |
); |
); |
&Apache::lonnet::write_log('course','slotreservationslog',\%storehash, |
&Apache::lonnet::write_log('course','slotreservationslog',\%storehash, |
1,$uname,$udom,$cnum,$cdom); |
1,$uname,$udom,$cnum,$cdom); |
&Apache::lonnet::write_log('course',$cdom.'_'.$cnum.'_slotlog',\%storehash, |
&Apache::lonnet::write_log('course',$cdom.'_'.$cnum.'_slotlog',\%storehash, |
1,$uname,$udom,$uname,$udom); |
1,$uname,$udom,$uname,$udom); |
} |
} |
} |
} |
} |
} |
Line 5147 sub parameter_release_vars {
|
Line 4662 sub parameter_release_vars {
|
} |
} |
|
|
sub parameter_releasecheck { |
sub parameter_releasecheck { |
my ($name,$value,$needsrelease,$cmajor,$cminor) = @_; |
my ($name,$value,$needsrelease,$chostname,$cmajor,$cminor) = @_; |
my $needsnewer; |
my $needsnewer; |
my ($needsmajor,$needsminor) = split(/\./,$needsrelease); |
my ($needsmajor,$needsminor) = split(/\./,$needsrelease); |
if (($cmajor < $needsmajor) || |
if (($cmajor < $needsmajor) || |
Line 5167 sub oldversion_warning {
|
Line 4682 sub oldversion_warning {
|
lenient => 'string_lenient', |
lenient => 'string_lenient', |
retrypartial => 'string_yesno', |
retrypartial => 'string_yesno', |
discussvote => 'string_discussvote', |
discussvote => 'string_discussvote', |
examcode => 'string_examcode', |
|
); |
); |
if (exists($stringtypes{$name})) { |
if (exists($stringtypes{$name})) { |
if ($name eq 'examcode') { |
if (ref($strings{$stringtypes{$name}}) eq 'ARRAY') { |
$desc = $value; |
|
} elsif (ref($strings{$stringtypes{$name}}) eq 'ARRAY') { |
|
foreach my $possibilities (@{ $strings{$stringtypes{$name}} }) { |
foreach my $possibilities (@{ $strings{$stringtypes{$name}} }) { |
next unless (ref($possibilities) eq 'ARRAY'); |
next unless (ref($possibilities) eq 'ARRAY'); |
my ($parmval, $description) = @{ $possibilities }; |
my ($parmval, $description) = @{ $possibilities }; |
Line 5182 sub oldversion_warning {
|
Line 4694 sub oldversion_warning {
|
} |
} |
} |
} |
} |
} |
} elsif (($name eq 'printstartdate') || ($name eq 'printenddate')) { |
|
my $now = time; |
|
if ($value =~ /^\d+$/) { |
|
if ($name eq 'printstartdate') { |
|
if ($value > $now) { |
|
$desc = &Apache::lonlocal::locallocaltime($value); |
|
} |
|
} elsif ($name eq 'printenddate') { |
|
if ($value < $now) { |
|
$desc = &Apache::lonlocal::locallocaltime($value); |
|
} |
|
} |
|
} |
|
} |
} |
my $standard_name = &standard_parameter_names($name); |
my $standard_name = &standard_parameter_names($name); |
return '<p class="LC_warning">'. |
return '<p class="LC_warning">'. |
Line 5206 sub oldversion_warning {
|
Line 4705 sub oldversion_warning {
|
'</p>'; |
'</p>'; |
} |
} |
|
|
sub get_permission { |
|
my %permission; |
|
my $allowed = 0; |
|
return (\%permission,$allowed) unless ($env{'request.course.id'}); |
|
if ((&Apache::lonnet::allowed('opa',$env{'request.course.id'})) || |
|
(&Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'. |
|
$env{'request.course.sec'}))) { |
|
%permission= ( |
|
'edit' => 1, |
|
'set' => 1, |
|
'setoverview' => 1, |
|
'addmetadata' => 1, |
|
'ordermetadata' => 1, |
|
'setrestrictmeta' => 1, |
|
'newoverview' => 1, |
|
'setdefaults' => 1, |
|
'settable' => 1, |
|
'parameterchangelog' => 1, |
|
'cleanparameters' => 1, |
|
'dateshift1' => 1, |
|
'dateshift2' => 1, |
|
'helper' => 1, |
|
); |
|
} elsif ((&Apache::lonnet::allowed('vpa',$env{'request.course.id'})) || |
|
(&Apache::lonnet::allowed('vpa',$env{'request.course.id'}.'/'. |
|
$env{'request.course.sec'}))) { |
|
%permission = ( |
|
'set' => 1, |
|
'settable' => 1, |
|
'newoverview' => 1, |
|
'setoverview' => 1, |
|
'parameterchangelog' => 1, |
|
); |
|
} |
|
foreach my $perm (values(%permission)) { |
|
if ($perm) { $allowed=1; last; } |
|
} |
|
return (\%permission,$allowed); |
|
} |
|
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
|
|
Line 5273 sub handler {
|
Line 4732 sub handler {
|
'Parameter_Manager,Course_Environment,Parameter_Helper,Parameter_Overview,Table_Mode'}); |
'Parameter_Manager,Course_Environment,Parameter_Helper,Parameter_Overview,Table_Mode'}); |
|
|
# ----------------------------------------------------- Needs to be in a course |
# ----------------------------------------------------- Needs to be in a course |
my ($parm_permission,$allowed) = &get_permission(); |
my $parm_permission = |
|
(&Apache::lonnet::allowed('opa',$env{'request.course.id'}) || |
|
&Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'. |
|
$env{'request.course.sec'})); |
my $exists = &check_for_course_info(); |
my $exists = &check_for_course_info(); |
|
|
if ($env{'request.course.id'} && $allowed && $exists) { |
if ($env{'request.course.id'} && $parm_permission && $exists) { |
# |
# |
# Main switch on form.action and form.state, as appropriate |
# Main switch on form.action and form.state, as appropriate |
# |
# |
# Check first if coming from someone else headed directly for |
# Check first if coming from someone else headed directly for |
# the table mode |
# the table mode |
if (($parm_permission->{'set'}) && |
if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
&& (!$env{'form.dis'})) || ($env{'form.symb'}))) { |
&assessparms($r); |
&assessparms($r,$parm_permission); |
|
} elsif (! exists($env{'form.action'})) { |
} elsif (! exists($env{'form.action'})) { |
&print_main_menu($r,$parm_permission); |
&print_main_menu($r,$parm_permission); |
} elsif (!$parm_permission->{$env{'form.action'}}) { |
|
&print_main_menu($r,$parm_permission); |
|
} elsif ($env{'form.action'} eq 'setoverview') { |
} elsif ($env{'form.action'} eq 'setoverview') { |
&overview($r,$parm_permission); |
&overview($r); |
} elsif ($env{'form.action'} eq 'addmetadata') { |
} elsif ($env{'form.action'} eq 'addmetadata') { |
&addmetafield($r); |
&addmetafield($r); |
} elsif ($env{'form.action'} eq 'ordermetadata') { |
} elsif ($env{'form.action'} eq 'ordermetadata') { |
&order_meta_fields($r); |
&order_meta_fields($r); |
} elsif ($env{'form.action'} eq 'setrestrictmeta') { |
} elsif ($env{'form.action'} eq 'setrestrictmeta') { |
&setrestrictmeta($r); |
&setrestrictmeta($r); |
} elsif ($env{'form.action'} eq 'newoverview') { |
} elsif ($env{'form.action'} eq 'newoverview') { |
&newoverview($r,$parm_permission); |
&newoverview($r); |
} elsif ($env{'form.action'} eq 'setdefaults') { |
} elsif ($env{'form.action'} eq 'setdefaults') { |
&defaultsetter($r); |
&defaultsetter($r); |
} elsif ($env{'form.action'} eq 'settable') { |
} elsif ($env{'form.action'} eq 'settable') { |
&assessparms($r,$parm_permission); |
&assessparms($r); |
} elsif ($env{'form.action'} eq 'parameterchangelog') { |
} elsif ($env{'form.action'} eq 'parameterchangelog') { |
&parm_change_log($r,$parm_permission); |
&parm_change_log($r); |
} elsif ($env{'form.action'} eq 'cleanparameters') { |
} elsif ($env{'form.action'} eq 'cleanparameters') { |
&clean_parameters($r); |
&clean_parameters($r); |
} elsif ($env{'form.action'} eq 'dateshift1') { |
} elsif ($env{'form.action'} eq 'dateshift1') { |
&date_shift_one($r); |
&date_shift_one($r); |
} elsif ($env{'form.action'} eq 'dateshift2') { |
} elsif ($env{'form.action'} eq 'dateshift2') { |