version 1.487, 2009/11/23 13:03:58
|
version 1.522.2.31, 2024/07/03 04:06:27
|
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 course parameters. |
lonparmset provides an interface to setting content parameters in a |
|
course. |
|
|
=head1 DESCRIPTION |
=head1 DESCRIPTION |
|
|
Line 46 This module sets coursewide and assessme
|
Line 47 This module sets coursewide and assessme
|
|
|
=over |
=over |
|
|
=pod |
|
|
|
=item parmval() |
=item parmval() |
|
|
Figure out a cascading parameter. |
Figure out a cascading parameter. |
Line 131 javascript function 'pjump'.
|
Line 130 javascript function 'pjump'.
|
|
|
=item print_td() |
=item print_td() |
|
|
=item print_usergroups() |
=item check_other_groups() |
|
|
=item parm_control_group() |
=item parm_control_group() |
|
|
=item extractResourceInformation() : |
=item extractResourceInformation() : |
|
|
Given the course data hash, extractResourceInformation extracts lots of information about 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 |
|
|
|
=over 4 |
|
|
|
=item * B<env{'user.name'}> : Current username |
|
|
Input: See list below: |
=item * B<env{'user.domain'}> : Domain of current user. |
|
|
=item * B<ids> : An array that will contain all of the ids in the course. |
=item * B<env{"request.course.fn"}> : Course |
|
|
=item * B<typep> : hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>. |
=back |
|
|
|
Outputs: See list below |
|
|
=item * B<keyp> : hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id |
=over 4 |
|
|
=item * B<allparms> : hash, name of parameter->display value (what is the display value?) |
=item * B<ids> (out) : An array that will contain all of the ids in the course. |
|
|
=item * B<allparts> : hash, part identification->text representation of part, where the text representation is "[Part $part]" |
=item * B<typep>(out) : hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>. |
|
|
=item * B<allkeys> : hash, full key to part->display value (what's display value?) |
=item * B<keyp> (out) : hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id |
|
|
=item * B<allmaps> : hash, ??? |
=item * B<allparms> (out) : hash, name of parameter->display value (what is the display value?) |
|
|
=item * B<fcat> : ??? |
=item * B<allparts> (out) : hash, part identification->text representation of part, where the text representation is "[Part $part]" |
|
|
=item * B<defp> : hash, ??? |
=item * B<allmaps> (out) : hash, ??? |
|
|
=item * B<mapp> : ?? |
=item * B<mapp> : ?? |
|
|
=item * B<symbp> : hash, id->full sym? |
=item * B<symbp> : hash, id->full sym? |
|
|
|
=item * B<maptitles> |
|
|
|
=item * B<uris> |
|
|
|
=item * B<keyorder> |
|
|
|
=item * B<defkeytype> |
|
|
|
=back |
|
|
=item isdateparm() |
=item isdateparm() |
|
|
Line 196 Input: See list below:
|
Line 211 Input: See list below:
|
Show assessment data and parameters. This is a large routine that should |
Show assessment data and parameters. This is a large routine that should |
be simplified and shortened... someday. |
be simplified and shortened... someday. |
|
|
Inputs: $r |
Inputs: $r - the Apache request object. |
|
|
Returns: nothing |
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 214 Variables used (guessed by Jeremy):
|
Line 231 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 248 Variables used (guessed by Jeremy):
|
Line 267 Variables used (guessed by Jeremy):
|
|
|
=item parse_key() |
=item parse_key() |
|
|
=item check_cloners() : |
|
|
|
Checks if new users included in list of allowed cloners |
|
are valid users. Replaces supplied list with |
|
cleaned list containing only users with valid usernames |
|
and domains. |
|
|
|
Inputs: $clonelist, $oldcloner |
|
where $clonelist is ref to array of requested cloners, |
|
and $oldcloner is ref to array of currently allowed |
|
cloners. |
|
|
|
Returns: string - comma separated list of requested |
|
cloners (username:domain) who do not exist in system. |
|
|
|
=item change_clone() : |
|
|
|
Modifies the list of courses a user can clone (stored |
|
in the user's environment.db file), called when a |
|
change is made to the list of users allowed to clone |
|
a course. |
|
|
|
Inputs: $action,$cloner |
|
where $action is add or drop, and $cloner is identity of |
|
user for whom cloning ability is to be changed in course. |
|
|
|
|
|
=item check_cloners() |
|
|
|
=item change_clone() |
|
|
|
=item header() |
=item header() |
|
|
Output html header for page |
Output html header for page |
Line 311 Set portfolio metadata
|
Line 299 Set portfolio metadata
|
|
|
Main handler. Calls &assessparms subroutine. |
Main handler. Calls &assessparms subroutine. |
|
|
|
|
=back |
=back |
|
|
=cut |
=cut |
Line 333 use Apache::lonlocal;
|
Line 320 use Apache::lonlocal;
|
use Apache::lonnavmaps; |
use Apache::lonnavmaps; |
use Apache::longroup; |
use Apache::longroup; |
use Apache::lonrss; |
use Apache::lonrss; |
|
use HTML::Entities; |
|
use Text::Wrap(); |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
|
|
|
|
Line 662 sub storeparm_by_symb {
|
Line 651 sub storeparm_by_symb {
|
} |
} |
|
|
sub log_parmset { |
sub log_parmset { |
return &Apache::lonnet::instructor_log('parameterlog',@_); |
return &Apache::lonnet::write_log('course','parameterlog',@_); |
} |
} |
|
|
sub storeparm_by_symb_inner { |
sub storeparm_by_symb_inner { |
Line 769 sub valout {
|
Line 758 sub valout {
|
my $result = ''; |
my $result = ''; |
# Values of zero are valid. |
# Values of zero are valid. |
if (! $value && $value ne '0') { |
if (! $value && $value ne '0') { |
if ($editable) { |
if ($editable) { |
$result = '<span class="LC_clickhere">*</span>'; |
$result = |
} else { |
'<img src="/res/adm/pages/editmap.png"' |
$result=' '; |
.' alt="'.&mt('Change').'"' |
} |
.' title="'.&mt('Change').'" style="border:0;" />'; |
|
} else { |
|
$result=' '; |
|
} |
} else { |
} else { |
if ($type eq 'date_interval') { |
if ($type eq 'date_interval') { |
my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); |
my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); |
Line 814 sub valout {
|
Line 806 sub valout {
|
&date_sanity_info($value); |
&date_sanity_info($value); |
} else { |
} else { |
$result = $value; |
$result = $value; |
|
$result=~s/\,/\, /gs; |
$result = &HTML::Entities::encode($result,'"<>&'); |
$result = &HTML::Entities::encode($result,'"<>&'); |
} |
} |
} |
} |
Line 855 sub page_js {
|
Line 848 sub page_js {
|
return(<<ENDJS); |
return(<<ENDJS); |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
function pclose() { |
|
parmwin=window.open("/adm/rat/empty.html","LONCAPAparms", |
|
"height=350,width=350,scrollbars=no,menubar=no"); |
|
parmwin.close(); |
|
} |
|
|
|
$pjump_def |
$pjump_def |
|
|
function psub() { |
function psub() { |
pclose(); |
|
if (document.parmform.pres_marker.value!='') { |
if (document.parmform.pres_marker.value!='') { |
document.parmform.action+='#'+document.parmform.pres_marker.value; |
document.parmform.action+='#'+document.parmform.pres_marker.value; |
var typedef=new Array(); |
var typedef=new Array(); |
Line 899 $selscript
|
Line 886 $selscript
|
ENDJS |
ENDJS |
|
|
} |
} |
|
|
|
sub showhide_js { |
|
return <<"COURSECONTENTSCRIPT"; |
|
|
|
function showHide_courseContent() { |
|
var parmlevValue=document.getElementById("parmlev").value; |
|
if (parmlevValue == 'general') { |
|
document.getElementById('mapmenu').style.display="none"; |
|
} else { |
|
if ((parmlevValue == "full") || (parmlevValue == "map")) { |
|
document.getElementById('mapmenu').style.display =""; |
|
} else { |
|
document.getElementById('mapmenu').style.display="none"; |
|
} |
|
} |
|
return; |
|
} |
|
|
|
COURSECONTENTSCRIPT |
|
} |
|
|
sub startpage { |
sub startpage { |
my ($r) = @_; |
my ($r,$psymb) = @_; |
|
|
my %loaditems = ('onunload' => "pclose()", |
my %loaditems = ( |
'onload' => "showHide_courseContent(); group_or_section('cgroup')", |
'onload' => "group_or_section('cgroup')", |
); |
); |
|
if (!$psymb) { |
|
$loaditems{'onload'} = "showHide_courseContent(); group_or_section('cgroup'); resize_scrollbox('mapmenuscroll','1','1');"; |
|
} |
|
|
if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
Line 915 sub startpage {
|
Line 926 sub startpage {
|
text=>"Table Mode", |
text=>"Table Mode", |
help => 'Course_Setting_Parameters'}); |
help => 'Course_Setting_Parameters'}); |
} |
} |
|
my $js = &page_js().' |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
'. |
|
&Apache::lonhtmlcommon::resize_scrollbox_js('params').' |
|
// ]]> |
|
</script> |
|
'; |
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page('Set/Modify Course Parameters', |
&Apache::loncommon::start_page('Set/Modify Course Parameters',$js, |
&page_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 $escpart=&Apache::lonhtmlcommon::entity_encode($env{'form.part'}); |
|
$r->print($start_page.$breadcrumbs); |
$r->print(<<ENDHEAD); |
$r->print(<<ENDHEAD); |
$start_page |
|
$breadcrumbs |
|
<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" /> |
<input type="hidden" value="" name="pres_type" /> |
<input type="hidden" value="" name="pres_type" /> |
<input type="hidden" value="" name="pres_marker" /> |
<input type="hidden" value="" name="pres_marker" /> |
<input type="hidden" value="1" name="prevvisit" /> |
<input type="hidden" value="1" name="prevvisit" /> |
|
<input type="hidden" value="$escfilter" name="filter" /> |
|
<input type="hidden" value="$escpart" name="part" /> |
ENDHEAD |
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)=@_; |
$defbgtwo,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups,$noeditgrp, |
|
$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 961 sub print_row {
|
Line 983 sub print_row {
|
|
|
if ($parmlev eq 'full') { |
if ($parmlev eq 'full') { |
$r->print('<td style="background-color:'.$defbgtwo.';" align="center">' |
$r->print('<td style="background-color:'.$defbgtwo.';" align="center">' |
.$$part{$which}.'</td>'); |
.($$part{$which} eq '0'?'0 ('.&mt('default').')':$$part{$which}).'</td>'); |
} else { |
} else { |
$parm=~s|\[.*\]\s||g; |
$parm=~s|\[.*\]\s||g; |
} |
} |
Line 980 sub print_row {
|
Line 1002 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); |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
} elsif ($cgroup) { |
} elsif ($cgroup) { |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly); |
} elsif ($csec) { |
} elsif ($csec) { |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
} else { |
} else { |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
} |
} |
} elsif ($parmlev eq 'map') { |
} elsif ($parmlev eq 'map') { |
|
|
if ($uname) { |
if ($uname) { |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
} elsif ($cgroup) { |
} elsif ($cgroup) { |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly); |
} elsif ($csec) { |
} elsif ($csec) { |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
} else { |
} else { |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
} |
} |
} 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) = |
&print_usergroups($r,$$part{$which}.'.'.$$name{$which}, |
&check_other_groups($$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 1017 sub print_row {
|
Line 1039 sub print_row {
|
} |
} |
} |
} |
|
|
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
|
|
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
|
|
if ($csec) { |
if ($csec) { |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
} |
} |
|
|
if ($cgroup) { |
if ($cgroup) { |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly); |
&print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly); |
} |
} |
|
|
if ($uname) { |
if ($uname) { |
if ($othergrp) { |
if ($othergrp) { |
$r->print($othergrp); |
$r->print($othergrp); |
} |
} |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
&print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); |
&print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly); |
} |
} |
|
|
} # end of $parmlev if/else |
} # end of $parmlev if/else |
Line 1062 sub print_row {
|
Line 1084 sub print_row {
|
} |
} |
|
|
sub print_td { |
sub print_td { |
my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_; |
my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display,$noeditgrp,$readonly)=@_; |
$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 ($which == 11 || $which == 12) { |
if ($readonly) { |
$nolink = 1; |
$nolink = 1; |
} elsif ($mprefix =~ /availablestudent\&$/) { |
} else { |
if ($which > 3) { |
if ($which == 11 || $which == 12) { |
$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 1083 sub print_td {
|
Line 1117 sub print_td {
|
$r->print('</td>'."\n"); |
$r->print('</td>'."\n"); |
} |
} |
|
|
sub print_usergroups { |
sub check_other_groups { |
my ($r,$what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_; |
my ($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 1099 sub print_usergroups {
|
Line 1133 sub print_usergroups {
|
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 1169 sub extractResourceInformation {
|
Line 1202 sub extractResourceInformation {
|
$$typep{$id}=$1; |
$$typep{$id}=$1; |
$$keyp{$id}=''; |
$$keyp{$id}=''; |
$$uris{$id}=$srcf; |
$$uris{$id}=$srcf; |
|
|
foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) { |
foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) { |
next if ($key!~/^parameter_/); |
next if ($key!~/^parameter_/); |
|
|
Line 1224 sub extractResourceInformation {
|
Line 1258 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 Course Documents'); |
$$maptitles{$mapid}=&mt('Main Content'); |
} else { |
} else { |
$$maptitles{$mapid}=&Apache::lonnet::gettitle($$mapp{$id}); |
$$maptitles{$mapid}=&Apache::lonnet::gettitle($$mapp{$id}); |
} |
} |
Line 1245 sub isdateparm {
|
Line 1279 sub isdateparm {
|
} |
} |
|
|
# |
# |
# This function prints a list of parameters, which were selected. It also display a link from which you can |
# parmmenu displays a list of the selected parameters. |
# hide or show the complete parameter list, from which you can choose your parameters. |
# It also offers a link to show/hide the complete parameter list |
|
# from which you can select all desired parameters. |
# |
# |
sub parmmenu { |
sub parmmenu { |
my ($r,$allparms,$pscat,$keyorder)=@_; |
my ($r)=@_; |
my $tempkey; |
|
$r->print(<<ENDSCRIPT); |
$r->print(<<ENDSCRIPT); |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 1267 sub parmmenu {
|
Line 1301 sub parmmenu {
|
ele = document.forms.parmform.elements[i]; |
ele = document.forms.parmform.elements[i]; |
if (ele.name == checkName) { |
if (ele.name == checkName) { |
document.forms.parmform.elements[i].checked=value; |
document.forms.parmform.elements[i].checked=value; |
document.getElementById(document.forms.parmform.elements[i].value.concat(li)).style.display = displayOverview; |
|
} |
} |
} |
} |
} |
} |
|
|
function checkthis(thisvalue, checkName) { |
function checkthis(thisvalue, checkName) { |
|
|
document.getElementById(thisvalue.concat("_li")).style.display = ""; |
|
|
|
for (i=0; i<document.forms.parmform.elements.length; i++) { |
for (i=0; i<document.forms.parmform.elements.length; i++) { |
ele = document.forms.parmform.elements[i]; |
ele = document.forms.parmform.elements[i]; |
Line 1293 sub parmmenu {
|
Line 1325 sub parmmenu {
|
} |
} |
|
|
function checkdisset() { |
function checkdisset() { |
checkthis('discussend','pscat'); |
checkthis('discussend','pscat'); |
checkthis('discusshide','pscat'); |
checkthis('discusshide','pscat'); |
|
checkthis('discussvote','pscat'); |
} |
} |
|
|
function checkcontdates() { |
function checkcontdates() { |
Line 1321 sub parmmenu {
|
Line 1354 sub parmmenu {
|
checkdates(); |
checkdates(); |
checkthis('weight','pscat'); |
checkthis('weight','pscat'); |
checkthis('maxtries','pscat'); |
checkthis('maxtries','pscat'); |
|
checkthis('type','pscat'); |
|
checkthis('problemstatus','pscat'); |
} |
} |
|
|
function hideParms() { |
|
document.getElementById('LC_parm_overview_parm_menu').style.display = "none"; |
|
} |
|
|
|
function showParms() { |
|
document.getElementById('LC_parm_overview_parm_menu').style.display = ""; |
|
} |
|
|
|
function checkboxChecked(id) { |
|
var li = "_li"; |
|
var id_li = id.concat(li); |
|
if (document.getElementById(id_li).style.display == "none") { |
|
document.getElementById(id_li).style.display = ""; |
|
} |
|
else { |
|
document.getElementById(id_li).style.display = "none"; |
|
} |
|
} |
|
// ]]> |
// ]]> |
</script> |
</script> |
ENDSCRIPT |
ENDSCRIPT |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View'))); |
|
|
|
#part to print selected parms overview |
|
$r->print(&mt('Selected Parameters:').'<br />'); |
|
|
|
#print out all possible parms and hide them by default |
$r->print('<hr />'); |
$r->print('<ul>'); |
&shortCuts($r); |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
$r->print('<hr />'); |
$r->print('<li id="'.$tempkey.'_li" value="'.$tempkey.'_li" name="pscat_li"'); |
|
if (!($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat})) { |
|
$r->print(' style="display:none"'); |
|
} |
|
$r->print('>' |
|
.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} : $tempkey) |
|
.'</li>' |
|
); |
|
} |
|
$r->print('</ul>' |
|
.'<p><a href="javascript:showParms()">' |
|
.&mt('Show detailed Parameter Selection') |
|
.'</a></p>' |
|
); |
|
|
|
&shortCuts($r,$allparms,$pscat,$keyorder); |
|
|
|
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
|
} |
} |
# return a hash |
# return a hash |
sub categories { |
sub categories { |
Line 1396 sub lookUpTableParameter {
|
Line 1391 sub lookUpTableParameter {
|
'contentopen' => 'time_settings', |
'contentopen' => 'time_settings', |
'contentclose' => 'time_settings', |
'contentclose' => 'time_settings', |
'discussend' => 'time_settings', |
'discussend' => 'time_settings', |
|
'printstartdate' => 'time_settings', |
|
'printenddate' => 'time_settings', |
'weight' => 'grading', |
'weight' => 'grading', |
'handgrade' => 'grading', |
'handgrade' => 'grading', |
'maxtries' => 'tries', |
'maxtries' => 'tries', |
'hinttries' => 'tries', |
'hinttries' => 'tries', |
|
'randomizeontries' => 'tries', |
'type' => 'problem_appearance', |
'type' => 'problem_appearance', |
'problemstatus' => 'problem_appearance', |
'problemstatus' => 'problem_appearance', |
'display' => 'problem_appearance', |
'display' => 'problem_appearance', |
Line 1426 sub lookUpTableParameter {
|
Line 1424 sub lookUpTableParameter {
|
'acc' => 'misc', |
'acc' => 'misc', |
'maxcollaborators' => 'misc', |
'maxcollaborators' => 'misc', |
'scoreformat' => 'misc', |
'scoreformat' => 'misc', |
|
'lenient' => 'grading', |
); |
'retrypartial' => 'tries', |
|
'discussvote' => 'misc', |
|
'examcode' => 'high_level_randomization', |
|
); |
} |
} |
|
|
sub whatIsMyCategory { |
sub whatIsMyCategory { |
Line 1493 sub parmboxes {
|
Line 1494 sub parmboxes {
|
'slots' => [], |
'slots' => [], |
'file_submission' => [], |
'file_submission' => [], |
'misc' => [], |
'misc' => [], |
); |
); |
|
|
foreach $tempparameter (keys %$allparms) { |
foreach $tempparameter (keys %$allparms) { |
&whatIsMyCategory($tempparameter, \%categoryList); |
&whatIsMyCategory($tempparameter, \%categoryList); |
} |
} |
#part to print the parm-list |
#part to print the parm-list |
$r->print('<fieldset id="LC_parm_overview_parm_menu" style="display:none">' |
$Text::Wrap::columns=60; |
.'<legend>'.&mt('Parameter').'</legend>'."\n" |
$Text::Wrap::separator='<br />'; |
); |
$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) { |
if(@{$categoryList{$key}} == 0) { |
next if(@{$categoryList{$key}} == 0); |
next; |
$r->print('<div class="LC_Box LC_400Box">' |
} else { |
.'<h4 class="LC_hcell">' |
$r->print('<fieldset>' |
.&mt($categories{$key}) |
.'<legend>' |
.'</h4>'."\n"); |
.&mt($categories{$key}) |
foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { |
.'</legend>'."\n"); |
next if ($tempkey eq ''); |
foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { |
$r->print('<span class="LC_nobreak">' |
$r->print('<span class="LC_nobreak">' |
.'<label><input type="checkbox" name="pscat" ' |
.'<label><input type="checkbox" name="pscat" '); |
.'value="'.$tempkey.'" '); |
$r->print('value="'.$tempkey.'" '); |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
$r->print('onclick="checkboxChecked(\''.$tempkey.'\')"'); |
$r->print(' checked="checked"'); |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
|
$r->print(' checked="checked"'); |
|
} |
|
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} |
|
: $tempkey) |
|
.'</label></span> '); |
|
} |
} |
$r->print('</fieldset>'); |
$r->print(' />'.($$allparms{$tempkey}=~/\S/ ? |
|
Text::Wrap::wrap('',' 'x4,$$allparms{$tempkey}) |
|
: $tempkey) |
|
.'</label></span><br />'."\n"); |
} |
} |
|
$r->print("</div>\n"); |
} |
} |
$r->print('<hr />' |
|
.'<a href="javascript:hideParms()">' |
|
.&mt('Hide') |
|
.'</a>' |
|
); |
|
|
|
#&shortCuts($r,$allparms,$pscat,$keyorder); |
$r->print("</div>\n"); |
$r->print('</fieldset>'); |
|
} |
} |
# |
# |
# 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,$allparms,$pscat,$keyorder)=@_; |
my ($r)=@_; |
|
|
#part to print out the shortcuts for parmselection |
# Parameter Selection |
$r->print('<table><tr id="LC_parm_overview_parm_menu_selectors">' |
$r->print( |
.'<td valign="top">' |
&Apache::lonhtmlcommon::start_funclist(&mt('Parameter Selection')) |
.'<fieldset><legend>'.&mt('Parameter Selection').'</legend>' |
.&Apache::lonhtmlcommon::add_item_funclist( |
.'<span class="LC_nobreak">' |
'<a href="javascript:checkall(true, \'pscat\')">'.&mt('Select All').'</a>') |
.'• <a href="javascript:checkall(true, \'pscat\')">'.&mt('Select All').'</a>' |
.&Apache::lonhtmlcommon::add_item_funclist( |
.'</span>' |
'<a href="javascript:checkstandard()">'.&mt('Select Common Only').'</a>') |
.'<br />' |
.&Apache::lonhtmlcommon::add_item_funclist( |
.'<span class="LC_nobreak">' |
'<a href="javascript:checkall(false, \'pscat\')">'.&mt('Unselect All').'</a>') |
.'• <a href="javascript:checkstandard()">'.&mt('Select Common Only').'</a>' |
.&Apache::lonhtmlcommon::end_funclist() |
.'</span>' |
); |
.'<br />' |
|
.'<span class="LC_nobreak">' |
# Add Selection for... |
.'• <a href="javascript:checkall(false, \'pscat\')">'.&mt('Unselect All').'</a>' |
$r->print( |
.'</span>' |
&Apache::lonhtmlcommon::start_funclist(&mt('Add Selection for...')) |
.'</fieldset>' |
.&Apache::lonhtmlcommon::add_item_funclist( |
.'</td>' |
'<a href="javascript:checkdates()">'.&mt('Problem Dates').'</a>') |
.'<td colspan="2" valign="top">' |
.&Apache::lonhtmlcommon::add_item_funclist( |
.'<fieldset><legend>'.&mt('Add Selection for...').'</legend>' |
'<a href="javascript:checkcontdates()">'.&mt('Content Dates').'</a>') |
.'<span class="LC_nobreak">' |
.&Apache::lonhtmlcommon::add_item_funclist( |
.'• <a href="javascript:checkdates()">'.&mt('Problem Dates').'</a>' |
'<a href="javascript:checkdisset()">'.&mt('Discussion Settings').'</a>') |
.'</span>' |
.&Apache::lonhtmlcommon::add_item_funclist( |
.'<span class="LC_nobreak">' |
'<a href="javascript:checkvisi()">'.&mt('Visibilities').'</a>') |
.' • <a href="javascript:checkcontdates()">'.&mt('Content Dates').'</a>' |
.&Apache::lonhtmlcommon::add_item_funclist( |
.'</span>' |
'<a href="javascript:checkparts()">'.&mt('Part Parameters').'</a>') |
# .'<br />' |
.&Apache::lonhtmlcommon::end_funclist() |
.'<span class="LC_nobreak">' |
); |
.' • <a href="javascript:checkdisset()">'.&mt('Discussion Settings').'</a>' |
|
.'</span>' |
|
.'<span class="LC_nobreak">' |
|
.' • <a href="javascript:checkvisi()">'.&mt('Visibilities').'</a>' |
|
.'</span>' |
|
# .'<br />' |
|
.'<span class="LC_nobreak">' |
|
.' • <a href="javascript:checkparts()">'.&mt('Part Parameters').'</a>' |
|
.'</span>' |
|
.'</fieldset>' |
|
.'</td>' |
|
.'</tr></table>'); |
|
} |
} |
|
|
sub partmenu { |
sub partmenu { |
my ($r,$allparts,$psprt)=@_; |
my ($r,$allparts,$psprt)=@_; |
|
my $selsize = 1+scalar(keys(%{$allparts})); |
|
if ($selsize > 8) { |
|
$selsize = 8; |
|
} |
|
|
$r->print('<select multiple="multiple" name="psprt" size="8">'); |
$r->print('<select multiple="multiple" name="psprt" size="'.$selsize.'">'); |
$r->print('<option value="all"'); |
$r->print('<option value="all"'); |
$r->print(' selected="selected"') unless (@{$psprt}); |
$r->print(' selected="selected"') unless (@{$psprt}); |
$r->print('>'.&mt('All Parts').'</option>'); |
$r->print('>'.&mt('All Parts').'</option>'); |
Line 1606 sub partmenu {
|
Line 1592 sub partmenu {
|
} |
} |
|
|
sub usermenu { |
sub usermenu { |
my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,$usersgroups)=@_; |
my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,$usersgroups,$pssymb)=@_; |
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'); |
&Apache::loncommon::selectstudent_link('parmform','uname','udom','condition'). |
my $selscript=&Apache::loncommon::studentbrowser_javascript(); |
&Apache::lonhtmlcommon::scripttag(<<ENDJS); |
|
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 = &Apache::longroup::coursegroups(); |
my %grouphash; |
|
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=''; |
|
|
if (%sectionhash) { |
my $currsec = $env{'request.course.sec'}; |
|
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 1634 sub usermenu {
|
Line 1659 sub usermenu {
|
$sections.='</select>'; |
$sections.='</select>'; |
} |
} |
|
|
if (%sectionhash && %grouphash && $parmlev ne 'full') { |
if (%sectionhash && %grouphash && $parmlev ne 'full' && $currsec eq '') { |
$sections .= ' '.&mt('or').' '; |
$sections .= ' '.&mt('or').' '; |
$sections .= qq| |
$sections .= qq| |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 1653 function group_or_section(caller) {
|
Line 1678 function group_or_section(caller) {
|
// ]]> |
// ]]> |
</script> |
</script> |
|; |
|; |
} else { |
} elsif ($currsec eq '') { |
$sections .= qq| |
$sections .= qq| |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 1667 function group_or_section(caller) {
|
Line 1692 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') { |
if (%sectionhash && $env{'form.action'} eq 'settable' && $currsec eq '') { |
$groups .= qq| onchange="group_or_section('cgroup')" |; |
$groups .= qq| onchange="group_or_section('cgroup')" |; |
} |
} |
$groups .= '>'; |
$groups .= '>'; |
Line 1706 function group_or_section(caller) {
|
Line 1731 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,$allparts,$pscat,$psprt,$keyorder)=@_; |
my ($r,$allparms,$pscat,$keyorder,$divid)=@_; |
|
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&parmmenu($r,$allparms,$pscat,$keyorder); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View'))); |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
|
&parmmenu($r); |
|
$r->print(&Apache::loncommon::start_scrollbox('480px','440px','200px',$divid)); |
&parmboxes($r,$allparms,$pscat,$keyorder); |
&parmboxes($r,$allparms,$pscat,$keyorder); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::loncommon::end_scrollbox()); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
|
&partmenu($r,$allparts,$psprt); |
|
$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()); |
|
|
} |
} |
|
|
sub mapmenu { |
sub mapmenu { |
my ($r,$allmaps,$pschp,$maptitles, $symbp)=@_; |
my ($r,$allmaps,$pschp,$maptitles,$symbp,$parmlev)=@_; |
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=[]; |
my $treeinfo={}; |
my $treeinfo={}; |
if (defined($navmap)) { |
if (defined($navmap)) { |
my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); |
my $it=$navmap->getIterator(undef,undef,undef,1,1,undef); |
my $curRes; |
my $curRes; |
my $depth = 0; |
my $depth = 0; |
my %parent = (); |
my %parent = (); |
Line 1767 sub mapmenu {
|
Line 1795 sub mapmenu {
|
} |
} |
} |
} |
# Show it ... |
# Show it ... |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'),'','',' id="mapmenu"')); |
my $rowattr = ' 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="" />'; |
$r->print(&Apache::loncommon::start_data_table() |
my $whitespace = |
.&Apache::loncommon::start_data_table_row() |
'<img src="' |
.'<td>'.$icon |
.&Apache::loncommon::lonhttpdurl('/adm/lonIcons/whitespace_21.gif') |
.'<label> ' |
.'" alt="" />'; |
.'<input type="radio" name="pschp" checked="checked" value="all" />' |
|
.&mt('All Maps or Folders') |
# Info about selectable folders/maps |
.'</label></td>' |
$r->print( |
.&Apache::loncommon::end_data_table_row() |
'<div class="LC_info">' |
|
.&mt('You can only select maps and folders which have modifiable settings.') |
|
.' '.&Apache::loncommon::help_open_topic('Parameter_Set_Folder') |
|
.'</div>' |
|
); |
|
|
|
$r->print(&Apache::loncommon::start_scrollbox('700px','680px','400px','mapmenuscroll')); |
|
$r->print(&Apache::loncommon::start_data_table(undef,'mapmenuinner')); |
|
|
|
# Display row: "All Maps or Folders" |
|
$r->print( |
|
&Apache::loncommon::start_data_table_row(undef,'picklevel') |
|
.'<td>' |
|
.'<label>' |
|
.'<input type="radio" name="pschp"' |
); |
); |
my $whitespace = '<img src="' |
$r->print(' checked="checked"') if ($pschp eq 'all' || !$pschp); |
.&Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21.gif") |
$r->print( |
.'" alt="" />'; |
' value="all" /> '.$icon.' ' |
|
.&mt('All Maps or Folders') |
|
.'</label>' |
|
.'<hr /></td>' |
|
.&Apache::loncommon::end_data_table_row() |
|
); |
|
|
|
# Display row: "Main Content" |
if (exists($$allmaps{1})) { |
if (exists($$allmaps{1})) { |
$r->print(&Apache::loncommon::start_data_table_row() |
$r->print( |
.'<td>'.$icon |
&Apache::loncommon::start_data_table_row() |
.'<label> ' |
.'<td>' |
.'<input type="radio" name="pschp" value="1"' |
.'<label>' |
|
.'<input type="radio" name="pschp" value="1"' |
); |
); |
if ($pschp eq 1) { |
$r->print(' checked="checked"') if ($pschp eq '1'); |
$r->print(' checked="checked"'); |
$r->print( |
} |
'/> '.$icon.' ' |
$r->print('/>' |
.$$maptitles{1} |
.$$maptitles{1} |
.($$allmaps{1} !~/^uploaded/?' ['.$$allmaps{1}.']':'') |
.($$allmaps{1} !~/^uploaded/?' ['.$$allmaps{1}.']':'') |
.'</label>' |
.'</label>' |
.'</td>' |
.'</td>' |
.&Apache::loncommon::end_data_table_row() |
.&Apache::loncommon::end_data_table_row() |
|
); |
); |
} |
} |
|
|
|
# Display rows for all course maps and folders |
foreach my $id (@{$tree}) { |
foreach my $id (@{$tree}) { |
my ($mapid,$resid)=split(/\./,$id); |
my ($mapid,$resid)=split(/\./,$id); |
# Indentation |
# Indentation |
Line 1814 sub mapmenu {
|
Line 1869 sub mapmenu {
|
my $symb_name = $$symbp{$id}; |
my $symb_name = $$symbp{$id}; |
my ($front, $tail) = split (/___${resid}___/, $symb_name); |
my ($front, $tail) = split (/___${resid}___/, $symb_name); |
$symb_name = $tail; |
$symb_name = $tail; |
$r->print(&Apache::loncommon::start_data_table_row() |
$r->print( |
.'<td>'.$indent.$icon |
&Apache::loncommon::start_data_table_row() |
.'<label> ' |
.'<td>' |
.'<input type ="radio" name="pschp" value="'.$allmaps_inverted{$symb_name}.'"' |
.'<label>' |
); |
); |
if ($pschp eq $allmaps_inverted{$symb_name}) { |
# Only offer radio button for folders/maps which can be parameterized |
$r->print(' checked="checked"'); |
if ($allmaps_inverted{$symb_name}) { |
|
$r->print( |
|
'<input type ="radio" name="pschp"' |
|
.' value="'.$allmaps_inverted{$symb_name}.'"' |
|
); |
|
$r->print(' checked="checked"') if ($allmaps_inverted{$symb_name} eq $pschp); |
|
$r->print('/>'); |
|
} else { |
|
$r->print($whitespace); |
} |
} |
$r->print('/>' |
$r->print( |
.$treeinfo->{$id}->{name} |
$indent.$icon.' ' |
.($$allmaps{$mapid}!~/^uploaded/?' ['.$$allmaps{$mapid}.']':'') |
.$treeinfo->{$id}->{name} |
.'</label>' |
.($$allmaps{$mapid}!~/^uploaded/?' ['.$$allmaps{$mapid}.']':'') |
.'</td>' |
.'</label>' |
.&Apache::loncommon::end_data_table_row() |
.'</td>' |
|
.&Apache::loncommon::end_data_table_row() |
); |
); |
} |
} |
$r->print(&Apache::loncommon::end_data_table()); |
|
|
$r->print(&Apache::loncommon::end_data_table(). |
|
'<br style="line-height:2px;" />'. |
|
&Apache::loncommon::end_scrollbox()); |
} |
} |
} |
} |
|
|
Line 1853 sub levelmenu {
|
Line 1920 sub levelmenu {
|
|
|
|
|
sub sectionmenu { |
sub sectionmenu { |
my ($r,$selectedsections)=@_; |
my ($selectedsections)=@_; |
my %sectionhash = &Apache::loncommon::get_sections(); |
my %sectionhash = &Apache::loncommon::get_sections(); |
return if (!%sectionhash); |
return '' if (!%sectionhash); |
|
|
$r->print('<select name="Section" multiple="multiple" size="8">'); |
my (@possibles,$disabled); |
foreach my $s ('all',sort keys %sectionhash) { |
if ($env{'request.course.sec'} ne '') { |
$r->print(' <option value="'.$s.'"'); |
@possibles = ($env{'request.course.sec'}); |
foreach (@{$selectedsections}) { |
$selectedsections = [$env{'request.course.sec'}]; |
if ($s eq $_) { |
$disabled = ' disabled="disabled"'; |
$r->print(' selected="selected"'); |
} else { |
last; |
@possibles = ('all',sort(keys(%sectionhash))); |
} |
|
} |
} |
$r->print('>'.$s."</option>\n"); |
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"; |
} |
} |
$r->print("</select>\n"); |
$output .= "</select>\n"; |
|
return $output; |
} |
} |
|
|
sub groupmenu { |
sub groupmenu { |
my ($r,$selectedgroups)=@_; |
my ($selectedgroups)=@_; |
my %grouphash = &Apache::longroup::coursegroups(); |
my %grouphash; |
return if (!%grouphash); |
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'}); |
|
} |
|
return '' if (!%grouphash); |
|
|
$r->print('<select name="Group" multiple="multiple" size="8">'); |
my $output = '<select name="Group" multiple="multiple" size="8">'; |
foreach my $group (sort(keys(%grouphash))) { |
foreach my $group (sort(keys(%grouphash))) { |
$r->print(' <option value="'.$group.'"'); |
$output .= ' <option value="'.$group.'"'; |
foreach (@{$selectedgroups}) { |
if ((@{$selectedgroups}) && (grep(/^\Q$group\E$/,\@{$selectedgroups}))) { |
if ($group eq $_) { |
$output .= ' selected="selected"'; |
$r->print(' selected="selected"'); |
|
last; |
|
} |
} |
|
$output .= '>'.$group."</option>\n"; |
} |
} |
$r->print('>'.$group."</option>\n"); |
$output .= "</select>\n"; |
} |
return $output; |
$r->print("</select>\n"); |
|
} |
} |
|
|
|
|
sub keysplit { |
sub keysplit { |
my $keyp=shift; |
my $keyp=shift; |
return (split(/\,/,$keyp)); |
return (split(/\,/,$keyp)); |
Line 1956 sub standardkeyorder {
|
Line 2031 sub standardkeyorder {
|
'parameter_0_tol' => 16, |
'parameter_0_tol' => 16, |
'parameter_0_sig' => 17, |
'parameter_0_sig' => 17, |
'parameter_0_turnoffunit' => 18, |
'parameter_0_turnoffunit' => 18, |
'parameter_0_discussend' => 19, |
'parameter_0_discussend' => 19, |
'parameter_0_discusshide' => 20); |
'parameter_0_discusshide' => 20, |
|
'parameter_0_discussvote' => 21, |
|
'parameter_0_printstartdate' => 22, |
|
'parameter_0_printenddate' => 23); |
} |
} |
|
|
|
|
sub assessparms { |
sub assessparms { |
|
|
my $r=shift; |
my ($r,$parm_permission) = @_; |
|
|
|
|
|
# -------------------------------------------------------- Variable declaration |
my @ids=(); |
my @ids=(); |
my %symbp=(); |
my %symbp=(); |
my %mapp=(); |
my %mapp=(); |
Line 1972 sub assessparms {
|
Line 2052 sub assessparms {
|
my %keyp=(); |
my %keyp=(); |
my %uris=(); |
my %uris=(); |
my %maptitles=(); |
my %maptitles=(); |
|
|
# -------------------------------------------------------- Variable declaration |
|
|
|
my %allmaps=(); |
my %allmaps=(); |
my %alllevs=(); |
my %alllevs=(); |
|
|
Line 1993 sub assessparms {
|
Line 2070 sub assessparms {
|
|
|
my %allparms; |
my %allparms; |
my %allparts; |
my %allparts; |
|
# ------------------------------------------------------------------------------ |
|
|
# |
# |
# Order in which these parameters will be displayed |
# Order in which these parameters will be displayed |
# |
# |
my %keyorder=&standardkeyorder(); |
my %keyorder=&standardkeyorder(); |
|
|
@ids=(); |
# @ids=(); |
%symbp=(); |
# %symbp=(); # These seem defined above already. |
%typep=(); |
# %typep=(); |
|
|
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 2017 sub assessparms {
|
Line 2110 sub assessparms {
|
|
|
my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); |
my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); |
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]='0'; } |
|
if (($env{'form.part'}) && ($psprt[0] ne 'all')) { $psprt[0]=$env{'form.part'}; } |
|
|
my $pssymb=''; |
my $pssymb=''; |
my $parmlev=''; |
my $parmlev=''; |
Line 2074 sub assessparms {
|
Line 2170 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') { |
$message='<span class="LC_error">'. |
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
&mt("User")." '$uname' ".&mt("at domain")." '$udom' ". |
if ($env{'form.userroles'} eq 'any') { |
&mt("not in this course")."</span>"; |
if (($env{'user.name'} eq $uname) && ($env{'user.domain'} eq $udom)) { |
$uname=''; |
$csec = $env{'request.course.sec'}; |
$csec=$env{'form.csec'}; |
$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 { |
|
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('ID').": ".$name{'id'}.'<p>'; |
."<br />\n".&mt('Student/Employee ID').': '.$name{'id'}.'</p>'; |
} |
@usersgroups = &Apache::lonnet::get_users_groups( |
@usersgroups = &Apache::lonnet::get_users_groups( |
$udom,$uname,$env{'request.course.id'}); |
$udom,$uname,$env{'request.course.id'}); |
if (@usersgroups > 0) { |
if (@usersgroups > 0) { |
unless (grep(/^\Q$cgroup\E$/,@usersgroups)) { |
unless (grep(/^\Q$cgroup\E$/,@usersgroups)) { |
$cgroup = $usersgroups[0]; |
$cgroup = $usersgroups[0]; |
} |
|
} else { |
|
$cgroup = ''; |
} |
} |
} |
} |
} |
} |
Line 2110 sub assessparms {
|
Line 2305 sub assessparms {
|
$symbp{'0.0'} = ''; |
$symbp{'0.0'} = ''; |
|
|
# ---------------------------------------------------------- Anything to store? |
# ---------------------------------------------------------- Anything to store? |
if ($env{'form.pres_marker'}) { |
if ($env{'form.pres_marker'} && $parm_permission->{'edit'}) { |
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'}); |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
|
my ($got_chostname,$chostname,$cmajor,$cminor); |
|
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); |
|
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 $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
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); |
my ($level,@all) = |
my ($level,@all) = |
Line 2147 sub assessparms {
|
Line 2359 sub assessparms {
|
} |
} |
} |
} |
} |
} |
|
} elsif ($markers[$i] =~ /_(type|lenient|retrypartial|discussvote|examcode|printstartdate|printenddate)\&\d+$/) { |
|
$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 = |
|
$Apache::lonnet::needsrelease{"parameter:$name:$val"}; |
|
if ($needsrelease) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor) = ¶meter_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
$needsnewer = ¶meter_releasecheck($name,$val, |
|
$needsrelease, |
|
$cmajor,$cminor); |
|
} |
|
} |
|
if ($needsnewer) { |
|
$message .= &oldversion_warning($name,$values[$i],$chostname,$cmajor, |
|
$cminor,$needsrelease); |
|
} else { |
|
$message.=&storeparm(split(/\&/,$markers[$i]), |
|
$values[$i], |
|
$types[$i], |
|
$uname,$udom,$csec,$cgroup); |
|
$totalstored ++; |
} |
} |
$message.=&storeparm(split(/\&/,$markers[$i]), |
|
$values[$i], |
|
$types[$i], |
|
$uname,$udom,$csec,$cgroup); |
|
} |
} |
# ---------------------------------------------------------------- Done storing |
# ---------------------------------------------------------------- Done storing |
$message.='<p class="LC_warning">' |
if ($totalstored) { |
.&mt('Changes can take up to 10 minutes before being active for all students.') |
$message.='<p class="LC_warning">' |
.&Apache::loncommon::help_open_topic('Caching') |
.&mt('Changes for [quant,_1,parameter] saved.',$totalstored) |
.'</p>'; |
.'<br />' |
|
.&mt('Changes can take up to 10 minutes before being active for all students.') |
|
.&Apache::loncommon::help_open_topic('Caching') |
|
.'</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 |
if ($pscat[0] eq "all") {@pscat = (keys %allparms);} |
if ($pscat[0] eq "all") {@pscat = (keys %allparms);} |
if (!@pscat) { @pscat=('duedate','opendate','answerdate','weight','maxtries') }; |
if (!@pscat) { @pscat=('duedate','opendate','answerdate','weight','maxtries','type','problemstatus') }; |
if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);} |
if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);} |
# ------------------------------------------------------------------ Start page |
# ------------------------------------------------------------------ Start page |
|
|
&startpage($r); |
&startpage($r,$pssymb); |
|
|
foreach ('tolerance','date_default','date_start','date_end', |
foreach ('tolerance','date_default','date_start','date_end', |
'date_interval','int','float','string') { |
'date_interval','int','float','string') { |
Line 2188 function parmsel_show() {
|
Line 2457 function parmsel_show() {
|
</script> |
</script> |
ENDPARMSELSCRIPT |
ENDPARMSELSCRIPT |
|
|
# Display Unit 1 "General Parameters" |
|
if (!$pssymb) { |
if (!$pssymb) { |
my $parmselhiddenstyle=' style="display:none"'; |
my $parmselhiddenstyle=' style="display:none"'; |
if($env{'form.hideparmsel'} eq 'hidden') { |
if($env{'form.hideparmsel'} eq 'hidden') { |
Line 2197 ENDPARMSELSCRIPT
|
Line 2465 ENDPARMSELSCRIPT
|
$r->print('<div id="parmsel">'); |
$r->print('<div id="parmsel">'); |
} |
} |
|
|
$r->print(&Apache::lonhtmlcommon::topic_bar(1,&mt('Resource Specification'))); |
# Step 1 |
$r->print(<<COURSECONTENTSCRIPT); |
$r->print(&Apache::lonhtmlcommon::topic_bar(1,&mt('Resource Specification'),'parmstep1')); |
|
$r->print(' |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA['. |
function showHide_courseContent(){ |
&showhide_js().' |
var parmlevValue=document.getElementById("parmlev").value; |
|
if (parmlevValue == 'general') { |
|
document.getElementById('mapmenu').style.display="none"; |
|
} else { |
|
if ((parmlevValue == "full") || (parmlevValue == "map")) { |
|
document.getElementById('mapmenu').style.display =""; |
|
} else { |
|
document.getElementById('mapmenu').style.display="none"; |
|
} |
|
} |
|
} |
|
// ]]> |
// ]]> |
</script> |
</script> |
COURSECONTENTSCRIPT |
'); |
|
$r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel')); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
|
&levelmenu($r,\%alllevs,$parmlev); |
&levelmenu($r,\%alllevs,$parmlev); |
|
$r->print(&Apache::lonhtmlcommon::row_closure()); |
|
&mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp,$parmlev); |
|
$r->print(&Apache::lonhtmlcommon::row_closure()); |
|
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
|
&partmenu($r,\%allparts,\@psprt); |
$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()); |
|
|
|
# Step 2 |
|
$r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2')); |
|
&displaymenu($r,\%allparms,\@pscat,\%keyorder,'parmmenuscroll'); |
|
|
|
# Step 3 |
|
$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()); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles, \%symbp); |
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups,$pssymb); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
|
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
#Display Unit 2 "Select Parameter" |
|
$r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'))); |
|
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); |
|
$r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'))); |
|
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
|
&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()); |
|
|
|
# Update Display Button |
$r->print('<p>' |
$r->print('<p>' |
.'<input type="submit" name="dis"' |
.'<input type="submit" name="dis"' |
.' value="'.&mt('Update Parameter Display').'" />' |
.' value="'.&mt('Update Display').'" />' |
.'<input type="hidden" name="hideparmsel" value="hidden" />' |
.'<input type="hidden" name="hideparmsel" value="hidden" />' |
.'</p>'); |
.'</p>'); |
$r->print('</div>'); |
$r->print('</div>'); |
|
|
# Offer link to display parameter selection again |
# Offer link to display parameter selection again |
$r->print('<p id="parmsellink"'); |
$r->print('<p id="parmsellink"'); |
if ($env{'form.hideparmsel'} ne 'hidden') { |
if ($env{'form.hideparmsel'} ne 'hidden') { |
Line 2250 COURSECONTENTSCRIPT
|
Line 2514 COURSECONTENTSCRIPT
|
.'</a>' |
.'</a>' |
.'</p>'); |
.'</p>'); |
} else { |
} else { |
|
$r->print(); |
# parameter screen for a single resource. |
# parameter screen for a single resource. |
my ($map,$iid,$resource)=&Apache::lonnet::decode_symb($pssymb); |
my ($map,$iid,$resource)=&Apache::lonnet::decode_symb($pssymb); |
my $title = &Apache::lonnet::gettitle($pssymb); |
my $title = &Apache::lonnet::gettitle($pssymb); |
$r->print(&mt('Specific Resource: [_1] ([_2])',$title,$resource). |
$r->print(&mt('Specific Resource: [_1] ([_2])', |
|
$title,'<span class="LC_filename">'.$resource.'</span>'). |
'<input type="hidden" value="'.$pssymb.'" name="symb" />'. |
'<input type="hidden" value="'.$pssymb.'" name="symb" />'. |
'<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')). |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View')). |
'<label>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'. |
'<label>'. |
($env{'form.psprt'}?' checked="checked"':'').' /></label></td></tr>'); |
'<input type="checkbox" name="psprt" value="all"'. |
&usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); |
($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>' |
.'<input type="submit" name="dis"' |
.'<input type="submit" name="dis"' |
.' value="'.&mt('Update Parameter Display').'" />' |
.' value="'.&mt('Update Display').'" />' |
.'<input type="hidden" name="hideparmsel" value="hidden" />' |
.'<input type="hidden" name="hideparmsel" value="hidden" />' |
.'</p>'); |
.'</p>'); |
} |
} |
Line 2290 COURSECONTENTSCRIPT
|
Line 2559 COURSECONTENTSCRIPT
|
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') { |
|
# |
|
# This produces the cascading table output of parameters |
|
# |
my $coursespan=$csec?8:5; |
my $coursespan=$csec?8:5; |
my $userspan=3; |
my $userspan=3; |
if ($cgroup ne '') { |
if ($cgroup ne '') { |
$coursespan += 3; |
$coursespan += 3; |
} |
} |
|
|
$r->print('<p><table border="2">'); |
$r->print(&Apache::loncommon::start_data_table()); |
|
# |
|
# This produces the headers |
|
# |
$r->print('<tr><td colspan="5"></td>'); |
$r->print('<tr><td colspan="5"></td>'); |
$r->print('<th colspan="'.($coursespan).'">'.&mt('Any User').'</th>'); |
$r->print('<th colspan="'.($coursespan).'">'.&mt('Any User').'</th>'); |
if ($uname) { |
if ($uname) { |
Line 2311 COURSECONTENTSCRIPT
|
Line 2590 COURSECONTENTSCRIPT
|
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'pie' => "Parameter in Effect", |
'pie' => "Parameter in Effect", |
'csv' => "Current Session Value", |
'csv' => "Current Session Value", |
'at' => 'at', |
|
'rl' => "Resource Level", |
'rl' => "Resource Level", |
'ic' => 'in Course', |
'ic' => 'in Course', |
'aut' => "Assessment URL and Title", |
'aut' => "Assessment URL and Title", |
Line 2327 COURSECONTENTSCRIPT
|
Line 2605 COURSECONTENTSCRIPT
|
); |
); |
$r->print(<<ENDTABLETWO); |
$r->print(<<ENDTABLETWO); |
<th rowspan="3">$lt{'pie'}</th> |
<th rowspan="3">$lt{'pie'}</th> |
<th rowspan="3">$lt{'csv'}<br />($csuname $lt{'at'} $csudom)</th> |
<th rowspan="3">$lt{'csv'}<br />($csuname:$csudom)</th> |
</tr><tr><td colspan="5"></td><th colspan="2">$lt{'ic'}</th><th colspan="2">$lt{'rl'}</th> |
</tr><tr><td colspan="5"></td><th colspan="2">$lt{'ic'}</th><th colspan="2">$lt{'rl'}</th> |
<th colspan="1">$lt{'ic'}</th> |
<th colspan="1">$lt{'ic'}</th> |
|
|
Line 2363 ENDTABLEHEADFOUR
|
Line 2641 ENDTABLEHEADFOUR
|
} |
} |
|
|
$r->print('</tr>'); |
$r->print('</tr>'); |
|
# |
|
# Done with the headers |
|
# |
my $defbgone=''; |
my $defbgone=''; |
my $defbgtwo=''; |
my $defbgtwo=''; |
my $defbgthree = ''; |
my $defbgthree = ''; |
Line 2403 ENDTABLEHEADFOUR
|
Line 2683 ENDTABLEHEADFOUR
|
my %default=(); |
my %default=(); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
my $uri=&Apache::lonnet::declutter($uris{$rid}); |
|
|
|
my $filter=$env{'form.filter'}; |
foreach (&keysplit($keyp{$rid})) { |
foreach (&keysplit($keyp{$rid})) { |
my $tempkeyp = $_; |
my $tempkeyp = $_; |
if (grep $_ eq $tempkeyp, @catmarker) { |
if (grep $_ eq $tempkeyp, @catmarker) { |
|
my $parmname=&Apache::lonnet::metadata($uri,$_.'.name'); |
|
# We may only want certain parameters listed |
|
if ($filter) { |
|
unless ($filter=~/\Q$parmname\E/) { next; } |
|
} |
|
$name{$_}=$parmname; |
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); |
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); |
$name{$_}=&Apache::lonnet::metadata($uri,$_.'.name'); |
|
my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display'); |
my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display'); |
if ($allparms{$name{$_}} ne '') { |
if ($allparms{$name{$_}} ne '') { |
my $identifier; |
my $identifier; |
Line 2451 ENDTABLEHEADFOUR
|
Line 2738 ENDTABLEHEADFOUR
|
$r->print('<td style="background-color:'.$defbgone.';"'. |
$r->print('<td style="background-color:'.$defbgone.';"'. |
' rowspan='.$totalparms. |
' rowspan='.$totalparms. |
'>'.$maptitles{$mapp{$rid}}.'</td>'); |
'>'.$maptitles{$mapp{$rid}}.'</td>'); |
|
|
foreach (&keysinorder_bytype(\%name,\%keyorder)) { |
foreach (&keysinorder_bytype(\%name,\%keyorder)) { |
|
|
unless ($firstrow) { |
unless ($firstrow) { |
$r->print('<tr>'); |
$r->print('<tr>'); |
} else { |
} else { |
Line 2461 ENDTABLEHEADFOUR
|
Line 2748 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); |
$cgroup,\@usersgroups,$noeditgrp,$readonly); |
} |
} |
} |
} |
} |
} |
} # end foreach ids |
} # end foreach ids |
# -------------------------------------------------- End entry for one resource |
# -------------------------------------------------- End entry for one resource |
$r->print('</table>'); |
$r->print(&Apache::loncommon::end_data_table); |
} # end of full |
} # end of full |
#--------------------------------------------------- Entry for parm level map |
#--------------------------------------------------- Entry for parm level map |
if ($parmlev eq 'map') { |
if ($parmlev eq 'map') { |
Line 2485 ENDTABLEHEADFOUR
|
Line 2772 ENDTABLEHEADFOUR
|
|
|
#-------------------------------------------- for each map, gather information |
#-------------------------------------------- for each map, gather information |
my $mapid; |
my $mapid; |
foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys %maplist) { |
foreach $mapid (sort { $a <=> $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 2584 ENDTABLEHEADFOUR
|
Line 2871 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); |
$parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp, |
|
$readonly); |
} |
} |
$r->print(&Apache::loncommon::end_data_table().'</p>' |
$r->print(&Apache::loncommon::end_data_table().'</p>' |
.'</div>' |
.'</div>' |
Line 2674 ENDMAPONE
|
Line 2962 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); |
$parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp, |
|
$readonly); |
} |
} |
$r->print(&Apache::loncommon::end_data_table() |
$r->print(&Apache::loncommon::end_data_table() |
.'</p>' |
.'</p>' |
Line 2683 ENDMAPONE
|
Line 2972 ENDMAPONE
|
); |
); |
} # end of $parmlev eq general |
} # end of $parmlev eq general |
} |
} |
$r->print('</form>'.&Apache::loncommon::end_page()); |
$r->print('</form>'); |
|
$r->print(&Apache::loncommon::end_page()); |
} # end sub assessparms |
} # end sub assessparms |
|
|
################################################## |
################################################## |
Line 2692 ENDMAPONE
|
Line 2982 ENDMAPONE
|
my $tableopen; |
my $tableopen; |
|
|
sub tablestart { |
sub tablestart { |
|
my ($readonly) = @_; |
if ($tableopen) { |
if ($tableopen) { |
return ''; |
return ''; |
} else { |
} else { |
$tableopen=1; |
$tableopen=1; |
return &Apache::loncommon::start_data_table().'<tr><th>'.&mt('Parameter').'</th><th>'. |
my $output = &Apache::loncommon::start_data_table().'<tr><th>'.&mt('Parameter').'</th>'; |
&mt('Delete').'</th><th>'.&mt('Set to ...').'</th></tr>'; |
if ($readonly) { |
|
$output .= '<th>'.&mt('Current value').'</th>'; |
|
} else { |
|
$output .= '<th>'.&mt('Delete').'</th><th>'.&mt('Set to ...').'</th>'; |
|
} |
|
$output .= '</tr>'; |
|
return $output; |
} |
} |
} |
} |
|
|
Line 2730 sub readdata {
|
Line 3027 sub readdata {
|
} |
} |
} |
} |
} |
} |
return $resourcedata; |
if (wantarray) { |
|
return ($resourcedata,$classlist); |
|
} else { |
|
return $resourcedata; |
|
} |
} |
} |
|
|
|
|
Line 2745 sub storedata {
|
Line 3046 sub storedata {
|
undef %newdata; |
undef %newdata; |
my @deldata=(); |
my @deldata=(); |
undef @deldata; |
undef @deldata; |
foreach (keys %env) { |
my ($got_chostname,$chostname,$cmajor,$cminor); |
if ($_=~/^form\.([a-z]+)\_(.+)$/) { |
my $now = time; |
|
foreach my $key (keys(%env)) { |
|
if ($key =~ /^form\.([a-z]+)\_(.+)$/) { |
my $cmd=$1; |
my $cmd=$1; |
my $thiskey=$2; |
my $thiskey=$2; |
my ($tuname,$tudom)=&extractuser($thiskey); |
my ($tuname,$tudom)=&extractuser($thiskey); |
Line 2755 sub storedata {
|
Line 3058 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); |
my ($data, $typeof, $text, $name, $valchk); |
if ($cmd eq 'set') { |
if ($cmd eq 'set') { |
$data=$env{$_}; |
$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') { |
|
$name = 'type'; |
|
} elsif ($typeof eq 'string_lenient') { |
|
$name = 'lenient'; |
|
} elsif ($typeof eq 'string_discussvote') { |
|
$name = 'discussvote'; |
|
} elsif ($typeof eq 'string_examcode') { |
|
$name = 'examcode'; |
|
if (&Apache::lonnet::validCODE($data)) { |
|
$valchk = 'valid'; |
|
} |
|
} elsif ($typeof eq 'string_yesno') { |
|
if ($thiskey =~ /\.retrypartial$/) { |
|
$name = 'retrypartial'; |
|
} |
|
} |
} elsif ($cmd eq 'datepointer') { |
} elsif ($cmd eq 'datepointer') { |
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$key}); |
$typeof=$env{'form.typeof_'.$thiskey}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$text = &mt('Saved modified date for'); |
$text = &mt('Saved modified date for'); |
|
if ($typeof eq 'date_start') { |
|
if ($thiskey =~ /\.printstartdate$/) { |
|
$name = 'printstartdate'; |
|
if (($data) && ($data > $now)) { |
|
$valchk = 'future'; |
|
} |
|
} |
|
} elsif ($typeof eq 'date_end') { |
|
if ($thiskey =~ /\.printenddate$/) { |
|
$name = 'printenddate'; |
|
if (($data) && ($data < $now)) { |
|
$valchk = 'past'; |
|
} |
|
} |
|
} |
} elsif ($cmd eq 'dateinterval') { |
} elsif ($cmd eq 'dateinterval') { |
$data=&get_date_interval_from_form($thiskey); |
$data=&get_date_interval_from_form($thiskey); |
$typeof=$env{'form.typeof_'.$thiskey}; |
$typeof=$env{'form.typeof_'.$thiskey}; |
$text = &mt('Saved modified date for'); |
$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) { |
|
$r->print('<br />'.&oldversion_warning($name,$data, |
|
$chostname,$cmajor, |
|
$cminor,$needsrelease)); |
|
next; |
|
} |
|
} |
|
} |
if (defined($data) and $$olddata{$thiskey} ne $data) { |
if (defined($data) and $$olddata{$thiskey} ne $data) { |
if ($tuname) { |
if ($tuname) { |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
Line 2811 sub storedata {
|
Line 3165 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 [_1] parameter(s)</h2>',$delentries)); |
$r->print('<h2>'.&mt('Deleted [quant,_1,parameter]',$delentries/2).'</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 2821 sub storedata {
|
Line 3175 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 [_1] parameter(s)',$putentries/2).'</h3>'); |
$r->print('<h3>'.&mt('Saved [quant,_1,parameter]',$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 2856 sub parse_listdata_key {
|
Line 3210 sub parse_listdata_key {
|
} |
} |
|
|
sub listdata { |
sub listdata { |
my ($r,$resourcedata,$listdata,$sortorder)=@_; |
my ($r,$resourcedata,$listdata,$sortorder,$caller,$classlist,$readonly)=@_; |
# Start list output |
# Start list output |
|
|
my $oldsection=''; |
my $oldsection=''; |
Line 2866 sub listdata {
|
Line 3220 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 2909 sub listdata {
|
Line 3274 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)/) { |
$section=&mt('User').": ".&Apache::loncommon::plainname($1,$2); |
my ($stuname,$studom) = ($1,$2); |
} else { |
if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { |
$section=&mt('Group/Section').': '.$issection; |
if (ref($classlist) eq 'HASH') { |
} |
if (ref($classlist->{$stuname.':'.$studom}) eq 'ARRAY') { |
$middle=~s/^\[(.*)\]//; |
next unless ($classlist->{$stuname.':'.$studom}->[$secidx] eq $env{'request.course.sec'}); |
|
} |
|
} |
|
} |
|
$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 2966 sub listdata {
|
Line 3357 sub listdata {
|
# Ready to print |
# Ready to print |
# |
# |
my $parmitem = &standard_parameter_names($name); |
my $parmitem = &standard_parameter_names($name); |
$r->print(&tablestart(). |
$r->print(&tablestart($readonly). |
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<td><b>'.&mt($parmitem). |
'<td><b>'.&mt($parmitem). |
'</b></td><td><input type="checkbox" name="del_'. |
'</b></td>'); |
$thiskey.'" /></td><td>'); |
unless ($readonly) { |
|
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; |
$pointer++; |
my $state; |
$r->print( |
$pointer++; |
&Apache::lonhtmlcommon::date_setter('parmform', |
if ($readonly) { |
$jskey, |
$state = 'disabled'; |
$$resourcedata{$thiskey}, |
} |
'',1,'',''). |
$r->print( |
|
&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})); |
$$resourcedata{$thiskey},$readonly)); |
} elsif ($thistype =~ m/^string/) { |
} elsif ($thistype =~ m/^string/) { |
$r->print(&string_selector($thistype,$thiskey, |
if ($name eq 'availablestudent') { |
$$resourcedata{$thiskey})); |
$readonly = 1; |
|
} |
|
$r->print(&string_selector($thistype,$thiskey, |
|
$$resourcedata{$thiskey},$name,$readonly)); |
} else { |
} else { |
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); |
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey},$readonly)); |
|
} |
|
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 3004 sub listdata {
|
Line 3416 sub listdata {
|
|
|
|
|
sub date_interval_selector { |
sub date_interval_selector { |
my ($thiskey, $showval) = @_; |
my ($thiskey, $showval, $readonly) = @_; |
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]); |
$result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey, |
if ($currval eq '') { |
%select); |
unshift(@{$select{'select_form_order'}},''); |
$result .= ' '.&mt($name); |
$select{''} = ''; |
|
$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 3027 sub date_interval_selector {
|
Line 3447 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})) { |
$seconds += $env{'form.'.$name.'_'.$key} * $factor; |
unless ($env{'form.'.$name.'_'.$key} eq '') { |
} |
$numnotnull ++; |
|
$seconds += $env{'form.'.$name.'_'.$key} * $factor; |
|
} |
|
} |
} |
} |
|
return if (!$numnotnull); |
return $seconds; |
return $seconds; |
} |
} |
|
|
|
|
sub default_selector { |
sub default_selector { |
my ($thiskey, $showval) = @_; |
my ($thiskey, $showval, $readonly) = @_; |
return '<input type="text" name="set_'.$thiskey.'" value="'.$showval.'" />'; |
my $disabled; |
|
if ($readonly) { |
|
$disabled = ' disabled="disabled"'; |
|
} |
|
return '<input type="text" name="set_'.$thiskey.'" value="'.$showval.'"'.$disabled.' />'; |
} |
} |
|
|
my %strings = |
my %strings = |
Line 3055 my %strings =
|
Line 3484 my %strings =
|
[ 'answer', 'Yes, and show correct answer if they exceed the maximum number of tries.' ], |
[ 'answer', 'Yes, and show correct answer if they exceed the maximum number of tries.' ], |
[ 'no', 'No, don\'t show correct/incorrect feedback.' ], |
[ 'no', 'No, don\'t show correct/incorrect feedback.' ], |
[ 'no_feedback_ever', 'No, show no feedback at all.' ]], |
[ 'no_feedback_ever', 'No, show no feedback at all.' ]], |
|
'string_questiontype' |
|
=> [[ 'problem', 'Standard Problem'], |
|
[ 'survey', 'Survey'], |
|
[ 'anonsurveycred', 'Anonymous Survey (credit for submission)'], |
|
[ 'exam', 'Exam'], |
|
[ 'anonsurvey', 'Anonymous Survey'], |
|
[ 'randomizetry', 'New Randomization Each N Tries (default N=1)'], |
|
[ 'practice', 'Practice'], |
|
[ 'surveycred', 'Survey (credit for submission)']], |
|
'string_lenient' |
|
=> [['yes', 'Yes' ], |
|
[ 'no', 'No' ], |
|
[ 'default', 'Default - only bubblesheet grading is lenient' ]], |
|
'string_discussvote' |
|
=> [['yes','Yes'], |
|
['notended','Yes, unless discussion ended'], |
|
['no','No']], |
); |
); |
|
|
|
sub standard_string_options { |
|
my ($string_type) = @_; |
|
if (ref($strings{$string_type}) eq 'ARRAY') { |
|
return $strings{$string_type}; |
|
} |
|
return; |
|
} |
|
|
sub string_selector { |
sub string_selector { |
my ($thistype, $thiskey, $showval) = @_; |
my ($thistype, $thiskey, $showval, $name, $readonly) = @_; |
|
|
if (!exists($strings{$thistype})) { |
if (!exists($strings{$thistype})) { |
return &default_selector($thiskey,$showval); |
return &default_selector($thiskey,$showval,$readonly); |
} |
} |
|
|
my $result; |
my %skiptype; |
foreach my $possibilities (@{ $strings{$thistype} }) { |
if (($thistype eq 'string_questiontype') || |
my ($name, $description) = @{ $possibilities }; |
($thistype eq 'string_lenient') || |
$result .= '<label><input type="radio" name="set_'.$thiskey. |
($thistype eq 'string_discussvote') || |
'" value="'.$name.'"'; |
($name eq 'retrypartial')) { |
if ($showval eq $name) { |
my ($got_chostname,$chostname,$cmajor,$cminor); |
$result .= ' checked="checked"'; |
foreach my $possibilities (@{ $strings{$thistype} }) { |
|
next unless (ref($possibilities) eq 'ARRAY'); |
|
my ($parmval, $description) = @{ $possibilities }; |
|
my $needsrelease=$Apache::lonnet::needsrelease{"parameter:$name:$parmval"}; |
|
if ($needsrelease) { |
|
unless ($got_chostname) { |
|
($chostname,$cmajor,$cminor)=¶meter_release_vars(); |
|
$got_chostname = 1; |
|
} |
|
my $needsnewer=¶meter_releasecheck($name,$parmval,$needsrelease, |
|
$cmajor,$cminor); |
|
if ($needsnewer) { |
|
$skiptype{$parmval} = 1; |
|
} |
|
} |
|
} |
} |
} |
$result .= ' />'.&mt($description).'</label> '; |
|
|
my ($result,$disabled); |
|
|
|
if ($readonly) { |
|
$disabled = ' disabled="disabled"'; |
|
} |
|
my $numinrow = 3; |
|
if ($thistype eq 'string_problemstatus') { |
|
$numinrow = 2; |
|
} elsif ($thistype eq 'string_questiontype') { |
|
if (keys(%skiptype) > 0) { |
|
$numinrow = 4; |
|
} |
|
} |
|
my $rem; |
|
if (ref($strings{$thistype}) eq 'ARRAY') { |
|
my $i=0; |
|
foreach my $possibilities (@{ $strings{$thistype} }) { |
|
next unless (ref($possibilities) eq 'ARRAY'); |
|
my ($name, $description) = @{ $possibilities }; |
|
next if ($skiptype{$name}); |
|
$rem = $i%($numinrow); |
|
if ($rem == 0) { |
|
if ($i > 0) { |
|
$result .= '</tr>'; |
|
} |
|
$result .= '<tr>'; |
|
} |
|
$result .= '<td class="LC_left_item">'. |
|
'<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="set_'.$thiskey. |
|
'" value="'.$name.'"'.$disabled; |
|
if ($showval eq $name) { |
|
$result .= ' checked="checked"'; |
|
} |
|
$result .= ' />'.&mt($description).'</label></span></td>'; |
|
$i++; |
|
} |
|
$rem = @{ $strings{$thistype} }%($numinrow); |
|
my $colsleft = $numinrow - $rem; |
|
if ($colsleft > 1 ) { |
|
$result .= '<td colspan="'.$colsleft.'" class="LC_left_item">'. |
|
' </td>'; |
|
} elsif ($colsleft == 1) { |
|
$result .= '<td class="LC_left_item"> </td>'; |
|
} |
|
$result .= '</tr>'; |
|
} |
|
if ($result) { |
|
$result = '<table border="0">'.$result.'</table>'; |
} |
} |
return $result; |
return $result; |
} |
} |
Line 3083 sub string_selector {
|
Line 3600 sub string_selector {
|
# |
# |
|
|
sub dateshift { |
sub dateshift { |
my ($shift)=@_; |
my ($shift,$numchanges)=@_; |
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 3100 sub dateshift {
|
Line 3630 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 3114 sub dateshift {
|
Line 3648 sub dateshift {
|
} |
} |
|
|
sub newoverview { |
sub newoverview { |
my ($r) = @_; |
my ($r,$parm_permission) = @_; |
|
|
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('Set Parameters'); |
|
|
my %loaditems = ( |
|
'onload' => "showHide_courseContent(); resize_scrollbox('mapmenuscroll','1','1');", |
|
); |
|
my $js = ' |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
'. |
|
&Apache::lonhtmlcommon::resize_scrollbox_js('params')."\n". |
|
&showhide_js()."\n". |
|
'// ]]> |
|
</script> |
|
'; |
|
my $start_page = &Apache::loncommon::start_page('Set Parameters',$js, |
|
{'add_entries' => \%loaditems,}); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
|
$r->print($start_page.$breadcrumbs); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
$start_page |
|
$breadcrumbs |
|
<form method="post" action="/adm/parmset?action=newoverview" name="parmform"> |
<form method="post" action="/adm/parmset?action=newoverview" name="parmform"> |
ENDOVER |
ENDOVER |
my @ids=(); |
my @ids=(); |
Line 3150 ENDOVER
|
Line 3701 ENDOVER
|
|
|
my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); |
my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); |
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]='0'; } |
|
|
Line 3161 ENDOVER
|
Line 3713 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 3182 ENDOVER
|
Line 3737 ENDOVER
|
} |
} |
# Menu to select levels, etc |
# Menu to select levels, etc |
|
|
#$r->print('<table id="LC_parm_overview_scope"> |
|
# <tr><td class="LC_parm_overview_level_menu">'); |
|
$r->print('<div class="LC_Box">'); |
$r->print('<div class="LC_Box">'); |
#$r->print('<h2 class="LC_hcell">Step 1</h2>'); |
#$r->print('<h2 class="LC_hcell">Step 1</h2>'); |
$r->print('<div>'); |
$r->print('<div>'); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
$r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel')); |
&levelmenu($r,\%alllevs,$parmlev); |
&levelmenu($r,\%alllevs,$parmlev); |
if ($parmlev ne 'general') { |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
#$r->print('<td class="LC_parm_overview_map_menu">'); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp,$parmlev); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
|
&mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp); |
|
#$r->print('</td>'); |
|
} |
|
$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>'); |
#$r->print('</td></tr></table>'); |
|
|
|
#$r->print('<table id="LC_parm_overview_controls"> |
|
# <tr><td class="LC_parm_overview_parm_selectors">'); |
|
$r->print('<div class="LC_Box">'); |
$r->print('<div class="LC_Box">'); |
$r->print('<div>'); |
$r->print('<div>'); |
$r->print(&Apache::lonhtmlcommon::start_pick_box()); |
&displaymenu($r,\%allparms,\@pscat,\%keyorder); |
&parmmenu($r,\%allparms,\@pscat,\%keyorder); |
|
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
|
&parmboxes($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'))); |
#$r->print('</td><td class="LC_parm_overview_restrictions">'. |
my $sectionselector = §ionmenu(\@selected_sections); |
|
my $groupselector = &groupmenu(\@selected_groups); |
$r->print('<table>'. |
$r->print('<table>'. |
'<tr><th>'.&mt('Parts').'</th><th>'.&mt('Section(s)'). |
'<tr><th>'.&mt('Parts').'</th>'); |
'</th><th>'.&mt('Group(s)').'</th></tr><tr><td>'); |
if ($sectionselector) { |
|
$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><td>'); |
$r->print('</td>'); |
§ionmenu($r,\@selected_sections); |
if ($sectionselector) { |
$r->print('</td><td>'); |
$r->print('<td>'.$sectionselector.'</td>'); |
&groupmenu($r,\@selected_groups); |
} |
$r->print('</td></tr></table>'); |
if ($groupselector) { |
#$r->print('</td></tr></table>'); |
$r->print('<td>'.$groupselector.'</td>'); |
|
} |
|
$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 3254 ENDOVER
|
Line 3806 ENDOVER
|
|
|
# List data |
# List data |
|
|
&listdata($r,$resourcedata,$listdata,$sortorder); |
&listdata($r,$resourcedata,$listdata,$sortorder,'newoverview',undef,$readonly); |
|
} |
|
$r->print(&tableend()); |
|
unless ($readonly) { |
|
$r->print(((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Save').'" /></p>':'')); |
} |
} |
$r->print(&tableend(). |
$r->print('</form>'); |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Save').'" /></p>':''). |
$r->print(&Apache::loncommon::end_page()); |
'</form>'.&Apache::loncommon::end_page()); |
|
} |
} |
|
|
sub secgroup_lister { |
sub secgroup_lister { |
Line 3297 sub secgroup_lister {
|
Line 3852 sub secgroup_lister {
|
} |
} |
|
|
sub overview { |
sub overview { |
my ($r) = @_; |
my ($r,$parm_permission) = @_; |
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(<<ENDOVER); |
$r->print($start_page.$breadcrumbs); |
$start_page |
$r->print('<form method="post" action="/adm/parmset?action=setoverview" name="parmform">'); |
$breadcrumbs |
|
<form method="post" action="/adm/parmset?action=setoverview" name="parmform"> |
|
ENDOVER |
|
# Store modified |
|
|
|
&storedata($r,$crs,$dom); |
# Store modified |
|
unless ($readonly) { |
|
&storedata($r,$crs,$dom); |
|
} |
|
|
# Read modified data |
# Read modified data |
|
|
my $resourcedata=&readdata($crs,$dom); |
my ($resourcedata,$classlist)=&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); |
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder,'overview',$classlist,$readonly); |
|
|
$r->print(&tableend().'<p>'. |
$r->print(&tableend().'<p>'); |
($foundkeys?'<input type="submit" value="'.&mt('Save').'" />':&mt('There are no parameters.')).'</p></form>'. |
if ($foundkeys) { |
&Apache::loncommon::end_page()); |
unless ($readonly) { |
|
$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 3391 ENDOVER
|
Line 3961 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 'section') { |
} elsif ($data{'scope_type'} eq 'secgroup') { |
$r->print(&mt('Section: [_1]',$data{'scope'})); |
$r->print(&mt('Group/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 3404 ENDOVER
|
Line 3972 ENDOVER
|
} elsif ($data{'realm_type'} eq 'symb') { |
} elsif ($data{'realm_type'} eq 'symb') { |
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] <br /> with ID: [_2] <br /> in folder [_3]', |
$r->print(&mt('Resource: [_1]with ID: [_2]in folder [_3]', |
$url,$resid,$map)); |
$url.' <br /> ', |
|
$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 3414 ENDOVER
|
Line 3983 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>'); |
&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
|
sub date_shift_one { |
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(<<ENDOVER); |
$r->print($start_page.$breadcrumbs); |
$start_page |
$r->print('<form name="shiftform" method="post" action="">'. |
$breadcrumbs |
|
ENDOVER |
|
$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>'. |
Line 3442 ENDOVER
|
Line 4020 ENDOVER
|
'</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="'.&mt('Shift all dates accordingly').'" /></form>'); |
'<input type="submit" value="'.$submit_text.'" /></form>'); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
|
Line 3450 sub date_shift_two {
|
Line 4028 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(<<ENDOVER); |
$r->print($start_page.$breadcrumbs); |
$start_page |
|
$breadcrumbs |
|
ENDOVER |
|
my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted'); |
my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted'); |
$r->print(&mt('Shifting all dates such that [_1] becomes [_2]', |
$r->print('<h2>'.&mt('Shift Dates').'</h2>'); |
&Apache::lonlocal::locallocaltime($env{'form.timebase'}), |
if ($sec ne '') { |
&Apache::lonlocal::locallocaltime($timeshifted))); |
my @groups; |
|
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'}; |
&dateshift($delta); |
my $numchanges = 0; |
|
my $result = &dateshift($delta,\$numchanges); |
|
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 3479 sub parse_key {
|
Line 4094 sub parse_key {
|
$data{'scope_type'} = 'user'; |
$data{'scope_type'} = 'user'; |
$data{'scope'} = [$1,$2]; |
$data{'scope'} = [$1,$2]; |
} else { |
} else { |
#FIXME check for group scope |
$data{'scope_type'} = 'secgroup'; |
$data{'scope_type'} = 'section'; |
|
} |
} |
$middle=~s/^\[(.*)\]//; |
$middle=~s/^\[(.*)\]//; |
} |
} |
Line 3507 sub parse_key {
|
Line 4121 sub parse_key {
|
} |
} |
|
|
|
|
|
|
sub extract_cloners { |
|
my ($clonelist,$allowclone) = @_; |
|
if ($clonelist =~ /,/) { |
|
@{$allowclone} = split(/,/,$clonelist); |
|
} else { |
|
$$allowclone[0] = $clonelist; |
|
} |
|
} |
|
|
|
sub check_cloners { |
|
my ($clonelist,$oldcloner) = @_; |
|
my ($clean_clonelist,%disallowed); |
|
my @allowclone = (); |
|
&extract_cloners($$clonelist,\@allowclone); |
|
foreach my $currclone (@allowclone) { |
|
if (!grep(/^\Q$currclone\E$/,@$oldcloner)) { |
|
if ($currclone eq '*') { |
|
$clean_clonelist .= $currclone.','; |
|
} else { |
|
my ($uname,$udom) = split(/:/,$currclone); |
|
if ($uname eq '*') { |
|
if ($udom =~ /^$match_domain$/) { |
|
if (!&Apache::lonnet::domain($udom)) { |
|
$disallowed{'domain'} .= $currclone.','; |
|
} else { |
|
$clean_clonelist .= $currclone.','; |
|
} |
|
} else { |
|
$disallowed{'format'} .= $currclone.','; |
|
} |
|
} elsif ($currclone !~/^($match_username)\:($match_domain)$/) { |
|
$disallowed{'format'} .= $currclone.','; |
|
} else { |
|
if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
|
$disallowed{'newuser'} .= $currclone.','; |
|
} else { |
|
$clean_clonelist .= $currclone.','; |
|
} |
|
} |
|
} |
|
} else { |
|
$clean_clonelist .= $currclone.','; |
|
} |
|
} |
|
foreach my $key (keys(%disallowed)) { |
|
$disallowed{$key} =~ s/,$//; |
|
} |
|
if ($clean_clonelist) { |
|
$clean_clonelist =~ s/,$//; |
|
} |
|
$$clonelist = $clean_clonelist; |
|
return %disallowed; |
|
} |
|
|
|
sub change_clone { |
|
my ($clonelist,$oldcloner) = @_; |
|
my ($uname,$udom); |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $clone_crs = $cnum.':'.$cdom; |
|
|
|
if ($cnum && $cdom) { |
|
my @allowclone; |
|
&extract_cloners($clonelist,\@allowclone); |
|
foreach my $currclone (@allowclone) { |
|
if (!grep(/^$currclone$/,@$oldcloner)) { |
|
if ($currclone ne '*') { |
|
($uname,$udom) = split(/:/,$currclone); |
|
if ($uname && $udom && $uname ne '*') { |
|
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
|
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
|
if ($currclonecrs{'cloneable'} !~ /\Q$clone_crs\E/) { |
|
if ($currclonecrs{'cloneable'} eq '') { |
|
$currclonecrs{'cloneable'} = $clone_crs; |
|
} else { |
|
$currclonecrs{'cloneable'} .= ','.$clone_crs; |
|
} |
|
&Apache::lonnet::put('environment',\%currclonecrs,$udom,$uname); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
foreach my $oldclone (@$oldcloner) { |
|
if (!grep(/^\Q$oldclone\E$/,@allowclone)) { |
|
if ($oldclone ne '*') { |
|
($uname,$udom) = split(/:/,$oldclone); |
|
if ($uname && $udom && $uname ne '*' ) { |
|
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
|
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
|
my %newclonecrs = (); |
|
if ($currclonecrs{'cloneable'} =~ /\Q$clone_crs\E/) { |
|
if ($currclonecrs{'cloneable'} =~ /,/) { |
|
my @currclonecrs = split/,/,$currclonecrs{'cloneable'}; |
|
foreach my $crs (@currclonecrs) { |
|
if ($crs ne $clone_crs) { |
|
$newclonecrs{'cloneable'} .= $crs.','; |
|
} |
|
} |
|
$newclonecrs{'cloneable'} =~ s/,$//; |
|
} else { |
|
$newclonecrs{'cloneable'} = ''; |
|
} |
|
&Apache::lonnet::put('environment',\%newclonecrs,$udom,$uname); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
|
|
sub header { |
sub header { |
return &Apache::loncommon::start_page('Parameter Manager'); |
return &Apache::loncommon::start_page('Content and Problem Settings'); |
} |
} |
|
|
|
|
Line 3634 sub print_main_menu {
|
Line 4131 sub print_main_menu {
|
my ($r,$parm_permission)=@_; |
my ($r,$parm_permission)=@_; |
# |
# |
$r->print(&header()); |
$r->print(&header()); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Manager')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Content and Problem Settings')); |
|
my $crstype = &Apache::loncommon::course_type(); |
|
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 3644 ENDMAINFORMHEAD
|
Line 4144 ENDMAINFORMHEAD
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
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 $crstype = &Apache::loncommon::course_type(); |
my $vcb = &Apache::lonnet::allowed('vcb',$env{'request.course.id'}); |
my $lc_crstype = lc($crstype); |
my $vpa = &Apache::lonnet::allowed('vpa',$env{'request.course.id'}); |
|
if ((!$dcm) && ($env{'request.course.sec'} ne '')) { |
|
$dcm = &Apache::lonnet::allowed('dcm',$env{'request.course.id'}. |
|
'/'.$env{'request.course.sec'}); |
|
} |
|
if ((!$vcb) && ($env{'request.course.sec'} ne '')) { |
|
$vcb = &Apache::lonnet::allowed('vcb',$env{'request.course.id'}. |
|
'/'.$env{'request.course.sec'}); |
|
} |
|
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=>"Settings for this $crstype", |
( { categorytitle=>"Content Settings for this $crstype", |
items => [ |
items => [ |
{ linktext => "$crstype Configuration", |
|
url => '/adm/courseprefs?origin=params', |
|
permission => $parm_permission, |
|
linktitle => "Edit $lc_crstype configuration." , |
|
icon => 'preferences-desktop-remote-desktop.png' , |
|
#help => 'Course_Environment', |
|
}, |
|
{ linktext => 'Portfolio Metadata', |
{ linktext => 'Portfolio Metadata', |
url => '/adm/parmset?action=setrestrictmeta', |
url => '/adm/parmset?action=setrestrictmeta', |
permission => $parm_permission, |
permission => $parm_permission->{'setrestrictmeta'}, |
linktitle => "Restrict metadata for this $lc_crstype." , |
linktitle => "Restrict metadata for this $lc_crstype." , |
icon =>'contact-new.png' , |
icon =>'contact-new.png' , |
}, |
}, |
{ linktext => "Manage $crstype Slots", |
{ linktext => $linktext{'resettimes'}, |
url => '/adm/slotrequest?command=showslots', |
url => $url{'resettimes'}, |
permission => $vgr, |
permission => ($vgr || $mgr), |
linktitle => "Manage slots for this $lc_crstype." , |
linktitle => $linktitle{'resettimes'}, |
icon => 'format-justify-fill.png' , |
icon => 'start-here.png', |
}, |
}, |
{ linktext => 'Reset Student Access Times', |
{ linktext => 'Blocking Communication/Resource Access', |
url => '/adm/helper/resettimes.helper', |
url => '/adm/setblock', |
permission => $mgr, |
permission => ($vcb || $dcm), |
linktitle => "Reset access times for folders/maps, resources or the $lc_crstype." , |
linktitle => 'Configure blocking of communication/collaboration and access to resources during an exam', |
icon => 'start-here.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, |
permission => $parm_permission->{'setdefaults'}, |
linktitle =>'Set default actions for parameters.' , |
linktitle =>'Set default actions for parameters.' , |
icon => 'folder-new.png' , |
icon => 'folder-new.png' , |
}]}, |
}]}, |
Line 3687 ENDMAINFORMHEAD
|
Line 4219 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, |
permission => $parm_permission->{'helper'}, |
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 => 'Edit Resource Parameters - Overview Mode', |
{ linktext => $linktext{'newoverview'}, |
url => '/adm/parmset?action=newoverview', |
url => '/adm/parmset?action=newoverview', |
permission => $parm_permission, |
permission => $parm_permission->{'newoverview'}, |
linktitle =>'Set/Modify resource parameters in overview mode.' , |
linktitle => $linktitle{'newoverview'}, |
icon => 'edit-find.png' , |
icon => 'edit-find.png', |
#help => 'Parameter_Overview', |
#help => 'Parameter_Overview', |
}, |
}, |
{ linktext => 'Edit Resource Parameters - Table Mode', |
{ linktext => $linktext{'settable'}, |
url => '/adm/parmset?action=settable', |
url => '/adm/parmset?action=settable', |
permission => $parm_permission, |
permission => $parm_permission->{'settable'}, |
linktitle =>'Set/Modify resource parameters in table mode.' , |
linktitle => $linktitle{'settable'}, |
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 => 'Modify Resource Parameters - Overview Mode', |
{ linktext => $linktext{'setoverview'}, |
url => '/adm/parmset?action=setoverview', |
url => '/adm/parmset?action=setoverview', |
permission => $parm_permission, |
permission => $parm_permission->{'setoverview'}, |
linktitle =>'Set/Modify existing resource parameters in overview mode.' , |
linktitle => $linktitle{'setoverview'}, |
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, |
permission => $parm_permission->{'parameterchangelog'}, |
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()); |
return; |
return; |
} |
} |
|
|
Line 3851 sub order_meta_fields {
|
Line 4384 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 3875 sub continue {
|
Line 4408 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="Continue" />'; |
$output .= '<input type="submit" value="'.&mt('Continue').'" />'; |
return ($output); |
return ($output); |
} |
} |
|
|
Line 3897 sub addmetafield {
|
Line 4430 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('Undeleted Metadata Field <strong>'.$env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.added'}."</strong> with result ".$put_result.'<br />'); |
$r->print(&mt('Undeleted Metadata Field [_1] with result [_2]', |
|
'<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 3909 sub addmetafield {
|
Line 4445 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('Added new Metadata Field <strong>'.$env{'form.fieldname'}."</strong> with result ".$put_result.'<br />'); |
$r->print(&mt('Added new Metadata Field [_1] with result [_2]', |
|
'<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('You may undelete previously deleted fields.<br />Check those you wish to undelete and click Undelete.<br />'); |
$r->print(&mt('You may undelete previously deleted fields.'). |
|
'<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 3922 sub addmetafield {
|
Line 4463 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 /><strong>Or</strong> you may enter a new metadata field name.<form method="post" action="/adm/parmset?action=addmetadata"'); |
$r->print('<hr />'. |
|
&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="Add Metadata Field" />'); |
$r->print('<input type="submit" value="'.&mt('Add Metadata Field').'" />'); |
} |
} |
$r->print('</form>'); |
$r->print('</form>'); |
} |
} |
Line 3945 sub setrestrictmeta {
|
Line 4489 sub setrestrictmeta {
|
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 3983 sub setrestrictmeta {
|
Line 4532 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="Save" /> |
<input type="submit" name="restrictmeta" value="$lt{'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="Add a Metadata Field" /> |
<input type="submit" name="restrictmeta" value="$lt{'addm'}" /> |
</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="Order Metadata Fields" /> |
<input type="submit" name="restrictmeta" value="$lt{'ordm'}" /> |
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))) { |
$row_alt = $row_alt ? 0 : 1; |
$output.= &output_row($r,$field,$$added_metadata_fields{$field},$added_flag); |
$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 4056 sub defaultsetter {
|
Line 4602 sub defaultsetter {
|
my $start_page = |
my $start_page = |
&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(<<ENDDEFHEAD); |
$r->print($start_page.$breadcrumbs); |
$start_page |
$r->print('<form method="post" action="/adm/parmset?action=setdefaults" name="defaultform">'); |
$breadcrumbs |
|
<form method="post" action="/adm/parmset?action=setdefaults" name="defaultform"> |
|
ENDDEFHEAD |
|
|
|
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'}; |
Line 4205 ENDYESNO
|
Line 4748 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"); |
&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
|
|
Line 4252 my %standard_parms;
|
Line 4795 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 4267 sub load_parameter_names {
|
Line 4810 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 4293 sub standard_parameter_types {
|
Line 4837 sub standard_parameter_types {
|
} |
} |
|
|
sub parm_change_log { |
sub parm_change_log { |
my ($r)=@_; |
my ($r,$parm_permission)=@_; |
&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"}); |
$r->print(&Apache::loncommon::start_page('Parameter Change Log')); |
my $js = '<script type="text/javascript">'."\n". |
|
'// <![CDATA['."\n". |
|
&Apache::loncommon::display_filter_js('parmslog')."\n". |
|
'// ]]>'."\n". |
|
'</script>'."\n"; |
|
$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')); |
|
|
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'}); |
|
|
if ((keys(%parmlog))[0]=~/^error\:/) { undef(%parmlog); } |
if ((keys(%parmlog))[0]=~/^error\:/) { undef(%parmlog); } |
|
|
$r->print('<form action="/adm/parmset?action=parameterchangelog" |
$r->print('<div class="LC_left_float">'. |
|
'<fieldset><legend>'.&mt('Display of Changes').'</legend>'. |
|
'<form action="/adm/parmset?action=parameterchangelog" |
method="post" name="parameterlog">'); |
method="post" name="parameterlog">'); |
|
|
my %saveable_parameters = ('show' => 'scalar',); |
my %saveable_parameters = ('show' => 'scalar',); |
Line 4313 sub parm_change_log {
|
Line 4863 sub parm_change_log {
|
\%saveable_parameters); |
\%saveable_parameters); |
&Apache::loncommon::restore_course_settings('parameter_log', |
&Apache::loncommon::restore_course_settings('parameter_log', |
\%saveable_parameters); |
\%saveable_parameters); |
$r->print(&Apache::loncommon::display_filter(). |
$r->print(&Apache::loncommon::display_filter('parmslog').' '."\n". |
'<label>'.&Apache::lonhtmlcommon::checkbox('includetypes',$env{'form.includetypes'},'1'). |
'<input type="submit" value="'.&mt('Display').'" />'. |
' '.&mt('Include parameter types').'</label>'. |
'</form></fieldset></div><br clear="all" />'); |
'<input type="submit" value="'.&mt('Display').'" /></form>'); |
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><th>'.&mt('Announce').'</th>'. |
&mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th>'); |
&Apache::loncommon::end_data_table_header_row()); |
unless ($readonly) { |
|
$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 4335 sub parm_change_log {
|
Line 4890 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 4356 sub parm_change_log {
|
Line 4917 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 ((($parmlog{$id}{'exe_uname'} ne $env{'user.name'}) |
if ((!$readonly) && |
|
(($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 4373 sub parm_change_log {
|
Line 4935 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 4426 sub parm_change_log {
|
Line 4996 sub parm_change_log {
|
} |
} |
} |
} |
} |
} |
$output .= '</td><td>'; |
$output .= '</td>'; |
|
|
if ($stillactive) { |
unless ($readonly) { |
my $parmitem = &standard_parameter_names($parmname); |
$output .= '<td>'; |
$parmitem = &mt($parmitem); |
if ($stillactive) { |
my $title=&mt('Changed [_1]',$parmitem); |
my $parmitem = &standard_parameter_names($parmname); |
my $description=&mt('Changed [_1] for [_2] to [_3]', |
$parmitem = &mt($parmitem); |
$parmitem,$realmdescription, |
my $title=&mt('Changed [_1]',$parmitem); |
(&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value)); |
my $description=&mt('Changed [_1] for [_2] to [_3]', |
if (($uname) && ($udom)) { |
$parmitem,$realmdescription, |
$output .= |
(&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value)); |
&Apache::loncommon::messagewrapper('Notify User', |
if (($uname) && ($udom)) { |
$uname,$udom,$title, |
$output .= |
$description); |
&Apache::loncommon::messagewrapper('Notify User', |
} else { |
$uname,$udom,$title, |
$output .= |
$description); |
&Apache::lonrss::course_blog_link($id,$title, |
} else { |
$description); |
$output .= |
} |
&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 4513 sub update_slots {
|
Line 5087 sub update_slots {
|
action => 'reserve', |
action => 'reserve', |
context => 'parameter', |
context => 'parameter', |
); |
); |
&Apache::lonnet::instructor_log('slotreservationslog',\%storehash, |
&Apache::lonnet::write_log('course','slotreservationslog',\%storehash, |
'',$uname,$udom,$cnum,$cdom); |
'',$uname,$udom,$cnum,$cdom); |
|
|
&Apache::lonnet::instructor_log($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 4547 sub delete_slots {
|
Line 5121 sub delete_slots {
|
action => 'release', |
action => 'release', |
context => 'parameter', |
context => 'parameter', |
); |
); |
&Apache::lonnet::instructor_log('slotreservationslog',\%storehash, |
&Apache::lonnet::write_log('course','slotreservationslog',\%storehash, |
1,$uname,$udom,$cnum,$cdom); |
1,$uname,$udom,$cnum,$cdom); |
&Apache::lonnet::instructor_log($cdom.'_'.$cnum.'_slotlog',\%storehash, |
&Apache::lonnet::write_log('course',$cdom.'_'.$cnum.'_slotlog',\%storehash, |
1,$uname,$udom,$uname,$udom); |
1,$uname,$udom,$uname,$udom); |
} |
} |
} |
} |
Line 4563 sub check_for_course_info {
|
Line 5137 sub check_for_course_info {
|
return 0; |
return 0; |
} |
} |
|
|
|
sub parameter_release_vars { |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
|
my $chostname = &Apache::lonnet::hostname($chome); |
|
my ($cmajor,$cminor) = |
|
split(/\./,&Apache::lonnet::get_server_loncaparev($cdom,$chome)); |
|
return ($chostname,$cmajor,$cminor); |
|
} |
|
|
|
sub parameter_releasecheck { |
|
my ($name,$value,$needsrelease,$cmajor,$cminor) = @_; |
|
my $needsnewer; |
|
my ($needsmajor,$needsminor) = split(/\./,$needsrelease); |
|
if (($cmajor < $needsmajor) || |
|
($cmajor == $needsmajor && $cminor < $needsminor)) { |
|
$needsnewer = 1; |
|
} else { |
|
&Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:'.$name.':'.$value}); |
|
} |
|
return $needsnewer; |
|
} |
|
|
|
sub oldversion_warning { |
|
my ($name,$value,$chostname,$cmajor,$cminor,$needsrelease) = @_; |
|
my $desc; |
|
my %stringtypes = ( |
|
type => 'string_questiontype', |
|
lenient => 'string_lenient', |
|
retrypartial => 'string_yesno', |
|
discussvote => 'string_discussvote', |
|
examcode => 'string_examcode', |
|
); |
|
if (exists($stringtypes{$name})) { |
|
if ($name eq 'examcode') { |
|
$desc = $value; |
|
} elsif (ref($strings{$stringtypes{$name}}) eq 'ARRAY') { |
|
foreach my $possibilities (@{ $strings{$stringtypes{$name}} }) { |
|
next unless (ref($possibilities) eq 'ARRAY'); |
|
my ($parmval, $description) = @{ $possibilities }; |
|
if ($parmval eq $value) { |
|
$desc = $description; |
|
last; |
|
} |
|
} |
|
} |
|
} 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); |
|
return '<p class="LC_warning">'. |
|
&mt('[_1] was [_2]not[_3] set to [_4].', |
|
$standard_name,'<b>','</b>','"'.$desc.'"').'<br />'. |
|
&mt('LON-CAPA version ([_1]) installed on home server ([_2]) does not meet version requirements ([_3] or newer).', |
|
$cmajor.'.'.$cminor,$chostname, |
|
$needsrelease). |
|
'</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 4578 sub handler {
|
Line 5260 sub handler {
|
'pres_marker', |
'pres_marker', |
'pres_value', |
'pres_value', |
'pres_type', |
'pres_type', |
|
'filter','part', |
'udom','uname','symb','serial','timebase']); |
'udom','uname','symb','serial','timebase']); |
|
|
|
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/parmset", |
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/parmset", |
text=>"Parameter Manager", |
text=>"Content and Problem Settings", |
faq=>10, |
faq=>10, |
bug=>'Instructor Interface', |
bug=>'Instructor Interface', |
help => |
help => |
'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 = |
my ($parm_permission,$allowed) = &get_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'} && $parm_permission && $exists) { |
if ($env{'request.course.id'} && $allowed && $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 ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
if (($parm_permission->{'set'}) && |
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
&assessparms($r); |
&& (!$env{'form.dis'})) || ($env{'form.symb'}))) { |
|
&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); |
&overview($r,$parm_permission); |
} 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); |
&newoverview($r,$parm_permission); |
} 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); |
&assessparms($r,$parm_permission); |
} elsif ($env{'form.action'} eq 'parameterchangelog') { |
} elsif ($env{'form.action'} eq 'parameterchangelog') { |
&parm_change_log($r); |
&parm_change_log($r,$parm_permission); |
} 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') { |
&date_shift_two($r); |
&date_shift_two($r); |
} elsif ($env{'form.action'} eq 'categorizecourse') { |
|
&assign_course_categories($r); |
|
} |
} |
} else { |
} else { |
# ----------------------------- Not in a course, or not allowed to modify parms |
# ----------------------------- Not in a course, or not allowed to modify parms |