version 1.600, 2021/06/12 22:06:32
|
version 1.616, 2022/07/07 03:37:01
|
Line 1245 function validateParms() {
|
Line 1245 function validateParms() {
|
var ipallowRegExp = /^setipallow_/; |
var ipallowRegExp = /^setipallow_/; |
var ipdenyRegExp = /^setipdeny_/; |
var ipdenyRegExp = /^setipdeny_/; |
var deeplinkRegExp = /^deeplink_/; |
var deeplinkRegExp = /^deeplink_/; |
var dlListScopeRegExp = /^deeplink_(listing|scope)_/; |
var dlListScopeRegExp = /^deeplink_(state|others|listing|scope)_/; |
var dlLinkUrlsRegExp = /^deeplink_urls_/; |
var dlLinkProtectRegExp = /^deeplink_protect_/; |
var dlLtiRegExp = /^deeplink_lti_/; |
var dlLtidRegExp = /^deeplink_ltid_/; |
|
var dlLticRegExp = /^deeplink_ltic_/; |
var dlKeyRegExp = /^deeplink_key_/; |
var dlKeyRegExp = /^deeplink_key_/; |
var dlMenusRegExp = /^deeplink_menus_/; |
var dlMenusRegExp = /^deeplink_menus_/; |
var dlCollsRegExp = /^deeplink_colls_/; |
var dlCollsRegExp = /^deeplink_colls_/; |
|
var dlTargetRegExp = /^deeplink_target_/; |
|
var dlExitRegExp = /^deeplink_exit_/; |
|
var dlExitTextRegExp = /^deeplink_exittext_/; |
var patternIP = /[\[\]\*\.a-zA-Z\d\-]+/; |
var patternIP = /[\[\]\*\.a-zA-Z\d\-]+/; |
if ((document.parmform.elements.length != 'undefined') && (document.parmform.elements.length) != 'null') { |
var numelements = document.parmform.elements.length; |
if (document.parmform.elements.length) { |
if ((typeof(numelements) != 'undefined') && (numelements != null)) { |
for (i=0; i<document.parmform.elements.length; i++) { |
if (numelements) { |
|
for (i=0; i<numelements; 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,''); |
Line 1314 function validateParms() {
|
Line 1319 function validateParms() {
|
} |
} |
document.parmform.elements['set_'+identifier].value += possdeeplink; |
document.parmform.elements['set_'+identifier].value += possdeeplink; |
} |
} |
} else if (dlLinkUrlsRegExp.test(name)) { |
} else if (dlLinkProtectRegExp.test(name)) { |
if (document.parmform.elements[i].checked) { |
if (document.parmform.elements[i].checked) { |
var identifier = name.replace(dlLinkUrlsRegExp,''); |
var identifier = name.replace(dlLinkProtectRegExp,''); |
var posslinkurl = document.parmform.elements[i].value; |
var posslinkurl = document.parmform.elements[i].value; |
posslinkurl = posslinkurl.replace(/^\s+|\s+$/g,''); |
posslinkurl = posslinkurl.replace(/^\s+|\s+$/g,''); |
if (document.parmform.elements['set_'+identifier].value) { |
if (document.parmform.elements['set_'+identifier].value) { |
Line 1324 function validateParms() {
|
Line 1329 function validateParms() {
|
} |
} |
document.parmform.elements['set_'+identifier].value += posslinkurl; |
document.parmform.elements['set_'+identifier].value += posslinkurl; |
} |
} |
} else if (dlLtiRegExp.test(name)) { |
} else if (dlLtidRegExp.test(name)) { |
var identifier = name.replace(dlLtiRegExp,''); |
var identifier = name.replace(dlLtidRegExp,''); |
if (isRadioSet('deeplink_urls_'+identifier,'lti')) { |
if (isRadioSet('deeplink_protect_'+identifier,'ltid')) { |
var posslti = document.parmform.elements[i].value; |
var possltid = document.parmform.elements[i].value; |
posslti = posslti.replace(/\D+/g,''); |
possltid = possltid.replace(/\D+/g,''); |
if (posslti.length) { |
if (possltid.length) { |
if (document.parmform.elements['set_'+identifier].value) { |
if (document.parmform.elements['set_'+identifier].value) { |
posslti = ':'+posslti; |
possltid = ':'+possltid; |
} |
} |
document.parmform.elements['set_'+identifier].value += posslti; |
document.parmform.elements['set_'+identifier].value += possltid; |
} else { |
} else { |
document.parmform.elements['set_'+identifier].value = ''; |
document.parmform.elements['set_'+identifier].value = ''; |
alert("A link type of 'deep with LTI launch' was selected but no LTI launcher was selected.\nPlease select one, or choose a different supported link type."); |
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; |
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)) { |
} else if (dlKeyRegExp.test(name)) { |
var identifier = name.replace(dlKeyRegExp,''); |
var identifier = name.replace(dlKeyRegExp,''); |
if (isRadioSet('deeplink_urls_'+identifier,'key')) { |
if (isRadioSet('deeplink_protect_'+identifier,'key')) { |
var posskey = document.parmform.elements[i].value; |
var posskey = document.parmform.elements[i].value; |
posskey = posskey.replace(/^\s+|\s+$/g,''); |
posskey = posskey.replace(/^\s+|\s+$/g,''); |
var origlength = posskey.length; |
var origlength = posskey.length; |
Line 1389 function validateParms() {
|
Line 1410 function validateParms() {
|
} |
} |
document.parmform.elements['set_'+identifier].value += posslinkmenu; |
document.parmform.elements['set_'+identifier].value += posslinkmenu; |
} |
} |
|
} else if (dlTargetRegExp.test(name)) { |
|
var identifier = name.replace(dlTargetRegExp,''); |
|
var idx = document.parmform.elements[i].selectedIndex; |
|
if (idx > 0) { |
|
var linktarget = document.parmform.elements[i].options[idx].value |
|
linktarget = linktarget.replace(/^\s+|\s+$/g,''); |
|
if (document.parmform.elements['set_'+identifier].value) { |
|
linktarget = ','+linktarget; |
|
} |
|
document.parmform.elements['set_'+identifier].value += linktarget; |
|
} |
|
} else if (dlExitRegExp.test(name)) { |
|
if (document.parmform.elements[i].checked) { |
|
var identifier = name.replace(dlExitRegExp,''); |
|
var posslinkexit = document.parmform.elements[i].value; |
|
posslinkexit = posslinkexit.replace(/^\s+|\s+$/g,''); |
|
if (document.parmform.elements['set_'+identifier].value) { |
|
posslinkexit = ','+posslinkexit; |
|
} |
|
document.parmform.elements['set_'+identifier].value += posslinkexit; |
|
} |
|
} else if (dlExitTextRegExp.test(name)) { |
|
var identifier = name.replace(dlExitTextRegExp,''); |
|
if ((isRadioSet('deeplink_exit_'+identifier,'yes')) || |
|
(isRadioSet('deeplink_exit_'+identifier,'url'))) { |
|
var posstext = document.parmform.elements[i].value; |
|
posstext = posstext.replace(/^\s+|\s+$/g,''); |
|
var origlength = posstext.length; |
|
posstext = posstext.replace(/[:;'",]/g,''); |
|
var newlength = posstext.length; |
|
if (newlength > 0) { |
|
var change = origlength - newlength; |
|
if (change) { |
|
alert(change+' disallowed character(s) removed from Exit Button text'); |
|
} |
|
if (posstext !== 'Exit Tool') { |
|
posstext = ':'+posstext; |
|
document.parmform.elements['set_'+identifier].value += posstext; |
|
} |
|
} else { |
|
document.parmform.elements['set_'+identifier].value = ''; |
|
if (newlength < origlength) { |
|
alert("An exit link type of 'In use' was selected but the button text value was blank, after removing disallowed characters.\nDisallowed characters are ,\":;'"); |
|
} else { |
|
alert("An exit link type of 'In use' was selected but the button text value was blank.\nPlease enter the text to use."); |
|
} |
|
return false; |
|
} |
|
} |
} |
} |
} |
} |
} |
} |
Line 1444 END
|
Line 1514 END
|
|
|
# Javascript function toggleSecret, for overview mode. |
# Javascript function toggleSecret, for overview mode. |
sub done_proctor_js { |
sub done_proctor_js { |
|
my $defaultdone = &mt('Done'); |
|
&js_escape(\$defaultdone); |
return <<"END"; |
return <<"END"; |
function toggleSecret(form,radio,key) { |
function toggleSecret(form,radio,key) { |
var radios = form[radio+key]; |
var radios = form[radio+key]; |
Line 1460 function toggleSecret(form,radio,key) {
|
Line 1532 function toggleSecret(form,radio,key) {
|
document.getElementById('done_'+key+'_proctorkey').value=''; |
document.getElementById('done_'+key+'_proctorkey').value=''; |
} |
} |
} |
} |
|
if (document.getElementById('done_'+key+'_buttontext')) { |
|
if (radios[i].value == '') { |
|
document.getElementById('done_'+key+'_buttontext').value = ''; |
|
} else { |
|
if (document.getElementById('done_'+key+'_buttontext').value == '') { |
|
document.getElementById('done_'+key+'_buttontext').value = '$defaultdone'; |
|
} |
|
} |
|
} |
} |
} |
} |
} |
} |
} |
Line 1478 function toggleDeepLink(form,item,key) {
|
Line 1559 function toggleDeepLink(form,item,key) {
|
if (document.getElementById('deeplink_key_'+item+'_'+key)) { |
if (document.getElementById('deeplink_key_'+item+'_'+key)) { |
keybox = document.getElementById('deeplink_key_'+item+'_'+key); |
keybox = document.getElementById('deeplink_key_'+item+'_'+key); |
} |
} |
var divoption; |
var divoptions = new Array(); |
if (item == 'urls') { |
if (item == 'protect') { |
divoption = 'lti' |
divoptions = ['ltic','ltid']; |
} else { |
} else { |
if (item == 'menus') { |
if (item == 'menus') { |
divoption = 'colls'; |
divoptions = ['colls']; |
} |
} |
} |
} |
var seldiv; |
var seldivs = new Array(); |
if (document.getElementById('deeplinkdiv_'+divoption+'_'+item+'_'+key)) { |
if ((item == 'protect') || (item == 'menus')) { |
seldiv = document.getElementById('deeplinkdiv_'+divoption+'_'+item+'_'+key); |
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++) { |
for (var i=0; i<radios.length; i++) { |
if (radios[i].checked) { |
if (radios[i].checked) { |
if (radios[i].value == divoption) { |
if ((item == 'protect') || (item == 'menus')) { |
seldiv.style.display = 'inline-block'; |
for (var j=0; j<seldivs.length; j++) { |
if (item == 'urls') { |
if (radios[i].value == divoptions[j]) { |
keybox.type = 'hidden'; |
if (seldivs[j] != '') { |
keybox.value = ''; |
seldivs[j].style.display = 'inline-block'; |
} |
} |
} else { |
if (item == 'protect') { |
if (seldiv != '') { |
keybox.type = 'hidden'; |
seldiv.style.display = 'none'; |
keybox.value = ''; |
form['deeplink_'+divoption+'_'+key].selectedIndex = 0; |
} |
|
} else { |
|
if (seldivs[j] != '') { |
|
seldivs[j].style.display = 'none'; |
|
form['deeplink_'+divoptions[j]+'_'+key].selectedIndex = 0; |
|
} |
|
} |
} |
} |
if (item == 'urls') { |
if (item == 'protect') { |
if (radios[i].value == 'key') { |
if (radios[i].value == 'key') { |
keybox.type = 'text'; |
keybox.type = 'text'; |
} else { |
} else { |
keybox.type = 'hidden'; |
keybox.type = 'hidden'; |
} |
} |
} |
} |
|
} else if (item == 'exit') { |
|
if (document.getElementById('deeplinkdiv_'+item+'_'+key)) { |
|
if (radios[i].value == 'no') { |
|
document.getElementById('deeplinkdiv_'+item+'_'+key).style.display = 'none'; |
|
if (document.getElementById('deeplink_exittext_'+key)) { |
|
if (document.getElementById('deeplink_exittext_'+key).value != '') { |
|
document.getElementById('deeplink_exittext_'+key).value = ''; |
|
} |
|
} |
|
} else { |
|
document.getElementById('deeplinkdiv_'+item+'_'+key).style.display = 'inline-block'; |
|
if (document.getElementById('deeplink_exittext_'+key)) { |
|
if (document.getElementById('deeplink_exittext_'+key).value == '') { |
|
document.getElementById('deeplink_exittext_'+key).value = 'Exit Tool'; |
|
} |
|
} |
|
} |
|
} |
} |
} |
} |
} |
} |
} |
Line 1704 sub print_row {
|
Line 1815 sub print_row {
|
$effparm_rec = 1; |
$effparm_rec = 1; |
} |
} |
if ($parmname eq 'deeplink') { |
if ($parmname eq 'deeplink') { |
my %posslti; |
my ($domltistr,$crsltistr); |
my %lti = |
my %lti = |
&Apache::lonnet::get_domain_lti($env{'course.'.$env{'request.course.id'}.'.domain'}, |
&Apache::lonnet::get_domain_lti($env{'course.'.$env{'request.course.id'}.'.domain'}, |
'provider'); |
'linkprot'); |
foreach my $item (keys(%lti)) { |
if (keys(%lti)) { |
if (ref($lti{$item}) eq 'HASH') { |
foreach my $item (sort { $a <=> $b } (keys(%lti))) { |
unless ($lti{$item}{'requser'}) { |
if (($item =~ /^\d+$/) && (ref($lti{$item}) eq 'HASH')) { |
$posslti{$item} = $lti{$item}{'consumer'}; |
$domltistr .= $item.':'.&escape(&escape($lti{$item}{'name'})).','; |
} |
} |
} |
} |
|
$domltistr =~ s/,$//; |
|
if ($domltistr) { |
|
$extra = 'ltid_'.$domltistr; |
|
} |
} |
} |
if (keys(%posslti)) { |
my %courselti = &Apache::lonnet::get_course_lti($cnum,$cdom); |
$extra = 'lti_'; |
if (keys(%courselti)) { |
foreach my $lti (sort { $a <=> $b } keys(%posslti)) { |
foreach my $item (sort { $a <=> $b } keys(%courselti)) { |
$extra .= $lti.':'.&escape(&escape($posslti{$lti})).','; |
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; |
} |
} |
$extra =~ s/,$//; |
|
} |
} |
if ($env{'course.'.$env{'request.course.id'}.'.menucollections'}) { |
if ($env{'course.'.$env{'request.course.id'}.'.menucollections'}) { |
my @colls; |
my @colls; |
Line 2033 sub parm_control_group {
|
Line 2156 sub parm_control_group {
|
# @param {hash reference} $uris - hash resource/map id -> resource src |
# @param {hash reference} $uris - hash resource/map id -> resource src |
# @param {hash reference} $keyorder - hash parameter key -> appearance rank for this parameter when looking through every resource and every parameter, starting at 100 (integer) |
# @param {hash reference} $keyorder - hash parameter key -> appearance rank for this parameter when looking through every resource and every parameter, starting at 100 (integer) |
# @param {hash reference} $defkeytype - hash parameter name -> parameter type |
# @param {hash reference} $defkeytype - hash parameter name -> parameter type |
|
# @param {string} $pssymb - resource symb (when a single resource is selected) |
sub extractResourceInformation { |
sub extractResourceInformation { |
my $ids = shift; |
my $ids = shift; |
my $typep = shift; |
my $typep = shift; |
Line 2046 sub extractResourceInformation {
|
Line 2170 sub extractResourceInformation {
|
my $uris=shift; |
my $uris=shift; |
my $keyorder=shift; |
my $keyorder=shift; |
my $defkeytype=shift; |
my $defkeytype=shift; |
|
my $pssymb=shift; |
|
|
my $keyordercnt=100; |
my $keyordercnt=100; |
|
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my @allres=$navmap->retrieveResources(undef,undef,1,undef,1); |
return unless(ref($navmap)); |
|
my @allres; |
|
if ($pssymb ne '') { |
|
my $res = $navmap->getBySymb($pssymb); |
|
if (ref($res)) { |
|
@allres = ($res); |
|
} |
|
} |
|
if (!@allres) { |
|
@allres=$navmap->retrieveResources(undef,undef,1,undef,1); |
|
} |
foreach my $resource (@allres) { |
foreach my $resource (@allres) { |
my $id=$resource->id(); |
my $id=$resource->id(); |
my ($mapid,$resid)=split(/\./,$id); |
my ($mapid,$resid)=split(/\./,$id); |
Line 2174 sub isdateparm {
|
Line 2309 sub isdateparm {
|
|
|
sub is_specialstring { |
sub is_specialstring { |
my $type=shift; |
my $type=shift; |
return (($type=~/^string_/) && (($type ne 'string_yesno'))); |
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. |
Line 2690 sub displaymenu {
|
Line 2825 sub displaymenu {
|
# @param {string} $pschp - selected map pc, or 'all' |
# @param {string} $pschp - selected map pc, or 'all' |
# @param {hash reference} $maptitles - hash map id or src -> map title |
# @param {hash reference} $maptitles - hash map id or src -> map title |
# @param {hash reference} $symbp - hash map pc or resource/map id -> map src.'___(all)' or resource symb |
# @param {hash reference} $symbp - hash map pc or resource/map id -> map src.'___(all)' or resource symb |
|
# @param {string} $parmlev - parameter level (Resource:'full', Map:'map', Course:'general') |
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=[]; |
Line 2739 sub mapmenu {
|
Line 2875 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="" />'; |
my $whitespace = |
my $whitespace = |
Line 2981 sub keysindisplayorder {
|
Line 3121 sub keysindisplayorder {
|
# |
# |
# @param {Apache2::RequestRec} $r - the Apache request |
# @param {Apache2::RequestRec} $r - the Apache request |
# @param {string} $sortorder - realmstudent|studentrealm |
# @param {string} $sortorder - realmstudent|studentrealm |
|
# @param {string} $context - newoverview|overview |
sub sortmenu { |
sub sortmenu { |
my ($r,$sortorder)=@_; |
my ($r,$sortorder,$context)=@_; |
$r->print('<br /><label><input type="radio" name="sortorder" value="realmstudent"'); |
my %text; |
if ($sortorder eq 'realmstudent') { |
if ($context eq 'newoverview') { |
$r->print(' checked="checked"'); |
%text = &Apache::lonlocal::texthash ( |
|
realmstudent => 'Sort by location in course first, then student (group/section)', |
|
studentrealm => 'Sort by student (group/section) first, then location in course', |
|
); |
|
} else { |
|
%text = &Apache::lonlocal::texthash ( |
|
realmstudent => 'Sort by realm first, then student (group/section)', |
|
studentrealm => 'Sort by student (group/section) first, then realm', |
|
); |
} |
} |
$r->print(' />'.&mt('Sort by realm first, then student (group/section)')); |
my %sortchecked = ( |
$r->print('</label><br /><label><input type="radio" name="sortorder" value="studentrealm"'); |
realmstudent => ' checked="checked"', |
|
studentrealm => '', |
|
); |
if ($sortorder eq 'studentrealm') { |
if ($sortorder eq 'studentrealm') { |
$r->print(' checked="checked"'); |
$sortchecked{'studentrealm'} = $sortchecked{'realmstudent'}; |
|
$sortchecked{'realmstudent'} = ''; |
|
} |
|
foreach my $sorttype ('realmstudent','studentrealm') { |
|
$r->print('<br /><label><input type="radio" name="sortorder" value="'.$sorttype.'"'.$sortchecked{$sorttype}.' />'. |
|
$text{$sorttype}.'</label>'); |
} |
} |
$r->print(' />'.&mt('Sort by student (group/section) first, then realm'). |
|
'</label>'); |
|
} |
} |
|
|
# Returns a hash parameter key -> order (integer) giving the order for some parameters. |
# Returns a hash parameter key -> order (integer) giving the order for some parameters. |
Line 3323 sub assessparms {
|
Line 3477 sub assessparms {
|
# --------------------------------------------------------- Get all assessments |
# --------------------------------------------------------- Get all assessments |
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
\%mapp, \%symbp,\%maptitles,\%uris, |
\%mapp, \%symbp,\%maptitles,\%uris, |
\%keyorder); |
\%keyorder,undef,$pssymb); |
|
|
%allmaps_inverted = reverse(%allmaps); |
%allmaps_inverted = reverse(%allmaps); |
|
|
Line 3340 sub assessparms {
|
Line 3494 sub assessparms {
|
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my ($got_chostname,$chostname,$cmajor,$cminor); |
my $totalstored = 0; |
my $totalstored = 0; |
|
my $totalskippeduser = 0; |
my $now = time; |
my $now = time; |
for (my $i=0;$i<=$#markers;$i++) { |
for (my $i=0;$i<=$#markers;$i++) { |
my ($needsrelease,$needsnewer,$name,$namematch); |
my ($needsrelease,$needsnewer,$name,$namematch); |
Line 3348 sub assessparms {
|
Line 3503 sub assessparms {
|
} |
} |
if ($markers[$i] =~ /\&(8|7|6|5)$/) { |
if ($markers[$i] =~ /\&(8|7|6|5)$/) { |
next if ($noeditgrp); |
next if ($noeditgrp); |
|
} elsif ($markers[$i] =~ /\&(4|3|2|1)$/) { |
|
if ($uname eq '') { |
|
$totalskippeduser ++; |
|
next; |
|
} |
} |
} |
if ($markers[$i] =~ /\&(17|11|7|3)$/) { |
if ($markers[$i] =~ /\&(17|11|7|3)$/) { |
$namematch = 'maplevelrecurse'; |
$namematch = 'maplevelrecurse'; |
Line 3486 sub assessparms {
|
Line 3646 sub assessparms {
|
# ---------------------------------------------------------------- Done storing |
# ---------------------------------------------------------------- Done storing |
if ($totalstored) { |
if ($totalstored) { |
$message.='<p class="LC_warning">' |
$message.='<p class="LC_warning">' |
|
.&mt('Changes for [quant,_1,parameter] saved.',$totalstored) |
|
.'<br />' |
.&mt('Changes can take up to 10 minutes before being active for all students.') |
.&mt('Changes can take up to 10 minutes before being active for all students.') |
.&Apache::loncommon::help_open_topic('Caching') |
.&Apache::loncommon::help_open_topic('Caching') |
.'</p>'; |
.'</p>'; |
|
} else { |
|
$message.='<p class="LC_info">'.&mt('No parameter changes saved.').'</p>'; |
|
} |
|
if ($totalskippeduser) { |
|
$message .= '<p class="LC_warning">'; |
|
if ($uhome eq 'no_host') { |
|
$message .= &mt('Changes for [quant,_1,user-specific parameter] not saved because the username or ID was invalid.', |
|
$totalskippeduser); |
|
} elsif ($env{'form.userroles'} eq 'any') { |
|
$message .= &mt('Changes for [quant,_1,user-specific parameter] not saved because the user does not have a course role.', |
|
$totalskippeduser); |
|
} else { |
|
$message .= &mt('Changes for [quant,_1,user-specific parameter] not saved because the user is not a student.', |
|
$totalskippeduser); |
|
} |
|
$message .= '</p>'; |
} |
} |
} |
} |
|
|
Line 3519 sub assessparms {
|
Line 3697 sub assessparms {
|
|
|
# ----- Start Parameter Selection |
# ----- Start Parameter Selection |
|
|
# Hide parm selection? |
# Hide parm selection and possibly table? |
|
my ($tablejs,$tabledivsty); |
|
if (((($env{'form.uname'} ne '') || ($env{'form.id'} ne '')) && ($uname eq '')) && |
|
($env{'form.dis'}) && ($pssymb eq '')) { |
|
$tablejs = 'document.getElementById('."'parmtable'".').style.display = "";'; |
|
$tabledivsty = ' style="display:none"'; |
|
} |
$r->print(<<ENDPARMSELSCRIPT); |
$r->print(<<ENDPARMSELSCRIPT); |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
function parmsel_show() { |
function parmsel_show() { |
document.getElementById('parmsel').style.display = ""; |
document.getElementById('parmsel').style.display = ""; |
document.getElementById('parmsellink').style.display = "none"; |
document.getElementById('parmsellink').style.display = "none"; |
|
$tablejs |
} |
} |
// ]]> |
// ]]> |
</script> |
</script> |
Line 3552 ENDPARMSELSCRIPT
|
Line 3737 ENDPARMSELSCRIPT
|
$r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel')); |
$r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel')); |
&levelmenu($r,\%alllevs,$parmlev); |
&levelmenu($r,\%alllevs,$parmlev); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles, \%symbp); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp,$parmlev); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); |
&partmenu($r,\%allparts,\@psprt); |
&partmenu($r,\%allparts,\@psprt); |
Line 3632 ENDPARMSELSCRIPT
|
Line 3817 ENDPARMSELSCRIPT
|
if ($parm_permission->{'edit'}) { |
if ($parm_permission->{'edit'}) { |
undef($readonly); |
undef($readonly); |
} |
} |
|
$r->print('<div id="parmtable"'.$tabledivsty.'>'); |
|
|
if ($parmlev eq 'full') { |
if ($parmlev eq 'full') { |
# |
# |
Line 3848 ENDTABLEHEADFOUR
|
Line 4034 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 4065 ENDMAPONE
|
Line 4251 ENDMAPONE
|
.'</center>' |
.'</center>' |
); |
); |
} # end of $parmlev eq general |
} # end of $parmlev eq general |
|
$r->print('</div>'); |
} |
} |
$r->print('</form>'); |
$r->print('</form>'); |
if ($numreclinks) { |
if ($numreclinks) { |
Line 4602 sub parse_listdata_key {
|
Line 4789 sub parse_listdata_key {
|
# @param {string} $caller - name of the calling sub (overview|newoverview) |
# @param {string} $caller - name of the calling sub (overview|newoverview) |
# @param {hash reference} $classlist - from loncoursedata::get_classlist |
# @param {hash reference} $classlist - from loncoursedata::get_classlist |
# @param {boolean} $readonly - true if editing not allowed |
# @param {boolean} $readonly - true if editing not allowed |
|
# @param {string} $parmlev - full|map |
|
# @param {hash reference} $hash_for_realm - keys: realm, values: numeric order |
|
# @param {string} $pschp - selected map pc, or 'all' |
# @returns{integer} - number of $listdata parameters processed |
# @returns{integer} - number of $listdata parameters processed |
sub listdata { |
sub listdata { |
my ($r,$resourcedata,$listdata,$sortorder,$caller,$classlist,$readonly)=@_; |
my ($r,$resourcedata,$listdata,$sortorder,$caller,$classlist,$readonly,$parmlev,$hash_for_realm,$pschp)=@_; |
|
|
# Start list output |
# Start list output |
|
|
Line 4630 sub listdata {
|
Line 4820 sub listdata {
|
foreach my $key (sort { |
foreach my $key (sort { |
my ($astudent,$ares,$apart,$aparm) = &parse_listdata_key($a,$listdata); |
my ($astudent,$ares,$apart,$aparm) = &parse_listdata_key($a,$listdata); |
my ($bstudent,$bres,$bpart,$bparm) = &parse_listdata_key($b,$listdata); |
my ($bstudent,$bres,$bpart,$bparm) = &parse_listdata_key($b,$listdata); |
|
my ($aid,$bid); |
|
if ($caller eq 'newoverview') { |
|
if (ref($hash_for_realm) eq 'HASH') { |
|
if (($parmlev eq 'map') && ($pschp eq 'all')) { |
|
my ($aurl) = ($ares =~ /^(.+\.(?:sequence|page))___\(all\)$/); |
|
my ($burl) = ($bres =~ /^(.+\.(?:sequence|page))___\(all\)$/); |
|
$aid = $hash_for_realm->{$aurl}; |
|
$bid = $hash_for_realm->{$burl}; |
|
} elsif ($parmlev eq 'full') { |
|
$aid = $hash_for_realm->{$ares}; |
|
$bid = $hash_for_realm->{$bres}; |
|
} |
|
} |
|
} |
|
|
# get the numerical order for the param |
# get the numerical order for the param |
$aparm=$keyorder{'parameter_0_'.$aparm}; |
$aparm=$keyorder{'parameter_0_'.$aparm}; |
Line 4639 sub listdata {
|
Line 4843 sub listdata {
|
|
|
if ($sortorder eq 'realmstudent') { |
if ($sortorder eq 'realmstudent') { |
if ($ares ne $bres ) { |
if ($ares ne $bres ) { |
$result = ($ares cmp $bres); |
if ($caller eq 'newoverview') { |
|
if (ref($hash_for_realm) eq 'HASH') { |
|
if (($parmlev eq 'map') && ($pschp eq 'all')) { |
|
$result = ($aid <=> $bid); |
|
} elsif ($parmlev eq 'full') { |
|
$result = ($aid <=> $bid); |
|
} else { |
|
$result = ($ares cmp $bres); |
|
} |
|
} else { |
|
$result = ($ares cmp $bres); |
|
} |
|
} else { |
|
$result = ($ares cmp $bres); |
|
} |
} elsif ($astudent ne $bstudent) { |
} elsif ($astudent ne $bstudent) { |
$result = ($astudent cmp $bstudent); |
$result = ($astudent cmp $bstudent); |
} elsif ($apart ne $bpart ) { |
} elsif ($apart ne $bpart ) { |
Line 4649 sub listdata {
|
Line 4867 sub listdata {
|
if ($astudent ne $bstudent) { |
if ($astudent ne $bstudent) { |
$result = ($astudent cmp $bstudent); |
$result = ($astudent cmp $bstudent); |
} elsif ($ares ne $bres ) { |
} elsif ($ares ne $bres ) { |
$result = ($ares cmp $bres); |
if ($caller eq 'newoverview') { |
|
if (ref($hash_for_realm) eq 'HASH') { |
|
if (($parmlev eq 'map') && ($pschp eq 'all')) { |
|
$result = ($aid <=> $bid); |
|
} elsif ($parmlev eq 'full') { |
|
$result = ($aid <=> $bid); |
|
} else { |
|
$result = ($ares cmp $bres); |
|
} |
|
} else { |
|
$result = ($ares cmp $bres); |
|
} |
|
} else { |
|
$result = ($ares cmp $bres); |
|
} |
} elsif ($apart ne $bpart ) { |
} elsif ($apart ne $bpart ) { |
$result = ($apart cmp $bpart); |
$result = ($apart cmp $bpart); |
} |
} |
Line 4729 sub listdata {
|
Line 4961 sub listdata {
|
} |
} |
if ($is_map) { |
if ($is_map) { |
my $leveltitle = &mt('Folder/Map'); |
my $leveltitle = &mt('Folder/Map'); |
|
my $title = &Apache::lonnet::gettitle($mapurl); |
|
if (ref($hash_for_realm) eq 'HASH') { |
|
if ($hash_for_realm->{$mapurl} eq '1') { |
|
$title = &mt('Main Content'); |
|
} |
|
} |
unless (($name eq 'hiddenresource') || ($name eq 'encrypturl')) { |
unless (($name eq 'hiddenresource') || ($name eq 'encrypturl')) { |
if ($caller eq 'newoverview') { |
if ($caller eq 'newoverview') { |
my $altkey = $thiskey; |
my $altkey = $thiskey; |
Line 4745 sub listdata {
|
Line 4983 sub listdata {
|
$is_recursive = 1; |
$is_recursive = 1; |
} |
} |
} |
} |
$realm='<span class="LC_parm_scope_folder">'.$leveltitle.': '.&Apache::lonnet::gettitle($mapurl).' <br /><span class="LC_parm_folder">('.$mapurl.')</span></span>'; |
$realm='<span class="LC_parm_scope_folder">'.$leveltitle.': '.$title.' <br /><span class="LC_parm_folder">('.$mapurl.')</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'). |
$realm='<span class="LC_parm_scope_resource">'.&mt('Resource'). |
': '.&Apache::lonnet::gettitle($middle). |
': '.&Apache::lonnet::gettitle($middle). |
' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '. |
' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '. |
Line 4869 sub listdata {
|
Line 5108 sub listdata {
|
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; |
|
} |
} |
} |
} |
} |
if (($key =~ /\.interval$/) && |
if (($key =~ /\.interval$/) && |
Line 4894 sub get_date_interval_from_form {
|
Line 5137 sub get_date_interval_from_form {
|
$seconds .= '_'.$env{'form.done_'.$key.'_proctorkey'}; |
$seconds .= '_'.$env{'form.done_'.$key.'_proctorkey'}; |
} |
} |
} |
} |
|
return if (!$numnotnull); |
return $seconds; |
return $seconds; |
} |
} |
|
|
Line 4981 sub string_ip_selector {
|
Line 5225 sub string_ip_selector {
|
|
|
sub string_deeplink_selector { |
sub string_deeplink_selector { |
my ($thiskey, $showval, $readonly) = @_; |
my ($thiskey, $showval, $readonly) = @_; |
my (@components,%values,@current,%titles,%options,%optiontext,%defaults, |
my (@tables,%values,@current,%titles,%options,%optiontext,%defaults, |
%selectnull,%posslti,@possmenus); |
%selectnull,%domlti,%crslti,@possmenus,%components); |
@components = ('listing','scope','urls','menus'); |
@tables = ('upper','lower'); |
|
%components = ( |
|
upper => ['state','others','listing','scope'], |
|
lower => ['protect','menus','target','exit'], |
|
); |
%titles = &Apache::lonlocal::texthash ( |
%titles = &Apache::lonlocal::texthash ( |
|
state => 'Access status', |
|
others => 'Hide other resources', |
listing => 'In Contents and/or Gradebook', |
listing => 'In Contents and/or Gradebook', |
scope => 'Access scope for link', |
scope => 'Access scope for link', |
urls => 'Supported link types', |
protect => 'Link protection', |
menus => 'Menu Items Displayed', |
menus => 'Menu Items Displayed', |
|
target => 'Embedded?', |
|
exit => 'Exit Tool Button?', |
); |
); |
%options = ( |
%options = ( |
|
state => ['only','off','both'], |
|
others => ['hide','unhide'], |
listing => ['full','absent','grades','details','datestatus'], |
listing => ['full','absent','grades','details','datestatus'], |
scope => ['res','map','rec'], |
scope => ['res','map','rec'], |
urls => ['any','only','key','lti'], |
protect => ['none','key','ltid','ltic'], |
menus => ['std','colls'], |
menus => ['std','colls'], |
|
target => ['_self','_top'], |
|
exit => ['no','yes','url'], |
); |
); |
%optiontext = &Apache::lonlocal::texthash ( |
%optiontext = &Apache::lonlocal::texthash ( |
|
only => 'deep only', |
|
off => 'deeplink off', |
|
both => 'regular + deep', |
|
hide => 'Hidden', |
|
unhide => 'Unhidden', |
full => 'Listed (linked) in both', |
full => 'Listed (linked) in both', |
absent => 'Not listed', |
absent => 'Not listed', |
grades => 'Listed in grades only', |
grades => 'Listed in grades only', |
Line 5005 sub string_deeplink_selector {
|
Line 5266 sub string_deeplink_selector {
|
res => 'resource only', |
res => 'resource only', |
map => 'enclosing map/folder', |
map => 'enclosing map/folder', |
rec => 'recursive map/folder', |
rec => 'recursive map/folder', |
any => 'regular + deep', |
none => 'not in use', |
only => 'deep only', |
key => 'key access', |
key => 'deep with key', |
ltic => 'LTI access (course)', |
lti => 'deep with LTI launch', |
ltid => 'LTI access (domain)' , |
std => 'Standard (all menus)', |
std => 'Standard (all menus)', |
colls => 'Numbered collection', |
colls => 'Numbered collection', |
|
_self => 'Embedded', |
|
_top => 'Not embedded', |
|
no => 'Not in use', |
|
yes => 'In use, no URL redirect', |
|
url => 'In use, redirect to URL', |
); |
); |
%selectnull = &Apache::lonlocal::texthash ( |
%selectnull = &Apache::lonlocal::texthash ( |
lti => 'Select Provider', |
ltic => 'Select Launcher', |
|
ltid => 'Select Launcher', |
colls => 'Select', |
colls => 'Select', |
); |
); |
if ($showval =~ /,/) { |
if ($showval =~ /,/) { |
%values=(); |
%values=(); |
@current = split(/,/,$showval); |
@current = split(/,/,$showval); |
($values{'listing'}) = ($current[0] =~ /^(full|absent|grades|details|datestatus)$/); |
($values{'state'}) = ($current[0] =~ /^(only|off|both)$/); |
($values{'scope'}) = ($current[1] =~ /^(res|map|rec)$/); |
($values{'others'}) = ($current[1] =~ /^(hide|unhide)$/); |
($values{'urls'}) = ($current[2] =~ /^(any|only|key:[a-zA-Z\d_.!\@#\$%^&*()+=-]+|lti:\d+)$/); |
($values{'listing'}) = ($current[2] =~ /^(full|absent|grades|details|datestatus)$/); |
($values{'menus'}) = ($current[3] =~ /^(\d+)$/); |
($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+)$/); |
|
($values{'target'}) = ($current[6] =~ /^(_self|_top)$/); |
|
($values{'exit'}) = ($current[7] =~ /^((?:(?:yes|url)(?:|\:[^:;"',]+))|no)$/); |
} else { |
} else { |
|
$defaults{'state'} = 'off', |
|
$defaults{'others'} = 'unhide', |
$defaults{'listing'} = 'full'; |
$defaults{'listing'} = 'full'; |
$defaults{'scope'} = 'res'; |
$defaults{'scope'} = 'res'; |
$defaults{'urls'} = 'any'; |
$defaults{'protect'} = 'none'; |
$defaults{'menus'} = '0'; |
$defaults{'menus'} = '0'; |
|
$defaults{'target'} = '_top'; |
|
$defaults{'exit'} = 'yes'; |
} |
} |
my $disabled; |
my $disabled; |
if ($readonly) { |
if ($readonly) { |
$disabled=' disabled="disabled"'; |
$disabled=' disabled="disabled"'; |
} |
} |
my %lti = |
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'}, |
&Apache::lonnet::get_domain_lti($env{'course.'.$env{'request.course.id'}.'.domain'}, |
'provider'); |
'linkprot'); |
foreach my $item (keys(%lti)) { |
foreach my $item (keys(%lti)) { |
if (ref($lti{$item}) eq 'HASH') { |
if (($item =~ /^\d+$/) && (ref($lti{$item}) eq 'HASH')) { |
unless ($lti{$item}{'requser'}) { |
$domlti{$item} = $lti{$item}{'name'}; |
$posslti{$item} = $lti{$item}{'consumer'}; |
|
} |
|
} |
} |
} |
} |
if ($env{'course.'.$env{'request.course.id'}.'.menucollections'}) { |
if ($env{'course.'.$env{'request.course.id'}.'.menucollections'}) { |
Line 5052 sub string_deeplink_selector {
|
Line 5333 sub string_deeplink_selector {
|
} |
} |
} |
} |
|
|
my $output = '<input type="hidden" name="set_'.$thiskey.'" /><table><tr>'; |
my $output = '<input type="hidden" name="set_'.$thiskey.'" />'; |
foreach my $item (@components) { |
foreach my $table ('upper','lower') { |
$output .= '<th>'.$titles{$item}.'</th>'; |
next unless (ref($components{$table}) eq 'ARRAY'); |
} |
$output .= '<table width="100%"><tr>'; |
$output .= '</tr><tr>'; |
foreach my $item (@{$components{$table}}) { |
foreach my $item (@components) { |
$output .= '<th>'.$titles{$item}.'</th>'; |
$output .= '<td>'; |
} |
if (($item eq 'urls') || ($item eq 'menus')) { |
$output .= '</tr><tr>'; |
my $selected = $values{$item}; |
foreach my $item (@{$components{$table}}) { |
foreach my $option (@{$options{$item}}) { |
$output .= '<td>'; |
if (($item eq 'urls') && ($option eq 'lti')) { |
if (($item eq 'protect') || ($item eq 'menus') || ($item eq 'exit')) { |
next unless (keys(%posslti)); |
my $selected = $values{$item}; |
} elsif (($item eq 'menus') && ($option eq 'colls')) { |
foreach my $option (@{$options{$item}}) { |
next unless (@possmenus); |
if ($item eq 'protect') { |
} |
if ($option eq 'ltid') { |
my $checked; |
next unless (keys(%domlti)); |
if ($item eq 'menus') { |
} elsif ($option eq 'ltic') { |
if (($selected =~ /^\d+$/) && (@possmenus) && |
next unless (keys(%crslti)); |
(grep(/^\Q$selected\E$/,@possmenus))) { |
} |
if ($option eq 'colls') { |
} 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"'; |
$checked = ' checked="checked"'; |
} |
} |
} elsif (($option eq 'std') && ($selected == 0) && ($selected ne '')) { |
} elsif ($selected =~ /^\Q$option\E/) { |
$checked = ' checked="checked"'; |
$checked = ' checked="checked"'; |
} |
} |
} elsif ($selected =~ /^\Q$option\E/) { |
my $onclick; |
$checked = ' checked="checked"'; |
unless ($readonly) { |
} |
my $esc_key = &js_escape($thiskey); |
my $onclick; |
$onclick = ' onclick="toggleDeepLink(this.form,'."'$item','$esc_key'".');"'; |
unless ($readonly) { |
} |
my $esc_key = &js_escape($thiskey); |
$output .= '<span class="LC_nobreak"><label>'. |
$onclick = ' onclick="toggleDeepLink(this.form,'."'$item','$esc_key'".');"'; |
'<input type="radio" name="deeplink_'.$item.'_'.$thiskey.'" value="'.$option.'"'.$onclick.$disabled.$checked.' />'."\n". |
} |
$optiontext{$option}.'</label>'; |
$output .= '<span class="LC_nobreak"><label>'. |
if (($item eq 'protect') && ($option eq 'key')) { |
'<input type="radio" name="deeplink_'.$item.'_'.$thiskey.'" value="'.$option.'"'.$onclick.$disabled.$checked.' />'."\n". |
my $visibility="hidden"; |
$optiontext{$option}.'</label>'; |
my $currkey; |
if (($item eq 'urls') && ($option eq 'key')) { |
if ($checked) { |
my $visibility="hidden"; |
$visibility = "text"; |
my $currkey; |
$currkey = (split(/\:/,$values{$item}))[1]; |
if ($checked) { |
} |
$visibility = "text"; |
$output .= ' '. |
$currkey = (split(/\:/,$values{$item}))[1]; |
'<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')) { |
$output .= ' '. |
my $display="none"; |
'<input type="'.$visibility.'" name="deeplink_'.$option.'_'.$thiskey.'" id="deeplink_'.$option.'_'.$item.'_'.$thiskey.'" value="'.$currkey.'" size="10"'.$disabled.' />'; |
my ($current,$blankcheck,@possibles); |
} elsif (($option eq 'lti') || ($option eq 'colls')) { |
if ($checked) { |
my $display="none"; |
$display = 'inline-block'; |
my ($current,$blankcheck,@possibles); |
if (($option eq 'ltic') || ($option eq 'ltid')) { |
if ($checked) { |
$current = (split(/\:/,$selected))[1]; |
$display = 'inline-block'; |
} else { |
if ($option eq 'lti') { |
$current = $selected; |
$current = (split(/\:/,$selected))[1]; |
} |
} else { |
} else { |
$current = $selected; |
$blankcheck = ' selected="selected"'; |
} |
} |
} else { |
if ($option eq 'ltid') { |
$blankcheck = ' selected="selected"'; |
@possibles = keys(%domlti); |
} |
} elsif ($option eq 'ltic') { |
if ($option eq 'lti') { |
@possibles = keys(%crslti); |
@possibles = keys(%posslti); |
} else { |
} else { |
@possibles = @possmenus; |
@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; |
$output .= '<div id="deeplinkdiv_'.$option.'_'.$item.'_'.$thiskey.'"'. |
if ($option eq 'lti') { |
' style="display: '.$display.'"> <select name="'. |
$shown = $posslti{$poss}; |
'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> '; |
|
} |
|
if ($item eq 'exit') { |
|
my $exitsty = 'none'; |
|
my $displayval; |
|
if ($values{$item} =~ /^(yes|url)/) { |
|
$exitsty = 'inline-block'; |
|
my $currval = (split(/\:/,$values{$item}))[1]; |
|
if ($currval eq '') { |
|
$displayval = 'Exit Tool'; |
|
} else { |
|
$displayval = $currval; |
} |
} |
$output .= '<option value="'.$poss.'"'.$selected.'>'.$shown.'</option>'; |
|
} |
} |
$output .= '</select></div>'; |
$output .= '<div id="deeplinkdiv_'.$item.'_'.$thiskey.'"'. |
} |
' style="display: '.$exitsty.'"><br />'.&mt('Button text').': '. |
$output .= '</span> '; |
'<input type="text" name="deeplink_exittext_'.$thiskey.'"'. |
} |
' id="deeplink_exittext_'.$thiskey.'" value="'.$displayval.'"'. |
} else { |
' size="10"'.$disabled.' /></div>'; |
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>'; |
} else { |
} |
my $selected = $values{$item}; |
$output .= '</select>'; |
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"; |
|
if ($table eq 'upper') { |
|
$output .= '<br />'; |
} |
} |
$output .= '</td>'; |
|
} |
} |
$output .= '</tr></table>'."\n"; |
|
return $output; |
return $output; |
} |
} |
|
|
Line 5195 my %strings =
|
Line 5509 my %strings =
|
=> [['_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' |
'string_deeplink' |
=> [['on','Set choices for link protection, resource listing, access scope, and shown menu items']], |
=> [['on','Set choices for link protection, resource listing, access scope, shown menu items, embedding, and exit link']], |
); |
); |
|
|
|
|
Line 5206 my %stringmatches = (
|
Line 5520 my %stringmatches = (
|
=> [['_allowfrom_','[^\!]+'], |
=> [['_allowfrom_','[^\!]+'], |
['_denyfrom_','\!']], |
['_denyfrom_','\!']], |
'string_deeplink' |
'string_deeplink' |
=> [['on','^(full|absent|grades|details|datestatus)\,(res|map|rec)\,(any|only|key\:\w+|lti\:\d+)\,(\d+|)$']], |
=> [['on','^(only|off|both)\,(hide|unhide)\,(full|absent|grades|details|datestatus)\,(res|map|rec)\,(none|key\:\w+|ltic\:\d+|ltid\:\d+)\,(\d+|)\,_(self|top),(yes|url|no)(|:[^:;\'",]+)$']], |
); |
); |
|
|
my %stringtypes = ( |
my %stringtypes = ( |
Line 5526 sub date_interval_selector {
|
Line 5840 sub date_interval_selector {
|
$showval %= $factor; |
$showval %= $factor; |
my %select = ((map {$_ => $_} (0..$max)), |
my %select = ((map {$_ => $_} (0..$max)), |
'select_form_order' => [0..$max]); |
'select_form_order' => [0..$max]); |
|
if ($currval eq '') { |
|
unshift(@{$select{'select_form_order'}},''); |
|
$select{''} = ''; |
|
$amount = ''; |
|
} |
$result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey, |
$result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey, |
\%select,'',$readonly); |
\%select,'',$readonly); |
$result .= ' '.&mt($name); |
$result .= ' '.&mt($name); |
Line 5533 sub date_interval_selector {
|
Line 5852 sub date_interval_selector {
|
if ($name eq 'interval') { |
if ($name eq 'interval') { |
unless ($skipval{'done'}) { |
unless ($skipval{'done'}) { |
my $checkedon = ''; |
my $checkedon = ''; |
|
my $checkedoff = ''; |
my $checkedproc = ''; |
my $checkedproc = ''; |
my $currproctorkey = ''; |
my $currproctorkey = ''; |
my $currprocdisplay = 'hidden'; |
my $currprocdisplay = 'hidden'; |
my $currdonetext = &mt('Done'); |
my $currdonetext = &mt('Done'); |
my $checkedoff = ' checked="checked"'; |
|
if ($currval =~ /^(?:\d+)_done$/) { |
if ($currval =~ /^(?:\d+)_done$/) { |
$checkedon = ' checked="checked"'; |
$checkedon = ' checked="checked"'; |
$checkedoff = ''; |
|
} elsif ($currval =~ /^(?:\d+)_done\:([^\:]+)\:$/) { |
} elsif ($currval =~ /^(?:\d+)_done\:([^\:]+)\:$/) { |
$currdonetext = $1; |
$currdonetext = $1; |
$checkedon = ' checked="checked"'; |
$checkedon = ' checked="checked"'; |
$checkedoff = ''; |
|
} elsif ($currval =~ /^(?:\d+)_done_proctor_(.+)$/) { |
} elsif ($currval =~ /^(?:\d+)_done_proctor_(.+)$/) { |
$currproctorkey = $1; |
$currproctorkey = $1; |
$checkedproc = ' checked="checked"'; |
$checkedproc = ' checked="checked"'; |
$checkedoff = ''; |
|
$currprocdisplay = 'text'; |
$currprocdisplay = 'text'; |
} elsif ($currval =~ /^(?:\d+)_done\:([^\:]+)\:_proctor_(.+)$/) { |
} elsif ($currval =~ /^(?:\d+)_done\:([^\:]+)\:_proctor_(.+)$/) { |
$currdonetext = $1; |
$currdonetext = $1; |
$currproctorkey = $2; |
$currproctorkey = $2; |
$checkedproc = ' checked="checked"'; |
$checkedproc = ' checked="checked"'; |
$checkedoff = ''; |
|
$currprocdisplay = 'text'; |
$currprocdisplay = 'text'; |
|
} elsif ($currval ne '') { |
|
$checkedoff = ' checked="checked"'; |
|
} else { |
|
$currdonetext = ''; |
} |
} |
my $onclick = ' onclick="toggleSecret(this.form,'."'done_','$thiskey'".');"'; |
my $onclick = ' onclick="toggleSecret(this.form,'."'done_','$thiskey'".');"'; |
my $disabled; |
my $disabled; |
Line 5572 sub date_interval_selector {
|
Line 5891 sub date_interval_selector {
|
'<input type="'.$currprocdisplay.'" id="done_'.$thiskey.'_proctorkey" '. |
'<input type="'.$currprocdisplay.'" id="done_'.$thiskey.'_proctorkey" '. |
'name="done_'.$thiskey.'_proctorkey" value="'.&HTML::Entities::encode($currproctorkey,'"<>&').'"'.$disabled.' /></span><br />'. |
'name="done_'.$thiskey.'_proctorkey" value="'.&HTML::Entities::encode($currproctorkey,'"<>&').'"'.$disabled.' /></span><br />'. |
'<span class="LC_nobreak">'.&mt('Button text').': '. |
'<span class="LC_nobreak">'.&mt('Button text').': '. |
'<input type="text" name="done_'.$thiskey.'_buttontext" value="'.&HTML::Entities::encode($currdonetext,'"<>&').'"'.$disabled.' /></span>'; |
'<input type="text" name="done_'.$thiskey.'_buttontext" id="done_'.$thiskey.'_buttontext" value="'. |
|
&HTML::Entities::encode($currdonetext,'"<>&').'"'.$disabled.' /></span>'; |
} |
} |
} |
} |
unless ($readonly) { |
unless ($readonly) { |
Line 5813 ENDOVER
|
Line 6133 ENDOVER
|
|
|
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
\%mapp, \%symbp,\%maptitles,\%uris, |
\%mapp, \%symbp,\%maptitles,\%uris, |
\%keyorder,\%defkeytype); |
\%keyorder,\%defkeytype,$pssymb); |
|
|
if (grep {$_ eq 'all'} (@psprt)) { |
if (grep {$_ eq 'all'} (@psprt)) { |
@psprt = keys(%allparts); |
@psprt = keys(%allparts); |
Line 5825 ENDOVER
|
Line 6145 ENDOVER
|
$r->print('<div>'); |
$r->print('<div>'); |
$r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel')); |
$r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel')); |
&levelmenu($r,\%alllevs,$parmlev); |
&levelmenu($r,\%alllevs,$parmlev); |
if ($parmlev ne 'general') { |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp,$parmlev); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp); |
|
} |
|
$r->print(&Apache::lonhtmlcommon::row_closure(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 5866 ENDOVER
|
Line 6184 ENDOVER
|
$r->print('<div>'); |
$r->print('<div>'); |
my $sortorder=$env{'form.sortorder'}; |
my $sortorder=$env{'form.sortorder'}; |
unless ($sortorder) { $sortorder='realmstudent'; } |
unless ($sortorder) { $sortorder='realmstudent'; } |
&sortmenu($r,$sortorder); |
&sortmenu($r,$sortorder,'newoverview'); |
$r->print('</div></div>'); |
$r->print('</div></div>'); |
|
|
$r->print('<p><input type="submit" name="dis" value="'.&mt('Display').'" /></p>'); |
$r->print('<p><input type="submit" name="dis" value="'.&mt('Display').'" /></p>'); |
Line 5891 ENDOVER
|
Line 6209 ENDOVER
|
|
|
# List data |
# List data |
|
|
&listdata($r,$resourcedata,$listdata,$sortorder,'newoverview',undef,$readonly); |
my $hash_for_realm; |
|
if (($parmlev eq 'map') && (keys(%allmaps))) { |
|
%{$hash_for_realm} = reverse(%allmaps); |
|
} elsif (($parmlev eq 'full') && (keys(%symbp))) { |
|
for (my $i=0; $i<@ids; $i++) { |
|
$hash_for_realm->{$symbp{$ids[$i]}} = $i; |
|
} |
|
} |
|
&listdata($r,$resourcedata,$listdata,$sortorder,'newoverview',undef,$readonly,$parmlev,$hash_for_realm,$pschp); |
} |
} |
$r->print(&tableend()); |
$r->print(&tableend()); |
unless ($readonly) { |
unless ($readonly) { |
Line 5998 sub overview {
|
Line 6324 sub overview {
|
|
|
my $sortorder=$env{'form.sortorder'}; |
my $sortorder=$env{'form.sortorder'}; |
unless ($sortorder) { $sortorder='realmstudent'; } |
unless ($sortorder) { $sortorder='realmstudent'; } |
&sortmenu($r,$sortorder); |
&sortmenu($r,$sortorder,'overview'); |
|
|
my $submitbutton = '<input type="submit" value="'.&mt('Save').'" />'; |
my $submitbutton = '<input type="submit" value="'.&mt('Save').'" />'; |
|
|