version 1.146, 2006/07/27 22:27:08
|
version 1.155, 2006/12/05 02:55:53
|
Line 60 use Time::Local;
|
Line 60 use Time::Local;
|
use Time::HiRes; |
use Time::HiRes; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonnet; |
use Apache::lonnet; |
use lib '/home/httpd/lib/perl/'; |
|
use LONCAPA; |
use LONCAPA; |
|
|
############################################## |
############################################## |
Line 78 use LONCAPA;
|
Line 77 use LONCAPA;
|
sub authorbombs { |
sub authorbombs { |
my $url=shift; |
my $url=shift; |
$url=&Apache::lonnet::declutter($url); |
$url=&Apache::lonnet::declutter($url); |
my ($udom,$uname)=($url=~/^(\w+)\/(\w+)\//); |
my ($udom,$uname)=($url=~m{^($LONCAPA::domain_re)/($LONCAPA::username_re)/}); |
my %bombs=&Apache::lonmsg::all_url_author_res_msg($uname,$udom); |
my %bombs=&Apache::lonmsg::all_url_author_res_msg($uname,$udom); |
foreach (keys %bombs) { |
foreach (keys %bombs) { |
if ($_=~/^$udom\/$uname\//) { |
if ($_=~/^$udom\/$uname\//) { |
Line 689 sub StatusOptions {
|
Line 688 sub StatusOptions {
|
$status = $env{'form.Status'} if (exists($env{'form.Status'})); |
$status = $env{'form.Status'} if (exists($env{'form.Status'})); |
} |
} |
|
|
my $OpSel1 = ''; |
|
my $OpSel2 = ''; |
|
my $OpSel3 = ''; |
|
|
|
if($status eq 'Any') { $OpSel3 = ' selected'; } |
|
elsif($status eq 'Expired' ) { $OpSel2 = ' selected'; } |
|
else { $OpSel1 = ' selected'; } |
|
|
|
my $Str = ''; |
my $Str = ''; |
$Str .= '<select name="Status"'; |
$Str .= '<select name="Status"'; |
if(defined($formName) && $formName ne '' && ! defined($onchange)) { |
if(defined($formName) && $formName ne '' && ! defined($onchange)) { |
Line 707 sub StatusOptions {
|
Line 698 sub StatusOptions {
|
} |
} |
$Str .= ' size="'.$size.'" '; |
$Str .= ' size="'.$size.'" '; |
$Str .= '>'."\n"; |
$Str .= '>'."\n"; |
$Str .= '<option value="Active" '.$OpSel1.'>'. |
foreach my $type (['Active', &mt('Currently Has Access')], |
&mt('Currently Enrolled').'</option>'."\n"; |
['Future', &mt('Will Have Future Access')], |
$Str .= '<option value="Expired" '.$OpSel2.'>'. |
['Expired', &mt('Previously Had Access')], |
&mt('Previously Enrolled').'</option>'."\n"; |
['Any', &mt('Any Access Status')]) { |
$Str .= '<option value="Any" '.$OpSel3.'>'. |
my ($name,$label) = @$type; |
&mt('Any Enrollment Status').'</option>'."\n"; |
$Str .= '<option value="'.$name.'" '; |
|
if ($status eq $name) { |
|
$Str .= 'selected="selected" '; |
|
} |
|
$Str .= '>'.$label.'</option>'."\n"; |
|
} |
|
|
$Str .= '</select>'."\n"; |
$Str .= '</select>'."\n"; |
} |
} |
|
|
Line 1014 sub crumbs {
|
Line 1011 sub crumbs {
|
$output.=qq{<a href="$linkpath" $target>$dir</a>/}; |
$output.=qq{<a href="$linkpath" $target>$dir</a>/}; |
} |
} |
} else { |
} else { |
$output.=$uri; |
foreach my $dir (split('/',$uri)) { |
|
if (! $dir) { next; } |
|
$output.=$dir.'/'; |
|
} |
} |
} |
unless ($uri=~/\/$/) { $output=~s/\/$//; } |
if ($uri !~ m|/$|) { $output=~s|/$||; } |
return $output.'</font>'.($noformat?'':'</b></tt><br />'); |
return $output.'</font>'.($noformat?'':'</b></tt><br />'); |
} |
} |
|
|
Line 1045 var checkwin;
|
Line 1045 var checkwin;
|
function spellcheckerwindow(string) { |
function spellcheckerwindow(string) { |
var esc_string = string.replace(/\"/g,'"'); |
var esc_string = string.replace(/\"/g,'"'); |
checkwin=window.open($nothing,'spellcheckwin','height=320,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no'); |
checkwin=window.open($nothing,'spellcheckwin','height=320,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no'); |
checkwin.document.writeln('$start_page<form name="spellcheckform" action="/adm/spellcheck" method="post"><input type="hidden" name="text" value="'+esc_string+'" /><\/form>$end_page'); |
checkwin.document.writeln('$start_page<form name="spellcheckform" action="/adm/spellcheck" method="post"><input type="hidden" name="text" value="'+esc_string+'" /><\\/form>$end_page'); |
checkwin.document.close(); |
checkwin.document.close(); |
} |
} |
// END LON-CAPA Internal --> |
// END LON-CAPA Internal --> |
Line 1418 ENDTWO
|
Line 1418 ENDTWO
|
} |
} |
|
|
sub role_select_row { |
sub role_select_row { |
my ($roles,$title,$css_class) = @_; |
my ($roles,$title,$css_class,$show_separate_custom,$cdom,$cnum) = @_; |
my $output; |
my $output; |
if (defined($title)) { |
if (defined($title)) { |
$output = &row_title($title,$css_class); |
$output = &row_title($title,$css_class); |
Line 1429 sub role_select_row {
|
Line 1429 sub role_select_row {
|
my $plrole; |
my $plrole; |
if ($role eq 'ow') { |
if ($role eq 'ow') { |
$plrole = &mt('Course Owner'); |
$plrole = &mt('Course Owner'); |
|
} elsif ($role eq 'cr') { |
|
if ($show_separate_custom) { |
|
if ($cdom ne '' && $cnum ne '') { |
|
my %course_customroles = &course_custom_roles($cdom,$cnum); |
|
foreach my $crrole (sort(keys(%course_customroles))) { |
|
my ($plcrrole) = ($crrole =~ m|^cr/[^/]+/[^/]+/(.+)$|); |
|
$output .= ' <option value="'.$crrole.'">'.$plcrrole. |
|
'</option>'; |
|
} |
|
} |
|
} else { |
|
$plrole = &mt('Custom Role'); |
|
} |
} else { |
} else { |
$plrole=&Apache::lonnet::plaintext($role); |
$plrole=&Apache::lonnet::plaintext($role); |
} |
} |
$output .= ' <option value="'.$role.'">'.$plrole.'</option>'; |
if (($role ne 'cr') || (!$show_separate_custom)) { |
|
$output .= ' <option value="'.$role.'">'.$plrole.'</option>'; |
|
} |
} |
} |
$output .= qq| </select>\n|; |
$output .= qq| </select>\n|; |
if (defined($title)) { |
if (defined($title)) { |
Line 1585 sub submit_row {
|
Line 1600 sub submit_row {
|
return $output; |
return $output; |
} |
} |
|
|
|
sub course_custom_roles { |
|
my ($cdom,$cnum) = @_; |
|
my %returnhash=(); |
|
my %coursepersonnel=&Apache::lonnet::dump('nohist_userroles',$cdom,$cnum); |
|
foreach my $person (sort(keys(%coursepersonnel))) { |
|
my ($role) = ($person =~ /^([^:]+):/); |
|
my ($end,$start) = split(/:/,$coursepersonnel{$person}); |
|
if ($end == -1 && $start == -1) { |
|
next; |
|
} |
|
if ($role =~ m|^cr/[^/]+/[^/]+/[^/]|) { |
|
$returnhash{$role} ++; |
|
} |
|
} |
|
return %returnhash; |
|
} |
|
|
|
|
############################################## |
############################################## |
############################################## |
############################################## |
|
|
Line 1723 sub set_form_elements {
|
Line 1756 sub set_form_elements {
|
my $valuestring = join('","',@{$values{$name}}); |
my $valuestring = join('","',@{$values{$name}}); |
$output .= qq| |
$output .= qq| |
var textvalues = new Array ("$valuestring"); |
var textvalues = new Array ("$valuestring"); |
var total = courseForm.$name.length; |
var total = courseForm.elements['$name'].length; |
if (total > $numvalues) { |
if (total > $numvalues) { |
total = $numvalues; |
total = $numvalues; |
} |
} |
for (var i=0; i<total; i++) { |
for (var i=0; i<total; i++) { |
courseForm.$name\[i].value = textvalues[i]; |
courseForm.elements['$name']\[i].value = textvalues[i]; |
} |
} |
|; |
|; |
} else { |
} else { |
$output .= qq| |
$output .= qq| |
courseForm.$name.value = "$values{$name}[0]"; |
courseForm.elements['$name'].value = "$values{$name}[0]"; |
|; |
|; |
} |
} |
} else { |
} else { |
$output .= qq| |
$output .= qq| |
var elementLength = courseForm.$name.length; |
var elementLength = courseForm.elements['$name'].length; |
if (elementLength==undefined) { |
if (elementLength==undefined) { |
|; |
|; |
foreach my $value (@{$values{$name}}) { |
foreach my $value (@{$values{$name}}) { |
if ($$elements{$name} eq 'selectbox') { |
if ($$elements{$name} eq 'selectbox') { |
$output .= qq| |
$output .= qq| |
if (courseForm.$name.options[0].value == "$value") { |
if (courseForm.elements['$name'].options[0].value == "$value") { |
courseForm.$name.options[0].selected = true; |
courseForm.elements['$name'].options[0].selected = true; |
}|; |
}|; |
} elsif (($$elements{$name} eq 'radio') || |
} elsif (($$elements{$name} eq 'radio') || |
($$elements{$name} eq 'checkbox')) { |
($$elements{$name} eq 'checkbox')) { |
$output .= qq| |
$output .= qq| |
if (courseForm.$name.value == "$value") { |
if (courseForm.elements['$name'].value == "$value") { |
courseForm.$name.checked = true; |
courseForm.elements['$name'].checked = true; |
}|; |
}|; |
} |
} |
} |
} |
$output .= qq| |
$output .= qq| |
} |
} |
else { |
else { |
for (var i=0; i<courseForm.$name.length; i++) { |
for (var i=0; i<courseForm.elements['$name'].length; i++) { |
|; |
|; |
if ($$elements{$name} eq 'selectbox') { |
if ($$elements{$name} eq 'selectbox') { |
$output .= qq| |
$output .= qq| |
courseForm.$name.options[i].selected = false;|; |
courseForm.elements['$name'].options[i].selected = false;|; |
} elsif (($$elements{$name} eq 'radio') || |
} elsif (($$elements{$name} eq 'radio') || |
($$elements{$name} eq 'checkbox')) { |
($$elements{$name} eq 'checkbox')) { |
$output .= qq| |
$output .= qq| |
courseForm.$name\[i].checked = false;|; |
courseForm.elements['$name']\[i].checked = false;|; |
} |
} |
$output .= qq| |
$output .= qq| |
} |
} |
for (var j=0; j<courseForm.$name.length; j++) { |
for (var j=0; j<courseForm.elements['$name'].length; j++) { |
|; |
|; |
foreach my $value (@{$values{$name}}) { |
foreach my $value (@{$values{$name}}) { |
if ($$elements{$name} eq 'selectbox') { |
if ($$elements{$name} eq 'selectbox') { |
$output .= qq| |
$output .= qq| |
if (courseForm.$name.options[j].value == "$value") { |
if (courseForm.elements['$name'].options[j].value == "$value") { |
courseForm.$name.options[j].selected = true; |
courseForm.elements['$name'].options[j].selected = true; |
}|; |
}|; |
} elsif (($$elements{$name} eq 'radio') || |
} elsif (($$elements{$name} eq 'radio') || |
($$elements{$name} eq 'checkbox')) { |
($$elements{$name} eq 'checkbox')) { |
$output .= qq| |
$output .= qq| |
if (courseForm.$name\[j].value == "$value") { |
if (courseForm.elements['$name']\[j].value == "$value") { |
courseForm.$name\[j].checked = true; |
courseForm.elements['$name']\[j].checked = true; |
}|; |
}|; |
} |
} |
} |
} |