version 1.4, 2009/05/12 21:20:42
|
version 1.8, 2009/11/23 21:45:18
|
Line 38 use Apache::lonlocal;
|
Line 38 use Apache::lonlocal;
|
|
|
sub print_header { |
sub print_header { |
my ($r,$phase,$context,$jscript) = @_; |
my ($r,$phase,$context,$jscript) = @_; |
my ($pagetitle,$brcrumtitle,$action); |
my ($pagetitle,$brcrumtitle,$action,$call_category_check); |
if ($context eq 'domain') { |
if ($context eq 'domain') { |
($pagetitle, $brcrumtitle) = ('View/Modify Domain Settings','Domain Settings'); |
($pagetitle, $brcrumtitle) = ('View/Modify Domain Settings','Domain Settings'); |
$action = '/adm/domainprefs'; |
$action = '/adm/domainprefs'; |
|
if ($phase eq 'display') { |
|
my @actions = &Apache::loncommon::get_env_multiple('form.actions'); |
|
if (grep(/^coursecategories$/,@actions)) { |
|
$call_category_check = qq| |
|
if (formname == document.display) { |
|
if (!categoryCheck(formname)) { |
|
return; |
|
} |
|
} |
|
|; |
|
} |
|
} |
} else { |
} else { |
($pagetitle, $brcrumtitle) = ('Course Configuration','Course Configuration'); |
if (&Apache::loncommon::course_type() eq 'Community') { |
|
($pagetitle,$brcrumtitle) = ('Community Configuration','Community Configuration'); |
|
} else { |
|
($pagetitle,$brcrumtitle) = ('Course Configuration','Course Configuration'); |
|
} |
$action = '/adm/courseprefs'; |
$action = '/adm/courseprefs'; |
} |
} |
my $alert = &mt('You must select at least one functionality type to display.'); |
my $alert = &mt('You must select at least one functionality type to display.'); |
my $js = ' |
my $js = ' |
<script type="text/javascript"> |
<script type="text/javascript"> |
|
// <![CDATA[ |
|
|
function changePage(formname,newphase) { |
function changePage(formname,newphase) { |
formname.phase.value = newphase; |
formname.phase.value = newphase; |
numchecked = 0; |
numchecked = 0; |
Line 71 function changePage(formname,newphase) {
|
Line 89 function changePage(formname,newphase) {
|
return; |
return; |
} |
} |
} |
} |
|
'.$call_category_check.' |
formname.submit(); |
formname.submit(); |
}'."\n"; |
}'."\n"; |
if ($phase eq 'pickactions') { |
if ($phase eq 'pickactions') { |
Line 81 function changePage(formname,newphase) {
|
Line 100 function changePage(formname,newphase) {
|
$js .= &color_pick_js()."\n"; |
$js .= &color_pick_js()."\n"; |
} |
} |
$js .= &Apache::loncommon::viewport_size_js().' |
$js .= &Apache::loncommon::viewport_size_js().' |
|
|
|
// ]]> |
</script> |
</script> |
'; |
'; |
if ($jscript) { |
if ($jscript) { |
Line 124 sub print_footer {
|
Line 145 sub print_footer {
|
$env{'form.width'}.'" />'. |
$env{'form.width'}.'" />'. |
'<input type="hidden" name="height" value="'. |
'<input type="hidden" name="height" value="'. |
$env{'form.height'}.'" />'); |
$env{'form.height'}.'" />'); |
|
if (defined($env{'form.origin'})) { |
|
$r->print('<input type="hidden" name="origin" value="'.$env{'form.origin'}.'" />'."\n"); |
|
} |
if (($phase eq 'display') || ($phase eq 'process')) { |
if (($phase eq 'display') || ($phase eq 'process')) { |
if (ref($actions) eq 'ARRAY') { |
if (ref($actions) eq 'ARRAY') { |
foreach my $item (@{$actions}) { |
foreach my $item (@{$actions}) { |
Line 162 sub make_changes {
|
Line 186 sub make_changes {
|
{href=>"javascript:changePage(document.$phase,'$phase')", |
{href=>"javascript:changePage(document.$phase,'$phase')", |
text=>"Updated"}); |
text=>"Updated"}); |
&print_header($r,$phase,$context); |
&print_header($r,$phase,$context); |
|
my $crstype; |
|
if ($context eq 'course') { |
|
$crstype = &Apache::loncommon::course_type(); |
|
} |
if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH') && |
if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH') && |
(ref($prefs) eq 'HASH')) { |
(ref($prefs) eq 'HASH')) { |
foreach my $item (@{$prefs_order}) { |
foreach my $item (@{$prefs_order}) { |
Line 169 sub make_changes {
|
Line 197 sub make_changes {
|
if ($context eq 'domain') { |
if ($context eq 'domain') { |
$r->print('<h3>'.&mt($prefs->{$item}{'text'}).'</h3>'. |
$r->print('<h3>'.&mt($prefs->{$item}{'text'}).'</h3>'. |
&Apache::domainprefs::process_changes($r,$dom, |
&Apache::domainprefs::process_changes($r,$dom, |
$confname,$item,$roles,$values,)); |
$confname,$item,$roles,$values)); |
} else { |
} else { |
$changes{$item} = {}; |
$changes{$item} = {}; |
&Apache::courseprefs::process_changes($dom,$item,$values, |
&Apache::courseprefs::process_changes($dom,$item,$values, |
$prefs->{$item},$changes{$item}, |
$prefs->{$item},$changes{$item}, |
$allitems,\%disallowed); |
$allitems,\%disallowed,$crstype); |
if (keys(%{$changes{$item}}) > 0) { |
if (keys(%{$changes{$item}}) > 0) { |
$numchanged ++; |
$numchanged ++; |
} |
} |
Line 185 sub make_changes {
|
Line 213 sub make_changes {
|
if ($context eq 'course') { |
if ($context eq 'course') { |
if ($numchanged) { |
if ($numchanged) { |
$r->print(&Apache::courseprefs::store_changes($dom,$confname,$prefs_order,\@actions, |
$r->print(&Apache::courseprefs::store_changes($dom,$confname,$prefs_order,\@actions, |
$prefs,$values,\%changes)); |
$prefs,$values,\%changes,$crstype)); |
} else { |
} else { |
$r->print(&mt('No changes made to course configuration.')); |
if ($crstype eq 'Community') { |
|
$r->print(&mt("No changes made to community configuration.")); |
|
} else { |
|
$r->print(&mt("No changes made to course configuration.")); |
|
} |
} |
} |
if (keys(%disallowed) > 0) { |
if (keys(%disallowed) > 0) { |
$r->print('<p>'); |
$r->print('<p>'); |
Line 195 sub make_changes {
|
Line 227 sub make_changes {
|
if (ref($disallowed{$item}) eq 'HASH') { |
if (ref($disallowed{$item}) eq 'HASH') { |
if (keys(%{$disallowed{$item}}) > 0) { |
if (keys(%{$disallowed{$item}}) > 0) { |
$r->print(&Apache::courseprefs::display_disallowed($item,$disallowed{$item}, |
$r->print(&Apache::courseprefs::display_disallowed($item,$disallowed{$item}, |
$prefs)); |
$prefs,$crstype)); |
} |
} |
} |
} |
} |
} |
Line 213 sub make_changes {
|
Line 245 sub make_changes {
|
|
|
sub display_settings { |
sub display_settings { |
my ($r,$dom,$phase,$context,$prefs_order,$prefs,$values,$confname,$jscript, |
my ($r,$dom,$phase,$context,$prefs_order,$prefs,$values,$confname,$jscript, |
$allitems) = @_; |
$allitems,$crstype) = @_; |
my %brcrumtext = &get_crumb_text(); |
my %brcrumtext = &get_crumb_text(); |
my @actions = &Apache::loncommon::get_env_multiple('form.actions'); |
my @actions = &Apache::loncommon::get_env_multiple('form.actions'); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
Line 235 sub display_settings {
|
Line 267 sub display_settings {
|
} else { |
} else { |
($output{$item},$rowtotal{$item}) = |
($output{$item},$rowtotal{$item}) = |
&Apache::courseprefs::print_config_box($r,$dom,$phase, |
&Apache::courseprefs::print_config_box($r,$dom,$phase, |
$item,$prefs->{$item},$values,$allitems); |
$item,$prefs->{$item},$values,$allitems,$crstype); |
} |
} |
$rowsum += $rowtotal{$item}; |
$rowsum += $rowtotal{$item}; |
} |
} |
Line 300 sub display_choices {
|
Line 332 sub display_choices {
|
} |
} |
my %helphash; |
my %helphash; |
&print_header($r,$phase,$context); |
&print_header($r,$phase,$context); |
$r->print('<h3>'.&mt('Functionality to display/modify').'</h3>'); |
$r->print('<h3>'.&mt('Settings to display/modify').'</h3>'); |
$r->print('<script type="text/javascript">'."\n". |
$r->print('<script type="text/javascript">'."\n". |
|
'// <![CDATA['."\n". |
&Apache::loncommon::check_uncheck_jscript()."\n". |
&Apache::loncommon::check_uncheck_jscript()."\n". |
|
'// ]]>'."\n". |
'</script>'."\n".'<p><input type="button" value="'.&mt('check all').'" '. |
'</script>'."\n".'<p><input type="button" value="'.&mt('check all').'" '. |
'onclick="javascript:checkAll(document.pickactions.actions)"'. |
'onclick="javascript:checkAll(document.pickactions.actions)"'. |
' />'.(' 'x2). |
' />'.(' 'x2). |