version 1.24, 2009/08/23 03:51:53
|
version 1.54.2.3, 2010/08/11 13:24:21
|
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 90 described at http://www.lon-capa.org.
|
Line 94 described at http://www.lon-capa.org.
|
|
|
=item print_request_outcome() |
=item print_request_outcome() |
|
|
=item get_processtype() |
|
|
|
=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 116 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 127 sub handler {
|
return OK; |
return OK; |
} |
} |
|
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
|
['action','showdom','cnum','state','crstype','queue']); |
&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'} = ['display']; |
$states{'new'} = ['courseinfo','enrollment','personnel','review','process']; |
$states{'new'} = ['courseinfo','enrollment','personnel','review','process']; |
|
|
if (($action eq 'new') && ($env{'form.crstype'} eq 'official')) { |
if (($action eq 'new') && ($env{'form.crstype'} eq 'official')) { |
Line 170 sub handler {
|
Line 153 sub handler {
|
} |
} |
} |
} |
|
|
|
my @invalidcrosslist; |
my %trail = ( |
my %trail = ( |
crstype => 'Course Request Action', |
crstype => 'Request Action', |
codepick => 'Category', |
codepick => 'Category', |
courseinfo => 'Description', |
courseinfo => 'Description', |
enrollment => 'Access Dates', |
enrollment => 'Access Dates', |
Line 182 sub handler {
|
Line 166 sub handler {
|
details => 'Request Details', |
details => 'Request Details', |
cancel => 'Cancel Request', |
cancel => 'Cancel Request', |
removal => 'Outcome', |
removal => 'Outcome', |
|
display => 'Request Logs', |
); |
); |
|
|
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; |
if ($env{'form.cnum'} ne '') { |
if (ref($states{$action}) eq 'ARRAY') { |
my $cnum = $env{'form.cnum'}; |
while ($i<@{$states{$action}} && !$done) { |
my $queue = $env{'form.queue'}; |
if ($states{$action}[$i] eq $state) { |
my $reqkey = $cnum.'_'.$queue; |
$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'); |
if ($env{'form.crstype'} eq 'community') { |
last; |
$warning = &mt('Invalid username or domain for community requestor'); |
} else { |
} else { |
if (($state eq 'process') && ($i > 0)) { |
$warning = &mt('Invalid username or domain for course requestor'); |
&Apache::lonhtmlcommon::add_breadcrumb( |
} |
{href=>"javascript:backPage(document.requestcrs,'$states{$action}[0]')", |
} |
text=>"$trail{$states{$action}[$i]}"}); |
|
} else { |
} else { |
&Apache::lonhtmlcommon::add_breadcrumb( |
if ($env{'form.crstype'} eq 'community') { |
{href=>"javascript:backPage(document.requestcrs,'$states{$action}[$i]')", |
$warning = &mt('No information was found for this community request.'); |
text=>"$trail{$states{$action}[$i]}"}); |
} else { |
|
$warning = &mt('No information was found for this course request.'); |
|
} |
} |
} |
|
} else { |
|
$warning = &mt('No course request ID provided.'); |
|
} |
|
} else { |
|
if ($env{'form.crstype'} eq 'any') { |
|
$warning = &mt('You do not have rights to view course or community request information.'); |
|
} elsif ($env{'form.crstype'} eq 'community') { |
|
$warning = &mt('You do not have rights to view community request information.'); |
|
} else { |
|
$warning = &mt('You do not have rights to view course request information.'); |
} |
} |
} |
} |
} else { |
} elsif ((defined($state)) && (defined($action))) { |
&Apache::lonhtmlcommon::add_breadcrumb( |
if (($action eq 'view') && ($state eq 'details')) { |
{text=>'Pick Action'}); |
if ((defined($env{'form.showdom'})) && (defined($env{'form.cnum'}))) { |
$crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests'); |
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); |
|
if ($state eq 'courseinfo') { |
|
$jscript .= &cloning_javascript(); |
|
} |
|
} |
|
} |
|
|
|
if ($state eq 'personnel') { |
|
$jscript .= "\n".&Apache::loncommon::userbrowser_javascript(); |
} |
} |
|
|
my %can_request; |
my $loaditems = &onload_action($action,$state); |
my $canreq = &check_can_request($dom,\%can_request); |
|
|
my (%can_request,%request_domains); |
|
my $canreq = |
|
&Apache::lonnet::check_can_request($dom,\%can_request,\%request_domains); |
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,\%request_domains); |
} 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/Community Requests').$crumb. |
'<div class="LC_warning">'. |
'<div class="LC_warning">'. |
&mt('You do not have privileges to request creation of courses.'). |
&mt('You do not have privileges to request creation of courses or communities.'). |
'</div>'.&Apache::loncommon::end_page()); |
'</div>'.&Apache::loncommon::end_page()); |
} |
} |
} 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,\%request_domains); |
|
} else { |
|
&request_administration($r,$action,$state,$page,\%states,$dom,$jscript, |
|
$loaditems,$crumb); |
|
} |
|
} elsif ($action eq 'display') { |
|
if ($warning ne '') { |
|
my $args = { only_body => 1 }; |
|
$r->print(&header('Course/Community Requests','','' ,'',$args).$crumb. |
|
'<h3>'.&mt('Course/Community Request Details').'</h3>'. |
|
'<div class="LC_warning">'.$warning.'</div>'. |
|
&close_popup_form()); |
} else { |
} else { |
&request_administration($r,$action,$state,$page,\%states,$dom,$jscript, |
&request_administration($r,$action,$state,$page,\%states,$dom,$jscript, |
$loaditems,$crumb); |
$loaditems,$crumb,'','','','','',$uname,$udom); |
} |
} |
} elsif ($action eq 'log') { |
} elsif ($action eq 'log') { |
&print_request_logs($jscript,$loaditems,$crumb); |
if ($state eq 'crstype') { |
|
&print_main_menu($r,\%can_request,\%states,$dom,$jscript,'',$crumb,\%request_domains); |
|
} else { |
|
$jscript .= <<ENDJS; |
|
|
|
function backPage(formname,prevstate) { |
|
formname.state.value = prevstate; |
|
formname.submit(); |
|
} |
|
|
|
function setPage(formname) { |
|
formname.page.value = '1'; |
|
return; |
|
} |
|
|
|
ENDJS |
|
&print_request_logs($r,$dom,$jscript,$loaditems,$crumb); |
|
} |
} else { |
} else { |
&print_main_menu($r,\%can_request,\%states,$dom,$jscript,'',$crumb); |
&print_main_menu($r,\%can_request,\%states,$dom,$jscript,'',$crumb,\%request_domains); |
} |
} |
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 cloning_javascript { |
|
return <<"END"; |
|
function setCloneDisplay(courseForm) { |
|
if (courseForm.cloning.length > 1) { |
|
for (var i=0; i<courseForm.cloning.length; i++) { |
|
if (courseForm.cloning[i].checked) { |
|
if (courseForm.cloning[i].value == 1) { |
|
document.getElementById('cloneoptions').style.display="block";; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
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/Community 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/Community Requests','Course_Requests'); |
|
} |
|
} else { |
|
&Apache::lonhtmlcommon::add_breadcrumb( |
|
{text=>'Pick Action'}); |
|
$crumb = &Apache::lonhtmlcommon::breadcrumbs('Course/Community 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 285 sub form_elements {
|
Line 499 sub form_elements {
|
}, |
}, |
courseinfo => { |
courseinfo => { |
cdescr => 'text', |
cdescr => 'text', |
|
cloning => 'radio', |
clonecrs => 'text', |
clonecrs => 'text', |
clonedom => 'selectbox', |
clonedom => 'selectbox', |
datemode => 'radio', |
datemode => 'radio', |
Line 354 sub form_elements {
|
Line 569 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} = 'text', |
$extras{'loncapasec_'.$i} = 'text'; |
} |
} |
} |
} |
my $crosslisttotal = $env{'form.crosslisttotal'}; |
my $crosslisttotal = $env{'form.crosslisttotal'}; |
Line 373 sub form_elements {
|
Line 587 sub form_elements {
|
if (!$crosslisttotal) { |
if (!$crosslisttotal) { |
$crosslisttotal = 1; |
$crosslisttotal = 1; |
} |
} |
|
|
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'; |
Line 417 sub onload_action {
|
Line 632 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 { |
if ($state eq 'courseinfo') { |
my ($dom,$can_request) = @_; |
$loaditems{'onload'} .= 'javascript:setCloneDisplay(document.requestcrs);'; |
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,$request_domains) = @_; |
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 = 'this.form.submit()'; |
} |
} |
|
|
my $nextstate_setter = "\n"; |
my $nextstate_setter = "\n"; |
Line 489 sub print_main_menu {
|
Line 668 sub print_main_menu {
|
my $js = <<"END"; |
my $js = <<"END"; |
|
|
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 508 function check_can_request(crschoice,act
|
Line 689 function check_can_request(crschoice,act
|
var unofficial = ''; |
var unofficial = ''; |
var community = ''; |
var community = ''; |
END |
END |
|
if (ref($can_request) eq 'HASH') { |
foreach my $item (keys(%{$can_request})) { |
foreach my $item (keys(%{$can_request})) { |
$js .= " |
$js .= " |
$item = 1; |
$item = 1; |
"; |
"; |
|
} |
} |
} |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
official => 'You are not permitted to request creation of an official course in this domain.', |
official => 'You are not permitted to request creation of an official course in this domain.', |
unofficial => 'You are not permitted to request creation of an unofficial course in this domain.', |
unofficial => 'You are not permitted to request creation of an unofficial course in this domain.', |
community => 'You are not permitted to request creation of a community this domain.', |
community => 'You are not permitted to request creation of a community this domain.', |
all => 'You must choose a specific course type when making a new course request.\\nAll types is not allowed.', |
all => 'You must choose a specific course type when making a new course request.\\n\"All types\" is not allowed.', |
); |
); |
$js .= <<END; |
$js .= <<END; |
if (crschoice == 'official') { |
if (crschoice == 'official') { |
Line 548 END
|
Line 730 END
|
} |
} |
return true; |
return true; |
} |
} |
|
|
END |
END |
|
my ($pagetitle,$pageinfo,$domaintitle); |
$r->print(&header('Course Requests',$js.$jscript,$loaditems).$crumb. |
if (ref($can_request) eq 'HASH') { |
'<div>'. |
if (($can_request->{'official'}) || ($can_request->{'unofficial'})) { |
'<form name="domforcourse" method="post" action="/adm/requestcourse">'. |
if ($can_request->{'community'}) { |
|
$pagetitle = 'Course/Community Requests'; |
|
$pageinfo = &mt('Request creation of a new course or community, or review your pending requests.'); |
|
$domaintitle = &mt('Course/Community Domain'); |
|
} else { |
|
$pagetitle = 'Course Requests'; |
|
$pageinfo = &mt('Request creation of a new course, or review your pending course requests.'); |
|
$domaintitle = &mt('Course Domain'); |
|
} |
|
} elsif ($can_request->{'community'}) { |
|
$pagetitle = 'Community Requests'; |
|
$pageinfo = &mt('Request creation of a new course, or review your pending requests.'); |
|
$domaintitle = &mt('Community Domain'); |
|
} else { |
|
$pagetitle = 'Course/Community Requests'; |
|
$pageinfo = &mt('You do not have rights to request creation of courses in this domain; please choose a different domain.'); |
|
$domaintitle = &mt('Course/Community Domain'); |
|
} |
|
} |
|
my @incdoms; |
|
if (ref($request_domains) eq 'HASH') { |
|
foreach my $item (keys(%{$request_domains})) { |
|
if (ref($request_domains->{$item}) eq 'ARRAY') { |
|
foreach my $possdom (@{$request_domains->{$item}}) { |
|
unless(grep(/^\Q$possdom\E$/,@incdoms)) { |
|
push(@incdoms,$possdom); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
$r->print(&header($pagetitle,$js.$jscript,$loaditems).$crumb. |
|
'<p>'.$pageinfo.'</p>'. |
|
'<div>'. |
&Apache::lonhtmlcommon::start_pick_box(). |
&Apache::lonhtmlcommon::start_pick_box(). |
&Apache::lonhtmlcommon::row_title('Course Domain'). |
&Apache::lonhtmlcommon::row_title($domaintitle). |
&Apache::loncommon::select_dom_form($dom,'showdom','',1,$onchange)); |
'<form name="domforcourse" method="post" action="/adm/requestcourse">'. |
|
&Apache::loncommon::select_dom_form($dom,'showdom','',1,$onchange,\@incdoms)); |
if (!$onchange) { |
if (!$onchange) { |
$r->print(' <input type="submit" name="godom" value="'. |
$r->print(' <input type="submit" name="godom" value="'. |
&mt('Change').'" />'); |
&mt('Change').'" />'); |
} |
} |
$r->print(&Apache::lonhtmlcommon::row_closure(1). |
unless ((ref($can_request) eq 'HASH') && (keys(%{$can_request}) > 0)) { |
&Apache::lonhtmlcommon::end_pick_box().'</form></div>'); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)."\n". |
|
&Apache::lonhtmlcommon::end_pick_box().'</div>'."\n". |
|
&Apache::loncommon::end_page()); |
|
return; |
|
} |
|
$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> |
<option value="log">'.&mt('View request history').'</option> |
</select>'. |
</select></form>'. |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_title('Course Type').' |
&Apache::lonhtmlcommon::row_title(&mt('Type')).' |
<select size="1" name="crstype"> |
<form name="mainmenu_coursetype" method="post" action=""> |
<option value="any">'.&mt('All types').'</option>'); |
<select size="1" name="crstype">'); |
if ((ref($types) eq 'ARRAY') && (ref($typename) eq 'HASH')) { |
if (ref($can_request) eq 'HASH') { |
foreach my $type (@{$types}) { |
if (keys(%{$can_request}) > 1) { |
my $selected = ''; |
$r->print(' <option value="any">'.&mt('All types').'</option>'); |
if ($type eq 'official') { |
} |
$selected = ' selected="selected"'; |
if ((ref($types) eq 'ARRAY') && (ref($typename) eq 'HASH')) { |
} |
foreach my $type (@{$types}) { |
$r->print('<option value="'.$type.'"'.$selected.'>'.$typename->{$type}. |
next unless($can_request->{$type}); |
'</option>'."\n"); |
my $selected = ''; |
} |
if ($env{'form.crstype'} eq '') { |
} |
if ($type eq 'official') { |
$r->print('</select> |
$selected = ' selected="selected"'; |
<input type="hidden" name="state" value="crstype" />'. |
} |
&Apache::lonhtmlcommon::row_closure(1). |
} else { |
&Apache::lonhtmlcommon::end_pick_box().'<br /> |
if ($type eq $env{'form.crstype'}) { |
<input type="button" name="next" value="'.$nexttext.'" onclick="javascript:nextPage(document.'.$formname.')" /> |
$selected = ' selected="selected"'; |
</form></div>'); |
} |
|
} |
|
$r->print('<option value="'.$type.'"'.$selected.'>'.&mt($typename->{$type}). |
|
'</option>'."\n"); |
|
} |
|
} |
|
} |
|
$r->print('</select></form>'."\n". |
|
&Apache::lonhtmlcommon::row_closure(1)."\n". |
|
&Apache::lonhtmlcommon::end_pick_box().'</div>'."\n". |
|
'<div><form name="'.$formname.'" method="post" action="/adm/requestcourse">'."\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></div>'); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
|
|
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 625 END
|
Line 860 END
|
} |
} |
if ($action eq 'new') { |
if ($action eq 'new') { |
my $jsextra; |
my $jsextra; |
unless (($state eq 'review') || ($state eq 'process')) { |
if (($state eq 'courseinfo') || ($state eq 'codepick')) { |
$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(); |
|
} |
|
my $title; |
|
if ($env{'form.crstype'} eq 'community') { |
|
$title = 'Request a community'; |
|
} else { |
|
$title = 'Request a course'; |
} |
} |
$r->print(&header('Request a course',$js.$jscript,$loaditems,$jsextra).$crumb); |
$r->print(&header($title,$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 644 END
|
Line 893 END
|
} elsif ($state eq 'cancel') { |
} elsif ($state eq 'cancel') { |
$jsextra = &viewcancel_javascript($formname); |
$jsextra = &viewcancel_javascript($formname); |
} |
} |
$r->print(&header('Manage course requests',$js.$jscript.$jsextra,$loaditems). |
my $title; |
$crumb); |
if ($env{'form.crstype'} eq 'community') { |
|
$title = 'Manage community requests'; |
|
} else { |
|
$title = 'Manage course requests'; |
|
} |
|
$r->print(&header($title,$js.$jscript.$jsextra,$loaditems).$crumb); |
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". |
my $title; |
&print_request_status($dom).'</form>'); |
if ($env{'form.crstype'} eq 'community') { |
|
$title = &mt('Pending community requests'); |
|
} elsif ($env{'form.crstype'} eq 'official') { |
|
$title = &mt('Pending requests for official courses'); |
|
} elsif ($env{'form.crstype'} eq 'unofficial') { |
|
$title = &mt('Pending requests for unofficial courses'); |
|
} else { |
|
$title = &mt('Pending course/community requests'); |
|
} |
|
$r->print('<h3>'.$title.'</h3><div>'."\n".$form."\n". |
|
&print_request_status($dom,$action).'</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 660 END
|
Line 924 END
|
&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('<h3>'.&mt('Course Request Details').'</h3><div>'."\n".$form."\n". |
my $title; |
&print_review($formname,$dom,\@codetitles,\%cat_titles,\%cat_order, |
if ($env{'form.crstype'} eq 'community') { |
|
$title = &mt('Community Request Details'); |
|
} else { |
|
$title = &mt('Course Request Details'); |
|
} |
|
$r->print('<h3>'.$title.'</h3><div>'."\n".$form."\n". |
|
&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 673 END
|
Line 943 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 $title; |
|
if ($env{'form.crstype'} eq 'community') { |
|
$title = &mt('Cancel community request'); |
|
} else { |
|
$title = &mt('Cancel course request'); |
|
} |
my ($result,$output) = &print_cancel_request($dom,$env{'form.origcnum'}); |
my ($result,$output) = &print_cancel_request($dom,$env{'form.origcnum'}); |
$r->print('<h3>'.&mt('Cancel course request').'</h3><div>'."\n".$form."\n". |
$r->print('<h3>'.$title.'</h3><div>'."\n".$form."\n". |
$output); |
$output); |
my @excluded = &get_excluded_elements($dom,$states,'view','cancel'); |
my @excluded = &get_excluded_elements($dom,$states,'view','cancel'); |
$r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'</div>'); |
$r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'</div>'); |
Line 687 END
|
Line 963 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 726 END
|
Line 1003 END
|
'<input type="hidden" name="showdom" value="'.$dom.'" />'."\n". |
'<input type="hidden" name="showdom" value="'.$dom.'" />'."\n". |
'<input type="hidden" name="orignum" value="'.$cnum.'" />'."\n"); |
'<input type="hidden" name="orignum" value="'.$cnum.'" />'."\n"); |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
$r->print(&mt('Your course request has been cancelled.')); |
if ($env{'form.crstype'} eq 'community') { |
|
$r->print(&mt('Your community request has been cancelled.')); |
|
} else { |
|
$r->print(&mt('Your course request has been cancelled.')); |
|
} |
} else { |
} else { |
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'. |
&mt('The request cancellation process was not complete.'). |
&mt('The request cancellation process was not complete.'). |
Line 734 END
|
Line 1015 END
|
} |
} |
$r->print('</form>'); |
$r->print('</form>'); |
} |
} |
} elsif ($action eq 'log') { |
} elsif ($action eq 'display') { |
$r->print(&coursereq_log('View request log',$jscript,$loaditems).$crumb); |
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); |
|
} |
|
my ($title,$header); |
|
if ($env{'form.crstype'} eq 'community') { |
|
$title = 'Community Request'; |
|
$header = &mt('Community Request'); |
|
} else { |
|
$title = 'Course Request'; |
|
$header = &mt('Course Request'); |
|
} |
|
$r->print(&header($title,'','','',{ 'only_body' => 1}). |
|
$crumb."\n".'<h3>'.$header.'</h3>'. |
|
&print_review($dom,\@codetitles,\%cat_titles,\%cat_order, |
|
\@code_order,$uname,$udom)."\n".'</div>'. |
|
&close_popup_form()); |
} |
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
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 752 sub print_request_form {
|
Line 1237 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 'valid') { |
$message .= '<br />'.$codechk; |
|
} |
|
$message .= '</div>'; |
$prev = 'crstype'; |
$prev = 'crstype'; |
} |
} |
$r->print($message); |
$r->print($message); |
Line 805 sub print_request_form {
|
Line 1274 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 818 sub print_request_form {
|
Line 1289 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'}; |
} else { |
} else { |
$cnum = &Apache::lonnet::generate_coursenum($dom); |
my $gentype = 'Course'; |
|
if ($crstype eq 'community') { |
|
$gentype = 'Community'; |
|
} |
|
$cnum = &Apache::lonnet::generate_coursenum($dom,$gentype); |
} |
} |
&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>'. |
if ($crstype eq 'community') { |
&print_review($formname,$dom,\@codetitles,\%cat_titles,\%cat_order, |
$r->print('<h3>'.&mt('Review community request details before submission').'</h3>'); |
\@code_order). |
} else { |
|
$r->print('<h3>'.&mt('Review course request details before submission').'</h3>'); |
|
} |
|
$r->print(&print_review($dom,\@codetitles,\%cat_titles,\%cat_order,\@code_order,'','',\@disallowed,\%disallowmsg). |
'<input type="hidden" name="cnum" value="'.$cnum.'" />'); |
'<input type="hidden" name="cnum" value="'.$cnum.'" />'); |
$navtxt{'next'} = &mt('Submit course request'); |
if ($crstype eq 'community') { |
|
$navtxt{'next'} = &mt('Submit community request'); |
|
} else { |
|
$navtxt{'next'} = &mt('Submit course request'); |
|
} |
} elsif ($state eq 'process') { |
} elsif ($state eq 'process') { |
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); |
} |
} |
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') { |
if ($state eq 'personnel') { |
push(@excluded,'persontotal'); |
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 891 sub get_excluded_elements {
|
Line 1526 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 906 sub print_enrollment_menu {
|
Line 1542 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 (!$crosslisttotal) { |
if (!$crosslisttotal) { |
$crosslisttotal = 1; |
$crosslisttotal = 1; |
Line 921 sub print_enrollment_menu {
|
Line 1565 sub print_enrollment_menu {
|
} |
} |
if ($crosslist_form) { |
if ($crosslist_form) { |
$crosslist_form .= |
$crosslist_form .= |
&Apache::lonhtmlcommon::row_title(&mt('Add another?')). |
&Apache::lonhtmlcommon::row_title(&mt('Add another')). |
'<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 $checked = ' checked="checked"'; |
my $secon = ' checked="checked"'; |
|
my $secoff = ''; |
if ($env{'form.origcnum'}) { |
if ($env{'form.origcnum'}) { |
$checked=''; |
$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.' value="1" /></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 1002 sub inst_section_selector {
|
Line 1681 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'; |
} |
} |
$table = &Apache::lonhtmlcommon::row_title($datetitles{'start'}). |
|
$startform. |
my %help_item = ( |
&Apache::lonhtmlcommon::row_closure(). |
access => { |
&Apache::lonhtmlcommon::row_title($datetitles{'end'}). |
start => 'Course_Request_Access_Start', |
$endform.$perpetual. |
end => 'Course_Request_Access_End', |
&Apache::lonhtmlcommon::row_closure(1); |
}, |
|
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(&Apache::loncommon::help_open_topic($help_item{$prefix}{'start'}). |
|
' '.&mt($datetitles{'start'})).$startform. |
|
&Apache::lonhtmlcommon::row_closure(1). |
|
&Apache::lonhtmlcommon::row_title(&Apache::loncommon::help_open_topic($help_item{$prefix}{'end'}). |
|
' '.&mt($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 1032 sub print_personnel_menu {
|
Line 1735 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 @roles = &Apache::lonuserutils::roles_by_context('course'); |
|
my $type = 'Course'; |
my $type = 'Course'; |
if ($crstype eq 'community') { |
if ($crstype eq 'community') { |
$type = 'Community'; |
$type = 'Community'; |
} |
} |
|
my $roleoptions; |
|
my @roles = &Apache::lonuserutils::roles_by_context('course','',$type); |
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 1085 sub print_personnel_menu {
|
Line 1776 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 1113 sub print_personnel_menu {
|
Line 1809 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')). |
'<input name="persontotal" type="hidden" value="'.$persontotal.'" />'. |
'<input name="persontotal" type="hidden" value="'.$persontotal.'" />'. |
'<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>'; |
|
if ($crstype eq 'community') { |
|
$output .= '<p>'.&mt('You may also add users later, once the community has been created, by using the "Manage community users" link, accessible from the "Main Menu".').'</p>'; |
|
} else { |
|
$output .= '<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 print_request_status { |
sub current_lc_sections { |
my ($dom) = @_; |
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 sorted_request_history { |
|
my ($dom,$action,$curr_req) = @_; |
|
my ($after,$before,$statusfilter,$crstypefilter); |
|
if ($env{'form.status'} ne '') { |
|
$statusfilter = $env{'form.status'}; |
|
} |
|
if ($env{'form.crstype'} ne '') { |
|
$crstypefilter = $env{'form.crstype'}; |
|
} |
|
if (ref($curr_req) eq 'HASH') { |
|
$after = $curr_req->{'requested_after_date'}, |
|
$before = $curr_req->{'requested_before_date'}; |
|
$statusfilter = $curr_req->{'status'}; |
|
$crstypefilter = $curr_req->{'crstype'}; |
|
} |
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 %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 ($action eq 'view') { |
(undef,my($cdom,$cnum)) = split(':',$key); |
next unless (($statusinfo{$key} eq 'approval') || ($statusinfo{$key} eq 'pending')); |
next if ($cdom ne $dom); |
} else { |
my $requestkey = $cdom.'_'.$cnum; |
next unless (($statusfilter eq 'any') || |
if ($requestkey =~ /^($match_domain)_($match_courseid)$/) { |
($statusfilter eq $statusinfo{$key})); |
my %history = &Apache::lonnet::restore($requestkey,'courserequests', |
} |
$env{'user.domain'},$env{'user.name'}); |
(undef,my($cdom,$cnum)) = split(':',$key); |
my $entry; |
next if ($cdom ne $dom); |
my $timestamp = $history{'reqtime'}; |
my $requestkey = $cdom.'_'.$cnum; |
my $crstype = $history{'crstype'}; |
if ($requestkey =~ /^($match_domain)_($match_courseid)$/) { |
my $disposition = $history{'disposition'}; |
my %history = &Apache::lonnet::restore($requestkey,'courserequests', |
|
$env{'user.domain'},$env{'user.name'}); |
|
my $entry; |
|
my $reqtime = $history{'reqtime'}; |
|
my $lastupdate = $history{'timestamp'}; |
|
my $crstype = $history{'crstype'}; |
|
my $disposition = $history{'disposition'}; |
|
my $status = $history{'status'}; |
|
if ($action eq 'view') { |
next if ((exists($history{'status'})) && ($history{'status'} eq 'created')); |
next if ((exists($history{'status'})) && ($history{'status'} eq 'created')); |
next unless (($env{'form.crstype'} eq 'any') || |
} else { |
($env{'form.crstype'} eq $crstype)); |
next if (($reqtime < $after) || ($reqtime > $before)); |
|
} |
|
next unless (($crstypefilter eq 'any') || |
|
($crstypefilter eq $crstype)); |
|
if ($action eq 'view') { |
next unless (($disposition eq 'approval') || |
next unless (($disposition eq 'approval') || |
($disposition eq 'pending')); |
($disposition eq 'pending')); |
if (ref($history{'details'}) eq 'HASH') { |
} |
$entry = $requestkey.':'.$crstype.':'. |
if (ref($history{'details'}) eq 'HASH') { |
&escape($history{'details'}{'cdescr'}); |
$entry = $requestkey.':'.$crstype.':'. |
if ($crstype eq 'official') { |
&escape($history{'details'}{'cdescr'}); |
$entry .= ':'.&escape($history{'details'}{'instcode'}); |
if ($action eq 'log') { |
|
$entry .= ':'.$lastupdate.':'; |
|
if ($statusinfo{$key} ne '') { |
|
$entry .= $statusinfo{$key}; |
|
} elsif ($status ne '') { |
|
$entry .= $status; |
|
} else { |
|
$entry .= $disposition; |
} |
} |
} |
} |
if ($entry ne '') { |
if ($crstype eq 'official') { |
if (exists($queue_by_date{$timestamp})) { |
$entry .= ':'.&escape($history{'details'}{'instcode'}); |
if (ref($queue_by_date{$timestamp}) eq 'ARRAY') { |
} |
push(@{$queue_by_date{$timestamp}},$entry); |
} |
} |
if ($entry ne '') { |
} else { |
if (exists($queue_by_date{$reqtime})) { |
@{$queue_by_date{$timestamp}} = ($entry); |
if (ref($queue_by_date{$reqtime}) eq 'ARRAY') { |
|
push(@{$queue_by_date{$reqtime}},$entry); |
} |
} |
|
} else { |
|
@{$queue_by_date{$reqtime}} = ($entry); |
} |
} |
} |
} |
} |
} |
} |
} |
$formname = 'requestcrs'; |
return %queue_by_date; |
|
} |
|
|
|
sub print_request_status { |
|
my ($dom,$action) = @_; |
|
my %queue_by_date = &sorted_request_history($dom,$action); |
my @sortedtimes = sort {$a <=> $b} (keys(%queue_by_date)); |
my @sortedtimes = sort {$a <=> $b} (keys(%queue_by_date)); |
$output = '<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'."\n". |
my $formname = 'requestcrs'; |
|
my ($types,$typenames) = &Apache::loncommon::course_types(); |
|
my $output = '<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'."\n". |
|
|
'<input type="hidden" name="state" value="'.$env{'form.state'}.'" />'."\n". |
'<input type="hidden" name="state" value="'.$env{'form.state'}.'" />'."\n". |
'<input type="hidden" name="crstype" value="'.$env{'form.crstype'}.'" />'."\n". |
'<input type="hidden" name="crstype" value="'.$env{'form.crstype'}.'" />'."\n". |
'<input type="hidden" name="showdom" value="" />'."\n". |
'<input type="hidden" name="showdom" value="" />'."\n". |
'<input type="hidden" name="cnum" value="" />'."\n"; |
'<input type="hidden" name="cnum" value="" />'."\n"; |
if (@sortedtimes > 0) { |
if (@sortedtimes > 0) { |
|
my $desctitle; |
|
if ($env{'form.crstype'} eq 'any') { |
|
$desctitle = &mt('Course/Community Description') |
|
} elsif ($env{'form.crstype'} eq 'community') { |
|
$desctitle = &mt('Community Description') |
|
} else { |
|
$desctitle = &mt('Course Description'); |
|
} |
$output .= &Apache::loncommon::start_data_table(). |
$output .= &Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_header_row(). |
&Apache::loncommon::start_data_table_header_row(). |
'<th>'.&mt('Action').'</th>'. |
'<th>'.&mt('Action').'</th>'. |
'<th>'.&mt('Course Description').'</th>'. |
'<th>'.$desctitle.'</th>'. |
'<th>'.&mt('Domain').'</th>'; |
'<th>'.&mt('Domain').'</th>'; |
if ($env{'form.crstype'} eq 'any') { |
if ($env{'form.crstype'} eq 'any') { |
$output .= '<th>'.&mt('Type').'</th>'; |
$output .= '<th>'.&mt('Type').'</th>'; |
Line 1217 sub print_request_status {
|
Line 1987 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 1240 sub print_request_status {
|
Line 2013 sub print_request_status {
|
} |
} |
$output .= &Apache::loncommon::end_data_table(); |
$output .= &Apache::loncommon::end_data_table(); |
} else { |
} else { |
$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>'; |
if ($env{'form.crstype'} eq 'any') { |
|
$output .= '<div>'.&mt('You have no matching course or community requests awaiting approval by a Domain Coordinator or held in a queue pending administrative action at your institution.').'</div>'; |
|
} elsif ($env{'form.crstype'} eq 'community') { |
|
$output .= '<div>'.&mt('You have no matching community requests awaiting approval by a Domain Coordinator or held in a queue pending administrative action at your institution.').'</div>'; |
|
} else { |
|
$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 1266 sub print_cancel_request {
|
Line 2044 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 1282 sub print_cancel_request {
|
Line 2060 sub print_cancel_request {
|
'<td>'.$showtype.'</td>'. |
'<td>'.$showtype.'</td>'. |
&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::end_data_table(). |
&Apache::loncommon::end_data_table(). |
'<br /><div class="LC_warning">'. |
'<br /><div class="LC_warning">'; |
&mt('Cancelling the request will remove it from the queue of pending course requests').'</div>'; |
if ($crstype eq 'community') { |
|
$output .= &mt('Cancelling the request will remove it from the queue of pending community requests').'</div>'; |
|
} else { |
|
$output .= &mt('Cancelling the request will remove it from the queue of pending course requests').'</div>'; |
|
} |
$result = 'ok'; |
$result = 'ok'; |
} else { |
} else { |
$output = '<div class="LC_error">'.&mt('No record exists for the course ID').'</div>'; |
$output = '<div class="LC_error">'.&mt('No record exists for the course ID').'</div>'; |
Line 1345 ENDJS
|
Line 2127 ENDJS
|
} |
} |
|
|
sub print_request_logs { |
sub print_request_logs { |
my ($jscript,$loaditems,$crumb) = @_; |
my ($r,$dom,$jscript,$loaditems,$crumb) = @_; |
|
my $title; |
|
if ($env{'form.crstype'} eq 'community') { |
|
$title = 'Community Request Logs'; |
|
} elsif ($env{'form.crstype'} eq 'any') { |
|
$title = 'Course/Community Request Logs'; |
|
} else { |
|
$title = 'Course Request Logs'; |
|
} |
|
$r->print(&header($title,$jscript,$loaditems).$crumb); |
|
my $formname = 'requestcrs'; |
|
$r->print('<form action="/adm/requestcourse" method="post" name="'.$formname.'" onsubmit="javascript:setPage(this);">'."\n". |
|
'<input type="hidden" name="action" value="log" />'."\n". |
|
'<input type="hidden" name="state" value="display" />'."\n"); |
|
# set defaults |
|
my $now = time(); |
|
my $defstart = $now - (7*24*3600); #7 days ago |
|
my %defaults = ( |
|
page => '1', |
|
show => '10', |
|
crstype => 'any', |
|
status => 'any', |
|
requested_before_date => $now, |
|
requested_after_date => $defstart, |
|
); |
|
my ($types,$typenames) = &Apache::loncommon::course_types(); |
|
my $more_records = 0; |
|
my %curr; |
|
foreach my $item ('show','page','crstype','status') { |
|
$curr{$item} = $env{'form.'.$item}; |
|
} |
|
$curr{'requested_after_date'} = &Apache::lonhtmlcommon::get_date_from_form('requested_after_date'); |
|
$curr{'requested_before_date'} = &Apache::lonhtmlcommon::get_date_from_form('requested_before_date'); |
|
foreach my $key (keys(%defaults)) { |
|
if ($curr{$key} eq '') { |
|
$curr{$key} = $defaults{$key}; |
|
} |
|
} |
|
my ($statuses,$statusnames) = &reqstatus_names($curr{'crstype'}); |
|
$r->print('<input type="hidden" name="page" value="'.$curr{'page'}.'" />'. |
|
&requestlog_display_filter($formname,\%curr)); |
|
my %queue_by_date = &sorted_request_history($dom,$env{'form.action'},\%curr); |
|
my @sortedtimes = sort {$a <=> $b} (keys(%queue_by_date)); |
|
my $showntablehdr = 0; |
|
my $tablehdr = &Apache::loncommon::start_data_table(). |
|
&Apache::loncommon::start_data_table_header_row(). |
|
'<th> </th><th>'.&mt('Request Date').'</th>'. |
|
'<th>'.&mt('Description').'</th>'; |
|
if ($curr{'crstype'} eq 'any') { |
|
$tablehdr .= '<th>'.&mt('Course Type').'</th>'; |
|
} |
|
if (($curr{'crstype'} eq 'official') || ($curr{'crstype'} eq 'any')) { |
|
$tablehdr .= '<th>'.&mt('Institutional Code').'</th>'; |
|
} |
|
if ($curr{'status'} eq 'any') { |
|
$tablehdr .= '<th>'.&mt('Status').'</th>'; |
|
} elsif ($curr{'status'} eq 'created') { |
|
$tablehdr .= '<th>'.&mt('Creation Date').'</th>'; |
|
} elsif ($curr{'status'} eq 'cancelled') { |
|
$tablehdr .= '<th>'.&mt('Cancellation Date').'</th>'; |
|
} elsif ($curr{'status'} eq 'rejected') { |
|
$tablehdr .= '<th>'.&mt('Rejection Date').'</th>'; |
|
} |
|
$tablehdr .= &Apache::loncommon::end_data_table_header_row(); |
|
my ($minshown,$maxshown); |
|
$minshown = 1; |
|
my $count = 0; |
|
if ($curr{'show'} ne &mt('all')) { |
|
$maxshown = $curr{'page'} * $curr{'show'}; |
|
if ($curr{'page'} > 1) { |
|
$minshown = 1 + ($curr{'page'} - 1) * $curr{'show'}; |
|
} |
|
} |
|
my $norecords; |
|
if (@sortedtimes > 0) { |
|
foreach my $item (@sortedtimes) { |
|
if ($curr{'show'} ne &mt('all')) { |
|
if ($count >= $curr{'page'} * $curr{'show'}) { |
|
$more_records = 1; |
|
last; |
|
} |
|
} |
|
$count ++; |
|
next if ($count < $minshown); |
|
if (!$showntablehdr) { |
|
$r->print($tablehdr); |
|
$showntablehdr = 1; |
|
} |
|
my $showtime = &Apache::lonlocal::locallocaltime($item); |
|
if (ref($queue_by_date{$item}) eq 'ARRAY') { |
|
foreach my $request (sort(@{$queue_by_date{$item}})) { |
|
my ($key,$crstype,$desc,$timestamp,$status,$instcode) = split(':',$request); |
|
my ($cdom,$cnum) = split('_',$key); |
|
my $output = &Apache::loncommon::start_data_table_row(). |
|
'<td>'.$count.'</td>'. |
|
'<td>'.$showtime.'</td>'. |
|
'<td>'.&unescape($desc).'</td>'; |
|
if ($curr{'crstype'} eq 'any') { |
|
my $typename; |
|
if (ref($typenames) eq 'HASH') { |
|
$typename = &mt($typenames->{$crstype}); |
|
} |
|
if ($typename eq '') { |
|
$typename = &mt('Unknown type'); |
|
} |
|
$output .= '<td>'.$typename.'</td>'; |
|
} |
|
if (($curr{'crstype'} eq 'any') || |
|
($curr{'crstype'} eq 'official')) { |
|
my $showinstcode; |
|
if ($crstype eq 'official') { |
|
$showinstcode = &unescape($instcode); |
|
} else { |
|
$showinstcode = &mt('Not applicable'); |
|
} |
|
$output .= '<td>'.$showinstcode.'</td>'; |
|
} |
|
if ($curr{'status'} eq 'any') { |
|
my $statusname = &mt('Unknown status'); |
|
if (ref($statusnames) eq 'HASH') { |
|
if ($statusnames->{$status} ne '') { |
|
$statusname = $statusnames->{$status}; |
|
} |
|
} |
|
if (($status eq 'created') || ($status eq 'cancelled') || |
|
($status eq 'rejected')) { |
|
$statusname .= ' '.&Apache::lonlocal::locallocaltime($timestamp); |
|
} |
|
$output .= '<td>'.$statusname.'</td>'; |
|
} elsif (($status eq 'created') || ($status eq 'cancelled') || |
|
($status eq 'rejected')) { |
|
$output .= '<td>'.&Apache::lonlocal::locallocaltime($timestamp).'</td>'; |
|
} |
|
$output .= &Apache::loncommon::end_data_table_row(); |
|
$r->print($output); |
|
} |
|
} |
|
} |
|
if ($showntablehdr) { |
|
$r->print(&Apache::loncommon::end_data_table()); |
|
if (($curr{'page'} > 1) || ($more_records)) { |
|
$r->print('<table><tr>'); |
|
if ($curr{'page'} > 1) { |
|
$r->print('<td><a href="javascript:chgPage('."'previous'".');">'.&mt('Previous [_1] changes',$curr{'show'}).'</a></td>'); |
|
} |
|
if ($more_records) { |
|
$r->print('<td><a href="javascript:chgPage('."'next'".');">'.&mt('Next [_1] changes',$curr{'show'}).'</a></td>'); |
|
} |
|
$r->print('</tr></table>'); |
|
$r->print(<<"ENDSCRIPT"); |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
function chgPage(caller) { |
|
if (caller == 'previous') { |
|
document.$formname.page.value --; |
|
} |
|
if (caller == 'next') { |
|
document.$formname.page.value ++; |
|
} |
|
document.$formname.submit(); |
|
return; |
|
} |
|
// ]]> |
|
</script> |
|
ENDSCRIPT |
|
} |
|
} else { |
|
$norecords = 1; |
|
} |
|
} else { |
|
$norecords = 1; |
|
} |
|
if ($norecords) { |
|
$r->print('<p class="LC_info">'. |
|
&mt('There are no records to display'). |
|
'</p>'); |
|
} |
|
$r->print('</form>'. |
|
&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
|
|
|
sub reqstatus_names { |
|
my ($crstype) = @_; |
|
my @statuses = qw(created approval pending rejected cancelled); |
|
my %statusnames = |
|
&Apache::lonlocal::texthash ( |
|
created => 'Created', |
|
approval => 'Queued pending approval', |
|
pending => 'Queued pending validation', |
|
rejected => 'Request rejected', |
|
cancelled => 'Request cancelled', |
|
); |
|
if (($crstype eq 'official') || ($crstype eq 'unofficial')) { |
|
$statusnames{'created'} = &mt('Course created'); |
|
} elsif ($crstype eq 'community') { |
|
$statusnames{'created'} = &mt('Community created'); |
|
} |
|
return (\@statuses,\%statusnames); |
|
} |
|
|
|
sub requestlog_display_filter { |
|
my ($formname,$curr) = @_; |
|
my $nolink = 1; |
|
my $output = '<table><tr><td valign="top">'. |
|
'<span class="LC_nobreak"><b>'.&mt('Records/page:').'</b></span><br />'. |
|
&Apache::lonmeta::selectbox('show',$curr->{'show'},undef, |
|
(&mt('all'),5,10,20,50,100,1000,10000)). |
|
'</td><td> </td>'; |
|
my $startform = |
|
&Apache::lonhtmlcommon::date_setter($formname,'requested_after_date', |
|
$curr->{'requested_after_date'},undef, |
|
undef,undef,undef,undef,undef,undef,$nolink); |
|
my $endform = |
|
&Apache::lonhtmlcommon::date_setter($formname,'requested_before_date', |
|
$curr->{'requested_before_date'},undef, |
|
undef,undef,undef,undef,undef,undef,$nolink); |
|
$output .= '<td valign="top"><b>'.&mt('Window during which course/community was requested:').'</b><br />'. |
|
'<table><tr><td>'.&mt('After:'). |
|
'</td><td>'.$startform.'</td></tr>'. |
|
'<tr><td>'.&mt('Before:').'</td>'. |
|
'<td>'.$endform.'</td></tr></table>'. |
|
'</td>'. |
|
'<td> </td>'; |
|
my ($types,$typenames) = &Apache::loncommon::course_types(); |
|
if (ref($types) eq 'ARRAY') { |
|
if (@{$types} > 1) { |
|
$output .= '<td valign="top"><b>'. |
|
&mt('Course Type:').'</b><br /><select name="crstype">'; |
|
my $selstr = ''; |
|
if ($curr->{'crstype'} eq 'any') { |
|
$selstr = ' selected="selected"'; |
|
} |
|
$output .= '<option value="any"'.$selstr.'>'.&mt('All types').'</option>'."\n"; |
|
foreach my $crstype (@{$types}) { |
|
my $selstr = ''; |
|
if ($curr->{'crstype'} eq $crstype) { |
|
$selstr = ' selected="selected"'; |
|
} |
|
my $typename = $crstype; |
|
if (ref($typenames) eq 'HASH') { |
|
if ($typenames->{$crstype} ne '') { |
|
$typename = $typenames->{$crstype}; |
|
} |
|
} |
|
$output .= '<option value="'.$crstype.'"'.$selstr.'>'.$typename.'</option>'."\n"; |
|
} |
|
$output .= '</select></td>'; |
|
} |
|
} |
|
my ($statuses,$statusnames) = &reqstatus_names($curr->{'crstype'}); |
|
if (ref($statuses) eq 'ARRAY') { |
|
if (@{$statuses} > 1) { |
|
$output .= '<td valign="top"><b>'. |
|
&mt('Request Status:').'</b><br /><select name="status">'; |
|
my $selstr = ''; |
|
if ($curr->{'status'} eq 'any') { |
|
$selstr = ' selected="selected"'; |
|
} |
|
$output .= '<option value="any"'.$selstr.'>'.&mt('Any status').'</option>'."\n"; |
|
foreach my $status (@{$statuses}) { |
|
my $selstr = ''; |
|
if ($curr->{'status'} eq $status) { |
|
$selstr = ' selected="selected"'; |
|
} |
|
my $statusname = $status; |
|
if (ref($statusnames) eq 'HASH') { |
|
if ($statusnames->{$status} ne '') { |
|
$statusname = $statusnames->{$status}; |
|
} |
|
} |
|
$output .= '<option value="'.$status.'"'.$selstr.'>'.$statusname.'</option>'."\n"; |
|
} |
|
$output .= '</select></td>'; |
|
} |
|
} |
|
$output .= '</tr></table>'; |
|
|
|
# Update Display button |
|
$output .= '<p>'. |
|
'<input type="submit" value="'.&mt('Update Display').'" />'. |
|
'</p><hr />'; |
|
return $output; |
|
} |
|
|
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 1367 sub print_review {
|
Line 2434 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 1468 sub print_review {
|
Line 2535 sub print_review {
|
|
|
my %ctxt = &clone_text(); |
my %ctxt = &clone_text(); |
$inst_headers .= '<th>'.&mt('Clone From').'</th>'; |
$inst_headers .= '<th>'.&mt('Clone From').'</th>'; |
if (($env{'form.clonecrs'} =~ /^$match_name$/) && |
if (($env{'form.cloning'}) && |
|
($env{'form.clonecrs'} =~ /^$match_name$/) && |
($env{'form.clonedom'} =~ /^$match_domain$/)) { |
($env{'form.clonedom'} =~ /^$match_domain$/)) { |
my $canclone = &Apache::loncoursequeueadmin::can_clone_course($env{'user.name'}, |
my $canclone = &Apache::loncoursequeueadmin::can_clone_course($uname, |
$env{'user.domain'},$env{'form.clonecrs'}, $env{'form.clonedom'}); |
$udom,$env{'form.clonecrs'},$env{'form.clonedom'}, |
|
$env{'form.crstype'}); |
if ($canclone) { |
if ($canclone) { |
my %courseenv = &Apache::lonnet::userenvironment($env{'form.clonedom'}, |
my %courseenv = &Apache::lonnet::userenvironment($env{'form.clonedom'}, |
$env{'form.clonecrs'},('description','internal.coursecode')); |
$env{'form.clonecrs'},('description','internal.coursecode')); |
Line 1513 sub print_review {
|
Line 2582 sub print_review {
|
} |
} |
|
|
my $container = 'Course'; |
my $container = 'Course'; |
|
my $ccrole = 'cc'; |
if ($env{'form.crstype'} eq 'community') { |
if ($env{'form.crstype'} eq 'community') { |
$container = 'Community'; |
$container = 'Community'; |
|
$ccrole = 'co'; |
} |
} |
|
|
$personnel_headers = '<th>'.&mt('Name').'</th><th>'.&mt('Username:Domain'). |
$personnel_headers = '<th>'.&mt('Name').'</th><th>'.&mt('Username:Domain'). |
'</th><th>'.&mt('Role').'</th><th>'.&mt('LON-CAPA Sections'). |
'</th><th>'.&mt('Role').'</th><th>'.&mt('LON-CAPA Sections'). |
'</th>'; |
'</th>'; |
|
|
$personnel_values .= '<tr><td>'.$ownername.'</td><td>'.$owner.'</td>'. |
$personnel_values .= '<tr><td>'.$ownername.'</td><td>'.$owner.'</td>'. |
'<td>'.&Apache::lonnet::plaintext('cc',$container).'</td>'. |
'<td>'.&Apache::lonnet::plaintext($ccrole,$container).'</td>'. |
'<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); |
Line 1546 sub print_review {
|
Line 2629 sub print_review {
|
if ($showsec eq '') { |
if ($showsec eq '') { |
$showsec = &mt('None'); |
$showsec = &mt('None'); |
} |
} |
if ($env{'form.person_'.$i.'_role'} eq 'cc') { |
if ($env{'form.person_'.$i.'_role'} eq $ccrole) { |
$showsec = &mt('None'); |
$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 1589 sub print_review {
|
Line 2684 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 1606 sub dates_from_form {
|
Line 2701 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'); |
} |
} |
|
|
|
function toggleCloning() { |
|
var willclone; |
|
if (document.$formname.cloning.length > 1) { |
|
for (var i=0; i<document.$formname.cloning.length; i++) { |
|
if (document.$formname.cloning[i].checked) { |
|
willclone = document.$formname.cloning[i].value; |
|
} |
|
} |
|
} |
|
if (willclone == 1) { |
|
document.getElementById('cloneoptions').style.display="block"; |
|
} else { |
|
document.getElementById('cloneoptions').style.display="none"; |
|
document.$formname.clonecrs.value = ''; |
|
} |
|
} |
|
|
// ]] |
// ]] |
</script> |
</script> |
|
|
ENDJS |
ENDJS |
|
my $title = &mt('Brief Course Description'); |
my $output .= $js_validate."\n".'<div>'.&Apache::lonhtmlcommon::start_pick_box(). |
my $clonetitle = &mt('Clone content and settings from an existing course?'); |
&Apache::lonhtmlcommon::row_title('Course Description'). |
if ($crstype eq 'community') { |
'<input type="text" size="40" name="cdescr" />'; |
$title = &mt('Brief Community Description'); |
|
$clonetitle = &mt('Clone content and settings from an existing community?'); |
|
} |
|
my $output .= $js_validate."\n".&Apache::lonhtmlcommon::start_pick_box(). |
|
&Apache::lonhtmlcommon::row_headline(). |
|
'<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 1635 ENDJS
|
Line 2760 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').' '.$clonetitle. |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_closure(1). |
|
&Apache::lonhtmlcommon::row_title(&mt('Clone?')). |
|
'<label><input type="radio" name="cloning" value="1" '. |
|
'onclick="javascript:toggleCloning()" />'. |
|
&mt('Yes').(' 'x2).'</label><label>'. |
|
'<input type="radio" name="cloning" value="0" checked="checked" '. |
|
'onclick="javascript:toggleCloning()" />'.&mt('No').'</label>'. |
|
'</h3>'. |
|
&Apache::lonhtmlcommon::row_closure(1). |
|
&Apache::lonhtmlcommon::row_headline(). |
|
'<div id="cloneoptions" style="display: none" >'. |
|
&Apache::lonhtmlcommon::start_pick_box(). |
|
&clone_form($dom,$formname,$crstype). |
&Apache::lonhtmlcommon::end_pick_box().'</div>'. |
&Apache::lonhtmlcommon::end_pick_box().'</div>'. |
'<div>'.&clone_form($dom,$formname,$crstype).'</div>'."\n"; |
&Apache::lonhtmlcommon::end_pick_box()."\n"; |
return $output; |
return $output; |
} |
} |
|
|
Line 1647 sub clone_form {
|
Line 2787 sub clone_form {
|
if ($crstype eq 'community') { |
if ($crstype eq 'community') { |
$type = 'Community'; |
$type = 'Community'; |
} |
} |
my $cloneform = &Apache::loncommon::select_dom_form($dom,'clonedom'). |
|
&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{'dmn'}).'<label>'. |
|
&Apache::loncommon::select_dom_form($dom,'clonedom').'</label>'. |
|
&Apache::lonhtmlcommon::row_closure(1). |
&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="" onfocus="this.blur();opencrsbrowser('."'$formname','clonecrs','clonedom','','','','','$type'".')" />'. |
'opencrsbrowser('."'$formname','clonecrs','clonedom','','','','$type'".');" />'. |
'</label> '. |
'</label>'.&Apache::lonhtmlcommon::row_closure(1).'<label>'. |
&Apache::loncommon::selectcourse_link($formname,'clonecrs','clonedom','','','',$type). |
&Apache::lonhtmlcommon::row_title($lt{'dmn'}).'</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 1666 sub clone_form {
|
Line 2805 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 1685 sub clone_text {
|
Line 2823 sub clone_text {
|
sub coursecode_form { |
sub coursecode_form { |
my ($dom,$context,$codetitles,$cat_titles,$cat_order,$num) = @_; |
my ($dom,$context,$codetitles,$cat_titles,$cat_order,$num) = @_; |
my $output; |
my $output; |
my %rowtitle = ( |
my %rowtitle = &Apache::lonlocal::texthash ( |
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 1704 sub coursecode_form {
|
Line 2846 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 1777 sub get_course_dom {
|
Line 2919 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 1816 sub get_course_dom {
|
Line 2958 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 1828 sub display_navbuttons {
|
Line 2970 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 1862 sub print_request_outcome {
|
Line 3022 sub print_request_outcome {
|
} |
} |
$now = time; |
$now = time; |
$crstype = $env{'form.crstype'}; |
$crstype = $env{'form.crstype'}; |
|
my $ccrole = 'cc'; |
|
if ($crstype eq 'community') { |
|
$ccrole = 'co'; |
|
} |
my @instsections; |
my @instsections; |
if ($crstype eq 'official') { |
if ($crstype eq 'official') { |
if (&Apache::lonnet::auto_run('',$dom)) { |
if (&Apache::lonnet::auto_run('',$dom)) { |
Line 1923 sub print_request_outcome {
|
Line 3087 sub print_request_outcome {
|
} else { |
} else { |
@{$personnel{$uname.':'.$udom}{'roles'}} = ($role); |
@{$personnel{$uname.':'.$udom}{'roles'}} = ($role); |
} |
} |
if ($role eq 'cc') { |
if ($role eq $ccrole) { |
@{$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 1968 sub print_request_outcome {
|
Line 3139 sub print_request_outcome {
|
} |
} |
my $clonecrs = ''; |
my $clonecrs = ''; |
my $clonedom = ''; |
my $clonedom = ''; |
if (($env{'form.clonecrs'} =~ /^($match_courseid)$/) && |
if (($env{'form.cloning'}) && |
|
($env{'form.clonecrs'} =~ /^($match_courseid)$/) && |
($env{'form.clonedom'} =~ /^($match_domain)$/)) { |
($env{'form.clonedom'} =~ /^($match_domain)$/)) { |
my $clonehome = &Apache::lonnet::homeserver($env{'form.clonecrs'}, |
my $clonehome = &Apache::lonnet::homeserver($env{'form.clonecrs'}, |
$env{'form.clonedom'}); |
$env{'form.clonedom'}); |
if ($clonehome ne 'no_host') { |
if ($clonehome ne 'no_host') { |
my $canclone = |
my $canclone = |
&Apache::loncoursequeueadmin::can_clone_course($env{'user.name'}, |
&Apache::loncoursequeueadmin::can_clone_course($env{'user.name'}, |
$env{'user.domain'},$env{'form.clonecrs'}, $env{'form.clonedom'}); |
$env{'user.domain'},$env{'form.clonecrs'},$env{'form.clonedom'}, |
|
$crstype); |
if ($canclone) { |
if ($canclone) { |
$clonecrs = $env{'form.clonecrs'}; |
$clonecrs = $env{'form.clonecrs'}; |
$clonedom = $env{'form.clonedom'}; |
$clonedom = $env{'form.clonedom'}; |
Line 2007 sub print_request_outcome {
|
Line 3180 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 = |
|
&Apache::loncoursequeueadmin::get_processtype($env{'user.name'},$env{'user.domain'}, |
|
$env{'user.adv'},$dom,$crstype,\@inststatuses,\%domconfig); |
if ($val eq '') { |
if ($val eq '') { |
if ($crstype eq 'official') { |
if ($crstype eq 'official') { |
$output = &mt('You are not permitted to request creation of official courses.'); |
$output = &mt('You are not permitted to request creation of official courses.'); |
Line 2019 sub print_request_outcome {
|
Line 3194 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 2065 sub print_request_outcome {
|
Line 3241 sub print_request_outcome {
|
$reqstatus = $disposition; |
$reqstatus = $disposition; |
my ($modified,$queued); |
my ($modified,$queued); |
if ($disposition eq 'rejected') { |
if ($disposition eq 'rejected') { |
$output = &mt('Your course request was rejected.'); |
if ($crstype eq 'community') { |
|
$output = &mt('Your community request was rejected.'); |
|
} else { |
|
$output = &mt('Your course request was rejected.'); |
|
} |
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); |
my @roles = &Apache::lonuserutils::roles_by_context('course'); |
|
my $type = 'Course'; |
my $type = 'Course'; |
if ($crstype eq 'community') { |
if ($crstype eq 'community') { |
$type = 'Community'; |
$type = 'Community'; |
} |
} |
|
my @roles = &Apache::lonuserutils::roles_by_context('course','',$type); |
foreach my $role (@roles) { |
foreach my $role (@roles) { |
$longroles{$role}=&Apache::lonnet::plaintext($role,$type); |
$longroles{$role}=&Apache::lonnet::plaintext($role,$type); |
} |
} |
Line 2086 sub print_request_outcome {
|
Line 3267 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.'); |
if ($crstype eq 'community') { |
} else { |
$output = '<p>'.&mt('Your community request has been processed and the community has been created.'); |
$output = '<span class="LC_error">'. |
} else { |
&mt('An error occurred when processing your course request.'). |
$output = '<p>'.&mt('Your course request has been processed and the course has been created.'); |
'<br />'. |
} |
&mt('You may want to review the request details and submit the request again.'). |
$output .= '<br />'.$role_result.'</p>'; |
|
$creationresult = 'created'; |
|
} else { |
|
$output = '<span class="LC_error">'; |
|
if ($crstype eq 'community') { |
|
$output .= &mt('An error occurred when processing your community request.'); |
|
} else { |
|
$output .= &mt('An error occurred when processing your course request.'); |
|
} |
|
$output .= '<br />'. |
|
&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 2107 sub print_request_outcome {
|
Line 3299 sub print_request_outcome {
|
description => $env{'form.cdescr'}, |
description => $env{'form.cdescr'}, |
}, |
}, |
}; |
}; |
|
if ($crstype eq 'official') { |
|
$request->{$requestid}->{'instcode'} = $instcode; |
|
} |
my $statuskey = 'status:'.$dom.':'.$cnum; |
my $statuskey = 'status:'.$dom.':'.$cnum; |
my %userreqhash = &Apache::lonnet::get('courserequests',[$statuskey], |
my %userreqhash = &Apache::lonnet::get('courserequests',[$statuskey], |
$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 2124 sub print_request_outcome {
|
Line 3320 sub print_request_outcome {
|
my $putresult = &Apache::lonnet::newput_dom('courserequestqueue',$request, |
my $putresult = &Apache::lonnet::newput_dom('courserequestqueue',$request, |
$dom); |
$dom); |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
$output = &mt('Your course request has been recorded.').'<br />'. |
if ($crstype eq 'community') { |
|
$output .= &mt('Your community request has been recorded.'); |
|
} else { |
|
$output .= &mt('Your course request has been recorded.') |
|
} |
|
$output .= '<br />'. |
¬ification_information($disposition,$req_notifylist, |
¬ification_information($disposition,$req_notifylist, |
$cnum,$now); |
$cnum,$now); |
} else { |
} else { |
Line 2135 sub print_request_outcome {
|
Line 3336 sub print_request_outcome {
|
} |
} |
} |
} |
} |
} |
my ($storeresult,$statusresult); |
($storeresult,my $updateresult) = |
if ($requestkey =~ /^($match_domain)_($match_courseid)$/) { |
&Apache::loncoursequeueadmin::update_coursereq_status(\%reqhash,$dom, |
$storeresult = &Apache::lonnet::store_userdata(\%reqhash,$requestkey, |
$cnum,$reqstatus,'request'); |
'courserequests'); |
if ($modified && $queued && $storeresult eq 'ok') { |
if ($storeresult eq 'ok') { |
if ($crstype eq 'community') { |
my %status = ( |
$output .= '<p>'.&mt('Your community request has been updated').'</p>'; |
'status:'.$dom.':'.$cnum => $reqstatus, |
} else { |
); |
$output .= '<p>'.&mt('Your course request has been updated').'</p>'; |
$statusresult = &Apache::lonnet::put('courserequests',\%status); |
|
} |
} |
} else { |
$output .= ¬ification_information($disposition,$req_notifylist,$cnum,$now); |
$storeresult = 'error: invalid requestkey format'; |
|
} |
} |
if ($storeresult ne 'ok') { |
if ($validationerror ne '') { |
$output .= '<span class="LC_warning">'.&mt('An error occurred saving a record of the details of your request: [_1].',$storeresult).'</span><br />'; |
$output .= '<p class="LC_warning">'.&mt('An error occurred validating your request with institutional data sources: [_1].',$validationerror).'</p>'; |
&Apache::lonnet::logthis("Error saving course request - $requestkey for $env{'user.name'}:$env{'user.domain'} - $storeresult"); |
|
} 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 />'; |
|
&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 ($updateresult) { |
$output .= '<p>'.&mt('Your course request has been updated').'</p>'. |
$output .= $updateresult; |
¬ification_information($disposition,$req_notifylist,$cnum,$now); |
|
} |
} |
if ($validationerror ne '') { |
} |
$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') { |
|
my $ccrole = 'cc'; |
|
if ($crstype eq 'community') { |
|
$ccrole = 'co'; |
|
} |
|
unless (ref($details->{'personnel'}{$owner}) eq 'HASH') { |
|
$details->{'personnel'}{$owner} = { |
|
'roles' => [$ccrole], |
|
$ccrole => { 'usec' => [] }, |
|
}; |
|
} |
|
my @roles; |
|
if (ref($details->{'personnel'}{$owner}{'roles'}) eq 'ARRAY') { |
|
@roles = sort(@{$details->{'personnel'}{$owner}{'roles'}}); |
|
unless (grep(/^\Q$ccrole\E$/,@roles)) { |
|
push(@roles,$ccrole); |
|
} |
|
} else { |
|
@roles = ($ccrole); |
|
} |
|
foreach my $role (@roles) { |
|
my $refresh=$env{'user.refresh.time'}; |
|
if ($refresh eq '') { |
|
$refresh = $env{'user.login.time'}; |
|
} |
|
if ($refresh eq '') { |
|
$refresh = $now; |
|
} |
|
my $start = $refresh-1; |
|
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 $ccrole) { |
|
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) { |
|
if ($crstype eq 'Community') { |
|
$output = &mt('Use the following link to enter the community:'); |
|
} else { |
|
$output = &mt('Use the following link to enter the course:'); |
|
} |
|
} else { |
|
if ($crstype eq 'Community') { |
|
$output = &mt('Use the following links to your new roles to enter the community:'); |
|
} else { |
|
$output = &mt('Use the following links to your new roles to enter the course:'); |
|
} |
|
} |
|
$output .= ' <ul>'.$active.'</ul><br />'; |
|
} |
|
if ($future) { |
|
if ($crstype eq 'Community') { |
|
$output .= &mt('The following community [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'})) |
|
} else { |
|
$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'})); |
|
} |
|
$output .= ' <ul>'.$future.'</ul>'; |
|
} |
return $output; |
return $output; |
} |
} |
|
|
Line 2197 sub notification_information {
|
Line 3527 sub notification_information {
|
'</div>'; |
'</div>'; |
} else { |
} else { |
$output .= '<div class="LC_warning">'. |
$output .= '<div class="LC_warning">'. |
&mt('Your request status is: [_1].',$disposition). |
&mt('Your request status is: [_1].',$disposition). |
'</div>' |
'</div>'; |
} |
} |
return $output; |
return $output; |
} |
} |
|
|
sub get_processtype { |
|
my ($dom,$crstype,$inststatuses,$domconfig) = @_; |
|
return unless ((ref($inststatuses) eq 'ARRAY') && (ref($domconfig) eq 'HASH')); |
|
my (%userenv,%settings,$val); |
|
my @options = ('autolimit','validate','approval'); |
|
if ($dom eq $env{'user.domain'}) { |
|
%userenv = |
|
&Apache::lonnet::userenvironment($env{'user.domain'},$env{'user.name'}, |
|
'requestcourses.'.$crstype,'inststatus'); |
|
if ($userenv{'requestcourses.'.$crstype}) { |
|
$val = $userenv{'requestcourses.'.$crstype}; |
|
@{$inststatuses} = ('_custom_'); |
|
} else { |
|
my ($task,%alltasks); |
|
if (ref($domconfig->{'requestcourses'}) eq 'HASH') { |
|
%settings = %{$domconfig->{'requestcourses'}}; |
|
if (ref($settings{$crstype}) eq 'HASH') { |
|
if (($env{'user.adv'}) && ($settings{$crstype}{'_LC_adv'} ne '')) { |
|
$val = $settings{$crstype}{'_LC_adv'}; |
|
@{$inststatuses} = ('_LC_adv_'); |
|
} else { |
|
if ($userenv{'inststatus'} ne '') { |
|
@{$inststatuses} = split(',',$userenv{'inststatus'}); |
|
} else { |
|
@{$inststatuses} = ('default'); |
|
} |
|
foreach my $status (@{$inststatuses}) { |
|
if (exists($settings{$crstype}{$status})) { |
|
my $value = $settings{$crstype}{$status}; |
|
next unless ($value); |
|
unless (exists($alltasks{$value})) { |
|
if (ref($alltasks{$value}) eq 'ARRAY') { |
|
unless(grep(/^\Q$status\E$/,@{$alltasks{$value}})) { |
|
push(@{$alltasks{$value}},$status); |
|
} |
|
} else { |
|
@{$alltasks{$value}} = ($status); |
|
} |
|
} |
|
} |
|
} |
|
my $maxlimit = 0; |
|
|
|
foreach my $key (sort(keys(%alltasks))) { |
|
if ($key =~ /^autolimit=(\d*)$/) { |
|
if ($1 eq '') { |
|
$val ='autolimit='; |
|
last; |
|
} elsif ($1 > $maxlimit) { |
|
$maxlimit = $1; |
|
} |
|
} |
|
} |
|
if ($maxlimit) { |
|
$val = 'autolimit='.$maxlimit; |
|
} else { |
|
foreach my $option (@options) { |
|
if ($alltasks{$option}) { |
|
$val = $option; |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} else { |
|
%userenv = &Apache::lonnet::userenvironment($env{'user.domain'}, |
|
$env{'user.name'},'reqcrsotherdom.'.$env{'form.crstype'}); |
|
if ($userenv{'reqcrsotherdom.'.$crstype}) { |
|
my @doms = split(',',$userenv{'reqcrsotherdom.'.$crstype}); |
|
my $optregex = join('|',@options); |
|
foreach my $item (@doms) { |
|
my ($extdom,$extopt) = split(':',$item); |
|
if ($extdom eq $dom) { |
|
if ($extopt =~ /^($optregex)(=?\d*)$/) { |
|
$val = $1.$2; |
|
} |
|
last; |
|
} |
|
} |
|
@{$inststatuses} = ('_external_'); |
|
} |
|
} |
|
return $val; |
|
} |
|
|
|
sub check_autolimit { |
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','co'],[$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 = 0; |
if (ref($types) eq 'ARRAY') { |
|
foreach my $type (@{$types}) { |
|
$count{$type} = 0; |
|
} |
|
} |
|
foreach my $key (keys(%requests)) { |
foreach my $key (keys(%requests)) { |
my ($cdom,$cnum) = split('_',$key); |
my ($cdom,$cnum) = split('_',$key); |
if (exists($crsroles{$cnum.':'.$cdom.':cc'})) { |
if (ref($requests{$key}) eq 'HASH') { |
if (ref($requests{$key}) eq 'HASH') { |
next if ($requests{$key}{'crstype'} ne $crstype); |
my $type = $requests{$key}{'crstype'}; |
if (($crstype eq 'community') && |
if ($type =~ /^official|unofficial|community$/) { |
(exists($crsroles{$cnum.':'.$cdom.':co'}))) { |
$count{$type} ++; |
$count ++; |
} |
} elsif ((($crstype eq 'official') || ($crstype eq 'unofficial')) && |
|
(exists($crsroles{$cnum.':'.$cdom.':cc'}))) { |
|
$count ++; |
} |
} |
} |
} |
} |
} |
if ($count{$crstype} < $limit) { |
if ($count < $limit) { |
return 'process'; |
return 'process'; |
} else { |
} else { |
if (ref($typename) eq 'HASH') { |
if (ref($typename) eq 'HASH') { |
$$message = &mt('Your request has not been processed because you have reached the limit for the number of courses of this type.').'<br />'.&mt("Your $typename->{$crstype} limit is [_1].",$limit); |
if ($crstype eq 'community') { |
|
$$message = &mt('Your request has not been processed because you have reached the limit for the number of communities.'). |
|
'<br />'.&mt("Your limit is [_1].",$limit); |
|
} else { |
|
$$message = &mt('Your request has not been processed because you have reached the limit for the number of courses of this type.'). |
|
'<br />'.&mt("Your $typename->{$crstype} limit is [_1].",$limit); |
|
} |
} |
} |
return 'rejected'; |
return 'rejected'; |
} |
} |
Line 2326 sub check_autolimit {
|
Line 3571 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 3593 sub retrieve_settings {
|
} |
} |
$env{'form.clonecrs'} = $reqinfo{'clonecrs'}; |
$env{'form.clonecrs'} = $reqinfo{'clonecrs'}; |
$env{'form.clonedom'} = $reqinfo{'clonedom'}; |
$env{'form.clonedom'} = $reqinfo{'clonedom'}; |
|
if (($reqinfo{'clonecrs'} ne '') && ($reqinfo{'clonedom'} ne '')) { |
|
$env{'form.cloning'} = 1; |
|
} |
$env{'form.datemode'} = $reqinfo{'datemode'}; |
$env{'form.datemode'} = $reqinfo{'datemode'}; |
$env{'form.dateshift'} = $reqinfo{'dateshift'}; |
$env{'form.dateshift'} = $reqinfo{'dateshift'}; |
if (($reqinfo{'crstype'} eq 'official') && ($reqinfo{'instcode'} ne '')) { |
if (($reqinfo{'crstype'} eq 'official') && ($reqinfo{'instcode'} ne '')) { |
Line 2432 sub retrieve_settings {
|
Line 3683 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') { |