version 1.361, 2006/05/01 21:03:35
|
version 1.370, 2006/05/12 02:17:50
|
Line 64 use HTML::Entities;
|
Line 64 use HTML::Entities;
|
use Apache::lonhtmlcommon(); |
use Apache::lonhtmlcommon(); |
use Apache::loncoursedata(); |
use Apache::loncoursedata(); |
use Apache::lontexconvert(); |
use Apache::lontexconvert(); |
|
use LONCAPA; |
|
|
my $readit; |
my $readit; |
|
|
Line 709 sub help_open_menu {
|
Line 710 sub help_open_menu {
|
my $timestamp = time; |
my $timestamp = time; |
foreach my $datum (\$color,\$function,\$topic,\$component_help,\$faq, |
foreach my $datum (\$color,\$function,\$topic,\$component_help,\$faq, |
\$bug,\$origurl) { |
\$bug,\$origurl) { |
$$datum = &Apache::lonnet::escape($$datum); |
$$datum = &escape($$datum); |
} |
} |
if (!$stayOnPage) { |
if (!$stayOnPage) { |
$link = "javascript:helpMenu('open')"; |
$link = "javascript:helpMenu('open')"; |
Line 775 ENDTEMPLATE
|
Line 776 ENDTEMPLATE
|
$width,$height).' '.$template; |
$width,$height).' '.$template; |
} else { |
} else { |
my $help_text; |
my $help_text; |
$help_text=&Apache::lonnet::unescape($topic); |
$help_text=&unescape($topic); |
$template='<table><tr><td>'. |
$template='<table><tr><td>'. |
&help_open_topic($component_help,$help_text,$stayOnPage, |
&help_open_topic($component_help,$help_text,$stayOnPage, |
$width,$height).'</td><td>'.$template. |
$width,$height).'</td><td>'.$template. |
Line 803 sub help_open_bug {
|
Line 804 sub help_open_bug {
|
my $link=''; |
my $link=''; |
my $template=''; |
my $template=''; |
my $url=$Apache::lonnet::perlvar{'BugzillaHost'}.'enter_bug.cgi?product=LON-CAPA&bug_file_loc='. |
my $url=$Apache::lonnet::perlvar{'BugzillaHost'}.'enter_bug.cgi?product=LON-CAPA&bug_file_loc='. |
&Apache::lonnet::escape($ENV{'REQUEST_URI'}).'&component='.$topic; |
&escape($ENV{'REQUEST_URI'}).'&component='.$topic; |
if (!$stayOnPage) |
if (!$stayOnPage) |
{ |
{ |
$link = "javascript:void(open('$url', 'Bugzilla', 'menubar=0,toolbar=1,scrollbars=1,width=$width,height=$height,resizable=yes'))"; |
$link = "javascript:void(open('$url', 'Bugzilla', 'menubar=0,toolbar=1,scrollbars=1,width=$width,height=$height,resizable=yes'))"; |
Line 2024 sub screenname {
|
Line 2025 sub screenname {
|
# ------------------------------------------------------------- Message Wrapper |
# ------------------------------------------------------------- Message Wrapper |
|
|
sub messagewrapper { |
sub messagewrapper { |
my ($link,$username,$domain)=@_; |
my ($link,$username,$domain,$subject,$text)=@_; |
return |
return |
'<a href="/adm/email?compose=individual&'. |
'<a href="/adm/email?compose=individual&'. |
'recname='.$username.'&recdom='.$domain.'" '. |
'recname='.$username.'&recdom='.$domain. |
|
'&subject='.&escape($subject).'&text='.&escape($text).'" '. |
'title="'.&mt('Send message').'">'.$link.'</a>'; |
'title="'.&mt('Send message').'">'.$link.'</a>'; |
} |
} |
# --------------------------------------------------------------- Notes Wrapper |
# --------------------------------------------------------------- Notes Wrapper |
Line 2394 sub get_previous_attempt {
|
Line 2396 sub get_previous_attempt {
|
} else { |
} else { |
$value=$returnhash{$version.':'.$key}; |
$value=$returnhash{$version.':'.$key}; |
} |
} |
$prevattempts.='<td>'.&Apache::lonnet::unescape($value).' </td>'; |
$prevattempts.='<td>'.&unescape($value).' </td>'; |
} |
} |
} |
} |
} |
} |
Line 2406 sub get_previous_attempt {
|
Line 2408 sub get_previous_attempt {
|
} else { |
} else { |
$value=$lasthash{$key}; |
$value=$lasthash{$key}; |
} |
} |
$value=&Apache::lonnet::unescape($value); |
$value=&unescape($value); |
if ($key =~/$regexp$/ && (defined &$gradesub)) {$value = &$gradesub($value)} |
if ($key =~/$regexp$/ && (defined &$gradesub)) {$value = &$gradesub($value)} |
$prevattempts.='<td>'.$value.' </td>'; |
$prevattempts.='<td>'.$value.' </td>'; |
} |
} |
Line 2528 sub submlink {
|
Line 2530 sub submlink {
|
if (!$symb) { $symb=$cursymb; } |
if (!$symb) { $symb=$cursymb; } |
} |
} |
if (!$symb) { $symb=&Apache::lonnet::symbread(); } |
if (!$symb) { $symb=&Apache::lonnet::symbread(); } |
$symb=&Apache::lonnet::escape($symb); |
$symb=&escape($symb); |
if ($target) { $target="target=\"$target\""; } |
if ($target) { $target="target=\"$target\""; } |
return '<a href="/adm/grades?&command=submission&'. |
return '<a href="/adm/grades?&command=submission&'. |
'symb='.$symb.'&student='.$uname. |
'symb='.$symb.'&student='.$uname. |
Line 2574 sub pprmlink {
|
Line 2576 sub pprmlink {
|
if (!$symb) { $symb=$cursymb; } |
if (!$symb) { $symb=$cursymb; } |
} |
} |
if (!$symb) { $symb=&Apache::lonnet::symbread(); } |
if (!$symb) { $symb=&Apache::lonnet::symbread(); } |
$symb=&Apache::lonnet::escape($symb); |
$symb=&escape($symb); |
if ($target) { $target="target=\"$target\""; } |
if ($target) { $target="target=\"$target\""; } |
return '<a href="/adm/parmset?&command=set&'. |
return '<a href="/adm/parmset?&command=set&'. |
'symb='.$symb.'&uname='.$uname. |
'symb='.$symb.'&uname='.$uname. |
Line 2604 sub timehash {
|
Line 2606 sub timehash {
|
'dlsav' => $ltime[8] ); |
'dlsav' => $ltime[8] ); |
} |
} |
|
|
|
sub utc_string { |
|
my ($date)=@_; |
|
my @utctime=gmtime($date); |
|
my $year=$utctime[5]+1900; |
|
my $month=$utctime[4]+1; |
|
return "$year$month$utctime[3]T$utctime[2]$utctime[1]$utctime[0]Z"; |
|
} |
|
|
sub maketime { |
sub maketime { |
my %th=@_; |
my %th=@_; |
return POSIX::mktime( |
return POSIX::mktime( |
Line 2945 ENDROLE
|
Line 2955 ENDROLE
|
return(<<ENDBODY); |
return(<<ENDBODY); |
$bodytag |
$bodytag |
<table id="LC_title_bar" class="LC_with_remote"> |
<table id="LC_title_bar" class="LC_with_remote"> |
<tr><td>$upperleft</td> |
<tr><td class="LC_title_bar_role_logo">$upperleft</td> |
<td class="LC_title_bar_domain_logo">$messages </td> |
<td class="LC_title_bar_domain_logo">$messages </td> |
</tr> |
</tr> |
<tr><td>$titleinfo $dc_info $menu</td> |
<tr><td>$titleinfo $dc_info $menu</td> |
$roleinfo |
$roleinfo |
|
</tr> |
</table> |
</table> |
ENDBODY |
ENDBODY |
} |
} |
Line 3089 sub standard_css {
|
Line 3100 sub standard_css {
|
my $mail_other_hover = '#669999'; |
my $mail_other_hover = '#669999'; |
|
|
return <<END; |
return <<END; |
<style type="text/css"> |
|
h1, h2, h3, th { font-family: $sans } |
h1, h2, h3, th { font-family: $sans } |
a:focus { color: red; background: yellow } |
a:focus { color: red; background: yellow } |
table.thinborder { border-collapse: collapse; } |
table.thinborder { border-collapse: collapse; } |
Line 3109 table#LC_top_nav, table#LC_menubuttons,
|
Line 3119 table#LC_top_nav, table#LC_menubuttons,
|
width: 100%; |
width: 100%; |
background: $pgbg; |
background: $pgbg; |
border: 0px; |
border: 0px; |
border-spacing: 1px; |
border-spacing: 2px 1px; |
padding: 0px; |
padding: 0px; |
margin: 0px; |
margin: 0px; |
border-collapse: separate; |
border-collapse: separate; |
Line 3117 table#LC_top_nav, table#LC_menubuttons,
|
Line 3127 table#LC_top_nav, table#LC_menubuttons,
|
table#LC_title_bar { |
table#LC_title_bar { |
width: 100%; |
width: 100%; |
border: 0; |
border: 0; |
border-spacing: 3px; |
border-spacing: 0px 1px; |
|
padding: 0px 2px 0px 2px; |
background: $pgbg; |
background: $pgbg; |
font-family: $sans; |
font-family: $sans; |
|
border-collapse: collapse; |
} |
} |
table#LC_title_bar.LC_with_remote { |
table#LC_title_bar.LC_with_remote { |
width: 100%; |
width: 100%; |
Line 3145 span.LC_title_bar_title {
|
Line 3157 span.LC_title_bar_title {
|
table#LC_title_bar td.LC_title_bar_domain_logo { |
table#LC_title_bar td.LC_title_bar_domain_logo { |
background: $sidebg; |
background: $sidebg; |
text-align: right; |
text-align: right; |
|
padding: 0px; |
|
} |
|
table#LC_title_bar td.LC_title_bar_role_logo { |
|
background: $sidebg; |
|
padding: 0px; |
} |
} |
|
|
table#LC_menubuttons_mainmenu { |
table#LC_menubuttons_mainmenu { |
Line 3165 table#LC_top_nav td a, div#LC_top_nav a
|
Line 3182 table#LC_top_nav td a, div#LC_top_nav a
|
color: $font; |
color: $font; |
font-family: $sans; |
font-family: $sans; |
} |
} |
|
table#LC_top_nav td.LC_top_nav_logo { |
|
background: $tabbg; |
|
text-align: right; |
|
} |
table#LC_breadcrumbs td { |
table#LC_breadcrumbs td { |
background: $tabbg; |
background: $tabbg; |
color: $font; |
color: $font; |
Line 3260 table.LC_mail_list tr.LC_mail_other {
|
Line 3281 table.LC_mail_list tr.LC_mail_other {
|
table.LC_mail_list tr.LC_mail_other:hover { |
table.LC_mail_list tr.LC_mail_other:hover { |
background-color: $mail_other_hover; |
background-color: $mail_other_hover; |
} |
} |
</style> |
|
END |
END |
} |
} |
|
|
Line 3294 Inputs: $title - optional title for the
|
Line 3314 Inputs: $title - optional title for the
|
sub headtag { |
sub headtag { |
my ($title,$head_extra,$args) = @_; |
my ($title,$head_extra,$args) = @_; |
|
|
|
my $function = $args->{'function'} || &get_users_function(); |
|
my $domain = $args->{'domain'} || &determinedomain(); |
|
my $bgcolor = $args->{'bgcolor'} || &designparm($function.'.pgbg',$domain); |
|
my $url = join(':',$env{'user.name'},$env{'user.domain'}, |
|
$env{'environment.color.timestamp'}, |
|
$function,$domain,$bgcolor); |
|
|
|
$url = '/adm/css/'.&escape($url).'.css'; |
|
|
my $result = |
my $result = |
'<head>'. |
'<head>'. |
&standard_css($args->{'function'},$args->{'domain'}, |
'<link rel="stylesheet" type="text/css" href="'.$url.'" />'. |
$args->{'bgcolor'}). |
|
&font_settings(). |
&font_settings(). |
&Apache::lonhtmlcommon::htmlareaheaders(); |
&Apache::lonhtmlcommon::htmlareaheaders(); |
|
|
Line 3635 sub simple_error_page {
|
Line 3663 sub simple_error_page {
|
sub end_data_table_row { |
sub end_data_table_row { |
return '</tr>'; |
return '</tr>'; |
} |
} |
|
|
|
sub start_data_table_header_row { |
|
return '<tr class="LC_header_row">'; |
|
} |
|
|
|
sub end_data_table_header_row { |
|
return '</tr>'; |
|
} |
} |
} |
|
|
############################################### |
############################################### |
Line 3740 Returns number of sections.
|
Line 3776 Returns number of sections.
|
|
|
############################################### |
############################################### |
sub get_sections { |
sub get_sections { |
my ($cdom,$cnum,$sectioncount,$possible_roles) = @_; |
my ($cdom,$cnum,$possible_roles) = @_; |
if (!($cdom && $cnum)) { return 0; } |
if (!defined($cdom) || !defined($cnum)) { |
my $numsections = 0; |
my $cid = $env{'request.course.id'}; |
|
|
|
return if (!defined($cid)); |
|
|
if (!defined($possible_roles) || (grep/^st$/,@$possible_roles)) { |
$cdom = $env{'course.'.$cid.'.domain'}; |
|
$cnum = $env{'course.'.$cid.'.num'}; |
|
} |
|
|
|
my %sectioncount; |
|
|
|
if (!defined($possible_roles) || (grep(/^st$/,@$possible_roles))) { |
my ($classlist) = &Apache::loncoursedata::get_classlist($cdom,$cnum); |
my ($classlist) = &Apache::loncoursedata::get_classlist($cdom,$cnum); |
my $sec_index = &Apache::loncoursedata::CL_SECTION(); |
my $sec_index = &Apache::loncoursedata::CL_SECTION(); |
my $status_index = &Apache::loncoursedata::CL_STATUS(); |
my $status_index = &Apache::loncoursedata::CL_STATUS(); |
while (my ($student,$data) = each %$classlist) { |
while (my ($student,$data) = each(%$classlist)) { |
my ($section,$status) = ($data->[$sec_index], |
my ($section,$status) = ($data->[$sec_index], |
$data->[$status_index]); |
$data->[$status_index]); |
unless ($section eq '-1' || $section =~ /^\s*$/) { |
unless ($section eq '-1' || $section =~ /^\s*$/) { |
if (!defined($$sectioncount{$section})) { $numsections++; } |
$sectioncount{$section}++; |
$$sectioncount{$section}++; |
|
} |
} |
} |
} |
} |
} |
Line 3769 sub get_sections {
|
Line 3812 sub get_sections {
|
} |
} |
if ($user =~ /^$role:[^:]*:[^:]*:(\w+)/) { $section=$1; } |
if ($user =~ /^$role:[^:]*:[^:]*:(\w+)/) { $section=$1; } |
if (!defined($section) || $section eq '-1') { next; } |
if (!defined($section) || $section eq '-1') { next; } |
if (!defined($$sectioncount{$section})) { $numsections++; } |
$sectioncount{$section}++; |
$$sectioncount{$section}++; |
|
} |
} |
return $numsections; |
return %sectioncount; |
} |
} |
|
|
############################################### |
############################################### |
Line 3809 can be sent to &get_group_settings() to
|
Line 3851 can be sent to &get_group_settings() to
|
############################################### |
############################################### |
|
|
sub coursegroups { |
sub coursegroups { |
my ($curr_groups,$cdom,$cnum,$group) = @_; |
my ($cdom,$cnum,$group) = @_; |
my $numgroups; |
|
if (!defined($cdom) || !defined($cnum)) { |
if (!defined($cdom) || !defined($cnum)) { |
my $cid = $env{'request.course.id'}; |
my $cid = $env{'request.course.id'}; |
|
|
|
return if (!defined($cid)); |
|
|
$cdom = $env{'course.'.$cid.'.domain'}; |
$cdom = $env{'course.'.$cid.'.domain'}; |
$cnum = $env{'course.'.$cid.'.num'}; |
$cnum = $env{'course.'.$cid.'.num'}; |
} |
} |
%{$curr_groups} = &Apache::lonnet::get_coursegroups($cdom,$cnum,$group); |
my %curr_groups = &Apache::lonnet::get_coursegroups($cdom,$cnum,$group); |
my ($tmp) = keys(%{$curr_groups}); |
my ($tmp) = keys(%curr_groups); |
if ($tmp=~/^error:/) { |
if ($tmp=~/^(con_lost|no_such_host|error: [^2] )/) { |
unless ($tmp eq 'error: 2 tie(GDBM) Failed while attempting dump') { |
undef(%curr_groups); |
&logthis('Error retrieving groups: '.$tmp.' in '.$cnum.':'. |
&logthis('Error retrieving groups: '.$tmp.' in '.$cnum.':'.$cdom); |
$cdom); |
} elsif ($tmp=~/^error: 2 /) { |
} |
undef(%curr_groups); |
$numgroups = 0; |
|
} else { |
|
$numgroups = keys(%{$curr_groups}); |
|
} |
} |
return $numgroups; |
return %curr_groups; |
} |
} |
|
|
############################################### |
############################################### |
Line 3888 sub get_group_settings {
|
Line 3929 sub get_group_settings {
|
$content{$tool}{$function} = $value; |
$content{$tool}{$function} = $value; |
} |
} |
} elsif ($entry eq 'groupname') { |
} elsif ($entry eq 'groupname') { |
$content{$entry}=&Apache::lonnet::unescape($value); |
$content{$entry}=&unescape($value); |
} elsif (($entry eq 'roles') || ($entry eq 'types') || |
} elsif (($entry eq 'roles') || ($entry eq 'types') || |
($entry eq 'sectionpick') || ($entry eq 'defpriv')) { |
($entry eq 'sectionpick') || ($entry eq 'defpriv')) { |
push(@{$content{$entry}},$value); |
push(@{$content{$entry}},$value); |
Line 4075 sub get_unprocessed_cgi {
|
Line 4116 sub get_unprocessed_cgi {
|
# $Apache::lonxml::debug=1; |
# $Apache::lonxml::debug=1; |
foreach my $pair (split(/&/,$query)) { |
foreach my $pair (split(/&/,$query)) { |
my ($name, $value) = split(/=/,$pair); |
my ($name, $value) = split(/=/,$pair); |
$name = &Apache::lonnet::unescape($name); |
$name = &unescape($name); |
if (!defined($possible_names) || (grep {$_ eq $name} @$possible_names)) { |
if (!defined($possible_names) || (grep {$_ eq $name} @$possible_names)) { |
$value =~ tr/+/ /; |
$value =~ tr/+/ /; |
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; |
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; |
Line 4704 sub DrawBarGraph {
|
Line 4745 sub DrawBarGraph {
|
$Title = '' if (! defined($Title)); |
$Title = '' if (! defined($Title)); |
$xlabel = '' if (! defined($xlabel)); |
$xlabel = '' if (! defined($xlabel)); |
$ylabel = '' if (! defined($ylabel)); |
$ylabel = '' if (! defined($ylabel)); |
$ValuesHash{$id.'.title'} = &Apache::lonnet::escape($Title); |
$ValuesHash{$id.'.title'} = &escape($Title); |
$ValuesHash{$id.'.xlabel'} = &Apache::lonnet::escape($xlabel); |
$ValuesHash{$id.'.xlabel'} = &escape($xlabel); |
$ValuesHash{$id.'.ylabel'} = &Apache::lonnet::escape($ylabel); |
$ValuesHash{$id.'.ylabel'} = &escape($ylabel); |
$ValuesHash{$id.'.y_max_value'} = $Max; |
$ValuesHash{$id.'.y_max_value'} = $Max; |
$ValuesHash{$id.'.NumBars'} = $NumBars; |
$ValuesHash{$id.'.NumBars'} = $NumBars; |
$ValuesHash{$id.'.NumSets'} = $NumSets; |
$ValuesHash{$id.'.NumSets'} = $NumSets; |
Line 4786 sub DrawXYGraph {
|
Line 4827 sub DrawXYGraph {
|
$ylabel = '' if (! defined($ylabel)); |
$ylabel = '' if (! defined($ylabel)); |
my %ValuesHash = |
my %ValuesHash = |
( |
( |
$id.'.title' => &Apache::lonnet::escape($Title), |
$id.'.title' => &escape($Title), |
$id.'.xlabel' => &Apache::lonnet::escape($xlabel), |
$id.'.xlabel' => &escape($xlabel), |
$id.'.ylabel' => &Apache::lonnet::escape($ylabel), |
$id.'.ylabel' => &escape($ylabel), |
$id.'.y_max_value'=> $Max, |
$id.'.y_max_value'=> $Max, |
$id.'.labels' => join(',',@$Xlabels), |
$id.'.labels' => join(',',@$Xlabels), |
$id.'.PlotType' => 'XY', |
$id.'.PlotType' => 'XY', |
Line 4883 sub DrawXYYGraph {
|
Line 4924 sub DrawXYYGraph {
|
$ylabel = '' if (! defined($ylabel)); |
$ylabel = '' if (! defined($ylabel)); |
my %ValuesHash = |
my %ValuesHash = |
( |
( |
$id.'.title' => &Apache::lonnet::escape($Title), |
$id.'.title' => &escape($Title), |
$id.'.xlabel' => &Apache::lonnet::escape($xlabel), |
$id.'.xlabel' => &escape($xlabel), |
$id.'.ylabel' => &Apache::lonnet::escape($ylabel), |
$id.'.ylabel' => &escape($ylabel), |
$id.'.labels' => join(',',@$Xlabels), |
$id.'.labels' => join(',',@$Xlabels), |
$id.'.PlotType' => 'XY', |
$id.'.PlotType' => 'XY', |
$id.'.NumSets' => 2, |
$id.'.NumSets' => 2, |
Line 4957 Inputs:
|
Line 4998 Inputs:
|
sub chartlink { |
sub chartlink { |
my ($linktext, $sname, $sdomain) = @_; |
my ($linktext, $sname, $sdomain) = @_; |
my $link = '<a href="/adm/statistics?reportSelected=student_assessment'. |
my $link = '<a href="/adm/statistics?reportSelected=student_assessment'. |
'&SelectedStudent='.&Apache::lonnet::escape($sname.':'.$sdomain). |
'&SelectedStudent='.&escape($sname.':'.$sdomain). |
'&chartoutputmode='.HTML::Entities::encode('html, with all links'). |
'&chartoutputmode='.HTML::Entities::encode('html, with all links'). |
'">'.$linktext.'</a>'; |
'">'.$linktext.'</a>'; |
} |
} |
Line 5020 sub store_course_settings {
|
Line 5061 sub store_course_settings {
|
if (ref($env{'form.'.$setting})) { |
if (ref($env{'form.'.$setting})) { |
$stored_form = join(',', |
$stored_form = join(',', |
map { |
map { |
&Apache::lonnet::escape($_); |
&escape($_); |
} sort(@{$env{'form.'.$setting}})); |
} sort(@{$env{'form.'.$setting}})); |
} else { |
} else { |
$stored_form = |
$stored_form = |
&Apache::lonnet::escape($env{'form.'.$setting}); |
&escape($env{'form.'.$setting}); |
} |
} |
# Determine if the array contents are the same. |
# Determine if the array contents are the same. |
if ($stored_form ne $env{$envname}) { |
if ($stored_form ne $env{$envname}) { |
Line 5058 sub restore_course_settings {
|
Line 5099 sub restore_course_settings {
|
} elsif ($type eq 'array') { |
} elsif ($type eq 'array') { |
$env{'form.'.$setting} = [ |
$env{'form.'.$setting} = [ |
map { |
map { |
&Apache::lonnet::unescape($_); |
&unescape($_); |
} split(',',$env{$envname}) |
} split(',',$env{$envname}) |
]; |
]; |
} |
} |
Line 5131 sub escape_double {
|
Line 5172 sub escape_double {
|
sub escape_url { |
sub escape_url { |
my ($url) = @_; |
my ($url) = @_; |
my @urlslices = split(/\//, $url,-1); |
my @urlslices = split(/\//, $url,-1); |
my $lastitem = &Apache::lonnet::escape(pop(@urlslices)); |
my $lastitem = &escape(pop(@urlslices)); |
return join('/',@urlslices).'/'.$lastitem; |
return join('/',@urlslices).'/'.$lastitem; |
} |
} |
=pod |
=pod |