--- loncom/interface/lonconfigsettings.pm 2009/10/29 14:57:18 1.7 +++ loncom/interface/lonconfigsettings.pm 2010/01/27 13:08:01 1.11 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: lonconfigsettings.pm,v 1.7 2009/10/29 14:57:18 raeburn Exp $ +# $Id: lonconfigsettings.pm,v 1.11 2010/01/27 13:08:01 wenzelju Exp $ # # Copyright Michigan State University Board of Trustees # @@ -38,10 +38,22 @@ use Apache::lonlocal; sub print_header { my ($r,$phase,$context,$jscript) = @_; - my ($pagetitle,$brcrumtitle,$action); + my ($pagetitle,$brcrumtitle,$action,$call_category_check); if ($context eq 'domain') { ($pagetitle, $brcrumtitle) = ('View/Modify Domain Settings','Domain Settings'); $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 { if (&Apache::loncommon::course_type() eq 'Community') { ($pagetitle,$brcrumtitle) = ('Community Configuration','Community Configuration'); @@ -77,6 +89,7 @@ function changePage(formname,newphase) { return; } } + '.$call_category_check.' formname.submit(); }'."\n"; if ($phase eq 'pickactions') { @@ -199,13 +212,14 @@ sub make_changes { } if ($context eq 'course') { if ($numchanged) { - $r->print(&Apache::courseprefs::store_changes($dom,$confname,$prefs_order,\@actions, - $prefs,$values,\%changes,$crstype)); + my $message = &Apache::courseprefs::store_changes($dom,$confname,$prefs_order,\@actions, + $prefs,$values,\%changes,$crstype); + $r->print(&Apache::loncommon::confirmwrapper($message)); } else { if ($crstype eq 'Community') { - $r->print(&mt("No changes made to community configuration.")); + $r->print(&Apache::loncommon::confirmwrapper(&mt("No changes made to community configuration."))); } else { - $r->print(&mt("No changes made to course configuration.")); + $r->print(&Apache::loncommon::confirmwrapper(&mt("No changes made to course configuration."))); } } if (keys(%disallowed) > 0) { @@ -288,17 +302,30 @@ sub display_settings { } else { $colend = @items; } - $r->print('

'); for (my $i=0; $i<$colend; $i++) { + if ($context ne 'course') { + $r->print('

'); + } + else { + $r->print('
'); + } + for (my $i=0; $i<$colend; $i++) { $r->print($output{$items[$i]}); } - $r->print('
'); + if ($context ne 'course') { + $r->print(''); + } if ($colend < @items) { for (my $i=$colend; $i<@items; $i++) { $r->print($output{$items[$i]}); } } - $r->print('

'); - $r->print(&print_footer($r,$phase,'process','Save',\@actions)); + if ($context ne 'course') { + $r->print('

'); + } + else { + $r->print(''); + } + $r->print(&print_footer($r,$phase,'process','Save Changes',\@actions)); } else { $r->print(''. ' + $(document).ready(function(){ + $("#prefs").accordion({ + autoHeight: false + }); + if ($(".LC_nested tr.advanced").get(0)) { + $(".LC_nested tr.advanced").each(function() { + $(this).hide(); + p = $(this).parents("div.ui-accordion-content") + if (p.find(".LC_advanced_toggle").length) { + return; + } + p.prepend("Show advanced options"); + }); + $(".LC_advanced_toggle input").change(function() { + if($(this).is(":checked")) { + $(this).parents("div.ui-accordion-content").find("tr.advanced").fadeIn("normal"); + } else { + $(this).parents("div.ui-accordion-content").find("tr.advanced").fadeOut("normal"); + } + }); + } + }); + +'); + } $r->print(&Apache::loncommon::end_page()); return; }