version 1.116, 2015/05/21 23:40:09
|
version 1.122, 2016/11/02 22:41:18
|
Line 55 sub handler {
|
Line 55 sub handler {
|
my ($type,$title,$jscript,$multelement,$multiple,$roleelement,$typeelement, |
my ($type,$title,$jscript,$multelement,$multiple,$roleelement,$typeelement, |
$lastaction,$autosubmit,$submitopener,$cloneruname,$clonerudom,$crscode,$crsdom); |
$lastaction,$autosubmit,$submitopener,$cloneruname,$clonerudom,$crscode,$crsdom); |
|
|
# Get course type - Course or Community. |
# Get course type - Course, Community or Placement. |
$type = $env{'form.type'}; |
$type = $env{'form.type'}; |
if (!defined($env{'form.type'})) { |
if (!defined($env{'form.type'})) { |
$type = 'Course'; |
$type = 'Course'; |
Line 69 sub handler {
|
Line 69 sub handler {
|
$title = 'Selecting '.$type.'(s)'; |
$title = 'Selecting '.$type.'(s)'; |
} |
} |
|
|
# if called when a DC is selecting a course |
# if called when a DC or DH is selecting a course |
my $roledom = $env{'form.roleelement'}; |
my ($roledom,$rolename) = split(/:/,$env{'form.roleelement'}); |
if ($roledom) { |
if ($roledom) { |
$roleelement = '<input type="hidden" name="roleelement" value="'.$roledom.'" />'; |
$roleelement = '<input type="hidden" name="roleelement" value="'.$env{'form.roleelement'}.'" />'; |
$submitopener = &processpick(); |
$submitopener = &processpick(); |
$autosubmit = 'process_pick("'.$roledom.'")'; |
$autosubmit = 'process_pick("'.$roledom.'","'.$rolename.'")'; |
} |
} |
if ($env{'form.typeelement'} ne '') { |
if ($env{'form.typeelement'} ne '') { |
$typeelement = '<input type="hidden" name="typeelement" value="'.$env{'form.typeelement'}.'" />'; |
$typeelement = '<input type="hidden" name="typeelement" value="'.$env{'form.typeelement'}.'" />'; |
Line 288 sub processpick {
|
Line 288 sub processpick {
|
} |
} |
my $process_pick = <<"ENDONE"; |
my $process_pick = <<"ENDONE"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
function process_pick(dom) { |
function process_pick(dom,rolename) { |
var pickedCourse=opener.document.$openerform.$env{'form.cnumelement'}.value; |
var pickedCourse=opener.document.$openerform.$env{'form.cnumelement'}.value; |
var pickedDomain=opener.document.$openerform.$env{'form.cdomelement'}.value; |
var pickedDomain=opener.document.$openerform.$env{'form.cdomelement'}.value; |
var okDomain = 0; |
var okDomain = 0; |
Line 297 ENDONE
|
Line 297 ENDONE
|
$process_pick .= <<"ENDTWO"; |
$process_pick .= <<"ENDTWO"; |
if (pickedDomain == dom) { |
if (pickedDomain == dom) { |
if (pickedCourse != '') { |
if (pickedCourse != '') { |
var ccrole = "cc"; |
var courseTarget; |
var pickedType = "$env{'form.type'}"; |
if (rolename == 'cc') { |
if (pickedType == "Community") { |
var ccrole = "cc"; |
ccrole = "co"; |
var pickedType = "$env{'form.type'}"; |
} |
if (pickedType == "Community") { |
var courseTarget = ccrole+"./"+pickedDomain+"/"+pickedCourse |
ccrole = "co"; |
opener.document.title='Role selected. Please stand by.'; |
} |
opener.status='Role selected. Please stand by.'; |
courseTarget = ccrole+"./"+pickedDomain+"/"+pickedCourse; |
opener.document.rolechoice.newrole.value=courseTarget |
} else { |
opener.document.rolechoice.submit(); |
if (!/\\W/.test(rolename)) { |
|
courseTarget = "cr/"+pickedDomain+"/"+pickedDomain+"-domainconfig/"+rolename+"./"+pickedDomain+"/"+pickedCourse; |
|
} |
|
} |
|
if ((courseTarget != '') && (courseTarget != undefined)) { |
|
opener.document.title='Role selected. Please stand by.'; |
|
opener.status='Role selected. Please stand by.'; |
|
opener.document.rolechoice.newrole.value=courseTarget; |
|
opener.document.rolechoice.submit(); |
|
} else { |
|
alert("Invalid role selection"); |
|
return; |
|
} |
} |
} |
} |
} |
else { |
else { |
alert("You may only use this screen to select courses in the current domain: "+dom+"\\nPlease return to the roles page window and click the 'Select Course' link for domain: "+pickedDomain+",\\n if you are a Domain Coordinator in that domain, and wish to become a Course Coordinator in a course in the domain"); |
alert("You may only use this screen to select courses in the current domain: "+dom+"\\nPlease return to the roles page window and click the 'Select Course' link for domain: "+pickedDomain+",\\n if you are a Domain Coordinator in that domain, and wish to become a Course Coordinator in a course in the domain"); |
} |
} |
Line 398 sub display_matched_courses {
|
Line 410 sub display_matched_courses {
|
my $cctitle = &Apache::lonnet::plaintext($ccrole,$type); |
my $cctitle = &Apache::lonnet::plaintext($ccrole,$type); |
my $dctitle = &Apache::lonnet::plaintext('dc'); |
my $dctitle = &Apache::lonnet::plaintext('dc'); |
my $ccrolechk = ' '; |
my $ccrolechk = ' '; |
|
my $possrole; |
my $menuchk = ' checked="checked" '; |
my $menuchk = ' checked="checked" '; |
$r->print( |
$r->print( |
'<div class="LC_left_float">' |
'<div class="LC_left_float">' |
.'<fieldset>' |
.'<fieldset>' |
.'<legend>'.&mt('Pick action').'</legend>' |
.'<legend>'.&mt('Pick action').'</legend>'); |
.'<span class="LC_nobreak"><label>' |
my $roleradio = '<span class="LC_nobreak"><label>'. |
.'<input type="radio" name="phase" value="ccrole"'.$ccrolechk.'/>' |
'<input type="radio" name="phase" value="adhocrole"'.$ccrolechk.'/>'.' '; |
.' '); |
if (&Apache::lonnet::allowed('ccc',$crsdom)) { |
if ($type eq 'Community') { |
$possrole = 1; |
$r->print(&mt('Enter the community with the role of [_1].',$cctitle)); |
$r->print($roleradio); |
} else { |
if ($type eq 'Community') { |
$r->print(&mt('Enter the course with the role of [_1].',$cctitle)); |
$r->print(&mt('Enter the community with the role of [_1].',$cctitle)); |
|
} elsif ($type eq 'Placement') { |
|
$r->print(&mt('Enter the placement test with the role of [_1].',$cctitle)); |
|
} else { |
|
$r->print(&mt('Enter the course with the role of [_1].',$cctitle)); |
|
} |
|
} elsif (&Apache::lonnet::allowed('rar',$crsdom)) { |
|
my %adhocroles = &Apache::lonnet::userenvironment($env{'user.domain'},$env{'user.name'}, |
|
'adhocroles.'.$crsdom); |
|
if ($adhocroles{'adhocroles.'.$crsdom} ne '') { |
|
$possrole = 1; |
|
$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') { |
|
$r->print(&mt('Enter the community with one of the available ad hoc roles: [_1].', |
|
$selector)); |
|
} elsif ($type eq 'Placement') { |
|
$r->print(&mt('Enter the placement test with one of the available ad hoc roles: [_1].', |
|
$selector)); |
|
} else { |
|
$r->print(&mt('Enter the course with one of the available ad hoc roles: [_1].', |
|
$selector)); |
|
} |
|
} else { |
|
if ($type eq 'Community') { |
|
$r->print(&mt('Enter the community with the ad hoc role of: [_1]',$adhoc[0])); |
|
} elsif ($type eq 'Placement') { |
|
$r->print(&mt('Enter the placement test with the ad hoc role of: [_1]',$adhoc[0])); |
|
} else { |
|
$r->print(&mt('Enter the course with the ad hoc role of: [_1]',$adhoc[0])); |
|
} |
|
$r->print('<input type="hidden" name="adhocrole" value="'.$adhoc[0].'" />'); |
|
} |
|
} |
} |
} |
$r->print('</label></span><br />' |
if ($possrole) { |
.'<span class="LC_nobreak"><label>' |
$r->print('</label></span><br />'); |
.'<input type="radio" name="phase" value="menu"'.$menuchk.'/> '); |
} |
if ($type eq 'Community') { |
$r->print('<span class="LC_nobreak"><label>' |
$r->print(&mt('View or modify community settings which only a [_1] may modify.',$dctitle)); |
.'<input type="radio" name="phase" value="menu"'.$menuchk.'/> '); |
} else { |
if (&Apache::lonnet::allowed('ccc',$crsdom)) { |
$r->print(&mt('View or modify course settings which only a [_1] may modify.',$dctitle)); |
if ($type eq 'Community') { |
|
$r->print(&mt('View or modify community settings which only a [_1] may modify.',$dctitle)); |
|
} elsif ($type eq 'Placement') { |
|
$r->print(&mt('View or modify placement test settings which only a [_1] may modify.',$dctitle)); |
|
} else { |
|
$r->print(&mt('View or modify course settings which only a [_1] may modify.',$dctitle)); |
|
} |
|
} elsif (&Apache::lonnet::allowed('rar',$crsdom)) { |
|
if ($type eq 'Community') { |
|
$r->print(&mt('View community settings which only a [_1] may modify.',$dctitle)); |
|
} elsif ($type eq 'Placement') { |
|
$r->print(&mt('View placement test settings which only a [_1] may modify.',$dctitle)); |
|
} else { |
|
$r->print(&mt('View course settings which only a [_1] may modify.',$dctitle)); |
|
} |
} |
} |
$r->print('</label></span>' |
$r->print('</label></span>' |
.'</fieldset></div>' |
.'</fieldset></div>' |
.'<br clear="all" />' |
.'<br clear="all" />' |
); |
); |
} |
} |
} |
} |
my %by_descrip; |
my %by_descrip; |
Line 457 sub display_matched_courses {
|
Line 521 sub display_matched_courses {
|
$r->print('<th>'.&mt('Select').'</th>' |
$r->print('<th>'.&mt('Select').'</th>' |
.'<th>'.$titlehdr.'</th>' |
.'<th>'.$titlehdr.'</th>' |
.'<th>'.&mt('Domain').'</th>'); |
.'<th>'.&mt('Domain').'</th>'); |
unless ($type eq 'Community') { |
unless (($type eq 'Community') || ($type eq 'Placement')) { |
$r->print('<th>'.&mt('Course Code').'</th>'); |
$r->print('<th>'.&mt('Course Code').'</th>'); |
} |
} |
$r->print('<th>'.&mt('Owner/Co-owner(s)').'</th>'); |
$r->print('<th>'.&mt('Owner/Co-owner(s)').'</th>'); |
Line 608 sub display_matched_courses {
|
Line 672 sub display_matched_courses {
|
$r->print(&Apache::lonnet::domain($cdom,'description')? |
$r->print(&Apache::lonnet::domain($cdom,'description')? |
$cdom.' ('.&Apache::lonnet::domain($cdom,'description').')':$cdom); |
$cdom.' ('.&Apache::lonnet::domain($cdom,'description').')':$cdom); |
$r->print('</td>'); |
$r->print('</td>'); |
unless ($type eq 'Community') { |
unless (($type eq 'Community') || ($type eq 'Placement')) { |
$r->print('<td>'); |
$r->print('<td>'); |
if ($instcode ne '') { |
if ($instcode ne '') { |
$r->print(&unescape($instcode)); |
$r->print(&unescape($instcode)); |
Line 706 sub get_coordinator_cloneable {
|
Line 770 sub get_coordinator_cloneable {
|
my ($cc_clone,$ccrole); |
my ($cc_clone,$ccrole); |
if ($type eq 'Community') { |
if ($type eq 'Community') { |
$ccrole = 'co'; |
$ccrole = 'co'; |
} elsif ($type eq 'Course') { |
} else { |
$ccrole = 'cc'; |
$ccrole = 'cc'; |
} |
} |
my %ccroles = &Apache::lonnet::get_my_roles($cloneruname,$clonerudom, |
my %ccroles = &Apache::lonnet::get_my_roles($cloneruname,$clonerudom, |
Line 751 sub gochoose_javascript {
|
Line 815 sub gochoose_javascript {
|
total => 'coursetotal', |
total => 'coursetotal', |
list => 'courselist', |
list => 'courselist', |
}, |
}, |
|
'Placement' => { |
|
name => 'coursepick', |
|
total => 'coursetotal', |
|
list => 'courselist', |
|
}, |
); |
); |
my $output = qq| |
my $output = qq| |
function gochoose(cname,cdom,cdesc) { |
function gochoose(cname,cdom,cdesc) { |
Line 872 Course Activity - how recently was cours
|
Line 941 Course Activity - how recently was cours
|
Course Domain - the domain of the course |
Course Domain - the domain of the course |
|
|
=item * |
=item * |
Type - Course or Community |
Type - Course, Community or Placement |
|
|
=item * |
=item * |
Course Institutional Code - the institutional identifier assigned to the course |
Course Institutional Code - the institutional identifier assigned to the course |
Line 925 Following selection, and/or submission,
|
Line 994 Following selection, and/or submission,
|
X<create_user_javascript()> |
X<create_user_javascript()> |
B<create_user_javascript($type)>: |
B<create_user_javascript($type)>: |
|
|
Input: 1 - $type - the course type - Course or Community |
Input: 1 - $type - the course type - Course, Community, or Placement |
|
|
Output: 1 - $output - javascript wrapped in E<lt>scriptE<gt>E<lt>/scriptE<gt> tags |
Output: 1 - $output - javascript wrapped in E<lt>scriptE<gt>E<lt>/scriptE<gt> tags |
|
|