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

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

  ViewVC Help
Powered by ViewVC 1.1.26