$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 ($uname) {
- &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra);
} elsif ($cgroup) {
- &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly);
+ &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly,$extra);
} elsif ($csec) {
- &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra);
} else {
- &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra);
}
} elsif ($parmlev eq 'map') {
if ($uname) {
- &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra);
} elsif ($cgroup) {
- &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly);
+ &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly,$extra);
} elsif ($csec) {
- &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra);
} else {
- &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra);
}
} else {
if ($uname) {
@@ -1152,32 +1398,32 @@ sub print_row {
}
}
- &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra);
- &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
- &print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
- &print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
- &print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra);
+ &print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra);
+ &print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra);
+ &print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra);
if ($csec) {
- &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
- &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
- &print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra);
+ &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra);
+ &print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra);
}
if ($cgroup) {
- &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly);
- &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly);
- &print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly);
+ &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly,$extra);
+ &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly,$extra);
+ &print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,$noeditgrp,$readonly,$extra);
}
if ($uname) {
if ($othergrp) {
$r->print($othergrp);
}
- &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
- &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
- &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly);
+ &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra);
+ &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra);
+ &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display,'',$readonly,$extra);
}
} # end of $parmlev if/else
@@ -1197,7 +1443,7 @@ sub print_row {
}
sub print_td {
- my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display,$noeditgrp,$readonly)=@_;
+ my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display,$noeditgrp,$readonly,$extra)=@_;
$r->print('');
my $nolink = 0;
@@ -1213,9 +1459,7 @@ sub print_td {
$nolink = 1;
}
} elsif ($mprefix =~ /availablestudent\&$/) {
- if ($which > 3) {
- $nolink = 1;
- }
+ $nolink = 1;
} elsif ($mprefix =~ /examcode\&$/) {
unless ($which == 2) {
$nolink = 1;
@@ -1227,7 +1471,7 @@ sub print_td {
} else {
$r->print(&plink($$typeoutpar[$which],
$$display{$value},$$outpar[$which],
- $mprefix."$which",'parmform.pres','psub'));
+ $mprefix."$which",'parmform.pres','psub',$extra));
}
$r->print(' | '."\n");
}
@@ -1398,7 +1642,7 @@ sub isdateparm {
sub is_specialstring {
my $type=shift;
- return (($type=~/^string_/) && (($type ne 'string_yesno')));
+ return (($type=~/^string_/) && ($type ne 'string_yesno'));
}
#
@@ -1535,6 +1779,7 @@ sub lookUpTableParameter {
'buttonshide' => 'hiding',
'turnoffeditor' => 'hiding',
'encrypturl' => 'hiding',
+ 'deeplink' => 'hiding',
'randomorder' => 'high_level_randomization',
'randompick' => 'high_level_randomization',
'available' => 'slots',
@@ -1811,7 +2056,7 @@ function group_or_section(caller) {
}
if (%grouphash) {
- $groups=&mt('Group:').' \n".&mt('Student/Employee ID').': '.$name{'id'}.'';
@@ -3147,21 +3392,39 @@ sub storedata {
if ($key =~ /^form\.([a-z]+)\_(.+)$/) {
my $cmd=$1;
my $thiskey=$2;
- next if ($cmd eq 'setipallow' || $cmd eq 'setipdeny');
+ next if ($cmd eq 'setipallow' || $cmd eq 'setipdeny' || $cmd eq 'setdeeplink');
my ($tuname,$tudom)=&extractuser($thiskey);
my $tkey=$thiskey;
if ($tuname) {
$tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./;
}
if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') {
- my ($data, $typeof, $text, $name, $valchk);
+ my ($data, $typeof, $text, $name, $valchk, $valmatch, $namematch);
if ($cmd eq 'set') {
$data=$env{$key};
+ $valmatch = '';
$valchk = $data;
$typeof=$env{'form.typeof_'.$thiskey};
$text = &mt('Saved modified parameter for');
if ($typeof eq 'string_questiontype') {
$name = 'type';
+ } elsif ($typeof eq 'string_deeplink') {
+ ($name) = ($typeof =~ /^string_(deeplink)$/);
+ my $stringmatch = &standard_string_matches($typeof);
+ if (ref($stringmatch) eq 'ARRAY') {
+ foreach my $item (@{$stringmatch}) {
+ if (ref($item) eq 'ARRAY') {
+ my ($regexpname,$pattern) = @{$item};
+ if ($pattern ne '') {
+ if ($data =~ /$pattern/) {
+ $valmatch = $regexpname;
+ $valchk = '';
+ last;
+ }
+ }
+ }
+ }
+ }
} elsif ($typeof eq 'string_lenient') {
$name = 'lenient';
} elsif ($typeof eq 'string_discussvote') {
@@ -3378,6 +3641,8 @@ sub listdata {
($thiskey=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);
my $section=&mt('All Students');
$readonly = $readonlyall;
+ my $userscope;
+ my $showval = $$resourcedata{$thiskey};
if ($middle=~/^\[(.*)\]/) {
my $issection=$1;
if ($issection=~/^useropt\:($match_username)\:($match_domain)/) {
@@ -3390,6 +3655,7 @@ sub listdata {
}
}
$section=&mt('User').": ".&Apache::loncommon::plainname($1,$2);
+ $userscope = 1;
} else {
if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) {
if (exists($grouphash{$issection})) {
@@ -3454,8 +3720,13 @@ sub listdata {
''.&mt($parmitem).
' | ');
unless ($readonly) {
+ my $disabled;
+ if (($name eq 'availablestudent') &&
+ (($showval eq '') || ($userscope))) {
+ $disabled = ' disabled="disabled"';
+ }
$r->print(' | ');
+ $thiskey.'"'.$disabled.' />');
}
$r->print('');
$foundkeys++;
@@ -3483,6 +3754,9 @@ sub listdata {
$r->print(&date_interval_selector($thiskey,$name,
$$resourcedata{$thiskey},$readonly));
} elsif ($thistype =~ m/^string/) {
+ if ($name eq 'availablestudent') {
+ $readonly = 1;
+ }
$r->print(&string_selector($thistype,$thiskey,
$$resourcedata{$thiskey},$name,$readonly));
} else {
@@ -3653,6 +3927,217 @@ sub string_ip_selector {
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 = ''."\n";
+ return $output;
+}
+
{
my %strings =
@@ -3685,8 +4170,28 @@ my %strings =
'string_ip'
=> [['_allowfrom_','Hostname(s), or IP(s) from which access is allowed'],
['_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 = (
+ 'string_ip'
+ => [['_allowfrom_','[^\!]+'],
+ ['_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 = (
+ type => 'string_questiontype',
+ lenient => 'string_lenient',
+ retrypartial => 'string_yesno',
+ discussvote => 'string_discussvote',
+ examcode => 'string_examcode',
+ acc => 'string_ip',
+ deeplink => 'string_deeplink',
+ );
+
sub standard_string_options {
my ($string_type) = @_;
if (ref($strings{$string_type}) eq 'ARRAY') {
@@ -3695,6 +4200,14 @@ sub standard_string_options {
return;
}
+sub standard_string_matches {
+ my ($string_type) = @_;
+ if (ref($stringmatches{$string_type}) eq 'ARRAY') {
+ return $stringmatches{$string_type};
+ }
+ return;
+}
+
sub string_selector {
my ($thistype, $thiskey, $showval, $name, $readonly) = @_;
@@ -3728,6 +4241,8 @@ sub string_selector {
if ($thistype eq 'string_ip') {
return &string_ip_selector($thiskey,$showval,$readonly);
+ } elsif ($thistype eq 'string_deeplink') {
+ return &string_deeplink_selector($thiskey,$showval,$readonly);
}
my ($result,$disabled);
@@ -3906,6 +4421,7 @@ sub newoverview {
&Apache::lonhtmlcommon::resize_scrollbox_js('params')."\n".
&showhide_js()."\n".
&done_proctor_js()."\n".
+ &deeplink_js()."\n".
'// ]]>
';
@@ -4099,6 +4615,7 @@ sub overview {
my $js = ''."\n";
my $readonly = 1;
|