version 1.112, 2014/03/17 02:45:25
|
version 1.119, 2016/10/05 13:59:46
|
Line 50 sub handler {
|
Line 50 sub handler {
|
&Apache::loncommon::get_unprocessed_cgi |
&Apache::loncommon::get_unprocessed_cgi |
($ENV{'QUERY_STRING'},['domainfilter','form','cnumelement', |
($ENV{'QUERY_STRING'},['domainfilter','form','cnumelement', |
'cdomelement','cnameelement','roleelement', |
'cdomelement','cnameelement','roleelement', |
'multiple','type','setroles','fixeddom','cloner']); |
'multiple','type','setroles','fixeddom','cloner', |
|
'crscode','crsdom']); |
my ($type,$title,$jscript,$multelement,$multiple,$roleelement,$typeelement, |
my ($type,$title,$jscript,$multelement,$multiple,$roleelement,$typeelement, |
$lastaction,$autosubmit,$submitopener,$cloneruname,$clonerudom); |
$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 82 sub handler {
|
Line 83 sub handler {
|
# if called when a DC is creating a course for another user. |
# if called when a DC is creating a course for another user. |
if ($env{'form.form'} eq 'ccrs') { |
if ($env{'form.form'} eq 'ccrs') { |
($cloneruname,$clonerudom) = ($env{'form.cloner'} =~ /^($match_username):($match_domain)$/); |
($cloneruname,$clonerudom) = ($env{'form.cloner'} =~ /^($match_username):($match_domain)$/); |
|
$crscode = $env{'form.crscode'}; |
|
$crsdom = $env{'request.role.domain'}; |
} |
} |
|
|
# if called when requesting a course |
# if called when requesting a course |
if ($env{'form.form'} eq 'requestcrs') { |
if ($env{'form.form'} eq 'requestcrs') { |
$cloneruname = $env{'user.name'}; |
$cloneruname = $env{'user.name'}; |
$clonerudom = $env{'user.domain'}; |
$clonerudom = $env{'user.domain'}; |
|
$crscode = $env{'form.crscode'}; |
|
$crsdom = $env{'form.crsdom'}; |
} |
} |
|
|
my $onlyown = 0; |
my $onlyown = 0; |
Line 105 sub handler {
|
Line 110 sub handler {
|
|
|
if ((($env{'form.form'} eq 'cu') || ($env{'form.form'} eq 'studentform')) && |
if ((($env{'form.form'} eq 'cu') || ($env{'form.form'} eq 'studentform')) && |
($env{'form.pickedcourse'})) { |
($env{'form.pickedcourse'})) { |
$loaditem{'onload'} .= 'setDefaultCredits();setRoles();setSections();'; |
if ($type ne 'Community') { |
|
my %coursedescription = |
|
&Apache::lonnet::coursedescription($env{'form.pickedcourse'}, |
|
{'one_time' => '1'}); |
|
my $cdom = $coursedescription{'domain'}; |
|
my %domdefs = &Apache::lonnet::get_domain_defaults($cdom); |
|
if (($domdefs{'officialcredits'} || $domdefs{'unofficialcredits'} || $domdefs{'textbookcredits'})) { |
|
$loaditem{'onload'} .= 'setDefaultCredits();'; |
|
} |
|
} |
|
$loaditem{'onload'} .= 'setRoles();setSections();'; |
|
} |
|
if ((($env{'form.gosearch'}) && ($env{'form.updater'} eq '')) && (!$onlyown)) { |
|
$loaditem{'onload'} .= 'hideSearching(); '; |
} |
} |
my $js = &Apache::loncommon::js_changer(); |
my $js = &Apache::loncommon::js_changer(); |
$r->print(&Apache::loncommon::start_page($title,$js, |
$r->print(&Apache::loncommon::start_page($title,$js, |
Line 207 sub handler {
|
Line 225 sub handler {
|
if ($coord_cloneable) { |
if ($coord_cloneable) { |
$clonetext .= '<input type="hidden" name="cc_clone" value="'.$coord_cloneable.'" />'; |
$clonetext .= '<input type="hidden" name="cc_clone" value="'.$coord_cloneable.'" />'; |
} |
} |
|
if ($crscode ne '') { |
|
$clonetext .= '<input type="hidden" name="crscode" value="'.$crscode.'" />'; |
|
} |
|
if ($crsdom ne '') { |
|
$clonetext .= '<input type="hidden" name="crsdom" value="'.$crsdom.'" />'; |
|
} |
} |
} |
$r->print(&Apache::loncommon::build_filters($filterlist,$type,$roleelement,$multelement, |
$r->print(&Apache::loncommon::build_filters($filterlist,$type,$roleelement,$multelement, |
$filter,$action,\$numtitles,undef,$cloneruname, |
$filter,$action,\$numtitles,undef,$cloneruname, |
Line 234 sub handler {
|
Line 258 sub handler {
|
my $srchdom = $filter->{'domainfilter'}; |
my $srchdom = $filter->{'domainfilter'}; |
%courses = &Apache::loncommon::search_courses($srchdom,$type,$filter,$numtitles, |
%courses = &Apache::loncommon::search_courses($srchdom,$type,$filter,$numtitles, |
$cloneruname,$clonerudom,$domcloner, |
$cloneruname,$clonerudom,$domcloner, |
\@codetitles,$env{'form.cc_clone'}); |
\@codetitles,$env{'form.cc_clone'}, |
|
$crsdom,$crscode); |
} else { |
} else { |
$r->print('<br />'); |
$r->print('<br />'); |
my %coursehash = &Apache::loncommon::findallcourses(); |
my %coursehash = &Apache::loncommon::findallcourses(); |
Line 249 sub handler {
|
Line 274 sub handler {
|
'<b>'.$filter->{'persondomfilter'}.'</b>').'</span>'); |
'<b>'.$filter->{'persondomfilter'}.'</b>').'</span>'); |
} else { |
} else { |
&display_matched_courses($r,$type,$multiple,$action,$showroles,$cloneruname, |
&display_matched_courses($r,$type,$multiple,$action,$showroles,$cloneruname, |
$clonerudom,%courses); |
$clonerudom,$crsdom,$crscode,%courses); |
} |
} |
} |
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
Line 358 function setDefaultCredits() {
|
Line 383 function setDefaultCredits() {
|
} |
} |
|
|
sub display_matched_courses { |
sub display_matched_courses { |
my ($r,$type,$multiple,$action,$showroles,$cloneruname,$clonerudom,%courses) = @_; |
my ($r,$type,$multiple,$action,$showroles,$cloneruname,$clonerudom,$crsdom,$crscode,%courses) = @_; |
if ($env{'form.form'} eq 'portform') { |
if ($env{'form.form'} eq 'portform') { |
$action = '/adm/portfolio'; |
$action = '/adm/portfolio'; |
} |
} |
Line 379 sub display_matched_courses {
|
Line 404 sub display_matched_courses {
|
.'<fieldset>' |
.'<fieldset>' |
.'<legend>'.&mt('Pick action').'</legend>' |
.'<legend>'.&mt('Pick action').'</legend>' |
.'<span class="LC_nobreak"><label>' |
.'<span class="LC_nobreak"><label>' |
.'<input type="radio" name="phase" value="ccrole"'.$ccrolechk.'/>' |
.'<input type="radio" name="phase" value="adhocrole"'.$ccrolechk.'/>' |
.' '); |
.' '); |
if ($type eq 'Community') { |
if (&Apache::lonnet::allowed('ccc',$crsdom)) { |
$r->print(&mt('Enter the community with the role of [_1].',$cctitle)); |
if ($type eq 'Community') { |
} else { |
$r->print(&mt('Enter the community with the role of [_1].',$cctitle)); |
$r->print(&mt('Enter the course 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 (keys(%adhocroles)) { |
|
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('</label></span><br />' |
$r->print('</label></span><br />' |
.'<span class="LC_nobreak"><label>' |
.'<span class="LC_nobreak"><label>' |
.'<input type="radio" name="phase" value="menu"'.$menuchk.'/> '); |
.'<input type="radio" name="phase" value="menu"'.$menuchk.'/> '); |
if ($type eq 'Community') { |
if (&Apache::lonnet::allowed('ccc',$crsdom)) { |
$r->print(&mt('View or modify community settings which only a [_1] may modify.',$dctitle)); |
if ($type eq 'Community') { |
} else { |
$r->print(&mt('View or modify community settings which only a [_1] may modify.',$dctitle)); |
$r->print(&mt('View or modify course 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 432 sub display_matched_courses {
|
Line 502 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 451 sub display_matched_courses {
|
Line 521 sub display_matched_courses {
|
map {$cc_cloneable{$_} = 1;} split('&',$coord_cloneable); |
map {$cc_cloneable{$_} = 1;} split('&',$coord_cloneable); |
} |
} |
} |
} |
|
my (%gotdomdefaults,%gotcodedefaults); |
foreach my $description (sort { lc($a) cmp lc($b) } (keys(%by_descrip))) { |
foreach my $description (sort { lc($a) cmp lc($b) } (keys(%by_descrip))) { |
foreach my $course (@{$by_descrip{$description}}) { |
foreach my $course (@{$by_descrip{$description}}) { |
$r->print(&Apache::loncommon::start_data_table_row()); |
$r->print(&Apache::loncommon::start_data_table_row()); |
Line 476 sub display_matched_courses {
|
Line 547 sub display_matched_courses {
|
} |
} |
unless ($canclone) { |
unless ($canclone) { |
my $cloners = $courses{$course}{'cloners'}; |
my $cloners = $courses{$course}{'cloners'}; |
if ($cloners ne '') { |
if ($cloners ne '') { |
my @cloneable = split(',',$cloners); |
my @cloneable = split(',',$cloners); |
if (grep(/^\*$/,@cloneable)) { |
if (grep(/^\*$/,@cloneable)) { |
$canclone = 1; |
$canclone = 1; |
Line 487 sub display_matched_courses {
|
Line 558 sub display_matched_courses {
|
if (grep(/^\Q$cloneruname\E:\Q$clonerudom\E$/,@cloneable)) { |
if (grep(/^\Q$cloneruname\E:\Q$clonerudom\E$/,@cloneable)) { |
$canclone = 1; |
$canclone = 1; |
} |
} |
|
unless ($canclone) { |
|
if (($instcode) && ($crscode) && ($cdom eq $crsdom)) { |
|
foreach my $cloner (@cloneable) { |
|
if (($cloner ne '*') && ($cloner !~ /^\*\:$match_domain$/) && |
|
($cloner !~ /^$match_username\:$match_domain$/) && ($cloner ne '')) { |
|
if ($cloner =~ /\=/) { |
|
my (%codedefaults,@code_order); |
|
if (ref($gotcodedefaults{$cdom}) eq 'HASH') { |
|
if (ref($gotcodedefaults{$cdom}{'defaults'}) eq 'HASH') { |
|
%codedefaults = %{$gotcodedefaults{$cdom}{'defaults'}}; |
|
} |
|
if (ref($gotcodedefaults{$cdom}{'order'}) eq 'ARRAY') { |
|
@code_order = @{$gotcodedefaults{$cdom}{'order'}}; |
|
} |
|
} else { |
|
&Apache::lonnet::auto_instcode_defaults($cdom, |
|
\%codedefaults, |
|
\@code_order); |
|
$gotcodedefaults{$cdom}{'defaults'} = \%codedefaults; |
|
$gotcodedefaults{$cdom}{'order'} = \@code_order; |
|
} |
|
if (@code_order > 0) { |
|
if (&Apache::lonnet::check_instcode_cloning(\%codedefaults,\@code_order, |
|
$cloner,$instcode,$crscode)) { |
|
$canclone = 1; |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} else { |
|
my %domdefs; |
|
if (ref($gotdomdefaults{$cdom}) eq 'HASH') { |
|
%domdefs = %{$gotdomdefaults{$cdom}}; |
|
} else { |
|
%domdefs = &Apache::lonnet::get_domain_defaults($cdom); |
|
$gotdomdefaults{$cdom} = \%domdefs; |
|
} |
|
if ($domdefs{'canclone'}) { |
|
unless ($domdefs{'canclone'} eq 'none') { |
|
if ($domdefs{'canclone'} eq 'domain') { |
|
if ($clonerudom eq $cdom) { |
|
$canclone = 1; |
|
} |
|
} elsif (($instcode) && ($crscode) && |
|
($cdom eq $crsdom)) { |
|
my (%codedefaults,@code_order); |
|
if (ref($gotcodedefaults{$cdom}) eq 'HASH') { |
|
if (ref($gotcodedefaults{$cdom}{'defaults'}) eq 'HASH') { |
|
%codedefaults = %{$gotcodedefaults{$cdom}{'defaults'}}; |
|
} |
|
if (ref($gotcodedefaults{$cdom}{'order'}) eq 'ARRAY') { |
|
@code_order = @{$gotcodedefaults{$cdom}{'order'}}; |
|
} |
|
} else { |
|
&Apache::lonnet::auto_instcode_defaults($cdom, |
|
\%codedefaults, |
|
\@code_order); |
|
$gotcodedefaults{$cdom}{'defaults'} = \%codedefaults; |
|
$gotcodedefaults{$cdom}{'order'} = \@code_order; |
|
} |
|
if (@code_order > 0) { |
|
if (&Apache::lonnet::default_instcode_cloning($cdom,$domdefs{'canclone'}, |
|
$instcode,$crscode,\%codedefaults, |
|
\@code_order)) { |
|
$canclone = 1; |
|
} |
|
} |
|
} |
|
} |
|
} |
} |
} |
} |
} |
} |
} |
Line 508 sub display_matched_courses {
|
Line 653 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 606 sub get_coordinator_cloneable {
|
Line 751 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 627 sub course_chooser {
|
Line 772 sub course_chooser {
|
$output = '<label><input type="checkbox" name="course_id" value="'.$cdom.'_'.$cnum.'" />'."\n"; |
$output = '<label><input type="checkbox" name="course_id" value="'.$cdom.'_'.$cnum.'" />'."\n"; |
} elsif ((($env{'form.form'} eq 'ccrs') || ($env{'form.form'} eq 'requestcrs')) && (!$canclone)) { |
} elsif ((($env{'form.form'} eq 'ccrs') || ($env{'form.form'} eq 'requestcrs')) && (!$canclone)) { |
if ($env{'form.form'} eq 'ccrs') { |
if ($env{'form.form'} eq 'ccrs') { |
$output = &mt('No cloning for ').$env{'form.cloner'}."\n"; |
$output = &mt('No cloning for [_1]',$env{'form.cloner'})."\n"; |
} else { |
} else { |
$output = &mt('No rights to clone')."\n"; |
$output = &mt('No rights to clone')."\n"; |
} |
} |
Line 651 sub gochoose_javascript {
|
Line 796 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 772 Course Activity - how recently was cours
|
Line 922 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 825 Following selection, and/or submission,
|
Line 975 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 |
|
|
Line 836 javascript code for reporting selected s
|
Line 986 javascript code for reporting selected s
|
|
|
=item * |
=item * |
X<display_matched_courses()> |
X<display_matched_courses()> |
B<display_matched_courses($r,$type,$multiple,$action,$showroles,$cloneruname,$clonerudom,%courses)>: |
B<display_matched_courses($r,$type,$multiple,$action,$showroles,$cloneruname,$clonerudom,$crsdom,$crscode,%courses)>: |
|
|
Input: 7 - request object, course type, multiple (0 or 1), form action, whether to show roles (for course personnel filter), username of new course owner, domain of new course owner, hash of courses. |
Input: 8 - request object, course type, multiple (0 or 1), form action, whether to show roles (for course personnel filter), username of new course owner, domain of new course owner, domain of new course, institutional code of new course, hash of courses. |
|
|
Output: 0 |
Output: 0 |
|
|