/[Frey]/branches/zimbardo/lib/Frey/Web.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /branches/zimbardo/lib/Frey/Web.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 584 by dpavlin, Fri Nov 28 13:25:17 2008 UTC revision 588 by dpavlin, Fri Nov 28 15:07:03 2008 UTC
# Line 102  sub popup_dropdown { Line 102  sub popup_dropdown {
102    
103          if ( $name =~ m{::} && $name !~ $re_html ) {          if ( $name =~ m{::} && $name !~ $re_html ) {
104                  return qq|<a class="frey-$type" target="$name" href="/$name">$name $content</a>\n|;                  return qq|<a class="frey-$type" target="$name" href="/$name">$name $content</a>\n|;
105            } elsif ( $name =~ s{^\s*(<a)\s+}{$1 class="frey-$type"} ) {
106                    return qq|$name $content\n|;
107          } else {          } else {
108                  return qq|<span class="frey-$type">$name $content</span>\n|;                  return qq|<span class="frey-$type">$name $content</span>\n|;
109          }          }
# Line 459  sub warnings_html { Line 461  sub warnings_html {
461          $level ||= $self->debug,          $level ||= $self->debug,
462          my $path = $self->log_path;          my $path = $self->log_path;
463    
464          my $warnings;          my $max = 50;
465            my $pos = 0;
466            my @warnings = ( '' x $max ); # XXX circualar buffer for 50 lines
467          my $line = 0;          my $line = 0;
468          my $multiline_end;          my $multiline_end;
469    
# Line 470  sub warnings_html { Line 474  sub warnings_html {
474    
475                  my $style = '';                  my $style = '';
476    
477    =for filter
478    
479                  if ( $multiline_end ) {                  if ( $multiline_end ) {
480                          if ( m{^\Q$multiline_end\E} || m{^\s.+\Q$multiline_end\E;$} ) {                          if ( m{^\Q$multiline_end\E} || m{^\s.+\Q$multiline_end\E;$} ) {
481  #                               warn "## $line end of $multiline_end in '$_'\n";  #                               warn "## $line end of $multiline_end in '$_'\n";
# Line 486  sub warnings_html { Line 492  sub warnings_html {
492                                  next;                                  next;
493                          }                          }
494    
495    =cut
496                    if ( m{^(#*)\s+} ) { # FIXME
497    
498                          $style = $warn_colors->{$1}                          $style = $warn_colors->{$1}
499                                  ? ' style="color:' . $warn_colors->{$1} . '"'                                  ? ' style="color:' . $warn_colors->{$1} . '"'
500                                  : '';                                  : '';
# Line 496  sub warnings_html { Line 505  sub warnings_html {
505                                  $msg = substr( $msg, 0, $self->html_dump_width );                                  $msg = substr( $msg, 0, $self->html_dump_width );
506                                  $spacer = '&hellip;'                                  $spacer = '&hellip;'
507                          }                          }
508                          $msg =~ s{^\s}{&nbsp;}g;                          $warnings[ $pos++ % $max ]
509                          $warnings .= qq|<tt$style>$msg</tt>$spacer<small><a target="editor" href="/editor+$path+$line">+$line</a></small><br/>|;                                  = $msg
510    #                               = ( $style ? qq|<span$style>$msg</span>| : $msg )
511                                    . $spacer
512                                    . qq|<a target="editor" href="/editor+$path+$line" style="float: right;">+$line</a><br/>|;
513                          # FIXME <tt> should be <code> but CSS hates me                          # FIXME <tt> should be <code> but CSS hates me
514                  }                  }
515          }          }
516          close($log) || die "can't close $path: $!";          close($log) || die "can't close $path: $!";
517    
518            my $size = -s $path;
519    
520            my $warnings = join('',
521                    map { $warnings[ ( $pos + $_ ) % $max ] || '' } 0 .. $max
522            );
523    
524            my $s = length($warnings);
525    
526          return          return
527                    qq|<span class="frey-popup"><a target="editor" href="/editor+$path+$line" title="open $path level $level">warn</a><span>|                  # need to wrap into span so we can have links in warnings
528                  . $self->editor_links( $warnings )                    qq|<span class="frey-popup"><a target="editor" href="/editor+$path+$line" title="$path \| $size -> $s bytes \| $line -> $pos lines \| level $level">warn</a><code>|
529                  . qq|</span></span>|                  . $warnings
530    #               . $self->editor_links( $warnings )
531                    . qq|</code></span></a>|
532                  ;                  ;
533  }  }
534    

Legend:
Removed from v.584  
changed lines
  Added in v.588

  ViewVC Help
Powered by ViewVC 1.1.26