--- loncom/interface/domainprefs.pm 2016/09/18 19:22:48 1.160.6.71
+++ loncom/interface/domainprefs.pm 2014/05/04 21:48:56 1.239
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.160.6.71 2016/09/18 19:22:48 raeburn Exp $
+# $Id: domainprefs.pm,v 1.239 2014/05/04 21:48:56 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -213,15 +213,15 @@ sub handler {
'quotas','autoenroll','autoupdate','autocreate',
'directorysrch','usercreation','usermodification',
'contacts','defaults','scantron','coursecategories',
- 'serverstatuses','requestcourses','coursedefaults',
- 'usersessions','loadbalancing','requestauthor',
- 'selfenrollment','inststatus'],$dom);
+ 'serverstatuses','requestcourses','helpsettings',
+ 'coursedefaults','usersessions','loadbalancing',
+ 'requestauthor','selfenrollment','inststatus'],$dom);
my @prefs_order = ('rolecolors','login','defaults','quotas','autoenroll',
'autoupdate','autocreate','directorysrch','contacts',
'usercreation','selfcreation','usermodification','scantron',
'requestcourses','requestauthor','coursecategories',
- 'serverstatuses','coursedefaults','selfenrollment',
- 'usersessions');
+ 'serverstatuses','helpsettings',
+ 'coursedefaults','selfenrollment','usersessions');
my %existing;
if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
%existing = %{$domconfig{'loadbalancing'}};
@@ -250,8 +250,6 @@ sub handler {
header => [{col1 => 'Log-in Page Items',
col2 => '',},
{col1 => 'Log-in Help',
- col2 => 'Value'},
- {col1 => 'Custom HTML in document head',
col2 => 'Value'}],
print => \&print_login,
modify => \&modify_login,
@@ -371,8 +369,6 @@ sub handler {
col2 => 'Value'},
{col1 => 'Available textbooks',
col2 => ''},
- {col1 => 'Available templates',
- col2 => ''},
{col1 => 'Validation (not official courses)',
col2 => 'Value'},],
print => \&print_quotas,
@@ -411,6 +407,14 @@ sub handler {
print => \&print_serverstatuses,
modify => \&modify_serverstatuses,
},
+ 'helpsettings' =>
+ {text => 'Help page settings',
+ help => 'Domain_Configuration_Help_Settings',
+ header => [{col1 => 'Help Settings (logged-in users)',
+ col2 => 'Value'}],
+ print => \&print_helpsettings,
+ modify => \&modify_helpsettings,
+ },
'coursedefaults' =>
{text => 'Course/Community defaults',
help => 'Domain_Configuration_Course_Defaults',
@@ -433,6 +437,14 @@ sub handler {
print => \&print_selfenrollment,
modify => \&modify_selfenrollment,
},
+ 'privacy' =>
+ {text => 'User Privacy',
+ help => 'Domain_Configuration_User_Privacy',
+ header => [{col1 => 'Setting',
+ col2 => 'Value',}],
+ print => \&print_privacy,
+ modify => \&modify_privacy,
+ },
'usersessions' =>
{text => 'User session hosting/offloading',
help => 'Domain_Configuration_User_Sessions',
@@ -465,8 +477,6 @@ sub handler {
{col1 => 'Log-in Page Items',
col2 => ''},
{col1 => 'Log-in Help',
- col2 => 'Value'},
- {col1 => 'Custom HTML in document head',
col2 => 'Value'}],
print => \&print_login,
modify => \&modify_login,
@@ -619,6 +629,8 @@ sub process_changes {
$output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig);
} elsif ($action eq 'requestauthor') {
$output = &modify_quotas($r,$dom,$action,$lastactref,%domconfig);
+ } elsif ($action eq 'helpsettings') {
+ $output = &modify_helpsettings($r,$dom,$confname,%domconfig);
} elsif ($action eq 'coursedefaults') {
$output = &modify_coursedefaults($dom,$lastactref,%domconfig);
} elsif ($action eq 'selfenrollment') {
@@ -656,7 +668,7 @@ sub print_config_box {
my $colspan = '';
my $rightcolspan = '';
if (($action eq 'rolecolors') || ($action eq 'defaults') ||
- (($action eq 'login') && ($numheaders < 4))) {
+ (($action eq 'login') && ($numheaders < 3))) {
$colspan = ' colspan="2"';
}
if ($action eq 'usersessions') {
@@ -678,7 +690,7 @@ sub print_config_box {
} elsif ($action eq 'coursecategories') {
$output .= $item->{'print'}->('top',$dom,$item,$settings,\$rowtotal);
} elsif ($action eq 'login') {
- if ($numheaders == 4) {
+ if ($numheaders == 3) {
$colspan = ' colspan="2"';
$output .= &print_login('service',$dom,$confname,$phase,$settings,\$rowtotal);
} else {
@@ -731,7 +743,7 @@ sub print_config_box {
($action eq 'defaults')) {
$output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
} elsif ($action eq 'login') {
- if ($numheaders == 4) {
+ if ($numheaders == 3) {
$output .= &print_login('page',$dom,$confname,$phase,$settings,\$rowtotal).'
@@ -747,31 +759,9 @@ sub print_config_box {
} else {
$output .= &print_login('help',$dom,$confname,$phase,$settings,\$rowtotal);
}
- $output .= '
-
-
-
-
-
-
- ';
- if ($numheaders == 4) {
- $output .= '
- '.&mt($item->{'header'}->[3]->{'col1'}).' |
- '.&mt($item->{'header'}->[3]->{'col2'}).' |
- ';
- } else {
- $output .= '
- '.&mt($item->{'header'}->[2]->{'col1'}).' |
- '.&mt($item->{'header'}->[2]->{'col2'}).' |
- ';
- }
- $rowtotal ++;
- $output .= &print_login('headtag',$dom,$confname,$phase,$settings,\$rowtotal);
} elsif ($action eq 'requestcourses') {
- $output .= &print_requestmail($dom,$action,$settings,\$rowtotal);
- $rowtotal ++;
- $output .= &print_studentcode($settings,\$rowtotal).'
+ $output .= &print_requestmail($dom,$action,$settings,\$rowtotal).
+ &print_studentcode($settings,\$rowtotal).'
|
@@ -781,18 +771,7 @@ sub print_config_box {
'.&mt($item->{'header'}->[2]->{'col1'}).' |
'.&mt($item->{'header'}->[2]->{'col2'}).' |
'.
- &textbookcourses_javascript($settings).
- &print_textbookcourses($dom,'textbooks',$settings,\$rowtotal).'
-
-
-
-
-
-
-
- '.&mt($item->{'header'}->[3]->{'col1'}).' |
- '.&mt($item->{'header'}->[3]->{'col2'}).' | '.
- &print_textbookcourses($dom,'templates',$settings,\$rowtotal).'
+ &print_textbookcourses($dom,$settings,\$rowtotal).'
|
@@ -800,13 +779,12 @@ sub print_config_box {
- '.&mt($item->{'header'}->[4]->{'col1'}).' |
- '.&mt($item->{'header'}->[4]->{'col2'}).' |
+ '.&mt($item->{'header'}->[3]->{'col1'}).' |
+ '.&mt($item->{'header'}->[3]->{'col2'}).' |
'.
&print_validation_rows('requestcourses',$dom,$settings,\$rowtotal);
} elsif ($action eq 'requestauthor') {
$output .= &print_requestmail($dom,$action,$settings,\$rowtotal);
- $rowtotal ++;
} elsif ($action eq 'rolecolors') {
$output .= &print_rolecolors($phase,'coordinator',$dom,$confname,$settings,\$rowtotal).'
@@ -1188,57 +1166,6 @@ sub print_login {
$itemcount ++;
}
$datatable .= &captcha_choice('login',$settings,$itemcount);
- } elsif ($caller eq 'headtag') {
- my %domservers = &Apache::lonnet::get_servers($dom);
- my $choice = $choices{'headtag'};
- $css_class = ' class="LC_odd_row"';
- $datatable .= ' | '.$choice.' | '.
- ' |
';
}
return $datatable;
}
@@ -1272,9 +1199,6 @@ sub login_choices {
link => "Link",
alink => "Active link",
vlink => "Visited link",
- headtag => "Custom markup",
- action => "Action",
- current => "Current",
);
return %choices;
}
@@ -2137,6 +2061,7 @@ sub print_requestmail {
$datatable .= &mt('There are no active Domain Coordinators');
}
$datatable .='';
+ $$rowtotal += $rows;
return $datatable;
}
@@ -2145,11 +2070,9 @@ sub print_studentcode {
my $rownum = 0;
my ($output,%current);
my @crstypes = ('official','unofficial','community','textbook');
- if (ref($settings) eq 'HASH') {
- if (ref($settings->{'uniquecode'}) eq 'HASH') {
- foreach my $type (@crstypes) {
- $current{$type} = $settings->{'uniquecode'}{$type};
- }
+ if (ref($settings->{'uniquecode'}) eq 'HASH') {
+ foreach my $type (@crstypes) {
+ $current{$type} = $settings->{'uniquecode'}{$type};
}
}
$output .= ''.
@@ -2170,14 +2093,14 @@ sub print_studentcode {
}
sub print_textbookcourses {
- my ($dom,$type,$settings,$rowtotal) = @_;
+ my ($dom,$settings,$rowtotal) = @_;
my $rownum = 0;
my $css_class;
my $itemcount = 1;
my $maxnum = 0;
my $bookshash;
if (ref($settings) eq 'HASH') {
- $bookshash = $settings->{$type};
+ $bookshash = $settings->{'textbooks'};
}
my %ordered;
if (ref($bookshash) eq 'HASH') {
@@ -2190,8 +2113,8 @@ sub print_textbookcourses {
}
my $confname = $dom.'-domainconfig';
my $switchserver = &check_switchserver($dom,$confname);
- my $maxnum = scalar(keys(%ordered));
- my $datatable;
+ $maxnum = scalar(keys(%ordered));
+ my $datatable = &textbookcourses_javascript(\%ordered);
if (keys(%ordered)) {
my @items = sort { $a <=> $b } keys(%ordered);
for (my $i=0; $i<@items; $i++) {
@@ -2199,24 +2122,21 @@ sub print_textbookcourses {
my $key = $ordered{$items[$i]};
my %coursehash=&Apache::lonnet::coursedescription($key);
my $coursetitle = $coursehash{'description'};
- my ($subject,$title,$author,$publisher,$image,$imgsrc,$cdom,$cnum);
+ my ($subject,$title,$author,$image,$imgsrc,$cdom,$cnum);
if (ref($bookshash->{$key}) eq 'HASH') {
$subject = $bookshash->{$key}->{'subject'};
$title = $bookshash->{$key}->{'title'};
- if ($type eq 'textbooks') {
- $publisher = $bookshash->{$key}->{'publisher'};
- $author = $bookshash->{$key}->{'author'};
- $image = $bookshash->{$key}->{'image'};
- if ($image ne '') {
- my ($path,$imagefile) = ($image =~ m{^(.+)/([^/]+)$});
- my $imagethumb = "$path/tn-".$imagefile;
- $imgsrc = '';
- }
+ $author = $bookshash->{$key}->{'author'};
+ $image = $bookshash->{$key}->{'image'};
+ if ($image ne '') {
+ my ($path,$imagefile) = ($image =~ m{^(.+)/([^/]+)$});
+ my $imagethumb = "$path/tn-".$imagefile;
+ $imgsrc = '';
}
}
- my $chgstr = ' onchange="javascript:reorderBooks(this.form,'."'$type".'_'."$key','$type'".');"';
+ my $chgstr = ' onchange="javascript:reorderBooks(this.form,'."'$key'".');"';
$datatable .= '
'
- .' | '.
''.
- ''.&mt('Subject:').' '.
+ ''.&mt('Subject:').' '.
(' 'x2).
- ''.&mt('Title:').' ';
- if ($type eq 'textbooks') {
- $datatable .= (' 'x2).
- ''.&mt('Publisher:').' '.
- (' 'x2).
- ''.&mt('Author(s):').' '.
- (' 'x2).
- ''.&mt('Thumbnail:');
- if ($image) {
- $datatable .= ''.
- $imgsrc.
- ''.&mt('Delete?').' '.
- ' '.&mt('Replace:').' ';
- }
- if ($switchserver) {
- $datatable .= &mt('Upload to library server: [_1]',$switchserver);
- } else {
- $datatable .= '';
- }
+ ''.&mt('Title:').' '.
+ (' 'x2).
+ ''.&mt('Author(s):').' '.
+ (' 'x2).
+ ''.&mt('Thumbnail:');
+ if ($image) {
+ $datatable .= ''.
+ $imgsrc.
+ ''.&mt('Delete?').' '.
+ ' '.&mt('Replace:').' ';
+ }
+ if ($switchserver) {
+ $datatable .= &mt('Upload to library server: [_1]',$switchserver);
+ } else {
+ $datatable .= '';
}
- $datatable .= ' '.
+ $datatable .= ' '.
''.&mt('LON-CAPA course:').' '.
$coursetitle.' |
'."\n";
$itemcount ++;
}
}
$css_class = $itemcount%2?' class="LC_odd_row"':'';
- my $chgstr = ' onchange="javascript:reorderBooks(this.form,'."'$type"."_addbook_pos','$type'".');"';
+ my $chgstr = ' onchange="javascript:reorderBooks(this.form,'."'addbook_pos'".');"';
$datatable .= ''."\n".
- ''."\n".
- '';
+ ''."\n".
+ '';
for (my $k=0; $k<$maxnum+1; $k++) {
my $vpos = $k+1;
my $selstr;
@@ -2272,30 +2188,26 @@ sub print_textbookcourses {
$datatable .= '';
}
$datatable .= ' '."\n".
- ''.&mt('Add').' | '."\n".
+ ''.&mt('Add').''."\n".
''.
- ''.&mt('Subject:').' '."\n".
+ ''.&mt('Subject:').' '."\n".
(' 'x2).
- ''.&mt('Title:').' '."\n".
- (' 'x2);
- if ($type eq 'textbooks') {
- $datatable .= ''.&mt('Publisher:').' '."\n".
- (' 'x2).
- ''.&mt('Author(s):').' '."\n".
- (' 'x2).
- ''.&mt('Image:').' ';
- if ($switchserver) {
- $datatable .= &mt('Upload to library server: [_1]',$switchserver);
- } else {
- $datatable .= '';
- }
+ ''.&mt('Title:').' '."\n".
+ (' 'x2).
+ ''.&mt('Author(s):').' '."\n".
+ (' 'x2).
+ ''.&mt('Image:').' ';
+ if ($switchserver) {
+ $datatable .= &mt('Upload to library server: [_1]',$switchserver);
+ } else {
+ $datatable .= '';
}
$datatable .= ''."\n".
''.&mt('LON-CAPA course:').' '.
- &Apache::loncommon::select_dom_form($env{'request.role.domain'},$type.'_addbook_cdom').
- ''.
+ &Apache::loncommon::select_dom_form($env{'request.role.domain'},'addbook_cdom').
+ ''.
&Apache::loncommon::selectcourse_link
- ('display',$type.'_addbook_cnum',$type.'_addbook_cdom',undef,undef,undef,'Course');
+ ('display','addbook_cnum','addbook_cdom',undef,undef,undef,'Course');
' | '."\n".
'
'."\n";
$itemcount ++;
@@ -2303,43 +2215,23 @@ sub print_textbookcourses {
}
sub textbookcourses_javascript {
- my ($settings) = @_;
- return unless(ref($settings) eq 'HASH');
- my (%ordered,%total,%jstext);
- foreach my $type ('textbooks','templates') {
- $total{$type} = 0;
- if (ref($settings->{$type}) eq 'HASH') {
- foreach my $item (keys(%{$settings->{$type}})) {
- if (ref($settings->{$type}->{$item}) eq 'HASH') {
- my $num = $settings->{$type}->{$item}{'order'};
- $ordered{$type}{$num} = $item;
- }
- }
- $total{$type} = scalar(keys(%{$settings->{$type}}));
- }
- my @jsarray = ();
- foreach my $item (sort {$a <=> $b } (keys(%{$ordered{$type}}))) {
- push(@jsarray,$ordered{$type}{$item});
- }
- $jstext{$type} = ' var '.$type.' = Array('."'".join("','",@jsarray)."'".');'."\n";
+ my ($textbooks) = @_;
+ return unless(ref($textbooks) eq 'HASH');
+ my $num = scalar(keys(%{$textbooks}));
+ my @jsarray;
+ foreach my $item (sort {$a <=> $b } (keys(%{$textbooks}))) {
+ push(@jsarray,$textbooks->{$item});
}
+ my $jstext = ' var textbooks = Array('."'".join("','",@jsarray)."'".');'."\n";
return <<"ENDSCRIPT";