version 1.119, 2009/11/16 04:03:05
|
version 1.122, 2009/12/04 14:17:38
|
Line 202 sub handler {
|
Line 202 sub handler {
|
'quotas','autoenroll','autoupdate','directorysrch', |
'quotas','autoenroll','autoupdate','directorysrch', |
'usercreation','usermodification','contacts','defaults', |
'usercreation','usermodification','contacts','defaults', |
'scantron','coursecategories','serverstatuses', |
'scantron','coursecategories','serverstatuses', |
'requestcourses','helpsettings'],$dom); |
'requestcourses','helpsettings','coursedefaults'],$dom); |
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', |
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll', |
'autoupdate','directorysrch','contacts', |
'autoupdate','directorysrch','contacts', |
'usercreation','usermodification','scantron', |
'usercreation','usermodification','scantron', |
'requestcourses','coursecategories','serverstatuses','helpsettings'); |
'requestcourses','coursecategories','serverstatuses','helpsettings', |
|
'coursedefaults'); |
my %prefs = ( |
my %prefs = ( |
'rolecolors' => |
'rolecolors' => |
{ text => 'Default color schemes', |
{ text => 'Default color schemes', |
Line 303 sub handler {
|
Line 304 sub handler {
|
col2 => 'Value'}], |
col2 => 'Value'}], |
}, |
}, |
'coursecategories' => |
'coursecategories' => |
{ text => 'Cataloging of courses', |
{ text => 'Cataloging of courses/communities', |
help => 'Domain_Configuration_Cataloging_Courses', |
help => 'Domain_Configuration_Cataloging_Courses', |
header => [{col1 => 'Category settings', |
header => [{col1 => 'Category settings', |
col2 => '',}, |
col2 => '',}, |
Line 322 sub handler {
|
Line 323 sub handler {
|
'helpsettings' => |
'helpsettings' => |
{text => 'Help page settings', |
{text => 'Help page settings', |
help => 'Domain_Configuration_Help_Settings', |
help => 'Domain_Configuration_Help_Settings', |
|
header => [{col1 => 'Authenticated Help Settings', |
|
col2 => ''}, |
|
{col1 => 'Unauthenticated Help Settings', |
|
col2 => ''}], |
|
}, |
|
'coursedefaults' => |
|
{text => 'Course/Community defaults', |
|
help => 'Domain_Configuration_Course_Defaults', |
|
header => [{col1 => 'Setting', |
|
col2 => 'Value',}], |
|
}, |
|
'privacy' => |
|
{text => 'User Privacy', |
|
help => 'Domain_Configuration_User_Privacy', |
header => [{col1 => 'Setting', |
header => [{col1 => 'Setting', |
col2 => 'Value',}], |
col2 => 'Value',}], |
}, |
}, |
Line 422 sub process_changes {
|
Line 437 sub process_changes {
|
} elsif ($action eq 'requestcourses') { |
} elsif ($action eq 'requestcourses') { |
$output = &modify_quotas($dom,$action,%domconfig); |
$output = &modify_quotas($dom,$action,%domconfig); |
} elsif ($action eq 'helpsettings') { |
} elsif ($action eq 'helpsettings') { |
$output = &modify_helpsettings($dom,%domconfig); |
$output = &modify_helpsettings($r,$dom,$confname,%domconfig); |
|
} elsif ($action eq 'coursedefaults') { |
|
$output = &modify_coursedefaults($dom,%domconfig); |
} |
} |
return $output; |
return $output; |
} |
} |
Line 448 sub print_config_box {
|
Line 465 sub print_config_box {
|
} |
} |
if ($numheaders > 1) { |
if ($numheaders > 1) { |
my $colspan = ''; |
my $colspan = ''; |
if (($action eq 'rolecolors') || ($action eq 'coursecategories')) { |
if (($action eq 'rolecolors') || ($action eq 'coursecategories') || ($action eq 'helpsettings')) { |
$colspan = ' colspan="2"'; |
$colspan = ' colspan="2"'; |
} |
} |
$output .= ' |
$output .= ' |
Line 474 sub print_config_box {
|
Line 491 sub print_config_box {
|
} elsif ($action eq 'requestcourses') { |
} elsif ($action eq 'requestcourses') { |
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
$output .= &print_quotas($dom,$settings,\$rowtotal,$action); |
} elsif ($action eq 'helpsettings') { |
} elsif ($action eq 'helpsettings') { |
$output .= &print_helpsettings($dom,$settings,\$rowtotal); |
$output .= &print_helpsettings('top',$dom,$confname,$settings,\$rowtotal); |
} else { |
} elsif ($action eq 'rolecolors') { |
$output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal); |
$output .= &print_rolecolors($phase,'student',$dom,$confname,$settings,\$rowtotal); |
} |
} |
$output .= ' |
$output .= ' |
Line 526 sub print_config_box {
|
Line 543 sub print_config_box {
|
$output .= &print_login('bottom',$dom,$confname,$phase,$settings,\$rowtotal); |
$output .= &print_login('bottom',$dom,$confname,$phase,$settings,\$rowtotal); |
} elsif ($action eq 'requestcourses') { |
} elsif ($action eq 'requestcourses') { |
$output .= &print_courserequestmail($dom,$settings,\$rowtotal); |
$output .= &print_courserequestmail($dom,$settings,\$rowtotal); |
} else { |
} elsif ($action eq 'helpsettings') { |
|
$output .= &print_helpsettings('bottom',$dom,$confname,$settings,\$rowtotal); |
|
} elsif ($action eq 'rolecolors') { |
$output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).' |
$output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).' |
</table> |
</table> |
</td> |
</td> |
Line 611 sub print_config_box {
|
Line 630 sub print_config_box {
|
} elsif ($action eq 'serverstatuses') { |
} elsif ($action eq 'serverstatuses') { |
$output .= &print_serverstatuses($dom,$settings,\$rowtotal); |
$output .= &print_serverstatuses($dom,$settings,\$rowtotal); |
} elsif ($action eq 'helpsettings') { |
} elsif ($action eq 'helpsettings') { |
$output .= &print_helpsettings($dom,$settings,\$rowtotal); |
$output .= &print_helpsettings('top',$dom,$confname,$settings,\$rowtotal); |
} |
} elsif ($action eq 'coursedefaults') { |
|
$output .= &print_coursedefaults($dom,$settings,\$rowtotal); |
|
} |
} |
} |
$output .= ' |
$output .= ' |
</table> |
</table> |
Line 1930 sub print_contacts {
|
Line 1951 sub print_contacts {
|
|
|
sub print_helpsettings { |
sub print_helpsettings { |
|
|
my ($dom,$settings,$rowtotal) = @_; |
my ($position,$dom,$confname,$settings,$rowtotal) = @_; |
my ($css_class,$datatable); |
my ($css_class,$datatable); |
my $itemcount = 1; |
|
my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles); |
|
|
|
%choices = |
my $switchserver = &check_switchserver($dom,$confname); |
&Apache::lonlocal::texthash ( |
|
submitbugs => 'Display "Submit a bug" link?', |
|
); |
|
|
|
%defaultchecked = ('submitbugs' => 'on'); |
my $itemcount = 1; |
|
|
@toggles = ('submitbugs',); |
if ($position eq 'top') { |
|
|
foreach my $item (@toggles) { |
my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles); |
if ($defaultchecked{$item} eq 'on') { |
|
|
%choices = |
|
&Apache::lonlocal::texthash ( |
|
submitbugs => 'Display "Submit a bug" link?', |
|
); |
|
|
|
%defaultchecked = ('submitbugs' => 'on'); |
|
|
|
@toggles = ('submitbugs',); |
|
|
|
foreach my $item (@toggles) { |
|
if ($defaultchecked{$item} eq 'on') { |
|
$checkedon{$item} = ' checked="checked" '; |
|
$checkedoff{$item} = ' '; |
|
} elsif ($defaultchecked{$item} eq 'off') { |
|
$checkedoff{$item} = ' checked="checked" '; |
|
$checkedon{$item} = ' '; |
|
} |
|
} |
|
|
|
if (ref($settings) eq 'HASH') { |
|
foreach my $item (@toggles) { |
|
if ($settings->{$item} eq '1') { |
|
$checkedon{$item} = ' checked="checked" '; |
|
$checkedoff{$item} = ' '; |
|
} elsif ($settings->{$item} eq '0') { |
|
$checkedoff{$item} = ' checked="checked" '; |
|
$checkedon{$item} = ' '; |
|
} |
|
} |
|
} |
|
|
|
foreach my $item (@toggles) { |
|
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
|
$datatable .= |
|
'<tr'.$css_class.'> |
|
<td><span class="LC_nobreak">'.$choices{$item}.'</span></td> |
|
<td><span class="LC_nobreak"> </span></td> |
|
<td class="LC_right_item"><span class="LC_nobreak"> |
|
<label><input type="radio" name="'.$item.'" '.$checkedon{$item}.' value="1" />'.&mt('Yes').'</label> |
|
<label><input type="radio" name="'.$item.'" '.$checkedoff{$item}.' value="0" />'.&mt('No').'</label>'. |
|
'</span></td>'. |
|
'</tr>'; |
|
$itemcount ++; |
|
} |
|
|
|
} else { |
|
|
|
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : ''; |
|
|
|
$datatable .= '<tr'.$css_class.'>'; |
|
|
|
if (ref($settings) eq 'HASH') { |
|
if ($settings->{'loginhelpurl'} ne '') { |
|
my($directory, $filename) = $settings->{'loginhelpurl'} =~ m/(.*\/)(.*)$/; |
|
$datatable .= '<td width="33%"><span class="LC_left_item"><label><a href="'.$settings->{'loginhelpurl'}.'" target="_blank">'.&mt('Custom Login Page Help File In Use').'</a></label></span></td>'; |
|
$datatable .= '<td width="33%"><span class="LC_right_item"><label><input type="checkbox" name="loginhelpurl_del" value="1" />'.&mt('Delete?').'</label></span></td>' |
|
} else { |
|
$datatable .= '<td width="33%"><span class="LC_left_item"><label>'.&mt('Default Login Page Help File In Use').'</label></span></td>'; |
|
$datatable .= '<td width="33%"><span class="LC_right_item"> </span></td>'; |
|
} |
|
} else { |
|
$datatable .= '<td><span class="LC_left_item"> </span></td>'; |
|
$datatable .= '<td><span class="LC_right_item"> </span></td>'; |
|
} |
|
|
|
$datatable .= '<td width="33%"><span class="LC_right_item">'; |
|
if ($switchserver) { |
|
$datatable .= &mt('Upload to library server: [_1]',$switchserver); |
|
} else { |
|
$datatable .= &mt('Upload Custom Login Page Help File:'); |
|
$datatable .='<input type="file" name="loginhelpurl" />'; |
|
} |
|
$datatable .= '</span></td></tr>'; |
|
|
|
} |
|
|
|
return $datatable; |
|
|
|
} |
|
|
|
|
|
sub radiobutton_prefs { |
|
my ($settings,$toggles,$defaultchecked,$choices,$itemcount) = @_; |
|
return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') && |
|
(ref($choices) eq 'HASH')); |
|
|
|
my (%checkedon,%checkedoff,$datatable,$css_class); |
|
|
|
foreach my $item (@{$toggles}) { |
|
if ($defaultchecked->{$item} eq 'on') { |
$checkedon{$item} = ' checked="checked" '; |
$checkedon{$item} = ' checked="checked" '; |
$checkedoff{$item} = ' '; |
$checkedoff{$item} = ' '; |
} elsif ($defaultchecked{$item} eq 'off') { |
} elsif ($defaultchecked->{$item} eq 'off') { |
$checkedoff{$item} = ' checked="checked" '; |
$checkedoff{$item} = ' checked="checked" '; |
$checkedon{$item} = ' '; |
$checkedon{$item} = ' '; |
} |
} |
} |
} |
|
|
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
foreach my $item (@toggles) { |
foreach my $item (@{$toggles}) { |
if ($settings->{$item} eq '1') { |
if ($settings->{$item} eq '1') { |
$checkedon{$item} = ' checked="checked" '; |
$checkedon{$item} = ' checked="checked" '; |
$checkedoff{$item} = ' '; |
$checkedoff{$item} = ' '; |
Line 1964 sub print_helpsettings {
|
Line 2069 sub print_helpsettings {
|
$checkedon{$item} = ' '; |
$checkedon{$item} = ' '; |
} |
} |
} |
} |
} |
} |
|
foreach my $item (@{$toggles}) { |
foreach my $item (@toggles) { |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$datatable .= |
$datatable .= |
'<tr'.$css_class.'><td><span class="LC_nobreak">'.$choices{$item}. |
'<tr'.$css_class.'><td><span class="LC_nobreak">'.$choices->{$item}. |
'</span></td>'. |
'</span></td>'. |
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<td class="LC_right_item"><span class="LC_nobreak">'. |
'<label><input type="radio" name="'. |
'<label><input type="radio" name="'. |
Line 1979 sub print_helpsettings {
|
Line 2083 sub print_helpsettings {
|
'</span></td>'. |
'</span></td>'. |
'</tr>'; |
'</tr>'; |
$itemcount ++; |
$itemcount ++; |
} |
} |
return $datatable; |
return ($datatable,$itemcount); |
|
} |
|
|
|
sub print_coursedefaults { |
|
my ($dom,$settings,$rowtotal) = @_; |
|
my ($css_class,$datatable); |
|
my $itemcount = 1; |
|
my (%checkedon,%checkedoff,%choices,%defaultchecked,@toggles); |
|
%choices = |
|
&Apache::lonlocal::texthash ( |
|
canuse_pdfforms => 'Course/Community users can create/upload PDF forms', |
|
); |
|
%defaultchecked = ('canuse_pdfforms' => 'off'); |
|
@toggles = ('canuse_pdfforms',); |
|
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked, |
|
\%choices,$itemcount); |
|
$$rowtotal += $itemcount; |
|
return $datatable; |
} |
} |
|
|
sub contact_titles { |
sub contact_titles { |
Line 2595 sub print_coursecategories {
|
Line 2715 sub print_coursecategories {
|
my $toggle_cats_dom = ' checked="checked" '; |
my $toggle_cats_dom = ' checked="checked" '; |
my $can_cat_crs = ' '; |
my $can_cat_crs = ' '; |
my $can_cat_dom = ' checked="checked" '; |
my $can_cat_dom = ' checked="checked" '; |
|
my $toggle_catscomm_comm = ' '; |
|
my $toggle_catscomm_dom = ' checked="checked" '; |
|
my $can_catcomm_comm = ' '; |
|
my $can_catcomm_dom = ' checked="checked" '; |
|
|
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if ($settings->{'togglecats'} eq 'crs') { |
if ($settings->{'togglecats'} eq 'crs') { |
$toggle_cats_crs = $toggle_cats_dom; |
$toggle_cats_crs = $toggle_cats_dom; |
Line 2604 sub print_coursecategories {
|
Line 2729 sub print_coursecategories {
|
$can_cat_crs = $can_cat_dom; |
$can_cat_crs = $can_cat_dom; |
$can_cat_dom = ' '; |
$can_cat_dom = ' '; |
} |
} |
|
if ($settings->{'togglecatscomm'} eq 'comm') { |
|
$toggle_catscomm_comm = $toggle_catscomm_dom; |
|
$toggle_catscomm_dom = ' '; |
|
} |
|
if ($settings->{'categorizecomm'} eq 'comm') { |
|
$can_catcomm_comm = $can_catcomm_dom; |
|
$can_catcomm_dom = ' '; |
|
} |
} |
} |
my %title = &Apache::lonlocal::texthash ( |
my %title = &Apache::lonlocal::texthash ( |
togglecats => 'Show/Hide a course in the catalog', |
togglecats => 'Show/Hide a course in catalog', |
categorize => 'Assign a category to a course', |
togglecatscomm => 'Show/Hide a community in catalog', |
|
categorize => 'Assign a category to a course', |
|
categorizecomm => 'Assign a category to a community', |
); |
); |
my %level = &Apache::lonlocal::texthash ( |
my %level = &Apache::lonlocal::texthash ( |
dom => 'Set in "Modify Course" (Domain)', |
dom => 'Set in Domain', |
crs => 'Set in "Modify Parameters" (Course)', |
crs => 'Set in Course', |
|
comm => 'Set in Community', |
); |
); |
$datatable = '<tr class="LC_odd_row">'. |
$datatable = '<tr class="LC_odd_row">'. |
'<td>'.$title{'togglecats'}.'</td>'. |
'<td>'.$title{'togglecats'}.'</td>'. |
Line 2627 sub print_coursecategories {
|
Line 2763 sub print_coursecategories {
|
$can_cat_dom.' value="dom" />'.$level{'dom'}.'</label> '. |
$can_cat_dom.' value="dom" />'.$level{'dom'}.'</label> '. |
'<label><input type="radio" name="categorize"'. |
'<label><input type="radio" name="categorize"'. |
$can_cat_crs.'value="crs" />'.$level{'crs'}.'</label></span></td>'. |
$can_cat_crs.'value="crs" />'.$level{'crs'}.'</label></span></td>'. |
|
'</tr><tr class="LC_odd_row">'. |
|
'<td>'.$title{'togglecatscomm'}.'</td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak"><label>'. |
|
'<input type="radio" name="togglecatscomm"'. |
|
$toggle_catscomm_dom.' value="dom" />'.$level{'dom'}.'</label> '. |
|
'<label><input type="radio" name="togglecatscomm"'. |
|
$toggle_catscomm_comm.' value="comm" />'.$level{'comm'}.'</label></span></td>'. |
|
'</tr><tr>'. |
|
'<td>'.$title{'categorizecomm'}.'</td>'. |
|
'<td class="LC_right_item"><span class="LC_nobreak">'. |
|
'<label><input type="radio" name="categorizecomm"'. |
|
$can_catcomm_dom.' value="dom" />'.$level{'dom'}.'</label> '. |
|
'<label><input type="radio" name="categorizecomm"'. |
|
$can_catcomm_comm.'value="comm" />'.$level{'comm'}.'</label></span></td>'. |
'</tr>'; |
'</tr>'; |
$$rowtotal += 2; |
$$rowtotal += 4; |
} else { |
} else { |
my $css_class; |
my $css_class; |
my $itemcount = 1; |
my $itemcount = 1; |
Line 2650 sub print_coursecategories {
|
Line 2800 sub print_coursecategories {
|
if (ref($cats[0]) eq 'ARRAY') { |
if (ref($cats[0]) eq 'ARRAY') { |
my $numtop = @{$cats[0]}; |
my $numtop = @{$cats[0]}; |
my $maxnum = $numtop; |
my $maxnum = $numtop; |
if ((!grep(/^instcode$/,@{$cats[0]})) || ($cathash->{'instcode::0'} eq '')) { |
my %default_names = ( |
|
instcode => &mt('Official courses'), |
|
communities => &mt('Communities'), |
|
); |
|
|
|
if ((!grep(/^instcode$/,@{$cats[0]})) || |
|
($cathash->{'instcode::0'} eq '') || |
|
(!grep(/^communities$/,@{$cats[0]})) || |
|
($cathash->{'communities::0'} eq '')) { |
$maxnum ++; |
$maxnum ++; |
} |
} |
my $lastidx; |
my $lastidx; |
Line 2671 sub print_coursecategories {
|
Line 2829 sub print_coursecategories {
|
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
$datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>'; |
} |
} |
$datatable .= '</select></td><td>'; |
$datatable .= '</select></td><td>'; |
if ($parent eq 'instcode') { |
if ($parent eq 'instcode' || $parent eq 'communities') { |
$datatable .= '<span class="LC_nobreak">'.&mt('Official courses') |
$datatable .= '<span class="LC_nobreak">' |
.'</span><br /><span class="LC_nobreak">(' |
.$default_names{$parent}.'</span>'; |
.&mt('with institutional codes').')</span></td>' |
if ($parent eq 'instcode') { |
.'<td'.$colattrib.'><span class="LC_nobreak"><label><input type="radio" name="instcode" value="1" checked="checked" />' |
$datatable .= '<br /><span class="LC_nobreak">(' |
.&mt('Display').'</label> ' |
.&mt('with institutional codes') |
.'<label><input type="radio" name="instcode" value="0" />' |
.')</span></td><td'.$colattrib.'>'; |
.&mt('Do not display').'</label></span></td>'; |
} else { |
|
$datatable .= '<table><tr><td>'; |
|
} |
|
$datatable .= '<span class="LC_nobreak">' |
|
.'<label><input type="radio" name="' |
|
.$parent.'" value="1" checked="checked" />' |
|
.&mt('Display').'</label>'; |
|
if ($parent eq 'instcode') { |
|
$datatable .= ' '; |
|
} else { |
|
$datatable .= '</span></td></tr><tr><td>' |
|
.'<span class="LC_nobreak">'; |
|
} |
|
$datatable .= '<label><input type="radio" name="' |
|
.$parent.'" value="0" />' |
|
.&mt('Do not display').'</label></span>'; |
|
if ($parent eq 'communities') { |
|
$datatable .= '</td></tr></table>'; |
|
} |
|
$datatable .= '</td>'; |
} else { |
} else { |
$datatable .= $parent |
$datatable .= $parent |
.' <label><input type="checkbox" name="deletecategory" ' |
.' <label><input type="checkbox" name="deletecategory" ' |
Line 2706 sub print_coursecategories {
|
Line 2883 sub print_coursecategories {
|
.'<input type="text" size="20" name="addcategory_name" value="" /></td>' |
.'<input type="text" size="20" name="addcategory_name" value="" /></td>' |
.'</tr>'."\n"; |
.'</tr>'."\n"; |
$itemcount ++; |
$itemcount ++; |
if ((!grep(/^instcode$/,@{$cats[0]})) || ($cathash->{'instcode::0'} eq '')) { |
foreach my $default ('instcode','communities') { |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
if ((!grep(/^\Q$default\E$/,@{$cats[0]})) || ($cathash->{$default.'::0'} eq '')) { |
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','instcode_pos','$lastidx'".');"'; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$datatable .= '<tr><td colspan="'.$maxdepth.'" class="LC_row_separator"></td></tr><tr '.$css_class.'><td>'. |
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','$default"."_pos','$lastidx'".');"'; |
'<span class="LC_nobreak"><select name="instcode_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="'.$default.'_pos"'.$chgstr.'>'; |
my $vpos = $k+1; |
for (my $k=0; $k<=$maxnum; $k++) { |
my $selstr; |
my $vpos = $k+1; |
if ($k == $maxnum) { |
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><span class="LC_nobreak">'. |
|
$default_names{$default}.'</span>'; |
|
if ($default eq 'instcode') { |
|
$datatable .= '<br /><span class="LC_nobreak">(' |
|
.&mt('with institutional codes').')</span>'; |
|
} |
|
$datatable .= '</td>' |
|
.'<td><span class="LC_nobreak"><label><input type="radio" name="'.$default.'" value="1" />' |
|
.&mt('Display').'</label> ' |
|
.'<label><input type="radio" name="'.$default.'" 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 { |
} else { |
Line 2814 sub coursecategories_javascript {
|
Line 2998 sub coursecategories_javascript {
|
$jstext = ' var categories = Array(1);'."\n". |
$jstext = ' var categories = Array(1);'."\n". |
' categories[0] = Array("instcode_pos");'."\n"; |
' categories[0] = Array("instcode_pos");'."\n"; |
} |
} |
|
my $instcode_reserved = &mt('The name: "instcode" is a reserved category'); |
|
my $communities_reserved = &mt('The name: "communities" is a reserved category'); |
|
my $choose_again = '\\n'.&mt('Please use a different name for the new top level category'); |
$output = <<"ENDSCRIPT"; |
$output = <<"ENDSCRIPT"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 2873 $jstext
|
Line 3060 $jstext
|
} |
} |
return; |
return; |
} |
} |
|
|
|
function categoryCheck(form) { |
|
if (form.elements['addcategory_name'].value == 'instcode') { |
|
alert('$instcode_reserved\\n$choose_again'); |
|
return false; |
|
} |
|
if (form.elements['addcategory_name'].value == 'communities') { |
|
alert('$communities_reserved\\n$choose_again'); |
|
return false; |
|
} |
|
return true; |
|
} |
|
|
// ]]> |
// ]]> |
</script> |
</script> |
|
|
Line 2882 ENDSCRIPT
|
Line 3082 ENDSCRIPT
|
|
|
sub initialize_categories { |
sub initialize_categories { |
my ($itemcount) = @_; |
my ($itemcount) = @_; |
my $datatable; |
my ($datatable,$css_class,$chgstr); |
my $css_class = $itemcount%2?' class="LC_odd_row"':''; |
my %default_names = ( |
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','instcode_pos','0'".');"'; |
instcode => 'Official courses (with institutional codes)', |
|
communities => 'Communities', |
$datatable = '<tr '.$css_class.'><td><span class="LC_nobreak">' |
); |
.'<select name="instcode_pos"><option value="0" selected="selected">1</option>' |
my $select0 = ' selected="selected"'; |
.'<option value="1">2</option></select> ' |
my $select1 = ''; |
.&mt('Official courses (with institutional codes)') |
foreach my $default ('instcode','communities') { |
.'</span></td><td><span class="LC_nobreak">' |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
.'<label><input type="radio" name="instcode" value="1" checked="checked" />' |
$chgstr = ' onchange="javascript:reorderCats(this.form,'."'',$default"."_pos','0'".');"'; |
.&mt('Display').'</label> <label>' |
if ($default eq 'communities') { |
.'<input type="radio" name="instcode" value="0" />'.&mt('Do not display') |
$select1 = $select0; |
|
$select0 = ''; |
|
} |
|
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
|
.'<select name="'.$default.'_pos">' |
|
.'<option value="0"'.$select0.'>1</option>' |
|
.'<option value="1"'.$select1.'>2</option>' |
|
.'<option value="2">3</option></select> ' |
|
.$default_names{$default} |
|
.'</span></td><td><span class="LC_nobreak">' |
|
.'<label><input type="radio" name="'.$default.'" value="1" checked="checked" />' |
|
.&mt('Display').'</label> <label>' |
|
.'<input type="radio" name="'.$default.'" value="0" />'.&mt('Do not display') |
.'</label></span></td></tr>'; |
.'</label></span></td></tr>'; |
$itemcount ++; |
$itemcount ++; |
|
} |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$chgstr = ' onchange="javascript:reorderCats(this.form,'."'','addcategory_pos','0'".');"'; |
$chgstr = ' onchange="javascript:reorderCats(this.form,'."'','addcategory_pos','0'".');"'; |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">' |
.'<select name="addcategory_pos"'.$chgstr.'><option value="0">1</option>' |
.'<select name="addcategory_pos"'.$chgstr.'>' |
.'<option value="1" selected="selected">2</option></select> ' |
.'<option value="0">1</option>' |
|
.'<option value="1">2</option>' |
|
.'<option value="2" selected="selected">3</option></select> ' |
.&mt('Add category').'</td><td>'.&mt('Name:') |
.&mt('Add category').'</td><td>'.&mt('Name:') |
.' <input type="text" size="20" name="addcategory_name" value="" /></td></tr>'; |
.' <input type="text" size="20" name="addcategory_name" value="" /></td></tr>'; |
return $datatable; |
return $datatable; |
Line 5398 sub modify_coursecategories {
|
Line 5613 sub modify_coursecategories {
|
$changes{'categorize'} = 1; |
$changes{'categorize'} = 1; |
$domconfig{'coursecategories'}{'categorize'} = $env{'form.categorize'}; |
$domconfig{'coursecategories'}{'categorize'} = $env{'form.categorize'}; |
} |
} |
|
if ($domconfig{'coursecategories'}{'togglecatscomm'} ne $env{'form.togglecatscomm'}) { |
|
$changes{'togglecatscomm'} = 1; |
|
$domconfig{'coursecategories'}{'togglecatscomm'} = $env{'form.togglecatscomm'}; |
|
} |
|
if ($domconfig{'coursecategories'}{'categorizecomm'} ne $env{'form.categorizecomm'}) { |
|
$changes{'categorizecomm'} = 1; |
|
$domconfig{'coursecategories'}{'categorizecomm'} = $env{'form.categorizecomm'}; |
|
} |
} else { |
} else { |
$changes{'togglecats'} = 1; |
$changes{'togglecats'} = 1; |
$changes{'categorize'} = 1; |
$changes{'categorize'} = 1; |
Line 5405 sub modify_coursecategories {
|
Line 5628 sub modify_coursecategories {
|
togglecats => $env{'form.togglecats'}, |
togglecats => $env{'form.togglecats'}, |
categorize => $env{'form.categorize'}, |
categorize => $env{'form.categorize'}, |
}; |
}; |
|
$changes{'togglecatscomm'} = 1; |
|
$changes{'categorizecomm'} = 1; |
|
$domconfig{'coursecategories'} = { |
|
togglecats => $env{'form.togglecatscomm'}, |
|
categorize => $env{'form.categorizecomm'}, |
|
}; |
} |
} |
if (ref($cathash) eq 'HASH') { |
if (ref($cathash) eq 'HASH') { |
if (($domconfig{'coursecategories'}{'cats'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) { |
if (($domconfig{'coursecategories'}{'cats'}{'instcode::0'} ne '') && ($env{'form.instcode'} == 0)) { |
push (@deletecategory,'instcode::0'); |
push (@deletecategory,'instcode::0'); |
} |
} |
|
if (($domconfig{'coursecategories'}{'cats'}{'communities::0'} ne '') && ($env{'form.communities'} == 0)) { |
|
push(@deletecategory,'communities::0'); |
|
} |
} |
} |
my (@predelcats,@predeltrails,%predelallitems,%sort_by_deltrail); |
my (@predelcats,@predeltrails,%predelallitems,%sort_by_deltrail); |
if (ref($cathash) eq 'HASH') { |
if (ref($cathash) eq 'HASH') { |
Line 5459 sub modify_coursecategories {
|
Line 5691 sub modify_coursecategories {
|
$adds{$newitem} = 1; |
$adds{$newitem} = 1; |
} |
} |
} |
} |
|
if ($env{'form.communities'} eq '1') { |
|
if (ref($cathash) eq 'HASH') { |
|
my $newitem = 'communities::0'; |
|
if ($cathash->{$newitem} eq '') { |
|
$domconfig{'coursecategories'}{'cats'}{$newitem} = $env{'form.communities_pos'}; |
|
$adds{$newitem} = 1; |
|
} |
|
} else { |
|
my $newitem = 'communities::0'; |
|
$domconfig{'coursecategories'}{'cats'}{$newitem} = $env{'form.communities_pos'}; |
|
$adds{$newitem} = 1; |
|
} |
|
} |
if ($env{'form.addcategory_name'} ne '') { |
if ($env{'form.addcategory_name'} ne '') { |
my $newitem = &escape($env{'form.addcategory_name'}).'::0'; |
if (($env{'form.addcategory_name'} ne 'instcode') && |
$domconfig{'coursecategories'}{'cats'}{$newitem} = $env{'form.addcategory_pos'}; |
($env{'form.addcategory_name'} ne 'communities')) { |
$adds{$newitem} = 1; |
my $newitem = &escape($env{'form.addcategory_name'}).'::0'; |
|
$domconfig{'coursecategories'}{'cats'}{$newitem} = $env{'form.addcategory_pos'}; |
|
$adds{$newitem} = 1; |
|
} |
} |
} |
my $putresult; |
my $putresult; |
if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) { |
if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) { |
Line 5499 sub modify_coursecategories {
|
Line 5747 sub modify_coursecategories {
|
$putresult = &Apache::lonnet::put_dom('configuration',\%domconfig,$dom); |
$putresult = &Apache::lonnet::put_dom('configuration',\%domconfig,$dom); |
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
my %title = ( |
my %title = ( |
togglecats => 'Show/Hide a course in the catalog', |
togglecats => 'Show/Hide a course in catalog', |
categorize => 'Category assigned to course', |
categorize => 'Assign a category to a course', |
|
togglecatscomm => 'Show/Hide a community in catalog', |
|
categorizecomm => 'Assign a category to a community', |
); |
); |
my %level = ( |
my %level = ( |
dom => 'set from "Modify Course" (Domain)', |
dom => 'set in Domain ("Modify Course/Community")', |
crs => 'set from "Parameters" (Course)', |
crs => 'set in Course ("Course Configuration")', |
|
comm => 'set in Community ("Community Configuration")', |
); |
); |
$resulttext = &mt('Changes made:').'<ul>'; |
$resulttext = &mt('Changes made:').'<ul>'; |
if ($changes{'togglecats'}) { |
if ($changes{'togglecats'}) { |
Line 5513 sub modify_coursecategories {
|
Line 5764 sub modify_coursecategories {
|
if ($changes{'categorize'}) { |
if ($changes{'categorize'}) { |
$resulttext .= '<li>'.&mt("$title{'categorize'} $level{$env{'form.categorize'}}").'</li>'; |
$resulttext .= '<li>'.&mt("$title{'categorize'} $level{$env{'form.categorize'}}").'</li>'; |
} |
} |
|
if ($changes{'togglecatscomm'}) { |
|
$resulttext .= '<li>'.&mt("$title{'togglecatscomm'} $level{$env{'form.togglecatscomm'}}").'</li>'; |
|
} |
|
if ($changes{'categorizecomm'}) { |
|
$resulttext .= '<li>'.&mt("$title{'categorizecomm'} $level{$env{'form.categorizecomm'}}").'</li>'; |
|
} |
if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) { |
if ((keys(%deletions) > 0) || (keys(%reorderings) > 0) || (keys(%adds) > 0)) { |
my $cathash; |
my $cathash; |
if (ref($domconfig{'coursecategories'}) eq 'HASH') { |
if (ref($domconfig{'coursecategories'}) eq 'HASH') { |
Line 5562 sub modify_coursecategories {
|
Line 5819 sub modify_coursecategories {
|
&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 and community categories'); |
} |
} |
return $resulttext; |
return $resulttext; |
} |
} |
Line 5693 sub modify_serverstatuses {
|
Line 5950 sub modify_serverstatuses {
|
} |
} |
|
|
sub modify_helpsettings { |
sub modify_helpsettings { |
my ($dom,%domconfig) = @_; |
my ($r,$dom,$confname,%domconfig) = @_; |
my ($resulttext,$errors,%changes,%helphash); |
my ($resulttext,$errors,%changes,%helphash); |
|
|
|
my $customhelpfile = $env{'form.loginhelpurl.filename'}; |
|
my $defaulthelpfile = 'defaulthelp.html'; |
|
my $servadm = $r->dir_config('lonAdmEMail'); |
|
my ($configuserok,$author_ok,$switchserver) = |
|
&config_check($dom,$confname,$servadm); |
|
|
my %defaultchecked = ('submitbugs' => 'on'); |
my %defaultchecked = ('submitbugs' => 'on'); |
my @offon = ('off','on'); |
my @offon = ('off','on'); |
my %title = ( submitbugs => 'Display link for users to submit a bug'); |
my %title = ( submitbugs => 'Display link for users to submit a bug', |
|
loginhelpurl => 'Unauthenticated login help page set to custom file'); |
|
|
my @toggles = ('submitbugs'); |
my @toggles = ('submitbugs'); |
|
|
$helphash{'helpsettings'} = {}; |
$helphash{'helpsettings'} = {}; |
Line 5729 sub modify_helpsettings {
|
Line 5994 sub modify_helpsettings {
|
} |
} |
} |
} |
$helphash{'helpsettings'}{$item} = $env{'form.'.$item}; |
$helphash{'helpsettings'}{$item} = $env{'form.'.$item}; |
} |
} |
|
|
|
if ($customhelpfile ne '') { |
|
my $error; |
|
if ($configuserok eq 'ok') { |
|
if ($switchserver) { |
|
$error = &mt("Upload of custom help file is not permitted to this server: [_1]",$switchserver); |
|
} else { |
|
if ($author_ok eq 'ok') { |
|
my ($result,$loginhelpurl) = |
|
&publishlogo($r,'upload','loginhelpurl',$dom, |
|
$confname,'help','','',$customhelpfile); |
|
if ($result eq 'ok') { |
|
$helphash{'helpsettings'}{'loginhelpurl'} = $loginhelpurl; |
|
$changes{'loginhelpurl'} = 1; |
|
} else { |
|
$error = &mt("Upload of [_1] failed because an error occurred publishing the file in RES space. Error was: [_2].",$customhelpfile,$result); |
|
} |
|
} else { |
|
$error = &mt("Upload of [_1] failed because an author role could not be assigned to a Domain Configuration user ([_2]) in domain: [_3]. Error was: [_4].",$customhelpfile,$confname,$dom,$author_ok); |
|
} |
|
} |
|
} else { |
|
$error = &mt("Upload of [_1] failed because a Domain Configuration user ([_2]) could not be created in domain: [_3]. Error was: [_4].",$customhelpfile,$confname,$dom,$configuserok); |
|
} |
|
if ($error) { |
|
&Apache::lonnet::logthis($error); |
|
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
|
} |
|
} |
|
|
|
if ($domconfig{'helpsettings'}{'loginhelpurl'} ne '') { |
|
if ($env{'form.loginhelpurl_del'}) { |
|
$helphash{'helpsettings'}{'loginhelpurl'} = ''; |
|
$changes{'loginhelpurl'} = 1; |
|
} |
|
} |
} |
} |
|
|
my $putresult = &Apache::lonnet::put_dom('configuration',\%helphash, |
my $putresult = &Apache::lonnet::put_dom('configuration',\%helphash,$dom); |
$dom); |
|
|
|
if ($putresult eq 'ok') { |
if ($putresult eq 'ok') { |
if (keys(%changes) > 0) { |
if (keys(%changes) > 0) { |
Line 5742 sub modify_helpsettings {
|
Line 6042 sub modify_helpsettings {
|
if ($item eq 'submitbugs') { |
if ($item eq 'submitbugs') { |
$resulttext .= '<li>'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'</li>'; |
$resulttext .= '<li>'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'</li>'; |
} |
} |
|
if ($item eq 'loginhelpurl') { |
|
if ($helphash{'helpsettings'}{'loginhelpurl'} eq '') { |
|
$resulttext .= '<li>'.&mt('[_1] help file removed; [_2] file will be used for the unathorized help page in this domain.',$customhelpfile,$defaulthelpfile).'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt("$title{$item} [_1]",$customhelpfile).'</li>'; |
|
} |
|
} |
} |
} |
$resulttext .= '</ul>'; |
$resulttext .= '</ul>'; |
} else { |
} else { |
Line 5757 sub modify_helpsettings {
|
Line 6064 sub modify_helpsettings {
|
} |
} |
return $resulttext; |
return $resulttext; |
} |
} |
|
|
|
sub modify_coursedefaults { |
|
my ($dom,%domconfig) = @_; |
|
my ($resulttext,$errors,%changes,%defaultshash); |
|
my %defaultchecked = ('canuse_pdfforms' => 'off'); |
|
my @offon = ('off','on'); |
|
my @toggles = ('canuse_pdfforms'); |
|
|
|
$defaultshash{'coursedefaults'} = {}; |
|
|
|
if (ref($domconfig{'coursedefaults'}) ne 'HASH') { |
|
if ($domconfig{'coursedefaults'} eq '') { |
|
$domconfig{'coursedefaults'} = {}; |
|
} |
|
} |
|
|
|
if (ref($domconfig{'coursedefaults'}) eq 'HASH') { |
|
foreach my $item (@toggles) { |
|
if ($defaultchecked{$item} eq 'on') { |
|
if (($domconfig{'coursedefaults'}{$item} eq '') && |
|
($env{'form.'.$item} eq '0')) { |
|
$changes{$item} = 1; |
|
} elsif ($domconfig{'coursdefaults'}{$item} ne $env{'form.'.$item}) { |
|
$changes{$item} = 1; |
|
} |
|
} elsif ($defaultchecked{$item} eq 'off') { |
|
if (($domconfig{'coursedefaults'}{$item} eq '') && |
|
($env{'form.'.$item} eq '1')) { |
|
$changes{$item} = 1; |
|
} elsif ($domconfig{'coursedefaults'}{$item} ne $env{'form.'.$item}) { |
|
$changes{$item} = 1; |
|
} |
|
} |
|
$defaultshash{'coursedefaults'}{$item} = $env{'form.'.$item}; |
|
} |
|
} |
|
my $putresult = &Apache::lonnet::put_dom('configuration',\%defaultshash, |
|
$dom); |
|
if ($putresult eq 'ok') { |
|
if (keys(%changes) > 0) { |
|
if ($changes{'canuse_pdfforms'}) { |
|
my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); |
|
$domdefaults{'canuse_pdfforms'}=$defaultshash{'coursedefaults'}{'canuse_pdfforms'}; |
|
my $cachetime = 24*60*60; |
|
&Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime); |
|
} |
|
$resulttext = &mt('Changes made:').'<ul>'; |
|
foreach my $item (sort(keys(%changes))) { |
|
if ($item eq 'canuse_pdfforms') { |
|
if ($env{'form.'.$item} eq '1') { |
|
$resulttext .= '<li>'.&mt("Course/Community users can create/upload PDF forms set to 'on'").'</li>'; |
|
} else { |
|
$resulttext .= '<li>'.&mt('Course/Community users can create/upload PDF forms set to "off"').'</li>'; |
|
} |
|
} |
|
} |
|
$resulttext .= '</ul>'; |
|
} else { |
|
$resulttext = &mt('No changes made to course defaults'); |
|
} |
|
} else { |
|
$resulttext = '<span class="LC_error">'. |
|
&mt('An error occurred: [_1]',$putresult).'</span>'; |
|
} |
|
return $resulttext; |
|
} |
|
|
sub recurse_check { |
sub recurse_check { |
my ($chkcats,$categories,$depth,$name) = @_; |
my ($chkcats,$categories,$depth,$name) = @_; |