version 1.173, 2006/06/16 09:27:38
|
version 1.175, 2006/06/20 03:38:58
|
Line 83 sub proctor_check_auth {
|
Line 83 sub proctor_check_auth {
|
} |
} |
} |
} |
if ($authenticated) { |
if ($authenticated) { |
&create_new_version($type,$user,$domain,$slot_name); |
my $useslots = &Apache::lonnet::EXT("resource.0.useslots"); |
|
if ( $useslots eq 'map_map') { |
|
&checkin_resource($user,$domain,$slot_name); |
|
} else { |
|
&create_new_version($type,$user,$domain,$slot_name); |
|
} |
return 1; |
return 1; |
} |
} |
} |
} |
Line 91 sub proctor_check_auth {
|
Line 96 sub proctor_check_auth {
|
return 0; |
return 0; |
} |
} |
|
|
|
sub check_in { |
|
my ($type,$user,$domain,$slot_name) = @_; |
|
my $useslots = &Apache::lonnet::EXT("resource.0.useslots"); |
|
if ( $useslots eq 'map_map') { |
|
&check_in_sequence($user,$domain,$slot_name); |
|
} else { |
|
&create_new_version($type,$user,$domain,$slot_name); |
|
} |
|
return 1; |
|
} |
|
|
|
sub check_in_sequence { |
|
my ($user,$domain,$slot_name) = @_; |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
my ($symb) = &Apache::lonxml::whichuser(); |
|
my ($map) = &Apache::lonnet::decode_symb($symb); |
|
my @resources = |
|
$navmap->retrieveResources($map, sub { $_[0]->is_problem() },0,0); |
|
my %old_history = %Apache::lonhomework::history; |
|
my %old_results = %Apache::lonhomework::results; |
|
|
|
foreach my $res (@resources) { |
|
&Apache::lonxml::debug("doing ".$res->src); |
|
&Apache::structuretags::initialize_storage($res->symb); |
|
my $type = ($res->is_task()) ? 'Task' : 'problem'; |
|
&create_new_version($type,$user,$domain,$slot_name); |
|
&Apache::structuretags::finalize_storage($res->symb); |
|
} |
|
|
|
%Apache::lonhomework::history = %old_history; |
|
%Apache::lonhomework::results = %old_results; |
|
} |
|
|
sub create_new_version { |
sub create_new_version { |
my ($type,$user,$domain,$slot_name) = @_; |
my ($type,$user,$domain,$slot_name) = @_; |
|
|
|
my $id = '0'; |
if ($type eq 'Task') { |
if ($type eq 'Task') { |
# increment version |
# increment version |
my $version= |
my $version= |
Line 107 sub create_new_version {
|
Line 147 sub create_new_version {
|
} |
} |
|
|
#setup new version and who did it |
#setup new version and who did it |
$Apache::lonhomework::results{'resource.0.version'}=$version; |
$Apache::lonhomework::results{'resource.0.version'}=$version; |
if (defined($user) && defined($domain)) { |
$id = "$version.0"; |
$Apache::lonhomework::results{"resource.$version.0.checkedin"}= |
if (!defined($user) || defined($domain)) { |
$user.':'.$domain; |
$user = $env{'user.name'}; |
} else { |
$domain = $env{'user.domain'}; |
$Apache::lonhomework::results{"resource.$version.0.checkedin"}= |
|
$env{'user.name'}.':'.$env{'user.domain'}; |
|
} |
|
if (defined($slot_name)) { |
|
$Apache::lonhomework::results{"resource.$version.0.checkedin.slot"}= |
|
$slot_name; |
|
} |
} |
|
|
} elsif ($type eq 'problem') { |
} elsif ($type eq 'problem') { |
&Apache::lonxml::debug("authed $slot_name"); |
&Apache::lonxml::debug("authed $slot_name"); |
if (defined($user) && defined($domain)) { |
} |
$Apache::lonhomework::results{"resource.0.checkedin"}= |
|
$user.':'.$domain; |
if (defined($user) && defined($domain)) { |
} |
$Apache::lonhomework::results{"resource.$id.checkedin"}= |
if (defined($slot_name)) { |
$user.':'.$domain; |
$Apache::lonhomework::results{"resource.0.checkedin.slot"}= |
} |
$slot_name; |
if (defined($slot_name)) { |
} |
$Apache::lonhomework::results{"resource.$id.checkedin.slot"}= |
|
$slot_name; |
} |
} |
} |
} |
|
|
Line 563 sub start_Task {
|
Line 599 sub start_Task {
|
($status,$accessmsg,my $slot_name,$slot) = |
($status,$accessmsg,my $slot_name,$slot) = |
&Apache::lonhomework::check_slot_access('0','Task'); |
&Apache::lonhomework::check_slot_access('0','Task'); |
if ($status eq 'CAN_ANSWER' && $version eq '') { |
if ($status eq 'CAN_ANSWER' && $version eq '') { |
&create_new_version('Task',undef,undef,$slot_name); |
# CAN_ANSWR mode, and no current version, unproctored access |
|
# thus self-checkedin |
|
&check_in('Task',undef,undef,$slot_name); |
&add_to_queue('gradingqueue',{'type' => 'Task', |
&add_to_queue('gradingqueue',{'type' => 'Task', |
'time' => time, |
'time' => time, |
'slot' => $slot_name}); |
'slot' => $slot_name}); |