--- loncom/interface/portfolio.pm 2012/04/16 19:31:57 1.234 +++ loncom/interface/portfolio.pm 2012/06/08 12:25:59 1.235 @@ -1,7 +1,7 @@ # The LearningOnline Network # portfolio browser # -# $Id: portfolio.pm,v 1.234 2012/04/16 19:31:57 raeburn Exp $ +# $Id: portfolio.pm,v 1.235 2012/06/08 12:25:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -122,6 +122,7 @@ END .'' .'' .'' + .'' .'' .'' .'' @@ -139,6 +140,7 @@ END .''.$groupitem .'' .'' + .'' .'' .'' .'' @@ -155,6 +157,7 @@ END 'selectfile' => $port_path, 'currentpath' => '/', 'mode' => $env{"form.mode"}, + 'symb' => $env{"form.symb"}, 'fieldname' => $env{"form.fieldname"}, 'continue' => $env{"form.continue"} ); @@ -168,6 +171,7 @@ END 'selectfile' => $tree[$i], 'currentpath' => $newCurrentPath, 'mode' => $env{"form.mode"}, + 'symb' => $env{"form.symb"}, 'fieldname' => $env{"form.fieldname"}, 'continue' => $env{"form.continue"} ); @@ -177,7 +181,7 @@ END $r->print(''); $r->print(&Apache::loncommon::help_open_topic('Portfolio ChangeDirectory')); &Apache::lonhtmlcommon::store_recent($namespace,$current_path,$current_path); - $r->print('
print('">'. &Apache::lonhtmlcommon::select_recent($namespace,'currentpath', 'this.form.submit();')); @@ -447,6 +451,7 @@ sub display_directory { 'selectfile' => $filename.'/', 'currentpath' => $current_path.$filename.'/', 'mode' => $env{"form.mode"}, + 'symb' => $env{"form.symb"}, 'fieldname' => $env{"form.fieldname"}, 'continue' => $env{"form.continue"} ); @@ -554,6 +559,7 @@ sub display_directory { $r->print(' +


@@ -641,6 +647,7 @@ sub done { 'showversions' => $env{'form.showversions'}, 'currentpath' => $env{'form.currentpath'}, 'fieldname' => $env{'form.fieldname'}, + 'symb' => $env{'form.symb'}, 'mode' => $env{'form.mode'} ); my $result = '

'.&make_anchor($url,\%anchor_fields,&mt($message)).'

'; @@ -2090,6 +2097,7 @@ sub hidden_elems { } return < + @@ -2451,6 +2459,7 @@ sub embedded_form_elems { my ($container) = @_; my $state = < + @@ -2467,7 +2476,7 @@ sub handler { &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['selectfile','currentpath','meta','lockinfo','currentfile','action', 'fieldname','mode','rename','continue','group','access','setnum', - 'cnum','cdom','type','setroles','showversions','ref']); + 'cnum','cdom','type','setroles','showversions','ref','symb']); my ($uname,$udom,$portfolio_root,$url,$caller,$title,$group,$grp_desc); if ($r->uri =~ m|^(/adm/)([^/]+)|) { $url = $1.$2; @@ -2570,12 +2579,42 @@ sub handler { } } $r->rflush(); + # Check if access to portfolio is blocked by one or more blocking events in courses. my ($blocked,$blocktext) = &Apache::loncommon::blocking_status('port',$uname,$udom); if ($blocked) { - $r->print($blocktext); - $r->print(&Apache::loncommon::end_page()); - return OK; + my $evade_block; + # If portfolio display is in a window popped up from a "Select Portfolio Files" + # link in a .task resource, check if access to the task included proctor validation + # of check-in to a slot limited by IP. + # If so, and the slot is between its open and close dates, override the block. + if ($env{'request.course.id'} && $env{'form.symb'}) { + (undef,undef,my $res) = &Apache::lonnet::decode_symb($env{'form.symb'}); + if ($res =~ /\.task$/i) { + my %history = + &Apache::lonnet::restore($env{'form.symb'},$env{'request.course.id'}, + $env{'user.domain'},$env{'user.name'}); + my $version = $history{'resource.0.version'}; + if ($history{'resource.'.$version.'.0.checkedin'}) { + if ($history{'resource.'.$version.'.0.checkedin.slot'}) { + my %slot = &Apache::lonnet::get_slot($history{'resource.'.$version.'.0.checkedin.slot'}); + if ($slot{'ip'}) { + if (&Apache::loncommon::check_ip_acc($slot{'ip'})) { + my $now = time; + if (($slot{'slottime'} < $now) && ($slot{'endtime'} > $now)) { + $evade_block = 1; + } + } + } + } + } + } + } + unless ($evade_block) { + $r->print($blocktext); + $r->print(&Apache::loncommon::end_page()); + return OK; + } } if (($env{'form.storeupl'}) & (!$env{'form.uploaddoc.filename'})){ $r->print('');