version 1.8.4.1, 2009/12/07 18:37:11
|
version 1.8.4.5, 2009/12/15 05:17:52
|
Line 81 ENDSCRIPT
|
Line 81 ENDSCRIPT
|
$switcher_js = &gcitest_switcher_js($current,$numcourses); |
$switcher_js = &gcitest_switcher_js($current,$numcourses); |
$script_tag= <<"ENDSCRIPT"; |
$script_tag= <<"ENDSCRIPT"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
|
// <![CDATA[ |
|
|
$switcher_js |
$switcher_js |
|
|
|
// ]]> |
</script> |
</script> |
ENDSCRIPT |
ENDSCRIPT |
} |
} |
Line 113 sub gcitest_switcher {
|
Line 117 sub gcitest_switcher {
|
my $clean_title = $courses{$course}{'description'}; |
my $clean_title = $courses{$course}{'description'}; |
$clean_title =~ s/\W+//g; |
$clean_title =~ s/\W+//g; |
if ($clean_title eq '') { |
if ($clean_title eq '') { |
$clean_title = $courseinfo{$course}{'description'}; |
$clean_title = $courses{$course}{'description'}; |
} |
} |
push(@{$Sortby{$clean_title}},$course); |
push(@{$Sortby{$clean_title}},$course); |
} |
} |
Line 132 sub gcitest_switcher {
|
Line 136 sub gcitest_switcher {
|
} |
} |
if ($default) { |
if ($default) { |
$output = '<form name="pickrole" action="/adm/roles" method="post">'. |
$output = '<form name="pickrole" action="/adm/roles" method="post">'. |
'<select name="newrole" method="post" onchange="javascript:courseswitcher();">'. |
'<select name="newrole" onchange="javascript:courseswitcher();">'. |
'<option value="" selected="selected">'.$default.'</option>'; |
'<option value="" selected="selected">'.$default.'</option>'; |
foreach my $item (@sorted_courses) { |
foreach my $item (@sorted_courses) { |
foreach my $course (@{$Sortby{$item}}) { |
foreach my $course (@{$Sortby{$item}}) { |
my ($cdom,$cnum) = split('_',$course); |
my ($cdom,$cnum) = split('_',$course); |
$output .= '<option value="cc./'.$cdom.'/'.$cnum.'">'.$item.'</option>'; |
$output .= '<option value="cc./'.$cdom.'/'.$cnum.'">'.$courses{$course}{'description'}.'</option>'; |
} |
} |
} |
} |
$output .= '</select><input type="hidden" name="selectrole" value="" /></form>'; |
$output .= '</select><input type="hidden" name="selectrole" value="" /></form>'; |
Line 145 sub gcitest_switcher {
|
Line 149 sub gcitest_switcher {
|
return $output; |
return $output; |
} |
} |
|
|
|
sub gcitest_switcher_js { |
|
my ($current,$numcourses) = @_; |
|
my $output = <<"ENDJS"; |
|
|
|
function courseswitcher(caller) { |
|
var numcourses = $numcourses; |
|
var current = '$current'; |
|
var choice = document.pickrole.newrole.options[document.pickrole.newrole.selectedIndex].value; |
|
if (choice == '') { |
|
if (caller == 'icon') { |
|
alert('No Concept Test selected'); |
|
} |
|
document.pickrole.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.pickrole.newrole.selectedIndex = 0; |
|
document.pickrole.selectrole.value = ''; |
|
return; |
|
} |
|
document.pickrole.selectrole.value = '1'; |
|
document.pickrole.submit(); |
|
return; |
|
} |
|
|
|
ENDJS |
|
return $output; |
|
} |
|
|
1; |
1; |
__END__ |
__END__ |
|
|