version 1.344, 2006/04/20 02:24:08
|
version 1.356, 2006/04/26 15:29:51
|
Line 76 my %language;
|
Line 76 my %language;
|
my %supported_language; |
my %supported_language; |
my %cprtag; |
my %cprtag; |
my %scprtag; |
my %scprtag; |
my %fe; my %fd; |
my %fe; my %fd; my %fm; |
my %category_extensions; |
my %category_extensions; |
|
|
# ---------------------------------------------- Designs |
# ---------------------------------------------- Designs |
Line 107 BEGIN {
|
Line 107 BEGIN {
|
my $langtabfile = $Apache::lonnet::perlvar{'lonTabDir'}. |
my $langtabfile = $Apache::lonnet::perlvar{'lonTabDir'}. |
'/language.tab'; |
'/language.tab'; |
if ( open(my $fh,"<$langtabfile") ) { |
if ( open(my $fh,"<$langtabfile") ) { |
while (<$fh>) { |
while (my $line = <$fh>) { |
next if /^\#/; |
next if ($line=~/^\#/); |
chomp; |
chomp($line); |
my ($key,$two,$country,$three,$enc,$val,$sup)=(split(/\t/,$_)); |
my ($key,$two,$country,$three,$enc,$val,$sup)=(split(/\t/,$line)); |
$language{$key}=$val.' - '.$enc; |
$language{$key}=$val.' - '.$enc; |
if ($sup) { |
if ($sup) { |
$supported_language{$key}=$sup; |
$supported_language{$key}=$sup; |
Line 124 BEGIN {
|
Line 124 BEGIN {
|
my $copyrightfile = $Apache::lonnet::perlvar{'lonIncludes'}. |
my $copyrightfile = $Apache::lonnet::perlvar{'lonIncludes'}. |
'/copyright.tab'; |
'/copyright.tab'; |
if ( open (my $fh,"<$copyrightfile") ) { |
if ( open (my $fh,"<$copyrightfile") ) { |
while (<$fh>) { |
while (my $line = <$fh>) { |
next if /^\#/; |
next if ($line=~/^\#/); |
chomp; |
chomp($line); |
my ($key,$val)=(split(/\s+/,$_,2)); |
my ($key,$val)=(split(/\s+/,$line,2)); |
$cprtag{$key}=$val; |
$cprtag{$key}=$val; |
} |
} |
close($fh); |
close($fh); |
} |
} |
} |
} |
# ------------------------------------------------------------------ source copyrights |
# ----------------------------------------------------------- source copyrights |
{ |
{ |
my $sourcecopyrightfile = $Apache::lonnet::perlvar{'lonIncludes'}. |
my $sourcecopyrightfile = $Apache::lonnet::perlvar{'lonIncludes'}. |
'/source_copyright.tab'; |
'/source_copyright.tab'; |
if ( open (my $fh,"<$sourcecopyrightfile") ) { |
if ( open (my $fh,"<$sourcecopyrightfile") ) { |
while (<$fh>) { |
while (my $line = <$fh>) { |
next if /^\#/; |
next if ($line =~ /^\#/); |
chomp; |
chomp($line); |
my ($key,$val)=(split(/\s+/,$_,2)); |
my ($key,$val)=(split(/\s+/,$line,2)); |
$scprtag{$key}=$val; |
$scprtag{$key}=$val; |
} |
} |
close($fh); |
close($fh); |
Line 159 BEGIN {
|
Line 159 BEGIN {
|
{ |
{ |
my $designfile = $designdir.'/'.$filename; |
my $designfile = $designdir.'/'.$filename; |
if ( open (my $fh,"<$designfile") ) { |
if ( open (my $fh,"<$designfile") ) { |
while (<$fh>) { |
while (my $line = <$fh>) { |
next if /^\#/; |
next if ($line =~ /^\#/); |
chomp; |
chomp($line); |
my ($key,$val)=(split(/\=/,$_)); |
my ($key,$val)=(split(/\=/,$line)); |
if ($val) { $designhash{$domain.'.'.$key}=$val; } |
if ($val) { $designhash{$domain.'.'.$key}=$val; } |
} |
} |
close($fh); |
close($fh); |
Line 178 BEGIN {
|
Line 178 BEGIN {
|
my $categoryfile = $Apache::lonnet::perlvar{'lonTabDir'}. |
my $categoryfile = $Apache::lonnet::perlvar{'lonTabDir'}. |
'/filecategories.tab'; |
'/filecategories.tab'; |
if ( open (my $fh,"<$categoryfile") ) { |
if ( open (my $fh,"<$categoryfile") ) { |
while (<$fh>) { |
while (my $line = <$fh>) { |
next if /^\#/; |
next if ($line =~ /^\#/); |
chomp; |
chomp($line); |
my ($extension,$category)=(split(/\s+/,$_,2)); |
my ($extension,$category)=(split(/\s+/,$line,2)); |
push @{$category_extensions{lc($category)}},$extension; |
push @{$category_extensions{lc($category)}},$extension; |
} |
} |
close($fh); |
close($fh); |
Line 193 BEGIN {
|
Line 193 BEGIN {
|
my $typesfile = $Apache::lonnet::perlvar{'lonTabDir'}. |
my $typesfile = $Apache::lonnet::perlvar{'lonTabDir'}. |
'/filetypes.tab'; |
'/filetypes.tab'; |
if ( open (my $fh,"<$typesfile") ) { |
if ( open (my $fh,"<$typesfile") ) { |
while (<$fh>) { |
while (my $line = <$fh>) { |
next if (/^\#/); |
next if ($line =~ /^\#/); |
chomp; |
chomp($line); |
my ($ending,$emb,$descr)=split(/\s+/,$_,3); |
my ($ending,$emb,$mime,$descr)=split(/\s+/,$line,4); |
if ($descr ne '') { |
if ($descr ne '') { |
$fe{$ending}=lc($emb); |
$fe{$ending}=lc($emb); |
$fd{$ending}=$descr; |
$fd{$ending}=$descr; |
|
if ($mime ne 'unk') { $fm{$ending}=$mime; } |
} |
} |
} |
} |
close($fh); |
close($fh); |
Line 706 sub help_open_menu {
|
Line 707 sub help_open_menu {
|
my $origurl = $ENV{'REQUEST_URI'}; |
my $origurl = $ENV{'REQUEST_URI'}; |
$origurl=~s|^/~|/priv/|; |
$origurl=~s|^/~|/priv/|; |
my $timestamp = time; |
my $timestamp = time; |
foreach (\$color,\$function,\$topic,\$component_help,\$faq,\$bug,\$origurl) { |
foreach my $datum (\$color,\$function,\$topic,\$component_help,\$faq, |
$$_ = &Apache::lonnet::escape($$_); |
\$bug,\$origurl) { |
|
$$datum = &Apache::lonnet::escape($$datum); |
} |
} |
if (!$stayOnPage) { |
if (!$stayOnPage) { |
$link = "javascript:helpMenu('open')"; |
$link = "javascript:helpMenu('open')"; |
Line 1152 sub get_domains {
|
Line 1154 sub get_domains {
|
# The code below was stolen from "The Perl Cookbook", p 102, 1st ed. |
# The code below was stolen from "The Perl Cookbook", p 102, 1st ed. |
my @domains; |
my @domains; |
my %seen; |
my %seen; |
foreach (sort values(%Apache::lonnet::hostdom)) { |
foreach my $dom (sort(values(%Apache::lonnet::hostdom))) { |
push (@domains,$_) unless $seen{$_}++; |
push(@domains,$dom) unless $seen{$dom}++; |
} |
} |
return @domains; |
return @domains; |
} |
} |
Line 1207 sub multiple_select_form {
|
Line 1209 sub multiple_select_form {
|
my @order = ref($order) ? @$order |
my @order = ref($order) ? @$order |
: sort(keys(%$hash)); |
: sort(keys(%$hash)); |
foreach my $key (@order) { |
foreach my $key (@order) { |
$output.='<option value="'.$key.'" '; |
$output.='<option value="'.&HTML::Entities::encode($key,'"<>&').'" '; |
$output.='selected="selected" ' if ($selected{$key}); |
$output.='selected="selected" ' if ($selected{$key}); |
$output.='>'.$hash->{$key}."</option>\n"; |
$output.='>'.$hash->{$key}."</option>\n"; |
} |
} |
Line 1237 sub select_form {
|
Line 1239 sub select_form {
|
} else { |
} else { |
@keys=sort(keys(%hash)); |
@keys=sort(keys(%hash)); |
} |
} |
foreach (@keys) { |
foreach my $key (@keys) { |
$selectform.="<option value=\"$_\" ". |
$selectform.= |
($_ eq $def ? 'selected="selected" ' : ''). |
'<option value="'.&HTML::Entities::encode($key,'"<>&').'" '. |
">".&mt($hash{$_})."</option>\n"; |
($key eq $def ? 'selected="selected" ' : ''). |
|
">".&mt($hash{$key})."</option>\n"; |
} |
} |
$selectform.="</select>"; |
$selectform.="</select>"; |
return $selectform; |
return $selectform; |
Line 1304 sub select_dom_form {
|
Line 1307 sub select_dom_form {
|
my @domains = get_domains(); |
my @domains = get_domains(); |
if ($includeempty) { @domains=('',@domains); } |
if ($includeempty) { @domains=('',@domains); } |
my $selectdomain = "<select name=\"$name\" size=\"1\">\n"; |
my $selectdomain = "<select name=\"$name\" size=\"1\">\n"; |
foreach (@domains) { |
foreach my $dom (@domains) { |
$selectdomain.="<option value=\"$_\" ". |
$selectdomain.="<option value=\"$dom\" ". |
($_ eq $defdom ? 'selected="selected" ' : ''). |
($dom eq $defdom ? 'selected="selected" ' : ''). |
">$_</option>\n"; |
">$dom</option>\n"; |
} |
} |
$selectdomain.="</select>"; |
$selectdomain.="</select>"; |
return $selectdomain; |
return $selectdomain; |
Line 1329 given $domain.
|
Line 1332 given $domain.
|
sub get_library_servers { |
sub get_library_servers { |
my $domain = shift; |
my $domain = shift; |
my %library_servers; |
my %library_servers; |
foreach (keys(%Apache::lonnet::libserv)) { |
foreach my $hostid (keys(%Apache::lonnet::libserv)) { |
if ($Apache::lonnet::hostdom{$_} eq $domain) { |
if ($Apache::lonnet::hostdom{$hostid} eq $domain) { |
$library_servers{$_} = $Apache::lonnet::hostname{$_}; |
$library_servers{$hostid} = $Apache::lonnet::hostname{$hostid}; |
} |
} |
} |
} |
return %library_servers; |
return %library_servers; |
Line 1353 sub home_server_option_list {
|
Line 1356 sub home_server_option_list {
|
my $domain = shift; |
my $domain = shift; |
my %servers = &get_library_servers($domain); |
my %servers = &get_library_servers($domain); |
my $result = ''; |
my $result = ''; |
foreach (sort keys(%servers)) { |
foreach my $hostid (sort(keys(%servers))) { |
$result.= |
$result.= |
'<option value="'.$_.'">'.$_.' '.$servers{$_}."</option>\n"; |
'<option value="'.$hostid.'">'. |
|
$hostid.' '.$servers{$hostid}."</option>\n"; |
} |
} |
return $result; |
return $result; |
} |
} |
Line 1845 sub initialize_keywords {
|
Line 1849 sub initialize_keywords {
|
} |
} |
untie %thesaurus_db; |
untie %thesaurus_db; |
# Remove special values from %Keywords. |
# Remove special values from %Keywords. |
foreach ('total.count','average.count') { |
foreach my $value ('total.count','average.count') { |
delete($Keywords{$_}) if (exists($Keywords{$_})); |
delete($Keywords{$value}) if (exists($Keywords{$value})); |
} |
} |
return 1; |
return 1; |
} |
} |
Line 1902 sub get_related_words {
|
Line 1906 sub get_related_words {
|
} |
} |
my @Words=(); |
my @Words=(); |
if (exists($thesaurus_db{$keyword})) { |
if (exists($thesaurus_db{$keyword})) { |
$_ = $thesaurus_db{$keyword}; |
# The first element is the number of times |
(undef,@Words) = split/:/; # The first element is the number of times |
# the word appears. We do not need it now. |
# the word appears. We do not need it now. |
(undef,@Words) = (split(/:/,$thesaurus_db{$keyword})); |
for (my $i=0;$i<=$#Words;$i++) { |
for (my $i=0;$i<=$#Words;$i++) { |
($Words[$i],undef)= split/\,/,$Words[$i]; |
($Words[$i],undef)= split(/\,/,$Words[$i]); |
} |
} |
} |
} |
untie %thesaurus_db; |
untie %thesaurus_db; |
Line 1947 sub plainname {
|
Line 1951 sub plainname {
|
$name=~s/^\s+//; |
$name=~s/^\s+//; |
$name=~s/\s+$//; |
$name=~s/\s+$//; |
$name=~s/\s+/ /g; |
$name=~s/\s+/ /g; |
if ($name !~ /\S/) { $name=$uname.'@'.$udom; } |
if ($name !~ /\S/) { $name=$uname.':'.$udom; } |
return $name; |
return $name; |
} |
} |
|
|
Line 2183 category
|
Line 2187 category
|
=cut |
=cut |
|
|
sub filecategorytypes { |
sub filecategorytypes { |
return @{$category_extensions{lc($_[0])}}; |
my ($cat) = @_; |
|
return @{$category_extensions{lc($cat)}}; |
} |
} |
|
|
=pod |
=pod |
Line 2198 sub fileembstyle {
|
Line 2203 sub fileembstyle {
|
return $fe{lc(shift(@_))}; |
return $fe{lc(shift(@_))}; |
} |
} |
|
|
|
sub filemimetype { |
|
return $fm{lc(shift(@_))}; |
|
} |
|
|
|
|
sub filecategoryselect { |
sub filecategoryselect { |
my ($name,$value)=@_; |
my ($name,$value)=@_; |
Line 2254 sub fileextensions {
|
Line 2263 sub fileextensions {
|
|
|
sub display_languages { |
sub display_languages { |
my %languages=(); |
my %languages=(); |
foreach (&preferred_languages()) { |
foreach my $lang (&preferred_languages()) { |
$languages{$_}=1; |
$languages{$lang}=1; |
} |
} |
&get_unprocessed_cgi($ENV{'QUERY_STRING'},['displaylanguage']); |
&get_unprocessed_cgi($ENV{'QUERY_STRING'},['displaylanguage']); |
if ($env{'form.displaylanguage'}) { |
if ($env{'form.displaylanguage'}) { |
foreach (split(/\s*(\,|\;|\:)\s*/,$env{'form.displaylanguage'})) { |
foreach my $lang (split(/\s*(\,|\;|\:)\s*/,$env{'form.displaylanguage'})) { |
$languages{$_}=1; |
$languages{$lang}=1; |
} |
} |
} |
} |
return %languages; |
return %languages; |
Line 2295 sub preferred_languages {
|
Line 2304 sub preferred_languages {
|
} |
} |
# turn "en-ca" into "en-ca,en" |
# turn "en-ca" into "en-ca,en" |
my @genlanguages; |
my @genlanguages; |
foreach (@languages) { |
foreach my $lang (@languages) { |
unless ($_=~/\w/) { next; } |
unless ($lang=~/\w/) { next; } |
push (@genlanguages,$_); |
push (@genlanguages,$lang); |
if ($_=~/(\-|\_)/) { |
if ($lang=~/(\-|\_)/) { |
push (@genlanguages,(split(/(\-|\_)/,$_))[0]); |
push(@genlanguages,(split(/(\-|\_)/,$lang))[0]); |
} |
} |
} |
} |
return @genlanguages; |
return @genlanguages; |
Line 2355 sub get_previous_attempt {
|
Line 2364 sub get_previous_attempt {
|
my %lasthash=(); |
my %lasthash=(); |
my $version; |
my $version; |
for ($version=1;$version<=$returnhash{'version'};$version++) { |
for ($version=1;$version<=$returnhash{'version'};$version++) { |
foreach (sort(split(/\:/,$returnhash{$version.':keys'}))) { |
foreach my $key (sort(split(/\:/,$returnhash{$version.':keys'}))) { |
$lasthash{$_}=$returnhash{$version.':'.$_}; |
$lasthash{$key}=$returnhash{$version.':'.$key}; |
} |
} |
} |
} |
$prevattempts='<table border="0" width="100%"><tr><td bgcolor="#777777">'; |
$prevattempts='<table border="0" width="100%"><tr><td bgcolor="#777777">'; |
$prevattempts.='<table border="0" width="100%"><tr bgcolor="#e6ffff"><td>History</td>'; |
$prevattempts.='<table border="0" width="100%"><tr bgcolor="#e6ffff"><td>History</td>'; |
foreach (sort(keys %lasthash)) { |
foreach my $key (sort(keys(%lasthash))) { |
my ($ign,@parts) = split(/\./,$_); |
my ($ign,@parts) = split(/\./,$key); |
if ($#parts > 0) { |
if ($#parts > 0) { |
my $data=$parts[-1]; |
my $data=$parts[-1]; |
pop(@parts); |
pop(@parts); |
Line 2378 sub get_previous_attempt {
|
Line 2387 sub get_previous_attempt {
|
if ($getattempt eq '') { |
if ($getattempt eq '') { |
for ($version=1;$version<=$returnhash{'version'};$version++) { |
for ($version=1;$version<=$returnhash{'version'};$version++) { |
$prevattempts.='</tr><tr bgcolor="#ffffe6"><td>Transaction '.$version.'</td>'; |
$prevattempts.='</tr><tr bgcolor="#ffffe6"><td>Transaction '.$version.'</td>'; |
foreach (sort(keys %lasthash)) { |
foreach my $key (sort(keys(%lasthash))) { |
my $value; |
my $value; |
if ($_ =~ /timestamp/) { |
if ($key =~ /timestamp/) { |
$value=scalar(localtime($returnhash{$version.':'.$_})); |
$value=scalar(localtime($returnhash{$version.':'.$key})); |
} else { |
} else { |
$value=$returnhash{$version.':'.$_}; |
$value=$returnhash{$version.':'.$key}; |
} |
} |
$prevattempts.='<td>'.&Apache::lonnet::unescape($value).' </td>'; |
$prevattempts.='<td>'.&Apache::lonnet::unescape($value).' </td>'; |
} |
} |
} |
} |
} |
} |
$prevattempts.='</tr><tr bgcolor="#ffffe6"><td>Current</td>'; |
$prevattempts.='</tr><tr bgcolor="#ffffe6"><td>Current</td>'; |
foreach (sort(keys %lasthash)) { |
foreach my $key (sort(keys(%lasthash))) { |
my $value; |
my $value; |
if ($_ =~ /timestamp/) { |
if ($key =~ /timestamp/) { |
$value=scalar(localtime($lasthash{$_})); |
$value=scalar(localtime($lasthash{$key})); |
} else { |
} else { |
$value=$lasthash{$_}; |
$value=$lasthash{$key}; |
} |
} |
$value=&Apache::lonnet::unescape($value); |
$value=&Apache::lonnet::unescape($value); |
if ($_ =~/$regexp$/ && (defined &$gradesub)) {$value = &$gradesub($value)} |
if ($key =~/$regexp$/ && (defined &$gradesub)) {$value = &$gradesub($value)} |
$prevattempts.='<td>'.$value.' </td>'; |
$prevattempts.='<td>'.$value.' </td>'; |
} |
} |
$prevattempts.='</tr></table></td></tr></table>'; |
$prevattempts.='</tr></table></td></tr></table>'; |
Line 2430 sub relative_to_absolute {
|
Line 2439 sub relative_to_absolute {
|
} |
} |
} |
} |
$thisdir=~s-/[^/]*$--; |
$thisdir=~s-/[^/]*$--; |
foreach (@rlinks) { |
foreach my $link (@rlinks) { |
unless (($_=~/^http:\/\//i) || |
unless (($link=~/^http:\/\//i) || |
($_=~/^\//) || |
($link=~/^\//) || |
($_=~/^javascript:/i) || |
($link=~/^javascript:/i) || |
($_=~/^mailto:/i) || |
($link=~/^mailto:/i) || |
($_=~/^\#/)) { |
($link=~/^\#/)) { |
my $newlocation=&Apache::lonnet::hreflocation($thisdir,$_); |
my $newlocation=&Apache::lonnet::hreflocation($thisdir,$link); |
$output=~s/(\"|\'|\=\s*)$_(\"|\'|\s|\>)/$1$newlocation$2/; |
$output=~s/(\"|\'|\=\s*)\Q$link\E(\"|\'|\s|\>)/$1$newlocation$2/; |
} |
} |
} |
} |
# -------------------------------------------------- Deal with Applet codebases |
# -------------------------------------------------- Deal with Applet codebases |
Line 2605 sub maketime {
|
Line 2614 sub maketime {
|
######################################### |
######################################### |
|
|
sub findallcourses { |
sub findallcourses { |
my %courses=(); |
my ($roles) = @_; |
|
my %roles; |
|
if (ref($roles)) { %roles = map { $_ => 1 } @{$roles}; } |
|
my %courses; |
my $now=time; |
my $now=time; |
foreach (keys %env) { |
foreach my $key (keys(%env)) { |
if ($_=~/^user\.role\.\w+\.\/(\w+)\/(\w+)/) { |
if ( $key=~m{^user\.role\.(\w+)\./(\w+)/(\w+)} ) { |
my ($starttime,$endtime)=$env{$_}; |
my ($role,$domain,$id) = ($1,$2,$3); |
|
next if ($role eq 'ca' || $role eq 'aa'); |
|
next if (%roles && !exists($roles{$role})); |
|
my ($starttime,$endtime)=split(/\./,$env{$key}); |
my $active=1; |
my $active=1; |
if ($starttime) { |
if ($starttime) { |
if ($now<$starttime) { $active=0; } |
if ($now<$starttime) { $active=0; } |
Line 2617 sub findallcourses {
|
Line 2632 sub findallcourses {
|
if ($endtime) { |
if ($endtime) { |
if ($now>$endtime) { $active=0; } |
if ($now>$endtime) { $active=0; } |
} |
} |
if ($active) { $courses{$1.'_'.$2}=1; } |
if ($active) { $courses{$domain.'_'.$id}=1; } |
} |
} |
} |
} |
return keys %courses; |
return keys(%courses); |
} |
} |
|
|
############################################### |
############################################### |
Line 2948 $titleinfo $dc_info $menu
|
Line 2963 $titleinfo $dc_info $menu
|
</td></tr> |
</td></tr> |
<tr> |
<tr> |
<td bgcolor="$tabbg" align="right"><font size="2" face="Arial, Helvetica, sans-serif">$realm</font> </td></tr> |
<td bgcolor="$tabbg" align="right"><font size="2" face="Arial, Helvetica, sans-serif">$realm</font> </td></tr> |
</table><br /> |
</table> |
ENDBODY |
ENDBODY |
} |
} |
|
|
Line 3041 sub endbodytag {
|
Line 3056 sub endbodytag {
|
return $endbodytag; |
return $endbodytag; |
} |
} |
|
|
|
=pod |
|
|
|
=over 4 |
|
|
|
=item * &standard_css() |
|
|
|
Returns a style sheet |
|
|
|
Inputs: (all optional) |
|
domain -> force to color decorate a page for a specific |
|
domain |
|
function -> force usage of a specific rolish color scheme |
|
bgcolor -> override the default page bgcolor |
|
|
|
=back |
|
|
|
=cut |
|
|
sub standard_css { |
sub standard_css { |
|
my ($function,$domain,$bgcolor) = @_; |
|
$function = &get_users_function() if (!$function); |
|
my $img = &designparm($function.'.img', $domain); |
|
my $tabbg = &designparm($function.'.tabbg', $domain); |
|
my $font = &designparm($function.'.font', $domain); |
|
my $sidebg = &designparm($function.'.sidebg',$domain); |
|
my $pgbg = $bgcolor || |
|
&designparm($function.'.pgbg', $domain); |
|
my $alink = &designparm($function.'.alink', $domain); |
|
my $vlink = &designparm($function.'.vlink', $domain); |
|
my $link = &designparm($function.'.link', $domain); |
|
|
|
my $sans = 'Arial,Helvetica,sans-serif'; |
|
my $data_table_head = $tabbg; |
|
my $data_table_light = '#EEEEEE'; |
|
my $data_table_dark = '#DDD'; |
|
my $data_table_highlight = '#FFFF00'; |
|
my $mail_new = '#FFBB77'; |
|
my $mail_new_hover = '#DD9955'; |
|
my $mail_read = '#BBBB77'; |
|
my $mail_read_hover = '#999944'; |
|
my $mail_replied = '#AAAA88'; |
|
my $mail_replied_hover = '#888855'; |
|
my $mail_other = '#99BBBB'; |
|
my $mail_other_hover = '#669999'; |
|
|
return <<END; |
return <<END; |
<style type="text/css"> |
<style type="text/css"> |
h1, h2, h3, th { font-family: Arial, Helvetica, sans-serif } |
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; } |
table.thinborder tr th, table.thinborder tr td { border-style: solid; border-width: 1px} |
table.thinborder tr th, table.thinborder tr td { border-style: solid; border-width: 1px} |
form, .inline { display: inline; } |
form, .inline { display: inline; } |
.center { text-align: center; } |
.center { text-align: center; } |
.filename {font-family: monospace;} |
.filename {font-family: monospace;} |
|
.LC_error { |
|
color: red; |
|
font-size: larger; |
|
} |
|
.LC_success { |
|
color: green; |
|
} |
|
|
|
table#LC_top_nav, table#LC_menubuttons, table#LC_nav_location { |
|
width: 100%; |
|
background: $pgbg; |
|
border: 0px; |
|
border-spacing: 1px; |
|
padding: 0px; |
|
margin: 0px; |
|
border-collapse: separate; |
|
} |
|
table#LC_menubuttons_mainmenu { |
|
background: $pgbg; |
|
border: 0px; |
|
border-spacing: 1px; |
|
padding: 0px; |
|
margin: 0px; |
|
border-collapse: separate; |
|
} |
|
table#LC_menubuttons img, table#LC_menubuttons_mainmenu img { |
|
border: 0px; |
|
} |
|
table#LC_top_nav td { |
|
background: $tabbg; |
|
} |
|
table#LC_top_nav td a, div#LC_top_nav a { |
|
color: $font; |
|
font-family: $sans; |
|
} |
|
.LC_menubuttons_inline_text { |
|
color: $font; |
|
font-family: $sans; |
|
font-size: smaller; |
|
} |
|
|
|
td.LC_menubuttons_text { |
|
color: $font; |
|
font-family: $sans; |
|
} |
|
td.LC_menubuttons_img { |
|
background: $tabbg; |
|
} |
|
.LC_current_location { |
|
font-family: $sans; |
|
background: $tabbg; |
|
} |
|
.LC_new_mail { |
|
font-family: $sans; |
|
font-weight: bold; |
|
} |
|
|
|
table.LC_data_table, table.LC_mail_list { |
|
border: 1px solid #000000; |
|
border-collapse: seperate; |
|
} |
|
table.LC_data_table tr th, table.LC_calendar tr th, table.LC_mail_list tr th { |
|
font-weight: bold; |
|
background-color: $data_table_head; |
|
} |
|
table.LC_data_table tr td { |
|
background-color: $data_table_light; |
|
} |
|
table.LC_data_table tr.LC_even_row td { |
|
background-color: $data_table_dark; |
|
} |
|
table.LC_data_table tr.LC_empty td { |
|
background-color: #FFFFFF; |
|
} |
|
|
|
table.LC_calendar { |
|
border: 1px solid #000000; |
|
border-collapse: collapse; |
|
} |
|
table.LC_calendar_pickdate { |
|
font-size: xx-small; |
|
} |
|
table.LC_calendar tr td { |
|
border: 1px solid #000000; |
|
vertical-align: top; |
|
} |
|
table.LC_calendar tr td.LC_calendar_day_empty { |
|
background-color: $data_table_dark; |
|
} |
|
table.LC_calendar tr td.LC_calendar_day_current { |
|
background-color: $data_table_highlight; |
|
} |
|
|
|
table.LC_mail_list tr.LC_mail_new { |
|
background-color: $mail_new; |
|
} |
|
table.LC_mail_list tr.LC_mail_new:hover { |
|
background-color: $mail_new_hover; |
|
} |
|
table.LC_mail_list tr.LC_mail_read { |
|
background-color: $mail_read; |
|
} |
|
table.LC_mail_list tr.LC_mail_read:hover { |
|
background-color: $mail_read_hover; |
|
} |
|
table.LC_mail_list tr.LC_mail_replied { |
|
background-color: $mail_replied; |
|
} |
|
table.LC_mail_list tr.LC_mail_replied:hover { |
|
background-color: $mail_replied_hover; |
|
} |
|
table.LC_mail_list tr.LC_mail_other { |
|
background-color: $mail_other; |
|
} |
|
table.LC_mail_list tr.LC_mail_other:hover { |
|
background-color: $mail_other_hover; |
|
} |
</style> |
</style> |
END |
END |
} |
} |
Line 3068 Inputs: $title - optional title for the
|
Line 3244 Inputs: $title - optional title for the
|
$args - optional arguments |
$args - optional arguments |
force_register - if is true call registerurl so the remote is |
force_register - if is true call registerurl so the remote is |
informed |
informed |
redirect - array ref of seconds before redirect occurs |
redirect -> array ref of seconds before redirect occurs |
url to redirect to |
url to redirect to |
(side effect of setting |
(side effect of setting |
$env{'internal.head.redirect'} to the url |
$env{'internal.head.redirect'} to the url |
redirected too) |
redirected too) |
|
domain -> force to color decorate a page for a specific |
|
domain |
|
function -> force usage of a specific rolish color scheme |
|
bgcolor -> override the default page bgcolor |
|
|
=back |
=back |
|
|
=cut |
=cut |
Line 3082 sub headtag {
|
Line 3263 sub headtag {
|
|
|
my $result = |
my $result = |
'<head>'. |
'<head>'. |
&standard_css(). |
&standard_css($args->{'function'},$args->{'domain'}, |
|
$args->{'bgcolor'}). |
&font_settings(). |
&font_settings(). |
&Apache::lonhtmlcommon::htmlareaheaders(); |
&Apache::lonhtmlcommon::htmlareaheaders(); |
|
|
Line 3249 sub start_page {
|
Line 3431 sub start_page {
|
my ($title,$head_extra,$args) = @_; |
my ($title,$head_extra,$args) = @_; |
#&Apache::lonnet::logthis("start_page ".join(':',caller(0))); |
#&Apache::lonnet::logthis("start_page ".join(':',caller(0))); |
my %head_args; |
my %head_args; |
foreach my $arg ('redirect','force_register') { |
foreach my $arg ('redirect','force_register','domain','function', |
|
'bgcolor') { |
if (defined($args->{$arg})) { |
if (defined($args->{$arg})) { |
$head_args{$arg} = $args->{$arg}; |
$head_args{$arg} = $args->{$arg}; |
} |
} |
Line 3395 sub simple_error_page {
|
Line 3578 sub simple_error_page {
|
} |
} |
return $page; |
return $page; |
} |
} |
|
|
|
{ |
|
my $row_count; |
|
sub start_data_table { |
|
undef($row_count); |
|
return '<table class="LC_data_table">'; |
|
} |
|
|
|
sub end_data_table { |
|
undef($row_count); |
|
return '</table>'; |
|
} |
|
|
|
sub start_data_table_row { |
|
$row_count++; |
|
return '<tr '.(($row_count % 2)?'':'class="LC_even_row"').'>'; |
|
} |
|
|
|
sub end_data_table_row { |
|
return '</tr>'; |
|
} |
|
} |
|
|
############################################### |
############################################### |
|
|
=pod |
=pod |
Line 3831 will result in $env{'form.uname'} and $e
|
Line 4037 will result in $env{'form.uname'} and $e
|
sub get_unprocessed_cgi { |
sub get_unprocessed_cgi { |
my ($query,$possible_names)= @_; |
my ($query,$possible_names)= @_; |
# $Apache::lonxml::debug=1; |
# $Apache::lonxml::debug=1; |
foreach (split(/&/,$query)) { |
foreach my $pair (split(/&/,$query)) { |
my ($name, $value) = split(/=/,$_); |
my ($name, $value) = split(/=/,$pair); |
$name = &Apache::lonnet::unescape($name); |
$name = &Apache::lonnet::unescape($name); |
if (!defined($possible_names) || (grep {$_ eq $name} @$possible_names)) { |
if (!defined($possible_names) || (grep {$_ eq $name} @$possible_names)) { |
$value =~ tr/+/ /; |
$value =~ tr/+/ /; |
Line 4049 sub record_sep {
|
Line 4255 sub record_sep {
|
if ($env{'form.upfiletype'} eq 'xml') { |
if ($env{'form.upfiletype'} eq 'xml') { |
} elsif ($env{'form.upfiletype'} eq 'space') { |
} elsif ($env{'form.upfiletype'} eq 'space') { |
my $i=0; |
my $i=0; |
foreach (split(/\s+/,$record)) { |
foreach my $field (split(/\s+/,$record)) { |
my $field=$_; |
|
$field=~s/^(\"|\')//; |
$field=~s/^(\"|\')//; |
$field=~s/(\"|\')$//; |
$field=~s/(\"|\')$//; |
$components{&takeleft($i)}=$field; |
$components{&takeleft($i)}=$field; |
Line 4058 sub record_sep {
|
Line 4263 sub record_sep {
|
} |
} |
} elsif ($env{'form.upfiletype'} eq 'tab') { |
} elsif ($env{'form.upfiletype'} eq 'tab') { |
my $i=0; |
my $i=0; |
foreach (split(/\t/,$record)) { |
foreach my $field (split(/\t/,$record)) { |
my $field=$_; |
|
$field=~s/^(\"|\')//; |
$field=~s/^(\"|\')//; |
$field=~s/(\"|\')$//; |
$field=~s/(\"|\')$//; |
$components{&takeleft($i)}=$field; |
$components{&takeleft($i)}=$field; |
Line 4153 sub csv_print_samples {
|
Line 4357 sub csv_print_samples {
|
my $samples = &get_samples($records,3); |
my $samples = &get_samples($records,3); |
|
|
$r->print(&mt('Samples').'<br /><table border="2"><tr>'); |
$r->print(&mt('Samples').'<br /><table border="2"><tr>'); |
foreach (sort({$a <=> $b} keys(%{ $samples->[0] }))) { |
foreach my $sample (sort({$a <=> $b} keys(%{ $samples->[0] }))) { |
$r->print('<th>'.&mt('Column [_1]',($_+1)).'</th>'); } |
$r->print('<th>'.&mt('Column [_1]',($sample+1)).'</th>'); } |
$r->print('</tr>'); |
$r->print('</tr>'); |
foreach my $hash (@$samples) { |
foreach my $hash (@$samples) { |
$r->print('<tr>'); |
$r->print('<tr>'); |
foreach (sort({$a <=> $b} keys(%{ $samples->[0] }))) { |
foreach my $sample (sort({$a <=> $b} keys(%{ $samples->[0] }))) { |
$r->print('<td>'); |
$r->print('<td>'); |
if (defined($$hash{$_})) { $r->print($$hash{$_}); } |
if (defined($$hash{$sample})) { $r->print($$hash{$sample}); } |
$r->print('</td>'); |
$r->print('</td>'); |
} |
} |
$r->print('</tr>'); |
$r->print('</tr>'); |
Line 4193 sub csv_print_select_table {
|
Line 4397 sub csv_print_select_table {
|
'<table border="2"><tr>'. |
'<table border="2"><tr>'. |
'<th>'.&mt('Attribute').'</th>'. |
'<th>'.&mt('Attribute').'</th>'. |
'<th>'.&mt('Column').'</th></tr>'."\n"); |
'<th>'.&mt('Column').'</th></tr>'."\n"); |
foreach (@$d) { |
foreach my $array_ref (@$d) { |
my ($value,$display,$defaultcol)=@{ $_ }; |
my ($value,$display,$defaultcol)=@{ $array_ref }; |
$r->print('<tr><td>'.$display.'</td>'); |
$r->print('<tr><td>'.$display.'</td>'); |
|
|
$r->print('<td><select name=f'.$i. |
$r->print('<td><select name=f'.$i. |
' onchange="javascript:flip(this.form,'.$i.');">'); |
' onchange="javascript:flip(this.form,'.$i.');">'); |
$r->print('<option value="none"></option>'); |
$r->print('<option value="none"></option>'); |
foreach (sort({$a <=> $b} keys(%{ $samples->[0] }))) { |
foreach my $sample (sort({$a <=> $b} keys(%{ $samples->[0] }))) { |
$r->print('<option value="'.$_.'"'. |
$r->print('<option value="'.$sample.'"'. |
($_ eq $defaultcol ? ' selected="selected" ' : ''). |
($sample eq $defaultcol ? ' selected="selected" ' : ''). |
'>Column '.($_+1).'</option>'); |
'>Column '.($sample+1).'</option>'); |
} |
} |
$r->print('</select></td></tr>'."\n"); |
$r->print('</select></td></tr>'."\n"); |
$i++; |
$i++; |