--- loncom/interface/lonrequestcourse.pm 2014/06/16 01:42:22 1.85
+++ loncom/interface/lonrequestcourse.pm 2016/09/18 20:04:02 1.95.2.2
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Request a course
#
-# $Id: lonrequestcourse.pm,v 1.85 2014/06/16 01:42:22 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.95.2.2 2016/09/18 20:04:02 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -768,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.',
@@ -776,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 .= <dir_config('lonHostID');
- my ($storeresult,$result) = &print_request_outcome($r,$lonhost,$dom,\@codetitles,
- \@code_order,$instcredits);
+ my ($storeresult,$result,$customized) = &print_request_outcome($r,$lonhost,$dom,\@codetitles,
+ \@code_order,$instcredits);
$r->print($result);
if (($storeresult eq 'ok') || ($storeresult eq 'created')) {
if ($storeresult eq 'ok') {
@@ -1578,10 +1584,14 @@ sub print_request_form {
''.&mt('Make another request').'
'.&Apache::loncommon::help_open_topic('Course_Request_Personnel').' '.$lt{$crstype}.' '.&mt('Include other personnel?').'
';
}
+ 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;
+ }
+ }
+ }
for (my $i=0; $i<$persontotal; $i++) {
my @linkargs = map { 'person_'.$i.'_'.$_ } (@items);
my $linkargstr = join("','",@linkargs);
@@ -2111,9 +2133,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');
@@ -2415,8 +2442,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')) {
@@ -2788,6 +2816,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}) {
@@ -2803,6 +2832,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.'
';
@@ -2890,7 +2924,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'));
@@ -3052,19 +3086,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";