/[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 725 by dpavlin, Fri Dec 5 17:33:00 2008 UTC revision 813 by dpavlin, Thu Dec 11 21:06:41 2008 UTC
# Line 11  use Carp qw/confess cluck carp/; Line 11  use Carp qw/confess cluck carp/;
11  use File::Slurp;  use File::Slurp;
12    
13  use Frey::Bookmarklet;  use Frey::Bookmarklet;
14  use Frey::ClassBrowser;  use Frey::Class::Browser;
15  use Frey::INC;  use Frey::INC;
16    
17  use Frey::SVK;  use Frey::SVK;
# Line 93  sub html_dump { Line 93  sub html_dump {
93  sub popup    { my $self = shift; $self->popup_dropdown('popup',    @_); }  sub popup    { my $self = shift; $self->popup_dropdown('popup',    @_); }
94  sub dropdown { my $self = shift; $self->popup_dropdown('dropdown', @_); }  sub dropdown { my $self = shift; $self->popup_dropdown('dropdown', @_); }
95    
96  our $re_html = qr{<(?:!--.+?--|(\w+).+?/\1|[^>]+/)>}s; # relaxed html check for one semi-valid tag  our $re_html = qr{<(?:!--.+?--|(\w+).+?/\1|[^>]+/?)>}s; # relaxed html check for one semi-valid tag
97    
98  sub popup_dropdown {  sub popup_dropdown {
99          my ( $self, $type, $name, $content, $full ) = @_;          my ( $self, $type, $name, $content, $full ) = @_;
# Line 184  sub add_css { Line 184  sub add_css {
184          | );          | );
185  }  }
186    
187    sub add_js {
188            my ($self,$js) = @_;
189            my ( $package, $path, $line ) = caller;
190    
191            if ( $js =~ m{http.*\.js} ) {
192                    $self->add_head( qq|
193                            <script type="text/javascript" src="$js">
194                            /* via $package at $path line $line */
195                            </script>
196                    |);
197            } else {
198                    $self->add_head( qq|
199                            <script type="text/javascript">
200                            /* via $package at $path line $line */
201                            $js
202                            </script>
203                    | );
204            };
205    }
206    
207  our $reload_counter = 0;  our $reload_counter = 0;
208    
209    
# Line 408  sub clean_status { Line 428  sub clean_status {
428          my ($self) = shift;          my ($self) = shift;
429          @head = ( 'static/frey.css' );          @head = ( 'static/frey.css' );
430          @status = (          @status = (
431                  { 'ClassBrowser' => Frey::ClassBrowser->new( usage_on_top => 0 )->as_markup },                  { 'ClassBrowser' => Frey::Class::Browser->new( usage_sort => 1, usage_on_top => 0 )->as_markup },
432                  { 'Bookmarklets' => Frey::Bookmarklet->new->as_markup },                  { 'Bookmarklets' => Frey::Bookmarklet->new->as_markup },
433                  { 'INC' => Frey::INC->new->as_markup },                  { 'INC' => Frey::INC->new->as_markup },
434          );          );
# Line 668  sub checkbox { Line 688  sub checkbox {
688          qq|<input name="$name" value="$value" type="checkbox"$checked>|;          qq|<input name="$name" value="$value" type="checkbox"$checked>|;
689  }  }
690    
691    =head2 strip
692    
693    Strip whitespace around content
694    
695      my $stripped = strip('  no more whitespace around this   ');
696    
697    =cut
698    
699    sub strip {
700            my $t = shift;
701            $t =~ s{^\s+}{}gs;
702            $t =~ s{>\s+<}{><}gs;
703            $t =~ s{\s+$}{}gs;
704            return $t;
705    }
706    
707  1;  1;

Legend:
Removed from v.725  
changed lines
  Added in v.813

  ViewVC Help
Powered by ViewVC 1.1.26