--- loncom/interface/lonconfigsettings.pm 2010/11/19 13:09:36 1.8.2.4
+++ loncom/interface/lonconfigsettings.pm 2013/09/10 01:23:45 1.21.4.3
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: lonconfigsettings.pm,v 1.8.2.4 2010/11/19 13:09:36 raeburn Exp $
+# $Id: lonconfigsettings.pm,v 1.21.4.3 2013/09/10 01:23:45 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,8 +37,8 @@ use Apache::lonhtmlcommon();
use Apache::lonlocal;
sub print_header {
- my ($r,$phase,$context,$jscript) = @_;
- my ($pagetitle,$brcrumtitle,$action,$call_category_check);
+ my ($r,$phase,$context,$jscript,$container) = @_;
+ my ($pagetitle,$brcrumtitle,$action,$call_category_check,$crstype);
if ($context eq 'domain') {
($pagetitle, $brcrumtitle) = ('View/Modify Domain Settings','View/Modify Domain Settings');
$action = '/adm/domainprefs';
@@ -55,7 +55,8 @@ sub print_header {
}
}
} else {
- if (&Apache::loncommon::course_type() eq 'Community') {
+ $crstype = &Apache::loncommon::course_type();
+ if ($crstype eq 'Community') {
($pagetitle,$brcrumtitle) = ('Community Configuration','Community Configuration');
} else {
($pagetitle,$brcrumtitle) = ('Course Configuration','Course Configuration');
@@ -93,9 +94,11 @@ function changePage(formname,newphase) {
formname.submit();
}'."\n";
if ($phase eq 'pickactions') {
+ $js .= &Apache::lonhtmlcommon::color_picker();
$js .=
&Apache::lonhtmlcommon::set_form_elements({actions => 'checkbox'})."\n";
} elsif ($phase eq 'display') {
+ $js .= &Apache::lonhtmlcommon::color_picker();
$js .= &color_pick_js()."\n";
}
$js .= &Apache::loncommon::viewport_size_js().'
@@ -132,7 +135,7 @@ $jscript
}
sub print_footer {
- my ($r,$phase,$newphase,$button_text,$actions) = @_;
+ my ($r,$phase,$newphase,$button_text,$actions,$container) = @_;
$button_text = &mt($button_text);
$r->print('');
if (defined($env{'form.origin'})) {
@@ -147,7 +150,9 @@ sub print_footer {
}
my $dest='"javascript:changePage(document.'.$phase.','."'$newphase'".')"';
if ($phase eq 'process') {
- $r->print('
'.$button_text.'
');
+ $r->print(
+ &Apache::lonhtmlcommon::actionbox(
+ [''.$button_text.'']));
} else {
my $onclick;
if ($phase eq 'display') {
@@ -159,13 +164,14 @@ sub print_footer {
$button_text.'" onclick='.$onclick.' />');
}
if ($phase eq 'process') {
- $r->print(''.&Apache::loncommon::end_page());
+ $r->print('');
+ $r->print(&Apache::loncommon::end_page());
}
return;
}
sub make_changes {
- my ($r,$dom,$phase,$context,$prefs_order,$prefs,$values,$confname,$roles,$allitems) = @_;
+ my ($r,$dom,$phase,$context,$prefs_order,$prefs,$values,$confname,$roles,$allitems,$container) = @_;
my %brcrumtext = &get_crumb_text();
my @actions = &Apache::loncommon::get_env_multiple('form.actions');
my ($numchanged,%changes,%disallowed);
@@ -174,8 +180,8 @@ sub make_changes {
text=>$brcrumtext{$context}},
{href=>"javascript:changePage(document.$phase,'$phase')",
text=>"Updated"});
- &print_header($r,$phase,$context);
- my $crstype;
+ &print_header($r,$phase,$context,undef,$container);
+ my ($crstype,$lastact);
if ($context eq 'course') {
$crstype = &Apache::loncommon::course_type();
}
@@ -186,7 +192,7 @@ sub make_changes {
if ($context eq 'domain') {
$r->print(''.&mt($prefs->{$item}{'text'}).'
'.
&Apache::domainprefs::process_changes($r,$dom,
- $confname,$item,$roles,$values));
+ $confname,$item,$roles,$values,\$lastact));
} else {
$changes{$item} = {};
&Apache::courseprefs::process_changes($dom,$item,$values,
@@ -229,19 +235,20 @@ sub make_changes {
if ($context eq 'course') {
$footer_text = 'Back to display/edit settings';
}
- &print_footer($r,$phase,'display',$footer_text,\@actions);
+ &print_footer($r,$phase,'display',$footer_text,\@actions,$container);
$r->print('');
+ return $lastact;
}
sub display_settings {
my ($r,$dom,$phase,$context,$prefs_order,$prefs,$values,$confname,$jscript,
- $allitems,$crstype) = @_;
+ $allitems,$crstype,$container) = @_;
my %brcrumtext = &get_crumb_text();
my @actions = &Apache::loncommon::get_env_multiple('form.actions');
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"javascript:changePage(document.$phase,'display')",
text=>"Display/Edit Settings"});
- &print_header($r,$phase,$context,$jscript);
+ &print_header($r,$phase,$context,$jscript,$container);
my $divwidth = 900;
if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH') && (ref($values) eq 'HASH')) {
if (@actions > 0) {
@@ -251,6 +258,13 @@ sub display_settings {
if (grep(/^\Q$item\E$/,@actions)) {
push(@items,$item);
if ($context eq 'domain') {
+ if ($item eq 'usersessions') {
+ $r->print(''."\n");
+ }
($output{$item},$rowtotal{$item}) =
&Apache::domainprefs::print_config_box($r,$dom,$confname,
$phase,$item,$prefs->{$item},$values->{$item});
@@ -267,7 +281,7 @@ sub display_settings {
$r->print($output{$items[$i]});
}
$r->print('');
- $r->print(&print_footer($r,$phase,'process','Save',\@actions));
+ $r->print(&print_footer($r,$phase,'process','Save Changes',\@actions,$container));
} else {
$r->print(''.
''.&mt('No settings chosen').
@@ -280,25 +294,25 @@ sub display_settings {
}
sub display_choices {
- my ($r,$phase,$context,$prefs_order,$prefs) = @_;
+ my ($r,$phase,$context,$prefs_order,$prefs,$container) = @_;
if ($phase eq '') {
$phase = 'pickactions';
}
my %helphash;
- &print_header($r,$phase,$context);
+ &print_header($r,$phase,$context,undef,$container);
$r->print(''."\n");
- $r->print(''.&mt('Settings to display/modify').'
'."\n".
+ $r->print(''.&mt('Settings to display/modify').'
'.
''.(' 'x2).
''.
- '
'."\n".
- '');
+ "\n".
+ '
');
my ($numitems,$maxincol,$firstthird,$secondthird,$seconddiv,$thirddiv,$count);
if (ref($prefs_order) eq 'ARRAY') {
$numitems = @{$prefs_order};
@@ -313,9 +327,10 @@ sub display_choices {
$count = 0;
if ((ref($prefs_order) eq 'ARRAY') && (ref($prefs) eq 'HASH')) {
foreach my $item (@{$prefs_order}) {
- $r->print(&Apache::loncommon::help_open_topic($prefs->{$item}->{'help'}).
+ $r->print('
'.
+ &Apache::loncommon::help_open_topic($prefs->{$item}->{'help'}).
'
');
+ '" /> '.&mt($prefs->{$item}->{'text'}).'
');
$count ++;
if ((!$seconddiv) && ($count >= $firstthird)) {
$r->print(''."\n".''."\n");
@@ -328,7 +343,7 @@ sub display_choices {
}
$r->print('
');
}
- $r->print(&print_footer($r,$phase,'display','Display'));
+ $r->print(&print_footer($r,$phase,'display','Display',undef,$container));
$r->print('');
$r->print(&Apache::loncommon::end_page());
return;
@@ -337,15 +352,11 @@ sub display_choices {
sub color_pick_js {
my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
my $output = <<"ENDCOL";
- function pclose() {
- parmwin=window.open("/adm/rat/empty.html","LONCAPAparms","height=350,width=350,scrollbars=no,menubar=no");
- parmwin.close();
- }
$pjump_def
function psub() {
- pclose();
+ modalWindow.close();
if (document.parmform.pres_marker.value!='') {
if (document.parmform.pres_type.value!='') {
eval('document.display.'+