version 1.54, 2008/05/31 23:37:46
|
version 1.58, 2008/06/30 03:47:12
|
Line 62 sub handler {
|
Line 62 sub handler {
|
} |
} |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['phase']); |
['phase','actions']); |
my $phase = 'pickactions'; |
my $phase = 'pickactions'; |
if ( exists($env{'form.phase'}) ) { |
if ( exists($env{'form.phase'}) ) { |
$phase = $env{'form.phase'}; |
$phase = $env{'form.phase'}; |
Line 162 sub handler {
|
Line 162 sub handler {
|
'coursecategories' => |
'coursecategories' => |
{ text => 'Cataloging of courses', |
{ text => 'Cataloging of courses', |
help => 'Domain_Course_Catalog', |
help => 'Domain_Course_Catalog', |
header => [ {col1 => 'Categories', |
header => [{col1 => 'Category settings', |
col2 => '', |
col2 => '',}, |
}], |
{col1 => 'Categories', |
|
col2 => '', |
|
}], |
} |
} |
); |
); |
my @roles = ('student','coordinator','author','admin'); |
my @roles = ('student','coordinator','author','admin'); |
Line 300 sub handler {
|
Line 302 sub handler {
|
$r->print('<h3>'.&mt('Functionality to display/modify').'</h3>'); |
$r->print('<h3>'.&mt('Functionality to display/modify').'</h3>'); |
$r->print('<script type="text/javascript">'."\n". |
$r->print('<script type="text/javascript">'."\n". |
&Apache::loncommon::check_uncheck_jscript()."\n". |
&Apache::loncommon::check_uncheck_jscript()."\n". |
'</script>'."\n".'<p><input type="button" value="check all" '. |
'</script>'."\n".'<p><input type="button" value="'.&mt('check all').'" '. |
'onclick="javascript:checkAll(document.pickactions.actions)"'. |
'onclick="javascript:checkAll(document.pickactions.actions)"'. |
' /> '. |
' /> '. |
'<input type="button" value="uncheck all" '. |
'<input type="button" value="'.&mt('uncheck all').'" '. |
'onclick="javascript:uncheckAll(document.pickactions.actions)"'. |
'onclick="javascript:uncheckAll(document.pickactions.actions)"'. |
' /></p><div class="LC_left_float">'); |
' /></p><div class="LC_left_float">'); |
my ($numitems,$midpoint,$seconddiv,$count); |
my ($numitems,$midpoint,$seconddiv,$count); |
Line 314 sub handler {
|
Line 316 sub handler {
|
} |
} |
$count = 0; |
$count = 0; |
foreach my $item (@prefs_order) { |
foreach my $item (@prefs_order) { |
$r->print('<h4><label><input type="checkbox" name="actions" value="'.$item.'" /> '.$prefs{$item}->{'text'}.'</label></h4>'); |
$r->print('<h4><label><input type="checkbox" name="actions" value="'.$item.'" /> '.&mt($prefs{$item}->{'text'}).'</label></h4>'); |
$count ++; |
$count ++; |
if ((!$seconddiv) && ($count >= $midpoint)) { |
if ((!$seconddiv) && ($count >= $midpoint)) { |
$r->print('</div>'."\n".'<div class="LC_left_float">'."\n"); |
$r->print('</div>'."\n".'<div class="LC_left_float">'."\n"); |
Line 386 sub print_config_box {
|
Line 388 sub print_config_box {
|
# </tr>'); |
# </tr>'); |
$rowtotal ++; |
$rowtotal ++; |
if (($action eq 'autoupdate') || ($action eq 'rolecolors') || |
if (($action eq 'autoupdate') || ($action eq 'rolecolors') || |
($action eq 'usercreation') || ($action eq 'usermodification')) { |
($action eq 'usercreation') || ($action eq 'usermodification') || |
|
($action eq 'coursecategories')) { |
my $colspan = ($action eq 'rolecolors')?' colspan="2"':''; |
my $colspan = ($action eq 'rolecolors')?' colspan="2"':''; |
$output .= ' |
$output .= ' |
<tr> |
<tr> |
Line 403 sub print_config_box {
|
Line 406 sub print_config_box {
|
$output .= &print_usercreation('top',$dom,$settings,\$rowtotal); |
$output .= &print_usercreation('top',$dom,$settings,\$rowtotal); |
} elsif ($action eq 'usermodification') { |
} elsif ($action eq 'usermodification') { |
$output .= &print_usermodification('top',$dom,$settings,\$rowtotal); |
$output .= &print_usermodification('top',$dom,$settings,\$rowtotal); |
|
} elsif ($action eq 'coursecategories') { |
|
$output .= &print_coursecategories('top',$dom,$item,$settings,\$rowtotal); |
} else { |
} else { |
$output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal); |
$output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal); |
} |
} |
Line 414 sub print_config_box {
|
Line 419 sub print_config_box {
|
<td> |
<td> |
<table class="LC_nested"> |
<table class="LC_nested"> |
<tr class="LC_info_row"> |
<tr class="LC_info_row"> |
<td class="LC_left_item"'.$colspan.'>'.$item->{'header'}->[1]->{'col1'}.'</td> |
<td class="LC_left_item"'.$colspan.'>'.$item->{'header'}->[1]->{'col1'}.'</td>'; |
<td class="LC_right_item">'.$item->{'header'}->[1]->{'col2'}.'</td> |
my $colspan = ($action eq 'coursecategories')?' colspan="2"':''; |
|
$output .= ' |
|
<td class="LC_right_item"'.$colspan.'>'.$item->{'header'}->[1]->{'col2'}.'</td> |
</tr>'; |
</tr>'; |
$rowtotal ++; |
$rowtotal ++; |
if ($action eq 'autoupdate') { |
if ($action eq 'autoupdate') { |
Line 435 sub print_config_box {
|
Line 442 sub print_config_box {
|
$rowtotal ++; |
$rowtotal ++; |
} elsif ($action eq 'usermodification') { |
} elsif ($action eq 'usermodification') { |
$output .= &print_usermodification('bottom',$dom,$settings,\$rowtotal); |
$output .= &print_usermodification('bottom',$dom,$settings,\$rowtotal); |
|
} elsif ($action eq 'coursecategories') { |
|
$output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal); |
} else { |
} else { |
$output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).' |
$output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).' |
</table> |
</table> |
Line 474 sub print_config_box {
|
Line 483 sub print_config_box {
|
$output .= ' |
$output .= ' |
<td class="LC_left_item">'.$item->{'header'}->[0]->{'col1'}.'</td>'; |
<td class="LC_left_item">'.$item->{'header'}->[0]->{'col1'}.'</td>'; |
} |
} |
my $colspan = ($action eq 'coursecategories')?' colspan="2"':''; |
|
$output .= ' |
$output .= ' |
<td class="LC_right_item"'.$colspan.'>'.$item->{'header'}->[0]->{'col2'}.'</td> |
<td class="LC_right_item">'.$item->{'header'}->[0]->{'col2'}.'</td> |
</tr>'; |
</tr>'; |
$rowtotal ++; |
$rowtotal ++; |
if ($action eq 'login') { |
if ($action eq 'login') { |
Line 493 sub print_config_box {
|
Line 501 sub print_config_box {
|
$output .= &print_defaults($dom,\$rowtotal); |
$output .= &print_defaults($dom,\$rowtotal); |
} elsif ($action eq 'scantron') { |
} elsif ($action eq 'scantron') { |
$output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal); |
$output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal); |
} elsif ($action eq 'coursecategories'){ |
|
$output .= &print_coursecategories($dom,$item,$settings,\$rowtotal); |
|
} |
} |
} |
} |
$output .= ' |
$output .= ' |
Line 1961 sub legacy_scantronformat {
|
Line 1967 sub legacy_scantronformat {
|
} |
} |
|
|
sub print_coursecategories { |
sub print_coursecategories { |
my ($dom,$hdritem,$settings,$rowtotal) = @_; |
my ($position,$dom,$hdritem,$settings,$rowtotal) = @_; |
my ($datatable,$css_class); |
my $datatable; |
my $itemcount = 1; |
if ($position eq 'top') { |
if (ref($settings) eq 'HASH') { |
my $toggle_cats_crs = ' '; |
my (@cats,@trails,%allitems,%idx,@jsarray); |
my $toggle_cats_dom = ' checked="checked" '; |
&Apache::loncommon::extract_categories($settings,\@cats,\@trails, |
my $can_cat_crs = ' '; |
\%allitems,\%idx,\@jsarray); |
my $can_cat_dom = ' checked="checked" '; |
my $maxdepth = scalar(@cats); |
if (ref($settings) eq 'HASH') { |
my $colattrib = ''; |
if ($settings->{'togglecats'} eq 'crs') { |
if ($maxdepth > 2) { |
$toggle_cats_crs = $toggle_cats_dom; |
$colattrib = ' colspan="2" '; |
$toggle_cats_dom = ' '; |
} |
} |
my @path; |
if ($settings->{'categorize'} eq 'crs') { |
if (@cats > 0) { |
$can_cat_crs = $can_cat_dom; |
if (ref($cats[0]) eq 'ARRAY') { |
$can_cat_dom = ' '; |
my $numtop = @{$cats[0]}; |
} |
my $maxnum = $numtop; |
} |
if ((!grep(/^instcode$/,@{$cats[0]})) || ($settings->{'instcode::0'} eq '')) { |
my %title = &Apache::lonlocal::texthash ( |
$maxnum ++; |
togglecats => 'Show/Hide a course in the catalog', |
} |
categorize => 'Assign a category to a course', |
my $lastidx; |
); |
for (my $i=0; $i<$numtop; $i++) { |
my %level = &Apache::lonlocal::texthash ( |
my $parent = $cats[0][$i]; |
dom => 'Set in "Modify Course" (Domain)', |
|
crs => 'Set in "Parameters" (Course)', |
|
); |
|
$datatable = '<tr class="LC_odd_row">'. |
|
'<td>'.$title{'togglecats'}.'</td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="togglecats"'. |
|
$toggle_cats_dom.' value="dom" />'.$level{'dom'}.'</label> '. |
|
'<label><input type="radio" name="togglecats"'. |
|
$toggle_cats_crs.' value="crs" />'.$level{'crs'}.'</label></span></td>'. |
|
'</tr><tr>'. |
|
'<td>'.$title{'categorize'}.'</td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak">'. |
|
'<label><input type="radio" name="categorize"'. |
|
$can_cat_dom.' value="dom" />'.$level{'dom'}.'</label> '. |
|
'<label><input type="radio" name="categorize"'. |
|
$can_cat_crs.'value="crs" />'.$level{'crs'}.'</label></span></td>'. |
|
'</tr>'; |
|
$$rowtotal += 2; |
|
} else { |
|
my $css_class; |
|
my $itemcount = 1; |
|
my $cathash; |
|
if (ref($settings) eq 'HASH') { |
|
$cathash = $settings->{'cats'}; |
|
} |
|
if (ref($cathash) eq 'HASH') { |
|
my (@cats,@trails,%allitems,%idx,@jsarray); |
|
&Apache::loncommon::extract_categories($cathash,\@cats,\@trails, |
|
\%allitems,\%idx,\@jsarray); |
|
my $maxdepth = scalar(@cats); |
|
my $colattrib = ''; |
|
if ($maxdepth > 2) { |
|
$colattrib = ' colspan="2" '; |
|
} |
|
my @path; |
|
if (@cats > 0) { |
|
if (ref($cats[0]) eq 'ARRAY') { |
|
my $numtop = @{$cats[0]}; |
|
my $maxnum = $numtop; |
|
if ((!grep(/^instcode$/,@{$cats[0]})) || ($cathash->{'instcode::0'} eq '')) { |
|
$maxnum ++; |
|
} |
|
my $lastidx; |
|
for (my $i=0; $i<$numtop; $i++) { |
|
my $parent = $cats[0][$i]; |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
my $item = &escape($parent).'::0'; |
|
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','$item','$idx{$item}'".');"'; |
|
$lastidx = $idx{$item}; |
|
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
|
.'<select name="'.$item.'"'.$chgstr.'>'; |
|
for (my $k=0; $k<=$maxnum; $k++) { |
|
my $vpos = $k+1; |
|
my $selstr; |
|
if ($k == $i) { |
|
$selstr = ' selected="selected" '; |
|
} |
|
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
|
} |
|
$datatable .= '</select></td><td>'; |
|
if ($parent eq 'instcode') { |
|
$datatable .= '<span class="LC_nobreak">'.&mt('Official courses') |
|
.'</span><br /><span class="LC_nobreak">(' |
|
.&mt('with institutional codes').')</span></td>' |
|
.'<td'.$colattrib.'><span class="LC_nobreak"><label><input type="radio" name="instcode" value="1" checked="checked" />' |
|
.&mt('Display').'</label> ' |
|
.'<label><input type="radio" name="instcode" value="0" />' |
|
.&mt('Do not display').'</label></span></td>'; |
|
} else { |
|
$datatable .= $parent |
|
.' <label><input type="checkbox" name="deletecategory" ' |
|
.'value="'.$item.'" />'.&mt('Delete').'</label></span></td>'; |
|
} |
|
my $depth = 1; |
|
push(@path,$parent); |
|
$datatable .= &build_category_rows($itemcount,\@cats,$depth,$parent,\@path,\%idx); |
|
pop(@path); |
|
$datatable .= '</tr><tr><td colspan="'.$maxdepth.'" class="LC_row_separator"></td></tr>'; |
|
$itemcount ++; |
|
} |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
my $item = &escape($parent).'::0'; |
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','addcategory_pos','$lastidx'".');"'; |
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','$item','$idx{$item}'".');"'; |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak"><select name="addcategory_pos"'.$chgstr.'>'; |
$lastidx = $idx{$item}; |
|
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
|
.'<select name="'.$item.'"'.$chgstr.'>'; |
|
for (my $k=0; $k<=$maxnum; $k++) { |
for (my $k=0; $k<=$maxnum; $k++) { |
my $vpos = $k+1; |
my $vpos = $k+1; |
my $selstr; |
my $selstr; |
if ($k == $i) { |
if ($k == $numtop) { |
$selstr = ' selected="selected" '; |
$selstr = ' selected="selected" '; |
} |
} |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
} |
} |
$datatable .= '</select></td><td>'; |
$datatable .= '</select></span></td><td colspan="2">'.&mt('New:').' ' |
if ($parent eq 'instcode') { |
.'<input type="text" size="20" name="addcategory_name" value="" /></td>' |
$datatable .= '<span class="LC_nobreak">'.&mt('Official courses') |
.'</tr>'."\n"; |
.'</span><br /><span class="LC_nobreak">(' |
|
.&mt('with institutional codes').')</span></td>' |
|
.'<td'.$colattrib.'><span class="LC_nobreak"><label><input type="radio" name="instcode" value="1" checked="checked" />' |
|
.&mt('Display').'</label> ' |
|
.'<label><input type="radio" name="instcode" value="0" />' |
|
.&mt('Do not display').'</label></span></td>'; |
|
} else { |
|
$datatable .= $parent |
|
.' <label><input type="checkbox" name="deletecategory" ' |
|
.'value="'.$item.'" />'.&mt('Delete').'</label></span></td>'; |
|
} |
|
my $depth = 1; |
|
push(@path,$parent); |
|
$datatable .= &build_category_rows($itemcount,\@cats,$depth,$parent,\@path,\%idx); |
|
pop(@path); |
|
$datatable .= '</tr><tr><td colspan="'.$maxdepth.'" class="LC_row_separator"></td></tr>'; |
|
$itemcount ++; |
$itemcount ++; |
} |
if ((!grep(/^instcode$/,@{$cats[0]})) || ($cathash->{'instcode::0'} eq '')) { |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','addcategory_pos','$lastidx'".');"'; |
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','instcode_pos','$lastidx'".');"'; |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak"><select name="addcategory_pos"'.$chgstr.'>'; |
$datatable .= '<tr><td colspan="'.$maxdepth.'" class="LC_row_separator"></td></tr><tr '.$css_class.'><td>'. |
for (my $k=0; $k<=$maxnum; $k++) { |
'<span class="LC_nobreak"><select name="instcode_pos"'.$chgstr.'>'; |
my $vpos = $k+1; |
for (my $k=0; $k<=$maxnum; $k++) { |
my $selstr; |
my $vpos = $k+1; |
if ($k == $numtop) { |
my $selstr; |
$selstr = ' selected="selected" '; |
if ($k == $maxnum) { |
} |
$selstr = ' selected="selected" '; |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
} |
} |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
$datatable .= '</select></span></td><td colspan="2">'.&mt('New:').' ' |
|
.'<input type="text" size="20" name="addcategory_name" value="" /></td>' |
|
.'</tr>'."\n"; |
|
$itemcount ++; |
|
if ((!grep(/^instcode$/,@{$cats[0]})) || ($settings->{'instcode::0'} eq '')) { |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','instcode_pos','$lastidx'".');"'; |
|
$datatable .= '<tr><td colspan="'.$maxdepth.'" class="LC_row_separator"></td></tr><tr '.$css_class.'><td>'. |
|
'<span class="LC_nobreak"><select name="instcode_pos"'.$chgstr.'>'; |
|
for (my $k=0; $k<=$maxnum; $k++) { |
|
my $vpos = $k+1; |
|
my $selstr; |
|
if ($k == $maxnum) { |
|
$selstr = ' selected="selected" '; |
|
} |
} |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
$datatable .= '</select></span></td><td><span class="LC_nobreak">' |
|
.&mt('Official courses').'</span>'.'<br /><span class="LC_nobreak">(' |
|
.&mt('with institutional codes').')</span></td>' |
|
.'<td><span class="LC_nobreak"><label><input type="radio" name="instcode" value="1" />' |
|
.&mt('Display').'</label> ' |
|
.'<label><input type="radio" name="instcode" value="0" checked="checked"/>' |
|
.&mt('Do not display').'</label></span></td></tr>'; |
} |
} |
$datatable .= '</select></span></td><td><span class="LC_nobreak">' |
|
.&mt('Official courses').'</span>'.'<br /><span class="LC_nobreak">(' |
|
.&mt('with institutional codes').')</span></td>' |
|
.'<td><span class="LC_nobreak"><label><input type="radio" name="instcode" value="1" />' |
|
.&mt('Display').'</label> ' |
|
.'<label><input type="radio" name="instcode" value="0" checked="checked"/>' |
|
.&mt('Do not display').'</label></span></td></tr>'; |
|
} |
} |
|
} else { |
|
$datatable .= &initialize_categories($itemcount); |
} |
} |
} else { |
} else { |
$datatable .= &initialize_categories($itemcount); |
$datatable .= '<td class="LC_right_item">'.$hdritem->{'header'}->[0]->{'col2'}.'</td>' |
|
.&initialize_categories($itemcount); |
} |
} |
} else { |
$$rowtotal += $itemcount; |
$datatable .= '<td class="LC_right_item">'.$hdritem->{'header'}->[0]->{'col2'}.'</td>' |
|
.&initialize_categories($itemcount); |
|
} |
} |
$$rowtotal += $itemcount; |
|
return $datatable; |
return $datatable; |
} |
} |
|
|
sub coursecategories_javascript { |
sub coursecategories_javascript { |
my ($settings) = @_; |
my ($settings) = @_; |
my ($output,$jstext); |
my ($output,$jstext,$cathash); |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
|
$cathash = $settings->{'cats'}; |
|
} |
|
if (ref($cathash) eq 'HASH') { |
my (@cats,@jsarray,%idx); |
my (@cats,@jsarray,%idx); |
&Apache::loncommon::gather_categories($settings,\@cats,\%idx,\@jsarray); |
&Apache::loncommon::gather_categories($cathash,\@cats,\%idx,\@jsarray); |
if (@jsarray > 0) { |
if (@jsarray > 0) { |
$jstext = ' var categories = Array('.scalar(@jsarray).');'."\n"; |
$jstext = ' var categories = Array('.scalar(@jsarray).');'."\n"; |
for (my $i=0; $i<@jsarray; $i++) { |
for (my $i=0; $i<@jsarray; $i++) { |
Line 2474 sub modify_login {
|
Line 2529 sub modify_login {
|
'adminmail' => 'off', |
'adminmail' => 'off', |
'newuser' => 'off', |
'newuser' => 'off', |
); |
); |
foreach my $item (@toggles) { |
if (ref($domconfig{'login'}) eq 'HASH') { |
if ($defaultchecked{$item} eq 'on') { |
foreach my $item (@toggles) { |
if (($domconfig{'login'}{$item} eq '0') && |
if ($defaultchecked{$item} eq 'on') { |
($env{'form.'.$item} eq '1')) { |
if (($domconfig{'login'}{$item} eq '0') && |
$changes{$item} = 1; |
($env{'form.'.$item} eq '1')) { |
} elsif (($domconfig{'login'}{$item} eq '' || |
$changes{$item} = 1; |
$domconfig{'login'}{$item} eq '1') && |
} elsif (($domconfig{'login'}{$item} eq '' || |
($env{'form.'.$item} eq '0')) { |
$domconfig{'login'}{$item} eq '1') && |
$changes{$item} = 1; |
($env{'form.'.$item} eq '0')) { |
} |
$changes{$item} = 1; |
} elsif ($defaultchecked{$item} eq 'off') { |
} |
if (($domconfig{'login'}{$item} eq '1') && |
} elsif ($defaultchecked{$item} eq 'off') { |
($env{'form.'.$item} eq '0')) { |
if (($domconfig{'login'}{$item} eq '1') && |
$changes{$item} = 1; |
($env{'form.'.$item} eq '0')) { |
} elsif (($domconfig{'login'}{$item} eq '' || |
$changes{$item} = 1; |
$domconfig{'login'}{$item} eq '0') && |
} elsif (($domconfig{'login'}{$item} eq '' || |
($env{'form.'.$item} eq '1')) { |
$domconfig{'login'}{$item} eq '0') && |
$changes{$item} = 1; |
($env{'form.'.$item} eq '1')) { |
|
$changes{$item} = 1; |
|
} |
} |
} |
} |
} |
} |
if (($domconfig{'login'}{'loginheader'} eq 'text') && |
if (($domconfig{'login'}{'loginheader'} eq 'text') && |
($env{'form.loginheader'} eq 'image')) { |
($env{'form.loginheader'} eq 'image')) { |
$changes{'loginheader'} = 1; |
$changes{'loginheader'} = 1; |
} elsif (($domconfig{'login'}{'loginheader'} eq '' || |
} elsif (($domconfig{'login'}{'loginheader'} eq '' || |
$domconfig{'login'}{'loginheader'} eq 'image') && |
$domconfig{'login'}{'loginheader'} eq 'image') && |
($env{'form.loginheader'} eq 'text')) { |
($env{'form.loginheader'} eq 'text')) { |
$changes{'loginheader'} = 1; |
$changes{'loginheader'} = 1; |
} |
} |
} |
if (keys(%changes) > 0 || $colchgtext) { |
if (keys(%changes) > 0 || $colchgtext) { |
&Apache::loncommon::devalidate_domconfig_cache($dom); |
&Apache::loncommon::devalidate_domconfig_cache($dom); |
Line 2534 sub color_font_choices {
|
Line 2591 sub color_font_choices {
|
img => "Header", |
img => "Header", |
bgs => "Background colors", |
bgs => "Background colors", |
links => "Link colors", |
links => "Link colors", |
|
images => "Images", |
font => "Font color", |
font => "Font color", |
pgbg => "Page", |
pgbg => "Page", |
tabbg => "Header", |
tabbg => "Header", |
Line 2549 sub modify_rolecolors {
|
Line 2607 sub modify_rolecolors {
|
my ($r,$dom,$confname,$roles,%domconfig) = @_; |
my ($r,$dom,$confname,$roles,%domconfig) = @_; |
my ($resulttext,%rolehash); |
my ($resulttext,%rolehash); |
$rolehash{'rolecolors'} = {}; |
$rolehash{'rolecolors'} = {}; |
|
if (ref($domconfig{'rolecolors'}) ne 'HASH') { |
|
if ($domconfig{'rolecolors'} eq '') { |
|
$domconfig{'rolecolors'} = {}; |
|
} |
|
} |
my ($errors,%changes) = &modify_colors($r,$dom,$confname,$roles, |
my ($errors,%changes) = &modify_colors($r,$dom,$confname,$roles, |
$domconfig{'rolecolors'},$rolehash{'rolecolors'}); |
$domconfig{'rolecolors'},$rolehash{'rolecolors'}); |
my $putresult = &Apache::lonnet::put_dom('configuration',\%rolehash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%rolehash, |
Line 3144 sub modify_quotas {
|
Line 3207 sub modify_quotas {
|
} |
} |
foreach my $key (keys(%formhash)) { |
foreach my $key (keys(%formhash)) { |
if ($formhash{$key} ne '') { |
if ($formhash{$key} ne '') { |
if (!exists($domconfig{'quotas'}{$key})) { |
if (ref($domconfig{'quotas'}) eq 'HASH') { |
|
if (!exists($domconfig{'quotas'}{$key})) { |
|
$changes{$key} = 1; |
|
} |
|
} else { |
$changes{$key} = 1; |
$changes{$key} = 1; |
} |
} |
} |
} |
Line 4245 sub modify_scantron {
|
Line 4312 sub modify_scantron {
|
|
|
sub modify_coursecategories { |
sub modify_coursecategories { |
my ($dom,%domconfig) = @_; |
my ($dom,%domconfig) = @_; |
my ($resulttext,%deletions,%reorderings,%needreordering,%adds,$errors); |
my ($resulttext,%deletions,%reorderings,%needreordering,%adds,%changes,$errors, |
|
$cathash); |
my @deletecategory = &Apache::loncommon::get_env_multiple('form.deletecategory'); |
my @deletecategory = &Apache::loncommon::get_env_multiple('form.deletecategory'); |
if (($domconfig{'coursecategories'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) { |
|
push (@deletecategory,'instcode::0'); |
|
} |
|
my (@predelcats,@predeltrails,%predelallitems); |
|
if (ref($domconfig{'coursecategories'}) eq 'HASH') { |
if (ref($domconfig{'coursecategories'}) eq 'HASH') { |
|
$cathash = $domconfig{'coursecategories'}{'cats'}; |
|
if ($domconfig{'coursecategories'}{'togglecats'} ne $env{'form.togglecats'}) { |
|
$changes{'togglecats'} = 1; |
|
$domconfig{'coursecategories'}{'togglecats'} = $env{'form.togglecats'}; |
|
} |
|
if ($domconfig{'coursecategories'}{'categorize'} ne $env{'form.categorize'}) { |
|
$changes{'categorize'} = 1; |
|
$domconfig{'coursecategories'}{'categorize'} = $env{'form.categorize'}; |
|
} |
|
} else { |
|
$changes{'togglecats'} = 1; |
|
$changes{'categorize'} = 1; |
|
$domconfig{'coursecategories'}{'togglecats'} = $env{'form.togglecats'}; |
|
$domconfig{'coursecategories'}{'categorize'} = $env{'form.categorize'}; |
|
} |
|
if (ref($cathash) eq 'HASH') { |
|
if (($domconfig{'coursecategories'}{'cats'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) { |
|
push (@deletecategory,'instcode::0'); |
|
} |
|
} |
|
my (@predelcats,@predeltrails,%predelallitems,%sort_by_deltrail); |
|
if (ref($cathash) eq 'HASH') { |
if (@deletecategory > 0) { |
if (@deletecategory > 0) { |
#FIXME Need to remove category from all courses using a deleted category |
#FIXME Need to remove category from all courses using a deleted category |
&Apache::loncommon::extract_categories($domconfig{'coursecategories'},\@predelcats,\@predeltrails,\%predelallitems); |
&Apache::loncommon::extract_categories($cathash,\@predelcats,\@predeltrails,\%predelallitems); |
foreach my $item (@deletecategory) { |
foreach my $item (@deletecategory) { |
if ($domconfig{'coursecategories'}{$item} ne '') { |
if ($domconfig{'coursecategories'}{'cats'}{$item} ne '') { |
delete($domconfig{'coursecategories'}{$item}); |
delete($domconfig{'coursecategories'}{'cats'}{$item}); |
$deletions{$item} = 1; |
$deletions{$item} = 1; |
&recurse_cat_deletes($item,$domconfig{'coursecategories'}, |
&recurse_cat_deletes($item,$cathash,\%deletions); |
\%deletions); |
|
} |
} |
} |
} |
} |
} |
foreach my $item (keys(%{$domconfig{'coursecategories'}})) { |
foreach my $item (keys(%{$cathash})) { |
my ($cat,$container,$depth) = map { &unescape($_); } split(/:/,$item); |
my ($cat,$container,$depth) = map { &unescape($_); } split(/:/,$item); |
if ($domconfig{'coursecategories'}{$item} ne $env{'form.'.$item}) { |
if ($cathash->{$item} ne $env{'form.'.$item}) { |
$reorderings{$item} = 1; |
$reorderings{$item} = 1; |
$domconfig{'coursecategories'}{$item} = $env{'form.'.$item}; |
$domconfig{'coursecategories'}{'cats'}{$item} = $env{'form.'.$item}; |
} |
} |
if ($env{'form.addcategory_name_'.$item} ne '') { |
if ($env{'form.addcategory_name_'.$item} ne '') { |
my $newcat = $env{'form.addcategory_name_'.$item}; |
my $newcat = $env{'form.addcategory_name_'.$item}; |
my $newdepth = $depth+1; |
my $newdepth = $depth+1; |
my $newitem = &escape($newcat).':'.&escape($cat).':'.$newdepth; |
my $newitem = &escape($newcat).':'.&escape($cat).':'.$newdepth; |
$domconfig{'coursecategories'}{$newitem} = $env{'form.addcategory_pos_'.$item}; |
$domconfig{'coursecategories'}{'cats'}{$newitem} = $env{'form.addcategory_pos_'.$item}; |
$adds{$newitem} = 1; |
$adds{$newitem} = 1; |
} |
} |
if ($env{'form.subcat_'.$item} ne '') { |
if ($env{'form.subcat_'.$item} ne '') { |
my $newcat = $env{'form.subcat_'.$item}; |
my $newcat = $env{'form.subcat_'.$item}; |
my $newdepth = $depth+1; |
my $newdepth = $depth+1; |
my $newitem = &escape($newcat).':'.&escape($cat).':'.$newdepth; |
my $newitem = &escape($newcat).':'.&escape($cat).':'.$newdepth; |
$domconfig{'coursecategories'}{$newitem} = 0; |
$domconfig{'coursecategories'}{'cats'}{$newitem} = 0; |
$adds{$newitem} = 1; |
$adds{$newitem} = 1; |
} |
} |
} |
} |
} |
} |
if ($env{'form.instcode'} eq '1') { |
if ($env{'form.instcode'} eq '1') { |
if (ref($domconfig{'coursecategories'}) eq 'HASH') { |
if (ref($cathash) eq 'HASH') { |
my $newitem = 'instcode::0'; |
my $newitem = 'instcode::0'; |
if ($domconfig{'coursecategories'}{$newitem} eq '') { |
if ($cathash->{$newitem} eq '') { |
$domconfig{'coursecategories'}{$newitem} = $env{'form.instcode_pos'}; |
$domconfig{'coursecategories'}{'cats'}{$newitem} = $env{'form.instcode_pos'}; |
$adds{$newitem} = 1; |
$adds{$newitem} = 1; |
} |
} |
} else { |
} else { |
my $newitem = 'instcode::0'; |
my $newitem = 'instcode::0'; |
$domconfig{'coursecategories'}{$newitem} = $env{'form.instcode_pos'}; |
$domconfig{'coursecategories'}{'cats'}{$newitem} = $env{'form.instcode_pos'}; |
$adds{$newitem} = 1; |
$adds{$newitem} = 1; |
} |
} |
} |
} |
if ($env{'form.addcategory_name'} ne '') { |
if ($env{'form.addcategory_name'} ne '') { |
my $newitem = &escape($env{'form.addcategory_name'}).'::0'; |
my $newitem = &escape($env{'form.addcategory_name'}).'::0'; |
$domconfig{'coursecategories'}{$newitem} = $env{'form.addcategory_pos'}; |
$domconfig{'coursecategories'}{'cats'}{$newitem} = $env{'form.addcategory_pos'}; |
$adds{$newitem} = 1; |
$adds{$newitem} = 1; |
} |
} |
|
my $putresult; |
if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) { |
if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) { |
my %sort_by_deltrail; |
|
if (keys(%deletions) > 0) { |
if (keys(%deletions) > 0) { |
foreach my $key (keys(%deletions)) { |
foreach my $key (keys(%deletions)) { |
if ($predelallitems{$key} ne '') { |
if ($predelallitems{$key} ne '') { |
Line 4314 sub modify_coursecategories {
|
Line 4399 sub modify_coursecategories {
|
} |
} |
} |
} |
my (@chkcats,@chktrails,%chkallitems); |
my (@chkcats,@chktrails,%chkallitems); |
&Apache::loncommon::extract_categories($domconfig{'coursecategories'},\@chkcats,\@chktrails,\%chkallitems); |
&Apache::loncommon::extract_categories($domconfig{'coursecategories'}{'cats'},\@chkcats,\@chktrails,\%chkallitems); |
if (ref($chkcats[0]) eq 'ARRAY') { |
if (ref($chkcats[0]) eq 'ARRAY') { |
my $depth = 0; |
my $depth = 0; |
my $chg = 0; |
my $chg = 0; |
Line 4326 sub modify_coursecategories {
|
Line 4411 sub modify_coursecategories {
|
} else { |
} else { |
$item = &escape($name).'::0'; |
$item = &escape($name).'::0'; |
if ($chg) { |
if ($chg) { |
$domconfig{'coursecategories'}{$item} -= $chg; |
$domconfig{'coursecategories'}{'cats'}{$item} -= $chg; |
} |
} |
$depth ++; |
$depth ++; |
&recurse_check(\@chkcats,$domconfig{'coursecategories'},$depth,$name); |
&recurse_check(\@chkcats,$domconfig{'coursecategories'}{'cats'},$depth,$name); |
$depth --; |
$depth --; |
} |
} |
} |
} |
} |
} |
my $putresult = &Apache::lonnet::put_dom('configuration',\%domconfig,$dom); |
} |
my (@cats,@trails,%allitems); |
if ((keys(%changes) > 0) || (keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) { |
&Apache::loncommon::extract_categories($domconfig{'coursecategories'},\@cats,\@trails,\%allitems); |
$putresult = &Apache::lonnet::put_dom('configuration',\%domconfig,$dom); |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
|
my %title = ( |
|
togglecats => 'Show/Hide a course in the catalog', |
|
categorize => 'Category assigned to course', |
|
); |
|
my %level = ( |
|
dom => 'set from "Modify Course" (Domain)', |
|
crs => 'set from "Parameters" (Course)', |
|
); |
$resulttext = &mt('Changes made:').'<ul>'; |
$resulttext = &mt('Changes made:').'<ul>'; |
if (keys(%deletions) > 0) { |
if ($changes{'togglecats'}) { |
$resulttext .= '<li>'.&mt('Deleted categories:').'<ul>'; |
$resulttext .= '<li>'.&mt("$title{'togglecats'} $level{$env{'form.togglecats'}}").'</li>'; |
foreach my $predeltrail (sort {$a <=> $b } (keys(%sort_by_deltrail))) { |
|
$resulttext .= '<li>'.$predeltrails[$predeltrail].'</li>'; |
|
} |
|
$resulttext .= '</ul></li>'; |
|
} |
} |
if (keys(%reorderings) > 0) { |
if ($changes{'categorize'}) { |
my %sort_by_trail; |
$resulttext .= '<li>'.&mt("$title{'categorize'} $level{$env{'form.categorize'}}").'</li>'; |
$resulttext .= '<li>'.&mt('Reordered categories:').'<ul>'; |
|
foreach my $key (keys(%reorderings)) { |
|
if ($allitems{$key} ne '') { |
|
$sort_by_trail{$allitems{$key}} = $trails[$allitems{$key}]; |
|
} |
|
} |
|
foreach my $trail (sort {$a <=> $b } (keys(%sort_by_trail))) { |
|
$resulttext .= '<li>'.$trails[$trail].'</li>'; |
|
} |
|
$resulttext .= '</ul></li>'; |
|
} |
} |
if (keys(%adds) > 0) { |
if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) { |
my %sort_by_trail; |
my $cathash; |
$resulttext .= '<li>'.&mt('Added categories:').'<ul>'; |
if (ref($domconfig{'coursecategories'}) eq 'HASH') { |
foreach my $key (keys(%adds)) { |
$cathash = $domconfig{'coursecategories'}{'cats'}; |
if ($allitems{$key} ne '') { |
} else { |
$sort_by_trail{$allitems{$key}} = $trails[$allitems{$key}]; |
$cathash = {}; |
|
} |
|
my (@cats,@trails,%allitems); |
|
&Apache::loncommon::extract_categories($cathash,\@cats,\@trails,\%allitems); |
|
if (keys(%deletions) > 0) { |
|
$resulttext .= '<li>'.&mt('Deleted categories:').'<ul>'; |
|
foreach my $predeltrail (sort {$a <=> $b } (keys(%sort_by_deltrail))) { |
|
$resulttext .= '<li>'.$predeltrails[$predeltrail].'</li>'; |
|
} |
|
$resulttext .= '</ul></li>'; |
|
} |
|
if (keys(%reorderings) > 0) { |
|
my %sort_by_trail; |
|
$resulttext .= '<li>'.&mt('Reordered categories:').'<ul>'; |
|
foreach my $key (keys(%reorderings)) { |
|
if ($allitems{$key} ne '') { |
|
$sort_by_trail{$allitems{$key}} = $trails[$allitems{$key}]; |
|
} |
|
} |
|
foreach my $trail (sort {$a <=> $b } (keys(%sort_by_trail))) { |
|
$resulttext .= '<li>'.$trails[$trail].'</li>'; |
} |
} |
|
$resulttext .= '</ul></li>'; |
} |
} |
foreach my $trail (sort {$a <=> $b } (keys(%sort_by_trail))) { |
if (keys(%adds) > 0) { |
$resulttext .= '<li>'.$trails[$trail].'</li>'; |
my %sort_by_trail; |
|
$resulttext .= '<li>'.&mt('Added categories:').'<ul>'; |
|
foreach my $key (keys(%adds)) { |
|
if ($allitems{$key} ne '') { |
|
$sort_by_trail{$allitems{$key}} = $trails[$allitems{$key}]; |
|
} |
|
} |
|
foreach my $trail (sort {$a <=> $b } (keys(%sort_by_trail))) { |
|
$resulttext .= '<li>'.$trails[$trail].'</li>'; |
|
} |
|
$resulttext .= '</ul></li>'; |
} |
} |
$resulttext .= '</ul></li>'; |
|
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
} else { |
} else { |
$resulttext = '<span class="LC_error">'. |
$resulttext = '<span class="LC_error">'. |
&mt('An error occurred: [_1]',$putresult).'</span>'; |
&mt('An error occurred: [_1]',$putresult).'</span>'; |
} |
} |
} else { |
} else { |
$resulttext = &mt('No changes made to course categories'); |
$resulttext = &mt('No changes made to course categories'); |