$b } (keys(%lti))) {
+ if (($item =~ /^\d+$/) && (ref($lti{$item}) eq 'HASH')) {
+ $domltistr .= $item.':'.&escape(&escape($lti{$item}{'name'})).',';
+ }
+ }
+ $domltistr =~ s/,$//;
+ if ($domltistr) {
+ $extra = 'ltid_'.$domltistr;
+ }
+ }
+ my %courselti = &Apache::lonnet::get_course_lti($cnum,$cdom,'provider');
+ 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) {
if (@{$usersgroups} > 1) {
my ($coursereply,$grp_parm,$controlgrp);
($coursereply,$othergrp,$grp_parm,$controlgrp) =
- &print_usergroups($r,$$part{$which}.'.'.$$name{$which},
+ &check_other_groups($$part{$which}.'.'.$$name{$which},
$rid,$cgroup,$defbgone,$usersgroups,$result,$courseopt);
if ($coursereply && $result > 3) {
if (defined($controlgrp)) {
@@ -1037,32 +1479,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
@@ -1082,7 +1524,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;
@@ -1091,10 +1533,14 @@ sub print_td {
} else {
if ($which == 11 || $which == 12) {
$nolink = 1;
- } elsif ($mprefix =~ /availablestudent\&$/) {
- if ($which > 3) {
+ } elsif (($env{'request.course.sec'} ne '') && ($which > 9)) {
+ $nolink = 1;
+ } elsif ($which == 4 || $which == 5 || $which == 6) {
+ if ($noeditgrp) {
$nolink = 1;
}
+ } elsif ($mprefix =~ /availablestudent\&$/) {
+ $nolink = 1;
} elsif ($mprefix =~ /examcode\&$/) {
unless ($which == 2) {
$nolink = 1;
@@ -1106,13 +1552,13 @@ 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");
}
-sub print_usergroups {
- my ($r,$what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_;
+sub check_other_groups {
+ my ($what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_;
my $courseid = $env{'request.course.id'};
my $output;
my $symb = &symbcache($rid);
@@ -1127,7 +1573,6 @@ sub print_usergroups {
if (($coursereply) && ($cgroup ne $resultgroup)) {
if ($result > 3) {
$bgcolor = '#AAFFAA';
- $grp_parm = &valout($coursereply,$resulttype);
}
$grp_parm = &valout($coursereply,$resulttype);
$output = '';
@@ -1195,23 +1640,27 @@ sub extractResourceInformation {
my $srcf=$resource->src();
$srcf=~/\.(\w+)$/;
$$typep{$id}=$1;
+ my $toolsymb;
+ if ($srcf =~ /ext\.tool$/) {
+ $toolsymb = $resource->symb();
+ }
$$keyp{$id}='';
$$uris{$id}=$srcf;
- foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) {
+ foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys',$toolsymb))) {
next if ($key!~/^parameter_/);
# Hidden parameters
- next if (&Apache::lonnet::metadata($srcf,$key.'.hidden') eq 'parm');
+ next if (&Apache::lonnet::metadata($srcf,$key.'.hidden',$toolsymb) eq 'parm');
#
# allparms is a hash of parameter names
#
- my $name=&Apache::lonnet::metadata($srcf,$key.'.name');
+ my $name=&Apache::lonnet::metadata($srcf,$key.'.name',$toolsymb);
if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) {
my ($display,$parmdis);
$display = &standard_parameter_names($name);
if ($display eq '') {
- $display= &Apache::lonnet::metadata($srcf,$key.'.display');
+ $display= &Apache::lonnet::metadata($srcf,$key.'.display',$toolsymb);
$parmdis = $display;
$parmdis =~ s/\s*\[Part.*$//g;
} else {
@@ -1220,14 +1669,14 @@ sub extractResourceInformation {
$$allparms{$name}=$parmdis;
if (ref($defkeytype)) {
$$defkeytype{$name}=
- &Apache::lonnet::metadata($srcf,$key.'.type');
+ &Apache::lonnet::metadata($srcf,$key.'.type',$toolsymb);
}
}
#
# allparts is a hash of all parts
#
- my $part= &Apache::lonnet::metadata($srcf,$key.'.part');
+ my $part= &Apache::lonnet::metadata($srcf,$key.'.part',$toolsymb);
$$allparts{$part} = &mt('Part: [_1]',$part);
#
# Remember all keys going with this resource
@@ -1273,14 +1722,21 @@ sub isdateparm {
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'));
+}
+
#
# parmmenu displays a list of the selected parameters.
# It also offers a link to show/hide the complete parameter list
# from which you can select all desired parameters.
#
sub parmmenu {
- my ($r,$allparms,$pscat,$keyorder)=@_;
- my $tempkey;
+ my ($r)=@_;
$r->print(<
// print(' ');
- &shortCuts($r,$allparms,$pscat,$keyorder);
+ &shortCuts($r);
$r->print(' ');
}
# return a hash
@@ -1408,6 +1864,7 @@ sub lookUpTableParameter {
'buttonshide' => 'hiding',
'turnoffeditor' => 'hiding',
'encrypturl' => 'hiding',
+ 'deeplink' => 'hiding',
'randomorder' => 'high_level_randomization',
'randompick' => 'high_level_randomization',
'available' => 'slots',
@@ -1423,8 +1880,9 @@ sub lookUpTableParameter {
'lenient' => 'grading',
'retrypartial' => 'tries',
'discussvote' => 'misc',
+ 'texdisplay' => 'misc',
'examcode' => 'high_level_randomization',
- );
+ );
}
sub whatIsMyCategory {
@@ -1506,6 +1964,7 @@ sub parmboxes {
.&mt($categories{$key})
.''."\n");
foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) {
+ next if ($tempkey eq '');
$r->print(''
.' print(
@@ -1584,21 +2043,60 @@ sub partmenu {
}
sub usermenu {
- my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,$usersgroups)=@_;
+ my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,$usersgroups,$pssymb)=@_;
my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '.
- &Apache::loncommon::selectstudent_link('parmform','uname','udom');
- my $selscript=&Apache::loncommon::studentbrowser_javascript();
+ &Apache::loncommon::selectstudent_link('parmform','uname','udom','condition').
+ &Apache::lonhtmlcommon::scripttag(< '.
+ $stuonly.' '.
+ ' '.
+ &mt('any role').' ';
my $sections='';
my %sectionhash = &Apache::loncommon::get_sections();
my $groups;
- my %grouphash = &Apache::longroup::coursegroups();
+ my %grouphash;
+ if (($pssymb) || &Apache::lonnet::allowed('mdg',$env{'request.course.id'})) {
+ %grouphash = &Apache::longroup::coursegroups();
+ } elsif ($env{'request.course.groups'} ne '') {
+ map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'});
+ }
my $g_s_header='';
my $g_s_footer='';
- if (%sectionhash) {
+ my $currsec = $env{'request.course.sec'};
+ if ($currsec) {
+ $sections=&mt('Section:').' '.$currsec;
+ if (%grouphash) {
+ $sections .= ';'.(' ' x2);
+ }
+ } elsif (%sectionhash && $currsec eq '') {
$sections=&mt('Section:').' ';
}
- if (%sectionhash && %grouphash && $parmlev ne 'full') {
+ if (%sectionhash && %grouphash && $parmlev ne 'full' && $currsec eq '') {
$sections .= ' '.&mt('or').' ';
$sections .= qq|
|;
- } else {
+ } elsif ($currsec eq '') {
$sections .= qq|
@@ -2285,7 +2938,7 @@ ENDPARMSELSCRIPT
$r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel'));
&levelmenu($r,\%alllevs,$parmlev);
$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_title(&mt('Select Parts to View')));
&partmenu($r,\%allparts,\@psprt);
@@ -2294,12 +2947,12 @@ ENDPARMSELSCRIPT
# Step 2
$r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2'));
- &displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder,'parmmenuscroll');
+ &displaymenu($r,\%allparms,\@pscat,\%keyorder,'parmmenuscroll');
# Step 3
$r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3'));
$r->print(&Apache::lonhtmlcommon::start_pick_box());
- &usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups);
+ &usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups,$pssymb);
$r->print(&Apache::lonhtmlcommon::row_closure(1));
$r->print(&Apache::lonhtmlcommon::end_pick_box());
@@ -2338,7 +2991,7 @@ ENDPARMSELSCRIPT
($env{'form.psprt'}?' checked="checked"':'').' />'.
&mt('Show all parts').
' ');
- &usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups);
+ &usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups,$pssymb);
$r->print(&Apache::lonhtmlcommon::row_closure(1));
$r->print(&Apache::lonhtmlcommon::end_pick_box());
$r->print(''
@@ -2371,6 +3024,7 @@ ENDPARMSELSCRIPT
if ($parm_permission->{'edit'}) {
undef($readonly);
}
+ $r->print('
');
if ($parmlev eq 'full') {
#
@@ -2490,20 +3144,24 @@ ENDTABLEHEADFOUR
my %type= ();
my %default=();
my $uri=&Apache::lonnet::declutter($uris{$rid});
+ my $toolsymb;
+ if ($uri =~ /ext\.tool$/) {
+ $toolsymb = $symbp{$rid};
+ }
my $filter=$env{'form.filter'};
foreach (&keysplit($keyp{$rid})) {
my $tempkeyp = $_;
if (grep $_ eq $tempkeyp, @catmarker) {
- my $parmname=&Apache::lonnet::metadata($uri,$_.'.name');
+ my $parmname=&Apache::lonnet::metadata($uri,$_.'.name',$toolsymb);
# We may only want certain parameters listed
if ($filter) {
unless ($filter=~/\Q$parmname\E/) { next; }
}
$name{$_}=$parmname;
- $part{$_}=&Apache::lonnet::metadata($uri,$_.'.part');
+ $part{$_}=&Apache::lonnet::metadata($uri,$_.'.part',$toolsymb);
- my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display');
+ my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display',$toolsymb);
if ($allparms{$name{$_}} ne '') {
my $identifier;
if ($parmdis =~ /(\s*\[Part.*)$/) {
@@ -2515,9 +3173,9 @@ ENDTABLEHEADFOUR
}
unless ($display{$_}) { $display{$_}=''; }
$display{$_}.=' ('.$name{$_}.')';
- $default{$_}=&Apache::lonnet::metadata($uri,$_);
- $type{$_}=&Apache::lonnet::metadata($uri,$_.'.type');
- $thistitle=&Apache::lonnet::metadata($uri,$_.'.title');
+ $default{$_}=&Apache::lonnet::metadata($uri,$_,$toolsymb);
+ $type{$_}=&Apache::lonnet::metadata($uri,$_.'.type',$toolsymb);
+ $thistitle=&Apache::lonnet::metadata($uri,$_.'.title',$toolsymb);
}
}
my $totalparms=scalar keys %name;
@@ -2580,7 +3238,7 @@ ENDTABLEHEADFOUR
#-------------------------------------------- for each map, gather information
my $mapid;
- foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys %maplist) {
+ foreach $mapid (sort { $a <=> $b } keys(%maplist)) {
my $maptitle = $maplist{$mapid};
#----------------------- loop through ids and get all parameter types for map
@@ -2602,6 +3260,10 @@ ENDTABLEHEADFOUR
if ($map eq $mapid) {
my $uri=&Apache::lonnet::declutter($uris{$rid});
+ my $toolsymb;
+ if ($uri =~ /ext\.tool$/) {
+ $toolsymb = $symbp{$rid};
+ }
# $r->print("Keys: $keyp{$rid} \n");
#--------------------------------------------------------------------
@@ -2618,8 +3280,8 @@ ENDTABLEHEADFOUR
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
$part{$tempkeyp}="0";
- $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');
- my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
+ $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name',$toolsymb);
+ my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display',$toolsymb);
if ($allparms{$name{$tempkeyp}} ne '') {
my $identifier;
if ($parmdis =~ /(\s*\[Part.*)$/) {
@@ -2632,8 +3294,8 @@ ENDTABLEHEADFOUR
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
$display{$tempkeyp} =~ s/_\w+_/_0_/;
- $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp);
- $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type');
+ $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp,$toolsymb);
+ $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type',$toolsymb);
}
} # end loop through keys
}
@@ -2707,6 +3369,10 @@ ENDTABLEHEADFOUR
my $rid = $_;
my $uri=&Apache::lonnet::declutter($uris{$rid});
+ my $toolsymb;
+ if ($uri =~ /ext\.tool$/) {
+ $toolsymb = $symbp{$rid};
+ }
#--------------------------------------------------------------------
# @catmarker contains list of all possible parameters including part #s
@@ -2721,8 +3387,8 @@ ENDTABLEHEADFOUR
$tempkeyp =~ s/_\w+_/_0_/;
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
$part{$tempkeyp}="0";
- $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');
- my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
+ $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name',$toolsymb);
+ my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display',$toolsymb);
if ($allparms{$name{$tempkeyp}} ne '') {
my $identifier;
if ($parmdis =~ /(\s*\[Part.*)$/) {
@@ -2735,8 +3401,8 @@ ENDTABLEHEADFOUR
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
$display{$tempkeyp} =~ s/_\w+_/_0_/;
- $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp);
- $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type');
+ $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp,$toolsymb);
+ $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type',$toolsymb);
}
} # end loop through keys
} # end loop through ids
@@ -2779,6 +3445,7 @@ ENDMAPONE
.''
);
} # end of $parmlev eq general
+ $r->print('
');
}
$r->print('');
$r->print(&Apache::loncommon::end_page());
@@ -2860,20 +3527,39 @@ sub storedata {
if ($key =~ /^form\.([a-z]+)\_(.+)$/) {
my $cmd=$1;
my $thiskey=$2;
+ 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') {
@@ -2887,6 +3573,8 @@ sub storedata {
if ($thiskey =~ /\.retrypartial$/) {
$name = 'retrypartial';
}
+ } elsif ($typeof eq 'string_tex') {
+ $name = 'texdisplay';
}
} elsif ($cmd eq 'datepointer') {
$data=&Apache::lonhtmlcommon::get_date_from_form($env{$key});
@@ -3018,7 +3706,7 @@ sub parse_listdata_key {
}
sub listdata {
- my ($r,$resourcedata,$listdata,$sortorder,$caller,$classlist,$readonly)=@_;
+ my ($r,$resourcedata,$listdata,$sortorder,$caller,$classlist,$readonly,$parmlev)=@_;
# Start list output
my $oldsection='';
@@ -3028,6 +3716,17 @@ sub listdata {
$tableopen=0;
my $foundkeys=0;
my %keyorder=&standardkeyorder();
+ my $readonlyall = $readonly;
+
+ my ($secidx,%grouphash);
+ if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) {
+ $secidx = &Apache::loncoursedata::CL_SECTION();
+ if (&Apache::lonnet::allowed('mdg',$env{'request.course.id'})) {
+ %grouphash = &Apache::longroup::coursegroups();
+ } elsif ($env{'request.course.groups'} ne '') {
+ map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'});
+ }
+ }
foreach my $thiskey (sort {
my ($astudent,$ares,$apart,$aparm) = &parse_listdata_key($a,$listdata);
@@ -3071,29 +3770,55 @@ sub listdata {
} keys %{$listdata}) {
if ($$listdata{$thiskey.'.type'}) {
- my $thistype=$$listdata{$thiskey.'.type'};
- if ($$resourcedata{$thiskey.'.type'}) {
- $thistype=$$resourcedata{$thiskey.'.type'};
+ my $thistype=$$listdata{$thiskey.'.type'};
+ if ($$resourcedata{$thiskey.'.type'}) {
+ $thistype=$$resourcedata{$thiskey.'.type'};
}
my ($middle,$part,$name)=
($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)/) {
- $section=&mt('User').": ".&Apache::loncommon::plainname($1,$2);
- } else {
- $section=&mt('Group/Section').': '.$issection;
- }
- $middle=~s/^\[(.*)\]//;
+ my $issection=$1;
+ if ($issection=~/^useropt\:($match_username)\:($match_domain)/) {
+ my ($stuname,$studom) = ($1,$2);
+ if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) {
+ if (ref($classlist) eq 'HASH') {
+ if (ref($classlist->{$stuname.':'.$studom}) eq 'ARRAY') {
+ next unless ($classlist->{$stuname.':'.$studom}->[$secidx] eq $env{'request.course.sec'});
+ }
+ }
+ }
+ $section=&mt('User').": ".&Apache::loncommon::plainname($1,$2);
+ $userscope = 1;
+ } else {
+ if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) {
+ if (exists($grouphash{$issection})) {
+ $section=&mt('Group').': '.$issection;
+ } elsif ($issection eq $env{'request.course.sec'}) {
+ $section = &mt('Section').': '.$issection;
+ } else {
+ next;
+ }
+ } else {
+ $section=&mt('Group/Section').': '.$issection;
+ }
+ }
+ $middle=~s/^\[(.*)\]//;
+ } elsif (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) {
+ $readonly = 1;
}
$middle=~s/\.+$//;
$middle=~s/^\.+//;
my $realm=''.&mt('All Resources').' ';
+
if ($middle=~/^(.+)\_\_\_\(all\)$/) {
$realm=''.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' ('.$1.') ';
} elsif ($middle) {
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle);
+ next if (($url =~ /\.(page|sequence)$/) && ($parmlev eq 'full') && ($caller eq 'newoverview'));
$realm=''.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' ('.$url.' in '.$map.' id: '.$id.') ';
}
if ($sortorder eq 'realmstudent') {
@@ -3133,8 +3858,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++;
@@ -3159,9 +3889,12 @@ sub listdata {
);
}
} elsif ($thistype eq 'date_interval') {
- $r->print(&date_interval_selector($thiskey,
+ $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 {
@@ -3179,8 +3912,9 @@ sub listdata {
sub date_interval_selector {
- my ($thiskey, $showval, $readonly) = @_;
- my $result;
+ my ($thiskey, $pname, $showval, $readonly) = @_;
+ my ($result,%skipval);
+ my $currval = $showval;
foreach my $which (['days', 86400, 31],
['hours', 3600, 23],
['minutes', 60, 59],
@@ -3190,10 +3924,62 @@ sub date_interval_selector {
$showval %= $factor;
my %select = ((map {$_ => $_} (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,
\%select,'',$readonly);
$result .= ' '.&mt($name);
}
+ if ($pname eq 'interval') {
+ unless ($skipval{'done'}) {
+ my $checkedon = '';
+ my $checkedoff = '';
+ my $checkedproc = '';
+ my $currproctorkey = '';
+ my $currprocdisplay = 'hidden';
+ my $currdonetext = &mt('Done');
+ my $checkedoff = ' checked="checked"';
+ if ($currval =~ /^(?:\d+)_done$/) {
+ $checkedon = ' checked="checked"';
+ } elsif ($currval =~ /^(?:\d+)_done\:([^\:]+)\:$/) {
+ $currdonetext = $1;
+ $checkedon = ' checked="checked"';
+ } elsif ($currval =~ /^(?:\d+)_done_proctor_(.+)$/) {
+ $currproctorkey = $1;
+ $checkedproc = ' checked="checked"';
+ $currprocdisplay = 'text';
+ } elsif ($currval =~ /^(?:\d+)_done\:([^\:]+)\:_proctor_(.+)$/) {
+ $currdonetext = $1;
+ $currproctorkey = $2;
+ $checkedproc = ' checked="checked"';
+ $currprocdisplay = 'text';
+ } elsif ($currval ne '') {
+ $checkedoff = ' checked="checked"';
+ } else {
+ $currdonetext = '';
+ }
+ my $onclick = ' onclick="toggleSecret(this.form,'."'done_','$thiskey'".');"';
+ my $disabled;
+ if ($readonly) {
+ $disabled = ' disabled="disabled"';
+ }
+ $result .= ''.&mt('Include "done" button').
+ ' '.
+ &mt('No').' '.(' 'x2).
+ ' '.
+ &mt('Yes').' '.(' 'x2).
+ ' '.
+ &mt('Yes, with proctor key').' '.
+ ' &').'"'.$disabled.' /> '.
+ ''.&mt('Button text').': '.
+ ' &').'"'.$disabled.' /> ';
+ }
+ }
unless ($readonly) {
$result .= ' ';
}
@@ -3204,15 +3990,36 @@ sub date_interval_selector {
sub get_date_interval_from_form {
my ($key) = @_;
my $seconds = 0;
+ my $numnotnull = 0;
foreach my $which (['days', 86400],
['hours', 3600],
['minutes', 60],
['seconds', 1]) {
my ($name, $factor) = @{ $which };
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$/) &&
+ (($env{'form.done_'.$key} eq '_done') || ($env{'form.done_'.$key} eq '_done_proctor'))) {
+ if ($env{'form.done_'.$key.'_buttontext'}) {
+ $env{'form.done_'.$key.'_buttontext'} =~ s/\://g;
+ $seconds .= '_done:'.$env{'form.done_'.$key.'_buttontext'}.':';
+ if ($env{'form.done_'.$key} eq '_done_proctor') {
+ $seconds .= '_proctor';
+ }
+ } else {
+ $seconds .= $env{'form.done_'.$key};
+ }
+ if (($env{'form.done_'.$key} eq '_done_proctor') &&
+ ($env{'form.done_'.$key.'_proctorkey'})) {
+ $seconds .= '_'.$env{'form.done_'.$key.'_proctorkey'};
+ }
}
+ return if (!$numnotnull);
return $seconds;
}
@@ -3226,6 +4033,320 @@ sub default_selector {
return ' ';
}
+sub string_ip_selector {
+ my ($thiskey, $showval, $readonly) = @_;
+ my %access = (
+ allow => [],
+ deny => [],
+ );
+ if ($showval ne '') {
+ my @current;
+ if ($showval =~ /,/) {
+ @current = split(/,/,$showval);
+ } else {
+ @current = ($showval);
+ }
+ foreach my $item (@current) {
+ if ($item =~ /^\!([\[\]a-zA-Z\.\d\*\-]+)$/) {
+ push(@{$access{'deny'}},$1);
+ } elsif ($item =~ /^([\[\]a-zA-Z\.\d\*\-]+)$/) {
+ push(@{$access{'allow'}},$item);
+ }
+ }
+ }
+ if (!@{$access{'allow'}}) {
+ @{$access{'allow'}} = ('');
+ }
+ if (!@{$access{'deny'}}) {
+ @{$access{'deny'}} = ('');
+ }
+ my ($disabled,$addmore);
+ if ($readonly) {
+ $disabled=' disabled="disabled"';
+ } else {
+ $addmore = "\n".''.&mt('Add more').' ';
+ }
+ my $output = '
+'.&mt('Allow from').' '.&mt('Deny from').' ';
+ foreach my $acctype ('allow','deny') {
+ $output .= '
+
+
+
'."\n";
+ my $num = 0;
+ foreach my $curr (@{$access{$acctype}}) {
+ $output .= '
'."\n";
+ $num ++;
+ }
+ $output .= '
+
'.$addmore.'
+
+ ';
+ }
+ $output .= '
+
+
'."\n";
+ return $output;
+}
+
+sub string_deeplink_selector {
+ my ($thiskey, $showval, $readonly) = @_;
+ my (@tables,%values,@current,%titles,%options,%optiontext,%defaults,
+ %selectnull,%domlti,%crslti,@possmenus,%components);
+ @tables = ('upper','lower');
+ %components = (
+ upper => ['state','others','listing','scope'],
+ lower => ['protect','menus','target','exit'],
+ );
+ %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',
+ target => 'Embedded?',
+ exit => 'Exit Tool Button?',
+ );
+ %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'],
+ target => ['_self','_top'],
+ exit => ['no','yes','url'],
+ );
+ %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',
+ _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 (
+ 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+)$/);
+ ($values{'target'}) = ($current[6] =~ /^(_self|_top)$/);
+ ($values{'exit'}) = ($current[7] =~ /^((?:(?:yes|url)(?:|\:[^:;"',]+))|no)$/);
+ } else {
+ $defaults{'state'} = 'off',
+ $defaults{'others'} = 'unhide',
+ $defaults{'listing'} = 'full';
+ $defaults{'scope'} = 'res';
+ $defaults{'protect'} = 'none';
+ $defaults{'menus'} = '0';
+ $defaults{'target'} = '_top';
+ $defaults{'exit'} = 'yes';
+ }
+ 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'},
+ 'provider');
+ 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'},
+ 'linkprot');
+ foreach my $item (keys(%lti)) {
+ if (($item =~ /^\d+$/) && (ref($lti{$item}) eq 'HASH')) {
+ $domlti{$item} = $lti{$item}{'name'};
+ }
+ }
+ 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 = ' ';
+ foreach my $table ('upper','lower') {
+ next unless (ref($components{$table}) eq 'ARRAY');
+ $output .= ''."\n";
+ if ($table eq 'upper') {
+ $output .= ' ';
+ }
+ }
+ return $output;
+}
+
+{
+
my %strings =
(
'string_yesno'
@@ -3253,8 +4374,35 @@ my %strings =
=> [['yes','Yes'],
['notended','Yes, unless discussion ended'],
['no','No']],
+ '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, shown menu items, embedding, and exit link']],
+ 'string_tex'
+ => [['tth', 'tth (TeX to HTML)'],
+ ['mathjax', 'MathJax']],
);
+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+|)\,_(self|top),(yes|url|no)(|:[^:;\'",]+)$']],
+ );
+
+my %stringtypes = (
+ type => 'string_questiontype',
+ lenient => 'string_lenient',
+ retrypartial => 'string_yesno',
+ discussvote => 'string_discussvote',
+ examcode => 'string_examcode',
+ acc => 'string_ip',
+ deeplink => 'string_deeplink',
+ texdisplay => 'string_tex',
+ );
+
sub standard_string_options {
my ($string_type) = @_;
if (ref($strings{$string_type}) eq 'ARRAY') {
@@ -3263,6 +4411,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) = @_;
@@ -3293,6 +4449,12 @@ 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);
@@ -3347,14 +4509,76 @@ sub string_selector {
return $result;
}
+sub oldversion_warning {
+ my ($name,$value,$chostname,$cmajor,$cminor,$needsrelease) = @_;
+ my $desc;
+ my %stringtypes = (
+ type => 'string_questiontype',
+ lenient => 'string_lenient',
+ retrypartial => 'string_yesno',
+ discussvote => 'string_discussvote',
+ examcode => 'string_examcode',
+ );
+ if (exists($stringtypes{$name})) {
+ if ($name eq 'examcode') {
+ $desc = $value;
+ } elsif (ref($strings{$stringtypes{$name}}) eq 'ARRAY') {
+ foreach my $possibilities (@{ $strings{$stringtypes{$name}} }) {
+ next unless (ref($possibilities) eq 'ARRAY');
+ my ($parmval, $description) = @{ $possibilities };
+ if ($parmval eq $value) {
+ $desc = $description;
+ last;
+ }
+ }
+ }
+ } elsif (($name eq 'printstartdate') || ($name eq 'printenddate')) {
+ my $now = time;
+ if ($value =~ /^\d+$/) {
+ if ($name eq 'printstartdate') {
+ if ($value > $now) {
+ $desc = &Apache::lonlocal::locallocaltime($value);
+ }
+ } elsif ($name eq 'printenddate') {
+ if ($value < $now) {
+ $desc = &Apache::lonlocal::locallocaltime($value);
+ }
+ }
+ }
+ }
+ my $standard_name = &standard_parameter_names($name);
+ return ''.
+ &mt('[_1] was [_2]not[_3] set to [_4].',
+ $standard_name,'',' ','"'.$desc.'"').' '.
+ &mt('LON-CAPA version ([_1]) installed on home server ([_2]) does not meet version requirements ([_3] or newer).',
+ $cmajor.'.'.$cminor,$chostname,
+ $needsrelease).
+ '
';
+}
+
+}
+
#
# Shift all start and end dates by $shift
#
sub dateshift {
- my ($shift)=@_;
+ my ($shift,$numchanges)=@_;
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
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);
# ugly retro fix for broken version of types
foreach my $key (keys %data) {
@@ -3369,7 +4593,11 @@ sub dateshift {
# go through all parameters and look for dates
foreach my $key (keys %data) {
if ($data{$key.'.type'}=~/^date_(start|end)$/) {
+ if ($sec ne '') {
+ next unless ($key =~ /^$env{'request.course.id'}\.\[$secgrpregex\]\./);
+ }
my $newdate=$data{$key}+$shift;
+ $$numchanges ++;
$storecontent{$key}=$newdate;
}
}
@@ -3403,6 +4631,10 @@ sub newoverview {
'.
&Apache::lonhtmlcommon::resize_scrollbox_js('params')."\n".
&showhide_js()."\n".
+ &validateparms_js()."\n".
+ &ipacc_boxes_js()."\n".
+ &done_proctor_js()."\n".
+ &deeplink_js()."\n".
'// ]]>
';
@@ -3411,7 +4643,7 @@ sub newoverview {
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview');
$r->print($start_page.$breadcrumbs);
$r->print(<
+ ');
+ $r->print('');
+ if ($sectionselector) {
+ $r->print(''.$sectionselector.' ');
+ }
+ if ($groupselector) {
+ $r->print(''.$groupselector.' ');
+ }
+ $r->print('');
$r->print(&Apache::lonhtmlcommon::row_closure(1));
$r->print(&Apache::lonhtmlcommon::end_pick_box());
$r->print('');
@@ -3530,7 +4773,7 @@ ENDOVER
# List data
- &listdata($r,$resourcedata,$listdata,$sortorder,'newoverview',undef,$readonly);
+ &listdata($r,$resourcedata,$listdata,$sortorder,'newoverview',undef,$readonly,$parmlev);
}
$r->print(&tableend());
unless ($readonly) {
@@ -3579,16 +4822,25 @@ sub overview {
my ($r,$parm_permission) = @_;
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
+ my $js = ''."\n";
my $readonly = 1;
if ($parm_permission->{'edit'}) {
undef($readonly);
}
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
text=>"Overview Mode"});
- my $start_page=&Apache::loncommon::start_page('Modify Parameters');
+ my $start_page=&Apache::loncommon::start_page('Modify Parameters',$js);
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview');
$r->print($start_page.$breadcrumbs);
- $r->print('');
+ ' ');
$r->print(&Apache::loncommon::end_page());
}
@@ -3742,20 +5004,54 @@ sub date_shift_two {
my ($r) = @_;
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $sec = $env{'request.course.sec'};
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'},
text=>"Shifting Dates"});
my $start_page=&Apache::loncommon::start_page('Shift Dates');
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift');
$r->print($start_page.$breadcrumbs);
my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted');
- $r->print(''.&mt('Shift Dates').' '.
- ''.&mt('Shifting all dates such that [_1] becomes [_2]',
- &Apache::lonlocal::locallocaltime($env{'form.timebase'}),
- &Apache::lonlocal::locallocaltime($timeshifted)).'
');
+ $r->print(''.&mt('Shift Dates').' ');
+ if ($sec ne '') {
+ my @groups;
+ if ($env{'request.course.groups'} ne '') {
+ @groups = split(/:/,$env{'request.course.groups'});
+ }
+ if (@groups) {
+ $r->print(''.
+ &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)).
+ '
');
+ } else {
+ $r->print(''.
+ &mt("Shift dates set just for your section, such that [_1] becomes [_2]",
+ &Apache::lonlocal::locallocaltime($env{'form.timebase'}),
+ &Apache::lonlocal::locallocaltime($timeshifted)).
+ '
');
+ }
+ } else {
+ $r->print(''.&mt('Shifting all dates such that [_1] becomes [_2]',
+ &Apache::lonlocal::locallocaltime($env{'form.timebase'}),
+ &Apache::lonlocal::locallocaltime($timeshifted)).
+ '
');
+ }
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(
- &Apache::lonhtmlcommon::confirm_success(&mt('Done')).
' '.
&Apache::lonhtmlcommon::actionbox(
[''.&mt('Content and Problem Settings').' ']));
@@ -3774,8 +5070,7 @@ sub parse_key {
$data{'scope_type'} = 'user';
$data{'scope'} = [$1,$2];
} else {
- #FIXME check for group scope
- $data{'scope_type'} = 'section';
+ $data{'scope_type'} = 'secgroup';
}
$middle=~s/^\[(.*)\]//;
}
@@ -4089,7 +5384,7 @@ sub continue {
my $output;
$output .= '');
}
- $r->print('Or you may enter a new metadata field name.');
}
@@ -4159,6 +5465,11 @@ sub setrestrictmeta {
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
my $key_base = $env{'course.'.$env{'request.course.id'}.'.'};
my $save_field = '';
+ my %lt = &Apache::lonlocal::texthash(
+ addm => 'Add Metadata Field',
+ ordm => 'Order Metadata Fields',
+ save => 'Save',
+ );
if ($env{'form.restrictmeta'}) {
foreach my $field (sort(keys(%env))) {
if ($field=~m/^form.(.+)_(.+)$/) {
@@ -4197,28 +5508,25 @@ sub setrestrictmeta {
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio');
# Now get possible added metadata fields
my $added_metadata_fields = &get_added_meta_fieldnames($env{'request.course.id'});
- my $row_alt = 1;
$output .= &Apache::loncommon::start_data_table();
foreach my $field (sort(keys(%metadata_fields))) {
if ($field ne 'courserestricted') {
- $row_alt = $row_alt ? 0 : 1;
$output.= &output_row($r, $field, $metadata_fields{$field});
}
}
my $buttons = (<
+