--- loncom/interface/lonrequestcourse.pm 2014/05/19 15:59:55 1.84 +++ loncom/interface/lonrequestcourse.pm 2015/08/24 14:50:22 1.93 @@ -1,7 +1,7 @@ # The LearningOnline Network # Request a course # -# $Id: lonrequestcourse.pm,v 1.84 2014/05/19 15:59:55 raeburn Exp $ +# $Id: lonrequestcourse.pm,v 1.93 2015/08/24 14:50:22 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -172,7 +172,7 @@ sub handler { if ($can_request{'textbook'}) { &process_textbook_request($r,$dom,$action,\%domdefs,\%domconfig,\%can_request); } else { - &textbook_request_disabled($r,$dom,\%can_request); + &textbook_request_disabled($r,$dom,$action,\%can_request); } } elsif ($action eq 'display') { my ($uname,$udom,$result,$warning) = &domcoord_display($dom); @@ -194,7 +194,7 @@ sub handler { if ($can_request{'textbook'}) { &print_textbook_form($r,$dom,\@incdoms,\%domdefs,$domconfig{'requestcourses'},\%can_request); } else { - &textbook_request_disabled($r,$dom,\%can_request); + &textbook_request_disabled($r,$dom,$action,\%can_request); } } return OK; @@ -476,27 +476,29 @@ sub get_breadcrumbs { } } } - for (my $i=0; $i<@{$states->{$action}}; $i++) { - if ($$state eq $states->{$action}[$i]) { - &Apache::lonhtmlcommon::add_breadcrumb( - {text=>"$trail->{$$state}"}); - $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course/Community Requests','Course_Requests'); - last; - } else { - if (($$state eq 'process') || ($$state eq 'removal') || ($$state eq 'reqauthor')) { + if (ref($states->{$action}) eq 'ARRAY') { + for (my $i=0; $i<@{$states->{$action}}; $i++) { + if ($$state eq $states->{$action}[$i]) { &Apache::lonhtmlcommon::add_breadcrumb( - { href => '/adm/requestcourse', - text => "$trail->{$states->{$action}[$i]}", - } - ); + {text=>"$trail->{$$state}"}); + $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course/Community Requests','Course_Requests'); + last; } else { - &Apache::lonhtmlcommon::add_breadcrumb( + if (($$state eq 'process') || ($$state eq 'removal') || ($$state eq 'reqauthor')) { + &Apache::lonhtmlcommon::add_breadcrumb( + { href => '/adm/requestcourse', + text => "$trail->{$states->{$action}[$i]}", + } + ); + } else { + &Apache::lonhtmlcommon::add_breadcrumb( { href => "javascript:backPage(document.requestcrs,'$states->{$action}[$i]')", text => "$trail->{$states->{$action}[$i]}", } - ); - } - } - } + ); + } + } + } + } } else { &Apache::lonhtmlcommon::add_breadcrumb( {text=>'Pick Action'}); @@ -766,7 +768,7 @@ END "; } } - my %lt = &Apache::lonlocal::texthash( + my %js_lt = &Apache::lonlocal::texthash( official => 'You are not permitted to request creation of an official course in this domain.', unofficial => 'You are not permitted to request creation of an unofficial course in this domain.', community => 'You are not permitted to request creation of a community in this domain.', @@ -774,33 +776,34 @@ END all => 'You must choose a specific course type when making a new course request.', allt => '"All types" is not allowed.', ); + &js_escape(\%js_lt); $js .= <print($result); if (($storeresult eq 'ok') || ($storeresult eq 'created')) { if ($storeresult eq 'ok') { @@ -1576,10 +1584,14 @@ sub print_request_form { ''.&mt('Make another request').'

'); } if (&Apache::loncoursequeueadmin::author_prompt()) { - &print_author_prompt($r,$env{'form.action'},$env{'form.cnum'},$env{'form.showdom'}, - $env{'form.crstype'},$storeresult); + unless ($customized) { + &print_author_prompt($r,$env{'form.action'},$env{'form.cnum'},$env{'form.showdom'}, + $env{'form.crstype'},$storeresult); + } } elsif ($storeresult eq 'created') { - $r->print('

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

'); + unless ($customized) { + $r->print('

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

'); + } } } } elsif ($state eq 'reqauthor') { @@ -2413,8 +2425,9 @@ ENDJS } sub viewcancel_javascript { - my $alert = &mt('Are you sure you want to cancel this request?').'\\n'. + my $alert = &mt('Are you sure you want to cancel this request?')."\n". &mt('Your request will be removed.'); + &js_escape(\$alert); return << "ENDJS"; function nextPage(formname,nextstate) { if (confirm('$alert')) { @@ -2786,6 +2799,7 @@ sub print_review { my $enrollrow_title = &mt('Default Access Dates').'
'. '('.&Apache::lonnet::plaintext('st',$category).')'; + my $instcode; if ($env{'form.crstype'} eq 'official') { if ((ref($codetitles) eq 'ARRAY') && (ref($cat_titles) eq 'HASH')) { foreach my $title (@{$codetitles}) { @@ -2801,6 +2815,11 @@ sub print_review { } } } + if (ref($code_order) eq 'ARRAY') { + foreach my $item (@{$code_order}) { + $instcode .= $env{'form.instcode_'.$item}; + } + } $inst_headers .= ''.&mt('Credits').''; if ($instcredits) { $inst_values .= ''.$instcredits.''; @@ -2888,7 +2907,7 @@ sub print_review { ($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')); @@ -3050,19 +3069,20 @@ 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'}; my $js_validate = <<"ENDJS";