version 1.65, 2013/12/24 19:15:11
|
version 1.71, 2014/03/31 01:37:28
|
Line 153 sub print_course_search_page {
|
Line 153 sub print_course_search_page {
|
$type = 'Course'; |
$type = 'Course'; |
} |
} |
&print_header($r,$type); |
&print_header($r,$type); |
my $filterlist = ['descriptfilter', |
my ($filterlist,$filter) = &get_filters($dom); |
'instcodefilter','ownerfilter', |
|
'coursefilter']; |
|
my $filter = {}; |
|
my ($numtitles,$cctitle,$dctitle,@codetitles); |
my ($numtitles,$cctitle,$dctitle,@codetitles); |
my $ccrole = 'cc'; |
my $ccrole = 'cc'; |
if ($type eq 'Community') { |
if ($type eq 'Community') { |
Line 164 sub print_course_search_page {
|
Line 161 sub print_course_search_page {
|
} |
} |
$cctitle = &Apache::lonnet::plaintext($ccrole,$type); |
$cctitle = &Apache::lonnet::plaintext($ccrole,$type); |
$dctitle = &Apache::lonnet::plaintext('dc'); |
$dctitle = &Apache::lonnet::plaintext('dc'); |
$r->print(&Apache::lonpickcourse::js_changer()); |
$r->print(&Apache::loncommon::js_changer()); |
if ($type eq 'Community') { |
if ($type eq 'Community') { |
$r->print('<h3>'.&mt('Search for a community in the [_1] domain',$domdesc).'</h3>'); |
$r->print('<h3>'.&mt('Search for a community in the [_1] domain',$domdesc).'</h3>'); |
} else { |
} else { |
$r->print('<h3>'.&mt('Search for a course in the [_1] domain',$domdesc).'</h3>'); |
$r->print('<h3>'.&mt('Search for a course in the [_1] domain',$domdesc).'</h3>'); |
} |
} |
$r->print(&Apache::lonpickcourse::build_filters($filterlist,$type, |
$r->print(&Apache::loncommon::build_filters($filterlist,$type,undef,undef,$filter,$action, |
undef,undef,$filter,$action,\$numtitles,'modifycourse', |
\$numtitles,'modifycourse',undef,undef,undef, |
undef,undef,undef,\@codetitles)); |
\@codetitles,$dom)); |
if ($type eq 'Community') { |
if ($type eq 'Community') { |
$r->print(&mt('Actions available after searching for a community:').'<ul>'. |
$r->print(&mt('Actions available after searching for a community:').'<ul>'. |
'<li>'.&mt('Enter the community with the role of [_1]',$cctitle).'</li>'."\n". |
'<li>'.&mt('Enter the community with the role of [_1]',$cctitle).'</li>'."\n". |
Line 184 sub print_course_search_page {
|
Line 181 sub print_course_search_page {
|
'<li>'.&mt('View or modify course settings which only a [_1] may modify.',$dctitle). |
'<li>'.&mt('View or modify course settings which only a [_1] may modify.',$dctitle). |
'</li>'."\n".'</ul>'); |
'</li>'."\n".'</ul>'); |
} |
} |
|
return; |
} |
} |
|
|
sub print_course_selection_page { |
sub print_course_selection_page { |
Line 195 sub print_course_selection_page {
|
Line 193 sub print_course_selection_page {
|
&print_header($r,$type); |
&print_header($r,$type); |
|
|
# Criteria for course search |
# Criteria for course search |
my $filterlist = ['descriptfilter', |
my ($filterlist,$filter) = &get_filters(); |
'instcodefilter','ownerfilter', |
|
'ownerdomfilter','coursefilter']; |
|
my %filter; |
|
my $action = '/adm/modifycourse'; |
my $action = '/adm/modifycourse'; |
my $dctitle = &Apache::lonnet::plaintext('dc'); |
my $dctitle = &Apache::lonnet::plaintext('dc'); |
my ($numtitles,@codetitles); |
my ($numtitles,@codetitles); |
$r->print(&Apache::lonpickcourse::js_changer()); |
$r->print(&Apache::loncommon::js_changer()); |
$r->print(&mt('Revise your search criteria for this domain').' ('.$domdesc.').<br />'); |
$r->print(&mt('Revise your search criteria for this domain').' ('.$domdesc.').<br />'); |
$r->print(&Apache::lonpickcourse::build_filters($filterlist,$type, |
$r->print(&Apache::loncommon::build_filters($filterlist,$type,undef,undef,$filter,$action, |
undef,undef,\%filter,$action,\$numtitles, |
\$numtitles,'modifycourse',undef,undef,undef, |
undef,undef,undef,undef,\@codetitles)); |
\@codetitles,$dom,$env{'form.form'})); |
$filter{'domainfilter'} = $dom; |
my %courses = &Apache::loncommon::search_courses($dom,$type,$filter,$numtitles, |
my %courses = &Apache::lonpickcourse::search_courses($r,$type,0, |
undef,undef,undef,\@codetitles); |
\%filter,$numtitles,undef, |
|
undef,undef,\@codetitles); |
|
&Apache::lonpickcourse::display_matched_courses($r,$type,0,$action,undef,undef,undef, |
&Apache::lonpickcourse::display_matched_courses($r,$type,0,$action,undef,undef,undef, |
%courses); |
%courses); |
return; |
return; |
} |
} |
|
|
|
sub get_filters { |
|
my ($dom) = @_; |
|
my @filterlist = ('descriptfilter','instcodefilter','ownerfilter', |
|
'ownerdomfilter','coursefilter','sincefilter'); |
|
# created filter |
|
my $loncaparev = &Apache::lonnet::get_server_loncaparev($dom); |
|
if ($loncaparev ne 'unknown_cmd') { |
|
push(@filterlist,'createdfilter'); |
|
} |
|
my %filter; |
|
foreach my $item (@filterlist) { |
|
$filter{$item} = $env{'form.'.$item}; |
|
} |
|
return (\@filterlist,\%filter); |
|
} |
|
|
sub print_modification_menu { |
sub print_modification_menu { |
my ($r,$cdesc,$domdesc,$dom,$type) = @_; |
my ($r,$cdesc,$domdesc,$dom,$type,$cid,$coursehash) = @_; |
&print_header($r,$type); |
&print_header($r,$type); |
my ($ccrole,$categorytitle,$setquota_text,$setuploadquota_text,$setparams_text,$cat_text); |
my ($ccrole,$categorytitle,$setquota_text,$setuploadquota_text,$setparams_text,$cat_text, |
|
$cdom,$cnum); |
|
if (ref($coursehash) eq 'HASH') { |
|
$cdom = $coursehash->{'domain'}; |
|
$cnum = $coursehash->{'num'}; |
|
} else { |
|
($cdom,$cnum) = split(/_/,$cid); |
|
} |
if ($type eq 'Community') { |
if ($type eq 'Community') { |
$ccrole = 'co'; |
$ccrole = 'co'; |
} else { |
} else { |
Line 436 sub print_setquota {
|
Line 452 sub print_setquota {
|
coursequota => 20, |
coursequota => 20, |
uploadquota => 500, |
uploadquota => 500, |
); |
); |
my %settings = &Apache::lonnet::get('environment',['internal.coursequota','internal.uploadquota','internal.instcode'], |
my %settings = &Apache::lonnet::get('environment',['internal.coursequota','internal.uploadquota','internal.coursecode'], |
$cdom,$cnum); |
$cdom,$cnum); |
my $coursequota = $settings{'internal.coursequota'}; |
my $coursequota = $settings{'internal.coursequota'}; |
my $uploadquota = $settings{'internal.uploadquota'}; |
my $uploadquota = $settings{'internal.uploadquota'}; |
Line 447 sub print_setquota {
|
Line 463 sub print_setquota {
|
my %domdefs = &Apache::lonnet::get_domain_defaults($cdom); |
my %domdefs = &Apache::lonnet::get_domain_defaults($cdom); |
if ($type eq 'Community') { |
if ($type eq 'Community') { |
$uploadquota = $domdefs{$lctype.'quota'}; |
$uploadquota = $domdefs{$lctype.'quota'}; |
} elsif ($settings{'internal.instcode'}) { |
} elsif ($settings{'internal.coursecode'}) { |
$uploadquota = $domdefs{'officialquota'}; |
$uploadquota = $domdefs{'officialquota'}; |
} elsif ($settings{'internal.textbook'}) { |
} elsif ($settings{'internal.textbook'}) { |
$uploadquota = $domdefs{'textbookquota'}; |
$uploadquota = $domdefs{'textbookquota'}; |
Line 996 sub modify_course {
|
Line 1012 sub modify_course {
|
$reply = '<h3>'.$mainheader.' <span class="LC_nobreak">'.$cdesc.'</span></h3>'."\n". |
$reply = '<h3>'.$mainheader.' <span class="LC_nobreak">'.$cdesc.'</span></h3>'."\n". |
'<p>'.$reply.'</p>'."\n". |
'<p>'.$reply.'</p>'."\n". |
'<form action="/adm/modifycourse" method="post" name="processparms">'. |
'<form action="/adm/modifycourse" method="post" name="processparms">'. |
&hidden_form_elements(). |
&hidden_form_elements(); |
'<a href="javascript:changePage(document.processparms,'."'menu'".')">'. |
my @actions = |
&mt('Pick another action').'</a>'; |
('<a href="javascript:changePage(document.processparms,'."'menu'".')">'. |
|
&mt('Pick another action').'</a>'); |
if ($numwarnings) { |
if ($numwarnings) { |
my $newrole = $ccrole.'./'.$cdom.'/'.$cnum; |
my $newrole = $ccrole.'./'.$cdom.'/'.$cnum; |
my $escuri = &HTML::Entities::encode('/adm/roles?selectrole=1&'.$newrole. |
my $escuri = &HTML::Entities::encode('/adm/roles?selectrole=1&'.$newrole. |
'=1&destinationurl=/adm/populate','&<>"'); |
'=1&destinationurl=/adm/populate','&<>"'); |
|
|
$reply .= '<br /><a href="'.$escuri.'">'. |
push(@actions, '<a href="'.$escuri.'">'. |
&mt('Go to Automated Enrollment Manager for course').'</a>'; |
&mt('Go to Automated Enrollment Manager for course').'</a>'); |
} |
} |
$reply .= '</form>'; |
$reply .= &Apache::lonhtmlcommon::actionbox(\@actions).'</form>'; |
$r->print($reply); |
$r->print($reply); |
return; |
return; |
} |
} |
Line 1240 sub modify_quota {
|
Line 1257 sub modify_quota {
|
} |
} |
$r->print('<p>'); |
$r->print('<p>'); |
if ($type eq 'Community') { |
if ($type eq 'Community') { |
$r->print(&mt('Disk usage [_1] exceeds the quota for this community.',$newoverquota).' '. |
$r->print(&mt("Disk usage $newoverquota exceeds the quota for this community.").' '. |
&mt('Upload of new portfolio files and assignment of a non-zero MB quota to new groups in the community will not be possible until some files have been deleted, and total usage is below community quota.')); |
&mt('Upload of new portfolio files and assignment of a non-zero MB quota to new groups in the community will not be possible until some files have been deleted, and total usage is below community quota.')); |
} else { |
} else { |
$r->print(&mt('Disk usage [_1] exceeds the quota for this course.',$newoverquota).' '. |
$r->print(&mt("Disk usage $newoverquota exceeds the quota for this course.").' '. |
&mt('Upload of new portfolio files and assignment of a non-zero MB quota to new groups in the course will not be possible until some files have been deleted, and total usage is below course quota.')); |
&mt('Upload of new portfolio files and assignment of a non-zero MB quota to new groups in the course will not be possible until some files have been deleted, and total usage is below course quota.')); |
} |
} |
$r->print('</p>'); |
$r->print('</p>'); |
Line 1561 sub print_footer {
|
Line 1578 sub print_footer {
|
} |
} |
|
|
sub check_course { |
sub check_course { |
my ($r,$dom,$domdesc) = @_; |
my ($dom,$domdesc) = @_; |
my ($ok_course,$description,$instcode,$owner); |
my ($ok_course,$description,$instcode); |
my %args = ( |
my %coursehash; |
one_time => 1, |
if ($env{'form.pickedcourse'} =~ /^$match_domain\_$match_courseid$/) { |
); |
my %args; |
my %coursehash = |
unless ($env{'course.'.$env{'form.pickedcourse'}.'.description'}) { |
&Apache::lonnet::coursedescription($env{'form.pickedcourse'},\%args); |
%args = ( |
my $cnum = $coursehash{'num'}; |
'one_time' => 1, |
my $cdom = $coursehash{'domain'}; |
'freshen_cache' => 1, |
if ($cdom eq $dom) { |
); |
my $description; |
} |
my %courseIDs = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.', |
%coursehash = |
$cnum,undef,undef,'.'); |
&Apache::lonnet::coursedescription($env{'form.pickedcourse'},\%args); |
if (keys(%courseIDs) > 0) { |
my $cnum = $coursehash{'num'}; |
$ok_course = 'ok'; |
my $cdom = $coursehash{'domain'}; |
my ($instcode,$owner); |
$description = $coursehash{'description'}; |
if (ref($courseIDs{$cdom.'_'.$cnum}) eq 'HASH') { |
$instcode = $coursehash{'internal.coursecode'}; |
$description = $courseIDs{$cdom.'_'.$cnum}{'description'}; |
if ($instcode) { |
$instcode = $courseIDs{$cdom.'_'.$cnum}{'inst_code'}; |
$description .= " ($instcode)"; |
$owner = $courseIDs{$cdom.'_'.$cnum}{'owner'}; |
} |
} else { |
if (($cdom eq $dom) && ($cnum =~ /^$match_courseid$/)) { |
($description,$instcode,$owner) = |
my %courseIDs = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.', |
split(/:/,$courseIDs{$cdom.'_'.$cnum}); |
$cnum,undef,undef,'.'); |
} |
if ($courseIDs{$cdom.'_'.$cnum}) { |
$description = &unescape($description); |
$ok_course = 'ok'; |
$instcode = &unescape($instcode); |
|
if ($instcode) { |
|
$description .= " ($instcode)"; |
|
} |
} |
return ($ok_course,$description); |
|
} |
} |
} |
} |
|
return ($ok_course,$description,\%coursehash); |
} |
} |
|
|
sub course_settings_descrip { |
sub course_settings_descrip { |
Line 1690 sub handler {
|
Line 1704 sub handler {
|
if ($phase eq 'courselist') { |
if ($phase eq 'courselist') { |
&print_course_selection_page($r,$dom,$domdesc); |
&print_course_selection_page($r,$dom,$domdesc); |
} else { |
} else { |
my ($checked,$cdesc) = &check_course($r,$dom,$domdesc); |
my ($checked,$cdesc,$coursehash) = &check_course($dom,$domdesc); |
if ($checked eq 'ok') { |
if ($checked eq 'ok') { |
my $enter_text; |
my $enter_text; |
if ($type eq 'Community') { |
if ($type eq 'Community') { |
Line 1702 sub handler {
|
Line 1716 sub handler {
|
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"javascript:changePage(document.$phase,'menu')", |
({href=>"javascript:changePage(document.$phase,'menu')", |
text=>"Pick action"}); |
text=>"Pick action"}); |
&print_modification_menu($r,$cdesc,$domdesc,$dom,$type); |
&print_modification_menu($r,$cdesc,$domdesc,$dom,$type, |
|
$env{'form.pickedcourse'},$coursehash); |
} elsif ($phase eq 'ccrole') { |
} elsif ($phase eq 'ccrole') { |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"javascript:changePage(document.$phase,'ccrole')", |
({href=>"javascript:changePage(document.$phase,'ccrole')", |