version 1.32, 2007/09/24 23:29:53
|
version 1.37, 2007/12/30 23:22:41
|
Line 33 use Apache::lonnet;
|
Line 33 use Apache::lonnet;
|
use Apache::loncommon; |
use Apache::loncommon; |
use Apache::lonhtmlcommon; |
use Apache::lonhtmlcommon; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::londropadd; |
use Apache::lonuserutils; |
use Apache::lonpickcourse; |
use Apache::lonpickcourse; |
use LONCAPA::Enrollment; |
use LONCAPA::Enrollment; |
use lib '/home/httpd/lib/perl'; |
use lib '/home/httpd/lib/perl'; |
Line 108 sub print_course_search_page {
|
Line 108 sub print_course_search_page {
|
my $action = '/adm/modifycourse'; |
my $action = '/adm/modifycourse'; |
my $cctitle = &Apache::lonnet::plaintext('cc',$type); |
my $cctitle = &Apache::lonnet::plaintext('cc',$type); |
my $dctitle = &Apache::lonnet::plaintext('dc'); |
my $dctitle = &Apache::lonnet::plaintext('dc'); |
my %lt=&Apache::lonlocal::texthash( |
$r->print( |
'some' => "Certain settings which control auto-enrollment of students from your institution's student information system.", |
'<h3>'.&mt('Search for a course in the [_1] domain',$domdesc).'</h3>'. |
'crqo' => 'The total disk space allocated for storage of portfolio files in all groups in a course.', |
&mt('Actions available after selecting a course:').'<ul>'. |
'tmod' => 'To view or modify these settings use the criteria below to select a course from this domain.', |
'<li>'.&mt('Enter the course with the role of [_1]',$cctitle).'</li>'."\n". |
); |
'<li>'.&mt('View or modify course settings which only a [_1] may modify.' |
$r->print('<h3>'. |
,$dctitle).'</li>'."\n".'</ul>'); |
&mt('Course settings which only a [_1] may modify.' |
|
,$dctitle).'</h3>'. |
|
&mt('Although almost all course settings can be modified by a [_1], a number of settings exist which only a [_2] may change:',$cctitle,$dctitle).' |
|
<ul> |
|
<li>'.$lt{'some'}.'</li> |
|
<li>'.$lt{'crqo'}.'</li> |
|
</ul>'. |
|
$lt{'tmod'}.' ('.$domdesc.') |
|
<br /><br /> |
|
'); |
|
$r->print(&Apache::lonpickcourse::build_filters($filterlist,$type, |
$r->print(&Apache::lonpickcourse::build_filters($filterlist,$type, |
undef,undef,$filter,$action,'modifycourse')); |
undef,undef,$filter,$action,'modifycourse')); |
} |
} |
Line 149 sub print_course_selection_page {
|
Line 139 sub print_course_selection_page {
|
$filter{'domainfilter'} = $dom; |
$filter{'domainfilter'} = $dom; |
my %courses = &Apache::lonpickcourse::search_courses($r,$type,0, |
my %courses = &Apache::lonpickcourse::search_courses($r,$type,0, |
\%filter); |
\%filter); |
if (keys(%courses) > 0) { |
|
$r->print(&mt("Click a 'Select' button to view or modify settings for a [_1] which may only be modified by a [_2] in this domain.",lc($type),$dctitle).'<br /><br />'); |
|
} |
|
|
|
&Apache::lonpickcourse::display_matched_courses($r,$type,0,$action, |
&Apache::lonpickcourse::display_matched_courses($r,$type,0,$action, |
%courses); |
%courses); |
return; |
return; |
} |
} |
|
|
sub print_modification_menu { |
sub print_modification_menu { |
my ($r,$cdesc) = @_; |
my ($r,$cdesc,$domdesc) = @_; |
&print_header($r,$cdesc); |
&print_header($r,$cdesc); |
|
my $type = 'Course'; |
|
my $action = '/adm/modifycourse'; |
|
my $cctitle = &Apache::lonnet::plaintext('cc',$type); |
|
my $dctitle = &Apache::lonnet::plaintext('dc'); |
|
my %lt=&Apache::lonlocal::texthash( |
|
'some' => "Certain settings which control auto-enrollment of students from your institution's student information system.", |
|
'crqo' => 'The total disk space allocated for storage of portfolio files in all groups in a course.', |
|
); |
my @menu = |
my @menu = |
( |
( |
{ text => 'Modify quota for group portfolio files', |
{ text => 'Modify quota for group portfolio files', |
Line 174 sub print_modification_menu {
|
Line 168 sub print_modification_menu {
|
} |
} |
); |
); |
my $menu_html = '<h3>'.&mt('View/Modify settings for: ').$cdesc.'</h3>'."\n". |
my $menu_html = '<h3>'.&mt('View/Modify settings for: ').$cdesc.'</h3>'."\n". |
'<form name="menu" method="post" action="/adm/modifycourse" />'."\n". |
&mt('Although almost all course settings can be modified by a [_1], a number of settings exist which only a [_2] may change:',$cctitle,$dctitle).' |
&hidden_form_elements(); |
<ul> |
|
<li>'.$lt{'some'}.'</li> |
|
<li>'.$lt{'crqo'}.'</li> |
|
</ul> |
|
<form name="menu" method="post" action="'.$action.'" />'."\n". |
|
&hidden_form_elements(); |
|
|
foreach my $menu_item (@menu) { |
foreach my $menu_item (@menu) { |
$menu_html.='<p>'; |
$menu_html.='<p>'; |
$menu_html.='<font size="+1">'; |
$menu_html.='<font size="+1">'; |
Line 189 sub print_modification_menu {
|
Line 189 sub print_modification_menu {
|
return; |
return; |
} |
} |
|
|
|
sub print_ccrole_selected { |
|
my ($r,$cdesc,$domdesc) = @_; |
|
&print_header($r); |
|
my ($cdom,$cnum) = split(/_/,$env{'form.pickedcourse'}); |
|
$r->print('<form name="ccrole" method="post" action="/adm/roles"> |
|
<input type="hidden" name="selectrole" value="1" /> |
|
<input type="hidden" name="newrole" value="cc./'.$cdom.'/'.$cnum.'" /> |
|
</form>'); |
|
} |
|
|
sub print_settings_display { |
sub print_settings_display { |
my ($r,$cdom,$cnum,$cdesc,$type) = @_; |
my ($r,$cdom,$cnum,$cdesc,$type) = @_; |
my %enrollvar = &get_enrollment_settings($cdom,$cnum); |
my %enrollvar = &get_enrollment_settings($cdom,$cnum); |
Line 239 sub print_settings_display {
|
Line 249 sub print_settings_display {
|
</p><p> |
</p><p> |
<a href="javascript:changePage(document.viewparms,'."'menu'".')">'.$lt{'back'}.'</a> |
<a href="javascript:changePage(document.viewparms,'."'menu'".')">'.$lt{'back'}.'</a> |
<a href="javascript:changePage(document.viewparms,'."'setparms'".')">'.&mt('Modify [_1]-only settings',$dctitle).'</a>'."\n". |
<a href="javascript:changePage(document.viewparms,'."'setparms'".')">'.&mt('Modify [_1]-only settings',$dctitle).'</a>'."\n". |
&hidden_form_elements(). |
&hidden_form_elements(). |
'</form>'); |
'</form>'); |
} |
} |
|
|
Line 368 all settings except course code, course
|
Line 378 all settings except course code, course
|
} |
} |
unless ($curr_authtype eq '') { |
unless ($curr_authtype eq '') { |
$curr_authfield = $curr_authtype.'arg'; |
$curr_authfield = $curr_authtype.'arg'; |
} |
} |
my $javascript_validations=&Apache::londropadd::javascript_validations('modifycourse',$krbdefdom,$curr_authtype,$curr_authfield); |
my $javascript_validations=&Apache::lonuserutils::javascript_validations('modifycourse',$krbdefdom,$curr_authtype,$curr_authfield); |
my %param = ( formname => 'document.cmod', |
my %param = ( formname => 'document.'.$env{'form.phase'}, |
kerb_def_dom => $krbdefdom, |
kerb_def_dom => $krbdefdom, |
kerb_def_auth => $krbdef, |
kerb_def_auth => $krbdef, |
mode => 'modifycourse', |
mode => 'modifycourse', |
Line 437 all settings except course code, course
|
Line 447 all settings except course code, course
|
my $mainheader = &mt('Course settings modifiable by [_1] only.',$dctitle); |
my $mainheader = &mt('Course settings modifiable by [_1] only.',$dctitle); |
my $hidden_elements = &hidden_form_elements(); |
my $hidden_elements = &hidden_form_elements(); |
$r->print(<<ENDDOCUMENT); |
$r->print(<<ENDDOCUMENT); |
<form action="/adm/modifycourse" method="post" name="setparms"> |
<form action="/adm/modifycourse" method="post" name="$env{'form.phase'}"> |
<h3>$mainheader</h3> |
<h3>$mainheader</h3> |
</p><p> |
</p><p> |
<table width="100%" cellspacing="6" cellpadding="6"> |
<table width="100%" cellspacing="6" cellpadding="6"> |
Line 561 sub modify_course {
|
Line 571 sub modify_course {
|
} |
} |
if ($changeowner == 1 || $changecode == 1) { |
if ($changeowner == 1 || $changecode == 1) { |
my $courseid_entry = &escape($cdom.'_'.$cnum).'='.&escape($description).':'.&escape($env{'form.coursecode'}).':'.&escape($env{'form.courseowner'}).':'.&escape($type); |
my $courseid_entry = &escape($cdom.'_'.$cnum).'='.&escape($description).':'.&escape($env{'form.coursecode'}).':'.&escape($env{'form.courseowner'}).':'.&escape($type); |
&Apache::lonnet::courseidput($cdom,$courseid_entry,&Apache::lonnet::homeserver($cnum,$cdom)); |
my %courseid_entry = ( |
|
$cdom.'_'.$cnum => { |
|
description => $description, |
|
inst_code => $env{'form.coursecode'}, |
|
owner => $env{'form.courseowner'}, |
|
type => $type, |
|
}, |
|
); |
|
&Apache::lonnet::courseidput($cdom,\%courseid_entry, |
|
&Apache::lonnet::homeserver($cnum,$cdom),'notime'); |
} |
} |
|
|
foreach my $param (@modifiable_params) { |
foreach my $param (@modifiable_params) { |
if ($currattr{$param} eq $newattr{$param}) { |
if ($currattr{$param} eq $newattr{$param}) { |
push(@nochanges,$param); |
push(@nochanges,$param); |
Line 573 sub modify_course {
|
Line 591 sub modify_course {
|
push(@changes,$param); |
push(@changes,$param); |
} |
} |
} |
} |
|
|
if (@changes > 0) { |
if (@changes > 0) { |
$chgresponse = &mt("The following automated enrollment parameters have been changed:<br/><ul>"); |
$chgresponse = &mt("The following automated enrollment parameters have been changed:<br/><ul>"); |
} |
} |
if (@nochanges > 0) { |
if (@nochanges > 0) { |
$nochgresponse = &mt("The following automated enrollment parameters remain unchanged:<br/><ul>"); |
$nochgresponse = &mt("The following automated enrollment parameters 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); |
if ($putreply !~ /^ok$/) { |
if ($putreply !~ /^ok$/) { |
$response = &mt("There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>"); |
$response = &mt("There was a problem processing your requested changes. The automated enrollment settings for this course have been left unchanged.<br/>").&mt('Error: ').$putreply; |
} else { |
} else { |
foreach my $attr (@modifiable_params) { |
foreach my $attr (@modifiable_params) { |
if (grep/^$attr$/,@changes) { |
if (grep/^$attr$/,@changes) { |
Line 781 function verify_quota(formname) {
|
Line 798 function verify_quota(formname) {
|
</script> |
</script> |
ENDSCRIPT |
ENDSCRIPT |
} |
} |
|
my $starthash; |
|
if ($env{'form.phase'} eq 'ccrole') { |
|
$starthash = { |
|
add_entries => {'onload' => "javascript:document.ccrole.submit();"}, |
|
}; |
|
} |
$r->print(&Apache::loncommon::start_page('View/Modify Course Settings', |
$r->print(&Apache::loncommon::start_page('View/Modify Course Settings', |
$js)); |
$js,$starthash)); |
my $bread_text = "View/Modify Courses"; |
my $bread_text = "View/Modify Courses"; |
if ($cdesc ne '') { |
if ($cdesc ne '') { |
$bread_text = "Course Settings: $cdesc"; |
$bread_text = "Course Settings: $cdesc"; |
Line 800 sub print_footer {
|
Line 823 sub print_footer {
|
sub check_course { |
sub check_course { |
my ($r,$dom,$domdesc) = @_; |
my ($r,$dom,$domdesc) = @_; |
my ($ok_course,$description,$instcode,$owner); |
my ($ok_course,$description,$instcode,$owner); |
if (defined($env{'form.pickedcourse'})) { |
my %args = ( |
my ($cdom,$cnum) = split(/_/,$env{'form.pickedcourse'}); |
one_time => 1, |
if ($cdom eq $dom) { |
); |
my %courseIDs = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.', |
my %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'}; |
|
if ($cdom eq $dom) { |
|
my $description; |
|
my %courseIDs = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.', |
|
$cnum,undef,undef,'.'); |
|
if (keys(%courseIDs) > 0) { |
|
$ok_course = 'ok'; |
|
my ($instcode,$owner); |
|
if (ref($courseIDs{$cdom.'_'.$cnum}) eq 'HASH') { |
|
$description = $courseIDs{$cdom.'_'.$cnum}{'description'}; |
|
$instcode = $courseIDs{$cdom.'_'.$cnum}{'inst_code'}; |
|
$owner = $courseIDs{$cdom.'_'.$cnum}{'owner'}; |
|
} else { |
($description,$instcode,$owner) = |
($description,$instcode,$owner) = |
split(/:/,$courseIDs{$cdom.'_'.$cnum}); |
split(/:/,$courseIDs{$cdom.'_'.$cnum}); |
$description = &unescape($description); |
|
$instcode = &unescape($instcode); |
|
if ($instcode) { |
|
$description .= " ($instcode)"; |
|
} |
|
} |
} |
|
$description = &unescape($description); |
|
$instcode = &unescape($instcode); |
|
if ($instcode) { |
|
$description .= " ($instcode)"; |
|
} |
|
return ($ok_course,$description); |
} |
} |
} |
} |
|
|
if ($ok_course ne 'ok') { |
|
$r->print('<br/>'.&mt('The LON-CAPA course selected was not a valid course for the [_1] domain',$domdesc)); |
|
} |
|
return ($ok_course,$description); |
|
} |
} |
|
|
sub course_settings_descrip { |
sub course_settings_descrip { |
Line 846 sub course_settings_descrip {
|
Line 877 sub course_settings_descrip {
|
sub hidden_form_elements { |
sub hidden_form_elements { |
my $hidden_elements = |
my $hidden_elements = |
&Apache::lonhtmlcommon::echo_form_input(['gosearch','coursecode', |
&Apache::lonhtmlcommon::echo_form_input(['gosearch','coursecode', |
'numlocalcc','courseowner', |
'prevphase','numlocalcc','courseowner','login','coursequota','intarg', |
'login','coursequota','intarg', 'locarg','krbarg','krbver']); |
'locarg','krbarg','krbver','counter'])."\n". |
|
'<input type="hidden" name="prevphase" value="'.$env{'form.phase'}.'" />'; |
return $hidden_elements; |
return $hidden_elements; |
} |
} |
|
|
Line 867 sub handler {
|
Line 899 sub handler {
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
|
|
my $phase = $env{'form.phase'}; |
my $phase = $env{'form.phase'}; |
&Apache::lonhtmlcommon::add_breadcrumb |
if ($phase eq '') { |
|
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"/adm/modifycourse", |
({href=>"/adm/modifycourse", |
text=>"Course search"}); |
text=>"Course search"}); |
if ($phase eq '') { |
|
&print_course_search_page($r,$dom,$domdesc); |
&print_course_search_page($r,$dom,$domdesc); |
} else { |
} else { |
|
my $firstform = $phase; |
|
if ($phase eq 'courselist') { |
|
$firstform = 'filterpicker'; |
|
} |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"javascript:changePage(document.$phase,'courselist')", |
({href=>"javascript:changePage(document.$firstform,'')", |
|
text=>"Course search"}, |
|
{href=>"javascript:changePage(document.$phase,'courselist')", |
text=>"Choose a course"}); |
text=>"Choose a course"}); |
if ($phase eq 'courselist') { |
if ($phase eq 'courselist') { |
&print_course_selection_page($r,$dom,$domdesc); |
&print_course_selection_page($r,$dom,$domdesc); |
} else { |
} else { |
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>"javascript:changePage(document.$phase,'menu')", |
|
text=>"Pick action"}); |
|
my ($checked,$cdesc) = &check_course($r,$dom,$domdesc); |
my ($checked,$cdesc) = &check_course($r,$dom,$domdesc); |
my $type = $env{'form.type'}; |
my $type = $env{'form.type'}; |
if ($type eq '') { |
if ($type eq '') { |
Line 889 sub handler {
|
Line 924 sub handler {
|
} |
} |
if ($checked eq 'ok') { |
if ($checked eq 'ok') { |
if ($phase eq 'menu') { |
if ($phase eq 'menu') { |
&print_modification_menu($r,$cdesc); |
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>"javascript:changePage(document.$phase,'menu')", |
|
text=>"Pick action"}); |
|
&print_modification_menu($r,$cdesc,$domdesc); |
|
} elsif ($phase eq 'ccrole') { |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>"javascript:changePage(document.$phase,'ccrole')", |
|
text=>"Enter course"}); |
|
&print_ccrole_selected($r,$cdesc,$domdesc); |
} else { |
} else { |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>"javascript:changePage(document.$phase,'menu')", |
|
text=>"Pick action"}); |
my ($cdom,$cnum) = split(/_/,$env{'form.pickedcourse'}); |
my ($cdom,$cnum) = split(/_/,$env{'form.pickedcourse'}); |
if ($phase eq 'setquota') { |
if ($phase eq 'setquota') { |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
Line 926 sub handler {
|
Line 972 sub handler {
|
} |
} |
} |
} |
} else { |
} else { |
$r->print(&mt('The course you selected is not a valid course in this domain')." ($domdesc)"); |
$r->print('<span class="LC_error">'.&mt('The course you selected is not a valid course in this domain')." ($domdesc)".'</span>'); |
} |
} |
} |
} |
} |
} |