--- loncom/interface/lonrequestcourse.pm 2014/01/05 10:55:35 1.75 +++ loncom/interface/lonrequestcourse.pm 2025/01/10 22:45:55 1.118 @@ -1,7 +1,7 @@ # The LearningOnline Network # Request a course # -# $Id: lonrequestcourse.pm,v 1.75 2014/01/05 10:55:35 raeburn Exp $ +# $Id: lonrequestcourse.pm,v 1.118 2025/01/10 22:45:55 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -119,6 +119,10 @@ use Apache::loncoursequeueadmin; use Apache::lonuserutils; use LONCAPA qw(:DEFAULT :match); +my $registered_flush; +my $registered_instcats; +my $modified_dom; + sub handler { my ($r) = @_; &Apache::loncommon::content_type($r,'text/html'); @@ -127,6 +131,10 @@ sub handler { return OK; } + $registered_flush = 0; + $registered_instcats = 0; + $modified_dom = ''; + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['action','showdom','cnum','state','crstype','queue','tabs']); &Apache::lonhtmlcommon::clear_breadcrumbs(); @@ -155,6 +163,23 @@ sub handler { } if ($canreq) { + if (($env{'form.crstype'} eq 'lti') && ($env{'request.lti.login'}) && + ($env{'form.lti.reqrole'} eq 'cc') && ($env{'form.lti.reqcrs'}) && + ($env{'form.lti.sourcecrs'} ne '')) { + if ($action eq 'process') { + if ($can_request{'lti'}) { + my %domconfig = &Apache::lonnet::get_dom('configuration',['requestcourses'],$dom); + &process_textbook_request($r,$dom,$action,\%domdefs,\%domconfig,\%can_request,'lti'); + } else { + $r->print(&header('Course Request','','','',{ 'only_body' => 1}). + '
'.&mt('You do not have privileges to request creation of LTI courses.').'
'. + ''.&mt('Make another request').'
'); + unless ($customized) { + $r->print(''.&mt('Make another request').'
'); + } } } } elsif ($state eq 'reqauthor') { @@ -1549,7 +1623,7 @@ sub print_request_form { if ($result eq 'created') { my $role = 'au'; my $spec = "$role./$env{'form.showdom'}/"; - push(@links,&mt('Enter your authoring space with role: [_1]', + push(@links,&mt('Enter your Authoring Space with role: [_1]', ''. &Apache::lonnet::plaintext($role).'')); } @@ -1624,12 +1698,12 @@ sub print_request_form { sub print_author_prompt { my ($r,$action,$cnum,$showdom,$crstype,$storeresult) = @_; - $r->print(''.
&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?'). + &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).
@@ -2041,18 +2115,32 @@ sub print_personnel_menu {
official => 'Requestor is automatically assigned Course Coordinator role.',
);
$lt{'unofficial'} = $lt{'official'};
- $lt{'textbook'} = $lt{'textbook'};
+ $lt{'textbook'} = $lt{'official'};
+ $lt{'placement'} = $lt{'official'};
$output .= &Apache::lonhtmlcommon::row_headline().
''.&Apache::loncommon::help_open_topic('Course_Request_Personnel').' '.$lt{$crstype}.' '.&mt('Include other personnel?').'
';
}
- for (my $i=0; $i<$persontotal; $i++) {
+ my $cansearch = 1;
+ my @alldoms = &Apache::lonnet::all_domains();
+ if (@alldoms == 1) {
+ my %domsrch = &Apache::lonnet::get_dom('configuration',
+ ['directorysrch'],$alldoms[0]);
+ if (ref($domsrch{'directorysrch'}) eq 'HASH') {
+ if ((!$domsrch{'directorysrch'}{'available'}) &&
+ ($domsrch{'directorysrch'}{'lcavailable'} eq '0')) {
+ $cansearch = 0;
+ }
+ }
+ }
+ my ($trusted,$untrusted) = &Apache::lonnet::trusted_domains('enroll',$dom);
+ for (my $i=0; $i<$persontotal; $i++) {
my @linkargs = map { 'person_'.$i.'_'.$_ } (@items);
my $linkargstr = join("','",@linkargs);
my $uname_form = '';
my $onchange = 'javascript:fix_domain('."'$formname','person_".$i."_dom',".
"'person_".$i."_hidedom','person_".$i."_uname'".');';
my $udom_form = &Apache::loncommon::select_dom_form($dom,'person_'.$i.'_dom','',
- 1,$onchange).
+ 1,$onchange,undef,$trusted,$untrusted).
'';
my %form_elems;
foreach my $item (@items) {
@@ -2069,9 +2157,14 @@ sub print_personnel_menu {
}
$sectionselector .= $newtitle.
''."\n";
- my $usersrchlinktxt = &mt('Search for user');
- my $usersrchlink = &Apache::loncommon::selectuser_link($formname,@linkargs,$dom,
- $usersrchlinktxt);
+ my $usersrchlink;
+ if ($cansearch) {
+ my $usersrchlinktxt = &mt('Search for user');
+ $usersrchlink = &Apache::loncommon::selectuser_link($formname,@linkargs,$dom,
+ $usersrchlinktxt);
+ } else {
+ $usersrchlink = ' ';
+ }
my $userchklinktxt = &mt('Check username');
my $userchklink = &Apache::loncommon::selectuser_link($formname,@linkargs,$dom,
$userchklinktxt,'checkusername');
@@ -2318,7 +2411,7 @@ sub print_cancel_request {
&Apache::loncommon::start_data_table_row().
'
'.
''.&mt('Records/page:').' '. - &Apache::lonmeta::selectbox('show',$curr->{'show'},undef, + &Apache::lonmeta::selectbox('show',$curr->{'show'},'',undef, (&mt('all'),5,10,20,50,100,1000,10000)). ' | '; my $startform = @@ -2671,7 +2765,7 @@ sub requestlog_display_filter { $typename = $typenames->{$crstype}; } } - $output .= ''."\n"; + $output .= ''."\n"; } $output .= ''; } @@ -2746,6 +2840,7 @@ sub print_review { my $enrollrow_title = &mt('Default Access Dates').' | '.&mt('Credits').' | '; if ($instcredits) { $inst_values .= ''.$instcredits.' | '; @@ -2841,19 +2941,20 @@ sub print_review { $inst_values .= ''.$env{'form.coursecredits'}.' | '; } - my %ctxt = &clone_text(); + my %ctxt = &clone_text($env{'form.crstype'}); $inst_headers .= ''.&mt('Clone From').' | '; if (($env{'form.cloning'}) && ($env{'form.clonecrs'} =~ /^$match_name$/) && ($env{'form.clonedom'} =~ /^$match_domain$/)) { my $canclone = &Apache::loncoursequeueadmin::can_clone_course($uname, $udom,$env{'form.clonecrs'},$env{'form.clonedom'}, - $env{'form.crstype'}); + $env{'form.crstype'},$dom,$instcode); if ($canclone) { my %courseenv = &Apache::lonnet::userenvironment($env{'form.clonedom'}, $env{'form.clonecrs'},('description','internal.coursecode')); if (keys(%courseenv) > 0) { - $inst_headers .= ''.$ctxt{'dsh'}.' | '; + $inst_headers .= ''.$ctxt{'dsh'}.' | '. + ''.$ctxt{'dpl'}.' | '; $inst_values .= ''.$courseenv{'description'}.' '; my $cloneinst = $courseenv{'internal.coursecode'}; if ($cloneinst ne '') { @@ -2869,6 +2970,14 @@ sub print_review { } else { $inst_values .= $ctxt{'ncd'}; } + $inst_values .= ' | '; + if ($env{'form.tinyurls'} eq 'delete') { + $inst_values .= $ctxt{'nsl'}; + } elsif ($env{'form.tinyurls'} eq 'transfer') { + $inst_values .= $ctxt{'tsl'}; + } else { + $inst_values .= $ctxt{'csl'}; + } $inst_values .= ' | '; } else { $inst_values .= ''.&mt('Unknown').' | '; @@ -3010,19 +3119,21 @@ sub dates_from_form { sub courseinfo_form { my ($dom,$formname,$crstype,$next,$description) = @_; - my %lt = &Apache::lonlocal::texthash( + my %js_lt = &Apache::lonlocal::texthash( official => 'You must provide a (brief) course description.', community => 'You must provide a (brief) community description.' ); - $lt{'unofficial'} = $lt{'official'}; - $lt{'textbook'} = $lt{'official'}; + &js_escape(\%js_lt); + $js_lt{'unofficial'} = $js_lt{'official'}; + $js_lt{'textbook'} = $js_lt{'official'}; + $js_lt{'placement'} = $js_lt{'official'}; my $js_validate = <<"ENDJS"; +ENDCLOSE + my %prog_state = &Apache::lonhtmlcommon::Create_PrgWin($r,undef,$preamble); + &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,&mt('Processing ...')); + $r->rflush(); + if (ref($details) eq 'HASH') { + if ($details->{'clonecrs'}) { + $customitems{'_LC_clonefrom'} = $details->{'clonedom'}.'_'.$details->{'clonecrs'}; + } + } + $customitems{'_LC_ownerfullname'} = &Apache::loncommon::plainname($env{'user.name'},$env{'user.domain'},'first'); + my $owneremail; + my %emails = &Apache::loncommon::getemails(); + foreach my $email ('permanentemail','critnotification','notification') { + $owneremail = $emails{$email}; + last if ($owneremail ne ''); + } + if ($owneremail ne '') { + $customitems{'_LC_owneremail'} = $owneremail; + } + $customitems{'_LC_coursedomainname'} = &Apache::lonnet::domain($dom,'description'); + $customitems{'_LC_coursedescription'} = $coursedesc; + $customitems{'_LC_coursestartdate'} = $accessstart; + $customitems{'_LC_courseenddate'} = $accessend; my ($result,$postprocess) = &Apache::loncoursequeueadmin::course_creation($dom,$cnum, - 'autocreate',$details,\$logmsg,\$newusermsg,\$addresult, - \$enrollcount,\$response,\$keysmsg,\%domdefs,\%longroles, - \$code,\%customitems); + 'autocreate',$details,\$logmsg,$clonemsg,\$newusermsg, + \$addresult,\$enrollcount,\$response,\$keysmsg,\%domdefs, + \%longroles,\$code,\%customitems); + &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,&mt('Finished!')); + &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); + $r->print($closure); + if (ref($postprocess) eq 'HASH') { + $customized = $postprocess->{'createdcustomized'}; + } if ($result eq 'created') { $disposition = 'created'; $reqstatus = 'created'; @@ -3715,13 +3919,56 @@ sub process_request { if (($code) || ((ref($postprocess) eq 'HASH') && (($postprocess->{'createdweb'}) || ($postprocess->{'createdmsg'})))) { $output .= ¬ification_information($disposition,$env{'user.name'}.':'.$env{'user.domain'}, - $dom,$cnum,$now,$code,$postprocess); + $dom,$cnum,$now,$code,$postprocess,$crstype); } if ($code) { $reqhash{'code'} = $code; } - $output .= '
---|