'
.&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.")
- .' '
- .&mt('Please contact the [_1]helpdesk[_2] for assistance.'
- ,'','')
+ .' '
+ .&mt('Enter a valid e-mail address as the username for the new user.').' '.&mt('Please contact the [_1]helpdesk[_2] for assistance.'
+ ,'','')
.'
';
}
}
@@ -10810,22 +11013,23 @@ sub clean_symb {
sub needs_gci_custom {
my $custommenu;
my $numdc = &check_for_gci_dc();
+ my $udom = $env{'user.domain'};
+ return if ($udom eq '');
unless ($numdc) {
my $then=$env{'user.login.time'};
my $now = time;
- my %cnums = (
- review => '9615072b469884921gcil1',
- submit => '1H96711d710194bfegcil1',
- );
- if ($env{'user.role.st./gci/'.$cnums{'review'}}) {
+ my %allnums = &get_faculty_cnums();
+ my $cnums = $allnums{$udom};
+ return unless (ref($cnums) eq 'HASH');
+ if ($env{"user.role.st./$udom/$cnums->{'review'}"}) {
my ($start,$end) =
- split('.',$env{'user.role.st./gci/'.$cnums{'review'}});
+ split('.',$env{"user.role.st./$udom/$cnums->{'review'}"});
if (((!$start) || ($start && $start <= $now)) &&
((!$end) || ($end > $now))) {
$custommenu = 1;
- if ($env{'user.role.cc./gci/'.$cnums{'review'}}) {
+ if ($env{"user.role.cc./$udom/$cnums->{'review'}"}) {
my ($ccstart,$ccend) =
- split('.',$env{'user.role.cc./gci/'.$cnums{'review'}});
+ split('.',$env{"user.role.cc./$udom/$cnums->{'review'}"});
if (((!$start) || ($start && $start <= $now)) &&
((!$end) || ($end > $now))) {
$custommenu = '';
@@ -10837,10 +11041,20 @@ sub needs_gci_custom {
return $custommenu;
}
+sub ci_tabs {
+ my ($domain) = @_;
+ my %tabs = (
+ gci => ['review','submit','managetest','tutorial'],
+ slci => ['review'],
+ );
+ return $tabs{$domain};
+}
+
sub check_for_gci_dc {
my $then=$env{'user.login.time'};
my $numdc = 0;
- foreach my $dom ('gci','gcitest') {
+ my @doms = &Apache::lonnet::current_machine_domains();
+ foreach my $dom (@doms) {
if ($env{'user.role.dc./'.$dom.'/'}) {
my $livedc = 1;
my ($tstart,$tend)=split(/\./,$env{'user.role.dc./'.$dom.'/'});
@@ -10854,10 +11068,24 @@ sub check_for_gci_dc {
return $numdc;
}
+sub get_faculty_cnums {
+ my %cnums = (
+ gci => {
+ review => '9615072b469884921gcil1',
+ submit => '1H96711d710194bfegcil1',
+ tutorial => '5422913620b814c90gcil1',
+ },
+ slci => {
+ review => '4V80581c93ffc4c38gcil1',
+ }
+ );
+ return %cnums;
+}
+
sub existing_gcitest_courses {
my ($role) = @_;
my %courses;
- my $cdom = 'gcitest';
+ my $cdom = $env{'user.domain'}.'test';
my $now = time;
foreach my $envkey (keys(%env)) {
my $cnum;
@@ -10866,7 +11094,7 @@ sub existing_gcitest_courses {
} else {
next;
}
- my ($tstart,$tend) = split('.',$env{$envkey});
+ my ($tstart,$tend) = split(/\./,$env{$envkey});
if (((!$tstart) || ($tstart < $now)) && ((!$tend) || ($tend > $now))) {
my $descr = $env{'course.'.$cdom.'_'.$cnum.'.description'};
if ($descr ne '') {
@@ -10877,6 +11105,88 @@ sub existing_gcitest_courses {
return %courses;
}
+sub gcitest_switcher {
+ my ($role,$formname,%courses) = @_;
+ my $output;
+ my %Sortby;
+ foreach my $course (sort(keys(%courses))) {
+ next unless (ref($courses{$course}) eq 'HASH');
+ my $clean_title = $courses{$course}{'description'};
+ $clean_title =~ s/\W+//g;
+ if ($clean_title eq '') {
+ $clean_title = $courses{$course}{'description'};
+ }
+ push(@{$Sortby{$clean_title}},$course);
+ }
+ my @sorted_courses = sort { lc($a) cmp lc($b) } (keys(%Sortby));
+ my $default;
+ if (@sorted_courses > 1) {
+ if (($env{'request.course.id'}) && ($courses{$env{'request.course.id'}})) {
+ $default = &mt('Switch concept test ...');
+ } else {
+ $default = &mt('Select a concept test ...');
+ }
+ } else {
+ unless (($env{'request.course.id'}) && ($courses{$env{'request.course.id'}})) {
+ $default = &mt('Select concept test ...');
+ }
+ }
+ if ($default) {
+ $output = '';
+ }
+ return $output;
+}
+
+sub gcitest_switcher_js {
+ my ($current,$numcourses,$formname) = @_;
+ my $output = <<"ENDJS";
+
+function courseswitcher(caller) {
+ var numcourses = $numcourses;
+ var current = '$current';
+ var choice = document.$formname.newrole.options[document.$formname.newrole.selectedIndex].value;
+ if (choice == '') {
+ if (caller == 'icon') {
+ alert('No Concept Test selected');
+ }
+ document.$formname.selectrole.value = '';
+ return;
+ }
+ if (choice == current) {
+ if ((caller != 'icon') && (numcourses > 1)) {
+ alert('You have selected the current course.\\nPlease select a different Concept Test course');
+ }
+ document.$formname.newrole.selectedIndex = 0;
+ document.$formname.selectrole.value = '';
+ return;
+ }
+ document.$formname.selectrole.value = '1';
+ document.$formname.submit();
+ return;
+}
+
+ENDJS
+ return $output;
+}
+
+sub get_citest_map {
+ my ($cdom) = @_;
+ my %questionnaires = (
+ gcitest => 'default_1261144274.sequence',
+ slcitest => 'default_1261144274.sequence',
+ );
+ return $questionnaires{$cdom};
+}
+
=pod
=back