version 1.614, 2022/05/31 14:16:29
|
version 1.616, 2022/07/07 03:37:01
|
Line 1253 function validateParms() {
|
Line 1253 function validateParms() {
|
var dlMenusRegExp = /^deeplink_menus_/; |
var dlMenusRegExp = /^deeplink_menus_/; |
var dlCollsRegExp = /^deeplink_colls_/; |
var dlCollsRegExp = /^deeplink_colls_/; |
var dlTargetRegExp = /^deeplink_target_/; |
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 1411 function validateParms() {
|
Line 1414 function validateParms() {
|
var identifier = name.replace(dlTargetRegExp,''); |
var identifier = name.replace(dlTargetRegExp,''); |
var idx = document.parmform.elements[i].selectedIndex; |
var idx = document.parmform.elements[i].selectedIndex; |
if (idx > 0) { |
if (idx > 0) { |
var possdeeplink = document.parmform.elements[i].options[idx].value |
var linktarget = document.parmform.elements[i].options[idx].value |
possdeeplink = possdeeplink.replace(/^\s+|\s+$/g,''); |
linktarget = linktarget.replace(/^\s+|\s+$/g,''); |
if (document.parmform.elements['set_'+identifier].value) { |
if (document.parmform.elements['set_'+identifier].value) { |
possdeeplink = ','+possdeeplink; |
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; |
} |
} |
document.parmform.elements['set_'+identifier].value += possdeeplink; |
|
} |
} |
} |
} |
} |
} |
Line 1562 function toggleDeepLink(form,item,key) {
|
Line 1603 function toggleDeepLink(form,item,key) {
|
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 4902 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($1); |
my $title = &Apache::lonnet::gettitle($mapurl); |
if (ref($hash_for_realm) eq 'HASH') { |
if (ref($hash_for_realm) eq 'HASH') { |
if ($hash_for_realm->{$mapurl} eq '1') { |
if ($hash_for_realm->{$mapurl} eq '1') { |
$title = &mt('Main Content'); |
$title = &mt('Main Content'); |
Line 5166 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,%domlti,%crslti,@possmenus); |
%selectnull,%domlti,%crslti,@possmenus,%components); |
@components = ('state','others','listing','scope','protect','menus','target'); |
@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', |
state => 'Access status', |
others => 'Hide other resources', |
others => 'Hide other resources', |
Line 5177 sub string_deeplink_selector {
|
Line 5240 sub string_deeplink_selector {
|
protect => 'Link protection', |
protect => 'Link protection', |
menus => 'Menu Items Displayed', |
menus => 'Menu Items Displayed', |
target => 'Embedded?', |
target => 'Embedded?', |
|
exit => 'Exit Tool Button?', |
); |
); |
%options = ( |
%options = ( |
state => ['only','off','both'], |
state => ['only','off','both'], |
Line 5186 sub string_deeplink_selector {
|
Line 5250 sub string_deeplink_selector {
|
protect => ['none','key','ltid','ltic'], |
protect => ['none','key','ltid','ltic'], |
menus => ['std','colls'], |
menus => ['std','colls'], |
target => ['_self','_top'], |
target => ['_self','_top'], |
|
exit => ['no','yes','url'], |
); |
); |
%optiontext = &Apache::lonlocal::texthash ( |
%optiontext = &Apache::lonlocal::texthash ( |
only => 'deep only', |
only => 'deep only', |
Line 5209 sub string_deeplink_selector {
|
Line 5274 sub string_deeplink_selector {
|
colls => 'Numbered collection', |
colls => 'Numbered collection', |
_self => 'Embedded', |
_self => 'Embedded', |
_top => 'Not 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 ( |
ltic => 'Select Launcher', |
ltic => 'Select Launcher', |
Line 5225 sub string_deeplink_selector {
|
Line 5293 sub string_deeplink_selector {
|
($values{'protect'}) = ($current[4] =~ /^(key:[a-zA-Z\d_.!\@#\$%^&*()+=-]+|ltic:\d+|ltid:\d+)$/); |
($values{'protect'}) = ($current[4] =~ /^(key:[a-zA-Z\d_.!\@#\$%^&*()+=-]+|ltic:\d+|ltid:\d+)$/); |
($values{'menus'}) = ($current[5] =~ /^(\d+)$/); |
($values{'menus'}) = ($current[5] =~ /^(\d+)$/); |
($values{'target'}) = ($current[6] =~ /^(_self|_top)$/); |
($values{'target'}) = ($current[6] =~ /^(_self|_top)$/); |
|
($values{'exit'}) = ($current[7] =~ /^((?:(?:yes|url)(?:|\:[^:;"',]+))|no)$/); |
} else { |
} else { |
$defaults{'state'} = 'off', |
$defaults{'state'} = 'off', |
$defaults{'others'} = 'unhide', |
$defaults{'others'} = 'unhide', |
Line 5233 sub string_deeplink_selector {
|
Line 5302 sub string_deeplink_selector {
|
$defaults{'protect'} = 'none'; |
$defaults{'protect'} = 'none'; |
$defaults{'menus'} = '0'; |
$defaults{'menus'} = '0'; |
$defaults{'target'} = '_top'; |
$defaults{'target'} = '_top'; |
|
$defaults{'exit'} = 'yes'; |
} |
} |
my $disabled; |
my $disabled; |
if ($readonly) { |
if ($readonly) { |
Line 5263 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 'protect') || ($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 'protect') { |
if (($item eq 'protect') || ($item eq 'menus') || ($item eq 'exit')) { |
if ($option eq 'ltid') { |
my $selected = $values{$item}; |
next unless (keys(%domlti)); |
foreach my $option (@{$options{$item}}) { |
} elsif ($option eq 'ltic') { |
if ($item eq 'protect') { |
next unless (keys(%crslti)); |
if ($option eq 'ltid') { |
} |
next unless (keys(%domlti)); |
} elsif (($item eq 'menus') && ($option eq 'colls')) { |
} elsif ($option eq 'ltic') { |
next unless (@possmenus); |
next unless (keys(%crslti)); |
} |
} |
my $checked; |
} elsif (($item eq 'menus') && ($option eq 'colls')) { |
if ($item eq 'menus') { |
next unless (@possmenus); |
if (($selected =~ /^\d+$/) && (@possmenus) && |
} |
(grep(/^\Q$selected\E$/,@possmenus))) { |
my $checked; |
if ($option eq 'colls') { |
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 'protect') && ($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 'ltic') || ($option eq 'ltid') || ($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 'ltic') || ($option eq 'ltid')) { |
$current = $selected; |
$current = (split(/\:/,$selected))[1]; |
} |
} else { |
} else { |
$current = $selected; |
$blankcheck = ' selected="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') { |
if ($option eq 'ltid') { |
$shown = $domlti{$poss}; |
@possibles = keys(%domlti); |
} elsif ($option eq 'ltic') { |
} elsif ($option eq 'ltic') { |
$shown = $crslti{$poss}; |
@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> '; |
|
} |
|
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').': '. |
|
'<input type="text" name="deeplink_exittext_'.$thiskey.'"'. |
|
' id="deeplink_exittext_'.$thiskey.'" value="'.$displayval.'"'. |
|
' size="10"'.$disabled.' /></div>'; |
} |
} |
$output .= '</span> '; |
} else { |
} |
my $selected = $values{$item}; |
} else { |
my $defsel; |
my $selected = $values{$item}; |
if ($selected eq '') { |
my $defsel; |
$defsel = ' selected="selected"'; |
if ($selected eq '') { |
} |
$defsel = ' selected="selected"'; |
$output .= '<select name="deeplink_'.$item.'_'.$thiskey.'"'.$disabled.'>'."\n". |
} |
'<option value=""'.$defsel.'>'.&mt('Please select').'</option>'."\n"; |
$output .= '<select name="deeplink_'.$item.'_'.$thiskey.'"'.$disabled.'>'."\n". |
foreach my $option (@{$options{$item}}) { |
'<option value=""'.$defsel.'>'.&mt('Please select').'</option>'."\n"; |
$output .= '<option value="'.$option.'"'; |
foreach my $option (@{$options{$item}}) { |
if ($option eq $selected) { |
$output .= '<option value="'.$option.'"'; |
$output .= ' selected="selected"'; |
if ($option eq $selected) { |
} |
$output .= ' selected="selected"'; |
$output .= '>'.$optiontext{$option}.'</option>'; |
} |
} |
$output .= '>'.$optiontext{$option}.'</option>'; |
$output .= '</select>'; |
} |
} |
$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 5414 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, shown menu items, and embedding']], |
=> [['on','Set choices for link protection, resource listing, access scope, shown menu items, embedding, and exit link']], |
); |
); |
|
|
|
|
Line 5425 my %stringmatches = (
|
Line 5520 my %stringmatches = (
|
=> [['_allowfrom_','[^\!]+'], |
=> [['_allowfrom_','[^\!]+'], |
['_denyfrom_','\!']], |
['_denyfrom_','\!']], |
'string_deeplink' |
'string_deeplink' |
=> [['on','^(only|off|both)\,(hide|unhide)\,(full|absent|grades|details|datestatus)\,(res|map|rec)\,(none|key\:\w+|ltic\:\d+|ltid\:\d+)\,(\d+|)\,_(self|top)$']], |
=> [['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 = ( |