'."\n".
&Apache::loncommon::end_page());
return;
@@ -905,7 +940,8 @@ END
if ($action eq 'new') {
my $jsextra;
if (($state eq 'courseinfo') || ($state eq 'codepick')) {
- $jsextra = "\n".&Apache::loncommon::coursebrowser_javascript($dom);
+ $jsextra = "\n".&Apache::loncommon::coursebrowser_javascript($dom,'','','','','',
+ $newinstcode);
} elsif ($state eq 'enrollment') {
if (($env{'form.crstype'} eq 'official') &&
(&Apache::lonnet::auto_run('',$dom))) {
@@ -1090,10 +1126,58 @@ END
return;
}
+sub domcoord_display {
+ my ($dom) = @_;
+ my ($uname,$udom,$result,$warning);
+ if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) {
+ if ($env{'form.cnum'} ne '') {
+ my $cnum = $env{'form.cnum'};
+ my $queue = $env{'form.queue'};
+ my $reqkey = $cnum.'_'.$queue;
+ my $namespace = 'courserequestqueue';
+ my $domconfig = &Apache::lonnet::get_domainconfiguser($dom);
+ my %queued =
+ &Apache::lonnet::get($namespace,[$reqkey],$dom,$domconfig);
+ if (ref($queued{$reqkey}) eq 'HASH') {
+ $uname = $queued{$reqkey}{'ownername'};
+ $udom = $queued{$reqkey}{'ownerdom'};
+ if (($udom =~ /^$match_domain$/) && ($uname =~ /^$match_username$/)) {
+ $result = &retrieve_settings($dom,$cnum,$udom,$uname);
+ } else {
+ if ($env{'form.crstype'} eq 'community') {
+ $warning = &mt('Invalid username or domain for community requestor');
+ } else {
+ $warning = &mt('Invalid username or domain for course requestor');
+ }
+ }
+ } else {
+ if ($env{'form.crstype'} eq 'community') {
+ $warning = &mt('No information was found for this community request.');
+ } else {
+ $warning = &mt('No information was found for this course request.');
+ }
+ }
+ } else {
+ $warning = &mt('No course request ID provided.');
+ }
+ } else {
+ if ($env{'form.crstype'} eq 'any') {
+ $warning = &mt('You do not have rights to view course or community request information.');
+ } elsif ($env{'form.crstype'} eq 'community') {
+ $warning = &mt('You do not have rights to view community request information.');
+ } else {
+ $warning = &mt('You do not have rights to view course request information.');
+ }
+ }
+ return ($uname,$udom,$result,$warning);
+}
+
sub enrollment_lcsec_js {
my %alerts = §ion_check_alerts();
my $secname = $alerts{'badsec'};
my $secnone = $alerts{'reserved'};
+ &js_escape(\$secname);
+ &js_escape(\$secnone);
my $output = '
function validateEnrollSections(formname,nextstate) {
var badsectotal = 0;
@@ -1151,8 +1235,10 @@ function validateEnrollSections(formname
sub personnel_lcsec_js {
my %alerts = §ion_check_alerts();
- my $secname = $alerts{'badsec'}.'\\n'.$alerts{'separate'};
+ my $secname = $alerts{'badsec'}."\n".$alerts{'separate'};
my $secnone = $alerts{'reserved'};
+ &js_escape(\$secname);
+ &js_escape(\$secnone);
my $output = '
function validatePersonnelSections(formname,nextstate) {
var badsectotal = 0;
@@ -1468,6 +1554,15 @@ sub print_request_form {
}
$r->print(&print_review($dom,\@codetitles,\%cat_titles,\%cat_order,\@code_order,'','',\@disallowed,\%disallowmsg,$instcredits).
'');
+ my $fullname = &Apache::loncommon::plainname($env{'user.name'},
+ $env{'user.domain'});
+ my $postprocess = &Apache::lonnet::auto_crsreq_update($dom,$cnum,$crstype,'review',$env{'user.name'},
+ $env{'user.domain'},$fullname,$env{'form.cdescr'});
+ if (ref($postprocess) eq 'HASH') {
+ if ($postprocess->{'reviewweb'}) {
+ $r->print($postprocess->{'reviewweb'});
+ }
+ }
if ($crstype eq 'community') {
$navtxt{'next'} = &mt('Submit community request');
} else {
@@ -1478,8 +1573,9 @@ sub print_request_form {
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles,
\%cat_order,\@code_order);
}
- my ($storeresult,$result) = &print_request_outcome($dom,\@codetitles,
- \@code_order,$instcredits);
+ my $lonhost = $r->dir_config('lonHostID');
+ 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') {
@@ -1488,27 +1584,14 @@ sub print_request_form {
''.&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.').'
');
+ }
}
}
} elsif ($state eq 'reqauthor') {
@@ -1518,7 +1601,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).''));
}
@@ -1591,6 +1674,29 @@ sub print_request_form {
return;
}
+sub print_author_prompt {
+ my ($r,$action,$cnum,$showdom,$crstype,$storeresult) = @_;
+ $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.').'
'.
+ ''.
+ ''.
+ ''.
+ ''.
+ ''.
+ ''.
+ ''.
+ ' ');
+}
+
sub get_usertype {
my ($persondom,$personname,$curr_rules,$got_rules) = @_;
my ($rules,$ruleorder) =
@@ -2105,6 +2211,7 @@ sub sorted_request_history {
my $crstype = $history{'crstype'};
my $disposition = $history{'disposition'};
my $status = $history{'status'};
+ my $uniquecode = $history{'code'};
if ($action eq 'view') {
next if ((exists($history{'status'})) && ($history{'status'} eq 'created'));
} else {
@@ -2120,7 +2227,7 @@ sub sorted_request_history {
$entry = $requestkey.':'.$crstype.':'.
&escape($history{'details'}{'cdescr'});
if ($action eq 'log') {
- $entry .= ':'.$lastupdate.':';
+ $entry .= ':'.$uniquecode.':'.$lastupdate.':';
if ($statusinfo{$key} ne '') {
$entry .= $statusinfo{$key};
} elsif ($status ne '') {
@@ -2318,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')) {
@@ -2333,7 +2441,7 @@ ENDJS
}
sub print_request_logs {
- my ($r,$dom,$jscript,$loaditems,$crumb) = @_;
+ my ($r,$dom,$jscript,$loaditems,$crumb,$usetabs) = @_;
my $title;
if ($env{'form.crstype'} eq 'community') {
$title = 'Community Request Logs';
@@ -2343,6 +2451,9 @@ sub print_request_logs {
$title = 'Course Request Logs';
}
$r->print(&header($title,$jscript,$loaditems).$crumb);
+ if ($usetabs) {
+ &startContentScreen($r,'textbooklogs');
+ }
my $formname = 'requestcrs';
$r->print(''.
- &Apache::loncommon::end_page());
+ if ($usetabs) {
+ $r->print('');
+ }
+ $r->print('');
+ if ($usetabs) {
+ &endContentScreen($r);
+ }
+ $r->print(&Apache::loncommon::end_page());
return;
}
@@ -2653,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}) {
@@ -2668,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.'
';
@@ -2755,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'));
@@ -2917,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";