version 1.60, 2013/03/01 05:01:26
|
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,$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 { |
$ccrole = 'cc'; |
$ccrole = 'cc'; |
} |
} |
if ($type eq 'Community') { |
if ($type eq 'Community') { |
$categorytitle = 'View/Modify Community Settings'; |
$categorytitle = 'View/Modify Community Settings'; |
$setquota_text = &mt('Total disk space allocated for storage of portfolio files in all groups in a community.'); |
$setquota_text = &mt('Total disk space allocated for storage of portfolio files in all groups in a community.'); |
|
$setuploadquota_text = &mt('Disk space allocated for storage of content uploaded directly to a community via Content Editor.'); |
$setparams_text = 'View/Modify community owner'; |
$setparams_text = 'View/Modify community owner'; |
$cat_text = 'View/Modify catalog settings for community'; |
$cat_text = 'View/Modify catalog settings for community'; |
} else { |
} else { |
$categorytitle = 'View/Modify Course Settings'; |
$categorytitle = 'View/Modify Course Settings'; |
$setquota_text = &mt('Total disk space allocated for storage of portfolio files in all groups in a course.'); |
$setquota_text = &mt('Total disk space allocated for storage of portfolio files in all groups in a course.'); |
|
$setuploadquota_text = &mt('Disk space allocated for storage of content uploaded directly to a course via Content Editor.'); |
if (&showcredits($dom)) { |
if (&showcredits($dom)) { |
$setparams_text = 'View/Modify course owner, institutional code, and default authentication and credits'; |
$setparams_text = 'View/Modify course owner, institutional code, and default authentication and credits'; |
} else { |
} else { |
Line 261 sub print_modification_menu {
|
Line 279 sub print_modification_menu {
|
linktitle => '' |
linktitle => '' |
}, |
}, |
{ |
{ |
linktext => 'View/Modify quota for group portfolio files', |
linktext => 'View/Modify quotas for group portfolio files, and for uploaded content.', |
url => &phaseurl('setquota'), |
url => &phaseurl('setquota'), |
permission => 1, |
permission => 1, |
#help => '', |
#help => '', |
Line 317 sub print_modification_menu {
|
Line 335 sub print_modification_menu {
|
} |
} |
} |
} |
$menu_html .= '<li>'.$setquota_text.'</li>'. |
$menu_html .= '<li>'.$setquota_text.'</li>'. |
|
'<li>'.$setuploadquota_text.'</li>'. |
'<li>'.$anon_text.'</li>'."\n"; |
'<li>'.$anon_text.'</li>'."\n"; |
foreach my $item (@additional_params) { |
foreach my $item (@additional_params) { |
if ($type eq 'Community') { |
if ($type eq 'Community') { |
Line 420 sub print_settings_display {
|
Line 439 sub print_settings_display {
|
|
|
sub print_setquota { |
sub print_setquota { |
my ($r,$cdom,$cnum,$cdesc,$type) = @_; |
my ($r,$cdom,$cnum,$cdesc,$type) = @_; |
|
my $lctype = lc($type); |
|
my $headline = &mt("Set disk space quotas for $lctype: [_1]", |
|
'<span class="LC_nobreak">'.$cdesc.'</span>'); |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'cquo' => 'Disk space for storage of group portfolio files for:', |
'gpqu' => 'Disk space for storage of group portfolio files', |
'gpqu' => 'Course portfolio files disk space', |
'upqu' => 'Disk space for storage of content directly uploaded to course via Content Editor', |
'modi' => 'Save', |
'modi' => 'Save', |
'back' => 'Pick another action', |
'back' => 'Pick another action', |
); |
); |
if ($type eq 'Community') { |
my %staticdefaults = ( |
$lt{'gpqu'} = &mt('Community portfolio files disk space'); |
coursequota => 20, |
} |
uploadquota => 500, |
my %settings = &Apache::lonnet::get('environment',['internal.coursequota'],$cdom,$cnum); |
); |
|
my %settings = &Apache::lonnet::get('environment',['internal.coursequota','internal.uploadquota','internal.coursecode'], |
|
$cdom,$cnum); |
my $coursequota = $settings{'internal.coursequota'}; |
my $coursequota = $settings{'internal.coursequota'}; |
|
my $uploadquota = $settings{'internal.uploadquota'}; |
if ($coursequota eq '') { |
if ($coursequota eq '') { |
$coursequota = 20; |
$coursequota = $staticdefaults{'coursequota'}; |
|
} |
|
if ($uploadquota eq '') { |
|
my %domdefs = &Apache::lonnet::get_domain_defaults($cdom); |
|
if ($type eq 'Community') { |
|
$uploadquota = $domdefs{$lctype.'quota'}; |
|
} elsif ($settings{'internal.coursecode'}) { |
|
$uploadquota = $domdefs{'officialquota'}; |
|
} elsif ($settings{'internal.textbook'}) { |
|
$uploadquota = $domdefs{'textbookquota'}; |
|
} else { |
|
$uploadquota = $domdefs{'unofficialquota'}; |
|
} |
|
if ($uploadquota eq '') { |
|
$uploadquota = $staticdefaults{'uploadquota'}; |
|
} |
} |
} |
&print_header($r,$type); |
&print_header($r,$type); |
my $hidden_elements = &hidden_form_elements(); |
my $hidden_elements = &hidden_form_elements(); |
my $helpitem = &Apache::loncommon::help_open_topic('Modify_Course_Quota'); |
my $porthelpitem = &Apache::loncommon::help_open_topic('Modify_Course_Quota'); |
|
my $uploadhelpitem = &Apache::loncommon::help_open_topic('Modify_Course_Upload_Quota'); |
$r->print(<<ENDDOCUMENT); |
$r->print(<<ENDDOCUMENT); |
<form action="/adm/modifycourse" method="post" name="setquota" onsubmit="return verify_quota();"> |
<form action="/adm/modifycourse" method="post" name="setquota" onsubmit="return verify_quota();"> |
<h3>$lt{'cquo'} <span class="LC_nobreak">$cdesc</span></h3> |
<h3>$headline</h3> |
|
<p><span class="LC_nobreak"> |
|
$porthelpitem $lt{'gpqu'}: <input type="text" size="4" name="coursequota" value="$coursequota" /> MB |
|
</span> |
|
<br /> |
|
<span class="LC_nobreak"> |
|
$uploadhelpitem $lt{'upqu'}: <input type="text" size="4" name="uploadquota" value="$uploadquota" /> MB |
|
</span> |
|
</p> |
<p> |
<p> |
$helpitem $lt{'gpqu'}: <input type="text" size="4" name="coursequota" value="$coursequota" /> Mb |
|
<input type="submit" value="$lt{'modi'}" /> |
<input type="submit" value="$lt{'modi'}" /> |
</p> |
</p> |
$hidden_elements |
$hidden_elements |
Line 851 sub modify_course {
|
Line 899 sub modify_course {
|
} |
} |
} |
} |
if (@changes > 0) { |
if (@changes > 0) { |
$chgresponse = &mt("The following settings have been changed:<br/><ul>"); |
$chgresponse = &mt('The following settings have been changed:').'<br/><ul>'; |
} |
} |
if (@nochanges > 0) { |
if (@nochanges > 0) { |
$nochgresponse = &mt("The following settings remain unchanged:<br/><ul>"); |
$nochgresponse = &mt('The following settings remain unchanged:').'<br/><ul>'; |
} |
} |
if (@changes > 0) { |
if (@changes > 0) { |
my $putreply = &Apache::lonnet::put('environment',\%cenv,$cdom,$cnum); |
my $putreply = &Apache::lonnet::put('environment',\%cenv,$cdom,$cnum); |
Line 964 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 1126 sub update_coowners {
|
Line 1175 sub update_coowners {
|
sub modify_quota { |
sub modify_quota { |
my ($r,$cdom,$cnum,$cdesc,$domdesc,$type) = @_; |
my ($r,$cdom,$cnum,$cdesc,$domdesc,$type) = @_; |
&print_header($r,$type); |
&print_header($r,$type); |
|
my $lctype = lc($type); |
|
my $headline = &mt("Disk space quotas for $lctype: [_1]", |
|
'<span class="LC_nobreak">'.$cdesc.'</span>'); |
$r->print('<form action="/adm/modifycourse" method="post" name="processquota">'."\n". |
$r->print('<form action="/adm/modifycourse" method="post" name="processquota">'."\n". |
'<h3>'.&mt('Disk space for storage of group portfolio files for:'). |
'<h3>'.$headline.'</h3>'); |
' <span class="LC_nobreak">'.$cdesc.'</span></h3><br />'); |
my %oldsettings = &Apache::lonnet::get('environment',['internal.coursequota','internal.uploadquota'],$cdom,$cnum); |
my %oldsettings = &Apache::lonnet::get('environment',['internal.coursequota'],$cdom,$cnum); |
my %staticdefaults = ( |
my $defaultquota = 20; |
coursequota => 20, |
if ($env{'form.coursequota'} ne '') { |
uploadquota => 500, |
my $newquota = $env{'form.coursequota'}; |
); |
if ($newquota =~ /^\s*(\d+\.?\d*|\.\d+)\s*$/) { |
my %default; |
$newquota = $1; |
$default{'coursequota'} = $staticdefaults{'coursequota'}; |
if ($oldsettings{'internal.coursequota'} eq $env{'form.coursequota'}) { |
my %domdefs = &Apache::lonnet::get_domain_defaults($cdom); |
$r->print(&mt('The disk space allocated for group portfolio files remains unchanged as [_1] Mb.',$env{'form.coursequota'})); |
$default{'uploadquota'} = $domdefs{'uploadquota'}; |
|
if ($default{'uploadquota'} eq '') { |
|
$default{'uploadquota'} = $staticdefaults{'uploadquota'}; |
|
} |
|
my (%cenv,%showresult); |
|
foreach my $item ('coursequota','uploadquota') { |
|
if ($env{'form.'.$item} ne '') { |
|
my $newquota = $env{'form.'.$item}; |
|
if ($newquota =~ /^\s*(\d+\.?\d*|\.\d+)\s*$/) { |
|
$newquota = $1; |
|
if ($oldsettings{'internal.'.$item} == $newquota) { |
|
if ($item eq 'coursequota') { |
|
$r->print(&mt('The disk space allocated for group portfolio files remains unchanged as [_1] MB.',$newquota).'<br />'); |
|
} else { |
|
$r->print(&mt('The disk space allocated for files uploaded via the Content Editor remains unchanged as [_1] MB.',$newquota).'<br />'); |
|
} |
|
} else { |
|
$cenv{'internal.'.$item} = $newquota; |
|
$showresult{$item} = 1; |
|
} |
} else { |
} else { |
my %cenv = ( |
if ($item eq 'coursequota') { |
'internal.coursequota' => $env{'form.coursequota'}, |
$r->print(&mt('The proposed group portfolio quota contained invalid characters, so the quota is unchanged.').'<br />'); |
); |
} else { |
my $putreply = &Apache::lonnet::put('environment',\%cenv,$cdom, |
$r->print(&mt('The proposed quota for content uploaded via the Content Editor contained invalid characters, so the quota is unchanged.').'<br />'); |
$cnum); |
|
if (($oldsettings{'internal.coursequota'} eq '') && |
} |
($env{'form.coursequota'} == $defaultquota)) { |
} |
|
} |
|
} |
|
if (keys(%cenv)) { |
|
my $putreply = &Apache::lonnet::put('environment',\%cenv,$cdom, |
|
$cnum); |
|
foreach my $key (sort(keys(%showresult))) { |
|
if (($oldsettings{'internal.'.$key} eq '') && |
|
($env{'form.'.$key} == $default{$key})) { |
|
if ($key eq 'uploadquota') { |
if ($type eq 'Community') { |
if ($type eq 'Community') { |
$r->print(&mt('The disk space allocated for group portfolio files in this community is the default quota for this domain: [_1] Mb.',$defaultquota)); |
$r->print(&mt('The disk space allocated for files uploaded to this community via the Content Editor is the default quota for this domain: [_1] MB.', |
|
$default{$key}).'<br />'); |
} else { |
} else { |
$r->print(&mt('The disk space allocated for group portfolio files in this course is the default quota for this domain: [_1] Mb.',$defaultquota)); |
$r->print(&mt('The disk space allocated for files uploaded to this course via the Content Editor is the default quota for this domain: [_1] MB.', |
|
$default{$key}).'<br />'); |
} |
} |
} else { |
} else { |
if ($putreply eq 'ok') { |
if ($type eq 'Community') { |
my %updatedsettings = &Apache::lonnet::get('environment',['internal.coursequota'],$cdom,$cnum); |
$r->print(&mt('The disk space allocated for group portfolio files in this community is the default quota for this domain: [_1] MB.', |
$r->print(&mt('The disk space allocated for group portfolio files is now: [_1] Mb.','<b>'.$updatedsettings{'internal.coursequota'}.'</b>')); |
$default{$key}).'<br />'); |
my $usage = &Apache::longroup::sum_quotas($cdom.'_'.$cnum); |
|
if ($usage >= $updatedsettings{'internal.coursequota'}) { |
|
my $newoverquota; |
|
if ($usage < $oldsettings{'internal.coursequota'}) { |
|
$newoverquota = 'now'; |
|
} |
|
$r->print('<p>'); |
|
if ($type eq 'Community') { |
|
$r->print(&mt('Disk usage [_1] exceeds the quota for this community.',$newoverquota).' '. |
|
&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 { |
|
$r->print(&mt('Disk usage [_1] exceeds the quota for this course.',$newoverquota).' '. |
|
&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>'); |
|
} |
|
} else { |
} else { |
$r->print(&mt('An error occurred storing the quota for group portfolio files: '). |
$r->print(&mt('The disk space allocated for group portfolio files in this course is the default quota for this domain: [_1] MB.', |
$putreply); |
$default{$key}).'<br />'); |
} |
} |
} |
} |
|
delete($showresult{$key}); |
|
} |
|
} |
|
if ($putreply eq 'ok') { |
|
my %updatedsettings = &Apache::lonnet::get('environment',['internal.coursequota','internal.uploadquota'],$cdom,$cnum); |
|
if ($showresult{'coursequota'}) { |
|
$r->print(&mt('The disk space allocated for group portfolio files is now: [_1] MB.', |
|
'<b>'.$updatedsettings{'internal.coursequota'}.'</b>').'<br />'); |
|
my $usage = &Apache::longroup::sum_quotas($cdom.'_'.$cnum); |
|
if ($usage >= $updatedsettings{'internal.coursequota'}) { |
|
my $newoverquota; |
|
if ($usage < $oldsettings{'internal.coursequota'}) { |
|
$newoverquota = 'now'; |
|
} |
|
$r->print('<p>'); |
|
if ($type eq 'Community') { |
|
$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.')); |
|
} else { |
|
$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.')); |
|
} |
|
$r->print('</p>'); |
|
} |
|
} |
|
if ($showresult{'uploadquota'}) { |
|
$r->print(&mt('The disk space allocated for content uploaded directly via the Content Editor is now: [_1] MB.', |
|
'<b>'.$updatedsettings{'internal.uploadquota'}.'</b>').'<br />'); |
} |
} |
} else { |
} else { |
$r->print(&mt('The new quota requested contained invalid characters, so the quota is unchanged.')); |
$r->print(&mt('An error occurred storing the quota(s) for group portfolio files and/or uploaded content: '). |
|
$putreply); |
} |
} |
} |
} |
$r->print('<p>'. |
$r->print('<p>'. |
Line 1483 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 1552 sub hidden_form_elements {
|
Line 1644 sub hidden_form_elements {
|
&Apache::lonhtmlcommon::echo_form_input(['gosearch','updater','coursecode', |
&Apache::lonhtmlcommon::echo_form_input(['gosearch','updater','coursecode', |
'prevphase','numlocalcc','courseowner','login','coursequota','intarg', |
'prevphase','numlocalcc','courseowner','login','coursequota','intarg', |
'locarg','krbarg','krbver','counter','hidefromcat','usecategory', |
'locarg','krbarg','krbver','counter','hidefromcat','usecategory', |
'threshold','defaultcredits'])."\n". |
'threshold','defaultcredits','uploadquota'])."\n". |
'<input type="hidden" name="prevphase" value="'.$env{'form.phase'}.'" />'; |
'<input type="hidden" name="prevphase" value="'.$env{'form.phase'}.'" />'; |
return $hidden_elements; |
return $hidden_elements; |
} |
} |
Line 1560 sub hidden_form_elements {
|
Line 1652 sub hidden_form_elements {
|
sub showcredits { |
sub showcredits { |
my ($dom) = @_; |
my ($dom) = @_; |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'}) { |
if ($domdefaults{'officialcredits'} || $domdefaults{'unofficialcredits'} || $domdefaults{'textbokcredits'}) { |
return 1; |
return 1; |
} |
} |
} |
} |
Line 1612 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 1624 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')", |