version 1.5, 2009/05/17 00:54:38
|
version 1.11, 2010/01/27 13:08:01
|
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 165 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 172 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 187 sub make_changes {
|
Line 212 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, |
my $message = &Apache::courseprefs::store_changes($dom,$confname,$prefs_order,\@actions, |
$prefs,$values,\%changes)); |
$prefs,$values,\%changes,$crstype); |
|
$r->print(&Apache::loncommon::confirmwrapper($message)); |
} else { |
} else { |
$r->print(&mt('No changes made to course configuration.')); |
if ($crstype eq 'Community') { |
|
$r->print(&Apache::loncommon::confirmwrapper(&mt("No changes made to community configuration."))); |
|
} else { |
|
$r->print(&Apache::loncommon::confirmwrapper(&mt("No changes made to course configuration."))); |
|
} |
} |
} |
if (keys(%disallowed) > 0) { |
if (keys(%disallowed) > 0) { |
$r->print('<p>'); |
$r->print('<p>'); |
Line 198 sub make_changes {
|
Line 228 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 216 sub make_changes {
|
Line 246 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 238 sub display_settings {
|
Line 268 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 272 sub display_settings {
|
Line 302 sub display_settings {
|
} else { |
} else { |
$colend = @items; |
$colend = @items; |
} |
} |
$r->print('<p><table class="LC_double_column"><tr><td class="LC_left_col">'); for (my $i=0; $i<$colend; $i++) { |
if ($context ne 'course') { |
|
$r->print('<p><table class="LC_double_column"><tr><td class="LC_left_col">'); |
|
} |
|
else { |
|
$r->print('<div id="prefs" style="max-width:900px;margin: 10px auto 10px auto;">'); |
|
} |
|
for (my $i=0; $i<$colend; $i++) { |
$r->print($output{$items[$i]}); |
$r->print($output{$items[$i]}); |
} |
} |
$r->print('</td><td></td><td class="LC_right_col">'); |
if ($context ne 'course') { |
|
$r->print('</td><td></td><td class="LC_right_col">'); |
|
} |
if ($colend < @items) { |
if ($colend < @items) { |
for (my $i=$colend; $i<@items; $i++) { |
for (my $i=$colend; $i<@items; $i++) { |
$r->print($output{$items[$i]}); |
$r->print($output{$items[$i]}); |
} |
} |
} |
} |
$r->print('</td></tr></table></p>'); |
if ($context ne 'course') { |
$r->print(&print_footer($r,$phase,'process','Save',\@actions)); |
$r->print('</td></tr></table></p>'); |
|
} |
|
else { |
|
$r->print('</div>'); |
|
} |
|
$r->print(&print_footer($r,$phase,'process','Save Changes',\@actions)); |
} else { |
} else { |
$r->print('<input type="hidden" name="phase" value="" />'. |
$r->print('<input type="hidden" name="phase" value="" />'. |
'<input type="hidden" name="numcols" value="'. |
'<input type="hidden" name="numcols" value="'. |
Line 292 sub display_settings {
|
Line 335 sub display_settings {
|
} |
} |
$r->print('</form>'); |
$r->print('</form>'); |
} |
} |
|
if ($context eq 'course') { |
|
$r->print(' |
|
<script type="text/javascript"> |
|
$(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("<span class=\'LC_advanced_toggle\'><input type=\"checkbox\"/>Show advanced options</span>"); |
|
}); |
|
$(".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"); |
|
} |
|
}); |
|
} |
|
}); |
|
</script> |
|
'); |
|
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
Line 305 sub display_choices {
|
Line 376 sub display_choices {
|
&print_header($r,$phase,$context); |
&print_header($r,$phase,$context); |
$r->print('<h3>'.&mt('Settings 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). |