version 1.124, 2017/01/03 17:47:57
|
version 1.125, 2017/01/05 16:17:11
|
Line 44 sub handler {
|
Line 44 sub handler {
|
if ($env{'form.context'} eq 'adhoc') { |
if ($env{'form.context'} eq 'adhoc') { |
&Apache::loncommon::content_type($r,'application/json'); |
&Apache::loncommon::content_type($r,'application/json'); |
$r->send_http_header; |
$r->send_http_header; |
my ($possroles,$description) = &Apache::lonnet::get_my_adhocroles($env{'form.cid'}); |
my ($possroles,$description) = &Apache::lonnet::get_my_adhocroles($env{'form.cid'},1); |
if ((ref($possroles) eq 'ARRAY') && (ref($description) eq 'HASH')) { |
if ((ref($possroles) eq 'ARRAY') && (ref($description) eq 'HASH')) { |
my $response = []; |
my $response = []; |
if (@{$possroles}) { |
if (@{$possroles}) { |
Line 440 sub display_matched_courses {
|
Line 440 sub display_matched_courses {
|
$action = '/adm/portfolio'; |
$action = '/adm/portfolio'; |
} |
} |
my $numcourses = keys(%courses); |
my $numcourses = keys(%courses); |
$r->print('<form name="courselist" method="post" action="'.$action.'">'); |
$r->print('<form name="courselist" method="post" action="'.$action.'" id="LCcoursepicker">'); |
if ($env{'form.form'} eq 'modifycourse') { |
if ($env{'form.form'} eq 'modifycourse') { |
if ($numcourses > 0) { |
if ($numcourses > 0) { |
my $ccrole = 'cc'; |
my $ccrole = 'cc'; |
Line 469 sub display_matched_courses {
|
Line 469 sub display_matched_courses {
|
$r->print(&mt('Enter the course with the role of [_1].',$cctitle)); |
$r->print(&mt('Enter the course with the role of [_1].',$cctitle)); |
} |
} |
} elsif (&Apache::lonnet::allowed('rar',$crsdom)) { |
} elsif (&Apache::lonnet::allowed('rar',$crsdom)) { |
my %adhocroles = &Apache::lonnet::userenvironment($env{'user.domain'},$env{'user.name'}, |
my ($roles_by_num,$description,$accessref,$accessinfo) = &Apache::lonnet::get_all_adhocroles($crsdom); |
'adhocroles.'.$crsdom); |
if ((ref($roles_by_num) eq 'ARRAY') && (ref($description) eq 'HASH')) { |
if ($adhocroles{'adhocroles.'.$crsdom} ne '') { |
if (@{$roles_by_num} > 1) { |
$possrole = 1; |
$r->print($roleradio); |
$r->print($roleradio); |
|
my @adhoc = split(/,/,$adhocroles{'adhocroles.'.$crsdom}); |
|
if (@adhoc > 1) { |
|
my %adhochash; |
|
map { $adhochash{$_} = $_; } @adhoc; |
|
my $selector = &Apache::loncommon::select_form($adhoc[0],'adhocrole',\%adhochash); |
|
if ($type eq 'Community') { |
if ($type eq 'Community') { |
$r->print(&mt('Enter the community with one of the available ad hoc roles: [_1].', |
$r->print(&mt('Enter the community with one of the available ad hoc roles.')); |
$selector)); |
|
} elsif ($type eq 'Placement') { |
} elsif ($type eq 'Placement') { |
$r->print(&mt('Enter the placement test with one of the available ad hoc roles: [_1].', |
$r->print(&mt('Enter the placement test with one of the available ad hoc roles.')); |
$selector)); |
|
} else { |
} else { |
$r->print(&mt('Enter the course with one of the available ad hoc roles: [_1].', |
$r->print(&mt('Enter the course with one of the available ad hoc roles.')); |
$selector)); |
|
} |
} |
} else { |
$possrole = 1; |
|
} elsif (@{$roles_by_num} == 1) { |
|
$r->print($roleradio); |
|
my $rolename = $description->{$roles_by_num->[0]}; |
if ($type eq 'Community') { |
if ($type eq 'Community') { |
$r->print(&mt('Enter the community with the ad hoc role of: [_1]',$adhoc[0])); |
$r->print(&mt('Enter the community with the ad hoc role of: [_1]',$rolename)); |
} elsif ($type eq 'Placement') { |
} elsif ($type eq 'Placement') { |
$r->print(&mt('Enter the placement test with the ad hoc role of: [_1]',$adhoc[0])); |
$r->print(&mt('Enter the placement test with the ad hoc role of: [_1]',$rolename)); |
} else { |
} else { |
$r->print(&mt('Enter the course with the ad hoc role of: [_1]',$adhoc[0])); |
$r->print(&mt('Enter the course with the ad hoc role of: [_1]',$rolename)); |
} |
} |
$r->print('<input type="hidden" name="adhocrole" value="'.$adhoc[0].'" />'); |
$possrole = 1; |
|
} |
|
if ($possrole) { |
|
$r->print('<input type="hidden" name="adhocrole" value="" />'); |
} |
} |
} |
} |
} |
} |
if ($possrole) { |
if ($possrole) { |
$r->print('</label></span><br />'); |
$r->print('</label></span><br />'); |
} |
} |
$r->print('<span class="LC_nobreak"><label>' |
$r->print('<span class="LC_nobreak"><label>' |
Line 766 sub display_matched_courses {
|
Line 763 sub display_matched_courses {
|
$r->print('<input type="hidden" name="setroles" value="'.$env{'form.setroles'}.'" />'); |
$r->print('<input type="hidden" name="setroles" value="'.$env{'form.setroles'}.'" />'); |
$r->print('<input type="hidden" name="action" value="rolepicker" />'); |
$r->print('<input type="hidden" name="action" value="rolepicker" />'); |
} elsif ($env{'form.form'} eq 'modifycourse') { |
} elsif ($env{'form.form'} eq 'modifycourse') { |
$r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','pickedcourse','type','form','numtitles','state'])); |
$r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','pickedcourse','type','form','numtitles','state','adhocrole'])); |
} else { |
} else { |
$r->print('<input type="hidden" name="cnumelement" value="'. |
$r->print('<input type="hidden" name="cnumelement" value="'. |
$env{'form.cnumelement'}.'" />'."\n". |
$env{'form.cnumelement'}.'" />'."\n". |
Line 872 sub gochoose_javascript {
|
Line 869 sub gochoose_javascript {
|
my $output; |
my $output; |
if ($rolechooser) { |
if ($rolechooser) { |
$output .= qq| |
$output .= qq| |
\$( "#LC_adhocrole_chooser" ).dialog({ autoOpen: false }); |
\$(document).ready(function(){ |
|
\$( "#LC_adhocrole_chooser" ).dialog({ autoOpen: false }); |
|
}); |
|; |
|; |
} |
} |
$output .= qq| |
$output .= qq| |