version 1.356, 2006/04/26 15:29:51
|
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 2773 Inputs:
|
Line 2783 Inputs:
|
|
|
=item * $notitle, if true keep the nav controls, but remove the title bar |
=item * $notitle, if true keep the nav controls, but remove the title bar |
|
|
|
=item * $no_inline_link, if true and in remote mode, don't show the |
|
'Switch To Inline Menu' link |
|
|
|
|
=back |
=back |
|
|
Line 2785 other decorations will be returned.
|
Line 2798 other decorations will be returned.
|
|
|
sub bodytag { |
sub bodytag { |
my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,$customtitle, |
my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,$customtitle, |
$notopbar,$bgcolor,$notitle)=@_; |
$notopbar,$bgcolor,$notitle,$no_inline_link)=@_; |
|
|
$title=&mt($title); |
$title=&mt($title); |
|
|
$function = &get_users_function() if (!$function); |
$function = &get_users_function() if (!$function); |
my $img = &designparm($function.'.img',$domain); |
my $img = &designparm($function.'.img',$domain); |
my $tabbg = &designparm($function.'.tabbg',$domain); |
|
my $font = &designparm($function.'.font',$domain); |
my $font = &designparm($function.'.font',$domain); |
my $sidebg = &designparm($function.'.sidebg',$domain); |
|
my $pgbg = $bgcolor || &designparm($function.'.pgbg',$domain); |
my $pgbg = $bgcolor || &designparm($function.'.pgbg',$domain); |
|
|
my %design = ( 'style' => 'margin-top: 0px', |
my %design = ( 'style' => 'margin-top: 0px', |
Line 2805 sub bodytag {
|
Line 2816 sub bodytag {
|
@$addentries{keys(%design)} = @design{keys(%design)}; |
@$addentries{keys(%design)} = @design{keys(%design)}; |
|
|
# role and realm |
# role and realm |
my ($role,$realm) |
my ($role,$realm) = |
=&Apache::lonnet::plaintext((split(/\./,$env{'request.role'}))[0]); |
&Apache::lonnet::plaintext((split(/\./,$env{'request.role'}))[0]); |
# realm |
# realm |
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
$realm= |
$realm = $env{'course.'.$env{'request.course.id'}.'.description'}; |
$env{'course.'.$env{'request.course.id'}.'.description'}; |
|
} |
} |
unless ($realm) { $realm=' '; } |
if (!$realm) { $realm=' '; } |
# Set messages |
# Set messages |
my $messages=&domainlogo($domain); |
my $messages=&domainlogo($domain); |
# Port for miniserver |
# Port for miniserver |
Line 2822 sub bodytag {
|
Line 2832 sub bodytag {
|
my $extra_body_attr = &make_attr_string($forcereg,$addentries); |
my $extra_body_attr = &make_attr_string($forcereg,$addentries); |
|
|
# construct main body tag |
# construct main body tag |
my $bodytag = <<END; |
my $bodytag = "<body $extra_body_attr>". |
<body $extra_body_attr> |
&Apache::lontexconvert::init_math_support(); |
END |
|
|
|
$bodytag .= &Apache::lontexconvert::init_math_support(); |
|
|
|
my $upperleft='<img src="http://'.$ENV{'HTTP_HOST'}.':'. |
|
$lonhttpdPort.$img.'" alt="'.$function.'" />'; |
|
if ($bodyonly |
if ($bodyonly |
|| ($env{'request.state'} eq 'construct' |
|| ($env{'request.state'} eq 'construct' |
&& $env{'environment.remote'} ne 'off' )) { |
&& $env{'environment.remote'} ne 'off' )) { |
Line 2842 END
|
Line 2847 END
|
$bodytag.='<h1>LON-CAPA: '.$title.'</h1>'; |
$bodytag.='<h1>LON-CAPA: '.$title.'</h1>'; |
} |
} |
return $bodytag; |
return $bodytag; |
} elsif ($env{'environment.remote'} eq 'off') { |
} |
# No Remote |
|
my $roleinfo=(<<ENDROLE); |
|
<td bgcolor="$tabbg" align="right"> |
|
<font size="2" face="Arial, Helvetica, sans-serif"> |
my $roleinfo=(<<ENDROLE); |
|
<td class="LC_title_bar_who"> |
|
<div class="LC_title_bar_name"> |
$env{'environment.firstname'} |
$env{'environment.firstname'} |
$env{'environment.middlename'} |
$env{'environment.middlename'} |
$env{'environment.lastname'} |
$env{'environment.lastname'} |
$env{'environment.generation'} |
$env{'environment.generation'} |
</font> |
|
<br /> |
</div> |
<font size="2" face="Arial, Helvetica, sans-serif">$role</font> |
<div class="LC_title_bar_role"> |
<br /> |
$role |
<font size="2" face="Arial, Helvetica, sans-serif">$realm</font> |
</div> |
|
<div class="LC_title_bar_realm"> |
|
$realm |
|
</div> |
</td> |
</td> |
ENDROLE |
ENDROLE |
my $titleinfo = '<font face="Arial, Helvetica, sans-serif" size="+3" color="'. |
|
$font.'"><b>'.$title.'</b></font>'; |
|
if ($customtitle) { |
|
$titleinfo = $customtitle; |
|
} |
|
|
|
|
my $titleinfo = '<span class="LC_title_bar_title">'.$title.'</span>'; |
|
if ($customtitle) { |
|
$titleinfo = $customtitle; |
|
} |
|
# |
|
# Extra info if you are the DC |
|
my $dc_info = ''; |
|
if ($env{'user.adv'} && exists($env{'user.role.dc./'. |
|
$env{'course.'.$env{'request.course.id'}. |
|
'.domain'}.'/'})) { |
|
my $cid = $env{'request.course.id'}; |
|
$dc_info.= $cid.' '.$env{'course.'.$cid.'.internal.coursecode'}; |
|
$dc_info = '('.$dc_info.')'; |
|
} |
|
|
|
if ($env{'environment.remote'} eq 'off') { |
|
# No Remote |
if ($env{'request.state'} eq 'construct') { |
if ($env{'request.state'} eq 'construct') { |
|
$forcereg=1; |
|
} |
|
|
|
if (!$customtitle && $env{'request.state'} eq 'construct') { |
|
# this is for resources; directories have customtitle, and crumbs |
|
# and select recent are created in lonpubdir.pm |
my ($uname,$thisdisfn)= |
my ($uname,$thisdisfn)= |
($env{'request.filename'} =~ m|^/home/([^/]+)/public_html/(.*)|); |
($env{'request.filename'} =~ m|^/home/([^/]+)/public_html/(.*)|); |
my $formaction='/priv/'.$uname.'/'.$thisdisfn; |
my $formaction='/priv/'.$uname.'/'.$thisdisfn; |
$formaction=~s/\/+/\//g; |
$formaction=~s/\/+/\//g; |
unless ($customtitle) { #this is for resources; directories have customtitle, and crumbs and select recent are created in lonpubdir.pm |
|
my $parentpath = ''; |
|
my $lastitem = ''; |
|
if ($thisdisfn =~ m-(.+/)([^/]*)$-) { |
|
$parentpath = $1; |
|
$lastitem = $2; |
|
} else { |
|
$lastitem = $thisdisfn; |
|
} |
|
$titleinfo = &Apache::loncommon::help_open_menu('','','','',3,'Authoring'). |
|
'<font face="Arial, Helvetica, sans-serif"><b>Construction Space</b>:</font> '. |
|
'<form name="dirs" method="post" action="'.$formaction |
|
.'" target="_top"><tt><b>' |
|
.&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv','','+1',1)."<font size=\"+1\">$lastitem</font></b></tt><br />" |
|
.&Apache::lonhtmlcommon::select_recent('construct','recent','this.form.action=this.form.recent.value;this.form.submit()') |
|
.'</form>' |
|
.&Apache::lonmenu::constspaceform(); |
|
|
|
} |
my $parentpath = ''; |
$forcereg=1; |
my $lastitem = ''; |
|
if ($thisdisfn =~ m-(.+/)([^/]*)$-) { |
|
$parentpath = $1; |
|
$lastitem = $2; |
|
} else { |
|
$lastitem = $thisdisfn; |
|
} |
|
$titleinfo = |
|
&Apache::loncommon::help_open_menu('','','','',3,'Authoring'). |
|
'<b>Construction Space</b>: '. |
|
'<form name="dirs" method="post" action="'.$formaction |
|
.'" target="_top"><tt><b>' |
|
.&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv','','+1',1)."<font size=\"+1\">$lastitem</font></b></tt><br />" |
|
.&Apache::lonhtmlcommon::select_recent('construct','recent','this.form.action=this.form.recent.value;this.form.submit()') |
|
.'</form>' |
|
.&Apache::lonmenu::constspaceform(); |
} |
} |
|
|
my $titletable; |
my $titletable; |
if (!$notitle) { |
if (!$notitle) { |
$titletable = |
$titletable = |
'<table bgcolor="'.$pgbg.'" width="100%" border="0" '. |
'<table id="LC_title_bar">'. |
'cellspacing="3" cellpadding="3">'. |
"<tr><td> $titleinfo $dc_info</td>".$roleinfo. |
'<tr><td bgcolor="'.$tabbg.'">'. |
'</tr></table>'; |
$titleinfo.'</td>'.$roleinfo.'</tr></table>'; |
|
} |
} |
if ($env{'request.state'} eq 'construct') { |
if ($notopbar) { |
if ($notopbar) { |
$bodytag .= $titletable; |
$bodytag .= $titletable; |
} else { |
} else { |
if ($env{'request.state'} eq 'construct') { |
$bodytag .= &Apache::lonmenu::menubuttons($forcereg,$forcereg, |
$bodytag .= &Apache::lonmenu::menubuttons($forcereg,$forcereg, |
$titletable); |
$titletable); |
} |
|
} else { |
|
if ($notopbar) { |
|
$bodytag .= $titletable; |
|
} else { |
} else { |
$bodytag .= &Apache::lonmenu::menubuttons($forcereg,$forcereg). |
$bodytag .= &Apache::lonmenu::menubuttons($forcereg,$forcereg). |
$titletable; |
$titletable; |
} |
} |
} |
} |
return $bodytag; |
return $bodytag; |
Line 2919 ENDROLE
|
Line 2941 ENDROLE
|
# |
# |
# Top frame rendering, Remote is up |
# Top frame rendering, Remote is up |
# |
# |
my $titleinfo = ' <font size="5" face="Arial, Helvetica, sans-serif"><b>'.$title.'</b></font>'; |
|
if ($customtitle) { |
my $upperleft='<img src="http://'.$ENV{'HTTP_HOST'}.':'. |
$titleinfo = $customtitle; |
$lonhttpdPort.$img.'" alt="'.$function.'" />'; |
} |
|
# |
|
# Extra info if you are the DC |
|
my $dc_info = ''; |
|
if ($env{'user.adv'} && exists($env{'user.role.dc./'. |
|
$env{'course.'.$env{'request.course.id'}. |
|
'.domain'}.'/'})) { |
|
my $cid = $env{'request.course.id'}; |
|
$dc_info.= $cid.' '.$env{'course.'.$cid.'.internal.coursecode'}; |
|
$dc_info = '('.$dc_info.')'; |
|
} |
|
# Explicit link to get inline menu |
# Explicit link to get inline menu |
my $menu='<br /><font size="2" face="Arial, Helvetica, sans-serif"> <a href="/adm/remote?action=collapse">'.&mt('Switch to Inline Menu Mode').'</a></font>'; |
my $menu= ($no_inline_link?'' |
|
:'<br /><a href="/adm/remote?action=collapse">'.&mt('Switch to Inline Menu Mode').'</a>'); |
# |
# |
if ($notitle) { |
if ($notitle) { |
return $bodytag; |
return $bodytag; |
} |
} |
return(<<ENDBODY); |
return(<<ENDBODY); |
$bodytag |
$bodytag |
<table width="100%" cellspacing="0" border="0" cellpadding="0"> |
<table id="LC_title_bar" class="LC_with_remote"> |
<tr><td bgcolor="$sidebg"> |
<tr><td class="LC_title_bar_role_logo">$upperleft</td> |
$upperleft</td> |
<td class="LC_title_bar_domain_logo">$messages </td> |
<td bgcolor="$sidebg" align="right">$messages </td> |
|
</tr> |
</tr> |
<tr> |
<tr><td>$titleinfo $dc_info $menu</td> |
<td rowspan="3" bgcolor="$tabbg"> |
$roleinfo |
$titleinfo $dc_info $menu |
|
</td><td bgcolor="$tabbg" align="right"> |
|
<font size="2" face="Arial, Helvetica, sans-serif"> |
|
$env{'environment.firstname'} |
|
$env{'environment.middlename'} |
|
$env{'environment.lastname'} |
|
$env{'environment.generation'} |
|
</font> |
|
</td> |
|
</tr> |
</tr> |
<tr><td bgcolor="$tabbg" align="right"> |
|
<font size="2" face="Arial, Helvetica, sans-serif">$role</font> |
|
</td></tr> |
|
<tr> |
|
<td bgcolor="$tabbg" align="right"><font size="2" face="Arial, Helvetica, sans-serif">$realm</font> </td></tr> |
|
</table> |
</table> |
ENDBODY |
ENDBODY |
} |
} |
Line 3102 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 3118 form, .inline { display: inline; }
|
Line 3115 form, .inline { display: inline; }
|
color: green; |
color: green; |
} |
} |
|
|
table#LC_top_nav, table#LC_menubuttons, table#LC_nav_location { |
table#LC_top_nav, table#LC_menubuttons, table#LC_nav_location, table#LC_breadcrumbs { |
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; |
} |
} |
|
table#LC_title_bar { |
|
width: 100%; |
|
border: 0; |
|
border-spacing: 0px 1px; |
|
padding: 0px 2px 0px 2px; |
|
background: $pgbg; |
|
font-family: $sans; |
|
border-collapse: collapse; |
|
} |
|
table#LC_title_bar.LC_with_remote { |
|
width: 100%; |
|
border: 0; |
|
border-spacing: 0; |
|
background: $pgbg; |
|
font-family: $sans; |
|
border-collapse: collapse; |
|
} |
|
table#LC_title_bar td { |
|
padding: 3px; |
|
background: $tabbg; |
|
} |
|
table#LC_title_bar td.LC_title_bar_who { |
|
background: $tabbg; |
|
color: $font; |
|
font: medium $sans; |
|
text-align: right; |
|
} |
|
span.LC_title_bar_title { |
|
font: bold xx-large $sans; |
|
} |
|
table#LC_title_bar td.LC_title_bar_domain_logo { |
|
background: $sidebg; |
|
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 { |
background: $pgbg; |
background: $pgbg; |
border: 0px; |
border: 0px; |
Line 3145 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 { |
|
background: $tabbg; |
|
color: $font; |
|
font-family: $sans; |
|
font-size: smaller; |
|
} |
|
table#LC_breadcrumbs td.LC_breadcrumb_component { |
|
background: $tabbg; |
|
color: $font; |
|
font-family: $sans; |
|
font-size: larger; |
|
text-align: right; |
|
} |
.LC_menubuttons_inline_text { |
.LC_menubuttons_inline_text { |
color: $font; |
color: $font; |
font-family: $sans; |
font-family: $sans; |
Line 3227 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 3261 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 3423 Inputs: $title - optional title for the
|
Line 3484 Inputs: $title - optional title for the
|
head -> skip the <html><head> generation |
head -> skip the <html><head> generation |
body -> skip all <body> generation |
body -> skip all <body> generation |
|
|
|
no_inline_link -> if true and in remote mode, don't show the |
|
'Switch To Inline Menu' link |
|
|
=back |
=back |
|
|
=cut |
=cut |
Line 3458 sub start_page {
|
Line 3522 sub start_page {
|
$args->{'only_body'}, $args->{'domain'}, |
$args->{'only_body'}, $args->{'domain'}, |
$args->{'force_register'}, $args->{'body_title'}, |
$args->{'force_register'}, $args->{'body_title'}, |
$args->{'no_nav_bar'}, $args->{'bgcolor'}, |
$args->{'no_nav_bar'}, $args->{'bgcolor'}, |
$args->{'no_title'}); |
$args->{'no_title'}, $args->{'no_inline_link'}); |
} |
} |
} |
} |
|
|
Line 3599 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 3704 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)); |
|
|
|
$cdom = $env{'course.'.$cid.'.domain'}; |
|
$cnum = $env{'course.'.$cid.'.num'}; |
|
} |
|
|
if (!defined($possible_roles) || (grep/^st$/,@$possible_roles)) { |
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 3733 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 3773 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 3852 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 4039 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 4668 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 4750 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 4847 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 4921 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 4984 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 5022 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 5095 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 |