version 1.584, 2017/12/18 23:13:53
|
version 1.602, 2021/08/12 20:43:26
|
Line 976 sub storeparm_by_symb_inner {
|
Line 976 sub storeparm_by_symb_inner {
|
# |
# |
# @param {string} $value - the parameter value |
# @param {string} $value - the parameter value |
# @param {string} $type - the parameter type |
# @param {string} $type - the parameter type |
# @param {string} $name - the parameter name (unused) |
|
# @param {boolean} $editable - Set to true to get an icon when no value is defined. |
# @param {boolean} $editable - Set to true to get an icon when no value is defined. |
sub valout { |
sub valout { |
my ($value,$type,$name,$editable)=@_; |
my ($value,$type,$editable)=@_; |
my $result = ''; |
my $result = ''; |
# Values of zero are valid. |
# Values of zero are valid. |
if (! $value && $value ne '0') { |
if (! $value && $value ne '0') { |
Line 1065 sub valout {
|
Line 1064 sub valout {
|
# @param {string} $marker - identifier for the parameter, "resource id&part_parameter name&level", will be passed as pres_marker when the user submits a change. |
# @param {string} $marker - identifier for the parameter, "resource id&part_parameter name&level", will be passed as pres_marker when the user submits a change. |
# @param {string} $return - prefix for the name of the form and field names that will be used to submit the form ('parmform.pres') |
# @param {string} $return - prefix for the name of the form and field names that will be used to submit the form ('parmform.pres') |
# @param {string} $call - javascript function to call to submit the form ('psub') |
# @param {string} $call - javascript function to call to submit the form ('psub') |
# @param {boolean} $recursive - true if link is for a map/folder where parameter is currently set to be recursive. |
# @param {boolean} $recursive - true if link is for a map/folder where parameter is currently set to be recursive. |
|
# @param {string} $extra - optional additional information to send as tenth arg in call to javascript pjump function. |
sub plink { |
sub plink { |
my ($type,$dis,$value,$marker,$return,$call,$recursive)=@_; |
my ($type,$dis,$value,$marker,$return,$call,$recursive,$extra)=@_; |
my $winvalue=$value; |
my $winvalue=$value; |
unless ($winvalue) { |
unless ($winvalue) { |
if (&isdateparm($type)) { |
if (&isdateparm($type) || (&is_specialstring($type))) { |
$winvalue=$env{'form.recent_'.$type}; |
$winvalue=$env{'form.recent_'.$type}; |
|
} elsif ($type eq 'string_yesno') { |
|
if ($env{'form.recent_string'} =~ /^(yes|no)$/i) { |
|
$winvalue=$env{'form.recent_string'}; |
|
} |
} else { |
} else { |
$winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]}; |
$winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]}; |
} |
} |
Line 1079 sub plink {
|
Line 1083 sub plink {
|
my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/); |
my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/); |
my ($hour,$min,$sec,$val)=&preset_defaults($parmname); |
my ($hour,$min,$sec,$val)=&preset_defaults($parmname); |
unless (defined($winvalue)) { $winvalue=$val; } |
unless (defined($winvalue)) { $winvalue=$val; } |
my $valout = &valout($value,$type,$parmname,1); |
my $valout = &valout($value,$type,1); |
my $unencmarker = $marker; |
my $unencmarker = $marker; |
foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call, |
foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call, |
\$hour, \$min, \$sec) { |
\$hour, \$min, \$sec, \$extra) { |
$$item = &HTML::Entities::encode($$item,'"<>&'); |
$$item = &HTML::Entities::encode($$item,'"<>&'); |
$$item =~ s/\'/\\\'/g; |
$$item =~ s/\'/\\\'/g; |
} |
} |
return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$unencmarker.'" /></td></tr><tr><td align="center">'. |
return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$unencmarker.'" /></td></tr><tr><td align="center">'. |
'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','" |
'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','" |
.$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'. |
.$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."','".$extra."'".');">'. |
$valout.'</a></td></tr>'.($recursive?'<tr><td align="center" class="LC_parm_recursive">'. |
$valout.'</a></td></tr>'.($recursive?'<tr><td align="center" class="LC_parm_recursive">'. |
&mt('recursive').'</td></tr>' : '').'</table>'; |
&mt('recursive').'</td></tr>' : '').'</table>'; |
|
|
Line 1107 sub page_js {
|
Line 1111 sub page_js {
|
$pjump_def |
$pjump_def |
|
|
function psub() { |
function psub() { |
|
var specstring = /^string_!(yesno|any)/i; |
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(); |
typedef=document.parmform.pres_type.value.split('_'); |
typedef=document.parmform.pres_type.value.split('_'); |
if (document.parmform.pres_type.value!='') { |
if (document.parmform.pres_type.value!='') { |
if (typedef[0]=='date') { |
if ((typedef[0]=='date') || |
|
(specstring.test(document.parmform.pres_type.value))) { |
eval('document.parmform.recent_'+ |
eval('document.parmform.recent_'+ |
document.parmform.pres_type.value+ |
document.parmform.pres_type.value+ |
'.value=document.parmform.pres_value.value;'); |
'.value=document.parmform.pres_value.value;'); |
Line 1235 function validateParms() {
|
Line 1241 function validateParms() {
|
var tailLenient = /\.lenient$/; |
var tailLenient = /\.lenient$/; |
var patternRelWeight = /^\-?[\d.]+$/; |
var patternRelWeight = /^\-?[\d.]+$/; |
var patternLenientStd = /^(yes|no|default)$/; |
var patternLenientStd = /^(yes|no|default)$/; |
|
var ipRegExp = /^setip/; |
var ipallowRegExp = /^setipallow_/; |
var ipallowRegExp = /^setipallow_/; |
var ipdenyRegExp = /^setipdeny_/; |
var ipdenyRegExp = /^setipdeny_/; |
|
var deeplinkRegExp = /^deeplink_/; |
|
var dlListScopeRegExp = /^deeplink_(state|others|listing|scope)_/; |
|
var dlLinkProtectRegExp = /^deeplink_protect_/; |
|
var dlLtidRegExp = /^deeplink_ltid_/; |
|
var dlLticRegExp = /^deeplink_ltic_/; |
|
var dlKeyRegExp = /^deeplink_key_/; |
|
var dlMenusRegExp = /^deeplink_menus_/; |
|
var dlCollsRegExp = /^deeplink_colls_/; |
var patternIP = /[\[\]\*\.a-zA-Z\d\-]+/; |
var patternIP = /[\[\]\*\.a-zA-Z\d\-]+/; |
if ((document.parmform.elements.length != 'undefined') && (document.parmform.elements.length) != 'null') { |
if ((document.parmform.elements.length != 'undefined') && (document.parmform.elements.length) != 'null') { |
if (document.parmform.elements.length) { |
if (document.parmform.elements.length) { |
for (i=0; i<document.parmform.elements.length; i++) { |
for (i=0; i<document.parmform.elements.length; i++) { |
var name=document.parmform.elements[i].name; |
var name=document.parmform.elements[i].name; |
if (textRegExp.test(name)) { |
if (textRegExp.test(name)) { |
var identifier = name.replace(textRegExp,''); |
var identifier = name.replace(textRegExp,''); |
if (tailLenient.test(identifier)) { |
if (tailLenient.test(identifier)) { |
if (document.parmform.elements['set_'+identifier].length) { |
if (document.parmform.elements['set_'+identifier].length) { |
Line 1265 function validateParms() {
|
Line 1280 function validateParms() {
|
} |
} |
} |
} |
} |
} |
} else { |
} else if (ipRegExp.test(name)) { |
if (ipallowRegExp.test(name)) { |
if (ipallowRegExp.test(name)) { |
var identifier = name.replace(ipallowRegExp,''); |
var identifier = name.replace(ipallowRegExp,''); |
var possallow = document.parmform.elements[i].value; |
var possallow = document.parmform.elements[i].value; |
Line 1274 function validateParms() {
|
Line 1289 function validateParms() {
|
if (document.parmform.elements['set_'+identifier].value) { |
if (document.parmform.elements['set_'+identifier].value) { |
possallow = ','+possallow; |
possallow = ','+possallow; |
} |
} |
document.parmform.elements['set_'+identifier].value += possallow; |
document.parmform.elements['set_'+identifier].value += possallow; |
} |
} |
} else { |
} else if (ipdenyRegExp.test(name)) { |
if (ipdenyRegExp.test(name)) { |
var identifier = name.replace(ipdenyRegExp,''); |
var identifier = name.replace(ipdenyRegExp,''); |
var possdeny = document.parmform.elements[i].value; |
var possdeny = document.parmform.elements[i].value; |
possdeny = possdeny.replace(/^\s+|\s+$/g,''); |
possdeny = possdeny.replace(/^\s+|\s+$/g,''); |
if (patternIP.test(possdeny)) { |
if (patternIP.test(possdeny)) { |
possdeny = '!'+possdeny; |
possdeny = '!'+possdeny; |
if (document.parmform.elements['set_'+identifier].value) { |
|
possdeny = ','+possdeny; |
|
} |
|
document.parmform.elements['set_'+identifier].value += possdeny; |
|
} |
|
} |
|
} else if (deeplinkRegExp.test(name)) { |
|
if (dlListScopeRegExp.test(name)) { |
|
var identifier = name.replace(dlListScopeRegExp,''); |
|
var idx = document.parmform.elements[i].selectedIndex; |
|
if (idx > 0) { |
|
var possdeeplink = document.parmform.elements[i].options[idx].value |
|
possdeeplink = possdeeplink.replace(/^\s+|\s+$/g,''); |
|
if (document.parmform.elements['set_'+identifier].value) { |
|
possdeeplink = ','+possdeeplink; |
|
} |
|
document.parmform.elements['set_'+identifier].value += possdeeplink; |
|
} |
|
} else if (dlLinkProtectRegExp.test(name)) { |
|
if (document.parmform.elements[i].checked) { |
|
var identifier = name.replace(dlLinkProtectRegExp,''); |
|
var posslinkurl = document.parmform.elements[i].value; |
|
posslinkurl = posslinkurl.replace(/^\s+|\s+$/g,''); |
|
if (document.parmform.elements['set_'+identifier].value) { |
|
posslinkurl = ','+posslinkurl; |
|
} |
|
document.parmform.elements['set_'+identifier].value += posslinkurl; |
|
} |
|
} else if (dlLtidRegExp.test(name)) { |
|
var identifier = name.replace(dlLtidRegExp,''); |
|
if (isRadioSet('deeplink_protect_'+identifier,'ltid')) { |
|
var possltid = document.parmform.elements[i].value; |
|
possltid = possltid.replace(/\D+/g,''); |
|
if (possltid.length) { |
|
if (document.parmform.elements['set_'+identifier].value) { |
|
possltid = ':'+possltid; |
|
} |
|
document.parmform.elements['set_'+identifier].value += possltid; |
|
} else { |
|
document.parmform.elements['set_'+identifier].value = ''; |
|
alert("A link type of 'domain LTI launch' was selected but no domain LTI launcher was selected.\nPlease select one, or choose a different supported link type."); |
|
return false; |
|
} |
|
} |
|
} else if (dlLticRegExp.test(name)) { |
|
var identifier = name.replace(dlLticRegExp,''); |
|
if (isRadioSet('deeplink_protect_'+identifier,'ltic')) { |
|
var possltic = document.parmform.elements[i].value; |
|
possltic = possltic.replace(/\D+/g,''); |
|
if (possltic.length) { |
|
if (document.parmform.elements['set_'+identifier].value) { |
|
possltic = ':'+possltic; |
|
} |
|
document.parmform.elements['set_'+identifier].value += possltic; |
|
} else { |
|
document.parmform.elements['set_'+identifier].value = ''; |
|
alert("A link type of 'course LTI launch' was selected but no course LTI launcher was selected.\nPlease select one, or choose a different supported link type."); |
|
return false; |
|
} |
|
} |
|
} else if (dlKeyRegExp.test(name)) { |
|
var identifier = name.replace(dlKeyRegExp,''); |
|
if (isRadioSet('deeplink_protect_'+identifier,'key')) { |
|
var posskey = document.parmform.elements[i].value; |
|
posskey = posskey.replace(/^\s+|\s+$/g,''); |
|
var origlength = posskey.length; |
|
posskey = posskey.replace(/[^a-zA-Z\d_.!@#$%^&*()+=-]/g,''); |
|
var newlength = posskey.length; |
|
if (newlength > 0) { |
|
var change = origlength - newlength; |
|
if (change) { |
|
alert(change+' disallowed character(s) removed from deeplink key'); |
|
} |
|
if (document.parmform.elements['set_'+identifier].value) { |
|
posskey = ':'+posskey; |
|
} |
|
document.parmform.elements['set_'+identifier].value += posskey; |
|
} else { |
|
document.parmform.elements['set_'+identifier].value = ''; |
|
if (newlength < origlength) { |
|
alert("A link type of 'deep with key' was selected but the key value was blank, after removing disallowed characters.\nPlease enter a key using one or more of: a-zA-Z0-9_.!@#$%^&*()+=-"); |
|
} else { |
|
alert("A link type of 'deep with key' was selected but the key value was blank.\nPlease enter a key."); |
|
} |
|
return false; |
|
} |
|
} |
|
} else if (dlMenusRegExp.test(name)) { |
|
if (document.parmform.elements[i].checked) { |
|
var identifier = name.replace(dlMenusRegExp,''); |
|
var posslinkmenu = document.parmform.elements[i].value; |
|
posslinkmenu = posslinkmenu.replace(/^\s+|\s+$/g,''); |
|
if (posslinkmenu == 'std') { |
|
posslinkmenu = '0'; |
if (document.parmform.elements['set_'+identifier].value) { |
if (document.parmform.elements['set_'+identifier].value) { |
possdeny = ','+possdeny; |
posslinkmenu = ','+posslinkmenu; |
} |
} |
document.parmform.elements['set_'+identifier].value += possdeny; |
document.parmform.elements['set_'+identifier].value += posslinkmenu; |
} |
} |
} |
} |
|
} else if (dlCollsRegExp.test(name)) { |
|
var identifier = name.replace(dlCollsRegExp,''); |
|
if (isRadioSet('deeplink_menus_'+identifier,'colls')) { |
|
var posslinkmenu = document.parmform.elements[i].value; |
|
if (document.parmform.elements['set_'+identifier].value) { |
|
posslinkmenu = ','+posslinkmenu; |
|
} |
|
document.parmform.elements['set_'+identifier].value += posslinkmenu; |
|
} |
} |
} |
} |
} |
} |
} |
Line 1297 function validateParms() {
|
Line 1414 function validateParms() {
|
return true; |
return true; |
} |
} |
|
|
|
function isRadioSet(name,expected) { |
|
var menuitems = document.getElementsByName(name); |
|
var radioLength = menuitems.length; |
|
result = false; |
|
if (radioLength > 1) { |
|
for (var j=0; j<radioLength; j++) { |
|
if (menuitems[j].checked) { |
|
if (menuitems[j].value == expected) { |
|
result = true; |
|
break; |
|
} |
|
} |
|
} |
|
} |
|
return result; |
|
} |
|
|
ENDSCRIPT |
ENDSCRIPT |
} |
} |
|
|
Line 1351 END
|
Line 1485 END
|
|
|
} |
} |
|
|
|
# Javascript function toggle |
|
sub deeplink_js { |
|
return <<"END"; |
|
function toggleDeepLink(form,item,key) { |
|
var radios = form['deeplink_'+item+'_'+key]; |
|
if (radios.length) { |
|
var keybox; |
|
if (document.getElementById('deeplink_key_'+item+'_'+key)) { |
|
keybox = document.getElementById('deeplink_key_'+item+'_'+key); |
|
} |
|
var divoptions = new Array(); |
|
if (item == 'protect') { |
|
divoptions = ['ltic','ltid']; |
|
} else { |
|
if (item == 'menus') { |
|
divoptions = ['colls']; |
|
} |
|
} |
|
var seldivs = new Array(); |
|
if ((item == 'protect') || (item == 'menus')) { |
|
for (var i=0; i<divoptions.length; i++) { |
|
if (document.getElementById('deeplinkdiv_'+divoptions[i]+'_'+item+'_'+key)) { |
|
seldivs[i] = document.getElementById('deeplinkdiv_'+divoptions[i]+'_'+item+'_'+key); |
|
} else { |
|
seldivs[i] = ''; |
|
} |
|
} |
|
} |
|
for (var i=0; i<radios.length; i++) { |
|
if (radios[i].checked) { |
|
if ((item == 'protect') || (item == 'menus')) { |
|
for (var j=0; j<seldivs.length; j++) { |
|
if (radios[i].value == divoptions[j]) { |
|
if (seldivs[j] != '') { |
|
seldivs[j].style.display = 'inline-block'; |
|
} |
|
if (item == 'protect') { |
|
keybox.type = 'hidden'; |
|
keybox.value = ''; |
|
} |
|
} else { |
|
if (seldivs[j] != '') { |
|
seldivs[j].style.display = 'none'; |
|
form['deeplink_'+divoptions[j]+'_'+key].selectedIndex = 0; |
|
} |
|
} |
|
} |
|
if (item == 'protect') { |
|
if (radios[i].value == 'key') { |
|
keybox.type = 'text'; |
|
} else { |
|
keybox.type = 'hidden'; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
END |
|
|
|
} |
|
|
# Prints HTML page start for table mode. |
# Prints HTML page start for table mode. |
# @param {Apache2::RequestRec} $r - the Apache request |
# @param {Apache2::RequestRec} $r - the Apache request |
# @param {string} $psymb - resource symb |
# @param {string} $psymb - resource symb |
Line 1477 sub print_row {
|
Line 1674 sub print_row {
|
my $mprefix=$rid.'&'.$thismarker.'&'; |
my $mprefix=$rid.'&'.$thismarker.'&'; |
my ($parmname)=($thismarker=~/\_([^\_]+)$/); |
my ($parmname)=($thismarker=~/\_([^\_]+)$/); |
my ($othergrp,$grp_parm,$controlgrp,$effective_parm,$effparm_rec,$effparm_level, |
my ($othergrp,$grp_parm,$controlgrp,$effective_parm,$effparm_rec,$effparm_level, |
$eff_groupparm,$recurse_check,$recursinfo); |
$eff_groupparm,$recurse_check,$recursinfo,$extra); |
if ((ref($recurseup) eq 'ARRAY') && (@{$recurseup} > 0)) { |
if ((ref($recurseup) eq 'ARRAY') && (@{$recurseup} > 0)) { |
if ($result eq '') { |
if ($result eq '') { |
$recurse_check = 1; |
$recurse_check = 1; |
Line 1535 sub print_row {
|
Line 1732 sub print_row {
|
($result == 16 || $result == 10 || $result == 6 || $result == 2)) { |
($result == 16 || $result == 10 || $result == 6 || $result == 2)) { |
$effparm_rec = 1; |
$effparm_rec = 1; |
} |
} |
|
if ($parmname eq 'deeplink') { |
|
my ($domltistr,$crsltistr); |
|
my %lti = |
|
&Apache::lonnet::get_domain_lti($env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
'provider'); |
|
if (keys(%lti)) { |
|
foreach my $item (sort { $a <=> $b } (keys(%lti))) { |
|
if (ref($lti{$item}) eq 'HASH') { |
|
unless ($lti{$item}{'requser'}) { |
|
$domltistr .= $item.':'.&escape(&escape($lti{$item}{'consumer'})).','; |
|
} |
|
} |
|
} |
|
$domltistr =~ s/,$//; |
|
if ($domltistr) { |
|
$extra = 'ltid_'.$domltistr; |
|
} |
|
} |
|
my %courselti = &Apache::lonnet::get_course_lti($cnum,$cdom); |
|
if (keys(%courselti)) { |
|
foreach my $item (sort { $a <=> $b } keys(%courselti)) { |
|
if (($item =~ /^\d+$/) && (ref($courselti{$item}) eq 'HASH')) { |
|
$crsltistr .= $item.':'.&escape(&escape($courselti{$item}{'name'})).','; |
|
} |
|
} |
|
$crsltistr =~ s/,$//; |
|
if ($crsltistr) { |
|
if ($extra) { |
|
$extra .= '&'; |
|
} |
|
$extra .= 'ltic_'.$crsltistr; |
|
} |
|
} |
|
if ($env{'course.'.$env{'request.course.id'}.'.menucollections'}) { |
|
my @colls; |
|
foreach my $item (split(/;/,$env{'course.'.$env{'request.course.id'}.'.menucollections'})) { |
|
my ($num,$value) = split(/\%/,$item); |
|
if ($num =~ /^\d+$/) { |
|
push(@colls,$num); |
|
} |
|
} |
|
if (@colls) { |
|
if ($extra) { |
|
$extra .= '&'; |
|
} |
|
$extra .= 'menus_'.join(',',@colls); |
|
} |
|
} |
|
} |
if ($parmlev eq 'general') { |
if ($parmlev eq 'general') { |
if ($uname) { |
if ($uname) { |
&print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,'',$extra); |
} elsif ($cgroup) { |
} elsif ($cgroup) { |
&print_td($r,8,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly); |
&print_td($r,8,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly,'',$extra); |
} elsif ($csec) { |
} elsif ($csec) { |
&print_td($r,12,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,12,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,'',$extra); |
} else { |
} else { |
&print_td($r,18,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,18,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,'',$extra); |
} |
} |
} elsif ($parmlev eq 'map') { |
} elsif ($parmlev eq 'map') { |
if ($uname) { |
if ($uname) { |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1,$extra); |
} elsif ($cgroup) { |
} elsif ($cgroup) { |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly,1); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly,1,$extra); |
} elsif ($csec) { |
} elsif ($csec) { |
&print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1); |
&print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1,$extra); |
} else { |
} else { |
&print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1); |
&print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1,$extra); |
} |
} |
} else { |
} else { |
if ($uname) { |
if ($uname) { |
Line 1576 sub print_row {
|
Line 1822 sub print_row {
|
} |
} |
} |
} |
|
|
&print_td($r,18,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,18,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,'',$extra); |
&print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1); |
&print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1,$extra); |
&print_td($r,15,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,15,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,'',$extra); |
&print_td($r,14,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,14,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,'',$extra); |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,'',$extra); |
|
|
if ($csec) { |
if ($csec) { |
&print_td($r,12,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,12,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,'',$extra); |
&print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1); |
&print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1,$extra); |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,'',$extra); |
} |
} |
|
|
if ($cgroup) { |
if ($cgroup) { |
&print_td($r,8,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly); |
&print_td($r,8,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly,'',$extra); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly,1); |
&print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly,1,$extra); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp.$readonly); |
&print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp.$readonly,'',$extra); |
} |
} |
|
|
if ($uname) { |
if ($uname) { |
if ($othergrp) { |
if ($othergrp) { |
$r->print($othergrp); |
$r->print($othergrp); |
} |
} |
&print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,'',$extra); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1); |
&print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1,$extra); |
&print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly); |
&print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,'',$extra); |
} |
} |
} # end of $parmlev if/else |
} # end of $parmlev if/else |
if (ref($recursinfo) eq 'ARRAY') { |
if (ref($recursinfo) eq 'ARRAY') { |
Line 1616 sub print_row {
|
Line 1862 sub print_row {
|
} |
} |
} |
} |
my ($parmname)=($thismarker=~/\_([^\_]+)$/); |
my ($parmname)=($thismarker=~/\_([^\_]+)$/); |
$effective_parm = &valout($recursinfo->[0],$recursinfo->[1],$parmname); |
$effective_parm = &valout($recursinfo->[0],$recursinfo->[1]); |
$r->print('<td style="background-color:#CCCCFF;" align="center">'.$effective_parm. |
$r->print('<td style="background-color:#CCCCFF;" align="center">'.$effective_parm. |
'<br /><span class="LC_parm_recursive">'.$rectitle.' '. |
'<br /><span class="LC_parm_recursive">'.$rectitle.' '. |
$effparm_level.'</span></td>'); |
$effparm_level.'</span></td>'); |
} else { |
} else { |
if ($result) { |
if ($result) { |
$effective_parm = &valout($outpar[$result],$typeoutpar[$result],$parmname); |
$effective_parm = &valout($outpar[$result],$typeoutpar[$result]); |
} |
} |
if ($eff_groupparm) { |
if ($eff_groupparm) { |
$effective_parm = $eff_groupparm; |
$effective_parm = $eff_groupparm; |
Line 1639 sub print_row {
|
Line 1885 sub print_row {
|
$sessionvaltype=$$defaulttype{$which}; |
$sessionvaltype=$$defaulttype{$which}; |
} |
} |
$r->print('<td style="background-color:#999999;" align="center"><font color="#FFFFFF">'. |
$r->print('<td style="background-color:#999999;" align="center"><font color="#FFFFFF">'. |
&valout($sessionval,$sessionvaltype,$$name{$which}).' '. |
&valout($sessionval,$sessionvaltype).' '. |
'</font></td>'); |
'</font></td>'); |
} |
} |
$r->print('</tr>'); |
$r->print('</tr>'); |
Line 1666 sub print_row {
|
Line 1912 sub print_row {
|
# @param {hash reference} $display - parameter key -> full title for the parameter |
# @param {hash reference} $display - parameter key -> full title for the parameter |
# @param {boolean} $noeditgrp - true if no edit is allowed for group level parameters |
# @param {boolean} $noeditgrp - true if no edit is allowed for group level parameters |
# @param {boolean} $readonly -true if editing not allowed. |
# @param {boolean} $readonly -true if editing not allowed. |
# @param {boolean} $ismaplevel - true if level is for a map. |
# @param {boolean} $ismaplevel - true if level is for a map. |
|
# @param {string} $extra - extra information to pass to plink. |
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,$ismaplevel)=@_; |
$noeditgrp,$readonly,$ismaplevel,$extra)=@_; |
my ($ineffect,$recursive,$currval,$currtype,$currlevel); |
my ($ineffect,$recursive,$currval,$currtype,$currlevel); |
$ineffect = 0; |
$ineffect = 0; |
$currval = $$outpar[$which]; |
$currval = $$outpar[$which]; |
Line 1708 sub print_td {
|
Line 1955 sub print_td {
|
$nolink = 1; |
$nolink = 1; |
} |
} |
} elsif ($mprefix =~ /availablestudent\&$/) { |
} elsif ($mprefix =~ /availablestudent\&$/) { |
if ($which > 4) { |
$nolink = 1; |
$nolink = 1; |
|
} |
|
} elsif ($mprefix =~ /examcode\&$/) { |
} elsif ($mprefix =~ /examcode\&$/) { |
unless ($which == 2) { |
unless ($which == 2) { |
$nolink = 1; |
$nolink = 1; |
Line 1719 sub print_td {
|
Line 1964 sub print_td {
|
} |
} |
if ($nolink) { |
if ($nolink) { |
my ($parmname)=((split(/\&/,$mprefix))[1]=~/\_([^\_]+)$/); |
my ($parmname)=((split(/\&/,$mprefix))[1]=~/\_([^\_]+)$/); |
$r->print(&valout($currval,$currtype,$parmname)); |
$r->print(&valout($currval,$currtype)); |
} else { |
} else { |
$r->print(&plink($currtype, |
$r->print(&plink($currtype, |
$$display{$value},$currval, |
$$display{$value},$currval, |
$mprefix.$currlevel,'parmform.pres','psub',$recursive)); |
$mprefix.$currlevel,'parmform.pres','psub',$recursive, |
|
$extra)); |
} |
} |
$r->print('</td>'."\n"); |
$r->print('</td>'."\n"); |
} |
} |
Line 1758 sub check_other_groups {
|
Line 2004 sub check_other_groups {
|
if ($result > 3) { |
if ($result > 3) { |
$bgcolor = '#AAFFAA'; |
$bgcolor = '#AAFFAA'; |
} |
} |
$grp_parm = &valout($coursereply,$resulttype,$parmname); |
$grp_parm = &valout($coursereply,$resulttype); |
$output = '<td style="background-color:'.$bgcolor.';" align="center">'; |
$output = '<td style="background-color:'.$bgcolor.';" align="center">'; |
if ($resultgroup && $resultlevel) { |
if ($resultgroup && $resultlevel) { |
if ($resultlevel eq 'recursive') { |
if ($resultlevel eq 'recursive') { |
Line 1966 sub isdateparm {
|
Line 2212 sub isdateparm {
|
return (($type=~/^date/) && (!($type eq 'date_interval'))); |
return (($type=~/^date/) && (!($type eq 'date_interval'))); |
} |
} |
|
|
|
# Determine if parameter type is specialized string type (i.e., |
|
# not just string or string_yesno. |
|
|
|
sub is_specialstring { |
|
my $type=shift; |
|
return (($type=~/^string_/) && (($type ne 'string_yesno'))); |
|
} |
|
|
# Prints the HTML and Javascript to select parameters, with various shortcuts. |
# Prints the HTML and Javascript to select parameters, with various shortcuts. |
# |
# |
# @param {Apache2::RequestRec} $r - the Apache request |
# @param {Apache2::RequestRec} $r - the Apache request |
Line 2101 sub lookUpTableParameter {
|
Line 2355 sub lookUpTableParameter {
|
'buttonshide' => 'hiding', |
'buttonshide' => 'hiding', |
'turnoffeditor' => 'hiding', |
'turnoffeditor' => 'hiding', |
'encrypturl' => 'hiding', |
'encrypturl' => 'hiding', |
|
'deeplink' => 'hiding', |
'randomorder' => 'high_level_randomization', |
'randomorder' => 'high_level_randomization', |
'randompick' => 'high_level_randomization', |
'randompick' => 'high_level_randomization', |
'available' => 'slots', |
'available' => 'slots', |
Line 2310 sub partmenu {
|
Line 2565 sub partmenu {
|
sub usermenu { |
sub usermenu { |
my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,$usersgroups,$pssymb)=@_; |
my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,$usersgroups,$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(); |
|
|
Line 2321 sub usermenu {
|
Line 2604 sub usermenu {
|
if (($pssymb) || &Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
if (($pssymb) || &Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
%grouphash = &Apache::longroup::coursegroups(); |
%grouphash = &Apache::longroup::coursegroups(); |
} elsif ($env{'request.course.groups'} ne '') { |
} elsif ($env{'request.course.groups'} ne '') { |
map { $grouphash{$_} = 1; } split(/,/,$env{'request.course.groups'}); |
map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'}); |
} |
} |
|
|
my $g_s_header=''; |
my $g_s_header=''; |
Line 2379 function group_or_section(caller) {
|
Line 2662 function group_or_section(caller) {
|
} |
} |
|
|
if (%grouphash) { |
if (%grouphash) { |
$groups=&mt('Group:').' <select name="cgroup"'; |
$groups=&mt('Group').': <select name="cgroup"'; |
if (%sectionhash && $env{'form.action'} eq 'settable' && $currsec eq '') { |
if (%sectionhash && $env{'form.action'} eq 'settable' && $currsec eq '') { |
$groups .= qq| onchange="group_or_section('cgroup')" |; |
$groups .= qq| onchange="group_or_section('cgroup')" |; |
} |
} |
Line 2665 sub groupmenu {
|
Line 2948 sub groupmenu {
|
if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
%grouphash = &Apache::longroup::coursegroups(); |
%grouphash = &Apache::longroup::coursegroups(); |
} elsif ($env{'request.course.groups'} ne '') { |
} elsif ($env{'request.course.groups'} ne '') { |
map { $grouphash{$_} = 1; } split(/,/,$env{'request.course.groups'}); |
map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'}); |
} |
} |
return '' if (!%grouphash); |
return '' if (!%grouphash); |
|
|
Line 2874 sub assessparms {
|
Line 3157 sub assessparms {
|
if ($cgroup ne '') { |
if ($cgroup ne '') { |
unless (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
unless (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
if (($env{'request.course.groups'} eq '') || |
if (($env{'request.course.groups'} eq '') || |
(!grep(/^\Q$cgroup\E$/,split(/,/,$env{'request.course.groups'})))) { |
(!grep(/^\Q$cgroup\E$/,split(/:/,$env{'request.course.groups'})))) { |
$noeditgrp = 1; |
$noeditgrp = 1; |
} |
} |
} |
} |
Line 2954 sub assessparms {
|
Line 3237 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= |
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
'<p class="LC_warning">'. |
if ($env{'form.userroles'} eq 'any') { |
&mt('User [_1] at domain [_2] not in this course', |
if (($env{'user.name'} eq $uname) && ($env{'user.domain'} eq $udom)) { |
"'".$uname."'","'".$udom."'"). |
$csec = $env{'request.course.sec'}; |
'</p>'; |
$message = '<span class="LC_info">'; |
$uname=''; |
if ($crstype eq 'Community') { |
$csec=$env{'form.csec'}; |
$message .= &mt('User [_1] at domain [_2] has a non-member role in this community', |
|
$uname,$udom); |
|
} else { |
|
$message .= &mt('User [_1] at domain [_2] has a non-student role in this course', |
|
$uname,$udom); |
|
} |
|
$message .= '</span>'; |
|
} else { |
|
my @possroles = ('in','ep','ta','cr'); |
|
if ($crstype eq 'Community') { |
|
unshift(@possroles,'co'); |
|
} else { |
|
unshift(@possroles,'cc'); |
|
} |
|
my %not_student_roles = |
|
&Apache::lonnet::get_my_roles($uname,$udom,'userroles',['active'], |
|
\@possroles,[$udom],1,1); |
|
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my %sections_by_role; |
|
foreach my $role (keys(%not_student_roles)) { |
|
if ($role =~ /^\Q$cnum:$cdom:\E([^:]+):(|[^:]+)$/) { |
|
my ($rolename,$sec) = ($1,$2); |
|
if ($rolename =~ m{^cr/}) { |
|
$rolename = 'cr'; |
|
} |
|
push(@{$sections_by_role{$rolename}},$sec); |
|
} |
|
} |
|
my $numroles = scalar(keys(%sections_by_role)); |
|
if ($numroles) { |
|
foreach my $role (@possroles) { |
|
if (ref($sections_by_role{$role}) eq 'ARRAY') { |
|
my @secs = sort { $a <=> $b } @{$sections_by_role{$role}}; |
|
$csec = $secs[0]; |
|
last; |
|
} |
|
} |
|
} |
|
if ($csec eq '-1') { |
|
$message = '<span class="LC_warning">'; |
|
if ($crstype eq 'Community') { |
|
$message .= &mt('User [_1] at domain [_2] does not have a role in this community', |
|
$uname,$udom); |
|
} else { |
|
$message .= &mt('User [_1] at domain [_2] does not have a role in this course', |
|
$uname,$udom); |
|
} |
|
$message .= '</span>'; |
|
$uname=''; |
|
if ($env{'request.course.sec'} ne '') { |
|
$csec=$env{'request.course.sec'}; |
|
} else { |
|
$csec=$env{'form.csec'}; |
|
} |
|
$cgroup=$env{'form.cgroup'}; |
|
} else { |
|
$message = '<span class="LC_info">'; |
|
if ($crstype eq 'Community') { |
|
$message .= &mt('User [_1] at domain [_2] has a non-member role in this community', |
|
$uname,$udom); |
|
} else { |
|
$message .= &mt('User [_1] at domain [_2] has a non-student role in this course', |
|
$uname,$udom); |
|
} |
|
$message .= '</span>'; |
|
} |
|
} |
|
} else { |
|
$message = '<span class="LC_warning">'; |
|
if ($crstype eq 'Community') { |
|
$message .= &mt('User [_1] at domain [_2] does not have a member role in this community', |
|
$uname,$udom); |
|
} else { |
|
$message .= &mt('User [_1] at domain [_2] does not have a student role in this course', |
|
$uname,$udom); |
|
} |
|
$message .= '</span>'; |
|
$uname=''; |
|
if ($env{'request.course.sec'} ne '') { |
|
$csec=$env{'request.course.sec'}; |
|
} else { |
|
$csec=$env{'form.csec'}; |
|
} |
|
$cgroup=$env{'form.cgroup'}; |
|
} |
|
} elsif ($env{'request.course.sec'} ne '') { |
|
if ($csec ne $env{'request.course.sec'}) { |
|
$message='<span class="LC_warning">'. |
|
&mt("User '[_1]' at domain '[_2]' not in section '[_3]'", |
|
$uname,$udom,$env{'request.course.sec'}). |
|
'</span>'; |
|
$uname=''; |
|
$csec=$env{'request.course.sec'}; |
|
} |
$cgroup=$env{'form.cgroup'}; |
$cgroup=$env{'form.cgroup'}; |
} else { |
} |
|
if ($uname ne '') { |
my %name=&Apache::lonnet::userenvironment($udom,$uname, |
my %name=&Apache::lonnet::userenvironment($udom,$uname, |
('firstname','middlename','lastname','generation','id')); |
('firstname','middlename','lastname','generation','id')); |
$message="\n<p>\n".&mt("Full Name").": ". |
$message .= "\n<p>\n".&mt('Full Name').': ' |
$name{'firstname'}.' '.$name{'middlename'}.' ' |
.$name{'firstname'}.' '.$name{'middlename'}.' ' |
.$name{'lastname'}.' '.$name{'generation'}. |
.$name{'lastname'}.' '.$name{'generation'} |
"<br />\n".&mt('Student/Employee ID').": ".$name{'id'}.'<p>'; |
."<br />\n".&mt('Student/Employee ID').': '.$name{'id'}.'</p>'; |
} |
@usersgroups = &Apache::lonnet::get_users_groups( |
@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 3171 sub assessparms {
|
Line 3551 sub assessparms {
|
&startpage($r,$pssymb,$crstype); |
&startpage($r,$pssymb,$crstype); |
|
|
foreach my $item ('tolerance','date_default','date_start','date_end', |
foreach my $item ('tolerance','date_default','date_start','date_end', |
'date_interval','int','float','string') { |
'date_interval','int','float','string','string_lenient', |
|
'string_examcode','string_deeplink','string_discussvote', |
|
'string_useslots','string_problemstatus','string_ip', |
|
'string_questiontype') { |
$r->print('<input type="hidden" value="'. |
$r->print('<input type="hidden" value="'. |
&HTML::Entities::encode($env{'form.recent_'.$item},'"&<>'). |
&HTML::Entities::encode($env{'form.recent_'.$item},'"&<>'). |
'" name="recent_'.$item.'" />'); |
'" name="recent_'.$item.'" />'); |
Line 3831 sub readdata {
|
Line 4214 sub readdata {
|
# Stores parameter data, using form parameters directly. |
# Stores parameter data, using form parameters directly. |
# |
# |
# Uses the following form parameters. The variable part in the names is a resourcedata key (except for a modification for user data). |
# Uses the following form parameters. The variable part in the names is a resourcedata key (except for a modification for user data). |
# set_* (except settext, setipallow, setipdeny) - set a parameter value |
# set_* (except settext, setipallow, setipdeny, setdeeplink) - set a parameter value |
# del_* - remove a parameter |
# del_* - remove a parameter |
# datepointer_* - set a date parameter (value is key_* refering to a set of other form parameters) |
# datepointer_* - set a date parameter (value is key_* refering to a set of other form parameters) |
# dateinterval_* - set a date interval parameter (value refers to more form parameters) |
# dateinterval_* - set a date interval parameter (value refers to more form parameters) |
Line 3864 sub storedata {
|
Line 4247 sub storedata {
|
my $cmd=$1; |
my $cmd=$1; |
my $thiskey=$2; |
my $thiskey=$2; |
my ($altkey,$recursive,$tkey,$tkeyrec,$tkeynonrec); |
my ($altkey,$recursive,$tkey,$tkeyrec,$tkeynonrec); |
next if ($cmd eq 'rec' || $cmd eq 'settext' || $cmd eq 'setipallow' || $cmd eq 'setipdeny'); |
next if ($cmd eq 'rec' || $cmd eq 'settext' || $cmd eq 'setipallow' || $cmd eq 'setipdeny' || $cmd eq 'setdeeplink'); |
if ((($cmd eq 'set') || ($cmd eq 'datepointer') || ($cmd eq 'dateinterval') || ($cmd eq 'del')) && |
if ((($cmd eq 'set') || ($cmd eq 'datepointer') || ($cmd eq 'dateinterval') || ($cmd eq 'del')) && |
($thiskey =~ /(?:sequence|page)\Q___(all)\E/)) { |
($thiskey =~ /(?:sequence|page)\Q___(all)\E/)) { |
unless ($thiskey =~ /(encrypturl|hiddenresource)$/) { |
unless ($thiskey =~ /(encrypturl|hiddenresource)$/) { |
Line 3895 sub storedata {
|
Line 4278 sub storedata {
|
$text = &mt('Saved modified parameter for'); |
$text = &mt('Saved modified parameter for'); |
if ($typeof eq 'string_questiontype') { |
if ($typeof eq 'string_questiontype') { |
$name = 'type'; |
$name = 'type'; |
} elsif ($typeof eq 'string_lenient') { |
} elsif (($typeof eq 'string_lenient') || ($typeof eq 'string_deeplink')) { |
$name = 'lenient'; |
($name) = ($typeof =~ /^string_(lenient|deeplink)$/); |
my $stringmatch = &standard_string_matches($typeof); |
my $stringmatch = &standard_string_matches($typeof); |
if (ref($stringmatch) eq 'ARRAY') { |
if (ref($stringmatch) eq 'ARRAY') { |
foreach my $item (@{$stringmatch}) { |
foreach my $item (@{$stringmatch}) { |
Line 4275 sub listdata {
|
Line 4658 sub listdata {
|
$tableopen=0; |
$tableopen=0; |
my $foundkeys=0; |
my $foundkeys=0; |
my %keyorder=&standardkeyorder(); |
my %keyorder=&standardkeyorder(); |
|
my $readonlyall = $readonly; |
|
|
my ($secidx,%grouphash); |
my ($secidx,%grouphash); |
if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { |
if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { |
Line 4282 sub listdata {
|
Line 4666 sub listdata {
|
if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { |
%grouphash = &Apache::longroup::coursegroups(); |
%grouphash = &Apache::longroup::coursegroups(); |
} elsif ($env{'request.course.groups'} ne '') { |
} elsif ($env{'request.course.groups'} ne '') { |
map { $grouphash{$_} = 1; } split(/,/,$env{'request.course.groups'}); |
map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'}); |
} |
} |
} |
} |
|
|
Line 4336 sub listdata {
|
Line 4720 sub listdata {
|
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}; |
my $showval = $$resourcedata{$thiskey}; |
if ($middle=~/^\[(.*)\]/) { |
if ($middle=~/^\[(.*)\]/) { |
my $issection=$1; |
my $issection=$1; |
Line 4349 sub listdata {
|
Line 4735 sub listdata {
|
} |
} |
} |
} |
$section=&mt('User').": ".&Apache::loncommon::plainname($stuname,$studom); |
$section=&mt('User').": ".&Apache::loncommon::plainname($stuname,$studom); |
|
$userscope = 1; |
} else { |
} else { |
if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { |
if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) { |
if (exists($grouphash{$issection})) { |
if (exists($grouphash{$issection})) { |
Line 4446 sub listdata {
|
Line 4833 sub listdata {
|
'<td><b>'.&mt($parmitem). |
'<td><b>'.&mt($parmitem). |
'</b></td>'); |
'</b></td>'); |
unless ($readonly) { |
unless ($readonly) { |
|
my $disabled; |
|
if (($name eq 'availablestudent') && |
|
(($showval eq '') || ($userscope))) { |
|
$disabled = ' disabled="disabled"'; |
|
} |
$r->print('<td><input type="checkbox" name="del_'. |
$r->print('<td><input type="checkbox" name="del_'. |
$thiskey.'" /></td>'); |
$thiskey.'"'.$disabled.' /></td>'); |
} |
} |
$r->print('<td>'); |
$r->print('<td>'); |
$foundkeys++; |
$foundkeys++; |
Line 4475 sub listdata {
|
Line 4867 sub listdata {
|
$r->print(&date_interval_selector($thiskey,$name, |
$r->print(&date_interval_selector($thiskey,$name, |
$showval,$readonly)); |
$showval,$readonly)); |
} elsif ($thistype =~ m/^string/) { |
} elsif ($thistype =~ m/^string/) { |
|
if ($name eq 'availablestudent') { |
|
$readonly = 1; |
|
} |
$r->print(&string_selector($thistype,$thiskey, |
$r->print(&string_selector($thistype,$thiskey, |
$showval,$name,$readonly)); |
$showval,$name,$readonly)); |
} else { |
} else { |
Line 4627 sub string_ip_selector {
|
Line 5022 sub string_ip_selector {
|
return $output; |
return $output; |
} |
} |
|
|
|
sub string_deeplink_selector { |
|
my ($thiskey, $showval, $readonly) = @_; |
|
my (@components,%values,@current,%titles,%options,%optiontext,%defaults, |
|
%selectnull,%domlti,%crslti,@possmenus); |
|
@components = ('state','others','listing','scope','protect','menus'); |
|
%titles = &Apache::lonlocal::texthash ( |
|
state => 'Access status', |
|
others => 'Hide other resources', |
|
listing => 'In Contents and/or Gradebook', |
|
scope => 'Access scope for link', |
|
protect => 'Link protection', |
|
menus => 'Menu Items Displayed', |
|
); |
|
%options = ( |
|
state => ['only','off','both'], |
|
others => ['hide','unhide'], |
|
listing => ['full','absent','grades','details','datestatus'], |
|
scope => ['res','map','rec'], |
|
protect => ['none','key','ltid','ltic'], |
|
menus => ['std','colls'], |
|
); |
|
%optiontext = &Apache::lonlocal::texthash ( |
|
only => 'deep only', |
|
off => 'deeplink off', |
|
both => 'regular + deep', |
|
hide => 'Hidden', |
|
unhide => 'Unhidden', |
|
full => 'Listed (linked) in both', |
|
absent => 'Not listed', |
|
grades => 'Listed in grades only', |
|
details => 'Listed (unlinked) in both', |
|
datestatus => 'Listed (unlinked) inc. status in both', |
|
res => 'resource only', |
|
map => 'enclosing map/folder', |
|
rec => 'recursive map/folder', |
|
none => 'not in use', |
|
key => 'key access', |
|
ltic => 'LTI access (course)', |
|
ltid => 'LTI access (domain)' , |
|
std => 'Standard (all menus)', |
|
colls => 'Numbered collection', |
|
); |
|
%selectnull = &Apache::lonlocal::texthash ( |
|
ltic => 'Select Launcher', |
|
ltid => 'Select Launcher', |
|
colls => 'Select', |
|
); |
|
if ($showval =~ /,/) { |
|
%values=(); |
|
@current = split(/,/,$showval); |
|
($values{'state'}) = ($current[0] =~ /^(only|off|both)$/); |
|
($values{'others'}) = ($current[1] =~ /^(hide|unhide)$/); |
|
($values{'listing'}) = ($current[2] =~ /^(full|absent|grades|details|datestatus)$/); |
|
($values{'scope'}) = ($current[3] =~ /^(res|map|rec)$/); |
|
($values{'protect'}) = ($current[4] =~ /^(key:[a-zA-Z\d_.!\@#\$%^&*()+=-]+|ltic:\d+|ltid:\d+)$/); |
|
($values{'menus'}) = ($current[5] =~ /^(\d+)$/); |
|
} else { |
|
$defaults{'state'} = 'off', |
|
$defaults{'others'} = 'unhide', |
|
$defaults{'listing'} = 'full'; |
|
$defaults{'scope'} = 'res'; |
|
$defaults{'protect'} = 'none'; |
|
$defaults{'menus'} = '0'; |
|
} |
|
my $disabled; |
|
if ($readonly) { |
|
$disabled=' disabled="disabled"'; |
|
} |
|
my %courselti = |
|
&Apache::lonnet::get_course_lti($env{'course.'.$env{'request.course.id'}.'.num'}, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}); |
|
foreach my $item (keys(%courselti)) { |
|
if (ref($courselti{$item}) eq 'HASH') { |
|
$crslti{$item} = $courselti{$item}{'name'}; |
|
} |
|
} |
|
my %lti = |
|
&Apache::lonnet::get_domain_lti($env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
'provider'); |
|
foreach my $item (keys(%lti)) { |
|
if (ref($lti{$item}) eq 'HASH') { |
|
unless ($lti{$item}{'requser'}) { |
|
$domlti{$item} = $lti{$item}{'consumer'}; |
|
} |
|
} |
|
} |
|
if ($env{'course.'.$env{'request.course.id'}.'.menucollections'}) { |
|
foreach my $item (split(/;/,$env{'course.'.$env{'request.course.id'}.'.menucollections'})) { |
|
my ($num,$value) = split(/\%/,$item); |
|
if ($num =~ /^\d+$/) { |
|
push(@possmenus,$num); |
|
} |
|
} |
|
} |
|
|
|
my $output = '<input type="hidden" name="set_'.$thiskey.'" /><table><tr>'; |
|
foreach my $item (@components) { |
|
$output .= '<th>'.$titles{$item}.'</th>'; |
|
} |
|
$output .= '</tr><tr>'; |
|
foreach my $item (@components) { |
|
$output .= '<td>'; |
|
if (($item eq 'protect') || ($item eq 'menus')) { |
|
my $selected = $values{$item}; |
|
foreach my $option (@{$options{$item}}) { |
|
if ($item eq 'protect') { |
|
if ($option eq 'ltid') { |
|
next unless (keys(%domlti)); |
|
} elsif ($option eq 'ltic') { |
|
next unless (keys(%crslti)); |
|
} |
|
} elsif (($item eq 'menus') && ($option eq 'colls')) { |
|
next unless (@possmenus); |
|
} |
|
my $checked; |
|
if ($item eq 'menus') { |
|
if (($selected =~ /^\d+$/) && (@possmenus) && |
|
(grep(/^\Q$selected\E$/,@possmenus))) { |
|
if ($option eq 'colls') { |
|
$checked = ' checked="checked"'; |
|
} |
|
} elsif (($option eq 'std') && ($selected == 0) && ($selected ne '')) { |
|
$checked = ' checked="checked"'; |
|
} |
|
} elsif ($selected =~ /^\Q$option\E/) { |
|
$checked = ' checked="checked"'; |
|
} |
|
my $onclick; |
|
unless ($readonly) { |
|
my $esc_key = &js_escape($thiskey); |
|
$onclick = ' onclick="toggleDeepLink(this.form,'."'$item','$esc_key'".');"'; |
|
} |
|
$output .= '<span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="deeplink_'.$item.'_'.$thiskey.'" value="'.$option.'"'.$onclick.$disabled.$checked.' />'."\n". |
|
$optiontext{$option}.'</label>'; |
|
if (($item eq 'protect') && ($option eq 'key')) { |
|
my $visibility="hidden"; |
|
my $currkey; |
|
if ($checked) { |
|
$visibility = "text"; |
|
$currkey = (split(/\:/,$values{$item}))[1]; |
|
} |
|
$output .= ' '. |
|
'<input type="'.$visibility.'" name="deeplink_'.$option.'_'.$thiskey.'" id="deeplink_'.$option.'_'.$item.'_'.$thiskey.'" value="'.$currkey.'" size="10"'.$disabled.' />'; |
|
} elsif (($option eq 'ltic') || ($option eq 'ltid') || ($option eq 'colls')) { |
|
my $display="none"; |
|
my ($current,$blankcheck,@possibles); |
|
if ($checked) { |
|
$display = 'inline-block'; |
|
if (($option eq 'ltic') || ($option eq 'ltid')) { |
|
$current = (split(/\:/,$selected))[1]; |
|
} else { |
|
$current = $selected; |
|
} |
|
} else { |
|
$blankcheck = ' selected="selected"'; |
|
} |
|
if ($option eq 'ltid') { |
|
@possibles = keys(%domlti); |
|
} elsif ($option eq 'ltic') { |
|
@possibles = keys(%crslti); |
|
} else { |
|
@possibles = @possmenus; |
|
} |
|
$output .= '<div id="deeplinkdiv_'.$option.'_'.$item.'_'.$thiskey.'"'. |
|
' style="display: '.$display.'"> <select name="'. |
|
'deeplink_'.$option.'_'.$thiskey.'"'.$disabled.'>'; |
|
if (@possibles > 1) { |
|
$output .= '<option value=""'.$blankcheck.'>'.$selectnull{$option}. |
|
'</option>'."\n"; |
|
} |
|
foreach my $poss (sort { $a <=> $b } @possibles) { |
|
my $selected; |
|
if (($poss == $current) || (scalar(@possibles) ==1)) { |
|
$selected = ' selected="selected"'; |
|
} |
|
my $shown = $poss; |
|
if ($option eq 'ltid') { |
|
$shown = $domlti{$poss}; |
|
} elsif ($option eq 'ltic') { |
|
$shown = $crslti{$poss}; |
|
} |
|
$output .= '<option value="'.$poss.'"'.$selected.'>'.$shown.'</option>'; |
|
} |
|
$output .= '</select></div>'; |
|
} |
|
$output .= '</span> '; |
|
} |
|
} else { |
|
my $selected = $values{$item}; |
|
my $defsel; |
|
if ($selected eq '') { |
|
$defsel = ' selected="selected"'; |
|
} |
|
$output .= '<select name="deeplink_'.$item.'_'.$thiskey.'"'.$disabled.'>'."\n". |
|
'<option value=""'.$defsel.'>'.&mt('Please select').'</option>'."\n"; |
|
foreach my $option (@{$options{$item}}) { |
|
$output .= '<option value="'.$option.'"'; |
|
if ($option eq $selected) { |
|
$output .= ' selected="selected"'; |
|
} |
|
$output .= '>'.$optiontext{$option}.'</option>'; |
|
} |
|
$output .= '</select>'; |
|
} |
|
$output .= '</td>'; |
|
} |
|
$output .= '</tr></table>'."\n"; |
|
return $output; |
|
} |
|
|
|
|
{ # block using some constants related to parameter types (overview mode) |
{ # block using some constants related to parameter types (overview mode) |
|
|
Line 4660 my %strings =
|
Line 5266 my %strings =
|
['no','No']], |
['no','No']], |
'string_ip' |
'string_ip' |
=> [['_allowfrom_','Hostname(s), or IP(s) from which access is allowed'], |
=> [['_allowfrom_','Hostname(s), or IP(s) from which access is allowed'], |
['_denyfrom_',], 'Hostname(s) or IP(s) from which access is disallowed'], |
['_denyfrom_','Hostname(s) or IP(s) from which access is disallowed']], |
); |
'string_deeplink' |
|
=> [['on','Set choices for link protection, resource listing, access scope, and shown menu items']], |
|
); |
|
|
|
|
my %stringmatches = ( |
my %stringmatches = ( |
'string_lenient' |
'string_lenient' |
Line 4669 my %stringmatches = (
|
Line 5278 my %stringmatches = (
|
'string_ip' |
'string_ip' |
=> [['_allowfrom_','[^\!]+'], |
=> [['_allowfrom_','[^\!]+'], |
['_denyfrom_','\!']], |
['_denyfrom_','\!']], |
|
'string_deeplink' |
|
=> [['on','^(only|off|both)\,(hide|unhide)\,(full|absent|grades|details|datestatus)\,(res|map|rec)\,(none|key\:\w+|ltic\:\d+|ltid\:\d+)\,(\d+|)$']], |
); |
); |
|
|
my %stringtypes = ( |
my %stringtypes = ( |
Line 4678 my %stringtypes = (
|
Line 5289 my %stringtypes = (
|
discussvote => 'string_discussvote', |
discussvote => 'string_discussvote', |
examcode => 'string_examcode', |
examcode => 'string_examcode', |
acc => 'string_ip', |
acc => 'string_ip', |
|
deeplink => 'string_deeplink', |
); |
); |
|
|
# Returns the possible values and titles for a given string type, or undef if there are none. |
# Returns the possible values and titles for a given string type, or undef if there are none. |
Line 4737 sub string_selector {
|
Line 5349 sub string_selector {
|
($thistype eq 'string_lenient') || |
($thistype eq 'string_lenient') || |
($thistype eq 'string_discussvote') || |
($thistype eq 'string_discussvote') || |
($thistype eq 'string_ip') || |
($thistype eq 'string_ip') || |
|
($thistype eq 'string_deeplink') || |
($name eq 'retrypartial')) { |
($name eq 'retrypartial')) { |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my ($got_chostname,$chostname,$cmajor,$cminor); |
foreach my $possibilities (@{ $strings{$thistype} }) { |
foreach my $possibilities (@{ $strings{$thistype} }) { |
Line 4775 sub string_selector {
|
Line 5388 sub string_selector {
|
|
|
if ($thistype eq 'string_ip') { |
if ($thistype eq 'string_ip') { |
return &string_ip_selector($thiskey,$showval,$readonly); |
return &string_ip_selector($thiskey,$showval,$readonly); |
|
} elsif ($thistype eq 'string_deeplink') { |
|
return &string_deeplink_selector($thiskey,$showval,$readonly); |
} |
} |
|
|
my ($result,$disabled); |
my ($result,$disabled); |
Line 5130 sub oldversion_warning {
|
Line 5745 sub oldversion_warning {
|
# @param {integer} $shift - time to shift, in seconds |
# @param {integer} $shift - time to shift, in seconds |
# @returns {string} - error name or 'ok' |
# @returns {string} - error name or 'ok' |
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 5147 sub dateshift {
|
Line 5775 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 5189 sub newoverview {
|
Line 5821 sub newoverview {
|
&validateparms_js()."\n". |
&validateparms_js()."\n". |
&ipacc_boxes_js()."\n". |
&ipacc_boxes_js()."\n". |
&done_proctor_js()."\n". |
&done_proctor_js()."\n". |
|
&deeplink_js()."\n". |
'// ]]> |
'// ]]> |
</script> |
</script> |
'; |
'; |
Line 5410 sub overview {
|
Line 6043 sub overview {
|
&validateparms_js()."\n". |
&validateparms_js()."\n". |
&ipacc_boxes_js()."\n". |
&ipacc_boxes_js()."\n". |
&done_proctor_js()."\n". |
&done_proctor_js()."\n". |
|
&deeplink_js()."\n". |
'// ]]>'."\n". |
'// ]]>'."\n". |
'</script>'."\n"; |
'</script>'."\n"; |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
Line 5557 sub date_shift_one {
|
Line 6191 sub date_shift_one {
|
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 $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
|
my $sec = $env{'request.course.sec'}; |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'}, |
text=>"Shifting Dates"}); |
text=>"Shifting Dates"}); |
|
my $submit_text = &mt('Shift all dates accordingly'); |
|
if ($sec ne '') { |
|
my @groups; |
|
if ($env{'request.course.groups'} ne '') { |
|
@groups = split(/:/,$env{'request.course.groups'}); |
|
} |
|
if (@groups) { |
|
$submit_text = &mt("Shift dates set just for your section/group(s), accordingly"); |
|
} else { |
|
$submit_text = &mt("Shift dates set just for your section, accordingly"); |
|
} |
|
} |
my $start_page=&Apache::loncommon::start_page('Shift Dates'); |
my $start_page=&Apache::loncommon::start_page('Shift Dates'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); |
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
Line 5575 sub date_shift_one {
|
Line 6221 sub date_shift_one {
|
'</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>'); |
&endSettingsScreen($r); |
&endSettingsScreen($r); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
Line 5587 sub date_shift_two {
|
Line 6233 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'}; |
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; |
&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"}); |
Line 5595 sub date_shift_two {
|
Line 6242 sub date_shift_two {
|
$r->print($start_page.$breadcrumbs); |
$r->print($start_page.$breadcrumbs); |
&startSettingsScreen($r,'parmset',$crstype); |
&startSettingsScreen($r,'parmset',$crstype); |
my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted'); |
my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted'); |
$r->print('<h2>'.&mt('Shift Dates').'</h2>'. |
$r->print('<h2>'.&mt('Shift Dates').'</h2>'); |
'<p>'.&mt('Shifting all dates such that [_1] becomes [_2]', |
if ($sec ne '') { |
&Apache::lonlocal::locallocaltime($env{'form.timebase'}), |
my @groups; |
&Apache::lonlocal::locallocaltime($timeshifted)).'</p>'); |
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( |
$r->print( |
&Apache::lonhtmlcommon::confirm_success(&mt('Done')). |
|
'<br /><br />'. |
'<br /><br />'. |
&Apache::lonhtmlcommon::actionbox( |
&Apache::lonhtmlcommon::actionbox( |
['<a href="/adm/parmset">'.&mt('Content and Problem Settings').'</a>'])); |
['<a href="/adm/parmset">'.&mt('Content and Problem Settings').'</a>'])); |
Line 5975 sub continue {
|
Line 6655 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 6003 sub addmetafield {
|
Line 6683 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 6015 sub addmetafield {
|
Line 6698 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('<label><input type="checkbox" name="undeletefield" value="'.$key.'" />'.$$fields{$key}.'</label><br /'); |
$r->print('<label><input type="checkbox" name="undeletefield" value="'.$key.'" />'.$$fields{$key}.'</label><br /'); |
} |
} |
$r->print('<input type="submit" name="undelete" value="Undelete" />'); |
$r->print('<input type="submit" name="undelete" value="'.&mt('Undelete').'" />'); |
$r->print('</form>'); |
$r->print('</form>'); |
} |
} |
$r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.'. |
$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">'); |
'<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>'); |
} |
} |
&endSettingsScreen($r); |
&endSettingsScreen($r); |
Line 6058 sub setrestrictmeta {
|
Line 6748 sub setrestrictmeta {
|
&startSettingsScreen($r,'parmset',$crstype); |
&startSettingsScreen($r,'parmset',$crstype); |
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 6096 sub setrestrictmeta {
|
Line 6791 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); # FIXME: wrong parameters |
|
} |
} |
$output .= &Apache::loncommon::end_data_table(); |
$output .= &Apache::loncommon::end_data_table(); |
$r->print(<<ENDenv); |
$r->print(<<ENDenv); |
Line 6540 sub parm_change_log {
|
Line 7232 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'}) { |
return $parmlog{$b}{'exe_time'} <=>$parmlog{$a}{'exe_time'} |
return $parmlog{$b}{'exe_time'} <=>$parmlog{$a}{'exe_time'} |
Line 6579 sub parm_change_log {
|
Line 7277 sub parm_change_log {
|
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'},$typeflag); |
&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'},$typeflag); |
if ($env{'request.course.sec'} ne '') { |
if ($env{'request.course.sec'} ne '') { |
next if (($issection ne '') && ($issection ne $env{'request.course.sec'})); |
next if (($issection ne '') && (!(($issection eq $env{'request.course.sec'}) || |
|
($numgroups && (grep(/^\Q$issection\E$/,@groups)))))); |
if ($uname ne '') { |
if ($uname ne '') { |
my $stusection = &Apache::lonnet::getsection($uname,$udom,$env{'request.course.id'}); |
my $stusection = &Apache::lonnet::getsection($uname,$udom,$env{'request.course.id'}); |
next if (($stusection ne '-1') && ($stusection ne $env{'request.course.sec'})); |
next if (($stusection ne '-1') && ($stusection ne $env{'request.course.sec'})); |