version 1.54.2.1, 2010/07/30 23:51:41
|
version 1.67, 2013/05/11 21:10:31
|
Line 134 sub handler {
|
Line 134 sub handler {
|
my $action = $env{'form.action'}; |
my $action = $env{'form.action'}; |
my $state = $env{'form.state'}; |
my $state = $env{'form.state'}; |
my (%states,%stored); |
my (%states,%stored); |
my ($jscript,$uname,$udom,$result,$warning); |
my ($jscript,$uname,$udom,$result,$warning,$showcredits,$instcredits); |
|
my %domdefs = &Apache::lonnet::get_domain_defaults($dom); |
|
if ($domdefs{'officialcredits'} || $domdefs{'unofficialcredits'}) { |
|
$showcredits = 1; |
|
} |
|
|
$states{'display'} = ['details']; |
$states{'display'} = ['details']; |
$states{'view'} = ['pick_request','details','cancel','removal']; |
$states{'view'} = ['pick_request','details','cancel','removal']; |
Line 147 sub handler {
|
Line 151 sub handler {
|
} |
} |
} |
} |
|
|
|
if (($action eq 'new') && (&Apache::loncoursequeueadmin::author_prompt())) { |
|
if (ref($states{$action}) eq 'ARRAY') { |
|
push(@{$states{$action}},'reqauthor'); |
|
} |
|
} |
|
|
foreach my $key (keys(%states)) { |
foreach my $key (keys(%states)) { |
if (ref($states{$key}) eq 'ARRAY') { |
if (ref($states{$key}) eq 'ARRAY') { |
unshift (@{$states{$key}},'crstype'); |
unshift (@{$states{$key}},'crstype'); |
Line 162 sub handler {
|
Line 172 sub handler {
|
personnel => 'Personnel', |
personnel => 'Personnel', |
review => 'Review', |
review => 'Review', |
process => 'Result', |
process => 'Result', |
|
reqauthor => 'Authoring Space Result', |
pick_request => 'Display Summary', |
pick_request => 'Display Summary', |
details => 'Request Details', |
details => 'Request Details', |
cancel => 'Cancel Request', |
cancel => 'Cancel Request', |
Line 173 sub handler {
|
Line 184 sub handler {
|
$trail{'enrollment'} = 'Enrollment'; |
$trail{'enrollment'} = 'Enrollment'; |
} |
} |
|
|
my ($page,$crumb,$newinstcode,$codechk,$checkedcode,$description) = |
my ($page,$crumb,$newinstcode,$codechk,$checkedcode,$description) = |
&get_breadcrumbs($dom,$action,\$state,\%states,\%trail); |
&get_breadcrumbs($dom,$action,\$state,\%states,\%trail); |
if ($action eq 'display') { |
if ($action eq 'display') { |
if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) { |
if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) { |
Line 262 sub handler {
|
Line 273 sub handler {
|
} |
} |
} |
} |
} |
} |
my %elements = &form_elements($dom); |
(my $elements,$instcredits) = &form_elements($dom,$showcredits); |
my $elementsref = {}; |
my $elementsref = {}; |
if (ref($elements{$action}) eq 'HASH') { |
if ((ref($elements) eq 'HASH') && (ref($elements->{$action}) eq 'HASH')) { |
if (ref($elements{$action}{$state}) eq 'HASH') { |
if (ref($elements->{$action}{$state}) eq 'HASH') { |
$elementsref = $elements{$action}{$state}; |
$elementsref = $elements->{$action}{$state}; |
} |
} |
} |
} |
if (($state eq 'courseinfo') && ($env{'form.clonedom'} eq '')) { |
if (($state eq 'courseinfo') && ($env{'form.clonedom'} eq '')) { |
Line 300 sub handler {
|
Line 311 sub handler {
|
&request_administration($r,$action,$state,$page,\%states,$dom, |
&request_administration($r,$action,$state,$page,\%states,$dom, |
$jscript,$loaditems,$crumb,$newinstcode, |
$jscript,$loaditems,$crumb,$newinstcode, |
$codechk,$checkedcode,$description, |
$codechk,$checkedcode,$description, |
\@invalidcrosslist); |
$showcredits,$instcredits,\@invalidcrosslist); |
} |
} |
} else { |
} else { |
$r->print(&header('Course/Community Requests').$crumb. |
$r->print(&header('Course/Community Requests').$crumb. |
Line 313 sub handler {
|
Line 324 sub handler {
|
&print_main_menu($r,\%can_request,\%states,$dom,$jscript,$loaditems,$crumb,\%request_domains); |
&print_main_menu($r,\%can_request,\%states,$dom,$jscript,$loaditems,$crumb,\%request_domains); |
} else { |
} else { |
&request_administration($r,$action,$state,$page,\%states,$dom,$jscript, |
&request_administration($r,$action,$state,$page,\%states,$dom,$jscript, |
$loaditems,$crumb); |
$loaditems,$crumb,'','','','',$showcredits); |
} |
} |
} elsif ($action eq 'display') { |
} elsif ($action eq 'display') { |
if ($warning ne '') { |
if ($warning ne '') { |
Line 324 sub handler {
|
Line 335 sub handler {
|
&close_popup_form()); |
&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,'','','','','',$uname,$udom); |
$loaditems,$crumb,'','','','',$showcredits,'','', |
|
$uname,$udom); |
} |
} |
} elsif ($action eq 'log') { |
} elsif ($action eq 'log') { |
if ($state eq 'crstype') { |
if ($state eq 'crstype') { |
Line 439 sub get_breadcrumbs {
|
Line 451 sub get_breadcrumbs {
|
$crumb = &Apache::lonhtmlcommon::breadcrumbs('Course/Community Requests','Course_Requests'); |
$crumb = &Apache::lonhtmlcommon::breadcrumbs('Course/Community Requests','Course_Requests'); |
last; |
last; |
} else { |
} else { |
if (($$state eq 'process') || ($$state eq 'removal')) { |
if (($$state eq 'process') || ($$state eq 'removal') || ($$state eq 'reqauthor')) { |
&Apache::lonhtmlcommon::add_breadcrumb( |
&Apache::lonhtmlcommon::add_breadcrumb( |
{ href => '/adm/requestcourse', |
{ href => '/adm/requestcourse', |
text => "$trail->{$states->{$action}[$i]}", |
text => "$trail->{$states->{$action}[$i]}", |
Line 488 sub header {
|
Line 500 sub header {
|
} |
} |
|
|
sub form_elements { |
sub form_elements { |
my ($dom) = @_; |
my ($dom,$showcredits) = @_; |
|
my $instcredits; |
my %elements = |
my %elements = |
( |
( |
new => { |
new => { |
Line 556 sub form_elements {
|
Line 569 sub form_elements {
|
} |
} |
if (&Apache::lonnet::auto_run('',$dom)) { |
if (&Apache::lonnet::auto_run('',$dom)) { |
my %extras = ( |
my %extras = ( |
sectotal => 'hidden', |
|
enrollstart_month => 'selectbox', |
enrollstart_month => 'selectbox', |
enrollstart_hour => 'selectbox', |
enrollstart_hour => 'selectbox', |
enrollend_month => 'selectbox', |
enrollend_month => 'selectbox', |
Line 572 sub form_elements {
|
Line 584 sub form_elements {
|
addcrosslist => 'checkbox', |
addcrosslist => 'checkbox', |
autoadds => 'radio', |
autoadds => 'radio', |
autodrops => 'radio', |
autodrops => 'radio', |
); |
); |
if ($env{'form.sectotal'} > 0) { |
my ($instcode,$titlescount) = &get_instcode($dom); |
for (my $i=0; $i<$env{'form.sectotal'}; $i++) { |
if ($instcode) { |
$extras{'sec_'.$i} = 'radio'; |
my @sections = &Apache::lonnet::auto_get_sections(undef,$dom,$instcode); |
$extras{'secnum_'.$i} = 'text'; |
if (@sections) { |
$extras{'loncapasec_'.$i} = 'text'; |
$extras{'sectotal'} = 'hidden'; |
|
if ($env{'form.sectotal'} > 0) { |
|
for (my $i=0; $i<$env{'form.sectotal'}; $i++) { |
|
$extras{'sec_'.$i} = 'radio'; |
|
$extras{'secnum_'.$i} = 'text'; |
|
$extras{'loncapasec_'.$i} = 'text'; |
|
} |
|
} |
|
} else { |
|
$extras{'addsection'} = 'checkbox'; |
|
my $sectotal = $env{'form.sectotal'}; |
|
if ($env{'form.addsection'}) { |
|
$sectotal ++; |
|
} |
|
for (my $i=0; $i<$sectotal; $i++) { |
|
$extras{'sec_'.$i} = 'checkbox'; |
|
$extras{'secnum_'.$i} = 'text', |
|
$extras{'loncapasec_'.$i} = 'text', |
|
} |
|
} |
|
(my $outcome,my $desc,$instcredits) = |
|
&Apache::lonnet::auto_validate_instcode(undef,$dom,$instcode); |
|
if ($showcredits && $instcredits eq '') { |
|
$extras{'coursecredits'} = 'text'; |
|
} |
|
} elsif ($env{'form.crstype'} eq 'unofficial') { |
|
if ($showcredits) { |
|
$extras{'coursecredits'} = 'text'; |
} |
} |
} |
} |
my $crosslisttotal = $env{'form.crosslisttotal'}; |
my $crosslisttotal = $env{'form.crosslisttotal'}; |
Line 587 sub form_elements {
|
Line 626 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 625 sub form_elements {
|
Line 663 sub form_elements {
|
} |
} |
my %personnelhash = (%{$elements{'new'}{'personnel'}},%people); |
my %personnelhash = (%{$elements{'new'}{'personnel'}},%people); |
%{$elements{'new'}{'personnel'}} = %personnelhash; |
%{$elements{'new'}{'personnel'}} = %personnelhash; |
return %elements; |
return (\%elements,$instcredits);; |
} |
} |
|
|
sub onload_action { |
sub onload_action { |
Line 647 sub onload_action {
|
Line 685 sub onload_action {
|
sub print_main_menu { |
sub print_main_menu { |
my ($r,$can_request,$states,$dom,$jscript,$loaditems,$crumb,$request_domains) = @_; |
my ($r,$can_request,$states,$dom,$jscript,$loaditems,$crumb,$request_domains) = @_; |
my ($types,$typename) = &Apache::loncommon::course_types(); |
my ($types,$typename) = &Apache::loncommon::course_types(); |
my $onchange; |
my $onchange = 'this.form.submit()'; |
unless ($env{'form.interface'} eq 'textual') { |
|
$onchange = 'this.form.submit()'; |
|
} |
|
|
|
my $nextstate_setter = "\n"; |
my $nextstate_setter = "\n"; |
if (ref($states) eq 'HASH') { |
if (ref($states) eq 'HASH') { |
foreach my $key (keys(%{$states})) { |
foreach my $key (keys(%{$states})) { |
Line 700 END
|
Line 734 END
|
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.\\n\"All types\" is not allowed.', |
all => 'You must choose a specific course type when making a new course request.', |
|
allt => '"All types" is not allowed.', |
); |
); |
$js .= <<END; |
$js .= <<END; |
if (crschoice == 'official') { |
if (crschoice == 'official') { |
Line 722 END
|
Line 757 END
|
} |
} |
} else { |
} else { |
if (actionchoice == 'new') { |
if (actionchoice == 'new') { |
alert("$lt{'all'}"); |
alert('$lt{'all'}'+'\\n'+'$lt{'allt'}'); |
return false; |
return false; |
} |
} |
} |
} |
Line 835 END
|
Line 870 END
|
|
|
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, |
$newinstcode,$codechk,$checkedcode,$description,$showcredits, |
$uname,$udom) = @_; |
$instcredits,$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 878 END
|
Line 913 END
|
} |
} |
$r->print(&header($title,$js.$jscript,$loaditems,$jsextra).$crumb); |
$r->print(&header($title,$js.$jscript,$loaditems,$jsextra).$crumb); |
&print_request_form($r,$action,$state,$page,$states,$dom,$newinstcode, |
&print_request_form($r,$action,$state,$page,$states,$dom,$newinstcode, |
$codechk,$checkedcode,$description,$invalidcrosslist); |
$codechk,$checkedcode,$description,$showcredits, |
|
$instcredits,$invalidcrosslist); |
} elsif ($action eq 'view') { |
} elsif ($action eq 'view') { |
my $jsextra; |
my $jsextra; |
my $formname = 'requestcrs'; |
my $formname = 'requestcrs'; |
Line 932 END
|
Line 968 END
|
} |
} |
$r->print('<h3>'.$title.'</h3><div>'."\n".$form."\n". |
$r->print('<h3>'.$title.'</h3><div>'."\n".$form."\n". |
&print_review($dom,\@codetitles,\%cat_titles,\%cat_order, |
&print_review($dom,\@codetitles,\%cat_titles,\%cat_order, |
\@code_order)."\n". |
\@code_order,'','','','',$instcredits)."\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', |
|
$showcredits); |
push(@excluded,'origcnum'); |
push(@excluded,'origcnum'); |
$r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'</div>'); |
$r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'</div>'); |
my $other = 'modify'; |
my $other = 'modify'; |
Line 956 END
|
Line 993 END
|
my ($result,$output) = &print_cancel_request($dom,$env{'form.origcnum'}); |
my ($result,$output) = &print_cancel_request($dom,$env{'form.origcnum'}); |
$r->print('<h3>'.$title.'</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', |
|
$showcredits); |
$r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'</div>'); |
$r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'</div>'); |
my %navtxt = &Apache::lonlocal::texthash ( |
my %navtxt = &Apache::lonlocal::texthash ( |
prev => 'Back', |
prev => 'Back', |
Line 1033 END
|
Line 1071 END
|
$r->print(&header($title,'','','',{ 'only_body' => 1}). |
$r->print(&header($title,'','','',{ 'only_body' => 1}). |
$crumb."\n".'<h3>'.$header.'</h3>'. |
$crumb."\n".'<h3>'.$header.'</h3>'. |
&print_review($dom,\@codetitles,\%cat_titles,\%cat_order, |
&print_review($dom,\@codetitles,\%cat_titles,\%cat_order, |
\@code_order,$uname,$udom)."\n".'</div>'. |
\@code_order,$uname,$udom,'','',$instcredits)."\n". |
|
'</div>'. |
&close_popup_form()); |
&close_popup_form()); |
} |
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
Line 1227 sub get_instcode {
|
Line 1266 sub get_instcode {
|
|
|
sub print_request_form { |
sub print_request_form { |
my ($r,$action,$state,$page,$states,$dom,$newinstcode,$codechk,$checkedcode, |
my ($r,$action,$state,$page,$states,$dom,$newinstcode,$codechk,$checkedcode, |
$description,$invalidcrosslist) = @_; |
$description,$showcredits,$instcredits,$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 1300 sub print_request_form {
|
Line 1339 sub print_request_form {
|
} |
} |
$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)); |
$showcredits,$instcredits,$invalidcrosslist)); |
} elsif ($state eq 'personnel') { |
} elsif ($state eq 'personnel') { |
$r->print(&print_personnel_menu($dom,$formname,$crstype,$invalidcrosslist)); |
$r->print(&print_personnel_menu($dom,$formname,$crstype,$invalidcrosslist)); |
} elsif ($state eq 'review') { |
} elsif ($state eq 'review') { |
Line 1326 sub print_request_form {
|
Line 1365 sub print_request_form {
|
} |
} |
if ($skipuser) { |
if ($skipuser) { |
push(@disallowed,$i); |
push(@disallowed,$i); |
$disallowmsg{$i} = &mt('[_1] was excluded because new users need be from the course domain','<tt>'.$personname.':'.$persondom.'</tt>'); |
$disallowmsg{$i} = &mt('[_1] was excluded because new users need to be from the course domain','<tt>'.$personname.':'.$persondom.'</tt>'); |
next; |
next; |
} |
} |
} |
} |
if (&get_cancreate_status($persondom,$personname,$dom)) { |
my $usertype = &get_usertype($persondom,$personname,\%curr_rules,\%got_rules); |
my ($allowed,$msg) = |
if (&Apache::lonuserutils::can_create_user($dom,'requestcrs',$usertype)) { |
|
my ($allowed,$msg,$authtype,$authparam) = |
&check_newuser_rules($persondom,$personname, |
&check_newuser_rules($persondom,$personname, |
\%alerts,\%rulematch,\%inst_results, |
\%alerts,\%rulematch,\%inst_results, |
\%curr_rules,\%got_rules); |
\%curr_rules,\%got_rules); |
if ($allowed) { |
if ($allowed) { |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($persondom); |
|
if ($usertype eq 'official') { |
|
if ($authtype eq '') { |
|
$authtype = $domdefaults{'auth_def'}; |
|
$authparam = $domdefaults{'auth_arg_def'}; |
|
} |
|
} elsif ($usertype eq 'unofficial') { |
|
if ($authtype eq '') { |
|
$authtype = 'internal'; |
|
$authparam = ''; |
|
} |
|
} else { |
|
$authtype = $domdefaults{'auth_def'}; |
|
$authparam = $domdefaults{'auth_arg_def'}; |
|
} |
|
if (($authtype eq '') || |
|
(($authtype =~/^krb/) && ($authparam eq ''))) { |
|
push(@disallowed,$i); |
|
$disallowmsg{$i} = &mt('[_1] was excluded because institutional information is incomplete for this new user.','<tt>'.$personname.':'.$persondom.'</tt>'); |
|
next; |
|
} |
if (ref($inst_results{$personname.':'.$persondom}) eq 'HASH') { |
if (ref($inst_results{$personname.':'.$persondom}) eq 'HASH') { |
if ($inst_results{$personname.':'.$persondom}{'lastname'} ne '') { |
if ($inst_results{$personname.':'.$persondom}{'lastname'} ne '') { |
$env{'form.person_'.$i.'_lastname'} = $inst_results{$personname.':'.$persondom}{'lastname'}; |
$env{'form.person_'.$i.'_lastname'} = $inst_results{$personname.':'.$persondom}{'lastname'}; |
Line 1394 sub print_request_form {
|
Line 1455 sub print_request_form {
|
} else { |
} else { |
$r->print('<h3>'.&mt('Review course request details before submission').'</h3>'); |
$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). |
$r->print(&print_review($dom,\@codetitles,\%cat_titles,\%cat_order,\@code_order,'','',\@disallowed,\%disallowmsg,$instcredits). |
'<input type="hidden" name="cnum" value="'.$cnum.'" />'); |
'<input type="hidden" name="cnum" value="'.$cnum.'" />'); |
if ($crstype eq 'community') { |
if ($crstype eq 'community') { |
$navtxt{'next'} = &mt('Submit community request'); |
$navtxt{'next'} = &mt('Submit community request'); |
Line 1407 sub print_request_form {
|
Line 1468 sub print_request_form {
|
\%cat_order,\@code_order); |
\%cat_order,\@code_order); |
} |
} |
my ($storeresult,$result) = &print_request_outcome($dom,\@codetitles, |
my ($storeresult,$result) = &print_request_outcome($dom,\@codetitles, |
\@code_order); |
\@code_order,$instcredits); |
$r->print($result); |
$r->print($result); |
if (($storeresult eq 'ok') || ($storeresult eq 'created')) { |
if (($storeresult eq 'ok') || ($storeresult eq 'created')) { |
$r->print('<p>'); |
|
if ($storeresult eq 'ok') { |
if ($storeresult eq 'ok') { |
$r->print('<a href="/adm/requestcourse?action=view&state=details&showdom='.$dom.'&cnum='. $env{'form.cnum'}.'">'. |
$r->print('<p><a href="/adm/requestcourse?action=view&state=details&showdom='.$dom.'&cnum='. $env{'form.cnum'}.'">'. |
&mt('Modify this request').'</a>'.(' 'x4)); |
&mt('Modify this request').'</a>'.(' 'x4). |
|
'<a href="/adm/requestcourse">'.&mt('Make another request').'</a></p>'); |
|
} |
|
if (&Apache::loncoursequeueadmin::author_prompt()) { |
|
$r->print('<h3>'.&mt('Access to authoring space').'</h3>'. |
|
'<p>'. |
|
&mt('Although assessment items can be created directly inside a course, such items only use part of the assessment capabilities of LON-CAPA.'). |
|
'<br />'. |
|
&mt('By contrast, items created in authoring space, then imported into a course, can use all of the features of the assessment engine.').'</p>'. |
|
'<p>'.&mt('Request authoring space access now?'). |
|
'<span class="LC_nobreak"> '. |
|
'<label><input type="radio" name="requestauthor" value="1" />'.&mt('Yes').'</label>'. |
|
(' 'x2). |
|
'<label><input type="radio" name="requestauthor" value="0" checked="checked"/>'.&mt('No').'</label>'. |
|
'</span></p>'. |
|
'<input type="submit" name="newauthor" value="'.&mt('Submit authoring request').'" />'. |
|
'<input type="hidden" name="state" value="reqauthor" />'. |
|
'<input type="hidden" name="action" value="'.$env{'form.action'}.'" />'. |
|
'<input type="hidden" name="cnum" value="'.$env{'form.cnum'}.'" />'. |
|
'<input type="hidden" name="showdom" value="'.$env{'form.showdom'}.'" />'. |
|
'<input type="hidden" name="crstype" value="'.$env{'form.crstype'}.'" />'. |
|
'<input type="hidden" name="disposition" value="'.$storeresult.'" />'. |
|
'<br />'); |
|
} elsif ($storeresult eq 'created') { |
|
$r->print('<p><a href="/adm/requestcourse">'.&mt('Make another request').'</a></p>'); |
|
} |
|
} |
|
} elsif ($state eq 'reqauthor') { |
|
my ($result,@links); |
|
if ($env{'form.requestauthor'}) { |
|
$r->print(&Apache::loncoursequeueadmin::process_reqauthor(\$result)); |
|
if ($result eq 'created') { |
|
my $role = 'au'; |
|
my $spec = "$role./$env{'form.showdom'}/"; |
|
push(@links,&mt('Enter your authoring space with role: [_1]', |
|
'<a href="/adm/roles?selectrole=1&'.$spec.'=1">'. |
|
&Apache::lonnet::plaintext($role).'</a>')); |
} |
} |
$r->print('<a href="/adm/requestcourse">'.&mt('Make another request').'</a></p>'); |
} |
return; |
if (($env{'form.disposition'} eq 'created') && |
|
($env{'form.cnum'} =~ /^$match_courseid$/) && |
|
($env{'form.showdom'} =~ /^$match_domain$/)) { |
|
my ($spec,$area,$role,$type); |
|
my $role = 'cc'; |
|
my $spec = "$role./$env{'form.showdom'}/$env{'form.cnum'}"; |
|
my $type = 'Course'; |
|
if ($env{'form.crstype'} eq 'community') { |
|
$type = 'Community'; |
|
} |
|
my $showrole = &Apache::lonnet::plaintext($role,$type); |
|
unshift(@links,&mt('Enter new course with role: [_1]', |
|
'<a href="/adm/roles?selectrole=1&'.$spec.'=1">'.$showrole.'</a>')); |
|
} |
|
if (@links > 1) { |
|
$r->print(&mt('New roles will be listed on your [_1]Roles[_2] page.', |
|
'<a href="/adm/roles">','</a>').' '.&mt('Choose a role:'). |
|
'<ul>'); |
|
foreach my $link (@links) { |
|
$r->print('<li>'.$link.'</li>'); |
|
} |
|
$r->print('</ul>'); |
|
} elsif (@links == 1) { |
|
$r->print('<p>'.$links[0].'</p>'); |
} |
} |
} |
} |
my @excluded = &get_excluded_elements($dom,$states,$action,$state); |
my @excluded = &get_excluded_elements($dom,$states,$action,$state,$showcredits); |
if ($state eq 'personnel') { |
if ($state eq 'personnel') { |
push(@excluded,'persontotal'); |
push(@excluded,'persontotal'); |
} |
} |
Line 1446 sub print_request_form {
|
Line 1565 sub print_request_form {
|
$count ++; |
$count ++; |
} |
} |
$env{'form.persontotal'} = $count; |
$env{'form.persontotal'} = $count; |
|
|
} |
} |
} |
} |
if ($state eq 'enrollment') { |
if ($state eq 'enrollment') { |
push(@excluded,'crosslisttotal'); |
push(@excluded,('sectotal','crosslisttotal')); |
|
} |
|
if (($state eq 'process') || ($state eq 'reqauthor')) { |
|
$r->print('</form>'); |
|
} else { |
|
$r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'</form>'); |
|
&display_navbuttons($r,$dom,$formname,$prev,$navtxt{'prev'},$next, |
|
$navtxt{'next'},$state); |
} |
} |
$r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'</form>'); |
|
&display_navbuttons($r,$dom,$formname,$prev,$navtxt{'prev'},$next, |
|
$navtxt{'next'},$state); |
|
return; |
return; |
} |
} |
|
|
sub get_cancreate_status { |
sub get_usertype { |
my ($persondom,$personname,$dom) = @_; |
my ($persondom,$personname,$curr_rules,$got_rules) = @_; |
my ($rules,$ruleorder) = |
my ($rules,$ruleorder) = |
&Apache::lonnet::inst_userrules($persondom,'username'); |
&Apache::lonnet::inst_userrules($persondom,'username'); |
my $usertype = &Apache::lonuserutils::check_usertype($persondom,$personname, |
my $usertype = &Apache::lonuserutils::check_usertype($persondom,$personname, |
$rules); |
$rules,$curr_rules,$got_rules); |
return &Apache::lonuserutils::can_create_user($dom,'requestcrs',$usertype); |
return $usertype; |
} |
} |
|
|
sub check_newuser_rules { |
sub check_newuser_rules { |
Line 1472 sub check_newuser_rules {
|
Line 1594 sub check_newuser_rules {
|
$got_rules) = @_; |
$got_rules) = @_; |
my $allowed = 1; |
my $allowed = 1; |
my $newuser = 1; |
my $newuser = 1; |
my ($checkhash,$userchkmsg); |
my ($checkhash,$userchkmsg,$authtype,$authparam); |
my $checks = { 'username' => 1 }; |
my $checks = { 'username' => 1 }; |
$checkhash->{$personname.':'.$persondom} = { 'newuser' => $newuser }; |
$checkhash->{$personname.':'.$persondom} = { 'newuser' => $newuser }; |
&Apache::loncommon::user_rule_check($checkhash,$checks,$alerts,$rulematch, |
&Apache::loncommon::user_rule_check($checkhash,$checks,$alerts,$rulematch, |
Line 1494 sub check_newuser_rules {
|
Line 1616 sub check_newuser_rules {
|
} |
} |
} |
} |
} |
} |
return ($allowed,$userchkmsg); |
if ($allowed) { |
|
if (ref($rulematch) eq 'HASH') { |
|
if (ref($rulematch->{$personname.':'.$persondom}) eq 'HASH') { |
|
my $matchedrule = $rulematch->{$personname.':'.$persondom}{'username'}; |
|
my ($rules,$ruleorder) = |
|
&Apache::lonnet::inst_userrules($persondom,'username'); |
|
if (ref($rules) eq 'HASH') { |
|
if (ref($rules->{$matchedrule}) eq 'HASH') { |
|
$authtype = $rules->{$matchedrule}{'authtype'}; |
|
$authparam = $rules->{$matchedrule}{'authparm'}; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return ($allowed,$userchkmsg,$authtype,$authparam); |
} |
} |
|
|
sub get_excluded_elements { |
sub get_excluded_elements { |
my ($dom,$states,$action,$state) = @_; |
my ($dom,$states,$action,$state,$showcredits) = @_; |
my @excluded = ('counter'); |
my @excluded = ('counter'); |
my %elements = &form_elements($dom); |
my ($elements,$instcredits) = &form_elements($dom,$showcredits); |
if (ref($states) eq 'HASH') { |
if (ref($states) eq 'HASH') { |
if (ref($states->{$action}) eq 'ARRAY') { |
if (ref($states->{$action}) eq 'ARRAY') { |
my @items = @{$states->{$action}}; |
my @items = @{$states->{$action}}; |
my $numitems = scalar(@items); |
my $numitems = scalar(@items); |
if ($numitems) { |
if ($numitems) { |
for (my $i=$numitems-1; $i>=0; $i--) { |
for (my $i=$numitems-1; $i>=0; $i--) { |
if (ref($elements{$action}) eq 'HASH') { |
if ((ref($elements) eq 'HASH') && |
if (ref($elements{$action}{$items[$i]}) eq 'HASH') { |
(ref($elements->{$action}) eq 'HASH')) { |
foreach my $key (keys(%{$elements{$action}{$items[$i]}})) { |
if (ref($elements->{$action}{$items[$i]}) eq 'HASH') { |
|
foreach my $key (keys(%{$elements->{$action}{$items[$i]}})) { |
push(@excluded,$key); |
push(@excluded,$key); |
} |
} |
} |
} |
Line 1527 sub get_excluded_elements {
|
Line 1665 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, |
$invalidcrosslist) =@_; |
$showcredits,$instcredits,$invalidcrosslist) =@_; |
my ($sections,$autoenroll,$access_dates,$output,$hasauto); |
my ($sections,$autoenroll,$access_dates,$output,$hasauto,$hascredits, |
|
$creditsrow,$domdefcredits); |
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 1540 sub print_enrollment_menu {
|
Line 1679 sub print_enrollment_menu {
|
'start' => 'Start auto-enrollment', |
'start' => 'Start auto-enrollment', |
'end' => 'End auto-enrollment', |
'end' => 'End auto-enrollment', |
); |
); |
|
if ($showcredits) { |
|
unless ($env{'form.crstype'} eq 'community') { |
|
my %domdefs = &Apache::lonnet::get_domain_defaults($dom); |
|
$domdefcredits = $domdefs{$env{'form.crstype'}.'credits'}; |
|
} |
|
} |
if ($env{'form.crstype'} eq 'official') { |
if ($env{'form.crstype'} eq 'official') { |
if (&Apache::lonnet::auto_run('',$dom)) { |
if (&Apache::lonnet::auto_run('',$dom)) { |
$output = &show_invalid_crosslists($invalidcrosslist); |
$output = &show_invalid_crosslists($invalidcrosslist); |
my ($section_form,$crosslist_form); |
my ($section_form,$crosslist_form); |
$section_form = &inst_section_selector($dom,$instcode); |
if ($instcode ne '') { |
|
$section_form = &inst_section_selector($dom,$instcode); |
|
if ($section_form eq '') { |
|
my $sectotal = $env{'form.sectotal'}; |
|
if (!$sectotal) { |
|
$sectotal = 1; |
|
} |
|
if ($env{'form.addsection'}) { |
|
$sectotal ++; |
|
} |
|
for (my $i=0; $i<$sectotal; $i++) { |
|
$section_form .= §ions_form($dom,$instcode,$i); |
|
} |
|
if ($section_form) { |
|
$section_form .= |
|
&Apache::lonhtmlcommon::row_title(&mt('Add another')). |
|
'<input name="sectotal" type="hidden" value="'.$sectotal.'" />'. |
|
'<input name="addsection" type="checkbox" value="'.$sectotal.'"'. |
|
' onclick="javascript:nextPage(document.'.$formname.",'".$env{'form.state'}. |
|
"'".');" />'.&mt('Add?').&Apache::lonhtmlcommon::row_closure(); |
|
} |
|
} |
|
} |
if ($section_form) { |
if ($section_form) { |
$sections = &Apache::lonhtmlcommon::row_headline(). |
$sections = &Apache::lonhtmlcommon::row_headline(). |
'<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Sections'). |
'<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Sections'). |
Line 1571 sub print_enrollment_menu {
|
Line 1738 sub print_enrollment_menu {
|
' onclick="javascript:nextPage(document.'.$formname.",'".$env{'form.state'}. |
' onclick="javascript:nextPage(document.'.$formname.",'".$env{'form.state'}. |
"'".');" />'.&mt('Add?').&Apache::lonhtmlcommon::row_closure(); |
"'".');" />'.&mt('Add?').&Apache::lonhtmlcommon::row_closure(); |
$sections .= &Apache::lonhtmlcommon::row_headline. |
$sections .= &Apache::lonhtmlcommon::row_headline. |
'<h3>'.&mt('Crosslisted courses for auto-enrollment').'</h3>'. |
'<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Crosslist').' '.&mt('Crosslisted courses for auto-enrollment').'</h3>'. |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_closure(1). |
$crosslist_form; |
$crosslist_form; |
} |
} |
Line 1592 sub print_enrollment_menu {
|
Line 1759 sub print_enrollment_menu {
|
&mt('No').'</label></span>'. |
&mt('No').'</label></span>'. |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_closure(1). |
&date_setting_table($starttime,$endtime,$formname,'enroll', |
&date_setting_table($starttime,$endtime,$formname,'enroll', |
$hasauto,%enrolltitles); |
$hasauto,undef,%enrolltitles); |
|
if ($showcredits) { |
|
if ($instcredits) { |
|
$creditsrow = &mt('[quant,_1,credit]',$instcredits); |
|
} else { |
|
$creditsrow = '<span class="LC_nobreak">'. |
|
'<input type="text" size="3" name="coursecredits"'. |
|
' value="'.$domdefcredits.'" />'; |
|
} |
|
$hascredits = 1; |
|
} |
|
} |
|
} elsif ($env{'form.crstype'} eq 'unofficial') { |
|
if ($showcredits) { |
|
$creditsrow = '<span class="LC_nobreak">'. |
|
'<input type="text" size="3" name="coursecredits"'. |
|
' value="'.$domdefcredits.'"/>'; |
|
$hascredits = 1; |
} |
} |
} |
} |
my $access_dates = |
my $access_dates = |
&date_setting_table($starttime,$endtime,$formname,'access',$hasauto, |
&date_setting_table($starttime,$endtime,$formname,'access',$hasauto, |
%accesstitles); |
$hascredits,%accesstitles); |
$output .= &Apache::lonhtmlcommon::start_pick_box(); |
$output .= &Apache::lonhtmlcommon::start_pick_box(); |
if ($sections) { |
if ($sections) { |
$output .= $sections; |
$output .= $sections; |
Line 1616 sub print_enrollment_menu {
|
Line 1800 sub print_enrollment_menu {
|
$output .= &Apache::lonhtmlcommon::row_headline('Access'). |
$output .= &Apache::lonhtmlcommon::row_headline('Access'). |
'<h3>'.$header.'</h3>'. |
'<h3>'.$header.'</h3>'. |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_closure(1). |
$access_dates |
$access_dates; |
|
} |
|
if ($creditsrow) { |
|
$output .= &Apache::lonhtmlcommon::row_headline('Credits'). |
|
'<h3>'.&mt('Credits earned by students').'</h3>'. |
|
&Apache::lonhtmlcommon::row_closure(1). |
|
&Apache::lonhtmlcommon::row_title(&mt('Default credits')). |
|
$creditsrow. |
|
&Apache::lonhtmlcommon::row_closure(1); |
} |
} |
return '<div>'.&Apache::lonhtmlcommon::start_pick_box().$output. |
return '<div>'.&Apache::lonhtmlcommon::start_pick_box().$output. |
&Apache::lonhtmlcommon::end_pick_box().'</div>'; |
&Apache::lonhtmlcommon::end_pick_box().'</div>'; |
Line 1681 sub inst_section_selector {
|
Line 1873 sub inst_section_selector {
|
} |
} |
|
|
sub date_setting_table { |
sub date_setting_table { |
my ($starttime,$endtime,$formname,$prefix,$hasauto,%datetitles) = @_; |
my ($starttime,$endtime,$formname,$prefix,$hasauto,$hascredits,%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); |
Line 1692 sub date_setting_table {
|
Line 1884 sub date_setting_table {
|
$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'; |
unless ($hascredits) { |
|
$closure = '1'; |
|
} |
} |
} |
|
|
my %help_item = ( |
my %help_item = ( |
Line 2414 sub requestlog_display_filter {
|
Line 2608 sub requestlog_display_filter {
|
|
|
sub print_review { |
sub print_review { |
my ($dom,$codetitles,$cat_titles,$cat_order,$code_order,$uname,$udom, |
my ($dom,$codetitles,$cat_titles,$cat_order,$code_order,$uname,$udom, |
$disallowed,$disallowmsg) = @_; |
$disallowed,$disallowmsg,$instcredits) = @_; |
my ($types,$typename) = &Apache::loncommon::course_types(); |
my ($types,$typename) = &Apache::loncommon::course_types(); |
my ($owner,$ownername,$owneremail); |
my ($owner,$ownername,$owneremail); |
if ($uname eq '' || $udom eq '') { |
if ($uname eq '' || $udom eq '') { |
Line 2462 sub print_review {
|
Line 2656 sub print_review {
|
} |
} |
} |
} |
} |
} |
|
$inst_headers .= '<th>'.&mt('Credits').'</th>'; |
|
if ($instcredits) { |
|
$inst_values .= '<td>'.$instcredits.'</td>'; |
|
} else { |
|
$inst_values .= '<td>'.$env{'form.coursecredits'}.'</td>'; |
|
} |
if (&Apache::lonnet::auto_run('',$dom)) { |
if (&Apache::lonnet::auto_run('',$dom)) { |
$enrollrow_title = &mt('Enrollment'); |
$enrollrow_title = &mt('Enrollment'); |
$enroll_headers = '<th>'.&mt('Automatic Adds').'</th>'. |
$enroll_headers = '<th>'.&mt('Automatic Adds').'</th>'. |
Line 2531 sub print_review {
|
Line 2731 sub print_review {
|
$section_values .= $xlistinfo; |
$section_values .= $xlistinfo; |
} |
} |
$section_values .= '</table></td>'; |
$section_values .= '</table></td>'; |
|
} elsif ($env{'form.crstype'} eq 'unofficial') { |
|
$inst_headers .= '<th>'.&mt('Credits').'</th>'; |
|
$inst_values .= '<td>'.$env{'form.coursecredits'}.'</td>'; |
} |
} |
|
|
my %ctxt = &clone_text(); |
my %ctxt = &clone_text(); |
Line 2538 sub print_review {
|
Line 2741 sub print_review {
|
if (($env{'form.cloning'}) && |
if (($env{'form.cloning'}) && |
($env{'form.clonecrs'} =~ /^$match_name$/) && |
($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'}); |
$env{'form.crstype'}); |
if ($canclone) { |
if ($canclone) { |
my %courseenv = &Apache::lonnet::userenvironment($env{'form.clonedom'}, |
my %courseenv = &Apache::lonnet::userenvironment($env{'form.clonedom'}, |
Line 2829 sub coursecode_form {
|
Line 3032 sub coursecode_form {
|
); |
); |
my %helpitem = ( |
my %helpitem = ( |
instcode => 'Course_Request_Category', |
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))) { |
Line 2846 sub coursecode_form {
|
Line 3048 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(&Apache::loncommon::help_open_topic($helpitem{$context}).' '.$rowtitle{$context}). |
my $helplink; |
|
if (defined($helpitem{$context})) { |
|
$helplink = &Apache::loncommon::help_open_topic($helpitem{$context}).' '; |
|
} |
|
$output = &Apache::lonhtmlcommon::row_title($helplink.$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 2911 sub coursecode_form {
|
Line 3117 sub coursecode_form {
|
return $output; |
return $output; |
} |
} |
|
|
|
sub sections_form { |
|
my ($dom,$instcode,$num) = @_; |
|
my $rowtitle; |
|
if ($instcode eq '') { |
|
$rowtitle = &mt('Sections'); |
|
} else { |
|
$rowtitle = &mt('Sections of [_1]',$instcode); |
|
} |
|
return &Apache::lonhtmlcommon::row_title($rowtitle). |
|
'<table><tr><td align="center">'. |
|
'<span class="LC_nobreak">'.&mt('Include?'). |
|
'<input type="checkbox" name="sec_'.$num.'" value="1" /></span>'. |
|
'</td><td align="center">'.&mt('Institutional section').'<br />'. |
|
'<input type="text" size="10" name="secnum_'.$num.'" />'. |
|
'</td><td align="center">'.&mt('LON-CAPA section').'<br />'. |
|
'<input type="text" size="10" name="loncapasec_'.$num.'" />'. |
|
'</td></tr></table>'. |
|
&Apache::lonhtmlcommon::row_closure(1); |
|
} |
|
|
sub get_course_dom { |
sub get_course_dom { |
my $codedom = &Apache::lonnet::default_login_domain(); |
my $codedom = &Apache::lonnet::default_login_domain(); |
if ($env{'form.showdom'} ne '') { |
if ($env{'form.showdom'} ne '') { |
Line 3003 sub display_navbuttons {
|
Line 3229 sub display_navbuttons {
|
} |
} |
|
|
sub print_request_outcome { |
sub print_request_outcome { |
my ($dom,$codetitles,$code_order) = @_; |
my ($dom,$codetitles,$code_order,$instcredits) = @_; |
my ($output,$cnum,$now,$req_notifylist,$crstype,$enrollstart,$enrollend, |
my ($output,$cnum,$now,$req_notifylist,$crstype,$enrollstart,$enrollend, |
%sections,%crosslistings,%personnel,@baduname,@missingdom,%domconfig,); |
%sections,%crosslistings,%personnel,@baduname,@missingdom,%domconfig); |
my $sectotal = $env{'form.sectotal'}; |
my $sectotal = $env{'form.sectotal'}; |
my $crosslisttotal = 0; |
my $crosslisttotal = 0; |
$cnum = $env{'form.cnum'}; |
$cnum = $env{'form.cnum'}; |
Line 3040 sub print_request_outcome {
|
Line 3266 sub print_request_outcome {
|
push(@instsections,$sec); |
push(@instsections,$sec); |
} |
} |
$sections{$i}{'loncapa'} = $env{'form.loncapasec_'.$i}; |
$sections{$i}{'loncapa'} = $env{'form.loncapasec_'.$i}; |
|
$sections{$i}{'loncapa'} =~ s/\W//g; |
|
if ($sections{$i}{'loncapa'} eq 'none') { |
|
$sections{$i}{'loncapa'} = ''; |
|
} |
} |
} |
} |
} |
} |
} |
Line 3065 sub print_request_outcome {
|
Line 3295 sub print_request_outcome {
|
$enrollstart = ''; |
$enrollstart = ''; |
$enrollend = ''; |
$enrollend = ''; |
} |
} |
|
my (%alerts,%rulematch,%inst_results,%curr_rules,%got_rules,%disallowmsg,%skipped); |
for (my $i=0; $i<$env{'form.persontotal'}; $i++) { |
for (my $i=0; $i<$env{'form.persontotal'}; $i++) { |
my $uname = $env{'form.person_'.$i.'_uname'}; |
my $uname = $env{'form.person_'.$i.'_uname'}; |
my $udom = $env{'form.person_'.$i.'_dom'}; |
my $udom = $env{'form.person_'.$i.'_dom'}; |
Line 3076 sub print_request_outcome {
|
Line 3307 sub print_request_outcome {
|
lastname => $env{'form.person_'.$i.'_lastname'}, |
lastname => $env{'form.person_'.$i.'_lastname'}, |
emailaddr => $env{'form.person_'.$i.'_emailaddr'}, |
emailaddr => $env{'form.person_'.$i.'_emailaddr'}, |
}; |
}; |
|
if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { |
|
my $usertype = &get_usertype($udom,$uname,\%curr_rules,\%got_rules); |
|
if (&Apache::lonuserutils::can_create_user($udom,'requestcrs',$usertype)) { |
|
my ($allowed,$msg,$authtype,$authparam) = |
|
&check_newuser_rules($udom,$uname,\%alerts,\%rulematch, |
|
\%inst_results,\%curr_rules,\%got_rules); |
|
if ($allowed) { |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($udom); |
|
if ($usertype eq 'official') { |
|
if ($authtype eq '') { |
|
$authtype = $domdefaults{'auth_def'}; |
|
$authparam = $domdefaults{'auth_arg_def'}; |
|
} else { |
|
if ($authtype eq 'loc') { |
|
$authtype = 'localauth'; |
|
} elsif ($authtype eq 'int') { |
|
$authtype = 'internal'; |
|
} |
|
if ($authtype !~ /^(krb4|krb5|internal|localauth)$/) { |
|
$authtype = $domdefaults{'auth_def'}; |
|
$authparam = $domdefaults{'auth_arg_def'}; |
|
} |
|
} |
|
} elsif ($usertype eq 'unofficial') { |
|
if ($authtype eq '') { |
|
$authtype = 'internal'; |
|
$authparam = ''; |
|
} |
|
} else { |
|
$authtype = $domdefaults{'auth_def'}; |
|
$authparam = $domdefaults{'auth_arg_def'}; |
|
} |
|
if (($authtype eq '') || |
|
(($authtype =~/^krb(4|5)$/) && ($authparam eq '')) || |
|
($authtype !~ /^(krb4|krb5|internal|localauth)$/)) { |
|
$skipped{$uname.':'.$udom} = 1; |
|
next; |
|
} else { |
|
$personnel{$uname.':'.$udom}{'authtype'} = $authtype; |
|
$personnel{$uname.':'.$udom}{'autharg'} = $authparam; |
|
} |
|
} else { |
|
$skipped{$uname.':'.$udom} = 1; |
|
next; |
|
} |
|
} else { |
|
$skipped{$uname.':'.$udom} = 1; |
|
next; |
|
} |
|
} |
} |
} |
my $role = $env{'form.person_'.$i.'_role'}; |
my $role = $env{'form.person_'.$i.'_role'}; |
unless ($role eq '') { |
unless ($role eq '') { |
Line 3121 sub print_request_outcome {
|
Line 3402 sub print_request_outcome {
|
push(@baduname,$uname.':'.$udom); |
push(@baduname,$uname.':'.$udom); |
} |
} |
} |
} |
|
if (keys(%skipped)) { |
|
foreach my $key (keys(%skipped)) { |
|
delete($personnel{$key}); |
|
} |
|
} |
my ($accessstart,$accessend) = &dates_from_form('accessstart','accessend'); |
my ($accessstart,$accessend) = &dates_from_form('accessstart','accessend'); |
my $autodrops = 0; |
my $autodrops = 0; |
if ($env{'form.autodrops'}) { |
if ($env{'form.autodrops'}) { |
Line 3128 sub print_request_outcome {
|
Line 3414 sub print_request_outcome {
|
} |
} |
my $autoadds = 0; |
my $autoadds = 0; |
if ($env{'form.autoadds'}) { |
if ($env{'form.autoadds'}) { |
$autodrops = $env{'form.autoadds'}; |
$autoadds = $env{'form.autoadds'}; |
} |
|
if ($env{'form.autoadds'}) { |
|
$autodrops = $env{'form.autoadds'}; |
|
} |
} |
my $instcode = ''; |
my $instcode = ''; |
if (exists($env{'form.instcode'})) { |
if (exists($env{'form.instcode'})) { |
$instcode = $env{'form.instcode'}; |
$instcode = $env{'form.instcode'}; |
} |
} |
|
my $credits; |
|
if ($instcredits) { |
|
$credits = $instcredits; |
|
} elsif (exists($env{'form.coursecredits'})) { |
|
$credits = $env{'form.coursecredits'}; |
|
} |
my $clonecrs = ''; |
my $clonecrs = ''; |
my $clonedom = ''; |
my $clonedom = ''; |
if (($env{'form.cloning'}) && |
if (($env{'form.cloning'}) && |
Line 3164 sub print_request_outcome {
|
Line 3453 sub print_request_outcome {
|
cdescr => $env{'form.cdescr'}, |
cdescr => $env{'form.cdescr'}, |
crstype => $env{'form.crstype'}, |
crstype => $env{'form.crstype'}, |
instcode => $instcode, |
instcode => $instcode, |
|
defaultcredits => $credits, |
clonedom => $clonedom, |
clonedom => $clonedom, |
clonecrs => $clonecrs, |
clonecrs => $clonecrs, |
datemode => $env{'form.datemode'}, |
datemode => $env{'form.datemode'}, |
Line 3182 sub print_request_outcome {
|
Line 3472 sub print_request_outcome {
|
}; |
}; |
my (@inststatuses,$storeresult,$creationresult); |
my (@inststatuses,$storeresult,$creationresult); |
my $val = |
my $val = |
&Apache::loncoursequeueadmin::get_processtype($env{'user.name'},$env{'user.domain'}, |
&Apache::loncoursequeueadmin::get_processtype('course',$env{'user.name'}, |
$env{'user.adv'},$dom,$crstype,\@inststatuses,\%domconfig); |
$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 3338 sub print_request_outcome {
|
Line 3629 sub print_request_outcome {
|
} |
} |
($storeresult,my $updateresult) = |
($storeresult,my $updateresult) = |
&Apache::loncoursequeueadmin::update_coursereq_status(\%reqhash,$dom, |
&Apache::loncoursequeueadmin::update_coursereq_status(\%reqhash,$dom, |
$cnum,$reqstatus,'request'); |
$cnum,$reqstatus,'request',$env{'user.domain'},$env{'user.name'}); |
if ($modified && $queued && $storeresult eq 'ok') { |
if ($modified && $queued && $storeresult eq 'ok') { |
if ($crstype eq 'community') { |
if ($crstype eq 'community') { |
$output .= '<p>'.&mt('Your community request has been updated').'</p>'; |
$output .= '<p>'.&mt('Your community request has been updated').'</p>'; |
Line 3593 sub retrieve_settings {
|
Line 3884 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') { |
$env{'form.sectotal'} = $reqinfo{'sectotal'}; |
$env{'form.autoadds'} = $reqinfo{'autoadds'}; |
$env{'form.crosslisttotal'} = $reqinfo{'crosslisttotal'}; |
$env{'form.autodrops'} = $reqinfo{'autodrops'}; |
$env{'form.autoadds'} = $reqinfo{'autoadds'}; |
if ($reqinfo{'instcode'} ne '') { |
$env{'form.autdrops'} = $reqinfo{'autodrops'}; |
$env{'form.sectotal'} = $reqinfo{'sectotal'}; |
$env{'form.instcode'} = $reqinfo{'instcode'}; |
$env{'form.crosslisttotal'} = $reqinfo{'crosslisttotal'}; |
my $crscode = { |
$env{'form.instcode'} = $reqinfo{'instcode'}; |
$cnum => $reqinfo{'instcode'}, |
my $crscode = { |
}; |
$cnum => $reqinfo{'instcode'}, |
&extract_instcode($dom,'instcode',$crscode,$cnum); |
}; |
|
&extract_instcode($dom,'instcode',$crscode,$cnum); |
|
(undef,undef,my $instcredits) = |
|
&Apache::lonnet::auto_validate_instcode(undef,$dom, |
|
$reqinfo{'instcode'}); |
|
if ($instcredits ne $reqinfo{'defaultcredits'}) { |
|
$env{'form.coursecredits'} = $reqinfo{'defaultcredits'}; |
|
} |
|
} |
|
} elsif ($reqinfo{'crstype'} eq 'unofficial') { |
|
$env{'form.coursecredits'} = $reqinfo{'defaultcredits'}; |
} |
} |
my @currsec; |
my @currsec; |
if (ref($reqinfo{'sections'}) eq 'HASH') { |
if (ref($reqinfo{'sections'}) eq 'HASH') { |