'.
+ '
'.$pageinfo.'
');
+ if ($earlyout) {
+ $r->print(&Apache::loncommon::end_page());
+ return;
+ }
+ $r->print('
'.
&Apache::lonhtmlcommon::start_pick_box().
&Apache::lonhtmlcommon::row_title($domaintitle).
''.&Apache::lonhtmlcommon::row_closure(1)."\n".
&Apache::lonhtmlcommon::end_pick_box().'
'."\n".
&Apache::loncommon::end_page());
return;
@@ -835,8 +950,8 @@ END
sub request_administration {
my ($r,$action,$state,$page,$states,$dom,$jscript,$loaditems,$crumb,
- $newinstcode,$codechk,$checkedcode,$description,$invalidcrosslist,
- $uname,$udom) = @_;
+ $newinstcode,$codechk,$checkedcode,$description,$showcredits,
+ $instcredits,$invalidcrosslist,$uname,$udom) = @_;
my $js;
if (($action eq 'new') || (($action eq 'view') && ($state eq 'pick_request'))) {
$js = <
print(&header($title,$js.$jscript,$loaditems,$jsextra).$crumb);
&print_request_form($r,$action,$state,$page,$states,$dom,$newinstcode,
- $codechk,$checkedcode,$description,$invalidcrosslist);
+ $codechk,$checkedcode,$description,$showcredits,
+ $instcredits,$invalidcrosslist);
} elsif ($action eq 'view') {
my $jsextra;
my $formname = 'requestcrs';
@@ -909,6 +1026,10 @@ END
$title = &mt('Pending requests for official courses');
} elsif ($env{'form.crstype'} eq 'unofficial') {
$title = &mt('Pending requests for unofficial courses');
+ } elsif ($env{'form.crstype'} eq 'textbook') {
+ $title = &mt('Pending requests for textbook courses');
+ } elsif ($env{'form.crstype'} eq 'textbook') {
+ $title = &mt('Pending requests for placement tests');
} else {
$title = &mt('Pending course/community requests');
}
@@ -932,9 +1053,10 @@ END
}
$r->print(''.$title.' '."\n".$form."\n".
&print_review($dom,\@codetitles,\%cat_titles,\%cat_order,
- \@code_order)."\n".
+ \@code_order,'','','','',$instcredits)."\n".
' '."\n");
- my @excluded = &get_excluded_elements($dom,$states,'new','review');
+ my @excluded = &get_excluded_elements($dom,$states,'new','review',
+ $showcredits);
push(@excluded,'origcnum');
$r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'
');
my $other = 'modify';
@@ -956,7 +1078,8 @@ END
my ($result,$output) = &print_cancel_request($dom,$env{'form.origcnum'});
$r->print(''.$title.' '."\n".$form."\n".
$output);
- my @excluded = &get_excluded_elements($dom,$states,'view','cancel');
+ my @excluded = &get_excluded_elements($dom,$states,'view','cancel',
+ $showcredits);
$r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'
');
my %navtxt = &Apache::lonlocal::texthash (
prev => 'Back',
@@ -1033,17 +1156,66 @@ END
$r->print(&header($title,'','','',{ 'only_body' => 1}).
$crumb."\n".''.$header.' '.
&print_review($dom,\@codetitles,\%cat_titles,\%cat_order,
- \@code_order,$uname,$udom)."\n".' '.
+ \@code_order,$uname,$udom,'','',$instcredits)."\n".
+ ''.
&close_popup_form());
}
$r->print(&Apache::loncommon::end_page());
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;
@@ -1101,8 +1273,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;
@@ -1227,7 +1401,7 @@ sub get_instcode {
sub print_request_form {
my ($r,$action,$state,$page,$states,$dom,$newinstcode,$codechk,$checkedcode,
- $description,$invalidcrosslist) = @_;
+ $description,$showcredits,$instcredits,$invalidcrosslist) = @_;
my $formname = 'requestcrs';
my ($next,$prev,$message,$output,$codepicker,$crstype);
$prev = $states->{$action}[$page-1];
@@ -1300,7 +1474,7 @@ sub print_request_form {
}
$r->print(&print_enrollment_menu($formname,$instcode,$dom,\@codetitles,
\%cat_titles,\%cat_order,\@code_order,
- $invalidcrosslist));
+ $showcredits,$instcredits,$invalidcrosslist));
} elsif ($state eq 'personnel') {
$r->print(&print_personnel_menu($dom,$formname,$crstype,$invalidcrosslist));
} elsif ($state eq 'review') {
@@ -1326,16 +1500,38 @@ sub print_request_form {
}
if ($skipuser) {
push(@disallowed,$i);
- $disallowmsg{$i} = &mt('[_1] was excluded because new users need be from the course domain',''.
+ &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.').'
'.
+ ''.&Apache::loncommon::help_open_topic('Course_Request_Sections').
@@ -1571,7 +1893,7 @@ sub print_enrollment_menu {
' onclick="javascript:nextPage(document.'.$formname.",'".$env{'form.state'}.
"'".');" />'.&mt('Add?').&Apache::lonhtmlcommon::row_closure();
$sections .= &Apache::lonhtmlcommon::row_headline.
- ''.&mt('Crosslisted courses for auto-enrollment').' '.
+ ''.&Apache::loncommon::help_open_topic('Course_Request_Crosslist').' '.&mt('Crosslisted courses for auto-enrollment').' '.
&Apache::lonhtmlcommon::row_closure(1).
$crosslist_form;
}
@@ -1592,12 +1914,29 @@ sub print_enrollment_menu {
&mt('No').''.
&Apache::lonhtmlcommon::row_closure(1).
&date_setting_table($starttime,$endtime,$formname,'enroll',
- $hasauto,%enrolltitles);
+ $hasauto,undef,%enrolltitles);
+ if ($showcredits) {
+ if ($instcredits) {
+ $creditsrow = &mt('[quant,_1,credit]',$instcredits);
+ } else {
+ $creditsrow = ''.
+ ' ';
+ }
+ $hascredits = 1;
+ }
+ }
+ } elsif (($env{'form.crstype'} eq 'unofficial') || ($env{'form.crstype'} eq 'textbook')) {
+ if ($showcredits) {
+ $creditsrow = ''.
+ ' ';
+ $hascredits = 1;
}
}
my $access_dates =
&date_setting_table($starttime,$endtime,$formname,'access',$hasauto,
- %accesstitles);
+ $hascredits,%accesstitles);
$output .= &Apache::lonhtmlcommon::start_pick_box();
if ($sections) {
$output .= $sections;
@@ -1616,7 +1955,15 @@ sub print_enrollment_menu {
$output .= &Apache::lonhtmlcommon::row_headline('Access').
''.$header.' '.
&Apache::lonhtmlcommon::row_closure(1).
- $access_dates
+ $access_dates;
+ }
+ if ($creditsrow) {
+ $output .= &Apache::lonhtmlcommon::row_headline('Credits').
+ ''.&mt('Credits earned by students').' '.
+ &Apache::lonhtmlcommon::row_closure(1).
+ &Apache::lonhtmlcommon::row_title(&mt('Default credits')).
+ $creditsrow.
+ &Apache::lonhtmlcommon::row_closure(1);
}
return ''.&Apache::lonhtmlcommon::start_pick_box().$output.
&Apache::lonhtmlcommon::end_pick_box().'
';
@@ -1681,7 +2028,7 @@ sub inst_section_selector {
}
sub date_setting_table {
- my ($starttime,$endtime,$formname,$prefix,$hasauto,%datetitles) = @_;
+ my ($starttime,$endtime,$formname,$prefix,$hasauto,$hascredits,%datetitles)=@_;
my ($perpetual,$table);
my $startform = &Apache::lonhtmlcommon::date_setter($formname,$prefix.'start',
$starttime,'','','',1,'','','',1);
@@ -1692,7 +2039,9 @@ sub date_setting_table {
$perpetual = ' '.
' '.
&mt('No end date').' ';
- $closure = '1';
+ unless ($hascredits) {
+ $closure = '1';
+ }
}
my %help_item = (
@@ -1782,17 +2131,32 @@ sub print_personnel_menu {
official => 'Requestor is automatically assigned Course Coordinator role.',
);
$lt{'unofficial'} = $lt{'official'};
+ $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) {
@@ -1809,9 +2173,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');
@@ -1899,6 +2268,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 {
@@ -1914,7 +2284,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 '') {
@@ -2057,7 +2427,7 @@ sub print_cancel_request {
&Apache::loncommon::start_data_table_row().
' '.$history{details}{'cdescr'}.' '.
&Apache::lonlocal::locallocaltime($timestamp).' '.
- ''.$showtype.' '.
+ ''.&mt($showtype).' '.
&Apache::loncommon::end_data_table_row().
&Apache::loncommon::end_data_table().
' ';
@@ -2112,8 +2482,9 @@ ENDJS
}
sub viewcancel_javascript {
- my $alert = &mt('Are you sure you want to cancel this request?\\n'.
- 'Your request will be removed.');
+ 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')) {
@@ -2127,7 +2498,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';
@@ -2137,6 +2508,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;
}
@@ -2320,7 +2729,7 @@ sub reqstatus_names {
rejected => 'Request rejected',
cancelled => 'Request cancelled',
);
- if (($crstype eq 'official') || ($crstype eq 'unofficial')) {
+ if (($crstype eq 'official') || ($crstype eq 'unofficial') || ($crstype eq 'textbook') || ($crstype eq 'placement')) {
$statusnames{'created'} = &mt('Course created');
} elsif ($crstype eq 'community') {
$statusnames{'created'} = &mt('Community created');
@@ -2372,7 +2781,7 @@ sub requestlog_display_filter {
$typename = $typenames->{$crstype};
}
}
- $output .= ''.$typename.' '."\n";
+ $output .= ''.&mt($typename).' '."\n";
}
$output .= '';
}
@@ -2414,7 +2823,7 @@ sub requestlog_display_filter {
sub print_review {
my ($dom,$codetitles,$cat_titles,$cat_order,$code_order,$uname,$udom,
- $disallowed,$disallowmsg) = @_;
+ $disallowed,$disallowmsg,$instcredits) = @_;
my ($types,$typename) = &Apache::loncommon::course_types();
my ($owner,$ownername,$owneremail);
if ($uname eq '' || $udom eq '') {
@@ -2447,6 +2856,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}) {
@@ -2462,6 +2872,17 @@ 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.' ';
+ } else {
+ $inst_values .= ''.$env{'form.coursecredits'}.' ';
+ }
if (&Apache::lonnet::auto_run('',$dom)) {
$enrollrow_title = &mt('Enrollment');
$enroll_headers = ''.&mt('Automatic Adds').' '.
@@ -2531,21 +2952,25 @@ sub print_review {
$section_values .= $xlistinfo;
}
$section_values .= '';
+ } elsif (($env{'form.crstype'} eq 'unofficial') || ($env{'form.crstype'} eq 'textbook')) {
+ $inst_headers .= ''.&mt('Credits').' ';
+ $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($env{'user.name'},
- $env{'user.domain'},$env{'form.clonecrs'},$env{'form.clonedom'},
- $env{'form.crstype'});
+ my $canclone = &Apache::loncoursequeueadmin::can_clone_course($uname,
+ $udom,$env{'form.clonecrs'},$env{'form.clonedom'},
+ $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 '') {
@@ -2561,6 +2986,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').' ';
@@ -2702,18 +3135,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'};
+ &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";