--- loncom/interface/domainprefs.pm 2016/09/18 19:22:48 1.160.6.71
+++ loncom/interface/domainprefs.pm 2016/06/06 17:40:47 1.273
@@ -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.273 2016/06/06 17:40:47 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -103,8 +103,8 @@ $datatable - HTML containing form eleme
In the case of course requests, radio buttons are displayed for each institutional
affiliate type (and also default, and _LC_adv) for each of the course types
-(official, unofficial, community, and textbook). In each case the radio buttons
-allow the selection of one of four values:
+(official, unofficial, community, textbook, and placement).
+In each case the radio buttons allow the selection of one of four values:
0, approval, validate, autolimit=N (where N is blank, or a positive integer).
which have the following effects:
@@ -173,6 +173,7 @@ use File::Copy;
use Locale::Language;
use DateTime::TimeZone;
use DateTime::Locale;
+use Time::HiRes qw( sleep );
my $registered_cleanup;
my $modified_urls;
@@ -213,15 +214,16 @@ 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',
+ 'ltitools'],$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',
+ 'ltitools','selfenrollment','usersessions');
my %existing;
if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
%existing = %{$domconfig{'loadbalancing'}};
@@ -411,6 +413,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 +443,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',
@@ -456,6 +474,15 @@ sub handler {
print => \&print_loadbalancing,
modify => \&modify_loadbalancing,
},
+ 'ltitools' =>
+ {text => 'External Tools (LTI)',
+ help => 'Domain_configuration_LTI_Tools',
+ header => [{col1 => 'Setting',
+ col2 => 'Value',}],
+ print => \&print_ltitools,
+ modify => \&modify_ltitools,
+ },
+
);
if (keys(%servers) > 1) {
$prefs{'login'} = { text => 'Log-in page options',
@@ -619,6 +646,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') {
@@ -627,6 +656,8 @@ sub process_changes {
$output = &modify_usersessions($dom,$lastactref,%domconfig);
} elsif ($action eq 'loadbalancing') {
$output = &modify_loadbalancing($dom,%domconfig);
+ } elsif ($action eq 'ltitools') {
+ $output = &modify_ltitools($r,$dom,$action,$lastactref,%domconfig);
}
return $output;
}
@@ -886,7 +917,8 @@ sub print_config_box {
if ($action eq 'quotas') {
$output .= &print_quotas($dom,$settings,\$rowtotal,$action);
} elsif (($action eq 'autoenroll') || ($action eq 'autocreate') || ($action eq 'directorysrch') ||
- ($action eq 'contacts') || ($action eq 'serverstatuses') || ($action eq 'loadbalancing')) {
+ ($action eq 'contacts') || ($action eq 'serverstatuses') || ($action eq 'loadbalancing') ||
+ ($action eq 'ltitools')) {
$output .= $item->{'print'}->($dom,$settings,\$rowtotal);
} elsif ($action eq 'scantron') {
$output .= &print_scantronformat($r,$dom,$confname,$settings,\$rowtotal);
@@ -1692,7 +1724,7 @@ sub print_quotas {
my $typecount = 0;
my ($css_class,%titles);
if ($context eq 'requestcourses') {
- @usertools = ('official','unofficial','community','textbook');
+ @usertools = ('official','unofficial','community','textbook','placement');
@options =('norequest','approval','validate','autolimit');
%validations = &Apache::lonnet::auto_courserequest_checks($dom);
%titles = &courserequest_titles();
@@ -2144,7 +2176,7 @@ sub print_studentcode {
my ($settings,$rowtotal) = @_;
my $rownum = 0;
my ($output,%current);
- my @crstypes = ('official','unofficial','community','textbook');
+ my @crstypes = ('official','unofficial','community','textbook','placement');
if (ref($settings) eq 'HASH') {
if (ref($settings->{'uniquecode'}) eq 'HASH') {
foreach my $type (@crstypes) {
@@ -2240,8 +2272,7 @@ sub print_textbookcourses {
(' 'x2).
''.&mt('Thumbnail:');
if ($image) {
- $datatable .= ''.
- $imgsrc.
+ $datatable .= $imgsrc.
' '.&mt('Delete?').' '.
' '.&mt('Replace:').' ';
@@ -2395,10 +2426,78 @@ $jstext{'templates'};
ENDSCRIPT
}
+sub ltitools_javascript {
+ my ($settings) = @_;
+ return unless(ref($settings) eq 'HASH');
+ my (%ordered,$total,%jstext);
+ $total = 0;
+ foreach my $item (keys(%{$settings})) {
+ if (ref($settings->{$item}) eq 'HASH') {
+ my $num = $settings->{$item}{'order'};
+ $ordered{$num} = $item;
+ }
+ }
+ $total = scalar(keys(%{$settings}));
+ my @jsarray = ();
+ foreach my $item (sort {$a <=> $b } (keys(%ordered))) {
+ push(@jsarray,$ordered{$item});
+ }
+ my $jstext = ' var ltitools = Array('."'".join("','",@jsarray)."'".');'."\n";
+ return <<"ENDSCRIPT";
+
+
+ENDSCRIPT
+}
+
sub print_autoenroll {
my ($dom,$settings,$rowtotal) = @_;
my $autorun = &Apache::lonnet::auto_run(undef,$dom),
- my ($defdom,$runon,$runoff,$coownerson,$coownersoff,$failsafe);
+ my ($defdom,$runon,$runoff,$coownerson,$coownersoff);
if (ref($settings) eq 'HASH') {
if (exists($settings->{'run'})) {
if ($settings->{'run'} eq '0') {
@@ -2432,9 +2531,6 @@ sub print_autoenroll {
if (exists($settings->{'sender_domain'})) {
$defdom = $settings->{'sender_domain'};
}
- if (exists($settings->{'autofailsafe'})) {
- $failsafe = $settings->{'autofailsafe'};
- }
} else {
if ($autorun) {
$runon = ' checked="checked" ';
@@ -2470,12 +2566,8 @@ sub print_autoenroll {
$coownerson.' value="1" />'.&mt('Yes').' '.
' '.&mt('No').' '.
- ''.
- ''.&mt('Failsafe for no drops when institutional data missing').' '.
- ''.
- ' ';
- $$rowtotal += 4;
+ '';
+ $$rowtotal += 3;
return $datatable;
}
@@ -2873,7 +2965,7 @@ sub radiobutton_prefs {
} else {
$datatable .= '
';
}
- $datatable .=
+ $datatable .=
''.
' '.&mt('Yes').
@@ -2887,33 +2979,379 @@ sub radiobutton_prefs {
return ($datatable,$itemcount);
}
+sub print_ltitools {
+ my ($dom,$settings,$rowtotal) = @_;
+ my $rownum = 0;
+ my $css_class;
+ my $itemcount = 1;
+ my $maxnum = 0;
+ my %ordered;
+ if (ref($settings) eq 'HASH') {
+ foreach my $item (keys(%{$settings})) {
+ if (ref($settings->{$item}) eq 'HASH') {
+ my $num = $settings->{$item}{'order'};
+ $ordered{$num} = $item;
+ }
+ }
+ }
+ my $confname = $dom.'-domainconfig';
+ my $switchserver = &check_switchserver($dom,$confname);
+ my $maxnum = scalar(keys(%ordered));
+ my $datatable = <itools_javascript($settings);
+ my %lt = <itools_names();
+ my @courseroles = ('cc','in','ta','ep','st');
+ my @ltiroles = qw(Instructor ContentDeveloper TeachingAssistant Learner);
+ my @fields = ('fullname','firstname','lastname','email','user','roles');
+ if (keys(%ordered)) {
+ my @items = sort { $a <=> $b } keys(%ordered);
+ for (my $i=0; $i<@items; $i++) {
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ my $item = $ordered{$items[$i]};
+ my ($title,$key,$secret,$url,$imgsrc,$version);
+ if (ref($settings->{$item}) eq 'HASH') {
+ $title = $settings->{$item}->{'title'};
+ $url = $settings->{$item}->{'url'};
+ $key = $settings->{$item}->{'key'};
+ $secret = $settings->{$item}->{'secret'};
+ my $image = $settings->{$item}->{'image'};
+ if ($image ne '') {
+ $imgsrc = ' ';
+ }
+ }
+ my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'ltitools_".$item."'".');"';
+ $datatable .= ''
+ .'';
+ for (my $k=0; $k<=$maxnum; $k++) {
+ my $vpos = $k+1;
+ my $selstr;
+ if ($k == $i) {
+ $selstr = ' selected="selected" ';
+ }
+ $datatable .= ''.$vpos.' ';
+ }
+ $datatable .= ' '.(' 'x2).
+ ' '.
+ &mt('Delete?').' '.
+ ''.
+ ''.&mt('Required settings').' '.
+ ''.$lt{'title'}.': '.
+ (' 'x2).
+ ''.$lt{'version'}.':'.
+ '1.1 '.
+ (' 'x2).
+ ''.$lt{'msgtype'}.':'.
+ 'Launch '.
+ ' '.
+ ''.$lt{'url'}.': '.
+ (' 'x2).
+ ''.$lt{'key'}.
+ ' '.
+ (' 'x2).
+ ''.$lt{'secret'}.':'.
+ ' '.
+ ' '.&mt('Visible input').' '.
+ ' '.
+ ' '.
+ ''.&mt('Optional settings').' '.
+ ''.&mt('Display target:');
+ my %currdisp;
+ if (ref($settings->{$item}->{'display'}) eq 'HASH') {
+ if ($settings->{$item}->{'display'}->{'target'} eq 'window') {
+ $currdisp{'window'} = ' checked="checked"';
+ } else {
+ $currdisp{'iframe'} = ' checked="checked"';
+ }
+ if ($settings->{$item}->{'display'}->{'width'} =~ /^(\d+)$/) {
+ $currdisp{'width'} = $1;
+ }
+ if ($settings->{$item}->{'display'}->{'height'} =~ /^(\d+)$/) {
+ $currdisp{'height'} = $1;
+ }
+ } else {
+ $currdisp{'iframe'} = ' checked="checked"';
+ }
+ foreach my $disp ('iframe','window') {
+ $datatable .= ' '.
+ $lt{$disp}.' '.(' 'x2);
+ }
+ $datatable .= (' 'x4);
+ foreach my $dimen ('width','height') {
+ $datatable .= ''.$lt{$dimen}.' '.
+ ' '.
+ (' 'x2);
+ }
+ $datatable .= ' ';
+ foreach my $extra ('passback','roster') {
+ my $checkedon = '';
+ my $checkedoff = ' checked="checked"';
+ if ($settings->{$item}->{$extra}) {
+ $checkedon = $checkedoff;
+ $checkedoff = '';
+ }
+ $datatable .= $lt{$extra}.' '.
+ ' '.
+ &mt('Yes').' '.(' 'x2).
+ ' '.
+ &mt('No').' '.(' 'x4);
+ }
+ $datatable .= ''.$lt{'icon'}.': ';
+ if ($imgsrc) {
+ $datatable .= $imgsrc.
+ ' '.&mt('Delete?').' '.
+ ' '.&mt('Replace:').' ';
+ } else {
+ $datatable .= '('.&mt('if larger than 21x21 pixels, image will be scaled').') ';
+ }
+ if ($switchserver) {
+ $datatable .= &mt('Upload to library server: [_1]',$switchserver);
+ } else {
+ $datatable .= ' ';
+ }
+ $datatable .= ' ';
+ my (%checkedfields,%rolemaps);
+ if (ref($settings->{$item}) eq 'HASH') {
+ if (ref($settings->{$item}->{'fields'}) eq 'HASH') {
+ %checkedfields = %{$settings->{$item}->{'fields'}};
+ }
+ if (ref($settings->{$item}->{'roles'}) eq 'HASH') {
+ %rolemaps = %{$settings->{$item}->{'roles'}};
+ $checkedfields{'roles'} = 1;
+ }
+ }
+ $datatable .= ''.&mt('User data sent on launch').' '.
+ '';
+ foreach my $field (@fields) {
+ my $checked;
+ if ($checkedfields{$field}) {
+ $checked = ' checked="checked"';
+ }
+ $datatable .= ''.
+ ' '.
+ $lt{$field}.' '.(' ' x2);
+ }
+ $datatable .= ' '.
+ ''.&mt('Role mapping').' ';
+ foreach my $role (@courseroles) {
+ my ($selected,$selectnone);
+ if (!$rolemaps{$role}) {
+ $selectnone = ' selected="selected"';
+ }
+ $datatable .= ''.
+ &Apache::lonnet::plaintext($role,'Course').' '.
+ ''.
+ ''.&mt('Select').' ';
+ foreach my $ltirole (@ltiroles) {
+ unless ($selectnone) {
+ if ($rolemaps{$role} eq $ltirole) {
+ $selected = ' selected="selected"';
+ } else {
+ $selected = '';
+ }
+ }
+ $datatable .= ''.$ltirole.' ';
+ }
+ $datatable .= ' ';
+ }
+ $datatable .= '
';
+ my %courseconfig;
+ if (ref($settings->{$item}) eq 'HASH') {
+ if (ref($settings->{$item}->{'crsconf'}) eq 'HASH') {
+ %courseconfig = %{$settings->{$item}->{'crsconf'}};
+ }
+ }
+ $datatable .= ''.&mt('Configurable in course').' ';
+ foreach my $item ('label','title','target') {
+ my $checked;
+ if ($courseconfig{$item}) {
+ $checked = ' checked="checked"';
+ }
+ $datatable .= ''.
+ ' '.
+ $lt{'crs'.$item}.' '.(' ' x2)."\n";
+ }
+ $datatable .= ' '.
+ ''.&mt('Custom items sent on launch').' '.
+ ' '."\n";
+ $itemcount ++;
+ }
+ }
+ $css_class = $itemcount%2?' class="LC_odd_row"':'';
+ my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'ltitools_add_pos'".');"';
+ $datatable .= ''."\n".
+ ' '."\n".
+ '';
+ for (my $k=0; $k<$maxnum+1; $k++) {
+ my $vpos = $k+1;
+ my $selstr;
+ if ($k == $maxnum) {
+ $selstr = ' selected="selected" ';
+ }
+ $datatable .= ''.$vpos.' ';
+ }
+ $datatable .= ' '."\n".
+ ' '.&mt('Add').' '."\n".
+ ''.
+ ''.&mt('Required settings').' '.
+ ''.$lt{'title'}.': '."\n".
+ (' 'x2).
+ ''.$lt{'version'}.':'.
+ '1.1 '."\n".
+ (' 'x2).
+ ''.$lt{'msgtype'}.':'.
+ 'Launch '.
+ ' '.
+ ''.$lt{'url'}.': '."\n".
+ (' 'x2).
+ ''.$lt{'key'}.': '."\n".
+ (' 'x2).
+ ''.$lt{'secret'}.': '.
+ ' '.&mt('Visible input').' '."\n".
+ ' '.
+ ''.&mt('Optional settings').' '.
+ ''.&mt('Display target:');
+ my %defaultdisp;
+ $defaultdisp{'iframe'} = ' checked="checked"';
+ foreach my $disp ('iframe','window') {
+ $datatable .= ' '.
+ $lt{$disp}.' '.(' 'x2);
+ }
+ $datatable .= (' 'x4);
+ foreach my $dimen ('width','height') {
+ $datatable .= ''.$lt{$dimen}.' '.
+ ' '.
+ (' 'x2);
+ }
+ $datatable .= ' ';
+ foreach my $extra ('passback','roster') {
+ $datatable .= $lt{$extra}.' '.
+ ' '.
+ &mt('Yes').' '.(' 'x2).
+ ' '.
+ &mt('No').' '.(' 'x4);
+ }
+ $datatable .= ''.$lt{'icon'}.': '.
+ '('.&mt('if larger than 21x21 pixels, image will be scaled').') ';
+ if ($switchserver) {
+ $datatable .= &mt('Upload to library server: [_1]',$switchserver);
+ } else {
+ $datatable .= ' ';
+ }
+ $datatable .= ' '.
+ ''.&mt('User data sent on launch').' '.
+ '';
+ foreach my $field (@fields) {
+ $datatable .= ''.
+ ' '.
+ $lt{$field}.' '.(' ' x2);
+ }
+ $datatable .= ' '.
+ ''.&mt('Role mapping').' ';
+ foreach my $role (@courseroles) {
+ my ($checked,$checkednone);
+ $datatable .= ''.
+ &Apache::lonnet::plaintext($role,'Course').' '.
+ ''.
+ ''.&mt('Select').' ';
+ foreach my $ltirole (@ltiroles) {
+ $datatable .= ''.$ltirole.' ';
+ }
+ $datatable .= ' ';
+ }
+ $datatable .= '
'.
+ ''.&mt('Configurable in course').' ';
+ foreach my $item ('label','title','target') {
+ $datatable .= ''.
+ ' '.
+ $lt{'crs'.$item}.' '.(' ' x2)."\n";
+ }
+ $datatable .= ' '.
+ ''.&mt('Custom items sent on launch').' '.
+ ' '."\n".
+ ' '."\n".
+ ''."\n";
+ $itemcount ++;
+ return $datatable;
+}
+
+sub ltitools_names {
+ my %lt = &Apache::lonlocal::texthash(
+ 'title' => 'Title',
+ 'version' => 'Version',
+ 'msgtype' => 'Message Type',
+ 'url' => 'URL',
+ 'key' => 'Key',
+ 'secret' => 'Secret',
+ 'icon' => 'Icon',
+ 'user' => 'Username:domain',
+ 'fullname' => 'Full Name',
+ 'firstname' => 'First Name',
+ 'lastname' => 'Last Name',
+ 'email' => 'E-mail',
+ 'roles' => 'Role',
+ 'window' => 'Window/Tab',
+ 'iframe' => 'iFrame',
+ 'height' => 'Height',
+ 'width' => 'Width',
+ 'passback' => 'Tool can return grades:',
+ 'roster' => 'Tool can retrieve roster:',
+ 'crstarget' => 'Display target',
+ 'crslabel' => 'Course label',
+ 'crstitle' => 'Course title',
+ );
+ return %lt;
+}
+
sub print_coursedefaults {
my ($position,$dom,$settings,$rowtotal) = @_;
my ($css_class,$datatable,%checkedon,%checkedoff,%defaultchecked,@toggles);
my $itemcount = 1;
my %choices = &Apache::lonlocal::texthash (
+ canuse_pdfforms => 'Course/Community users can create/upload PDF forms',
uploadquota => 'Default quota for files uploaded directly to course/community using Course Editor (MB)',
anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys',
coursecredits => 'Credits can be specified for courses',
uselcmath => 'Math preview uses LON-CAPA previewer (javascript) in place of DragMath (Java)',
usejsme => 'Molecule editor uses JSME (HTML5) in place of JME (Java)',
postsubmit => 'Disable submit button/keypress following student submission',
- canclone => "People who may clone a course (besides course's owner and coordinators)",
- mysqltables => 'Lifetime (s) of "Temporary" MySQL tables (student performance data) on homeserver',
+ canclone => "People who may clone a course (besides course's owner and coordinators)",
);
my %staticdefaults = (
anonsurvey_threshold => 10,
uploadquota => 500,
postsubmit => 60,
- mysqltables => 172800,
);
if ($position eq 'top') {
%defaultchecked = (
+ 'canuse_pdfforms' => 'off',
'uselcmath' => 'on',
'usejsme' => 'on',
- 'canclone' => 'none',
+ 'canclone' => 'none',
);
- @toggles = ('uselcmath','usejsme');
+ @toggles = ('canuse_pdfforms','uselcmath','usejsme');
($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
\%choices,$itemcount);
$css_class = $itemcount%2?' class="LC_odd_row"':'';
@@ -2950,7 +3388,7 @@ sub print_coursedefaults {
$currcanclone = $settings->{'canclone'};
}
}
- }
+ }
foreach my $option (@cloneoptions) {
my ($checked,$additional);
if ($currcanclone eq $option) {
@@ -2989,10 +3427,10 @@ sub print_coursedefaults {
$itemcount ++;
} else {
$css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
- my ($currdefresponder,%defcredits,%curruploadquota,%deftimeout,%currmysql);
+ my ($currdefresponder,%defcredits,%curruploadquota,%deftimeout);
my $currusecredits = 0;
my $postsubmitclient = 1;
- my @types = ('official','unofficial','community','textbook');
+ my @types = ('official','unofficial','community','textbook','placement');
if (ref($settings) eq 'HASH') {
$currdefresponder = $settings->{'anonsurvey_threshold'};
if (ref($settings->{'uploadquota'}) eq 'HASH') {
@@ -3019,7 +3457,7 @@ sub print_coursedefaults {
foreach my $type (@types) {
if (ref($settings->{'postsubmit'}->{'timeout'}) eq 'HASH') {
if ($settings->{'postsubmit'}->{'timeout'}->{$type} =~ /^\d+$/) {
- $deftimeout{$type} = $settings->{'postsubmit'}->{'timeout'}->{$type};
+ $deftimeout{$type} = $settings->{'postsubmit'}->{'timeout'}->{$type};
} else {
$deftimeout{$type} = $staticdefaults{'postsubmit'};
}
@@ -3033,15 +3471,6 @@ sub print_coursedefaults {
$deftimeout{$type} = $staticdefaults{'postsubmit'};
}
}
- if (ref($settings->{'mysqltables'}) eq 'HASH') {
- foreach my $type (keys(%{$settings->{'mysqltables'}})) {
- $currmysql{$type} = $settings->{'mysqltables'}{$type};
- }
- } else {
- foreach my $type (@types) {
- $currmysql{$type} = $staticdefaults{'mysqltables'};
- }
- }
} else {
foreach my $type (@types) {
$deftimeout{$type} = $staticdefaults{'postsubmit'};
@@ -3119,27 +3548,13 @@ sub print_coursedefaults {
$additional .= ''."\n";
%defaultchecked = ('postsubmit' => 'on');
@toggles = ('postsubmit');
- $current = {
- 'postsubmit' => $postsubmitclient,
- };
+ my $current = {
+ 'postsubmit' => $postsubmitclient,
+ };
($table,$itemcount) =
&radiobutton_prefs($current,\@toggles,\%defaultchecked,
\%choices,$itemcount,$onclick,$additional,'left');
$datatable .= $table;
- $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
- $datatable .= ''.
- $choices{'mysqltables'}.
- ' '.
- ''.
- ' '."\n";
- $itemcount ++;
-
}
$$rowtotal += $itemcount;
return $datatable;
@@ -3149,7 +3564,7 @@ sub print_selfenrollment {
my ($position,$dom,$settings,$rowtotal) = @_;
my ($css_class,$datatable);
my $itemcount = 1;
- my @types = ('official','unofficial','community','textbook');
+ my @types = ('official','unofficial','community','textbook','placement');
if (($position eq 'top') || ($position eq 'middle')) {
my ($rowsref,$titlesref) = &Apache::lonuserutils::get_selfenroll_titles();
my %descs = &Apache::lonuserutils::selfenroll_default_descs();
@@ -3672,7 +4087,7 @@ sub spares_row {
'.
&mt('[_1] when busy, offloads to:'
,''.$server.' ').' '.
- ''."\n".
+ ''."\n".
' '.
' '.&mt('Switch active users on next access').' '.
"\n";
@@ -4168,6 +4583,7 @@ sub tool_titles {
unofficial => 'Unofficial courses',
community => 'Communities',
textbook => 'Textbook courses',
+ placement => 'Placement tests',
);
return %titles;
}
@@ -4178,6 +4594,7 @@ sub courserequest_titles {
unofficial => 'Unofficial',
community => 'Communities',
textbook => 'Textbook',
+ placement => 'Placement tests',
norequest => 'Not allowed',
approval => 'Approval by Dom. Coord.',
validate => 'With validation',
@@ -4568,7 +4985,7 @@ sub email_as_username {
sub captcha_choice {
my ($context,$settings,$itemcount) = @_;
my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext,
- $vertext,$currver);
+ $vertext,$currver);
my %lt = &captcha_phrases();
$keyentry = 'hidden';
if ($context eq 'cancreate') {
@@ -5162,6 +5579,10 @@ sub print_coursecategories {
my $toggle_catscomm_dom = ' checked="checked" ';
my $can_catcomm_comm = ' ';
my $can_catcomm_dom = ' checked="checked" ';
+ my $toggle_catsplace_place = ' ';
+ my $toggle_catsplace_dom = ' checked="checked" ';
+ my $can_catplace_place = ' ';
+ my $can_catplace_dom = ' checked="checked" ';
if (ref($settings) eq 'HASH') {
if ($settings->{'togglecats'} eq 'crs') {
@@ -5180,17 +5601,28 @@ sub print_coursecategories {
$can_catcomm_comm = $can_catcomm_dom;
$can_catcomm_dom = ' ';
}
+ if ($settings->{'togglecatsplace'} eq 'place') {
+ $toggle_catsplace_place = $toggle_catsplace_dom;
+ $toggle_catsplace_dom = ' ';
+ }
+ if ($settings->{'categorizeplace'} eq 'place') {
+ $can_catplace_place = $can_catplace_dom;
+ $can_catplace_dom = ' ';
+ }
}
my %title = &Apache::lonlocal::texthash (
- togglecats => 'Show/Hide a course in catalog',
- togglecatscomm => 'Show/Hide a community in catalog',
- categorize => 'Assign a category to a course',
- categorizecomm => 'Assign a category to a community',
+ togglecats => 'Show/Hide a course in catalog',
+ togglecatscomm => 'Show/Hide a community in catalog',
+ togglecatsplace => 'Show/Hide a placement test in catalog',
+ categorize => 'Assign a category to a course',
+ categorizecomm => 'Assign a category to a community',
+ categorizeplace => 'Assign a category to a placement test',
);
my %level = &Apache::lonlocal::texthash (
- dom => 'Set in Domain',
- crs => 'Set in Course',
- comm => 'Set in Community',
+ dom => 'Set in Domain',
+ crs => 'Set in Course',
+ comm => 'Set in Community',
+ place => 'Set in Placement Test',
);
$datatable = ''.
''.$title{'togglecats'}.' '.
@@ -5220,8 +5652,22 @@ sub print_coursecategories {
$can_catcomm_dom.' value="dom" />'.$level{'dom'}.' '.
' '.$level{'comm'}.' '.
+ ' '.
+ ''.$title{'togglecatsplace'}.' '.
+ ''.
+ ' '.$level{'dom'}.' '.
+ ' '.$level{'place'}.' '.
+ ' '.
+ ''.$title{'categorizeplace'}.' '.
+ ''.
+ ' '.$level{'dom'}.' '.
+ ' '.$level{'place'}.' '.
' ';
- $$rowtotal += 4;
+ $$rowtotal += 6;
} else {
my $css_class;
my $itemcount = 1;
@@ -5246,12 +5692,15 @@ sub print_coursecategories {
my %default_names = (
instcode => &mt('Official courses'),
communities => &mt('Communities'),
+ placement => &mt('Placement Tests'),
);
if ((!grep(/^instcode$/,@{$cats[0]})) ||
($cathash->{'instcode::0'} eq '') ||
(!grep(/^communities$/,@{$cats[0]})) ||
- ($cathash->{'communities::0'} eq '')) {
+ ($cathash->{'communities::0'} eq '') ||
+ (!grep(/^placement$/,@{$cats[0]})) ||
+ ($cathash->{'placement::0'} eq '')) {
$maxnum ++;
}
my $lastidx;
@@ -5272,7 +5721,7 @@ sub print_coursecategories {
$datatable .= ''.$vpos.' ';
}
$datatable .= ' ';
- if ($parent eq 'instcode' || $parent eq 'communities') {
+ if ($parent eq 'instcode' || $parent eq 'communities' || $parent eq 'placement') {
$datatable .= ''
.$default_names{$parent}.' ';
if ($parent eq 'instcode') {
@@ -5295,7 +5744,7 @@ sub print_coursecategories {
$datatable .= ' '
.&mt('Do not display').' ';
- if ($parent eq 'communities') {
+ if (($parent eq 'communities') || ($parent eq 'placement')) {
$datatable .= ' ';
}
$datatable .= '';
@@ -5327,7 +5776,7 @@ sub print_coursecategories {
.' '
.''."\n";
$itemcount ++;
- foreach my $default ('instcode','communities') {
+ foreach my $default ('instcode','communities','placement') {
if ((!grep(/^\Q$default\E$/,@{$cats[0]})) || ($cathash->{$default.'::0'} eq '')) {
$css_class = $itemcount%2?' class="LC_odd_row"':'';
my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','$default"."_pos','$lastidx'".');"';
@@ -5423,7 +5872,7 @@ sub serverstatus_pages {
sub defaults_javascript {
my ($settings) = @_;
- return unless (ref($settings) eq 'HASH');
+ return unless (ref($settings) eq 'HASH');
if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) {
my $maxnum = scalar(@{$settings->{'inststatusorder'}});
if ($maxnum eq '') {
@@ -5508,9 +5957,11 @@ sub coursecategories_javascript {
}
my $instcode_reserved = &mt('The name: [_1] is a reserved category.','"instcode"');
my $communities_reserved = &mt('The name: [_1] is a reserved category.','"communities"');
+ my $placement_reserved = &mt('The name: [_1] is a reserved category.','"placement"');
my $choose_again = "\n".&mt('Please use a different name for the new top level category.');
&js_escape(\$instcode_reserved);
&js_escape(\$communities_reserved);
+ &js_escape(\$placement_reserved);
&js_escape(\$choose_again);
$output = <<"ENDSCRIPT";