/[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 578 by dpavlin, Fri Nov 28 00:42:35 2008 UTC revision 581 by dpavlin, Fri Nov 28 13:16:47 2008 UTC
# Line 79  sub html_dump { Line 79  sub html_dump {
79          $dump =~ s{(\n[^\n]{$width})([^\n]+?)([^\n]{5})}{\n$1...$3}gs;          $dump =~ s{(\n[^\n]{$width})([^\n]+?)([^\n]{5})}{\n$1...$3}gs;
80          $dump = $self->html_escape( $dump );          $dump = $self->html_escape( $dump );
81          $dump =~ s{\Q...\E}{…}gs;          $dump =~ s{\Q...\E}{…}gs;
82    #       $dump =~ $self->editor_links( $dump ); # FIXME include this
83          return "<code>$dump</code>";          return "<code>$dump</code>";
84  }  }
85    
# Line 94  sub popup_dropdown { Line 95  sub popup_dropdown {
95    
96          $content = qq|<span>$content</span>| unless $content =~ m{^\s*<(span|a|code).+?/\1>\s*};          $content = qq|<span>$content</span>| unless $content =~ m{^\s*<(span|a|code).+?/\1>\s*};
97    
98            $content =~ s{<span>(<code>[^<]+</code>)</span>}{$1} && $self->TODO("code wrapped in span");
99    
100          warn "## $type [$name] = ", length( $content ), " bytes" if $self->debug;          warn "## $type [$name] = ", length( $content ), " bytes" if $self->debug;
101    
102          if ( $name =~ m{::} && $name !~ $re_html ) {          if ( $name =~ m{::} && $name !~ $re_html ) {
# Line 166  sub add_css { Line 169  sub add_css {
169          my ( $package, $path, $line ) = caller;          my ( $package, $path, $line ) = caller;
170          $self->add_head( qq|          $self->add_head( qq|
171          <style type="text/css">          <style type="text/css">
172          /* via package $package at $path line $line */          /* via $package at $path line $line */
173          $css          $css
174          </style>          </style>
175          | );          | );
# Line 200  sub page { Line 203  sub page {
203    
204          my $status_line = '';          my $status_line = '';
205    
         unshift @status, { 'ClassBrowser' => Frey::ClassBrowser->new( usage_on_top => 0 )->as_markup };  
 #       unshift @status, { 'Bookmarklets' => Frey::Bookmarklet->new->as_markup };  
         unshift @status, { 'INC' => Frey::INC->new->as_markup };  
   
206          foreach my $part ( @status ) {          foreach my $part ( @status ) {
207                  foreach my $name ( keys %$part ) {                  foreach my $name ( keys %$part ) {
208                          $status_line .= $self->popup( $name, $part->{$name} );                          $status_line .= $self->popup( $name, $part->{$name} );
# Line 303  sub editor_links { Line 302  sub editor_links {
302          $error =~ s{at\s+(\S+)\s+line\s+(\d+)}          $error =~ s{at\s+(\S+)\s+line\s+(\d+)}
303                  {at <a target="editor" href="/editor+$1+$2">$1</a> line $2}gsm;                  {at <a target="editor" href="/editor+$1+$2">$1</a> line $2}gsm;
304    
305          $error =~ s{(via package ")([\w:]+)(")}          $error =~ s{(via (?:package) "?)([\w:]+)("?)}
306                  {$1<a target="editor" href="/editor+$2+1">$2</a>$3}gsm;                  {$1<a target="editor" href="/editor+$2+1">$2</a>$3}gsm;
307    
308          return $error;          return $error;
# Line 328  sub error { Line 327  sub error {
327    
328  =head2 add_status  =head2 add_status
329    
330    $self->add_status( name => { some => 'data' } );    $self->add_status( { name => { some => 'data' } } );
331    
332    $self->add_status( "append to last status popup" );    $self->add_status( "append to last status popup" );
333    
# Line 336  sub error { Line 335  sub error {
335    
336  sub add_status {  sub add_status {
337          my ( $self, $data ) = @_;          my ( $self, $data ) = @_;
338            push @status, { 'X' => [ $self->backtrace ] };
339          if ( ref($data) ) {          if ( ref($data) ) {
340                  push @status, $data;                  push @status, $data;
341          } else {          } else {
342                  $status[ $#status ]->{added} = $data;                  if ( defined $status[ $#status ] ) {
343                            $status[ $#status ]->{ '+' } = $data;
344                    } else {
345                            push @status, { '+' => $data };
346                    }
347          }          }
348  }  }
349    
# Line 354  Called at beginning of each request Line 358  Called at beginning of each request
358  sub clean_status {  sub clean_status {
359          my ($self) = shift;          my ($self) = shift;
360          @head = ( 'static/frey.css' );          @head = ( 'static/frey.css' );
361          @status = ();          @status = (
362                    { 'ClassBrowser' => Frey::ClassBrowser->new( usage_on_top => 0 )->as_markup },
363                    { 'Bookmarklets' => Frey::Bookmarklet->new->as_markup },
364                    { 'INC' => Frey::INC->new->as_markup },
365            );
366          $icon_html = '';          $icon_html = '';
367  }  }
368    
# Line 523  sub backtrace { Line 531  sub backtrace {
531                  ) = caller($_) or last;                  ) = caller($_) or last;
532    
533                  push @backtrace,                  push @backtrace,
534                          qq|via package $package at $path line $line|;                          qq|via $package at $path line $line|;
535          }          }
536          warn "# backtrace: ", dump( @backtrace ) if @backtrace;          warn "# backtrace: ", dump( @backtrace ) if @backtrace;
537          return @backtrace;          return @backtrace;

Legend:
Removed from v.578  
changed lines
  Added in v.581

  ViewVC Help
Powered by ViewVC 1.1.26