version 1.20, 2009/08/21 13:18:46
|
version 1.36.2.3, 2009/10/24 03:56:01
|
Line 44 described at http://www.lon-capa.org.
|
Line 44 described at http://www.lon-capa.org.
|
|
|
=item handler() |
=item handler() |
|
|
|
=item get_breadcrumbs() |
|
|
=item header() |
=item header() |
|
|
=item form_elements() |
=item form_elements() |
|
|
=item onload_action() |
=item onload_action() |
|
|
=item check_can_request() |
|
|
|
=item course_types() |
|
|
|
=item print_main_menu() |
=item print_main_menu() |
|
|
=item request_administration() |
=item request_administration() |
|
|
|
=item close_popup_form() |
|
|
|
=item get_instcode() |
|
|
=item print_request_form() |
=item print_request_form() |
|
|
=item print_enrollment_menu() |
=item print_enrollment_menu() |
|
|
|
=item show_invalid_crosslists() |
|
|
=item inst_section_selector() |
=item inst_section_selector() |
|
|
=item date_setting_table() |
=item date_setting_table() |
Line 94 described at http://www.lon-capa.org.
|
Line 98 described at http://www.lon-capa.org.
|
|
|
=item check_autolimit() |
=item check_autolimit() |
|
|
=item build_batchcreatehash() |
|
|
|
=item retrieve_settings() |
=item retrieve_settings() |
|
|
=item get_request_settings() |
=item get_request_settings() |
|
|
|
=item extract_instcode() |
|
|
|
=item generate_date_items() |
|
|
=back |
=back |
|
|
=cut |
=cut |
Line 112 use Apache::lonnet;
|
Line 118 use Apache::lonnet;
|
use Apache::loncommon; |
use Apache::loncommon; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::loncoursequeueadmin; |
use Apache::loncoursequeueadmin; |
|
use Apache::lonuserutils; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
|
|
sub handler { |
sub handler { |
Line 122 sub handler {
|
Line 129 sub handler {
|
return OK; |
return OK; |
} |
} |
|
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
|
['action','showdom','cnum','state']); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
my $dom = &get_course_dom(); |
my $dom = &get_course_dom(); |
my $action = $env{'form.action'}; |
my $action = $env{'form.action'}; |
my $state = $env{'form.state'}; |
my $state = $env{'form.state'}; |
my %stored; |
my (%states,%stored); |
my $jscript; |
my ($jscript,$uname,$udom,$result,$warning); |
if ((defined($state)) && (defined($action))) { |
|
if (($action eq 'view') && ($state eq 'details')) { |
|
if ((defined($env{'form.showdom'})) && (defined($env{'form.cnum'}))) { |
|
my $result = &retrieve_settings($env{'form.showdom'},$env{'form.cnum'}); |
|
} |
|
} |
|
my %elements = &form_elements($dom); |
|
my $elementsref = {}; |
|
if (ref($elements{$action}) eq 'HASH') { |
|
if (ref($elements{$action}{$state}) eq 'HASH') { |
|
$elementsref = $elements{$action}{$state}; |
|
} |
|
} |
|
if (($state eq 'courseinfo') && ($env{'form.clonedom'} eq '')) { |
|
$env{'form.clonedom'} = $dom; |
|
} |
|
$jscript = &Apache::lonhtmlcommon::set_form_elements($elementsref,\%stored); |
|
} |
|
|
|
if ($state eq 'personnel') { |
|
$jscript .= "\n".&Apache::loncommon::userbrowser_javascript(); |
|
} |
|
|
|
my $loaditems = &onload_action($action,$state); |
$states{'display'} = ['details']; |
|
|
my %states; |
|
$states{'view'} = ['pick_request','details','cancel','removal']; |
$states{'view'} = ['pick_request','details','cancel','removal']; |
$states{'log'} = ['filter','display']; |
$states{'log'} = ['filter','display']; |
$states{'new'} = ['courseinfo','enrollment','personnel','review','process']; |
$states{'new'} = ['courseinfo','enrollment','personnel','review','process']; |
Line 170 sub handler {
|
Line 155 sub handler {
|
} |
} |
} |
} |
|
|
|
my @invalidcrosslist; |
my %trail = ( |
my %trail = ( |
crstype => 'Course Request Action', |
crstype => 'Course Request Action', |
codepick => 'Category', |
codepick => 'Category', |
Line 186 sub handler {
|
Line 172 sub handler {
|
|
|
if (($env{'form.crstype'} eq 'official') && (&Apache::lonnet::auto_run('',$dom))) { |
if (($env{'form.crstype'} eq 'official') && (&Apache::lonnet::auto_run('',$dom))) { |
$trail{'enrollment'} = 'Enrollment'; |
$trail{'enrollment'} = 'Enrollment'; |
} |
} |
|
|
my $page = 0; |
my ($page,$crumb,$newinstcode,$codechk,$checkedcode,$description) = |
my $crumb; |
&get_breadcrumbs($dom,$action,\$state,\%states,\%trail); |
if (defined($action)) { |
if ($action eq 'display') { |
my $done = 0; |
if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) { |
my $i=0; |
my $namespace = 'courserequestqueue'; |
if (ref($states{$action}) eq 'ARRAY') { |
if ($env{'form.cnum'} ne '') { |
while ($i<@{$states{$action}} && !$done) { |
my $cnum = $env{'form.cnum'}; |
if ($states{$action}[$i] eq $state) { |
my $reqkey = $cnum.'_approval'; |
$page = $i; |
my $namespace = 'courserequestqueue'; |
$done = 1; |
my $domconfig = &Apache::lonnet::get_domainconfiguser($dom); |
} |
my %queued = |
$i++; |
&Apache::lonnet::get($namespace,[$reqkey],$dom,$domconfig); |
} |
if (ref($queued{$reqkey}) eq 'HASH') { |
} |
$uname = $queued{$reqkey}{'ownername'}; |
for (my $i=0; $i<@{$states{$action}}; $i++) { |
$udom = $queued{$reqkey}{'ownerdom'}; |
if ($state eq $states{$action}[$i]) { |
if (($udom =~ /^$match_domain$/) && ($uname =~ /^$match_username$/)) { |
&Apache::lonhtmlcommon::add_breadcrumb( |
$result = &retrieve_settings($dom,$cnum,$udom,$uname); |
{text=>"$trail{$state}"}); |
} else { |
$crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests'); |
$warning = &mt('Invalid username or domain for course requestor'); |
last; |
} |
} else { |
|
if (($state eq 'process') && ($i > 0)) { |
|
&Apache::lonhtmlcommon::add_breadcrumb( |
|
{href=>"javascript:backPage(document.requestcrs,'$states{$action}[0]')", |
|
text=>"$trail{$states{$action}[$i]}"}); |
|
} else { |
} else { |
&Apache::lonhtmlcommon::add_breadcrumb( |
$warning = &mt('No information was found for this course request.'); |
{href=>"javascript:backPage(document.requestcrs,'$states{$action}[$i]')", |
|
text=>"$trail{$states{$action}[$i]}"}); |
|
} |
} |
|
} else { |
|
$warning = &mt('No course request ID provided.'); |
} |
} |
|
} else { |
|
$warning = &mt('You do not have rights to view course request information.'); |
|
} |
|
} elsif ((defined($state)) && (defined($action))) { |
|
if (($action eq 'view') && ($state eq 'details')) { |
|
if ((defined($env{'form.showdom'})) && (defined($env{'form.cnum'}))) { |
|
my $result = &retrieve_settings($env{'form.showdom'},$env{'form.cnum'}); |
|
} |
|
} elsif ($env{'form.crstype'} eq 'official') { |
|
if (&Apache::lonnet::auto_run('',$dom)) { |
|
if (($action eq 'new') && (($state eq 'enrollment') || |
|
($state eq 'personnel'))) { |
|
my $checkcrosslist = 0; |
|
for (my $i=0; $i<$env{'form.crosslisttotal'}; $i++) { |
|
if ($env{'form.crosslist_'.$i}) { |
|
$checkcrosslist ++; |
|
} |
|
} |
|
if ($checkcrosslist) { |
|
my %codechk; |
|
my (@codetitles,%cat_titles,%cat_order,@code_order,$lastitem); |
|
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles, |
|
\%cat_titles, |
|
\%cat_order, |
|
\@code_order); |
|
my $numtitles = scalar(@codetitles); |
|
if ($numtitles) { |
|
for (my $i=0; $i<$env{'form.crosslisttotal'}; $i++) { |
|
if ($env{'form.crosslist_'.$i}) { |
|
my $codecheck; |
|
my $crosslistcode = ''; |
|
foreach my $item (@code_order) { |
|
$crosslistcode .= $env{'form.crosslist_'.$i.'_'.$item}; |
|
} |
|
if ($crosslistcode ne '') { |
|
($codechk{$i}, my $rest) = |
|
&Apache::lonnet::auto_validate_instcode('',$dom,$crosslistcode); |
|
} |
|
unless ($codechk{$i} eq 'valid') { |
|
$env{'form.crosslist_'.$i} = ''; |
|
push(@invalidcrosslist,$crosslistcode); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
my %elements = &form_elements($dom); |
|
my $elementsref = {}; |
|
if (ref($elements{$action}) eq 'HASH') { |
|
if (ref($elements{$action}{$state}) eq 'HASH') { |
|
$elementsref = $elements{$action}{$state}; |
|
} |
|
} |
|
if (($state eq 'courseinfo') && ($env{'form.clonedom'} eq '')) { |
|
$env{'form.clonedom'} = $dom; |
|
} |
|
if ($state eq 'crstype') { |
|
$jscript = &mainmenu_javascript(); |
|
} else { |
|
$jscript = &Apache::lonhtmlcommon::set_form_elements($elementsref,\%stored); |
} |
} |
} else { |
|
&Apache::lonhtmlcommon::add_breadcrumb( |
|
{text=>'Pick Action'}); |
|
$crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests'); |
|
} |
} |
|
|
|
if ($state eq 'personnel') { |
|
$jscript .= "\n".&Apache::loncommon::userbrowser_javascript(); |
|
} |
|
|
|
my $loaditems = &onload_action($action,$state); |
|
|
my %can_request; |
my %can_request; |
my $canreq = &check_can_request($dom,\%can_request); |
my $canreq = &Apache::lonnet::check_can_request($dom,\%can_request); |
if ($action eq 'new') { |
if ($action eq 'new') { |
if ($canreq) { |
if ($canreq) { |
if ($state eq 'crstype') { |
if ($state eq 'crstype') { |
&print_main_menu($r,\%can_request,\%states,$dom,$jscript,$loaditems, |
&print_main_menu($r,\%can_request,\%states,$dom,$jscript,$loaditems, |
$crumb); |
$crumb); |
} else { |
} else { |
&request_administration($r,$action,$state,$page,\%states,$dom,$jscript, |
&request_administration($r,$action,$state,$page,\%states,$dom, |
$loaditems,$crumb); |
$jscript,$loaditems,$crumb,$newinstcode, |
|
$codechk,$checkedcode,$description, |
|
\@invalidcrosslist); |
} |
} |
} else { |
} else { |
$r->print(&header('Course Requests').$crumb. |
$r->print(&header('Course Requests').$crumb. |
Line 245 sub handler {
|
Line 293 sub handler {
|
} |
} |
} elsif ($action eq 'view') { |
} elsif ($action eq 'view') { |
if ($state eq 'crstype') { |
if ($state eq 'crstype') { |
&print_main_menu($r,\%can_request,\%states,$dom,$jscript,'',$crumb); |
&print_main_menu($r,\%can_request,\%states,$dom,$jscript,$loaditems,$crumb); |
} else { |
} else { |
&request_administration($r,$action,$state,$page,\%states,$dom,$jscript, |
&request_administration($r,$action,$state,$page,\%states,$dom,$jscript, |
$loaditems,$crumb); |
$loaditems,$crumb); |
|
} |
|
} elsif ($action eq 'display') { |
|
if ($warning ne '') { |
|
my $args = { only_body => 1 }; |
|
$r->print(&header('Course Requests','','',$args).$crumb. |
|
'<h3>'.&mt('Course Request Details').'</h3>'. |
|
'<div class="LC_warning">'.$warning.'</div>'. |
|
&close_popup_form()); |
|
} else { |
|
&request_administration($r,$action,$state,$page,\%states,$dom,$jscript, |
|
$loaditems,$crumb,'','','','','',$uname,$udom); |
} |
} |
} elsif ($action eq 'log') { |
} elsif ($action eq 'log') { |
&print_request_logs($jscript,$loaditems,$crumb); |
&print_request_logs($jscript,$loaditems,$crumb); |
Line 258 sub handler {
|
Line 317 sub handler {
|
return OK; |
return OK; |
} |
} |
|
|
|
sub mainmenu_javascript { |
|
return <<"END"; |
|
function setType(courseForm) { |
|
for (var i=0; i<courseForm.crstype.length; i++) { |
|
if (courseForm.crstype.options[i].value == "$env{'form.crstype'}") { |
|
courseForm.crstype.options[i].selected = true; |
|
} else { |
|
courseForm.crstype.options[i].selected = false; |
|
} |
|
} |
|
} |
|
|
|
function setAction(courseForm) { |
|
for (var i=0; i<courseForm.action.length; i++) { |
|
if (courseForm.action.options[i].value == "$env{'form.action'}") { |
|
courseForm.action.options[i].selected = true; |
|
} else { |
|
courseForm.action.options[i].selected = false; |
|
} |
|
} |
|
} |
|
END |
|
} |
|
|
|
sub get_breadcrumbs { |
|
my ($dom,$action,$state,$states,$trail) = @_; |
|
my ($crumb,$newinstcode,$codechk,$checkedcode,$numtitles,$description); |
|
my $page = 0; |
|
if ((ref($states) eq 'HASH') && (ref($trail) eq 'HASH') && (ref($state))) { |
|
if (defined($action)) { |
|
my $done = 0; |
|
my $i=0; |
|
if (ref($states->{$action}) eq 'ARRAY') { |
|
while ($i<@{$states->{$action}} && !$done) { |
|
if ($states->{$action}[$i] eq $$state) { |
|
$page = $i; |
|
$done = 1; |
|
} |
|
$i++; |
|
} |
|
} |
|
if ($env{'form.crstype'} eq 'official') { |
|
if ($page > 1) { |
|
if ($states->{$action}[$page-1] eq 'codepick') { |
|
if ($env{'form.instcode'} eq '') { |
|
($newinstcode,$numtitles) = &get_instcode($dom); |
|
if ($numtitles) { |
|
if ($newinstcode eq '') { |
|
$$state = 'codepick'; |
|
$page --; |
|
} else { |
|
($codechk,$description) = |
|
&Apache::lonnet::auto_validate_instcode('', |
|
$dom,$newinstcode); |
|
if ($codechk ne 'valid') { |
|
$$state = 'codepick'; |
|
$page --; |
|
} |
|
$checkedcode = 1; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
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 Requests','Course_Requests'); |
|
last; |
|
} else { |
|
if (($$state eq 'process') || ($$state eq 'removal')) { |
|
&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'}); |
|
$crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests'); |
|
} |
|
} else { |
|
&Apache::lonhtmlcommon::add_breadcrumb( |
|
{text=>'Pick Action'}); |
|
$crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests'); |
|
} |
|
return ($page,$crumb,$newinstcode,$codechk,$checkedcode,$description); |
|
} |
|
|
sub header { |
sub header { |
my ($bodytitle,$jscript,$loaditems,$jsextra) = @_; |
my ($bodytitle,$jscript,$loaditems,$jsextra,$args) = @_; |
if ($jscript) { |
if ($jscript) { |
$jscript = '<script type="text/javascript">'."\n". |
$jscript = '<script type="text/javascript">'."\n". |
'// <![CDATA['."\n". |
'// <![CDATA['."\n". |
$jscript."\n".'// ]]>'."\n".'</script>'."\n"; |
$jscript."\n".'// ]]>'."\n".'</script>'."\n"; |
} |
} |
if ($loaditems) { |
if ($loaditems) { |
$loaditems = {'add_entries' => $loaditems,}; |
if (ref($args) eq 'HASH') { |
return &Apache::loncommon::start_page($bodytitle,$jscript.$jsextra,$loaditems); |
my %loadhash = ( |
} else { |
'add_entries' => $loaditems, |
return &Apache::loncommon::start_page($bodytitle,$jscript.$jsextra); |
); |
|
my %arghash = (%loadhash,%{$args}); |
|
$args = \%arghash; |
|
} else { |
|
$args = {'add_entries' => $loaditems,}; |
|
} |
} |
} |
|
return &Apache::loncommon::start_page($bodytitle,$jscript.$jsextra,$args); |
} |
} |
|
|
sub form_elements { |
sub form_elements { |
Line 354 sub form_elements {
|
Line 518 sub form_elements {
|
enrollend_year => 'text', |
enrollend_year => 'text', |
enrollend_minute => 'text', |
enrollend_minute => 'text', |
enrollend_second => 'text', |
enrollend_second => 'text', |
crosslisttotal => 'hidden', |
|
addcrosslist => 'checkbox', |
addcrosslist => 'checkbox', |
autoadds => 'radio', |
autoadds => 'radio', |
autodrops => 'radio', |
autodrops => 'radio', |
); |
); |
if ($env{'form.sectotal'} > 0) { |
if ($env{'form.sectotal'} > 0) { |
for (my $i=0; $i<$env{'form.sectotal'}; $i++) { |
for (my $i=0; $i<$env{'form.sectotal'}; $i++) { |
$extras{'sec_'.$i} = 'checkbox', |
$extras{'sec_'.$i} = 'radio'; |
$extras{'secnum_'.$i} = 'text', |
$extras{'secnum_'.$i} = 'text'; |
$extras{'loncapasec_'.$i} = 'checkbox', |
$extras{'loncapasec_'.$i} = 'text'; |
} |
} |
} |
} |
my $crosslisttotal = $env{'form.crosslisttotal'}; |
my $crosslisttotal = $env{'form.crosslisttotal'}; |
if ($env{'form.addcrosslist'}) { |
if ($env{'form.addcrosslist'}) { |
$crosslisttotal ++; |
$crosslisttotal ++; |
} |
} |
if (!defined($crosslisttotal)) { |
if (!$crosslisttotal) { |
$crosslisttotal = 1; |
$crosslisttotal = 1; |
} |
} |
if ($crosslisttotal > 0) { |
|
for (my $i=0; $i<$env{'form.crosslisttotal'}; $i++) { |
for (my $i=0; $i<$env{'form.crosslisttotal'}; $i++) { |
if ($numtitles) { |
if ($numtitles) { |
$extras{'crosslist_'.$i.'_'.$lastitem} = 'text'; |
$extras{'crosslist_'.$i.'_'.$lastitem} = 'text'; |
} |
} |
if (@codetitles > 0) { |
if (@codetitles > 0) { |
foreach my $item (@codetitles) { |
foreach my $item (@codetitles) { |
$extras{'crosslist_'.$i.'_'.$item} = 'selectbox'; |
$extras{'crosslist_'.$i.'_'.$item} = 'selectbox'; |
} |
|
} |
} |
$extras{'crosslist_'.$i} = 'checkbox'; |
|
$extras{'crosslist_'.$i.'_instsec'} = 'text', |
|
$extras{'crosslist_'.$i.'_lcsec'} = 'text', |
|
} |
} |
|
$extras{'crosslist_'.$i} = 'checkbox'; |
|
$extras{'crosslist_'.$i.'_instsec'} = 'text', |
|
$extras{'crosslist_'.$i.'_lcsec'} = 'text', |
} |
} |
my %mergedhash = (%{$elements{'new'}{'enrollment'}},%extras); |
my %mergedhash = (%{$elements{'new'}{'enrollment'}},%extras); |
%{$elements{'new'}{'enrollment'}} = %mergedhash; |
%{$elements{'new'}{'enrollment'}} = %mergedhash; |
Line 419 sub onload_action {
|
Line 581 sub onload_action {
|
my ($action,$state) = @_; |
my ($action,$state) = @_; |
my %loaditems; |
my %loaditems; |
if (($action eq 'new') || ($action eq 'view')) { |
if (($action eq 'new') || ($action eq 'view')) { |
$loaditems{'onload'} = 'javascript:setFormElements(document.requestcrs)'; |
if ($state eq 'crstype') { |
} |
$loaditems{'onload'} = 'javascript:setAction(document.mainmenu_action);javascript:setType(document.mainmenu_coursetype)'; |
return \%loaditems; |
} else { |
} |
$loaditems{'onload'} = 'javascript:setFormElements(document.requestcrs)'; |
|
|
sub check_can_request { |
|
my ($dom,$can_request) = @_; |
|
my $canreq = 0; |
|
my ($types,$typename) = &course_types(); |
|
my @options = ('approval','validate','autolimit'); |
|
my $optregex = join('|',@options); |
|
if ((ref($can_request) eq 'HASH') && (ref($types) eq 'ARRAY')) { |
|
foreach my $type (@{$types}) { |
|
if (&Apache::lonnet::usertools_access($env{'user.name'}, |
|
$env{'user.domain'}, |
|
$type,undef,'requestcourses')) { |
|
$canreq ++; |
|
if ($dom eq $env{'user.domain'}) { |
|
$can_request->{$type} = 1; |
|
} |
|
} |
|
if ($env{'environment.reqcrsotherdom.'.$type} ne '') { |
|
my @curr = split(',',$env{'environment.reqcrsotherdom.'.$type}); |
|
if (@curr > 0) { |
|
$canreq ++; |
|
unless ($dom eq $env{'user.domain'}) { |
|
if (grep(/^\Q$dom\E:($optregex)(=?\d*)$/,@curr)) { |
|
$can_request->{$type} = 1; |
|
} |
|
} |
|
} |
|
} |
|
} |
} |
} |
} |
return $canreq; |
return \%loaditems; |
} |
|
|
|
sub course_types { |
|
my @types = ('official','unofficial','community'); |
|
my %typename = ( |
|
official => 'Official course', |
|
unofficial => 'Unofficial course', |
|
community => 'Community', |
|
); |
|
return (\@types,\%typename); |
|
} |
} |
|
|
|
|
sub print_main_menu { |
sub print_main_menu { |
my ($r,$can_request,$states,$dom,$jscript,$loaditems,$crumb) = @_; |
my ($r,$can_request,$states,$dom,$jscript,$loaditems,$crumb) = @_; |
my ($types,$typename) = &course_types(); |
my ($types,$typename) = &Apache::loncommon::course_types(); |
my $onchange; |
my $onchange; |
unless ($env{'form.interface'} eq 'textual') { |
unless ($env{'form.interface'} eq 'textual') { |
$onchange = 1; |
$onchange = 1; |
Line 488 sub print_main_menu {
|
Line 611 sub print_main_menu {
|
} |
} |
} |
} |
|
|
|
my $standby=&mt('Course selected. Please stand by.'); |
my $js = <<"END"; |
my $js = <<"END"; |
|
|
|
function enterrole (thisform,rolecode,buttonname) { |
|
document.title='$standby'; |
|
window.status='$standby'; |
|
thisform.newrole.value=rolecode; |
|
thisform.selectrole.value='1'; |
|
thisform.submit(); |
|
} |
|
|
|
function ToSyllabus(cdom,cnum) { |
|
if (cdom == '' || cdom == null) { |
|
return; |
|
} |
|
if (cnum == '' || cnum == null) { |
|
return; |
|
} |
|
var options = 'height=600,width=800,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no'; |
|
var url = "/public/"+cdom+"/"+cnum+"/syllabus"; |
|
syllwin = window.open(url,'',options,1); |
|
syllwin.focus(); |
|
return; |
|
} |
|
|
function nextPage(formname) { |
function nextPage(formname) { |
var crschoice = document.requestcrs.crstype.value; |
var crschoice = document.mainmenu_coursetype.crstype.value; |
var actionchoice = document.requestcrs.action.value; |
var actionchoice = document.mainmenu_action.action.value; |
if (check_can_request(crschoice,actionchoice) == true) { |
if (check_can_request(crschoice,actionchoice) == true) { |
if ((actionchoice == 'new') && (crschoice == 'official')) { |
if ((actionchoice == 'new') && (crschoice == 'official')) { |
nextstate = 'codepick'; |
nextstate = 'codepick'; |
} else { |
} else { |
$nextstate_setter |
$nextstate_setter |
} |
} |
|
formname.crstype.value = crschoice; |
|
formname.action.value = actionchoice; |
formname.state.value= nextstate; |
formname.state.value= nextstate; |
formname.submit(); |
formname.submit(); |
} |
} |
Line 552 END
|
Line 700 END
|
} |
} |
|
|
END |
END |
|
$r->print(&header('Concept Test Courses',$js.$jscript,$loaditems).$crumb); |
$r->print(&header('Course Requests',$js.$jscript,$loaditems).$crumb. |
my $existing = &existing_courses(); |
'<div>'. |
if ($existing) { |
'<form name="domforcourse" method="post" action="/adm/requestcourse">'. |
$r->print('<div class="LC_left_float">'. |
&Apache::lonhtmlcommon::start_pick_box(). |
'<h3>'.&mt('Request creation of a new course').'</h3>'); |
&Apache::lonhtmlcommon::row_title('Course Domain'). |
} else { |
&Apache::loncommon::select_dom_form($dom,'showdom','',1,$onchange)); |
$r->print('<div><h3>'.&mt('Request creation of a new course, or review your pending course requests.').'</h3>'); |
if (!$onchange) { |
|
$r->print(' <input type="submit" name="godom" value="'. |
|
&mt('Change').'" />'); |
|
} |
} |
$r->print(&Apache::lonhtmlcommon::row_closure(1). |
$r->print('<p>'. |
&Apache::lonhtmlcommon::end_pick_box().'</form></div>'); |
&Apache::lonhtmlcommon::start_pick_box(). |
|
&Apache::lonhtmlcommon::row_title(&mt('Course Domain')). |
|
'<form name="domforcourse" method="post" action="/adm/requestcourse">'); |
|
$r->print('GCI Web Center Concept Test Delivery (gcitest)'."\n". |
|
'<input type="hidden" value="gcitest" name="showdom" />'); |
|
$r->print('</form>'.&Apache::lonhtmlcommon::row_closure()); |
|
|
my $formname = 'requestcrs'; |
my $formname = 'requestcrs'; |
my $nexttext = &mt('Next'); |
my $nexttext = &mt('Next'); |
$r->print( |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Action')).' |
'<div><form name="'.$formname.'" method="post" action="/adm/requestcourse">'. |
<form name="mainmenu_action" method="post" action=""> |
&Apache::lonhtmlcommon::start_pick_box(). |
|
&Apache::lonhtmlcommon::row_title('Action').' |
|
<input type="hidden" name="showdom" value="'.$dom.'" /> |
|
<select size="1" name="action" > |
<select size="1" name="action" > |
<option value="new">'.&mt('New request').'</option> |
<option value="new">'.&mt('New request').'</option> |
<option value="view">'.&mt('View/Modify/Cancel pending requests').'</option> |
<option value="view">'.&mt('View/Modify/Cancel pending requests').'</option> |
<option value="log">'.&mt('View request history').'</option> |
</select></form>'. |
</select>'. |
|
&Apache::lonhtmlcommon::row_closure(). |
|
&Apache::lonhtmlcommon::row_title('Course Type').' |
|
<select size="1" name="crstype"> |
|
<option value="any">'.&mt('All types').'</option>'); |
|
if ((ref($types) eq 'ARRAY') && (ref($typename) eq 'HASH')) { |
|
foreach my $type (@{$types}) { |
|
my $selected = ''; |
|
if ($type eq 'official') { |
|
$selected = ' selected="selected"'; |
|
} |
|
$r->print('<option value="'.$type.'"'.$selected.'>'.$typename->{$type}. |
|
'</option>'."\n"); |
|
} |
|
} |
|
$r->print('</select> |
|
<input type="hidden" name="state" value="crstype" />'. |
|
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::end_pick_box().'<br /> |
&Apache::lonhtmlcommon::row_title(&mt('Course Type')). |
<input type="button" name="next" value="'.$nexttext.'" onclick="javascript:nextPage(document.'.$formname.')" /> |
&mt($typename->{'unofficial'})."\n". |
</form></div>'); |
'<form name="mainmenu_coursetype" method="post" action="">'."\n". |
|
'<input type="hidden" name="crstype" value="unofficial" ></form>'."\n". |
|
&Apache::lonhtmlcommon::row_closure(1)."\n". |
|
&Apache::lonhtmlcommon::end_pick_box().'</p>'."\n". |
|
'<p><form name="'.$formname.'" method="post" action="">'."\n". |
|
'<input type="hidden" name="state" value="crstype" />'."\n". |
|
'<input type="hidden" name="showdom" value="'.$dom.'" />'."\n". |
|
'<input type="hidden" name="crstype" value="" />'."\n". |
|
'<input type="hidden" name="action" value="" />'."\n". |
|
'<input type="button" name="next" value="'.$nexttext. |
|
'" onclick="javascript:nextPage(document.'.$formname.')" />'."\n". |
|
'</form></p>'); |
|
if ($existing) { |
|
$r->print('</div><div class="LC_left_float"><h3>'.&mt('Enter an existing Concept Test course').'</h3>'.$existing.'</div><div class="LC_clear_float_footer"></div>'); |
|
} else { |
|
$r->print('</div>'); |
|
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
|
|
|
sub existing_courses { |
|
my $output; |
|
my %roleshash = &Apache::lonnet::get_my_roles(undef,undef,'userroles',undef, |
|
['cc'],['gcitest']); |
|
my %courses; |
|
if (keys(%roleshash) > 0) { |
|
foreach my $key (keys(%roleshash)) { |
|
my ($cnum,$cdom,$role) = split(':',$key); |
|
my ($tstart,$tend) = split(':',$roleshash{$key}); |
|
my %coursehash = &Apache::lonnet::coursedescription($cdom.'/'.$cnum); |
|
$courses{$cdom.'_'.$cnum}{'description'} = $coursehash{'description'}; |
|
$courses{$cdom.'_'.$cnum}{'owner'} = $coursehash{'internal.courseowner'}; |
|
if (defined($coursehash{'default_enrollment_start_date'}) ) { |
|
$courses{$cdom.'_'.$cnum}{'startaccess'} = |
|
&Apache::lonlocal::locallocaltime($coursehash{'default_enrollment_start_date'}); |
|
} |
|
if (defined($coursehash{'default_enrollment_end_date'}) ) { |
|
$courses{$cdom.'_'.$cnum}{'endaccess'} = |
|
&Apache::lonlocal::locallocaltime($coursehash{'default_enrollment_end_date'}); |
|
if ($coursehash{'default_enrollment_end_date'} == 0) { |
|
$courses{$cdom.'_'.$cnum}{'endaccess'} = &mt('No ending date'); |
|
} |
|
} |
|
} |
|
$output = '<form name="pickrole" action="/adm/roles" method="post">'. |
|
&Apache::loncommon::start_data_table(). |
|
&Apache::loncommon::start_data_table_header_row(); |
|
my @coltitles = ('Select','Title','Owner(s)', |
|
'Default Access Dates for Students','Student Counts'); |
|
foreach my $item (@coltitles) { |
|
$output .= '<th>'; |
|
if ($item eq 'Select') { |
|
$output .= ' '; |
|
} else { |
|
$output .= &mt($item); |
|
} |
|
$output .= '</th>'; |
|
} |
|
$output .= &Apache::loncommon::end_data_table_header_row(); |
|
my %courseinfo = &build_courseinfo_hash(\%courses); |
|
my %Sortby; |
|
foreach my $course (sort(keys(%courses))) { |
|
my $clean_title = $courseinfo{$course}{'title'}; |
|
$clean_title =~ s/\W+//g; |
|
if ($clean_title eq '') { |
|
$clean_title = $courseinfo{$course}{'title'}; |
|
} |
|
push(@{$Sortby{$clean_title}},$course); |
|
} |
|
my @sorted_courses; |
|
my @sorted_courses = sort { lc($a) cmp lc($b) } (keys(%Sortby)); |
|
foreach my $item (@sorted_courses) { |
|
foreach my $course (@{$Sortby{$item}}) { |
|
my ($cdom,$cnum) = split('_',$course); |
|
$output.= &Apache::loncommon::start_data_table_row(). |
|
&courseinfo_row($courseinfo{$course},$cnum,$cdom). |
|
&Apache::loncommon::end_data_table_row(); |
|
} |
|
} |
|
$output .= &Apache::loncommon::end_data_table(). |
|
'<input type="hidden" name="newrole" value="" />'. |
|
'<input type="hidden" name="selectrole" value="" /></form>'; |
|
} |
|
return $output; |
|
} |
|
|
|
sub build_courseinfo_hash { |
|
my ($courses) = @_; |
|
my %courseinfo; |
|
foreach my $course (keys(%{$courses})) { |
|
my ($cdom,$cnum) = split('_',$course); |
|
my $descr; |
|
if (ref($courses->{$course}) eq 'HASH') { |
|
$descr = $courses->{$course}{'description'}; |
|
} |
|
my $cleandesc=&HTML::Entities::encode($descr,'<>&"'); |
|
$cleandesc=~s/'/\\'/g; |
|
$cleandesc =~ s/^\s+//; |
|
my ($cdom,$cnum)=split(/\_/,$course); |
|
my ($singleowner,@owners,%ownernames); |
|
if (ref($courses->{$course}) eq 'HASH') { |
|
$singleowner = $courses->{$course}{'owner'}; |
|
push(@owners,$singleowner); |
|
if (ref($courses->{$course}{'co-owners'}) eq 'ARRAY') { |
|
foreach my $item (@{$courses->{$course}{'co-owners'}}) { |
|
push(@owners,$item); |
|
} |
|
} |
|
} |
|
foreach my $owner (@owners) { |
|
my ($ownername,$ownerdom); |
|
if ($owner =~ /:/) { |
|
($ownername,$ownerdom) = split(/:/,$owner); |
|
} else { |
|
$ownername = $owner; |
|
if ($owner ne '') { |
|
$ownerdom = $cdom; |
|
} |
|
} |
|
if ($ownername ne '' && $ownerdom ne '') { |
|
my %namehash=&Apache::loncommon::getnames($ownername,$ownerdom); |
|
$ownernames{$ownername.':'.$ownerdom} = \%namehash; |
|
} |
|
} |
|
$courseinfo{$course}{'cdom'} = $cdom; |
|
$courseinfo{$course}{'cnum'} = $cnum; |
|
my @lastnames; |
|
foreach my $owner (keys(%ownernames)) { |
|
if (ref($ownernames{$owner}) eq 'HASH') { |
|
push(@lastnames,$ownernames{$owner}{'lastname'}); |
|
} |
|
} |
|
$courseinfo{$course}{'ownerlastnames'} = join(', ',sort(@lastnames)); |
|
$courseinfo{$course}{'title'} = $cleandesc; |
|
$courseinfo{$course}{'owner'} = $singleowner; |
|
my @classids; |
|
$courseinfo{$course}{'counts'} = &count_students($cdom,$cnum,0); |
|
my $startaccess = $courses->{$course}{'startaccess'}; |
|
my $endaccess = $courses->{$course}{'endaccess'}; |
|
my $accessdates; |
|
if ($startaccess) { |
|
$accessdates .= '<i>'.&mt('From:[_1]','</i> '.$startaccess).'<br />'; |
|
} |
|
if ($endaccess) { |
|
$accessdates .= '<i>'.&mt('To:[_1]','</i> '.$endaccess).'<br />'; |
|
} |
|
$courseinfo{$course}{'access'} = $accessdates; |
|
} |
|
return %courseinfo; |
|
} |
|
|
|
sub courseinfo_row { |
|
my ($info,$cnum,$cdom) = @_; |
|
my $output; |
|
if (ref($info) eq 'HASH') { |
|
my $rolecode = 'cc./'.$cdom.'/'.$cnum; |
|
my $buttonname = $rolecode; |
|
$buttonname=~s/\W//g; |
|
$output .= '<td><input type="button" name="'.$buttonname.'" value="'.&mt('Select').'" onclick="javascript:enterrole(this.form,'."'$rolecode','$buttonname'".')" ></td>'. |
|
'<td>'.$info->{'title'}.' <font size="-2">'. |
|
'<a href="javascript:ToSyllabus('."'$cdom','$cnum'".')">'. |
|
&mt('Syllabus').'</a></font></td>'. |
|
'<td>'.$info->{'ownerlastnames'}.'</td>'. |
|
'<td>'.$info->{'access'}.'</td>'. |
|
'<td>'.$info->{'counts'}.'</td>'; |
|
} else { |
|
$output = '<td colspan="4">'.&mt('No information available for [_1].', |
|
$cdom.'_'.$cnum).'</td>'; |
|
return $output; |
|
} |
|
return $output; |
|
} |
|
|
|
sub count_students { |
|
my ($cdom,$cnum,$numsec) = @_; |
|
my $classlist = &Apache::loncoursedata::get_classlist($cdom,$cnum); |
|
my %student_count = ( |
|
Active => 0, |
|
Future => 0, |
|
Expired => 0, |
|
); |
|
my %idx; |
|
$idx{'status'} = &Apache::loncoursedata::CL_STATUS(); |
|
my %status_title = &Apache::lonlocal::texthash( |
|
Expired => 'Previous access', |
|
Active => 'Current access', |
|
Future => 'Future access', |
|
); |
|
|
|
while (my ($student,$data) = each(%$classlist)) { |
|
$student_count{$data->[$idx{'status'}]} ++; |
|
} |
|
|
|
my $countslist = &mt('[quant,_1,section:,sections:,No sections]',$numsec).'<br />'; |
|
foreach my $status ('Active','Future') { |
|
$countslist .= '<span class="LC_nobreak">'.$status_title{$status}.': '. |
|
$student_count{$status}.'</span><br />'; |
|
} |
|
return $countslist; |
|
} |
|
|
|
|
sub request_administration { |
sub request_administration { |
my ($r,$action,$state,$page,$states,$dom,$jscript,$loaditems,$crumb) = @_; |
my ($r,$action,$state,$page,$states,$dom,$jscript,$loaditems,$crumb, |
|
$newinstcode,$codechk,$checkedcode,$description,$invalidcrosslist, |
|
$uname,$udom) = @_; |
my $js; |
my $js; |
if (($action eq 'new') || (($action eq 'view') && ($state eq 'pick_request'))) { |
if (($action eq 'new') || (($action eq 'view') && ($state eq 'pick_request'))) { |
$js = <<END; |
$js = <<END; |
Line 627 END
|
Line 957 END
|
} |
} |
if ($action eq 'new') { |
if ($action eq 'new') { |
my $jsextra; |
my $jsextra; |
unless (($state eq 'review') || ($state eq 'process')) { |
if ($state eq 'courseinfo') { |
$jsextra = "\n".&Apache::loncommon::coursebrowser_javascript($dom); |
$jsextra = "\n".&Apache::loncommon::coursebrowser_javascript($dom); |
|
} elsif ($state eq 'enrollment') { |
|
if (($env{'form.crstype'} eq 'official') && |
|
(&Apache::lonnet::auto_run('',$dom))) { |
|
$js .= "\n".§ion_check_javascript()."\n".&enrollment_lcsec_js(); |
|
} |
|
} elsif ($state eq 'personnel') { |
|
$js .= "\n".§ion_check_javascript()."\n".&personnel_lcsec_js(); |
} |
} |
$r->print(&header('Request a course',$js.$jscript,$loaditems,$jsextra).$crumb); |
$r->print(&header('Request a course',$js.$jscript,$loaditems,$jsextra).$crumb); |
&print_request_form($r,$action,$state,$page,$states,$dom); |
&print_request_form($r,$action,$state,$page,$states,$dom,$newinstcode, |
|
$codechk,$checkedcode,$description,$invalidcrosslist); |
} elsif ($action eq 'view') { |
} elsif ($action eq 'view') { |
my $jsextra; |
my $jsextra; |
my $formname = 'requestcrs'; |
my $formname = 'requestcrs'; |
Line 651 END
|
Line 989 END
|
my $form = '<form method="post" name="'.$formname.'" action="/adm/requestcourse" />'; |
my $form = '<form method="post" name="'.$formname.'" action="/adm/requestcourse" />'; |
if ($state eq 'pick_request') { |
if ($state eq 'pick_request') { |
$r->print('<h3>'.&mt('Pending course requests').'</h3><div>'."\n".$form."\n". |
$r->print('<h3>'.&mt('Pending course requests').'</h3><div>'."\n".$form."\n". |
&print_request_status($dom).'</form>'); |
&print_request_status($dom).'</form></div>'); |
} elsif ($state eq 'details') { |
} elsif ($state eq 'details') { |
my (@codetitles,%cat_titles,%cat_order,@code_order,$instcode,$code_chk); |
my (@codetitles,%cat_titles,%cat_order,@code_order,$instcode,$code_chk); |
my $origcnum = $env{'form.cnum'}; |
my $origcnum = $env{'form.cnum'}; |
Line 663 END
|
Line 1001 END
|
\%cat_order,\@code_order); |
\%cat_order,\@code_order); |
} |
} |
$r->print('<h3>'.&mt('Course Request Details').'</h3><div>'."\n".$form."\n". |
$r->print('<h3>'.&mt('Course Request Details').'</h3><div>'."\n".$form."\n". |
&print_review($formname,$dom,\@codetitles,\%cat_titles,\%cat_order, |
&print_review($dom,\@codetitles,\%cat_titles,\%cat_order, |
\@code_order)."\n". |
\@code_order)."\n". |
'<input name="origcnum" value="'.$origcnum.'" type="hidden" />'."\n"); |
'<input name="origcnum" value="'.$origcnum.'" type="hidden" />'."\n"); |
my @excluded = &get_excluded_elements($dom,$states,'new','review'); |
my @excluded = &get_excluded_elements($dom,$states,'new','review'); |
Line 675 END
|
Line 1013 END
|
other => 'Modify Request', |
other => 'Modify Request', |
next => 'Cancel Request', |
next => 'Cancel Request', |
); |
); |
&display_navbuttons($r,$formname,$prev,$navtxt{'prev'},$next,$navtxt{'next'}, |
&display_navbuttons($r,$dom,$formname,$prev,$navtxt{'prev'},$next, |
$state,$other,$navtxt{'other'}); |
$navtxt{'next'},$state,$other,$navtxt{'other'}); |
$r->print('</form>'); |
$r->print('</form>'); |
} elsif ($state eq 'cancel') { |
} elsif ($state eq 'cancel') { |
my ($result,$output) = &print_cancel_request($dom,$env{'form.origcnum'}); |
my ($result,$output) = &print_cancel_request($dom,$env{'form.origcnum'}); |
Line 689 END
|
Line 1027 END
|
next => 'Confirm Cancellation', |
next => 'Confirm Cancellation', |
); |
); |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
&display_navbuttons($r,$formname,$prev,$navtxt{'prev'},$next, |
&display_navbuttons($r,$dom,$formname,$prev,$navtxt{'prev'},$next, |
$navtxt{'next'},$state); |
$navtxt{'next'},$state); |
} else { |
} else { |
&display_navbuttons($r,$formname,$prev,$navtxt{'prev'},undef,'',$state); |
&display_navbuttons($r,$dom,$formname,$prev,$navtxt{'prev'},undef, |
|
'',$state); |
} |
} |
$r->print('</form>'); |
$r->print('</form>'); |
} elsif ($state eq 'removal') { |
} elsif ($state eq 'removal') { |
Line 736 END
|
Line 1075 END
|
} |
} |
$r->print('</form>'); |
$r->print('</form>'); |
} |
} |
|
} elsif ($action eq 'display') { |
|
my $formname = 'requestcrs'; |
|
my (@codetitles,%cat_titles,%cat_order,@code_order,$instcode,$code_chk); |
|
if ($env{'form.crstype'} eq 'official') { |
|
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, |
|
\%cat_order,\@code_order); |
|
} |
|
$r->print(&header('Course Request','','','',{ 'only_body' => 1}). |
|
$crumb."\n".'<h3>'.&mt('Course Request Details').'</h3>'. |
|
&print_review($dom,\@codetitles,\%cat_titles,\%cat_order, |
|
\@code_order,$uname,$udom)."\n".'</div>'. |
|
&close_popup_form()); |
} elsif ($action eq 'log') { |
} elsif ($action eq 'log') { |
$r->print(&coursereq_log('View request log',$jscript,$loaditems).$crumb); |
$r->print(&coursereq_log('View request log',$jscript,$loaditems).$crumb); |
} |
} |
Line 743 END
|
Line 1094 END
|
return; |
return; |
} |
} |
|
|
|
sub enrollment_lcsec_js { |
|
my %alerts = §ion_check_alerts(); |
|
my $secname = $alerts{'badsec'}; |
|
my $secnone = $alerts{'reserved'}; |
|
my $output = ' |
|
function validateEnrollSections(formname,nextstate) { |
|
var badsectotal = 0; |
|
var reservedtotal = 0; |
|
var secTest = ""; |
|
'; |
|
for (my $i=0; $i<$env{'form.sectotal'}; $i++) { |
|
$output .= " |
|
var selSec = 0; |
|
for (var j=0; j<document.requestcrs.sec_".$i.".length; j++) { |
|
if (document.requestcrs.sec_".$i."[j].checked) { |
|
selSec = document.requestcrs.sec_".$i."[j].value; |
|
} |
|
if (selSec == 1) { |
|
secTest = validsection(document.requestcrs.loncapasec_".$i."); |
|
if (secTest == 'badsec') { |
|
badsectotal++; |
|
} |
|
if (secTest == 'reserved') { |
|
reservedtotal++; |
|
} |
|
} |
|
} |
|
"; |
|
} |
|
for (my $i=0; $i<$env{'form.crosslisttotal'}; $i++) { |
|
$output .= " |
|
if (document.requestcrs.crosslist_".$i.".checked) { |
|
secTest = validsection(document.requestcrs.crosslist_".$i."_lcsec); |
|
if (secTest == 'badsec') { |
|
badsectotal++; |
|
} |
|
if (secTest == 'reserved') { |
|
reservedtotal++; |
|
} |
|
} |
|
"; |
|
} |
|
$output .= " |
|
if (badsectotal>0) { |
|
alert('$secname'); |
|
return false; |
|
} |
|
if (reservedtotal>0) { |
|
alert('$secnone'); |
|
return false; |
|
} |
|
formname.state.value= nextstate; |
|
formname.submit(); |
|
return; |
|
} |
|
"; |
|
return $output; |
|
} |
|
|
|
sub personnel_lcsec_js { |
|
my %alerts = §ion_check_alerts(); |
|
my $secname = $alerts{'badsec'}.'\\n'.$alerts{'separate'}; |
|
my $secnone = $alerts{'reserved'}; |
|
my $output = ' |
|
function validatePersonnelSections(formname,nextstate) { |
|
var badsectotal = 0; |
|
var reservedtotal = 0; |
|
var secTest = ""; |
|
'; |
|
for (my $i=0; $i<$env{'form.persontotal'}; $i++) { |
|
$output .= " |
|
if (document.requestcrs.person_".$i."_uname.value != '') { |
|
secTest = validsection(document.requestcrs.person_".$i."_newsec,'1'); |
|
if (secTest == 'badsec') { |
|
badsectotal++; |
|
} |
|
if (secTest == 'reserved') { |
|
reservedtotal++; |
|
} |
|
} |
|
"; |
|
} |
|
$output .= " |
|
if (badsectotal > 0) { |
|
alert('$secname'); |
|
return false; |
|
} else { |
|
if (reservedtotal > 0) { |
|
alert('$secnone'); |
|
return false; |
|
} |
|
} |
|
formname.state.value = nextstate; |
|
formname.submit(); |
|
return; |
|
} |
|
"; |
|
return $output; |
|
} |
|
|
|
sub section_check_alerts { |
|
my %lt = |
|
&Apache::lonlocal::texthash( |
|
reserved => "You need to change one or more LON-CAPA section names - none is a reserved word in the system, and may not be used.", |
|
badsec => 'You need to change one or more LON-CAPA section names - names may only contain letters or numbers.', |
|
separate => 'Separate multiple sections with a comma.' |
|
); |
|
return %lt; |
|
} |
|
|
|
sub section_check_javascript { |
|
return <<"END"; |
|
function validsection(field,mult) { |
|
var str = field.value; |
|
var badsec=0; |
|
var reserved=0; |
|
if (window.RegExp) { |
|
var badsecnum=0; |
|
var reservednum=0; |
|
var pattern=/[^a-zA-Z0-9]/; |
|
str = str.replace(/(^\\s*)|(\\s*\$)/gi,""); |
|
str = str.replace(/[ ]{2,}/gi," "); |
|
if (mult == '1') { |
|
var sections = new Array(); |
|
sections = str.split(/\\s*[\\s,;:]\\s*/); |
|
var i; |
|
for (i=0; i<sections.length; i++) { |
|
if ((sections[i] != '') && (sections[i] != undefined) && (sections[i] != null)) { |
|
if (pattern.test(sections[i])) { |
|
badsecnum++; |
|
} else { |
|
if (sections[i] == 'none') { |
|
reservednum++; |
|
} |
|
} |
|
} |
|
} |
|
} else { |
|
if ((str != '') && (str != undefined) && (str != null)) { |
|
if (pattern.test(str)) { |
|
badsecnum++; |
|
} else { |
|
if (str == 'none') { |
|
reservednum++; |
|
} |
|
} |
|
} |
|
} |
|
if (badsecnum > 0) { |
|
return 'badsec'; |
|
} |
|
if (reservednum > 0) { |
|
return 'reserved'; |
|
} |
|
} |
|
return; |
|
} |
|
END |
|
} |
|
|
|
sub close_popup_form { |
|
my $close= &mt('Close Window'); |
|
return << "END"; |
|
<p><form name="displayreq" action="" method="post"> |
|
<input type="button" name="closeme" value="$close" onclick="javascript:self.close();" /> |
|
</form></p> |
|
END |
|
} |
|
|
|
sub get_instcode { |
|
my ($dom) = @_; |
|
my ($instcode,$numtitles); |
|
my (@codetitles,%cat_titles,%cat_order,@code_order,$instcode,$code_chk); |
|
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, |
|
\%cat_order,\@code_order); |
|
$numtitles = scalar(@codetitles); |
|
if (@code_order > 0) { |
|
my $message; |
|
foreach my $item (@code_order) { |
|
$instcode .= $env{'form.instcode_'.$item}; |
|
} |
|
} |
|
return ($instcode,$numtitles); |
|
} |
|
|
sub print_request_form { |
sub print_request_form { |
my ($r,$action,$state,$page,$states,$dom) = @_; |
my ($r,$action,$state,$page,$states,$dom,$newinstcode,$codechk,$checkedcode, |
|
$description,$invalidcrosslist) = @_; |
my $formname = 'requestcrs'; |
my $formname = 'requestcrs'; |
my ($next,$prev,$message,$output,$codepicker,$crstype); |
my ($next,$prev,$message,$output,$codepicker,$crstype); |
$prev = $states->{$action}[$page-1]; |
$prev = $states->{$action}[$page-1]; |
Line 754 sub print_request_form {
|
Line 1291 sub print_request_form {
|
next => 'Next', |
next => 'Next', |
); |
); |
$crstype = $env{'form.crstype'}; |
$crstype = $env{'form.crstype'}; |
$r->print('<form name="'.$formname.'" method="post" action="/adm/requestcourse">'); |
$r->print('<br /><form name="'.$formname.'" method="post" action="/adm/requestcourse">'); |
my (@codetitles,%cat_titles,%cat_order,@code_order,$instcode,$code_chk); |
my (@codetitles,%cat_titles,%cat_order,@code_order,$instcode,$code_chk, |
|
@disallowed); |
if ($crstype eq 'official') { |
if ($crstype eq 'official') { |
if ($env{'form.instcode'} ne '') { |
if ($env{'form.instcode'} ne '') { |
$instcode = $env{'form.instcode'}; |
$instcode = $env{'form.instcode'}; |
|
} elsif ($newinstcode ne '') { |
|
$instcode = $newinstcode; |
} |
} |
} |
if ($checkedcode) { |
if ($prev eq 'codepick') { |
if ($codechk eq 'valid') { |
if ($crstype eq 'official') { |
$message = '<div class="LC_info">'. |
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, |
&mt('The chosen course category [_1] is valid.','<b>'. |
\%cat_order,\@code_order); |
$instcode.'</b>'). |
} |
'<input type="hidden" name="instcode" value="'. |
if (@code_order > 0) { |
$instcode.'" /></div>'; |
my $message; |
|
if ($instcode eq '') { |
|
foreach my $item (@code_order) { |
|
$instcode .= $env{'form.instcode_'.$item}; |
|
} |
|
$r->print('<input type="hidden" name="instcode" value="'.$instcode.'" />'."\n"); |
|
} |
|
if ($instcode ne '') { |
|
$code_chk = &Apache::lonnet::auto_validate_instcode('',$dom,$instcode); |
|
if ($code_chk eq 'valid') { |
|
$message = '<div class="LC_info">'. |
|
&mt('The chosen course category [_1] is valid.','<b>'. |
|
$instcode.'</b>').'</div>'; |
|
} else { |
|
$message = '<div class="LC_warning">'. |
|
&mt('No course was found matching your choice of institutional course category.'); |
|
if ($code_chk ne '') { |
|
$message .= '<br />'.$code_chk; |
|
} |
|
$message .= '</div>'; |
|
} |
|
} else { |
} else { |
$message = '<div class="LC_warning">'. |
$message = '<div class="LC_warning">'. |
&mt('No course was found matching your choice of institutional course category.'); |
&mt('No course was found matching your choice of institutional course category.'); |
} |
if ($codechk ne '') { |
unless ($code_chk eq 'ok') { |
$message .= '<br />'.$codechk; |
|
} |
|
$message .= '</div>'; |
$prev = 'crstype'; |
$prev = 'crstype'; |
} |
} |
$r->print($message); |
$r->print($message); |
Line 807 sub print_request_form {
|
Line 1328 sub print_request_form {
|
$codepicker = &coursecode_form($dom,'instcode',\@codetitles, |
$codepicker = &coursecode_form($dom,'instcode',\@codetitles, |
\%cat_titles,\%cat_order); |
\%cat_titles,\%cat_order); |
if ($codepicker) { |
if ($codepicker) { |
$r->print('<div>'.&Apache::lonhtmlcommon::start_pick_box().$codepicker. |
$r->print(&mt('Specify the course to be created.'). |
|
'<div>'.&Apache::lonhtmlcommon::start_pick_box(). |
|
$codepicker. |
&Apache::lonhtmlcommon::end_pick_box().'</div>'); |
&Apache::lonhtmlcommon::end_pick_box().'</div>'); |
} else { |
} else { |
$next = $states->{$action}[$page+2]; |
$next = $states->{$action}[$page+2]; |
Line 820 sub print_request_form {
|
Line 1343 sub print_request_form {
|
$r->print(&courseinfo_form($dom,$formname,$crstype,$next)); |
$r->print(&courseinfo_form($dom,$formname,$crstype,$next)); |
} |
} |
} elsif ($prev eq 'codepick') { |
} elsif ($prev eq 'codepick') { |
if ($env{'form.instcode'} eq '') { |
if ($instcode eq '') { |
$prev = $states->{$action}[$page-2]; |
$prev = $states->{$action}[$page-2]; |
} |
} |
$r->print(&courseinfo_form($dom,$formname,$crstype,$next)); |
$r->print(&courseinfo_form($dom,$formname,$crstype,$next,$description)); |
} elsif ($state eq 'enrollment') { |
} elsif ($state eq 'enrollment') { |
if ($crstype eq 'official') { |
if ($crstype eq 'official') { |
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, |
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, |
\%cat_order,\@code_order); |
\%cat_order,\@code_order); |
} |
} |
$r->print(&print_enrollment_menu($formname,$instcode,$dom,\@codetitles, |
$r->print(&print_enrollment_menu($formname,$instcode,$dom,\@codetitles, |
\%cat_titles,\%cat_order,\@code_order)); |
\%cat_titles,\%cat_order,\@code_order, |
|
$invalidcrosslist)); |
} elsif ($state eq 'personnel') { |
} elsif ($state eq 'personnel') { |
$r->print(&print_personnel_menu($dom,$formname,$crstype)); |
$r->print(&print_personnel_menu($dom,$formname,$crstype,$invalidcrosslist)); |
} elsif ($state eq 'review') { |
} elsif ($state eq 'review') { |
|
my (%alerts,%rulematch,%inst_results,%curr_rules,%got_rules,%disallowmsg); |
|
my $now = time; |
|
for (my $i=0; $i<$env{'form.persontotal'}; $i++) { |
|
my $personname = $env{'form.person_'.$i.'_uname'}; |
|
my $persondom = $env{'form.person_'.$i.'_dom'}; |
|
if (($personname =~ /^$match_username$/) && |
|
($persondom =~ /^$match_domain$/)) { |
|
if (&Apache::lonnet::domain($persondom)) { |
|
my $personhome = |
|
&Apache::lonnet::homeserver($personname,$persondom); |
|
if ($personhome eq 'no_host') { |
|
if ($persondom ne $dom) { |
|
my $skipuser = 1; |
|
if ($env{'user.role.dc./'.$persondom.'/'}) { |
|
my ($start,$end) = split('.',$env{'user.role.dc./'.$persondom.'/'}); |
|
if (((!$start) || ($start < $now)) && |
|
((!$end) || ($end > $now))) { |
|
$skipuser = 0; |
|
} |
|
} |
|
if ($skipuser) { |
|
push(@disallowed,$i); |
|
$disallowmsg{$i} = &mt('[_1] was excluded because new users need be from the course domain','<tt>'.$personname.':'.$persondom.'</tt>'); |
|
next; |
|
} |
|
} |
|
if (&get_cancreate_status($persondom,$personname,$dom)) { |
|
my ($allowed,$msg) = |
|
&check_newuser_rules($persondom,$personname, |
|
\%alerts,\%rulematch,\%inst_results, |
|
\%curr_rules,\%got_rules); |
|
if ($allowed) { |
|
if (ref($inst_results{$personname.':'.$persondom}) eq 'HASH') { |
|
if ($inst_results{$personname.':'.$persondom}{'lastname'} ne '') { |
|
$env{'form.person_'.$i.'_lastname'} = $inst_results{$personname.':'.$persondom}{'lastname'}; |
|
} |
|
if ($inst_results{$personname.':'.$persondom}{'firstname'} ne '') { |
|
$env{'form.person_'.$i.'_firstname'} = $inst_results{$personname.':'.$persondom}{'firstname'}; |
|
} |
|
if ($inst_results{$personname.':'.$persondom}{'permanentemail'} ne '') { |
|
$env{'form.person_'.$i.'_emailaddr'} = $inst_results{$personname.':'.$persondom}{'permanentemail'}; |
|
} |
|
} |
|
} else { |
|
push(@disallowed,$i); |
|
$disallowmsg{$i} = &mt('[_1] was excluded because the username violated format rules for the domain','<tt>'.$personname.':'.$persondom.'</tt>'); |
|
} |
|
} else { |
|
push(@disallowed,$i); |
|
$disallowmsg{$i} = &mt('[_1] was excluded because you may not request new users in the domain','<tt>'.$personname.':'.$persondom.'</tt>'); |
|
} |
|
} else { |
|
my %userenv = |
|
&Apache::lonnet::userenvironment($persondom,$personname,'lastname','firstname','permanentemail'); |
|
if ($env{'form.person_'.$i.'_lastname'} eq '') { |
|
$env{'form.person_'.$i.'_lastname'} = $userenv{'lastname'}; |
|
} |
|
if ($env{'form.person_'.$i.'_firstname'} eq '') { |
|
$env{'form.person_'.$i.'_firstname'} = $userenv{'firstname'}; |
|
} |
|
if ($env{'form.person_'.$i.'_emailaddr'} eq '') { |
|
$env{'form.person_'.$i.'_emailaddr'} = $userenv{'permanentemail'}; |
|
} |
|
} |
|
} elsif ($personname ne '') { |
|
push(@disallowed,$i); |
|
$disallowmsg{$i} = &mt('[_1] was excluded because the domain is invalid','<tt>'.$personname.':'.$persondom.'</tt>'); |
|
} |
|
} elsif ($personname ne '') { |
|
push(@disallowed,$i); |
|
$disallowmsg{$i} = &mt('[_1] was excluded because the username or domain is invalid.','<tt>'.$personname.':'.$persondom.'</tt>'); |
|
} |
|
} |
my $cnum; |
my $cnum; |
if ($env{'form.origcnum'} =~ /^($match_courseid)$/) { |
if ($env{'form.origcnum'} =~ /^($match_courseid)$/) { |
$cnum = $env{'form.origcnum'}; |
$cnum = $env{'form.origcnum'}; |
Line 842 sub print_request_form {
|
Line 1439 sub print_request_form {
|
} |
} |
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, |
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, |
\%cat_order,\@code_order); |
\%cat_order,\@code_order); |
$r->print('<p>'.&mt('Review the details of the course request before submission.').'</p>'. |
$r->print('<h3>'.&mt('Review course request details before submission').'</h3>'. |
&print_review($formname,$dom,\@codetitles,\%cat_titles,\%cat_order, |
&print_review($dom,\@codetitles,\%cat_titles,\%cat_order,\@code_order,'','',\@disallowed,\%disallowmsg). |
\@code_order). |
|
'<input type="hidden" name="cnum" value="'.$cnum.'" />'); |
'<input type="hidden" name="cnum" value="'.$cnum.'" />'); |
$navtxt{'next'} = &mt('Submit course request'); |
$navtxt{'next'} = &mt('Submit course request'); |
} elsif ($state eq 'process') { |
} elsif ($state eq 'process') { |
Line 852 sub print_request_form {
|
Line 1448 sub print_request_form {
|
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, |
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, |
\%cat_order,\@code_order); |
\%cat_order,\@code_order); |
} |
} |
my $result = &print_request_outcome($dom,\@codetitles,\@code_order); |
my ($storeresult,$result) = &print_request_outcome($dom,\@codetitles, |
|
\@code_order); |
$r->print($result); |
$r->print($result); |
|
if (($storeresult eq 'ok') || ($storeresult eq 'created')) { |
|
$r->print('<p>'); |
|
if ($storeresult eq 'ok') { |
|
$r->print('<a href="/adm/requestcourse?action=view&state=details&showdom='.$dom.'&cnum='. $env{'form.cnum'}.'">'. |
|
&mt('Modify this request').'</a>'.(' 'x4)); |
|
} |
|
$r->print('<a href="/adm/requestcourse">'.&mt('Make another request').'</a></p>'); |
|
return; |
|
} |
} |
} |
my @excluded = &get_excluded_elements($dom,$states,$action,$state); |
my @excluded = &get_excluded_elements($dom,$states,$action,$state); |
|
if ($state eq 'personnel') { |
|
push(@excluded,'persontotal'); |
|
} |
|
if ($state eq 'review') { |
|
if (@disallowed > 0) { |
|
my @items = qw(uname dom lastname firstname emailaddr hidedom role newsec); |
|
my @currsecs = ¤t_lc_sections(); |
|
if (@currsecs) { |
|
push(@items,'sec'); |
|
} |
|
my $count = 0; |
|
for (my $i=0; $i<$env{'form.persontotal'}; $i++) { |
|
unless ($env{'form.person_'.$i.'_uname'} eq '') { |
|
if (grep(/^$i$/,@disallowed)) { |
|
foreach my $item (@items) { |
|
$env{'form.person_'.$i.'_'.$item} = ''; |
|
} |
|
} else { |
|
foreach my $item (@items) { |
|
$env{'form.person_'.$count.'_'.$item} = $env{'form.person_'.$i.'_'.$item}; |
|
} |
|
} |
|
} |
|
$count ++; |
|
} |
|
$env{'form.persontotal'} = $count; |
|
|
|
} |
|
} |
|
if ($state eq 'enrollment') { |
|
push(@excluded,'crosslisttotal'); |
|
} |
$r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'</form>'); |
$r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'</form>'); |
&display_navbuttons($r,$formname,$prev,$navtxt{'prev'},$next,$navtxt{'next'},$state); |
&display_navbuttons($r,$dom,$formname,$prev,$navtxt{'prev'},$next, |
|
$navtxt{'next'},$state); |
return; |
return; |
} |
} |
|
|
|
sub get_cancreate_status { |
|
my ($persondom,$personname,$dom) = @_; |
|
my ($rules,$ruleorder) = |
|
&Apache::lonnet::inst_userrules($persondom,'username'); |
|
my $usertype = &Apache::lonuserutils::check_usertype($persondom,$personname, |
|
$rules); |
|
return &Apache::lonuserutils::can_create_user($dom,'requestcrs',$usertype); |
|
} |
|
|
|
sub check_newuser_rules { |
|
my ($persondom,$personname,$alerts,$rulematch,$inst_results,$curr_rules, |
|
$got_rules) = @_; |
|
my $allowed = 1; |
|
my $newuser = 1; |
|
my ($checkhash,$userchkmsg); |
|
my $checks = { 'username' => 1 }; |
|
$checkhash->{$personname.':'.$persondom} = { 'newuser' => $newuser }; |
|
&Apache::loncommon::user_rule_check($checkhash,$checks,$alerts,$rulematch, |
|
$inst_results,$curr_rules,$got_rules); |
|
if (ref($alerts->{'username'}) eq 'HASH') { |
|
if (ref($alerts->{'username'}{$persondom}) eq 'HASH') { |
|
my $domdesc = |
|
&Apache::lonnet::domain($persondom,'description'); |
|
if ($alerts->{'username'}{$persondom}{$personname}) { |
|
if (ref($curr_rules->{$persondom}) eq 'HASH') { |
|
$userchkmsg = |
|
&Apache::loncommon::instrule_disallow_msg('username', |
|
$domdesc,1). |
|
&Apache::loncommon::user_rule_formats($persondom, |
|
$domdesc,$curr_rules->{$persondom}{'username'}, |
|
'username'); |
|
} |
|
$allowed = 0; |
|
} |
|
} |
|
} |
|
return ($allowed,$userchkmsg); |
|
} |
|
|
sub get_excluded_elements { |
sub get_excluded_elements { |
my ($dom,$states,$action,$state) = @_; |
my ($dom,$states,$action,$state) = @_; |
my @excluded = ('counter'); |
my @excluded = ('counter'); |
Line 890 sub get_excluded_elements {
|
Line 1568 sub get_excluded_elements {
|
} |
} |
|
|
sub print_enrollment_menu { |
sub print_enrollment_menu { |
my ($formname,$instcode,$dom,$codetitles,$cat_titles,$cat_order,$code_order) =@_; |
my ($formname,$instcode,$dom,$codetitles,$cat_titles,$cat_order,$code_order, |
my ($sections,$autoenroll,$access_dates); |
$invalidcrosslist) =@_; |
|
my ($sections,$autoenroll,$access_dates,$output,$hasauto); |
my $starttime = time; |
my $starttime = time; |
my $endtime = time+(6*30*24*60*60); # 6 months from now, approx |
my $endtime = time+(6*30*24*60*60); # 6 months from now, approx |
|
|
Line 905 sub print_enrollment_menu {
|
Line 1584 sub print_enrollment_menu {
|
); |
); |
if ($env{'form.crstype'} eq 'official') { |
if ($env{'form.crstype'} eq 'official') { |
if (&Apache::lonnet::auto_run('',$dom)) { |
if (&Apache::lonnet::auto_run('',$dom)) { |
my ($section_form,$crosslist_form,$autoenroll_form); |
$output = &show_invalid_crosslists($invalidcrosslist); |
|
my ($section_form,$crosslist_form); |
$section_form = &inst_section_selector($dom,$instcode); |
$section_form = &inst_section_selector($dom,$instcode); |
|
if ($section_form) { |
|
$sections = &Apache::lonhtmlcommon::row_headline(). |
|
'<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Sections'). |
|
' '.&mt('Sections for auto-enrollment').'</h3>'. |
|
&Apache::lonhtmlcommon::row_closure(1). |
|
$section_form; |
|
} |
my $crosslisttotal = $env{'form.crosslisttotal'}; |
my $crosslisttotal = $env{'form.crosslisttotal'}; |
if (!defined($crosslisttotal)) { |
if (!$crosslisttotal) { |
$crosslisttotal = 1; |
$crosslisttotal = 1; |
} |
} |
if ($env{'form.addcrosslist'}) { |
if ($env{'form.addcrosslist'}) { |
Line 924 sub print_enrollment_menu {
|
Line 1611 sub print_enrollment_menu {
|
'<input name="crosslisttotal" type="hidden" value="'.$crosslisttotal.'" />'. |
'<input name="crosslisttotal" type="hidden" value="'.$crosslisttotal.'" />'. |
'<input name="addcrosslist" type="checkbox" value="'.$crosslisttotal.'"'. |
'<input name="addcrosslist" type="checkbox" value="'.$crosslisttotal.'"'. |
' onclick="javascript:nextPage(document.'.$formname.",'".$env{'form.state'}. |
' onclick="javascript:nextPage(document.'.$formname.",'".$env{'form.state'}. |
"'".');" />'.&mt('Add?').&Apache::lonhtmlcommon::row_closure(1); |
"'".');" />'.&mt('Add?').&Apache::lonhtmlcommon::row_closure(); |
} |
$sections .= &Apache::lonhtmlcommon::row_headline. |
if ($section_form || $crosslist_form) { |
'<h3>'.&mt('Crosslisted courses for auto-enrollment').'</h3>'. |
$sections = '<div>'.&Apache::lonhtmlcommon::start_pick_box(). |
&Apache::lonhtmlcommon::row_closure(1). |
$section_form.$crosslist_form. |
$crosslist_form; |
&Apache::lonhtmlcommon::end_pick_box().'</div>'."\n"; |
} |
} |
$hasauto = 1; |
$autoenroll_form = |
$autoenroll = |
&Apache::lonhtmlcommon::row_title(&mt('Add registered students automatically')). |
&Apache::lonhtmlcommon::row_title(&Apache::loncommon::help_open_topic('Course_Request_Autoadd').' '.&mt('Add registered students automatically')). |
'<span class="LC_nobreak"><label>'. |
'<span class="LC_nobreak"><label>'. |
'<input type="radio" name="autoadds" value="1">'. |
'<input type="radio" name="autoadds" value="1">'. |
&mt('Yes').'</label>'.(' 'x3).'<label>'. |
&mt('Yes').'</label>'.(' 'x3).'<label>'. |
'<input type="radio" name="autoadds" value="0" checked="checked">'. |
'<input type="radio" name="autoadds" value="0" checked="checked">'. |
&mt('No').'</label></span>'. |
&mt('No').'</label></span>'. |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_title(&mt('Drop unregistered students automatically')). |
&Apache::lonhtmlcommon::row_title(&Apache::loncommon::help_open_topic('Course_Request_Autodrop').' '.&mt('Drop unregistered students automatically')). |
'<span class="LC_nobreak"><label>'. |
'<span class="LC_nobreak"><label>'. |
'<input type="radio" name="autodrops" value="1">'. |
'<input type="radio" name="autodrops" value="1">'. |
&mt('Yes').'</label>'.(' 'x3).'<label>'. |
&mt('Yes').'</label>'.(' 'x3).'<label>'. |
'<input type="radio" name="autodrops" value="0" checked="checked">'. |
'<input type="radio" name="autodrops" value="0" checked="checked">'. |
&mt('No').'</label></span>'. |
&mt('No').'</label></span>'. |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_closure(1). |
&date_setting_table($starttime,$endtime,$formname,'enroll',%enrolltitles); |
&date_setting_table($starttime,$endtime,$formname,'enroll', |
if ($autoenroll_form) { |
$hasauto,%enrolltitles); |
$autoenroll = '<div>'.&Apache::lonhtmlcommon::start_pick_box(). |
} |
$autoenroll_form. |
} |
&Apache::lonhtmlcommon::end_pick_box().'</div>'."\n"; |
my $access_dates = |
|
&date_setting_table($starttime,$endtime,$formname,'access',$hasauto, |
|
%accesstitles); |
|
$output .= &Apache::lonhtmlcommon::start_pick_box(); |
|
if ($sections) { |
|
$output .= $sections; |
|
} |
|
if ($autoenroll) { |
|
$output .= &Apache::lonhtmlcommon::row_headline('Auto-enroll'). |
|
'<h3>'.&mt('Auto-enrollment settings').'</h3>'. |
|
&Apache::lonhtmlcommon::row_closure(1). |
|
$autoenroll; |
|
} |
|
if ($access_dates) { |
|
my $header = &mt('Access dates for students'); |
|
if ($env{'form.crstype'} eq 'community') { |
|
$header = &mt('Access dates for community members'); |
|
} |
|
$output .= &Apache::lonhtmlcommon::row_headline('Access'). |
|
'<h3>'.$header.'</h3>'. |
|
&Apache::lonhtmlcommon::row_closure(1). |
|
$access_dates |
|
} |
|
return '<div>'.&Apache::lonhtmlcommon::start_pick_box().$output. |
|
&Apache::lonhtmlcommon::end_pick_box().'</div>'; |
|
} |
|
|
|
sub show_invalid_crosslists { |
|
my ($invalidcrosslist) = @_; |
|
my $output; |
|
if (ref($invalidcrosslist) eq 'ARRAY') { |
|
if (@{$invalidcrosslist} > 0) { |
|
$output = '<div class="LC_warning">'. |
|
&mt('The following crosslisted courses were invalid:').'<ul>'; |
|
foreach my $item (@{$invalidcrosslist}) { |
|
$output .= '<li>'.$item.'</li>'; |
} |
} |
|
$output .= '</ul></div><br />'; |
} |
} |
} |
} |
my $access_dates_form = |
return $output; |
&date_setting_table($starttime,$endtime,$formname,'access',%accesstitles); |
|
if ($access_dates_form) { |
|
$access_dates = '<div>'.&Apache::lonhtmlcommon::start_pick_box(). |
|
$access_dates_form. |
|
&Apache::lonhtmlcommon::end_pick_box().'</div>'."\n"; |
|
} |
|
return $sections.$autoenroll.$access_dates; |
|
} |
} |
|
|
|
|
sub inst_section_selector { |
sub inst_section_selector { |
my ($dom,$instcode) = @_; |
my ($dom,$instcode) = @_; |
my @sections = &Apache::lonnet::auto_get_sections(undef,$dom,$instcode); |
my @sections = &Apache::lonnet::auto_get_sections(undef,$dom,$instcode); |
my $sectotal = scalar(@sections); |
my $sectotal = scalar(@sections); |
my $output; |
my $output; |
if ($sectotal) { |
if ($sectotal) { |
$output .= &Apache::lonhtmlcommon::row_title('Sections'). |
$output .= &Apache::lonhtmlcommon::row_title(&mt('Sections of [_1]',$instcode)). |
&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<th>'.&mt('Include?').'<input type="hidden" name="sectotal" '. |
'<th>'.&mt('Include?').'<input type="hidden" name="sectotal" '. |
'value="'.$sectotal.'"</th>'. |
'value="'.$sectotal.'" /></th>'. |
'<th>'.&mt('Institutional Section').'</th>'. |
'<th>'.&mt('Institutional Section').'</th>'. |
'<th>'.&mt('LON-CAPA section').'</th>'. |
'<th>'.&Apache::loncommon::help_open_topic('Course_Request_LCSection'). |
|
' '.&mt('LON-CAPA section').'</th>'. |
&Apache::loncommon::end_data_table_row(); |
&Apache::loncommon::end_data_table_row(); |
for (my $i=0; $i<@sections; $i++) { |
for (my $i=0; $i<@sections; $i++) { |
my $colflag = $i%2; |
my $colflag = $i%2; |
|
my $secon = ' checked="checked"'; |
|
my $secoff = ''; |
|
if ($env{'form.origcnum'}) { |
|
$secoff = $secon; |
|
$secon=''; |
|
} |
$output .= &Apache::loncommon::start_data_table_row(). |
$output .= &Apache::loncommon::start_data_table_row(). |
'<td><input type="checkbox" name="sec_'.$i. |
'<td><label><input type="radio" name="sec_'.$i. |
'" checked="checked" /></td>'. |
'"'.$secon.' value="1" />'.&mt('Yes').'</label>'. |
'<td>'.$sections[$i]. |
(' 'x2).'<label><input type="radio" name="sec_'.$i. |
|
'"'.$secoff.' value="0" />'.&mt('No').'</label></td>'. |
|
'<td align="center">'.$sections[$i]. |
'<input type="hidden" name="secnum_'.$i.'" value="'. |
'<input type="hidden" name="secnum_'.$i.'" value="'. |
$sections[$i].'" /></td>'. |
$sections[$i].'" /></td>'. |
'<td><input type="text" size="10" name="loncapasec_'.$i. |
'<td><input type="text" size="10" name="loncapasec_'.$i. |
Line 997 sub inst_section_selector {
|
Line 1723 sub inst_section_selector {
|
} |
} |
|
|
sub date_setting_table { |
sub date_setting_table { |
my ($starttime,$endtime,$formname,$prefix,%datetitles) = @_; |
my ($starttime,$endtime,$formname,$prefix,$hasauto,%datetitles) = @_; |
my ($perpetual,$table); |
my ($perpetual,$table); |
my $startform = &Apache::lonhtmlcommon::date_setter($formname,$prefix.'start', |
my $startform = &Apache::lonhtmlcommon::date_setter($formname,$prefix.'start', |
$starttime,'','','',1,'','','',1); |
$starttime,'','','',1,'','','',1); |
my $endform = &Apache::lonhtmlcommon::date_setter($formname,$prefix.'end', |
my $endform = &Apache::lonhtmlcommon::date_setter($formname,$prefix.'end', |
$endtime,'','','',1,'','','',1); |
$endtime,'','','',1,'','','',1); |
|
my $closure = ''; |
if ($prefix eq 'access') { |
if ($prefix eq 'access') { |
$perpetual = ' <span class="LC_nobreak"><label>'. |
$perpetual = ' <span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="no_end_date" />'. |
'<input type="checkbox" name="no_end_date" />'. |
&mt('No end date').'</label></span>'; |
&mt('No end date').'</label></span>'; |
|
$closure = '1'; |
|
} |
|
|
|
my %help_item = ( |
|
access => { |
|
start => 'Course_Request_Access_Start', |
|
end => 'Course_Request_Access_End', |
|
}, |
|
enroll => { |
|
start => 'Course_Request_Enroll_Start', |
|
end => 'Course_Request_Enroll_End', |
|
}, |
|
); |
|
if ($hasauto) { |
|
$help_item{'access'}{'start'} = 'Course_Request_RegAccess_Start'; |
|
$help_item{'access'}{'end'} = 'Course_Request_RegAccess_End'; |
} |
} |
$table = &Apache::lonhtmlcommon::row_title($datetitles{'start'}). |
|
$startform. |
$table = &Apache::lonhtmlcommon::row_title(&Apache::loncommon::help_open_topic($help_item{$prefix}{'start'}). |
&Apache::lonhtmlcommon::row_closure(). |
' '.$datetitles{'start'}).$startform. |
&Apache::lonhtmlcommon::row_title($datetitles{'end'}). |
&Apache::lonhtmlcommon::row_closure(1). |
$endform.$perpetual. |
&Apache::lonhtmlcommon::row_title(&Apache::loncommon::help_open_topic($help_item{$prefix}{'end'}). |
&Apache::lonhtmlcommon::row_closure(1); |
' '.$datetitles{'end'}).$endform.$perpetual. |
|
&Apache::lonhtmlcommon::row_closure($closure); |
return $table; |
return $table; |
} |
} |
|
|
sub print_personnel_menu { |
sub print_personnel_menu { |
my ($dom,$formname,$crstype) = @_; |
my ($dom,$formname,$crstype,$invalidcrosslist) = @_; |
my $output = '<div>'.&Apache::lonhtmlcommon::start_pick_box(); |
my $output; |
|
if ($crstype eq 'official') { |
|
if (&Apache::lonnet::auto_run('',$dom)) { |
|
$output .= &show_invalid_crosslists($invalidcrosslist); |
|
} |
|
} |
|
$output .= '<div>'.&Apache::lonhtmlcommon::start_pick_box(); |
my $persontotal = $env{'form.persontotal'}; |
my $persontotal = $env{'form.persontotal'}; |
if ((!defined($persontotal)) || (!$persontotal)) { |
if ((!defined($persontotal)) || (!$persontotal)) { |
$persontotal = 1; |
$persontotal = 1; |
Line 1027 sub print_personnel_menu {
|
Line 1777 sub print_personnel_menu {
|
if ($env{'form.addperson'}) { |
if ($env{'form.addperson'}) { |
$persontotal ++; |
$persontotal ++; |
} |
} |
my $userlinktxt = &mt('Set User'); |
|
my @items = ('uname','dom','lastname','firstname','emailaddr','hidedom'); |
my @items = ('uname','dom','lastname','firstname','emailaddr','hidedom'); |
|
|
my $roleoptions; |
my $roleoptions; |
Line 1037 sub print_personnel_menu {
|
Line 1786 sub print_personnel_menu {
|
$type = 'Community'; |
$type = 'Community'; |
} |
} |
foreach my $role (@roles) { |
foreach my $role (@roles) { |
my $plrole=&Apache::lonnet::plaintext($role,$type); |
my $plrole = &Apache::lonnet::plaintext($role,$type); |
$roleoptions .= ' <option value="'.$role.'">'.$plrole.'</option>'."\n"; |
$roleoptions .= ' <option value="'.$role.'">'.$plrole.'</option>'."\n"; |
} |
} |
my %customroles=&Apache::lonuserutils::my_custom_roles(); |
my %customroles=&Apache::lonuserutils::my_custom_roles(); |
if (keys(%customroles) > 0) { |
if (keys(%customroles) > 0) { |
foreach my $cust (sort(keys(%customroles))) { |
foreach my $cust (sort(keys(%customroles))) { |
my $custrole='cr_cr_'.$env{'user.domain'}. |
my $custrole="cr/$env{'user.domain'}/$env{'user.name'}/$cust"; |
'_'.$env{'user.name'}.'_'.$cust; |
|
$roleoptions .= ' <option value="'.$custrole.'">'.$cust.'</option>'."\n"; |
$roleoptions .= ' <option value="'.$custrole.'">'.$cust.'</option>'."\n"; |
} |
} |
} |
} |
|
|
my @currsecs; |
my @currsecs = ¤t_lc_sections(); |
if ($env{'form.sectotal'}) { |
|
for (my $i=0; $i<$env{'form.sectotal'}; $i++) { |
|
if (defined($env{'form.loncapasec_'.$i})) { |
|
my $lcsec = $env{'form.loncapasec_'.$i}; |
|
unless (grep(/^\Q$lcsec\E$/,@currsecs)) { |
|
push(@currsecs,$lcsec); |
|
} |
|
} |
|
} |
|
} |
|
|
|
my ($existtitle,$existops,$existmult,$newtitle,$seccolspan); |
my ($existtitle,$existops,$existmult,$newtitle,$seccolspan); |
if (@currsecs) { |
if (@currsecs) { |
Line 1080 sub print_personnel_menu {
|
Line 1818 sub print_personnel_menu {
|
$newtitle = &mt('Other').': '; |
$newtitle = &mt('Other').': '; |
} |
} |
|
|
|
if ($persontotal) { |
|
my %lt = &Apache::lonlocal::texthash( |
|
community => 'Requestor is automatically assigned Coordinator role.', |
|
official => 'Requestor is automatically assigned Course Coordinator role.', |
|
); |
|
$lt{'unofficial'} = $lt{'official'}; |
|
$output .= &Apache::lonhtmlcommon::row_headline(). |
|
'<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Personnel').' '.$lt{$crstype}.' '.&mt('Include other personnel?').'</h3>'; |
|
} |
for (my $i=0; $i<$persontotal; $i++) { |
for (my $i=0; $i<$persontotal; $i++) { |
my @linkargs = map { 'person_'.$i.'_'.$_ } (@items); |
my @linkargs = map { 'person_'.$i.'_'.$_ } (@items); |
my $linkargstr = join("','",@linkargs); |
my $linkargstr = join("','",@linkargs); |
my $userlink = &Apache::loncommon::selectuser_link($formname,@linkargs,$dom,$userlinktxt); |
my $uname_form = '<input type="text" name="person_'.$i.'_uname" value="" size="20" />'; |
my $uname_form = '<input type="text" name="person_'.$i.'_uname" value=""'. |
|
' onFocus="this.blur();'. |
|
'openuserbrowser('."'$formname','$linkargstr','$dom'".');" />'; |
|
my $onchange = 'javascript:fix_domain('."'$formname','person_".$i."_dom',". |
my $onchange = 'javascript:fix_domain('."'$formname','person_".$i."_dom',". |
"'person_".$i."_hidedom'".');'. |
"'person_".$i."_hidedom','person_".$i."_uname'".');'; |
'openuserbrowser('."'$formname','$linkargstr','$dom'".');'; |
|
my $udom_form = &Apache::loncommon::select_dom_form($dom,'person_'.$i.'_dom','', |
my $udom_form = &Apache::loncommon::select_dom_form($dom,'person_'.$i.'_dom','', |
1,$onchange). |
1,$onchange). |
'<input type="hidden" name="person_'.$i.'_hidedom" value="'.$dom.'" />'; |
'<input type="hidden" name="person_'.$i.'_hidedom" value="" />'; |
my %form_elems; |
my %form_elems; |
foreach my $item (@items) { |
foreach my $item (@items) { |
next if (($item eq 'dom') || ($item eq 'uname') || ($item eq 'hidedom')); |
next if (($item eq 'dom') || ($item eq 'uname') || ($item eq 'hidedom')); |
Line 1108 sub print_personnel_menu {
|
Line 1851 sub print_personnel_menu {
|
} |
} |
$sectionselector .= $newtitle. |
$sectionselector .= $newtitle. |
'<input type="text" name="person_'.$i.'_newsec" size="15" value="" />'."\n"; |
'<input type="text" name="person_'.$i.'_newsec" size="15" value="" />'."\n"; |
|
my $usersrchlinktxt = &mt('Search for user'); |
|
my $usersrchlink = &Apache::loncommon::selectuser_link($formname,@linkargs,$dom, |
|
$usersrchlinktxt); |
|
my $userchklinktxt = &mt('Check username'); |
|
my $userchklink = &Apache::loncommon::selectuser_link($formname,@linkargs,$dom, |
|
$userchklinktxt,'checkusername'); |
$output .= |
$output .= |
&Apache::lonhtmlcommon::row_title(&mt('Additional Personnel').'<br />'. |
&Apache::lonhtmlcommon::row_title(&mt('Additional Personnel')). |
'<span class="LC_nobreak">'.$userlink. |
'<table><tr><td align="center" valign="middle"><b>'.$usersrchlink.'</b></td>'."\n". |
'</span>'). |
'<td align="left" valign="top" colspan="2"><span class="LC_nobreak">'. |
'<table><tr><td align="center" valign="top">'.&mt('Username').'<br />'.$uname_form.'</td>'."\n". |
&mt('Username').': '.$uname_form.' '.$userchklink.'</span><br />'."\n". |
'<td align="center" valign="top" colspan="2">'.&mt('Domain').'<br />'.$udom_form.'</td></tr><tr>'."\n". |
'<span class="LC_nobreak">'.&mt('Domain').': '.$udom_form.'</span></td>'. |
|
'</tr>'."\n".'<tr>'. |
'<td align="center" valign="top">'.&mt('First Name').'<br />'.$form_elems{'firstname'}.'</td>'."\n". |
'<td align="center" valign="top">'.&mt('First Name').'<br />'.$form_elems{'firstname'}.'</td>'."\n". |
'<td align="center" valign="top">'.&mt('Last Name').'<br />'.$form_elems{'lastname'}.'</td>'."\n". |
'<td align="center" valign="top">'.&mt('Last Name').'<br />'.$form_elems{'lastname'}.'</td>'."\n". |
'<td align="center" valign="top">'.&mt('E-mail').'<br />'.$form_elems{'emailaddr'}.'</td></tr>'."\n". |
'<td align="center" valign="top">'.&mt('E-mail').'<br />'.$form_elems{'emailaddr'}.'</td></tr>'."\n". |
'<tr><td align="center" valign="top">'.&mt('Role').'<br />'.$roleselector.'</td>'."\n". |
'<tr><td align="center" valign="top">'.&Apache::loncommon::help_open_topic('Course_Roles').' '.&mt('Role').'<br />'.$roleselector.'</td>'."\n". |
'<td'.$seccolspan.' align="center" valign="top">'.&mt('Section(s)').'<br />'.$sectionselector.'</td>'."\n". |
'<td'.$seccolspan.' align="center" valign="top">'. |
|
&Apache::loncommon::help_open_topic('Course_Request_Rolesection').' '.&mt('LON-CAPA Section(s)').'<br />'.$sectionselector.'</td>'."\n". |
'</tr></table>'.&Apache::lonhtmlcommon::row_closure(); |
'</tr></table>'.&Apache::lonhtmlcommon::row_closure(); |
} |
} |
$output .= &Apache::lonhtmlcommon::row_title(&mt('Add another?')). |
$output .= &Apache::lonhtmlcommon::row_title(&mt('Add another?')). |
Line 1126 sub print_personnel_menu {
|
Line 1877 sub print_personnel_menu {
|
'<input name="addperson" type="checkbox" value="'.$persontotal.'"'. |
'<input name="addperson" type="checkbox" value="'.$persontotal.'"'. |
' onclick="javascript:nextPage(document.'.$formname.",'".$env{'form.state'}. |
' onclick="javascript:nextPage(document.'.$formname.",'".$env{'form.state'}. |
"'".');" />'.&mt('Add?').&Apache::lonhtmlcommon::row_closure(1). |
"'".');" />'.&mt('Add?').&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::end_pick_box().'</div>'; |
&Apache::lonhtmlcommon::end_pick_box().'</div>'. |
|
'<p>'.&mt('You may also add users later, once the course has been created, by using the "Manage course users" link, accessible from the "Main Menu".').'</p>'; |
return $output; |
return $output; |
} |
} |
|
|
|
sub current_lc_sections { |
|
my @currsecs; |
|
if ($env{'form.sectotal'}) { |
|
for (my $i=0; $i<$env{'form.sectotal'}; $i++) { |
|
if ($env{'form.sec_'.$i}) { |
|
if (defined($env{'form.loncapasec_'.$i})) { |
|
my $lcsec = $env{'form.loncapasec_'.$i}; |
|
unless (grep(/^\Q$lcsec\E$/,@currsecs)) { |
|
push(@currsecs,$lcsec); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return @currsecs; |
|
} |
|
|
sub print_request_status { |
sub print_request_status { |
my ($dom) = @_; |
my ($dom) = @_; |
my %statusinfo = &Apache::lonnet::dump('courserequests',$env{'user.domain'}, |
my %statusinfo = &Apache::lonnet::dump('courserequests',$env{'user.domain'}, |
$env{'user.name'},'^status:'.$dom); |
$env{'user.name'},'^status:'.$dom); |
my ($output,$formname,%queue_by_date,%typenames); |
my ($output,$formname,%queue_by_date); |
if ($env{'form.crstype'} eq 'any') { |
my ($types,$typenames) = &Apache::loncommon::course_types(); |
%typenames = &Apache::lonlocal::texthash ( |
|
official => 'Official course', |
|
unofficial => 'Unofficial course', |
|
community => 'Community', |
|
); |
|
} |
|
foreach my $key (keys(%statusinfo)) { |
foreach my $key (keys(%statusinfo)) { |
if (($statusinfo{$key} eq 'approval') || ($statusinfo{$key} eq 'pending')) { |
if (($statusinfo{$key} eq 'approval') || ($statusinfo{$key} eq 'pending')) { |
(undef,my($cdom,$cnum)) = split(':',$key); |
(undef,my($cdom,$cnum)) = split(':',$key); |
Line 1212 sub print_request_status {
|
Line 1975 sub print_request_status {
|
'<td>'.&unescape($desc).'</td>'. |
'<td>'.&unescape($desc).'</td>'. |
'<td>'.$cdom.'</td>'; |
'<td>'.$cdom.'</td>'; |
if ($env{'form.crstype'} eq 'any') { |
if ($env{'form.crstype'} eq 'any') { |
my $typename = $typenames{$type}; |
my $typename; |
|
if (ref($typenames) eq 'HASH') { |
|
$typename = &mt($typenames->{$type}); |
|
} |
if ($typename eq '') { |
if ($typename eq '') { |
$typename = &mt('Unknown type'); |
$typename = &mt('Unknown type'); |
} |
} |
Line 1238 sub print_request_status {
|
Line 2004 sub print_request_status {
|
$output .= '<div>'.&mt('You have no matching course requests awaiting approval by a Domain Coordinator or held in a queue pending administrative action at your institution.').'</div>'; |
$output .= '<div>'.&mt('You have no matching course requests awaiting approval by a Domain Coordinator or held in a queue pending administrative action at your institution.').'</div>'; |
} |
} |
$output .= ' |
$output .= ' |
<br /><input type="button" name="prev" value="'.&mt('Back').'" onclick="javascript:backPage(document.'.$formname.",'crstype'".')" /> |
<br /><input type="button" name="prev" value="'.&mt('Back').'" onclick="javascript:backPage(document.'.$formname.",'crstype'".')" />'; |
</form></div>'; |
|
return $output; |
return $output; |
} |
} |
|
|
Line 1261 sub print_cancel_request {
|
Line 2026 sub print_cancel_request {
|
} |
} |
$output = &mt('No further action will be taken'); |
$output = &mt('No further action will be taken'); |
} elsif (ref($history{'details'}) eq 'HASH') { |
} elsif (ref($history{'details'}) eq 'HASH') { |
my ($types,$typename) = &course_types(); |
my ($types,$typename) = &Apache::loncommon::course_types(); |
my $showtype = $crstype; |
my $showtype = $crstype; |
if (defined($typename->{$crstype})) { |
if (defined($typename->{$crstype})) { |
$showtype = $typename->{$crstype}; |
$showtype = $typename->{$crstype}; |
Line 1345 sub print_request_logs {
|
Line 2110 sub print_request_logs {
|
} |
} |
|
|
sub print_review { |
sub print_review { |
my ($formname,$dom,$codetitles,$cat_titles,$cat_order,$code_order) = @_; |
my ($dom,$codetitles,$cat_titles,$cat_order,$code_order,$uname,$udom, |
my ($types,$typename) = &course_types(); |
$disallowed,$disallowmsg) = @_; |
|
my ($types,$typename) = &Apache::loncommon::course_types(); |
my ($owner,$ownername,$owneremail); |
my ($owner,$ownername,$owneremail); |
$owner = $env{'user.name'}.':'.$env{'user.domain'}; |
if ($uname eq '' || $udom eq '') { |
$ownername = &Apache::loncommon::plainname($env{'user.name'}, |
$uname = $env{'user.name'}; |
$env{'user.domain'},'first'); |
$udom = $env{'user.domain'}; |
my %emails = &Apache::loncommon::getemails(); |
} |
|
$owner = $uname.':'.$udom; |
|
$ownername = &Apache::loncommon::plainname($uname,$udom,'first'); |
|
my %emails = &Apache::loncommon::getemails($uname,$udom); |
foreach my $email ('permanentemail','critnotification','notification') { |
foreach my $email ('permanentemail','critnotification','notification') { |
$owneremail = $emails{$email}; |
$owneremail = $emails{$email}; |
last if ($owneremail ne ''); |
last if ($owneremail ne ''); |
Line 1362 sub print_review {
|
Line 2131 sub print_review {
|
$crstypename = $env{'form.crstype'}; |
$crstypename = $env{'form.crstype'}; |
if (ref($typename) eq 'HASH') { |
if (ref($typename) eq 'HASH') { |
unless ($typename->{$env{'form.crstype'}} eq '') { |
unless ($typename->{$env{'form.crstype'}} eq '') { |
$crstypename = $typename->{$env{'form.crstype'}}; |
$crstypename = &mt($typename->{$env{'form.crstype'}}); |
} |
} |
} |
} |
my $category = 'Course'; |
my $category = 'Course'; |
Line 1430 sub print_review {
|
Line 2199 sub print_review {
|
&mt('Institutional course/section').'</th>'. |
&mt('Institutional course/section').'</th>'. |
'<th>'.&mt('LON-CAPA section').'</th></tr>'; |
'<th>'.&mt('LON-CAPA section').'</th></tr>'; |
my $xlistinfo; |
my $xlistinfo; |
if ($env{'form.crosslisttotal'}) { |
my $crosslisttotal = $env{'form.crosslisttotal'}; |
for (my $i=0; $i<$env{'form.crosslisttotal'}; $i++) { |
if (!$crosslisttotal) { |
if ($env{'form.crosslist_'.$i}) { |
$crosslisttotal = 1; |
$xlistinfo .= '<tr><td>'; |
} |
if (ref($code_order) eq 'ARRAY') { |
for (my $i=0; $i<$crosslisttotal; $i++) { |
if (@{$code_order} > 0) { |
if ($env{'form.crosslist_'.$i}) { |
foreach my $item (@{$code_order}) { |
$xlistinfo .= '<tr><td>'; |
$xlistinfo .= $env{'form.crosslist_'.$i.'_'.$item}; |
if (ref($code_order) eq 'ARRAY') { |
} |
if (@{$code_order} > 0) { |
|
foreach my $item (@{$code_order}) { |
|
$xlistinfo .= $env{'form.crosslist_'.$i.'_'.$item}; |
} |
} |
} |
} |
$xlistinfo .= $env{'form.crosslist_'.$i.'_instsec'}.'</td><td>'; |
|
if ($env{'form.crosslist_'.$i.'_lcsec'}) { |
|
$xlistinfo .= $env{'form.crosslist_'.$i.'_lcsec'}; |
|
} else { |
|
$xlistinfo .= &mt('None'); |
|
} |
|
$xlistinfo .= '</td></tr>'; |
|
} |
} |
|
$xlistinfo .= $env{'form.crosslist_'.$i.'_instsec'}.'</td><td>'; |
|
if ($env{'form.crosslist_'.$i.'_lcsec'}) { |
|
$xlistinfo .= $env{'form.crosslist_'.$i.'_lcsec'}; |
|
} else { |
|
$xlistinfo .= &mt('None'); |
|
} |
|
$xlistinfo .= '</td></tr>'; |
} |
} |
} |
} |
if ($xlistinfo eq '') { |
if ($xlistinfo eq '') { |
$xlistinfo = '<tr><td colspan="2">'.&mt('None').'</td></tr>'; |
$xlistinfo = '<tr><td colspan="2">'.&mt('None').'</td></tr>'; |
} |
} |
$section_values .= $xlistinfo.'</table></td>'; |
$section_values .= $xlistinfo; |
} |
} |
|
$section_values .= '</table></td>'; |
} |
} |
|
|
my %ctxt = &clone_text(); |
my %ctxt = &clone_text(); |
Line 1517 sub print_review {
|
Line 2289 sub print_review {
|
'<td>'.&mt('None').'</td></tr>'; |
'<td>'.&mt('None').'</td></tr>'; |
for (my $i=0; $i<$env{'form.persontotal'}; $i++) { |
for (my $i=0; $i<$env{'form.persontotal'}; $i++) { |
if ($env{'form.person_'.$i.'_uname'} ne '') { |
if ($env{'form.person_'.$i.'_uname'} ne '') { |
my @allsecs = &Apache::loncommon::get_env_multiple('form.person_'.$i.'_sec'); |
if (ref($disallowed) eq 'ARRAY') { |
|
next if (grep(/^$i$/,@{$disallowed})); |
|
} |
|
my @officialsecs = &Apache::loncommon::get_env_multiple('form.person_'.$i.'_sec'); |
|
my @allsecs; |
|
foreach my $sec (@officialsecs) { |
|
next unless ($sec =~ /\w/); |
|
next if ($sec =~ /\W/); |
|
next if ($sec eq 'none'); |
|
push(@allsecs,$sec); |
|
} |
my $newsec = $env{'form.person_'.$i.'_newsec'}; |
my $newsec = $env{'form.person_'.$i.'_newsec'}; |
$newsec =~ s/^\s+//; |
$newsec =~ s/^\s+//; |
$newsec =~s/\s+$//; |
$newsec =~s/\s+$//; |
my @newsecs = split(/[\s,;]+/,$newsec); |
my @newsecs = split(/\s*[\s,;:]\s*/,$newsec); |
foreach my $sec (@newsecs) { |
foreach my $sec (@newsecs) { |
|
next unless ($sec =~ /\w/); |
next if ($sec =~ /\W/); |
next if ($sec =~ /\W/); |
next if ($newsec eq 'none'); |
next if ($sec eq 'none'); |
if ($sec ne '') { |
if ($sec ne '') { |
unless (grep(/^\Q$sec\E$/,@allsecs)) { |
unless (grep(/^\Q$sec\E$/,@allsecs)) { |
push(@allsecs,$sec); |
push(@allsecs,$sec); |
} |
} |
} |
} |
} |
} |
my $showsec = 'None'; |
my $showsec; |
if (@allsecs) { |
if (@allsecs) { |
$showsec = join(', ',@allsecs); |
$showsec = join(', ',@allsecs); |
} |
} |
|
if ($showsec eq '') { |
|
$showsec = &mt('None'); |
|
} |
|
if ($env{'form.person_'.$i.'_role'} eq 'cc') { |
|
$showsec = &mt('None'); |
|
} |
|
my $role = $env{'form.person_'.$i.'_role'}; |
$personnel_values .= |
$personnel_values .= |
'<tr><td>'.$env{'form.person_'.$i.'_firstname'}.' '. |
'<tr><td>'.$env{'form.person_'.$i.'_firstname'}.' '. |
$env{'form.person_'.$i.'_lastname'}.'</td>'. |
$env{'form.person_'.$i.'_lastname'}.'</td>'. |
'<td>'.$env{'form.person_'.$i.'_uname'}.':'. |
'<td>'.$env{'form.person_'.$i.'_uname'}.':'. |
$env{'form.person_'.$i.'_dom'}.'</td>'. |
$env{'form.person_'.$i.'_dom'}.'</td>'. |
'<td>'.&Apache::lonnet::plaintext($env{'form.person_'.$i.'_role'}, |
'<td>'.&Apache::lonnet::plaintext($role,$container).'</td>'. |
$container).'</td>'. |
|
'<td>'.$showsec.'</td></tr>'; |
'<td>'.$showsec.'</td></tr>'; |
} |
} |
} |
} |
my $output = |
my $output; |
'<div>'.&Apache::lonhtmlcommon::start_pick_box(). |
if (ref($disallowed) eq 'ARRAY') { |
|
if (@{$disallowed} > 0) { |
|
if (ref($disallowmsg) eq 'HASH') { |
|
$output = '<p class="LC_warning">'. |
|
&mt('Not all requested personnel could be included.').'<ul>'; |
|
foreach my $item (@{$disallowed}) { |
|
$output .= '<li>'.$disallowmsg->{$item}.'</li>'; |
|
} |
|
$output .= '</ul></p>'; |
|
} |
|
} |
|
} |
|
$output .= '<div>'.&Apache::lonhtmlcommon::start_pick_box(). |
&Apache::lonhtmlcommon::row_title(&mt('Owner')). |
&Apache::lonhtmlcommon::row_title(&mt('Owner')). |
'<table class="LC_innerpickbox"><tr>'. |
'<table class="LC_innerpickbox"><tr>'. |
'<th>'.&mt('Name').'</th>'. |
'<th>'.&mt('Name').'</th>'. |
Line 1575 sub print_review {
|
Line 2376 sub print_review {
|
'<table class="LC_innerpickbox"><tr>'.$personnel_headers.'</tr>'."\n". |
'<table class="LC_innerpickbox"><tr>'.$personnel_headers.'</tr>'."\n". |
$personnel_values.'</table>'."\n". |
$personnel_values.'</table>'."\n". |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::end_pick_box(); |
&Apache::lonhtmlcommon::end_pick_box().'</div>'; |
return $output; |
return $output; |
} |
} |
|
|
Line 1592 sub dates_from_form {
|
Line 2393 sub dates_from_form {
|
} |
} |
|
|
sub courseinfo_form { |
sub courseinfo_form { |
my ($dom,$formname,$crstype,$next) = @_; |
my ($dom,$formname,$crstype,$next,$description) = @_; |
my $nodescr = &mt('You must provide a (brief) course description.'); |
my %lt = &Apache::lonlocal::texthash( |
|
official => 'You must provide a (brief) course description.', |
|
community => 'You must provide a (brief) community description.' |
|
); |
|
$lt{'unofficial'} = $lt{'official'}; |
my $js_validate = <<"ENDJS"; |
my $js_validate = <<"ENDJS"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[' |
// <![CDATA[' |
|
|
function validateForm() { |
function validateForm() { |
if ((document.$formname.cdescr.value == "") || (document.$formname.cdescr.value == "undefined")) { |
if ((document.$formname.cdescr.value == "") || (document.$formname.cdescr.value == "undefined")) { |
alert('$nodescr'); |
alert('$lt{$crstype}'); |
return; |
return; |
} |
} |
nextPage(document.$formname,'$next'); |
nextPage(document.$formname,'$next'); |
Line 1609 function validateForm() {
|
Line 2414 function validateForm() {
|
</script> |
</script> |
|
|
ENDJS |
ENDJS |
|
my $title = &mt('Brief Course Description'); |
|
if ($crstype eq 'community') { |
|
$title = &mt('Brief Community Description'); |
|
} |
my $output .= $js_validate."\n".'<div>'.&Apache::lonhtmlcommon::start_pick_box(). |
my $output .= $js_validate."\n".'<div>'.&Apache::lonhtmlcommon::start_pick_box(). |
&Apache::lonhtmlcommon::row_title('Course Description'). |
&Apache::lonhtmlcommon::row_headline(). |
'<input type="text" size="40" name="cdescr" />'; |
'<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Description').' '.$title.'</h3>'. |
|
&Apache::lonhtmlcommon::row_closure(1). |
|
&Apache::lonhtmlcommon::row_title(&mt('Description')). |
|
'<input type="text" size="60" name="cdescr" value="'.$description.'" />'; |
my ($home_server_pick,$numlib) = |
my ($home_server_pick,$numlib) = |
&Apache::loncommon::home_server_form_item($dom,'chome', |
&Apache::loncommon::home_server_form_item($dom,'chome', |
'default','hide'); |
'default','hide'); |
Line 1621 ENDJS
|
Line 2432 ENDJS
|
&Apache::lonhtmlcommon::row_title(&mt('Home Server for Course')); |
&Apache::lonhtmlcommon::row_title(&mt('Home Server for Course')); |
} |
} |
$output .= $home_server_pick. |
$output .= $home_server_pick. |
|
&Apache::lonhtmlcommon::row_closure(). |
|
&Apache::lonhtmlcommon::row_headline(). |
|
'<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Clone').' '.&mt('Clone content and settings from an existing course?').'</h3>'. |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::end_pick_box().'</div>'. |
&clone_form($dom,$formname,$crstype). |
'<div>'.&clone_form($dom,$formname,$crstype).'</div>'."\n"; |
&Apache::lonhtmlcommon::end_pick_box().'</div>'."\n"; |
return $output; |
return $output; |
} |
} |
|
|
Line 1633 sub clone_form {
|
Line 2447 sub clone_form {
|
if ($crstype eq 'community') { |
if ($crstype eq 'community') { |
$type = 'Community'; |
$type = 'Community'; |
} |
} |
my $cloneform = &Apache::loncommon::select_dom_form($dom,'clonedom'). |
my $cloneform = &Apache::loncommon::select_dom_form($dom,'clonedom').' '. |
&Apache::loncommon::selectcourse_link($formname,'clonecrs','clonedom','','','',$type); |
&Apache::loncommon::selectcourse_link($formname,'clonecrs','clonedom','','','',$type); |
my %lt = &clone_text(); |
my %lt = &clone_text(); |
my $output .= |
my $output .= |
&Apache::lonhtmlcommon::start_pick_box(). |
|
&Apache::lonhtmlcommon::row_title($lt{'cid'}).'<label>'. |
&Apache::lonhtmlcommon::row_title($lt{'cid'}).'<label>'. |
'<input type="text" size="25" name="clonecrs" value="" onfocus="this.blur();'. |
'<input type="text" size="25" name="clonecrs" value="" />'. |
'opencrsbrowser('."'$formname','clonecrs','clonedom','','','','$type'".');" />'. |
'</label>'.&Apache::lonhtmlcommon::row_closure(1). |
'</label>'.&Apache::lonhtmlcommon::row_closure(1).'<label>'. |
&Apache::lonhtmlcommon::row_title($lt{'dmn'}).'<label>'. |
&Apache::lonhtmlcommon::row_title($lt{'dmn'}).'</label>'. |
$cloneform.'</label>'.&Apache::lonhtmlcommon::row_closure(1). |
$cloneform.'</label>'.&Apache::lonhtmlcommon::row_closure(). |
|
&Apache::lonhtmlcommon::row_title($lt{'dsh'}).'<label>'. |
&Apache::lonhtmlcommon::row_title($lt{'dsh'}).'<label>'. |
'<input type="radio" name="datemode" value="delete" /> '.$lt{'ncd'}. |
'<input type="radio" name="datemode" value="delete" /> '.$lt{'ncd'}. |
'</label><br /><label>'. |
'</label><br /><label>'. |
Line 1652 sub clone_form {
|
Line 2464 sub clone_form {
|
'<input type="radio" name="datemode" value="shift" checked="checked" /> '. |
'<input type="radio" name="datemode" value="shift" checked="checked" /> '. |
$lt{'shd'}.'</label>'. |
$lt{'shd'}.'</label>'. |
'<input type="text" size="5" name="dateshift" value="365" />'. |
'<input type="text" size="5" name="dateshift" value="365" />'. |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_closure(1); |
&Apache::lonhtmlcommon::end_pick_box(); |
|
return $output; |
return $output; |
} |
} |
|
|
Line 1675 sub coursecode_form {
|
Line 2486 sub coursecode_form {
|
instcode => 'Course Category', |
instcode => 'Course Category', |
crosslist => 'Cross Listed Course', |
crosslist => 'Cross Listed Course', |
); |
); |
|
my %helpitem = ( |
|
instcode => 'Course_Request_Category', |
|
crosslist => 'Course_Request_Crosslist', |
|
); |
if ((ref($codetitles) eq 'ARRAY') && (ref($cat_titles) eq 'HASH') && |
if ((ref($codetitles) eq 'ARRAY') && (ref($cat_titles) eq 'HASH') && |
(ref($cat_order))) { |
(ref($cat_order))) { |
my ($sel,$instsec,$lcsec); |
my ($sel,$instsec,$lcsec); |
Line 1690 sub coursecode_form {
|
Line 2505 sub coursecode_form {
|
my $lastitem = pop(@{$codetitles}); |
my $lastitem = pop(@{$codetitles}); |
my $lastinput = '<input type="text" size="5" name="'.$sel.'_'. $lastitem.'" />'; |
my $lastinput = '<input type="text" size="5" name="'.$sel.'_'. $lastitem.'" />'; |
if (@{$codetitles} > 0) { |
if (@{$codetitles} > 0) { |
$output = &Apache::lonhtmlcommon::row_title($rowtitle{$context}). |
$output = &Apache::lonhtmlcommon::row_title(&Apache::loncommon::help_open_topic($helpitem{$context}).' '.$rowtitle{$context}). |
'<table><tr>'; |
'<table><tr>'; |
if ($context eq 'crosslist') { |
if ($context eq 'crosslist') { |
$output .= '<td>'.&mt('Include?').'<br />'. |
$output .= '<td>'.&mt('Include?').'<br />'. |
Line 1763 sub get_course_dom {
|
Line 2578 sub get_course_dom {
|
} |
} |
} |
} |
if (($env{'user.domain'} ne '') && ($env{'user.domain'} ne 'public')) { |
if (($env{'user.domain'} ne '') && ($env{'user.domain'} ne 'public')) { |
my ($types,$typename) = &course_types(); |
my ($types,$typename) = &Apache::loncommon::course_types(); |
if (ref($types) eq 'ARRAY') { |
if (ref($types) eq 'ARRAY') { |
foreach my $type (@{$types}) { |
foreach my $type (@{$types}) { |
if (&Apache::lonnet::usertools_access($env{'user.name'}, |
if (&Apache::lonnet::usertools_access($env{'user.name'}, |
Line 1802 sub get_course_dom {
|
Line 2617 sub get_course_dom {
|
} |
} |
|
|
sub display_navbuttons { |
sub display_navbuttons { |
my ($r,$formname,$prev,$prevtext,$next,$nexttext,$state,$other,$othertext) = @_; |
my ($r,$dom,$formname,$prev,$prevtext,$next,$nexttext,$state,$other,$othertext) = @_; |
$r->print('<div class="LC_navbuttons">'); |
$r->print('<div class="LC_navbuttons">'); |
if ($prev) { |
if ($prev) { |
$r->print('<input type="button" name="previous" value = "'.$prevtext.'" '. |
$r->print('<input type="button" name="previous" value = "'.$prevtext.'" '. |
'onclick="javascript:backPage(document.'.$formname.','."'".$prev."'".')"/>'. |
'onclick="javascript:backPage('."document.$formname,'$prev'".')"/>'. |
(' 'x3)); |
(' 'x3)); |
} elsif ($prevtext) { |
} elsif ($prevtext) { |
$r->print('<input type="button" name="previous" value = "'.$prevtext.'" '. |
$r->print('<input type="button" name="previous" value = "'.$prevtext.'" '. |
Line 1814 sub display_navbuttons {
|
Line 2629 sub display_navbuttons {
|
} |
} |
if ($state eq 'details') { |
if ($state eq 'details') { |
$r->print(' <input type="button" name="other" value="'.$othertext.'" '. |
$r->print(' <input type="button" name="other" value="'.$othertext.'" '. |
'onclick="javascript:nextPage(document.'.$formname.','."'".$other."'". |
'onclick="javascript:nextPage('."document.$formname,'$other'". |
')" />'); |
')" />'); |
} |
} |
|
my $gotnext; |
if ($state eq 'courseinfo') { |
if ($state eq 'courseinfo') { |
$r->print('<input type="button" name="next" value="'.$nexttext.'" '. |
$r->print('<input type="button" name="next" value="'.$nexttext.'" '. |
'onclick="javascript:validateForm();" />'); |
'onclick="javascript:validateForm();" />'); |
} elsif ($next) { |
$gotnext = 1; |
$r->print(' |
} elsif ($state eq 'enrollment') { |
<input type="button" name="next" value="'.$nexttext.'" '. |
if (($env{'form.crstype'} eq 'official') && |
'onclick="javascript:nextPage(document.'.$formname.','."'".$next."'".')" />'); |
(&Apache::lonnet::auto_run('',$dom))) { |
|
$r->print('<input type="button" name="next" value="'.$nexttext.'" '. |
|
'onclick="javascript:validateEnrollSections('."document.$formname,'$next'".');" />'); |
|
$gotnext = 1; |
|
} |
|
} elsif ($state eq 'personnel') { |
|
if ($env{'form.persontotal'} > 0) { |
|
$r->print('<input type="button" name="next" value="'.$nexttext.'" '. |
|
'onclick="javascript:validatePersonnelSections('."document.$formname,'$next'".');" />'); |
|
$gotnext = 1; |
|
} |
|
} |
|
unless ($gotnext) { |
|
if ($next) { |
|
$r->print(' |
|
<input type="button" name="next" value="'.$nexttext.'" '. |
|
'onclick="javascript:nextPage('."document.$formname,'$next'".')" />'); |
|
} |
} |
} |
$r->print('</div>'); |
$r->print('</div>'); |
} |
} |
Line 1832 sub print_request_outcome {
|
Line 2665 sub print_request_outcome {
|
my ($dom,$codetitles,$code_order) = @_; |
my ($dom,$codetitles,$code_order) = @_; |
my ($output,$cnum,$now,$req_notifylist,$crstype,$enrollstart,$enrollend, |
my ($output,$cnum,$now,$req_notifylist,$crstype,$enrollstart,$enrollend, |
%sections,%crosslistings,%personnel,@baduname,@missingdom,%domconfig,); |
%sections,%crosslistings,%personnel,@baduname,@missingdom,%domconfig,); |
|
my $sectotal = $env{'form.sectotal'}; |
|
my $crosslisttotal = 0; |
$cnum = $env{'form.cnum'}; |
$cnum = $env{'form.cnum'}; |
unless ($cnum =~ /^$match_courseid$/) { |
unless ($cnum =~ /^$match_courseid$/) { |
$output = &mt('Invalid LON-CAPA course number for the new course')."\n"; |
$output = &mt('Invalid LON-CAPA course number for the new course')."\n"; |
Line 1873 sub print_request_outcome {
|
Line 2708 sub print_request_outcome {
|
} |
} |
} |
} |
} |
} |
$xlistinfo .= $env{'form.crosslist_'.$i.'_instsec'}; |
$crosslistings{$i}{'instcode'} = $xlistinfo; |
$crosslistings{$i}{'inst'} = $xlistinfo; |
if ($xlistinfo ne '') { |
|
$crosslisttotal ++; |
|
} |
|
$crosslistings{$i}{'instsec'} = $env{'form.crosslist_'.$i.'_instsec'}; |
$crosslistings{$i}{'loncapa'} = $env{'form.crosslist_'.$i.'_lcsec'}; |
$crosslistings{$i}{'loncapa'} = $env{'form.crosslist_'.$i.'_lcsec'}; |
} |
} |
} |
} |
Line 1908 sub print_request_outcome {
|
Line 2746 sub print_request_outcome {
|
@{$personnel{$uname.':'.$udom}{$role}{'usec'}} = (); |
@{$personnel{$uname.':'.$udom}{$role}{'usec'}} = (); |
} else { |
} else { |
my @currsec = &Apache::loncommon::get_env_multiple('form.person_'.$i.'_sec'); |
my @currsec = &Apache::loncommon::get_env_multiple('form.person_'.$i.'_sec'); |
|
my @allsecs; |
|
foreach my $sec (@currsec) { |
|
next unless ($sec =~ /\w/); |
|
next if ($sec =~ /\W/); |
|
next if ($sec eq 'none'); |
|
push(@allsecs,$sec); |
|
} |
my $newsec = $env{'form.person_'.$i.'_newsec'}; |
my $newsec = $env{'form.person_'.$i.'_newsec'}; |
$newsec =~ s/^\s+//; |
$newsec =~ s/^\s+//; |
$newsec =~s/\s+$//; |
$newsec =~s/\s+$//; |
my @newsecs = split(/[\s,;]+/,$newsec); |
my @newsecs = split(/[\s,;]+/,$newsec); |
foreach my $sec (@newsecs) { |
foreach my $sec (@newsecs) { |
next if ($sec =~ /\W/); |
next if ($sec =~ /\W/); |
next if ($newsec eq 'none'); |
next if ($sec eq 'none'); |
if ($sec ne '') { |
if ($sec ne '') { |
unless (grep(/^\Q$sec\E$/,@currsec)) { |
unless (grep(/^\Q$sec\E$/,@allsecs)) { |
push(@currsec,$sec); |
push(@allsecs,$sec); |
} |
} |
} |
} |
} |
} |
@{$personnel{$uname.':'.$udom}{$role}{'usec'}} = @currsec; |
@{$personnel{$uname.':'.$udom}{$role}{'usec'}} = @allsecs; |
} |
} |
} |
} |
} else { |
} else { |
Line 1940 sub print_request_outcome {
|
Line 2785 sub print_request_outcome {
|
if ($env{'form.autoadds'}) { |
if ($env{'form.autoadds'}) { |
$autodrops = $env{'form.autoadds'}; |
$autodrops = $env{'form.autoadds'}; |
} |
} |
my $sectotal = 0; |
|
if ($env{'form.sectotal'}) { |
|
$sectotal = $env{'form.sectotal'}; |
|
} |
|
if ($env{'form.autoadds'}) { |
if ($env{'form.autoadds'}) { |
$autodrops = $env{'form.autoadds'}; |
$autodrops = $env{'form.autoadds'}; |
} |
} |
my $crosslisttotal = 0; |
|
if ($env{'form.crosslisttotal'}) { |
|
$crosslisttotal = $env{'form.crosslisttotal'}; |
|
} |
|
my $instcode = ''; |
my $instcode = ''; |
if (exists($env{'form.instcode'})) { |
if (exists($env{'form.instcode'})) { |
$instcode = $env{'form.instcode'}; |
$instcode = $env{'form.instcode'}; |
Line 1996 sub print_request_outcome {
|
Line 2833 sub print_request_outcome {
|
accessend => $accessend, |
accessend => $accessend, |
personnel => \%personnel, |
personnel => \%personnel, |
}; |
}; |
my @inststatuses; |
my (@inststatuses,$storeresult,$creationresult); |
my $val = &get_processtype($dom,$crstype,\@inststatuses,\%domconfig); |
my $val = &get_processtype($dom,$crstype,\@inststatuses,\%domconfig); |
if ($val eq '') { |
if ($val eq '') { |
if ($crstype eq 'official') { |
if ($crstype eq 'official') { |
Line 2008 sub print_request_outcome {
|
Line 2845 sub print_request_outcome {
|
} else { |
} else { |
$output = &mt('Unrecognized course type: [_1]',$crstype); |
$output = &mt('Unrecognized course type: [_1]',$crstype); |
} |
} |
|
$storeresult = 'notpermitted'; |
} else { |
} else { |
my ($disposition,$message,$reqstatus); |
my ($disposition,$message,$reqstatus); |
my %reqhash = ( |
my %reqhash = ( |
Line 2024 sub print_request_outcome {
|
Line 2862 sub print_request_outcome {
|
$disposition = &check_autolimit($env{'user.name'},$env{'user.domain'}, |
$disposition = &check_autolimit($env{'user.name'},$env{'user.domain'}, |
$dom,$crstype,$limit,\$message); |
$dom,$crstype,$limit,\$message); |
} elsif ($val eq 'validate') { |
} elsif ($val eq 'validate') { |
my $inststatuslist; |
my ($inststatuslist,$validationchk,$validation); |
if (@inststatuses > 0) { |
if (@inststatuses > 0) { |
$inststatuslist = join(',',@inststatuses); |
$inststatuslist = join(',',@inststatuses); |
} |
} |
Line 2032 sub print_request_outcome {
|
Line 2870 sub print_request_outcome {
|
if (@instsections > 0) { |
if (@instsections > 0) { |
$instseclist = join(',',@instsections); |
$instseclist = join(',',@instsections); |
} |
} |
my $validation = |
$validationchk = |
&Apache::lonnet::auto_validate_instcode('',$dom,$instcode, |
&Apache::lonnet::auto_courserequest_validation($dom, |
$env{'user.name'}.':'.$env{'user.domain'},$inststatuslist, |
$env{'user.name'}.':'.$env{'user.domain'},$crstype, |
$instseclist); |
$inststatuslist,$instcode,$instseclist); |
if ($validation eq 'valid') { |
if ($validationchk =~ /:/) { |
$disposition = 'process'; |
($validation,$message) = split(':',$validationchk); |
} elsif ($validation eq 'rejected') { |
} else { |
$disposition = 'rejected'; |
$validation = $validationchk; |
} elsif ($validation eq 'pending') { |
} |
$disposition = 'pending'; |
if ($validation =~ /^error(.*)$/) { |
} elsif ($disposition eq 'approval') { |
|
$disposition = 'approval'; |
|
} elsif ($disposition =~ /^error(.*)$/) { |
|
$disposition = 'approval'; |
$disposition = 'approval'; |
$validationerror = $1; |
$validationerror = $1; |
} else { |
} else { |
$disposition = 'approval'; |
$disposition = $validation; |
} |
} |
} else { |
} else { |
$disposition = 'approval'; |
$disposition = 'approval'; |
Line 2061 sub print_request_outcome {
|
Line 2896 sub print_request_outcome {
|
if ($message) { |
if ($message) { |
$output .= '<div class="LC_warning">'.$message.'</div>'; |
$output .= '<div class="LC_warning">'.$message.'</div>'; |
} |
} |
|
$storeresult = 'rejected'; |
} elsif ($disposition eq 'process') { |
} elsif ($disposition eq 'process') { |
my %domdefs = &Apache::lonnet::get_domain_defaults($dom); |
my %domdefs = &Apache::lonnet::get_domain_defaults($dom); |
my ($logmsg,$newusermsg,$addresult,$enrollcount,$response,$keysmsg,%longroles); |
my ($logmsg,$newusermsg,$addresult,$enrollcount,$response,$keysmsg,%longroles); |
Line 2078 sub print_request_outcome {
|
Line 2914 sub print_request_outcome {
|
if ($result eq 'created') { |
if ($result eq 'created') { |
$disposition = 'created'; |
$disposition = 'created'; |
$reqstatus = 'created'; |
$reqstatus = 'created'; |
$output = &mt('Your course request has been processed and the course has been created.'). |
my $role_result = &update_requestors_roles($dom,$cnum,$crstype,$details, |
'<br />'. |
\%longroles); |
&mt('You will need to logout and log-in again to be able to select a role in the course.'); |
$output = '<p>'.&mt('Your course request has been processed and the course has been created.'). |
|
'<br />'.$role_result.'</p>'; |
|
$creationresult = 'created'; |
} else { |
} else { |
$output = '<span class="LC_error">'. |
$output = '<span class="LC_error">'. |
&mt('An error occurred when processing your course request.'). |
&mt('An error occurred when processing your course request.'). |
'<br />'. |
'<br />'. |
&mt('You may want to review the request details and submit the request again.'). |
&mt('You may want to review the request details and submit the request again.'). |
'</span>'; |
'</span>'; |
|
$creationresult = 'error'; |
} |
} |
} else { |
} else { |
my $requestid = $cnum.'_'.$disposition; |
my $requestid = $cnum.'_'.$disposition; |
Line 2104 sub print_request_outcome {
|
Line 2943 sub print_request_outcome {
|
$env{'user.domain'},$env{'user.name'}); |
$env{'user.domain'},$env{'user.name'}); |
if ($userreqhash{$statuskey} ne '') { |
if ($userreqhash{$statuskey} ne '') { |
$modified = 1; |
$modified = 1; |
my %queuehash = &Apache::lonnet::get_dom('courserequestqueue', |
my $uname = &Apache::lonnet::get_domainconfiguser($dom); |
[$cnum.'_approval', |
my %queuehash = &Apache::lonnet::get('courserequestqueue', |
$cnum.'_pending'],$dom); |
[$cnum.'_approval', |
|
$cnum.'_pending'],$dom,$uname); |
if (($queuehash{$cnum.'_approval'} ne '') || |
if (($queuehash{$cnum.'_approval'} ne '') || |
($queuehash{$cnum.'_pending'} ne '')) { |
($queuehash{$cnum.'_pending'} ne '')) { |
$queued = 1; |
$queued = 1; |
Line 2127 sub print_request_outcome {
|
Line 2967 sub print_request_outcome {
|
} |
} |
} |
} |
} |
} |
my ($storeresult,$statusresult); |
my ($statusresult); |
if ($requestkey =~ /^($match_domain)_($match_courseid)$/) { |
if ($requestkey =~ /^($match_domain)_($match_courseid)$/) { |
$storeresult = &Apache::lonnet::store_userdata(\%reqhash,$requestkey, |
$storeresult = &Apache::lonnet::store_userdata(\%reqhash,$requestkey, |
'courserequests'); |
'courserequests'); |
Line 2135 sub print_request_outcome {
|
Line 2975 sub print_request_outcome {
|
my %status = ( |
my %status = ( |
'status:'.$dom.':'.$cnum => $reqstatus, |
'status:'.$dom.':'.$cnum => $reqstatus, |
); |
); |
$statusresult = &Apache::lonnet::put('courserequests',\%status); |
$statusresult = &Apache::lonnet::put('courserequests',\%status); |
} |
} |
} else { |
} else { |
$storeresult = 'error: invalid requestkey format'; |
$storeresult = 'error: invalid requestkey format'; |
Line 2144 sub print_request_outcome {
|
Line 2984 sub print_request_outcome {
|
$output .= '<span class="LC_warning">'.&mt('An error occurred saving a record of the details of your request: [_1].',$storeresult).'</span><br />'; |
$output .= '<span class="LC_warning">'.&mt('An error occurred saving a record of the details of your request: [_1].',$storeresult).'</span><br />'; |
&Apache::lonnet::logthis("Error saving course request - $requestkey for $env{'user.name'}:$env{'user.domain'} - $storeresult"); |
&Apache::lonnet::logthis("Error saving course request - $requestkey for $env{'user.name'}:$env{'user.domain'} - $storeresult"); |
} elsif ($statusresult ne 'ok') { |
} elsif ($statusresult ne 'ok') { |
$output .= '<span class="LC_warning">'.&mt('An error occurred saving a record of the status of your request: [_1].',$statusresult).'</span><br />'; |
$output .= '<span class="LC_warning">'.&mt('An error occurred saving a record of the status of your request: [_1].',$statusresult).'</span><br />'; |
&Apache::lonnet::logthis("Error saving course request status for $requestkey (for $env{'user.name'}:$env{'user.domain'}) - $statusresult"); |
&Apache::lonnet::logthis("Error saving course request status for $requestkey (for $env{'user.name'}:$env{'user.domain'}) - $statusresult"); |
} |
} |
if ($modified && $queued && $storeresult eq 'ok') { |
if ($modified && $queued && $storeresult eq 'ok') { |
Line 2155 sub print_request_outcome {
|
Line 2995 sub print_request_outcome {
|
$output .= '<span class="LC_warning">'.&mt('An error occurred validating your request with institutional data sources: [_1].',$validationerror).'</p>'; |
$output .= '<span class="LC_warning">'.&mt('An error occurred validating your request with institutional data sources: [_1].',$validationerror).'</p>'; |
} |
} |
} |
} |
|
if ($creationresult ne '') { |
|
return ($creationresult,$output); |
|
} else { |
|
return ($storeresult,$output); |
|
} |
|
} |
|
|
|
sub update_requestors_roles { |
|
my ($dom,$cnum,$crstype,$details,$longroles) = @_; |
|
my $now = time; |
|
my ($active,$future,$numactive,$numfuture,$output); |
|
my $owner = $env{'user.name'}.':'.$env{'user.domain'}; |
|
if (ref($details) eq 'HASH') { |
|
if (ref($details->{'personnel'}) eq 'HASH') { |
|
unless (ref($details->{'personnel'}{$owner}) eq 'HASH') { |
|
$details->{'personnel'}{$owner} = { |
|
'roles' => ['cc'], |
|
'cc' => { 'usec' => [] }, |
|
}; |
|
} |
|
my @roles; |
|
if (ref($details->{'personnel'}{$owner}{'roles'}) eq 'ARRAY') { |
|
@roles = sort(@{$details->{'personnel'}{$owner}{'roles'}}); |
|
unless (grep(/^cc$/,@roles)) { |
|
push(@roles,'cc'); |
|
} |
|
} else { |
|
@roles = ('cc'); |
|
} |
|
foreach my $role (@roles) { |
|
my $start = $now; |
|
my $end = '0'; |
|
if ($role eq 'st') { |
|
if ($details->{'accessstart'} ne '') { |
|
$start = $details->{'accessstart'}; |
|
} |
|
if ($details->{'accessend'} ne '') { |
|
$end = $details->{'accessend'}; |
|
} |
|
} |
|
my @usecs; |
|
if ($role ne 'cc') { |
|
if (ref($details->{'personnel'}{$owner}{$role}{'usec'}) eq 'ARRAY') { |
|
@usecs = @{$details->{'personnel'}{$owner}{$role}{'usec'}}; |
|
} |
|
} |
|
if ($role eq 'st') { |
|
if (@usecs > 1) { |
|
my $firstsec = $usecs[0]; |
|
@usecs = ($firstsec); |
|
} |
|
} |
|
if (@usecs == 0) { |
|
push(@usecs,''); |
|
} |
|
foreach my $usec (@usecs) { |
|
my (%userroles,%newrole,%newgroups,$spec,$area); |
|
my $area = '/'.$dom.'/'.$cnum; |
|
my $spec = $role.'.'.$area; |
|
if ($usec ne '') { |
|
$spec .= '/'.$usec; |
|
$area .= '/'.$usec; |
|
} |
|
if ($role =~ /^cr\//) { |
|
&Apache::lonnet::custom_roleprivs(\%newrole,$role,$dom, |
|
$cnum,$spec,$area); |
|
} else { |
|
&Apache::lonnet::standard_roleprivs(\%newrole,$role,$dom, |
|
$spec,$cnum,$area); |
|
} |
|
&Apache::lonnet::set_userprivs(\%userroles,\%newrole, |
|
\%newgroups); |
|
$userroles{'user.role.'.$spec} = $start.'.'.$end; |
|
&Apache::lonnet::appenv(\%userroles,[$role,'cm']); |
|
if (($end == 0) || ($end > $now)) { |
|
my $showrole = $role; |
|
if ($role =~ /^cr\//) { |
|
$showrole = &Apache::lonnet::plaintext($role,$crstype); |
|
} elsif (ref($longroles) eq 'HASH') { |
|
if ($longroles->{$role} ne '') { |
|
$showrole = $longroles->{$role}; |
|
} |
|
} |
|
if ($start <= $now) { |
|
$active .= '<li><a href="/adm/roles?selectrole=1&'. |
|
$spec.'=1">'.$showrole; |
|
if ($usec ne '') { |
|
$active .= ' - '.&mt('section:').' '.$usec; |
|
} |
|
$active .= '</a></li>'; |
|
$numactive ++; |
|
} else { |
|
$future .= '<li>'.$showrole; |
|
if ($usec ne '') { |
|
$future .= ' - '.&mt('section:').' '.$usec; |
|
} |
|
$future .= '</li>'; |
|
$numfuture ++; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if ($active) { |
|
if ($numactive == 1) { |
|
$output = &mt('Use the following link to enter the course:'); |
|
} else { |
|
$output = &mt('Use the following links to your new roles to enter the course:'); |
|
} |
|
$output .= ' <ul>'.$active.'</ul><br />'; |
|
} |
|
if ($future) { |
|
$output .= &mt('The following course [quant,_1,role] will become available for selection from your [_2]roles page[_3], once the default student access start date - [_4] - has been reached:',$numfuture,'<a href="/adm/roles">','</a>',&Apache::lonlocal::locallocaltime($details->{'accessstart'})). |
|
' <ul>'.$future.'</ul>'; |
|
} |
return $output; |
return $output; |
} |
} |
|
|
Line 2212 sub get_processtype {
|
Line 3168 sub get_processtype {
|
if (ref($domconfig->{'requestcourses'}) eq 'HASH') { |
if (ref($domconfig->{'requestcourses'}) eq 'HASH') { |
%settings = %{$domconfig->{'requestcourses'}}; |
%settings = %{$domconfig->{'requestcourses'}}; |
if (ref($settings{$crstype}) eq 'HASH') { |
if (ref($settings{$crstype}) eq 'HASH') { |
if (($env{'user.adv'}) && (exists($settings{$crstype}{'_LC_adv'}))) { |
if (($env{'user.adv'}) && ($settings{$crstype}{'_LC_adv'} ne '')) { |
$val = $settings{$crstype}{'_LC_adv'}; |
$val = $settings{$crstype}{'_LC_adv'}; |
@{$inststatuses} = ('_LC_adv_'); |
@{$inststatuses} = ('_LC_adv_'); |
} else { |
} else { |
Line 2287 sub check_autolimit {
|
Line 3243 sub check_autolimit {
|
my ($uname,$udom,$dom,$crstype,$limit,$message) = @_; |
my ($uname,$udom,$dom,$crstype,$limit,$message) = @_; |
my %crsroles = &Apache::lonnet::get_my_roles($env{'user.name'},$env{'user.domain'}, |
my %crsroles = &Apache::lonnet::get_my_roles($env{'user.name'},$env{'user.domain'}, |
'userroles',['active','future'],['cc'],[$dom]); |
'userroles',['active','future'],['cc'],[$dom]); |
my ($types,$typename) = &course_types(); |
my ($types,$typename) = &Apache::loncommon::course_types(); |
my %requests = &Apache::lonnet::dumpstore('courserequests',$udom,$uname); |
my %requests = &Apache::lonnet::dumpstore('courserequests',$udom,$uname); |
my %count; |
my %count; |
if (ref($types) eq 'ARRAY') { |
if (ref($types) eq 'ARRAY') { |
Line 2318 sub check_autolimit {
|
Line 3274 sub check_autolimit {
|
} |
} |
|
|
sub retrieve_settings { |
sub retrieve_settings { |
my ($dom,$cnum) = @_; |
my ($dom,$cnum,$udom,$uname) = @_; |
my ($result,%reqinfo) = &get_request_settings($dom,$cnum); |
if ($udom eq '' || $uname eq '') { |
|
$udom = $env{'user.domain'}; |
|
$uname = $env{'user.name'}; |
|
} |
|
my ($result,%reqinfo) = &get_request_settings($dom,$cnum,$udom,$uname); |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
if (($env{'user.name'} eq $reqinfo{'owner'}) && |
if (($udom eq $reqinfo{'domain'}) && ($uname eq $reqinfo{'owner'})) { |
($env{'user.domain'} eq $reqinfo{'domain'})) { |
|
$env{'form.chome'} = $reqinfo{'coursehome'}; |
$env{'form.chome'} = $reqinfo{'coursehome'}; |
$env{'form.cdescr'} = $reqinfo{'cdescr'}; |
$env{'form.cdescr'} = $reqinfo{'cdescr'}; |
$env{'form.crstype'} = $reqinfo{'crstype'}; |
$env{'form.crstype'} = $reqinfo{'crstype'}; |
Line 2345 sub retrieve_settings {
|
Line 3304 sub retrieve_settings {
|
$env{'form.autoadds'} = $reqinfo{'autoadds'}; |
$env{'form.autoadds'} = $reqinfo{'autoadds'}; |
$env{'form.autdrops'} = $reqinfo{'autodrops'}; |
$env{'form.autdrops'} = $reqinfo{'autodrops'}; |
$env{'form.instcode'} = $reqinfo{'instcode'}; |
$env{'form.instcode'} = $reqinfo{'instcode'}; |
my %crscode = ( |
my $crscode = { |
instcode => $reqinfo{'instcode'}, |
$cnum => $reqinfo{'instcode'}, |
); |
}; |
&extract_instcode($dom,'instcode',\%crscode); |
&extract_instcode($dom,'instcode',$crscode,$cnum); |
} |
} |
my @currsec; |
my @currsec; |
if (ref($reqinfo{'sections'}) eq 'HASH') { |
if (ref($reqinfo{'sections'}) eq 'HASH') { |
foreach my $i (sort(keys(%{$reqinfo{'sections'}}))) { |
foreach my $i (sort(keys(%{$reqinfo{'sections'}}))) { |
if (ref($reqinfo{'sections'}{$i}) eq 'HASH') { |
if (ref($reqinfo{'sections'}{$i}) eq 'HASH') { |
my $sec = $reqinfo{'sections'}{$i}{'inst'};; |
my $sec = $reqinfo{'sections'}{$i}{'inst'}; |
$env{'form.secnum_'.$i} = $sec; |
$env{'form.secnum_'.$i} = $sec; |
|
$env{'form.sec_'.$i} = '1'; |
if (!grep(/^\Q$sec\E$/,@currsec)) { |
if (!grep(/^\Q$sec\E$/,@currsec)) { |
push(@currsec,$sec); |
push(@currsec,$sec); |
} |
} |
Line 2363 sub retrieve_settings {
|
Line 3323 sub retrieve_settings {
|
} |
} |
} |
} |
} |
} |
if (ref($reqinfo{'crosslistings'}) eq 'HASH') { |
if (ref($reqinfo{'crosslists'}) eq 'HASH') { |
foreach my $i (sort(keys(%{$reqinfo{'crosslistings'}}))) { |
foreach my $i (sort(keys(%{$reqinfo{'crosslists'}}))) { |
if (ref($reqinfo{'crosslistings'}{$i}) eq 'HASH') { |
if (ref($reqinfo{'crosslists'}{$i}) eq 'HASH') { |
$env{'form.crosslist_'.$i.'_lcsec'} = $reqinfo{'crosslistings'}{$i}{'loncapa'}; |
$env{'form.crosslist_'.$i} = '1'; |
my $xlistsec = $reqinfo{'crosslistings'}{$i}{'instsec'}; |
$env{'form.crosslist_'.$i.'_instsec'} = $reqinfo{'crosslists'}{$i}{'instsec'}; |
my %crscode = ( |
$env{'form.crosslist_'.$i.'_lcsec'} = $reqinfo{'crosslists'}{$i}{'loncapa'}; |
$i => $reqinfo{'crosslistings'}{$i}{'instcode'}, |
if ($reqinfo{'crosslists'}{$i}{'instcode'} ne '') { |
); |
my $key = $cnum.$i; |
&extract_instcode($dom,'crosslist',\%crscode,$1,$xlistsec); |
my $crscode = { |
|
$key => $reqinfo{'crosslists'}{$i}{'instcode'}, |
|
}; |
|
&extract_instcode($dom,'crosslist',$crscode,$key,$i); |
|
} |
} |
} |
} |
} |
} |
} |
Line 2419 sub retrieve_settings {
|
Line 3383 sub retrieve_settings {
|
} |
} |
|
|
sub get_request_settings { |
sub get_request_settings { |
my ($dom,$cnum) = @_; |
my ($dom,$cnum,$udom,$uname) = @_; |
my $requestkey = $dom.'_'.$cnum; |
my $requestkey = $dom.'_'.$cnum; |
my ($result,%reqinfo); |
my ($result,%reqinfo); |
if ($requestkey =~ /^($match_domain)_($match_courseid)$/) { |
if ($requestkey =~ /^($match_domain)_($match_courseid)$/) { |
my %history = &Apache::lonnet::restore($requestkey,'courserequests', |
my %history = &Apache::lonnet::restore($requestkey,'courserequests',$udom,$uname); |
$env{'user.domain'},$env{'user.name'}); |
|
my $disposition = $history{'disposition'}; |
my $disposition = $history{'disposition'}; |
if (($disposition eq 'approval') || ($disposition eq 'pending')) { |
if (($disposition eq 'approval') || ($disposition eq 'pending')) { |
if (ref($history{'details'}) eq 'HASH') { |
if (ref($history{'details'}) eq 'HASH') { |
Line 2443 sub get_request_settings {
|
Line 3406 sub get_request_settings {
|
} |
} |
|
|
sub extract_instcode { |
sub extract_instcode { |
my ($cdom,$element,$crscodehashref,$counter,$xlistsec) = @_; |
my ($cdom,$element,$crscode,$crskey,$counter) = @_; |
my (%codes,@codetitles,%cat_titles,%cat_order); |
my (%codes,@codetitles,%cat_titles,%cat_order); |
if (ref($crscodehashref) eq 'HASH') { |
if (&Apache::lonnet::auto_instcode_format('requests',$cdom,$crscode,\%codes, |
if (&Apache::lonnet::auto_instcode_format('requests',$cdom,$crscodehashref, |
\@codetitles,\%cat_titles, |
\%codes,\@codetitles,\%cat_titles,\%cat_order) eq 'ok') { |
\%cat_order) eq 'ok') { |
|
if (ref($codes{$crskey}) eq 'HASH') { |
if (@codetitles > 0) { |
if (@codetitles > 0) { |
my $sel = $element; |
my $sel = $element; |
if ($element eq 'crosslist') { |
if ($element eq 'crosslist') { |
$sel .= '_'.$counter; |
$sel .= '_'.$counter; |
} |
} |
my $lastitem = pop(@codetitles); |
|
foreach my $title (@codetitles) { |
foreach my $title (@codetitles) { |
if (ref($cat_order{$title}) eq 'ARRAY') { |
$env{'form.'.$sel.'_'.$title} = $codes{$crskey}{$title}; |
if (@{$cat_order{$title}} > 0) { |
|
$env{'form.'.$sel.'_'.$title} = $cat_order{$title}[0]; |
|
} |
|
} |
|
} |
|
if ($element eq 'crosslist') { |
|
$env{'form.'.$sel.'_'.$lastitem} = $xlistsec; |
|
} |
} |
} |
} |
} |
} |