/[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 476 by dpavlin, Thu Nov 20 12:56:37 2008 UTC revision 516 by dpavlin, Tue Nov 25 14:14:21 2008 UTC
# Line 12  use File::Slurp; Line 12  use File::Slurp;
12    
13  use Frey::Bookmarklet;  use Frey::Bookmarklet;
14  use Frey::ClassBrowser;  use Frey::ClassBrowser;
15    use Frey::SVK;
16    
17  has 'head' => (  has 'head' => (
18          is => 'rw',          is => 'rw',
# Line 188  sub page { Line 189  sub page {
189                  $body = '<!-- no body -->';                  $body = '<!-- no body -->';
190          }          }
191    
192            my $warn_colors = {
193                    '#'  => '#444',
194                    '##' => '#888',
195            };
196    
197          $status_line          $status_line
198                  .= qq|<span class="frey-popup">warn<code>|                  .= qq|<span class="frey-popup">warn<span>|
199                  . $self->editor_links( join("", $self->warnings ) )                  . $self->editor_links(
200                  . qq|</code></span>|                          join("", map {
201                                    warn "# $_";
202                                    my $style = '';
203                                    $style = $warn_colors->{$1}
204                                            ? ' style="color:' . $warn_colors->{$1} . '"'
205                                            : ''
206                                            if m{^(#+)};
207                                    qq|<tt$style>$_</tt><br/>|; # XXX <tt> should be <code> but CSS hates me
208                            } $self->warnings )
209                    )
210                    . qq|</span></span>|
211                  if $self->warnings;                  if $self->warnings;
212    
213            my      ($exit,$description) = ('exit','stop server');
214                    ($exit,$description) = ('restart','restart server')
215                    if $ENV{FREY_RESTART}; # tune labels on exit link
216    
217          my $right =          my $right =
218                  qq|                  qq|
219                          <span class="right">                          <span class="right">
220                          <a href="?reload=$reload_counter"><code>$url</code></a>                          <a title="reload"  href="/reload$url"><code>$url</code></a>
221                            <a title="$description" href="/exit$url">$exit</a>
222                          </span>                          </span>
223                  |;                  |;
224    
225            my $info = Frey::SVK->info;
226            my $revision = Frey::SVK->info->{Revision} || '';
227            $revision = $1 if $info->{'Mirrored From'} =~ m{Rev\.\s+(\d+)};
228    
229          my $html = join("\n",          my $html = join("\n",
230                  qq|<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><head>|,                  qq|<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"><html><head>|,
231                  $self->_head_html,                  $self->_head_html,
# Line 211  sub page { Line 236  sub page {
236                  </head><body>                  </head><body>
237                  $body                  $body
238                  <div class="frey-status-line">                  <div class="frey-status-line">
239                          <a href="/">Frey</a> $Frey::VERSION                          <a href="/">Frey</a> $Frey::VERSION $revision
240                          $status_line                          $status_line
241                          $right                          $right
242                  </div>                  </div>
# Line 224  sub page { Line 249  sub page {
249          return $html;          return $html;
250  }  }
251    
252    =head2 editor
253    
254    Create HTML editor link with optional line and title
255    
256      my $html = $self->editor( $class, $line, $title );
257    
258    =cut
259    
260    sub editor {
261            my ( $self, $class, $line, $title ) = @_;
262            confess "need class" unless $class;
263            $line ||= 1;
264            qq|<a target="editor" href="/editor+$class+$line"| .
265            ( $title ? qq| title="$title"| : '' ) .
266            qq|>$class</a>|;
267    }
268    
269    =head2 editor_links
270    
271    Create HTML links to editor for perl error message
272    
273      my $html = $self->editor_links( $error )
274    
275    =cut
276    
277  sub editor_links {  sub editor_links {
278          my ( $self, $error ) = @_;          my ( $self, $error ) = @_;
279    
# Line 251  sub error { Line 301  sub error {
301                  ;                  ;
302  }  }
303    
304    sub add_status {
305            my ( $self, $data ) = @_;
306            push @{ $self->status }, $data;
307            warn "## current status ", $#{ $self->status }, " elements";
308    }
309    
310  1;  1;

Legend:
Removed from v.476  
changed lines
  Added in v.516

  ViewVC Help
Powered by ViewVC 1.1.26