--- loncom/interface/lonrequestcourse.pm 2012/08/14 15:45:06 1.64 +++ loncom/interface/lonrequestcourse.pm 2012/08/15 14:37:13 1.65 @@ -1,7 +1,7 @@ # The LearningOnline Network # Request a course # -# $Id: lonrequestcourse.pm,v 1.64 2012/08/14 15:45:06 raeburn Exp $ +# $Id: lonrequestcourse.pm,v 1.65 2012/08/15 14:37:13 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -147,6 +147,12 @@ sub handler { } } + if (($action eq 'new') && (&Apache::loncoursequeueadmin::author_prompt())) { + if (ref($states{$action}) eq 'ARRAY') { + push(@{$states{$action}},'reqauthor'); + } + } + foreach my $key (keys(%states)) { if (ref($states{$key}) eq 'ARRAY') { unshift (@{$states{$key}},'crstype'); @@ -162,6 +168,7 @@ sub handler { personnel => 'Personnel', review => 'Review', process => 'Result', + reqauthor => 'Authoring Space Result', pick_request => 'Display Summary', details => 'Request Details', cancel => 'Cancel Request', @@ -439,7 +446,7 @@ sub get_breadcrumbs { $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course/Community Requests','Course_Requests'); last; } else { - if (($$state eq 'process') || ($$state eq 'removal')) { + if (($$state eq 'process') || ($$state eq 'removal') || ($$state eq 'reqauthor')) { &Apache::lonhtmlcommon::add_breadcrumb( { href => '/adm/requestcourse', text => "$trail->{$states->{$action}[$i]}", @@ -1444,13 +1451,71 @@ sub print_request_form { \@code_order); $r->print($result); if (($storeresult eq 'ok') || ($storeresult eq 'created')) { - $r->print('

'); if ($storeresult eq 'ok') { - $r->print(''. - &mt('Modify this request').''.(' 'x4)); + $r->print('

'. + &mt('Modify this request').''.(' 'x4). + ''.&mt('Make another request').'

'); + } + if (&Apache::loncoursequeueadmin::author_prompt()) { + $r->print('

'.&mt('Access to authoring space').'

'. + '

'. + &mt('Although assessment items can be created directly inside a course, such items only use part of the assessment capabilities of LON-CAPA.'). + '
'. + &mt('By contrast, items created in authoring space, then imported into a course, can use all of the features of the assessment engine.').'

'. + '

'.&mt('Request authoring space access now?'). + ' '. + ''. + (' 'x2). + ''. + '

'. + ''. + ''. + ''. + ''. + ''. + ''. + ''. + '
'); + } elsif ($storeresult eq 'created') { + $r->print('

'.&mt('Make another request').'

'); + } + } + } elsif ($state eq 'reqauthor') { + my ($result,@links); + if ($env{'form.requestauthor'}) { + $r->print(&Apache::loncoursequeueadmin::process_reqauthor(\$result)); + if ($result eq 'created') { + my $role = 'au'; + my $spec = "$role./$env{'form.showdom'}/"; + push(@links,&mt('Enter your authoring space with role: [_1]', + ''. + &Apache::lonnet::plaintext($role).'')); + } + } + if (($env{'form.disposition'} eq 'created') && + ($env{'form.cnum'} =~ /^$match_courseid$/) && + ($env{'form.showdom'} =~ /^$match_domain$/)) { + my ($spec,$area,$role,$type); + my $role = 'cc'; + my $spec = "$role./$env{'form.showdom'}/$env{'form.cnum'}"; + my $type = 'Course'; + if ($env{'form.crstype'} eq 'community') { + $type = 'Community'; } - $r->print(''.&mt('Make another request').'

'); - return; + my $showrole = &Apache::lonnet::plaintext($role,$type); + unshift(@links,&mt('Enter new course with role: [_1]', + ''.$showrole.'')); + } + if (@links > 1) { + $r->print(&mt('New roles will be listed on your [_1]Roles[_2] page.', + '','').' '.&mt('Choose a role:'). + ''); + } elsif (@links == 1) { + $r->print('

'.$links[0].'

'); } } my @excluded = &get_excluded_elements($dom,$states,$action,$state); @@ -1480,15 +1545,18 @@ sub print_request_form { $count ++; } $env{'form.persontotal'} = $count; - } } if ($state eq 'enrollment') { push(@excluded,('sectotal','crosslisttotal')); } - $r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).''); - &display_navbuttons($r,$dom,$formname,$prev,$navtxt{'prev'},$next, - $navtxt{'next'},$state); + if (($state eq 'process') || ($state eq 'reqauthor')) { + $r->print(''); + } else { + $r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).''); + &display_navbuttons($r,$dom,$formname,$prev,$navtxt{'prev'},$next, + $navtxt{'next'},$state); + } return; }