');
if ($parmlev eq 'full') {
#
@@ -3262,7 +3908,6 @@ ENDTABLEHEADFOUR
foreach my $rid (@ids) {
my ($inmapid)=($rid=~/\.(\d+)$/);
-
if ((!$pssymb &&
(($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid})))
||
@@ -3292,19 +3937,23 @@ 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 my $tempkeyp (&keysplit($keyp{$rid})) {
if (grep $_ eq $tempkeyp, @catmarker) {
- my $parmname=&Apache::lonnet::metadata($uri,$tempkeyp.'.name');
+ my $parmname=&Apache::lonnet::metadata($uri,$tempkeyp.'.name',$toolsymb);
# We may only want certain parameters listed
if ($filter) {
unless ($filter=~/\Q$parmname\E/) { next; }
}
$name{$tempkeyp}=$parmname;
- $part{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.part');
+ $part{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.part',$toolsymb);
- my $parmdis=&Apache::lonnet::metadata($uri,$tempkeyp.'.display');
+ my $parmdis=&Apache::lonnet::metadata($uri,$tempkeyp.'.display',$toolsymb);
if ($allparms{$name{$tempkeyp}} ne '') {
my $identifier;
if ($parmdis =~ /(\s*\[Part.*)$/) {
@@ -3316,15 +3965,20 @@ ENDTABLEHEADFOUR
}
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
- $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp);
- $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.type');
- $thistitle=&Apache::lonnet::metadata($uri,$tempkeyp.'.title');
+ $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp,$toolsymb);
+ $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.type',$toolsymb);
+ $thistitle=&Apache::lonnet::metadata($uri,$tempkeyp.'.title',$toolsymb);
}
}
my $totalparms=scalar(keys(%name));
if ($totalparms>0) {
my $firstrow=1;
my $title=&Apache::lonnet::gettitle($symbp{$rid});
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ my @recurseup;
+ if (ref($navmap) && $mapp{$rid}) {
+ @recurseup = $navmap->recurseup_maps($mapp{$rid});
+ }
$r->print('
'.
@@ -3356,7 +4010,9 @@ ENDTABLEHEADFOUR
&print_row($r,$item,\%part,\%name,\%symbp,$rid,\%default,
\%type,\%display,$defbgone,$defbgtwo,
$defbgthree,$parmlev,$uname,$udom,$csec,
- $cgroup,\@usersgroups,$noeditgrp,$readonly);
+ $cgroup,\@usersgroups,$noeditgrp,$readonly,
+ \@recurseup,\%maptitles,\%allmaps_inverted,
+ \$numreclinks);
}
}
}
@@ -3380,7 +4036,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
@@ -3402,6 +4058,11 @@ 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");
#--------------------------------------------------------------------
@@ -3417,8 +4078,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.*)$/) {
@@ -3431,8 +4092,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
}
@@ -3474,12 +4135,23 @@ ENDTABLEHEADFOUR
.&Apache::loncommon::end_data_table_header_row()
);
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ my @recurseup;
+ if (ref($navmap)) {
+ my $mapres = $navmap->getByMapPc($mapid);
+ if (ref($mapres)) {
+ @recurseup = $navmap->recurseup_maps($mapres->src());
+ }
+ }
+
+
foreach my $item (&keysinorder(\%name,\%keyorder)) {
$r->print(&Apache::loncommon::start_data_table_row());
&print_row($r,$item,\%part,\%name,\%symbp,$mapid,\%default,
\%type,\%display,$defbgone,$defbgtwo,$defbgthree,
$parmlev,$uname,$udom,$csec,$cgroup,'',$noeditgrp,
- $readonly);
+ $readonly,\@recurseup,\%maptitles,\%allmaps_inverted,
+ \$numreclinks);
}
$r->print(&Apache::loncommon::end_data_table().''
.''
@@ -3506,6 +4178,10 @@ ENDTABLEHEADFOUR
my $rid = $id;
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
@@ -3519,8 +4195,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.*)$/) {
@@ -3533,8 +4209,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
@@ -3577,8 +4253,28 @@ ENDMAPONE
.''
);
} # end of $parmlev eq general
+ $r->print('');
}
$r->print('');
+ if ($numreclinks) {
+ $r->print(<<"END");
+
+
+END
+ }
&endSettingsScreen($r);
$r->print(&Apache::loncommon::end_page());
} # end sub assessparms
@@ -3664,7 +4360,7 @@ sub readdata {
# Stores parameter data, using form parameters directly.
#
# Uses the following form parameters. The variable part in the names is a resourcedata key (except for a modification for user data).
-# set_* (except settext, setipallow, setipdeny) - set a parameter value
+# set_* (except settext, setipallow, setipdeny, setdeeplink) - set a parameter value
# del_* - remove a parameter
# datepointer_* - set a date parameter (value is key_* refering to a set of other form parameters)
# dateinterval_* - set a date interval parameter (value refers to more form parameters)
@@ -3697,7 +4393,7 @@ sub storedata {
my $cmd=$1;
my $thiskey=$2;
my ($altkey,$recursive,$tkey,$tkeyrec,$tkeynonrec);
- next if ($cmd eq 'rec' || $cmd eq 'settext' || $cmd eq 'setipallow' || $cmd eq 'setipdeny');
+ next if ($cmd eq 'rec' || $cmd eq 'settext' || $cmd eq 'setipallow' || $cmd eq 'setipdeny' || $cmd eq 'setdeeplink');
if ((($cmd eq 'set') || ($cmd eq 'datepointer') || ($cmd eq 'dateinterval') || ($cmd eq 'del')) &&
($thiskey =~ /(?:sequence|page)\Q___(all)\E/)) {
unless ($thiskey =~ /(encrypturl|hiddenresource)$/) {
@@ -3728,8 +4424,8 @@ sub storedata {
$text = &mt('Saved modified parameter for');
if ($typeof eq 'string_questiontype') {
$name = 'type';
- } elsif ($typeof eq 'string_lenient') {
- $name = 'lenient';
+ } elsif (($typeof eq 'string_lenient') || ($typeof eq 'string_deeplink')) {
+ ($name) = ($typeof =~ /^string_(lenient|deeplink)$/);
my $stringmatch = &standard_string_matches($typeof);
if (ref($stringmatch) eq 'ARRAY') {
foreach my $item (@{$stringmatch}) {
@@ -4095,9 +4791,12 @@ sub parse_listdata_key {
# @param {string} $caller - name of the calling sub (overview|newoverview)
# @param {hash reference} $classlist - from loncoursedata::get_classlist
# @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
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
@@ -4108,6 +4807,7 @@ 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')) {
@@ -4115,13 +4815,27 @@ sub listdata {
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'});
+ map { $grouphash{$_} = 1; } split(/:/,$env{'request.course.groups'});
}
}
foreach my $key (sort {
my ($astudent,$ares,$apart,$aparm) = &parse_listdata_key($a,$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
$aparm=$keyorder{'parameter_0_'.$aparm};
@@ -4131,7 +4845,21 @@ sub listdata {
if ($sortorder eq 'realmstudent') {
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) {
$result = ($astudent cmp $bstudent);
} elsif ($apart ne $bpart ) {
@@ -4141,7 +4869,21 @@ sub listdata {
if ($astudent ne $bstudent) {
$result = ($astudent cmp $bstudent);
} 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 ) {
$result = ($apart cmp $bpart);
}
@@ -4169,6 +4911,8 @@ sub listdata {
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;
@@ -4182,6 +4926,7 @@ sub listdata {
}
}
$section=&mt('User').": ".&Apache::loncommon::plainname($stuname,$studom);
+ $userscope = 1;
} else {
if (($env{'request.course.sec'} ne '') && ($caller eq 'overview')) {
if (exists($grouphash{$issection})) {
@@ -4218,6 +4963,12 @@ sub listdata {
}
if ($is_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')) {
if ($caller eq 'newoverview') {
my $altkey = $thiskey;
@@ -4234,9 +4985,10 @@ sub listdata {
$is_recursive = 1;
}
}
- $realm=''.$leveltitle.': '.&Apache::lonnet::gettitle($mapurl).' ('.$mapurl.') ';
+ $realm=''.$leveltitle.': '.$title.' ('.$mapurl.') ';
} 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: '.
@@ -4279,8 +5031,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++;
@@ -4308,6 +5065,9 @@ sub listdata {
$r->print(&date_interval_selector($thiskey,$name,
$showval,$readonly));
} elsif ($thistype =~ m/^string/) {
+ if ($name eq 'availablestudent') {
+ $readonly = 1;
+ }
$r->print(&string_selector($thistype,$thiskey,
$showval,$name,$readonly));
} else {
@@ -4350,13 +5110,17 @@ sub listdata {
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$/) &&
@@ -4375,6 +5139,7 @@ sub get_date_interval_from_form {
$seconds .= '_'.$env{'form.done_'.$key.'_proctorkey'};
}
}
+ return if (!$numnotnull);
return $seconds;
}
@@ -4460,6 +5225,257 @@ sub string_ip_selector {
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'});
+ 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;
+}
+
{ # block using some constants related to parameter types (overview mode)
@@ -4493,8 +5509,11 @@ my %strings =
['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'],
- );
+ ['_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']],
+ );
+
my %stringmatches = (
'string_lenient'
@@ -4502,6 +5521,8 @@ 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 = (
@@ -4511,6 +5532,7 @@ my %stringtypes = (
discussvote => 'string_discussvote',
examcode => 'string_examcode',
acc => 'string_ip',
+ deeplink => 'string_deeplink',
);
# Returns the possible values and titles for a given string type, or undef if there are none.
@@ -4570,6 +5592,7 @@ sub string_selector {
($thistype eq 'string_lenient') ||
($thistype eq 'string_discussvote') ||
($thistype eq 'string_ip') ||
+ ($thistype eq 'string_deeplink') ||
($name eq 'retrypartial')) {
my ($got_chostname,$chostname,$cmajor,$cminor);
foreach my $possibilities (@{ $strings{$thistype} }) {
@@ -4608,6 +5631,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);
@@ -4817,6 +5842,11 @@ 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);
@@ -4824,29 +5854,29 @@ sub date_interval_selector {
if ($name 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"';
- $checkedoff = '';
} elsif ($currval =~ /^(?:\d+)_done\:([^\:]+)\:$/) {
$currdonetext = $1;
$checkedon = ' checked="checked"';
- $checkedoff = '';
} elsif ($currval =~ /^(?:\d+)_done_proctor_(.+)$/) {
$currproctorkey = $1;
$checkedproc = ' checked="checked"';
- $checkedoff = '';
$currprocdisplay = 'text';
} elsif ($currval =~ /^(?:\d+)_done\:([^\:]+)\:_proctor_(.+)$/) {
$currdonetext = $1;
$currproctorkey = $2;
$checkedproc = ' checked="checked"';
- $checkedoff = '';
$currprocdisplay = 'text';
+ } elsif ($currval ne '') {
+ $checkedoff = ' checked="checked"';
+ } else {
+ $currdonetext = '';
}
my $onclick = ' onclick="toggleSecret(this.form,'."'done_','$thiskey'".');"';
my $disabled;
@@ -4863,7 +5893,8 @@ sub date_interval_selector {
' &').'"'.$disabled.' /> '.
''.&mt('Button text').': '.
- ' &').'"'.$disabled.' /> ';
+ ' &').'"'.$disabled.' />';
}
}
unless ($readonly) {
@@ -4963,9 +5994,22 @@ sub oldversion_warning {
# @param {integer} $shift - time to shift, in seconds
# @returns {string} - error name or 'ok'
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)) {
@@ -4980,7 +6024,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;
}
}
@@ -5022,6 +6070,7 @@ sub newoverview {
&validateparms_js()."\n".
&ipacc_boxes_js()."\n".
&done_proctor_js()."\n".
+ &deeplink_js()."\n".
'// ]]>
';
@@ -5086,7 +6135,7 @@ ENDOVER
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps,
\%mapp, \%symbp,\%maptitles,\%uris,
- \%keyorder,\%defkeytype);
+ \%keyorder,\%defkeytype,$pssymb);
if (grep {$_ eq 'all'} (@psprt)) {
@psprt = keys(%allparts);
@@ -5098,17 +6147,15 @@ ENDOVER
$r->print('');
$r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel'));
&levelmenu($r,\%alllevs,$parmlev);
- if ($parmlev ne 'general') {
- $r->print(&Apache::lonhtmlcommon::row_closure());
- &mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp);
- }
+ $r->print(&Apache::lonhtmlcommon::row_closure());
+ &mapmenu($r,\%allmaps,$pschp,\%maptitles,\%symbp,$parmlev);
$r->print(&Apache::lonhtmlcommon::row_closure(1));
$r->print(&Apache::lonhtmlcommon::end_pick_box());
$r->print('
');
$r->print('');
$r->print('
');
- &displaymenu($r,\%allparms,\@pscat,\%keyorder); # FIXME: wrong parameters, could make keysindisplayorderCategory crash because $keyorder is undefined
+ &displaymenu($r,\%allparms,\@pscat,\%keyorder);
$r->print(&Apache::lonhtmlcommon::start_pick_box());
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View')));
my $sectionselector = §ionmenu(\@selected_sections);
@@ -5139,7 +6186,7 @@ ENDOVER
$r->print('
');
my $sortorder=$env{'form.sortorder'};
unless ($sortorder) { $sortorder='realmstudent'; }
- &sortmenu($r,$sortorder);
+ &sortmenu($r,$sortorder,'newoverview');
$r->print('
');
$r->print('
');
@@ -5164,7 +6211,15 @@ ENDOVER
# 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());
unless ($readonly) {
@@ -5243,6 +6298,7 @@ sub overview {
&validateparms_js()."\n".
&ipacc_boxes_js()."\n".
&done_proctor_js()."\n".
+ &deeplink_js()."\n".
'// ]]>'."\n".
''."\n";
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
@@ -5270,7 +6326,7 @@ sub overview {
my $sortorder=$env{'form.sortorder'};
unless ($sortorder) { $sortorder='realmstudent'; }
- &sortmenu($r,$sortorder);
+ &sortmenu($r,$sortorder,'overview');
my $submitbutton = '
';
@@ -5354,10 +6410,8 @@ ENDOVER
$r->print(&mt('All users'));
} elsif ($data{'scope_type'} eq 'user') {
$r->print(&mt('User: [_1]',join(':',@{$data{'scope'}})));
- } elsif ($data{'scope_type'} eq 'section') {
- $r->print(&mt('Section: [_1]',$data{'scope'}));
- } elsif ($data{'scope_type'} eq 'group') {
- $r->print(&mt('Group: [_1]',$data{'scope'}));
+ } elsif ($data{'scope_type'} eq 'secgroup') {
+ $r->print(&mt('Group/Section: [_1]',$data{'scope'}));
}
$r->print('
');
if ($data{'realm_type'} eq 'all') {
@@ -5392,9 +6446,21 @@ sub date_shift_one {
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 $sec = $env{'request.course.sec'};
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'},
text=>"Shifting Dates"});
+ my $submit_text = &mt('Shift all dates accordingly');
+ if ($sec ne '') {
+ my @groups;
+ if ($env{'request.course.groups'} ne '') {
+ @groups = split(/:/,$env{'request.course.groups'});
+ }
+ if (@groups) {
+ $submit_text = &mt("Shift dates set just for your section/group(s), accordingly");
+ } else {
+ $submit_text = &mt("Shift dates set just for your section, accordingly");
+ }
+ }
my $start_page=&Apache::loncommon::start_page('Shift Dates');
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift');
$r->print($start_page.$breadcrumbs);
@@ -5410,7 +6476,7 @@ sub date_shift_one {
'
');
&endSettingsScreen($r);
$r->print(&Apache::loncommon::end_page());
}
@@ -5422,6 +6488,7 @@ 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'};
my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'},
text=>"Shifting Dates"});
@@ -5430,14 +6497,47 @@ sub date_shift_two {
$r->print($start_page.$breadcrumbs);
&startSettingsScreen($r,'parmset',$crstype);
my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted');
- $r->print('
'.&mt('Shifting all dates such that [_1] becomes [_2]',
- &Apache::lonlocal::locallocaltime($env{'form.timebase'}),
- &Apache::lonlocal::locallocaltime($timeshifted)).'
');
+ 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)).
+ '
'.
+ &mt("Shift dates set just for your section, such that [_1] becomes [_2]",
+ &Apache::lonlocal::locallocaltime($env{'form.timebase'}),
+ &Apache::lonlocal::locallocaltime($timeshifted)).
+ '
'.&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')).
'
']));
@@ -5464,8 +6564,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/^\[(.*)\]//;
}
@@ -5811,7 +6910,7 @@ sub continue {
my $output;
$output .= '
you may enter a new metadata field name.
');
}
- $r->print('');
&endSettingsScreen($r);
}
@@ -5893,6 +7003,11 @@ sub setrestrictmeta {
&startSettingsScreen($r,'parmset',$crstype);
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.(.+)_(.+)$/) {
@@ -5931,28 +7046,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});
+ $output.= &output_row($r,$field,$metadata_fields{$field});
}
}
my $buttons = (<