Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial commit, needs more cleanup

  • Loading branch information...
commit f29b7488f06f9a67899ed659133eea954b072f6a 0 parents
Jay Shirley jshirley authored
Showing with 1,953 additions and 0 deletions.
  1. +4 −0 Changes
  2. +22 −0 Makefile.PL
  3. +1 −0  README
  4. +1 −0  designs/ems/root/index.tt
  5. +1 −0  designs/ems/root/site/footer/default.tt
  6. BIN  designs/ems/static/images/logo.jpg
  7. +2 −0  designs/plain/root/index.tt
  8. +72 −0 lib/StyleGuide.pm
  9. BIN  lib/StyleGuide/Controller/.Root.pm.swp
  10. +88 −0 lib/StyleGuide/Controller/Root.pm
  11. +85 −0 lib/StyleGuide/Plugin/Static.pm
  12. +158 −0 lib/StyleGuide/View/StyleGuide.pm
  13. +87 −0 lib/StyleGuide/View/TT.pm
  14. BIN  root/favicon.ico
  15. +8 −0 root/switch.tt
  16. +30 −0 script/styleguide_cgi.pl
  17. +57 −0 script/styleguide_create.pl
  18. +47 −0 script/styleguide_fastcgi.pl
  19. +60 −0 script/styleguide_server.pl
  20. +40 −0 script/styleguide_test.pl
  21. +11 −0 shared/site/ads/google_sidebar.tt
  22. +5 −0 shared/site/ads/newsletter.tt
  23. +22 −0 shared/site/clippy.tt
  24. +3 −0  shared/site/footer/default.tt
  25. +360 −0 shared/site/global.tt
  26. +8 −0 shared/site/header/default.tt
  27. +66 −0 shared/site/html.tt
  28. +10 −0 shared/site/instrumentation/googleanalytics.tt
  29. +39 −0 shared/site/instrumentation/querylog.tt
  30. +28 −0 shared/site/layout/default.tt
  31. +11 −0 shared/site/messages.tt
  32. +1 −0  shared/site/nav/default.tt
  33. +9 −0 shared/site/nav/my.tt
  34. +58 −0 shared/site/nav/search_refine.tt
  35. +75 −0 shared/site/nav/ticket.tt
  36. +6 −0 shared/site/nav/ticket_stack.tt
  37. +277 −0 shared/site/oldglobal.tt
  38. +50 −0 shared/site/shared/base.tt
  39. +24 −0 shared/site/shared/pager.tt
  40. +72 −0 shared/site/shared/ticket_table.tt
  41. +12 −0 shared/site/wrapper.tt
  42. +13 −0 styleguide.yml
  43. +10 −0 t/01app.t
  44. +10 −0 t/02pod.t
  45. +10 −0 t/03podcoverage.t
4 Changes
@@ -0,0 +1,4 @@
+This file documents the revision history for Perl extension StyleGuide.
+
+0.01 2010-03-25 06:55:48
+ - initial revision, generated by Catalyst
22 Makefile.PL
@@ -0,0 +1,22 @@
+#!/usr/bin/env perl
+# IMPORTANT: if you delete this file your app will not work as
+# expected. You have been warned.
+use inc::Module::Install;
+
+name 'StyleGuide';
+all_from 'lib/StyleGuide.pm';
+
+requires 'Catalyst::Runtime' => '5.80021';
+requires 'Catalyst::Plugin::ConfigLoader';
+requires 'Catalyst::Plugin::Static::Simple';
+requires 'Catalyst::Action::RenderView';
+requires 'Moose';
+requires 'namespace::autoclean';
+requires 'Config::General'; # This should reflect the config file format you've chosen
+ # See Catalyst::Plugin::ConfigLoader for supported formats
+test_requires 'Test::More' => '0.88';
+catalyst;
+
+install_script glob('script/*.pl');
+auto_install;
+WriteAll;
1  README
@@ -0,0 +1 @@
+Run script/styleguide_server.pl to test the application.
1  designs/ems/root/index.tt
@@ -0,0 +1 @@
+[% PROCESS "site/global.tt" %]
1  designs/ems/root/site/footer/default.tt
@@ -0,0 +1 @@
+designs/ems/site/footer/default.tt
BIN  designs/ems/static/images/logo.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2  designs/plain/root/index.tt
@@ -0,0 +1,2 @@
+<h1>Plain!</h1>
+This is the plain theme.
72 lib/StyleGuide.pm
@@ -0,0 +1,72 @@
+package StyleGuide;
+use Moose;
+use namespace::autoclean;
+
+use Catalyst::Runtime 5.80;
+
+# Set flags and add plugins for the application
+#
+# -Debug: activates the debug mode for very useful log messages
+# ConfigLoader: will load the configuration from a Config::General file in the
+# application's home directory
+# Static::Simple: will serve static files from the application's root
+# directory
+
+use Catalyst qw/
+ ConfigLoader
+
+ +StyleGuide::Plugin::Static
+/;
+
+extends 'Catalyst';
+
+our $VERSION = '0.01';
+$VERSION = eval $VERSION;
+
+# Configure the application.
+#
+# Note that settings in styleguide.conf (or other external
+# configuration file that you set up manually) take precedence
+# over this when using ConfigLoader. Thus configuration
+# details given here can function as a default configuration,
+# with an external configuration file acting as an override for
+# local deployment.
+
+__PACKAGE__->config(
+ name => 'StyleGuide',
+ # Disable deprecated behavior needed by old applications
+ disable_component_resolution_regex_fallback => 1,
+);
+
+# Start the application
+__PACKAGE__->setup();
+
+
+=head1 NAME
+
+StyleGuide - Catalyst based application
+
+=head1 SYNOPSIS
+
+ script/styleguide_server.pl
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 SEE ALSO
+
+L<StyleGuide::Controller::Root>, L<Catalyst>
+
+=head1 AUTHOR
+
+Jay Shirley
+
+=head1 LICENSE
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
BIN  lib/StyleGuide/Controller/.Root.pm.swp
Binary file not shown
88 lib/StyleGuide/Controller/Root.pm
@@ -0,0 +1,88 @@
+package StyleGuide::Controller::Root;
+use Moose;
+use namespace::autoclean;
+
+BEGIN { extends 'Catalyst::Controller' }
+
+#
+# Sets the actions in this controller to be registered with no prefix
+# so they function identically to actions created in MyApp.pm
+#
+__PACKAGE__->config(namespace => '');
+
+=head1 NAME
+
+StyleGuide::Controller::Root - Root Controller for StyleGuide
+
+=head1 DESCRIPTION
+
+[enter your description here]
+
+=head1 METHODS
+
+=head2 index
+
+The root page (/)
+
+=cut
+
+sub guide : Chained('/') PathPart('') CaptureArgs(0) {
+ my ( $self, $c ) = @_;
+ my $design = $c->req->cookie('design');
+ if ( not $design ) {
+ $design = $c->view('StyleGuide')->default_style
+ } else {
+ $c->stash->{design} = $design->value;
+ }
+}
+
+sub index : Chained('guide') PathPart('') Args(0) { }
+
+sub switch : Chained('guide') Args(0) {
+ my ( $self, $c ) = @_;
+
+ $c->stash->{designs} = $c->view('StyleGuide')->designs;
+
+ if ( $c->req->method eq 'POST' and my $design = $c->req->params->{design} ) {
+ if ( $c->view('StyleGuide')->get_design($design) ) {
+ $c->res->cookies->{design} = { value => $design };
+ }
+ $c->res->redirect($c->req->uri);
+ }
+ $c->forward( $c->view('TT') );
+}
+
+=head2 default
+
+Standard 404 error page
+
+=cut
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->response->body( 'Page not found' );
+ $c->response->status(404);
+}
+
+=head2 end
+
+Attempt to render a view, if needed.
+
+=cut
+
+sub end : ActionClass('RenderView') {}
+
+=head1 AUTHOR
+
+Jay Shirley
+
+=head1 LICENSE
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+__PACKAGE__->meta->make_immutable;
+
+1;
85 lib/StyleGuide/Plugin/Static.pm
@@ -0,0 +1,85 @@
+package StyleGuide::Plugin::Static;
+
+use Moose;
+
+extends 'Catalyst::Plugin::Static::Simple';
+
+# Search through all included directories for the static file
+# Based on Template Toolkit INCLUDE_PATH code
+sub _locate_static_file {
+ my ( $c, $path, $in_static_dir ) = @_;
+
+ my $cookie = $c->req->cookie('design');
+ my $design = defined $cookie ? $cookie->value : undef;
+
+ if ( $design ) {
+ $design = $c->view('StyleGuide')->get_design($design);
+ } else {
+ ( $design ) = keys %{ $c->view('StyleGuide')->designs };
+ $design = $c->view('StyleGuide')->get_design($design);
+ $c->log->debug("Picking random design ($design->{static}), yeehaw!") if $c->debug;
+ }
+
+ my $static_path = $design->{static};
+ $static_path =~ s/\/static$//g;
+
+ $path = File::Spec->catdir(
+ File::Spec->no_upwards( File::Spec->splitdir( $path ) )
+ );
+
+ my $config = $c->config->{static};
+ my @ipaths = ( $static_path, @{ $config->{include_path} } );
+ my $dpaths;
+ my $count = 64; # maximum number of directories to search
+
+ DIR_CHECK:
+ while ( @ipaths && --$count) {
+ my $dir = shift @ipaths || next DIR_CHECK;
+
+ if ( ref $dir eq 'CODE' ) {
+ eval { $dpaths = &$dir( $c ) };
+ if ($@) {
+ $c->log->error( 'Static::Simple: include_path error: ' . $@ );
+ } else {
+ unshift @ipaths, @$dpaths;
+ next DIR_CHECK;
+ }
+ } else {
+$c->log->debug("Checking path: $dir/$path");
+ $dir =~ s/(\/|\\)$//xms;
+ if ( -d $dir && -f $dir . '/' . $path ) {
+
+ # Don't ignore any files in static dirs defined with 'dirs'
+ unless ( $in_static_dir ) {
+ # do we need to ignore the file?
+ for my $ignore ( @{ $config->{ignore_dirs} } ) {
+ $ignore =~ s{(/|\\)$}{};
+ if ( $path =~ /^$ignore(\/|\\)/ ) {
+ $c->_debug_msg( "Ignoring directory `$ignore`" )
+ if $config->{debug};
+ next DIR_CHECK;
+ }
+ }
+
+ # do we need to ignore based on extension?
+ for my $ignore_ext ( @{ $config->{ignore_extensions} } ) {
+ if ( $path =~ /.*\.${ignore_ext}$/ixms ) {
+ $c->_debug_msg( "Ignoring extension `$ignore_ext`" )
+ if $config->{debug};
+ next DIR_CHECK;
+ }
+ }
+ }
+
+ $c->_debug_msg( 'Serving ' . $dir . '/' . $path )
+ if $config->{debug};
+ return $c->_static_file( $dir . '/' . $path );
+ }
+ }
+ }
+
+ return;
+}
+
+no Moose;
+1;
158 lib/StyleGuide/View/StyleGuide.pm
@@ -0,0 +1,158 @@
+package StyleGuide::View::StyleGuide;
+
+use Moose;
+use Template;
+
+use namespace::autoclean;
+
+extends 'Catalyst::View';
+
+__PACKAGE__->config({
+ PRE_PROCESS => 'site/shared/base.tt',
+ WRAPPER => 'site/wrapper.tt',
+ TEMPLATE_EXTENSION => '.tt',
+ TIMER => 0,
+});
+
+has 'default_style' => (
+ is => 'rw',
+ isa => 'Str'
+);
+
+has 'renderers' => (
+ is => 'rw',
+ isa => 'HashRef',
+ traits => [ 'Hash' ],
+ lazy => 1,
+ default => sub { { } },
+ handles => {
+ 'get_renderer' => 'get',
+ 'set_renderer' => 'set',
+ }
+);
+
+has 'shared_root' => (
+ is => 'rw',
+ isa => 'Str'
+);
+
+has 'designs' => (
+ is => 'rw',
+ isa => 'HashRef',
+ traits => [ 'Hash' ],
+ lazy => 1,
+ default => sub { { } },
+ handles => {
+ 'get_design' => 'get',
+ }
+);
+
+sub process {
+ my ( $self, $c ) = @_;
+
+ my $design = $c->stash->{design};
+ if ( not $design ) {
+ my $cookie = $c->req->cookie('design');
+ $design = $cookie->value if defined $cookie;
+ $c->log->debug("Design from cookie ($cookie) => $design");
+ }
+
+ unless ( $design ) {
+ ( $design ) = keys %{ $self->designs };
+ }
+ my $renderer = $self->get_renderer($design);
+ unless ( defined $renderer ) {
+ $c->log->debug("Building renderer for design: $design");
+ $renderer = $self->_build_renderer( $c, $design );
+ $self->set_renderer( $design, $renderer );
+ }
+
+ my $template = $c->stash->{template}
+ || $c->action . $self->{TEMPLATE_EXTENSION};
+
+ unless (defined $template) {
+ $c->log->debug('No template specified for rendering') if $c->debug;
+ return 0;
+ }
+
+ my $output;
+ #try {
+ $output = $self->render($renderer, $c, $template);
+ #} catch {
+if ( 0 ) {
+ my $error = qq/Couldn't render template "$template": / . $renderer->error;
+ $c->log->error($error);
+ $c->error($error);
+ return 0;
+ };
+
+ unless ( $c->response->content_type ) {
+ $c->response->content_type('text/html; charset=utf-8');
+ }
+
+ $c->response->body($output);
+
+ return 1;
+}
+
+sub render {
+ my ($self, $renderer, $c, $template, $args) = @_;
+
+ $c->log->debug(qq/Rendering template "$template"/) if $c && $c->debug;
+
+ my $output;
+ my $vars = {
+ (ref $args eq 'HASH' ? %$args : %{ $c->stash() }),
+ $self->template_vars($c)
+ };
+
+ local $self->{include_path} =
+ [ @{ $vars->{additional_template_paths} }, @{ $self->{include_path} } ]
+ if ref $vars->{additional_template_paths};
+
+ unless ( $renderer->process( $template, $vars, \$output ) ) {
+ die $renderer->error;
+ }
+ return $output;
+}
+
+sub template_vars {
+ my ( $self, $c ) = @_;
+
+ return () unless $c;
+ my $cvar = $self->config->{CATALYST_VAR};
+
+ defined $cvar
+ ? ( $cvar => $c )
+ : (
+ c => $c,
+ base => $c->req->base,
+ name => $c->config->{name}
+ )
+}
+
+sub _build_renderer {
+ my ( $self, $c, $design ) = @_;
+
+ my $config = {
+ EVAL_PERL => 0,
+ TEMPLATE_EXTENSION => '',
+ %{ $self->config },
+ INCLUDE_PATH => [
+ $self->get_design($design)->{root},
+ $self->shared_root,
+ ]
+ };
+
+$c->log->_dump($config);
+
+ return Template->new($config) || do {
+ my $error = Template->error();
+ $c->log->error($error);
+ $c->error($error);
+ return undef;
+ };
+}
+
+no Moose;
+__PACKAGE__->meta->make_immutable;
87 lib/StyleGuide/View/TT.pm
@@ -0,0 +1,87 @@
+package StyleGuide::View::TT;
+
+use strict;
+
+use parent 'Catalyst::View::TT';
+
+use Scalar::Util qw(blessed);
+use DateTime::Format::DateParse;
+
+__PACKAGE__->config({
+ #PRE_PROCESS => 'site/shared/base.tt',
+ #WRAPPER => 'site/wrapper.tt',
+ TEMPLATE_EXTENSION => '.tt',
+ TIMER => 0,
+ static_root => '/static',
+ static_build => 0,
+ default_tz => 'America/Los_Angeles',
+ default_locale => 'en_US',
+ formats => {
+ date => {
+ date => '%x',
+ short => '%b %e, %G',
+ long => '%X %x',
+ }
+ }
+});
+
+sub template_vars {
+ my $self = shift;
+ return (
+ $self->next::method(@_),
+ static_root => $self->{static_root},
+ static_build => $self->{static_build}
+ );
+}
+
+sub new {
+ my ( $class, $c, $arguments ) = @_;
+ my $formats = $class->config->{formats};
+
+ return $class->next::method( $c, $arguments ) unless ref $formats eq 'HASH';
+
+ $class->config->{FILTERS} ||= {};
+
+ my $filters = $class->config->{FILTERS};
+
+ foreach my $key ( keys %$formats ) {
+ if ( $key eq 'date' ) {
+ foreach my $date_key ( keys %{$formats->{$key}} ) {
+ $filters->{"${key}_$date_key"} = sub {
+ my $date = shift;
+ return unless defined $date;
+ unless ( blessed $date and $date->can("stringify") ) {
+ $date = DateTime::Format::DateParse->parse_datetime($date);
+ }
+ unless ( $date ) { return $date; }
+ $date->set_locale($class->config->{default_locale})
+ if defined $class->config->{default_locale};
+ # Only apply a timezone if we have a complete date.
+ unless ( "$date" =~ /T00:00:00$/ ) {
+ $date->set_time_zone( $class->config->{default_tz} || 'America/Los_Angeles' );
+ }
+ $date->strftime($formats->{$key}->{$date_key});
+ };
+ }
+ }
+ }
+
+ return $class->next::method( $c, $arguments );
+}
+
+=head1 NAME
+
+StyleGuide::View::TT - Catalyst TT::Bootstrap::YUI View
+
+=head1 AUTHOR
+
+Jay Shirley
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
BIN  root/favicon.ico
Binary file not shown
8 root/switch.tt
@@ -0,0 +1,8 @@
+<form method="post" action="[% c.uri_for_action('/switch') %]">
+ <select name="design">
+ [% FOREACH d IN designs.keys %]
+ <option value="[% design | html %]"[% IF d == design %] selected="selected"[% END %]>[% design %]</option>
+ [% END %]
+ </select>
+ <input type="submit" value="Set Design">
+</form>
30 script/styleguide_cgi.pl
@@ -0,0 +1,30 @@
+#!/usr/bin/env perl
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('StyleGuide', 'CGI');
+
+1;
+
+=head1 NAME
+
+styleguide_cgi.pl - Catalyst CGI
+
+=head1 SYNOPSIS
+
+See L<Catalyst::Manual>
+
+=head1 DESCRIPTION
+
+Run a Catalyst application as a cgi script.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
57 script/styleguide_create.pl
@@ -0,0 +1,57 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('StyleGuide', 'Create');
+
+1;
+
+=head1 NAME
+
+styleguide_create.pl - Create a new Catalyst Component
+
+=head1 SYNOPSIS
+
+styleguide_create.pl [options] model|view|controller name [helper] [options]
+
+ Options:
+ --force don't create a .new file where a file to be created exists
+ --mechanize use Test::WWW::Mechanize::Catalyst for tests if available
+ --help display this help and exits
+
+ Examples:
+ styleguide_create.pl controller My::Controller
+ styleguide_create.pl -mechanize controller My::Controller
+ styleguide_create.pl view My::View
+ styleguide_create.pl view MyView TT
+ styleguide_create.pl view TT TT
+ styleguide_create.pl model My::Model
+ styleguide_create.pl model SomeDB DBIC::Schema MyApp::Schema create=dynamic\
+ dbi:SQLite:/tmp/my.db
+ styleguide_create.pl model AnotherDB DBIC::Schema MyApp::Schema create=static\
+ dbi:Pg:dbname=foo root 4321
+
+ See also:
+ perldoc Catalyst::Manual
+ perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Create a new Catalyst Component.
+
+Existing component files are not overwritten. If any of the component files
+to be created already exist the file will be written with a '.new' suffix.
+This behavior can be suppressed with the C<-force> option.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
47 script/styleguide_fastcgi.pl
@@ -0,0 +1,47 @@
+#!/usr/bin/env perl
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('StyleGuide', 'FastCGI');
+
+1;
+
+=head1 NAME
+
+styleguide_fastcgi.pl - Catalyst FastCGI
+
+=head1 SYNOPSIS
+
+styleguide_fastcgi.pl [options]
+
+ Options:
+ -? -help display this help and exits
+ -l --listen Socket path to listen on
+ (defaults to standard input)
+ can be HOST:PORT, :PORT or a
+ filesystem path
+ -n --nproc specify number of processes to keep
+ to serve requests (defaults to 1,
+ requires -listen)
+ -p --pidfile specify filename for pid file
+ (requires -listen)
+ -d --daemon daemonize (requires -listen)
+ -M --manager specify alternate process manager
+ (FCGI::ProcManager sub-class)
+ or empty string to disable
+ -e --keeperr send error messages to STDOUT, not
+ to the webserver
+
+=head1 DESCRIPTION
+
+Run a Catalyst application as fastcgi.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
60 script/styleguide_server.pl
@@ -0,0 +1,60 @@
+#!/usr/bin/env perl
+
+BEGIN {
+ $ENV{CATALYST_SCRIPT_GEN} = 40;
+}
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('StyleGuide', 'Server');
+
+1;
+
+=head1 NAME
+
+styleguide_server.pl - Catalyst Test Server
+
+=head1 SYNOPSIS
+
+styleguide_server.pl [options]
+
+ -d --debug force debug mode
+ -f --fork handle each request in a new process
+ (defaults to false)
+ -? --help display this help and exits
+ -h --host host (defaults to all)
+ -p --port port (defaults to 3000)
+ -k --keepalive enable keep-alive connections
+ -r --restart restart when files get modified
+ (defaults to false)
+ -rd --restart_delay delay between file checks
+ (ignored if you have Linux::Inotify2 installed)
+ -rr --restart_regex regex match files that trigger
+ a restart when modified
+ (defaults to '\.yml$|\.yaml$|\.conf|\.pm$')
+ --restart_directory the directory to search for
+ modified files, can be set mulitple times
+ (defaults to '[SCRIPT_DIR]/..')
+ --follow_symlinks follow symlinks in search directories
+ (defaults to false. this is a no-op on Win32)
+ --background run the process in the background
+ --pidfile specify filename for pid file
+
+ See also:
+ perldoc Catalyst::Manual
+ perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst Testserver for this application.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
40 script/styleguide_test.pl
@@ -0,0 +1,40 @@
+#!/usr/bin/env perl
+
+use Catalyst::ScriptRunner;
+Catalyst::ScriptRunner->run('StyleGuide', 'Test');
+
+1;
+
+=head1 NAME
+
+styleguide_test.pl - Catalyst Test
+
+=head1 SYNOPSIS
+
+styleguide_test.pl [options] uri
+
+ Options:
+ --help display this help and exits
+
+ Examples:
+ styleguide_test.pl http://localhost/some_action
+ styleguide_test.pl /some_action
+
+ See also:
+ perldoc Catalyst::Manual
+ perldoc Catalyst::Manual::Intro
+
+=head1 DESCRIPTION
+
+Run a Catalyst action from the command line.
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
11 shared/site/ads/google_sidebar.tt
@@ -0,0 +1,11 @@
+<script type="text/javascript"><!--
+google_ad_client = "pub-1735214917172287";
+/* Codepeek sidebar. 160x600, created 3/13/10 */
+google_ad_slot = "3818071938";
+google_ad_width = 160;
+google_ad_height = 600;
+//-->
+</script>
+<script type="text/javascript"
+src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
+</script>
5 shared/site/ads/newsletter.tt
@@ -0,0 +1,5 @@
+[% IF 1 %]
+<aside id="notice">
+ <p><a href="http://eepurl.com/j0P6"><img src="/static/images/ads/cp-news.png"></a></p>
+</aside>
+[% END %]
22 shared/site/clippy.tt
@@ -0,0 +1,22 @@
+<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
+ width="110"
+ height="14"
+ id="clippy" >
+ <param name="movie" value="[% static('flash/clippy.swf') %]"/>
+ <param name="allowScriptAccess" value="always" />
+ <param name="quality" value="high" />
+ <param name="scale" value="noscale" />
+ <param NAME="FlashVars" value="text=[% clippy_text %]">
+ <param name="bgcolor" value="e5e5e5">
+ <embed src="[% static('flash/clippy.swf') %]"
+ width="110"
+ height="14"
+ name="clippy"
+ quality="high"
+ allowScriptAccess="always"
+ type="application/x-shockwave-flash"
+ pluginspage="http://www.macromedia.com/go/getflashplayer"
+ FlashVars="text=[% clippy_text %]"
+ bgcolor="e5e5e5"
+ />
+ </object>
3  shared/site/footer/default.tt
@@ -0,0 +1,3 @@
+<div class="footer">
+ /shared/site/footer/default.tt
+</div>
360 shared/site/global.tt
@@ -0,0 +1,360 @@
+[%~
+USE Digest.MD5;
+
+MACRO form(params) BLOCK;
+ submit_label = params.submit_label || c.loc('Save');
+ form_actions = [];
+ form_scopes = [];
+ form_contents = [];
+ FOREACH sec IN params.sections;
+ section = {};
+ content = PROCESS $sec;
+ output = content WRAPPER "site/wrappers/form.tt";
+ IF section.scope; form_scopes.push([ section.scope, section.title ]); END;
+ form_contents.push(output);
+ IF section.action.defined;
+ form_actions.push( section.action );
+ END;
+ END;
+ IF params.action; form_actions = [ params.action ]; END;
+ %]<h3>Actions: [% form_actions.unique.join(', ') %]</h3>[%
+ IF form_scopes.size > 0;
+ FOREACH sc IN form_scopes;
+ IF loop.first; "<ul>"; END %]
+ <li><a href="#scope_[% sc.0 %]">[% sc.1 | html %]</a></li>
+ [% IF loop.last; "</ul>"; END;
+ END;
+ END;
+ IF form_actions.unique.size == 1 %]
+ <form method="post" action="[% form_actions.0 %]">
+ <input type="hidden" name="_page.referrer" value="[% c.req.uri | html %]">
+ [% form_contents.join('') %]
+ <div class="button"><input type="submit" value="[% submit_label %]"></div>
+ </form>
+ [% ELSE;
+ form_contents.join('');
+ END;
+END;
+
+MACRO ad_slot(zone, slot) BLOCK;
+ %]<img src="[% c.static_uri("images/ads/ad_zone${zone}.png") %]">[%
+END;
+
+MACRO run_widget(name, args) BLOCK;
+ SET w = widget.load(name, args);
+ INCLUDE "widgets/${w.template}" args = w.run(args);
+END;
+
+MACRO select_field(info) BLOCK;
+ info.type = 'select';
+ render_field(info);
+END;
+
+MACRO country_field(info) BLOCK;
+ %][% IF info.message %]<p class="clear attention">[% c.loc(info.message) %]</p>[% END %]
+ <p id="form_[% info.name %]_fields" class="text_group[% IF info.optional %] optional[% END %]">
+ <label for="form_[% info.name %]">[% c.loc(info.label) %]<span class="required">[% IF info.optional %]&nbsp;&nbsp;&nbsp;&nbsp;[% ELSE %][% c.loc("FIELD REQUIRED SPLAT") %][% END %]</span></label>
+ <select id="form_[% info.name %]" name="[% info.name %]">
+ [% PROCESS form/countries.tt %]
+ </select>
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+ </p>[%
+END;
+
+MACRO password_field(info) BLOCK;
+ info.type = 'password';
+ text_field(info);
+END;
+
+MACRO text_field(info) BLOCK;
+ info.type = 'text';
+ render_field(info);
+END;
+
+MACRO render_single_field(info) BLOCK %]
+ <input type="[% info.type || 'text' %]" id="form_[% info.name %]" name="[% info.name %]" value="[% info.value || info.hint | html %]"
+ [%~ IF info.autocomplete == 0 %] autocomplete="false"[% END ~%]
+ [%~ IF info.disabled %] disabled="disabled"[% END ~%]
+ [%~ IF info.maxlength %] maxlength="[% info.maxlength %]"[% END ~%]
+ [%~ IF info.width =%]
+ size="[% info.width %]" style="width: [% info.width %]em;"
+ [%~ END =%]
+ class="
+ [%~ IF hinted %] hint[% END ~%]
+ [%~ IF info.focus %] focus[% END ~%]
+ ">
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+[% END;
+
+MACRO render_textarea_field(info) BLOCK;
+ label_class.push('banner');
+%]
+ <textarea id="form_[% info.name %]" name="[% info.name %]"
+ [%~ IF info.autocomplete == 0 %] autocomplete="false"[% END ~%]
+ [%~ IF info.disabled %] disabled="disabled"[% END ~%]
+ [%~ IF info.maxlength %] maxlength="[% info.maxlength %]"[% END ~%]
+ [%~ IF info.width =%]
+ size="[% info.width %]" style="width: [% info.width %]em;"
+ [%~ END =%]
+ class="
+ [%~ IF hinted %] hint[% END ~%]
+ [%~ IF info.focus %] focus[% END ~%]
+ ">
+ [%~ info.value || info.hint | html ~%]
+ </textarea>
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+[% END;
+
+MACRO render_select_field(info) BLOCK %]
+ <select id="form_[% info.name %]" name="[% info.name %]" style="width: auto">
+ [% IF info.default_option %]<option value="[% info.default_option.0 %]">[% info.default_option.1 %]</option>[% END %]
+ [% FOREACH item = info.array %]
+ [% IF info.value_method %]
+ [% SET this_value = item.${info.value_method}; %]
+ [% ELSE %]
+ [% SET this_value = item %]
+ [% END %]
+ <option value="[% this_value %]" [% IF this_value == info.value %]selected="selected"[% END %] >[% IF info.label_method; item.${info.label_method}; ELSE; item; END %]</option>
+ [% END %]
+ </select>
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+[% END;
+
+MACRO render_field(info) BLOCK;
+ field_class = [ 'text_group' ];
+ messages = [];
+ message_class = [];
+ label_class = [];
+
+ IF info.optional;
+ field_class.push('optional');
+ END;
+ IF section.scope;
+ stack = message_stack.for_scope(section.scope).for_subject(info.name);
+ info.name = "${section.scope}.${info.name}";
+ IF stack.count;
+ label_class.push('attention');
+ FOREACH msg IN stack.messages;
+ messages.push({ type => msg.level, message => c.loc(msg.text || msg.id, [ msg.params ]) });
+ field_class.push(msg.level);
+ END;
+ END;
+ ELSIF info.message;
+ label_class.push('attention');
+ messages.push({ type => 'error', message => c.loc(info.message) });
+ END;
+
+ IF !info.value && info.hint;
+ hinted = 1;
+ END;
+
+
+ field_content = '';
+ IF info.type == 'textarea';
+ field_content = render_textarea_field(info);
+ ELSIF info.type == 'select';
+ field_content = render_select_field(info);
+ ELSIF info.type == 'date';
+ field_content = render_date_field(info);
+ ELSIF info.type == 'checkbox';
+ field_content = render_checkbox_group(info);
+ ELSIF info.type == 'radio';
+ field_content = render_checkbox_group(info);
+ ELSE;
+ field_content = render_single_field(info);
+ END;
+ %]
+ <div id="form_[% info.name %]_fields" class="[% field_class.join(' ') %]">
+ <label id="form_[% info.name %]_label" for="form_[% info.name %]" class="[% label_class.join(' ') %]">[% c.loc(info.label) %]: <span class="required">[% IF info.optional %]&nbsp;&nbsp;&nbsp;&nbsp;[% ELSE %][% c.loc("FIELD REQUIRED SPLAT") %][% END %]</span></label>
+ [% field_content %]
+ [% FOREACH message IN messages %]
+ [% IF loop.first %]<div class="messages">[% END %]
+ <p class="clear attention [% message.type %]">[% message.message %]</p>
+ [% IF loop.last %]</div>[% END %]
+ [% END %]
+ </div>[%
+END;
+
+MACRO textarea_field(info) BLOCK;
+ info.type = 'textarea';
+ render_field(info);
+END;
+
+MACRO readonly_field(info) BLOCK %]
+ [% IF info.message %]<p class="clear attention">[% c.loc(info.message) %]</p>[% END %]
+ <p id="form_[% info.name %]_fields" class="text_group[% IF info.optional %] optional[% END %]">
+ <label id="form_[% info.name %]_label" for="form_[% info.name %]"[% IF info.message %] class="attention"[% END %]>[% c.loc(info.label) %]<span class="required">[% IF info.optional %]&nbsp;&nbsp;&nbsp;&nbsp;[% ELSE %][% c.loc("FIELD REQUIRED SPLAT") %][% END %]</span></label>
+ <input type="hidden" id="form_[% info.name %]" name="[% info.name %]" value="[% info.value | html %]"/>
+ <span class="readonly">[% info.value %]</span>
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+ </p>[%
+END;
+
+MACRO display_field(info) BLOCK %]
+ [% IF info.optional != 0; info.optional = 1; END; %]
+ [% IF info.message %]<p class="clear attention">[% c.loc(info.message) %]</p>[% END %]
+ <p id="form_[% info.name %]_fields" class="text_group[% IF info.optional %] optional[% END %]">
+ <label id="form_[% info.name %]_label" for="form_[% info.name %]"[% IF info.message %] class="attention"[% END %]>[% c.loc(info.label) %]<span class="required">[% IF info.optional %]&nbsp;&nbsp;&nbsp;&nbsp;[% ELSE %][% c.loc("FIELD REQUIRED SPLAT") %][% END %]</span></label>
+ <span class="readonly" id="form_[% info.name %]">[% info.value %]</span>
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+ </p>[%
+END;
+
+
+MACRO checkbox_field(info) BLOCK %]
+ [% IF info.message %]<p class="clear attention">[% c.loc(info.message) %]</p>[% END %]
+ <p id="form_[% info.name %]_fields" class="text_group[% IF info.optional %] optional[% END %]">
+ <label for="form_[% info.name %]"[% IF info.message %] class="attention"[% END %]>[% c.loc(info.label) %]<span class="required">[% IF info.optional %]&nbsp;&nbsp;&nbsp;&nbsp;[% ELSE %][% c.loc("FIELD REQUIRED SPLAT") %][% END %]</span></label>
+ <input [% IF info.maxlength %]maxlength="[% info.maxlength %]"[% END %] [% IF info.width %]size="[% info.width %]"[% END %] type="[% info.type || 'checkbox' %]" id="form_[% info.name %]" name="[% info.name %]" value="[% info.value | html %]"
+ [%~ IF info.checked == 1 %] checked="checked"[% END ~%]
+ [%~ IF info.disabled == 1 %] disabled="disabled"[% END ~%]
+ />
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+ </p>[%
+END;
+
+MACRO radio_group(info) BLOCK;
+ classes = [ 'label' ];
+ IF info.message; classes.push('attention'); END; %]
+ [% IF info.message %]<p class="clear attention">[% c.loc(info.message) %]</p>[% END %]
+ <div id="form_[% info.name %]_fields" class="input_group[% IF info.optional %] optional[% END %]">
+ <div class="[% classes.join(' ') %]">[%= ~%]
+ [% c.loc(info.label) ~%]
+ <span class="required">
+ [%~ IF info.optional %]&nbsp;&nbsp;&nbsp;&nbsp;
+ [%~ ELSE ~%]
+ [%~ c.loc("FIELD REQUIRED SPLAT") ~%]
+ [%~ END ~%]
+ </span>[%= ~%]
+ </div>
+ <div class="options">
+ [%~ FOREACH key IN info.values.keys ~%]
+ <label class="radio-label">
+ <input [% IF info.maxlength %]maxlength="[% info.maxlength %]"[% END %] [% IF info.width %]size="[% info.width %]"[% END %] type="[% info.type || 'radio' %]" id="form_[% info.name %]_[% info.values.$key %]" name="[% info.name %]" value="[% info.values.$key | html %]"
+ [%~ IF info.value == info.values.$key =%]
+ checked="checked"
+ [%~ END ~%]
+ >
+ [% key | html %]
+ </label><br>
+ [% END %]
+ </div>
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+ </div>
+[% END;
+
+USE format;
+
+date_month_format = format("%02d");
+
+MACRO date_field(info) BLOCK;
+ IF info.no_day != 1;
+ info.day = info.value.strftime('%d');
+ END;
+ info.month = info.month || info.value.strftime('%m');
+ info.year = info.year || info.value.strftime('%Y');
+
+ info.start_year = info.start_year || 1920;
+ info.end_year = info.end_year || 2003;
+
+ info.type = 'date';
+ render_field(info);
+END;
+
+MACRO render_checkbox_group(info) BLOCK %]
+ <div class="input_group">
+ [%~ FOREACH key IN info.values.keys ~%]
+ <label class="radio-label">
+ <input [% IF info.maxlength %]maxlength="[% info.maxlength %]"[% END %] [% IF info.width %]size="[% info.width %]"[% END %] type="[% info.type || 'radio' %]" id="form_[% info.name %]_[% info.values.$key %]" name="[% info.name %]" value="[% info.values.$key | html %]"
+ [%~ IF info.value == info.values.$key =%]
+ checked="checked"
+ [%~ END ~%]
+ >
+ [% key | html %]
+ </label><br>
+ [% END %]
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+ </div>
+[% END;
+
+MACRO render_date_field(info) BLOCK %]
+ <div class="input_group">
+ <select id="form_[% info.name %]" name="[% info.name %].month" class="inline">
+ [% FOREACH month_opt IN [ 0 .. 12 ] %]
+ <option value="[% month_opt %]"[% IF date_month_format(month_opt) == info.month %] selected="selected"[% END %]>[% month_opt || "Month" %]</option>
+ [% END %]
+ </select>
+[% IF info.no_day != 1 %]
+ <select name="[% info.name %].day" class="inline">
+ [% FOREACH day_opt IN [ 0 .. 31 ] %]
+ <option value="[% day_opt %]"[% IF date_month_format(day_opt) == info.day %] selected="selected"[% END %]>[% day_opt || "Day" %]</option>
+ [% END %]
+ </select>
+[% END %]
+ <select name="[% info.name %].year" class="inline">
+ <option value="0">Year</option>
+ [% FOREACH year_opt IN [ info.start_year .. info.end_year ] %]
+ <option value="[% year_opt %]"[% IF year_opt == info.year %] selected="selected"[% END %]>[% year_opt %]</option>
+ [% END %]
+ </select>
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+ </div>
+[% END;
+
+MACRO phone_field(info) BLOCK;
+ IF info.value;
+ area_code = info.value.substr(0, 3);
+ prefix = info.value.substr(3, 3);
+ last4 = info.value.substr(6);
+ END %]
+ [% IF info.message %]<p class="clear attention">[% c.loc(info.message) %]</p>[% END %]
+ [% IF !info.value && info.hint;
+ hinted = 1;
+ END; %]
+ <p id="form_[% info.name %]_fields" class="text_group[% IF info.optional %] optional[% END %]">
+ <label id="form_[% info.name %]_label" for="form_[% info.name %]"[% IF info.message %] class="attention"[% END %]>[% c.loc(info.label) %]<span class="required">[% IF info.optional %]&nbsp;&nbsp;&nbsp;&nbsp;[% ELSE %][% c.loc("FIELD REQUIRED SPLAT") %][% END %]</span></label>
+ <span class="group">
+ (<input type="text" id="form_[% info.name %]" name="[% info.name %].areacode" value="[% area_code %]" size="3" class="inline">)
+ <input type="text" id="form_[% info.name %]" name="[% info.name %].prefix" value="[% prefix %]" size="3" class="inline">-
+ <input type="text" id="form_[% info.name %]" name="[% info.name %].last4" value="[% last4 %]" size="4" class="inline">
+ </span>
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+ </p>[%
+END;
+
+MACRO address_field(info) BLOCK %]
+ [% IF info.message %]<p class="clear attention">[% c.loc(info.message) %]</p>[% END %]
+ <div id="form_[% info.name %]_fields" class="text_group[% IF info.optional %] optional[% END %]">
+ <label id="form_[% info.name %]_label" for="form_[% info.name %]"[% IF info.message %] class="attention"[% END %]>[% c.loc(info.label) %]<span class="required">[% IF info.optional %]&nbsp;&nbsp;&nbsp;&nbsp;[% ELSE %][% c.loc("FIELD REQUIRED SPLAT") %][% END %]</span></label>
+ <div class="group inline">
+ <p>
+ <label for="address_1">Street:</label>
+ <input type="text" name="address_1" value="[% info.values.address_1 %]">
+ </p>
+ <p>
+ <label for="city">City:</label>
+ <input type="text" name="city" value="[% info.values.city %]">
+ </p>
+ <p>
+ <label for="state">State:</label>
+ <select name="state">
+ [% FOREACH state IN c.model('Schema::State').all %]
+ <option value="[% state.abbr %]" [% IF info.values.state == state.abbr %] selected="selected"[% END %]>[% state.full_name %]</option>
+ [% END %]
+ </select>
+ </p>
+ <p>
+ <label for="zip">Zip:</label>
+ <input type="text" name="zip" value="[% info.values.zip %]" style="width: 5em;" size="5">
+ </p>
+ </div>
+ </div>[%
+END;
+
+MACRO sort_link(key) BLOCK;
+ cur_dir = dir || 'DESC';
+ IF sort_by == key; cur_dir = cur_dir == 'DESC' ? 'ASC' : 'DESC'; END;
+ c.req.uri_with({ sort_by => key, dir => cur_dir });
+END;
+
+~%]
8 shared/site/header/default.tt
@@ -0,0 +1,8 @@
+<div class="header">
+ <h1>header</h1>
+ [% # Include the navigation
+ IF page.nav && page.nav != 'none';
+ PROCESS "site/nav/${page.nav}.tt";
+ END;
+ ~%]
+</div>
66 shared/site/html.tt
@@ -0,0 +1,66 @@
+[%~
+
+IF c.debug && debug_init.defined; $debug_init; END;
+
+IF page.header && page.header != 'none';
+ header = PROCESS "site/header/${page.header}.tt";
+END;
+
+IF page.footer && page.header != 'none';
+ footer = PROCESS "site/footer/${page.footer}.tt";
+END;
+
+~%]
+<!DOCTYPE html>
+<html lang="[% page.language %]">
+ <head>
+ <meta charset="utf-8">
+ <title>Codepeek[% IF page.title %]: [% page.title %] [% ELSE %], the Enlightened Pastebin[% END %]</title>
+ <meta http-equiv="Content-Language" content="[% page.language %]">
+ <meta name="google-site-verification" content="xkULRZIWgERjfbepNJTesWRHke3-mMBxPRCax8AUEkw" />
+ <meta name="description" content="[% page.description %]">
+[%
+# Add all javascript refs in page.head.scripts (see page.body.scripts)
+page.head.scripts = page.head.scripts.unique;
+FOREACH script IN page.head.scripts;
+ NEXT UNLESS script;
+ script = script.match('^(https?://|/)') ?
+ script :
+ static("scripts/$script", 1); -%]
+ <script type="text/javascript" src="[% script %]"></script>
+[%
+END;
+
+# Add all stylesheet refs in page.head.stylesheets
+page.head.stylesheets = page.head.stylesheets.unique;
+FOREACH stylesheet IN page.head.stylesheets;
+ NEXT UNLESS stylesheet;
+ stylesheet = stylesheet.match('^(https?://|/)') ?
+ stylesheet :
+ static("css/$stylesheet", 1); -%]
+ <link rel="stylesheet" href="[% stylesheet %]" type="text/css" media="screen">
+[%
+END;
+%]
+ <link rel="stylesheet" href="[% static( 'css/screen.css', 1 ) %]" type="text/css" media="screen">
+ <style type="text/css" id="styleoverrides"></style>
+ </head>
+ [% # Drop in the header if appropriate
+ header %]
+ [% content %]
+ [% footer;
+
+ # Add footer scripts
+ page.body.scripts = page.body.scripts.unique;
+ FOREACH script IN page.body.scripts;
+ NEXT UNLESS script;
+ script = script.match('^(https?://|/)') ?
+ script :
+ static('scripts/' _ script, undef, 1); -%]
+ <script type="text/javascript" src="[% script %]"></script>
+ [%
+ END;
+ %]
+ [% PROCESS site/instrumentation/googleanalytics.tt %]
+ </body>
+</html>
10 shared/site/instrumentation/googleanalytics.tt
@@ -0,0 +1,10 @@
+<script type="text/javascript">
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-4086509-6']);
+ _gaq.push(['_trackPageview']);
+ (function() {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
+ })();
+</script>
39 shared/site/instrumentation/querylog.tt
@@ -0,0 +1,39 @@
+[% IF querylog %]
+ [% SET total = querylog.time_elapsed | format('%0.6f') %]
+ <h3>[% c.loc('Query Log Report') %]</h3>
+ <table>
+ <tbody>
+ <tr class="head">
+ <th>Time</th>
+ <th>%</th>
+ <th>SQL</th>
+ </tr>
+ [% FOREACH q = qlanalyzer.get_sorted_queries %]
+ <tr class="[% IF loop.count % 2 %]odd[% END %]">
+ <th>[% q.time_elapsed | format('%0.6f') %]</th>
+ <td>[% ((q.time_elapsed / total ) * 100 ) | format('%i') %]%</td>
+ <td>[% q.sql %]: [% q.params.join(',') %]</td>
+ </tr>
+ [% END %]
+ </tbody>
+ <tfoot>
+ <tr>
+ <td colspan="4">
+ <details>
+ <dl>
+ <dt>Total SQL Time:</dt>
+ <dd>[% total | format('%0.6f') %] seconds<dd>
+ [% SET qcount = querylog.count %]
+ <dt>Total Queries:</dt>
+ <dd>[% qcount %]</dd>
+ [% IF qcount > 0 %]
+ <dt>Avg Statement Time:</dd>
+ <dd>[% (querylog.time_elapsed / qcount) | format('%0.6f') %] seconds.</dd>
+ [% END %]
+ </dl>
+ </details>
+ </td>
+ </tr>
+ </tfoot>
+ </table>
+[% END %]
28 shared/site/layout/default.tt
@@ -0,0 +1,28 @@
+[% IF page.crumbs.size %]
+<nav id="crumbs">
+ <ul>
+ <li><a href="[% c.uri_for('/') %]">[% c.loc('Home') %]</a> [% c.loc('CRUMBS_SEP') %]</li>
+ [% FOREACH link = page.crumbs %]
+ [% IF loop.last %]
+ <li>[% c.loc(link.keys.0) %]</li>
+ [% ELSE %]
+ <li><a href="[% link.values.0 %]">[% c.loc(link.keys.0) %]</a> [% c.loc('CRUMBS_SEP') %]</li>
+ [% END %]
+ [% END %]
+ </ul>
+</nav>
+[% END %]
+<article id="content">
+ <div id="main" class="clearfix">
+ [% PROCESS site/messages.tt %]
+[%~
+# Nothing fancy here. Just dump the content.
+content
+~%]
+ [% IF c.debug %]
+ <section id="debug">
+ [% PROCESS site/instrumentation/querylog.tt %]
+ </section>
+ [% END %]
+ </div>
+</article>
11 shared/site/messages.tt
@@ -0,0 +1,11 @@
+<section class="message">
+ [% FOREACH gpos IN messages.for_scope('global').for_level('success').messages %]
+ <aside class="gmessage" [% UNLESS gpos %]style="display: none"[% END %]><p>[% c.loc(gpos.id || gpos.text) %]</p></aside>
+ [% END %]
+ [% FOREACH gerr IN messages.for_scope('global').for_level('error').messages %]
+ <aside class="rmessage" [% UNLESS gerr %]style="display: none"[% END %]><p>[% c.loc(gerr.id || gerr.text) %]</p></aside>
+ [% END %]
+ [% FOREACH gwarn IN messages.for_scope('global').for_level('warning').messages %]
+ <aside class="omessage" [% UNLESS gwarn %]style="display: none"[% END %]><p>[% c.loc(gwarn.id || gwarn.text) %]</p></aside>
+ [% END %]
+</section>
1  shared/site/nav/default.tt
@@ -0,0 +1 @@
+<div class="nav">/shared/site/nav/default.tt</div>
9 shared/site/nav/my.tt
@@ -0,0 +1,9 @@
+<nav>
+ <ul>
+ [% IF c.user_exists %]
+ <li><a href="[% c.uri_for_action('/my/root') %]">[% c.loc('Projects') %]</a></a></li>
+ <li><a href="[% c.uri_for_action('/my/info') %]">[% c.loc('Information') %]</a></a></li>
+ [% END %]
+ <li><a href="[% c.uri_for_action('/paste/root') %]">[% c.loc('New Paste') %]</a></li>
+ </ul>
+</nav>
58 shared/site/nav/search_refine.tt
@@ -0,0 +1,58 @@
+<h3>[% c.loc('Refine') %]</h3>
+<ul>
+[% SET products = results.facets.products %]
+[% IF products.size > 1 %]
+ [% SET s_things = results.get_sorted_facet('product') %]
+ <li>[% c.loc('Product') %]
+ <ul>
+ [% FOREACH prod = s_things %]
+ <li><a href="[% c.req.uri_with({ product => prod }) %]">[% c.loc('[_1] ([_2])', prod, products.${prod}) %]</a></li>
+ [% END %]
+ </ul>
+ </li>
+[% END %]
+[% SET statuses = results.facets.status %]
+[% IF statuses.size > 1 %]
+ [% SET s_things = results.get_sorted_facet('status') %]
+ <li>[% c.loc('Status') %]
+ <ul>
+ [% FOREACH status = s_things %]
+ <li><a href="[% c.req.uri_with({ 'status' => status }) %]">[% c.loc('[_1] ([_2])', c.loc(status), statuses.${status}) %]</a></li>
+ [% END %]
+ </ul>
+ </li>
+[% END %]
+[% SET owners = results.facets.owner %]
+[% IF owners.size > 1 %]
+ [% SET s_things = results.get_sorted_facet('owner') %]
+ <li>[% c.loc('Owner') %]
+ <ul>
+ [% FOREACH owner = s_things %]
+ <li><a href="[% c.req.uri_with({ 'owner' => owner }) %]">[% c.loc('[_1] ([_2])', owner, owners.${owner}) %]</a></li>
+ [% END %]
+ </ul>
+ </li>
+[% END %]
+[% SET priorities = results.facets.priority %]
+[% IF priorities.size > 1 %]
+ [% SET s_things = results.get_sorted_facet('priority') %]
+ <li>[% c.loc('Priority') %]
+ <ul>
+ [% FOREACH pri = s_things %]
+ <li><a href="[% c.req.uri_with({ 'priority' => pri }) %]">[% c.loc('[_1] ([_2])', pri, priorities.${pri}) %]</a></li>
+ [% END %]
+ </ul>
+ </li>
+[% END %]
+[% SET types = results.facets.type %]
+[% IF types.size > 1 %]
+ [% SET s_things = results.get_sorted_facet('type') %]
+ <li>[% c.loc('Type') %]
+ <ul>
+ [% FOREACH type = s_things %]
+ <li><a href="[% c.req.uri_with({ 'type' => type }) %]">[% c.loc('[_1] ([_2])', type, types.${type}) %]</a></li>
+ [% END %]
+ </ul>
+ </li>
+[% END %]
+</ul>
75 shared/site/nav/ticket.tt
@@ -0,0 +1,75 @@
+[% is_editable = 1 %]
+<h4>[% c.loc('Ticket #[_1]', ticket.id) %]</a></h4>
+[% IF is_editable %]<form>[% END %]
+ <table class="ticket">
+ <tbody>
+ <tr>
+ [% readonly_field({ label => 'Type', value => ticket.type.name }) %]
+ </tr>
+ <tr>
+ [% readonly_field({ label => 'Queue', value => ticket.queue.name, link => c.uri_for_action('/queue/object', [ ticket.parent_pk1 ]) }) %]
+ </tr>
+ <tr>
+[% IF is_editable;
+ select_field({
+ default_option => [ 0, 'Choose...' ],
+ label => 'Owner', name => 'ticket.owner',
+ value => owner.person_pk1,
+ array => ticket.assignable_persons.all,
+ value_method => 'pk1', label_method => 'name'
+ });
+ ELSE;
+ readonly_field({ label => 'Owner', name => 'ticket.owner', value => owner.person.name });
+ END %]
+ </tr>
+ <tr>
+ [% IF is_editable;
+ select_field({
+ default_option => [ 0, '' ],
+ label => 'Attention', name => 'ticket.attention',
+ value => attention.person_pk1,
+ array => ticket.assignable_persons.all,
+ value_method => 'pk1', label_method => 'name',
+ });
+ ELSE;
+ readonly_field({ label => 'Attention', name => 'ticket.reporter', value => attention.person.name, important => 1, double => 1 });
+ END %]
+ </tr>
+ <tr>
+ [% dt = ticket.due_date; due_date = dt;
+ IF dt.defined && dt.dt_marker.defined;
+ link = c.uri_for_action('/calendar/root', dt.dt_marker.year, dt.dt_marker.month, { highlight => 'ticket', 'ticket' => ticket.id } );
+ due_date = dt.dt_marker | date_long;
+ ELSE;
+ due_date = c.loc('Unscheduled');
+ END;
+ readonly_field({ label => 'Date Due', name => 'ticket.date_due', type => 'date', value => due_date, link => link }); %]
+ </tr>
+ <tr>
+ [% IF is_editable;
+ select_field({
+ label => 'Priority', name => 'ticket.priority',
+ value => ticket.state.priority_pk1,
+ array => ticket.assignable_priorities.all,
+ value_method => 'pk1', label_method => 'name'
+ });
+ ELSE;
+ readonly_field({ label => 'Priority', name => 'ticket.priority', value => 'Normal' });
+ END %]
+ </tr>
+ <tr>
+ [% readonly_field({ label => 'Tags', double => 1, name => 'ticket.tags', value => tag_list.join(' ') }); %]
+ </tr>
+ [% IF is_editable %]
+ <tr class="submit">
+ <td colspan="4"><input type="image" src="[% static('/static/images/buttons/save-medium.png') %]" alt="c.loc('Submit Form') %]"></td>
+ </tr>
+ [% END %]
+ </tbody>
+ </table>
+</form>
+<ul>
+ <li><a href="#comment">[% c.loc('Comment') %]</a></li>
+ <li><a href="[% c.uri_for('/ticket/create', { parent => ticket.id }) %]">[% c.loc('Create Dependent') %]</a></li>
+ <li><a href="#">[% c.loc('Add to Stack') %]</a></li>
+</ul>
6 shared/site/nav/ticket_stack.tt
@@ -0,0 +1,6 @@
+<h4>[% c.loc('Ticket Stack') %]</h4>
+<ul class="tix">
+ <li><a href="#">#1234 Test Suite Generated Ticket</a></li>
+ <li><a href="#">#1235 Lorem Ipsum Solor Amet Long Ass Ticket Name</a></li>
+</ul>
+
277 shared/site/oldglobal.tt
@@ -0,0 +1,277 @@
+[%~
+
+MACRO logo BLOCK;
+ SET lang = 'en';
+ # Just list languages we support? Not sure...
+ IF c.language == 'ja';
+ lang = c.language;
+ END;
+ c.static_uri("images/logo-${lang}.png");
+END;
+
+MACRO select_field(info) BLOCK; %]
+ [%~ IF info.dynamic_array =%]<script type="text/javascript">if ( typeof dynamic_forms === 'undefined' ) dynamic_forms = {}; dynamic_forms['[% info.value_from %]'] = { 'source': '[% info.dynamic_array %]', 'update': '[% info.name %]', 'value': "[% info.value || html %]" };</script>[% IF info.array.size == 0; info.array.push(c.loc('Please select [_1]', [ info.value_from ] ) ); END; END %]
+ <div id="form_[% info.name %]_fields" class="text_group[% IF info.optional %] optional[% END %] [% IF info.class %][% info.class %][% END %]">
+ <label for="form_[% info.name %]">[% c.loc(info.label) %][% IF info.optional && !form.hide_optional %]<span class="optional">[% c.loc("FIELD OPTIONAL SPLAT") %][% ELSIF !info.optional && !form.hide_required %]<span class="required">[% c.loc("FIELD REQUIRED SPLAT") %]</span>[% END %]</label>
+ <select id="form_[% info.name %]" name="[% info.name %]" style="width: auto" class="
+ [%~ IF info.dynamic_array =%]
+ dynamic-array
+ [%~ END ~%]">
+ [% IF info.default_option %]<option value="[% info.default_option.0 %]">[% info.default_option.1 %]</option>[% END %]
+ [% FOREACH item = info.array;
+ IF info.value_method;
+ SET this_value = item.${info.value_method};
+ ELSE;
+ SET this_value = item;
+ END;
+ IF info.label_method;
+ SET this_name = item.${info.label_method};
+ ELSE;
+ SET this_name = item;
+ END;
+ %]<option value="[% this_value %]" [% IF this_value == info.value %]selected="selected"[% END %] >[% this_name %]</option>
+ [% END %]
+ </select>
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+ [% IF info.message %]<p class="clear attention">[% c.loc(info.message) %]</p>[% END %]
+ </div>[%
+END;
+
+MACRO autocomplete_field(info) BLOCK;
+ info.autocomplete = 1;
+ text_field(info);
+END;
+
+MACRO country_field(info) BLOCK; %]
+ <div id="form_[% info.name %]_fields" class="text_group[% IF info.optional %] optional[% END %]">
+ <label for="form_[% info.name %]">[% c.loc(info.label) %][% IF info.optional && !form.hide_optional %]<span class="optional">[% c.loc("FIELD OPTIONAL SPLAT") %][% ELSIF !info.optional && !form.hide_required %]<span class="required">[% c.loc("FIELD REQUIRED SPLAT") %]</span>[% END %]</label>
+ <select id="form_[% info.name %]" name="[% info.name %]">
+ [% PROCESS form/countries.tt %]
+ </select>
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+ [% IF info.message %]<p class="clear attention">[% c.loc(info.message) %]</p>[% END %]
+ </div>[%
+END;
+
+MACRO password_field(info) BLOCK;
+ info.type = 'password';
+ text_field(info);
+END;
+
+MACRO text_field(info) BLOCK %]
+ [% IF !info.value && info.hint;
+ hinted = 1;
+ END;
+ classes = [ 'text_group' ];
+ classes.push( info.classes );
+ IF info.optional; classes.push('optional'); END;
+ %]
+ <div id="form_[% info.name %]_fields" class="text_group[% IF info.optional %] optional[% END %]">
+ <label id="form_[% info.name %]_label" for="form_[% info.name %]"[% IF info.message %] class="attention"[% END %]>[% c.loc(info.label) ~%]
+ [%~ IF info.tooltip %]<script type="text/javascript">new YAHOO.widget.Tooltip('tt_[% info.name %]_label', { context: 'form_[% info.name %]_label', text: "[% info.tooltip | replace('"', '\"') %]" } );</script>[?][% END ~%]
+ [% IF info.optional && !form.hide_optional %]<span class="optional">[% c.loc("FIELD OPTIONAL SPLAT") %][% ELSIF !info.optional && !form.hide_required %]<span class="required">[% c.loc("FIELD REQUIRED SPLAT") %][% END %]</span>[%~ ~%]
+ </label>
+ <input type="[% info.type || 'text' %]" id="form_[% info.name %]" name="[% info.name %]" value="[% info.value || info.hint | html %]"
+ [%~ IF info.autocomplete == 0 %] autocomplete="false"[% END ~%]
+ [%~ IF info.disabled == 1 %] disabled="disabled"[% END ~%]
+ [%~ IF info.tabindex %] tabindex="[% info.tabindex %]"[% END ~%]
+ [%~ IF info.maxlength %] maxlength="[% info.maxlength %]"[% END ~%]
+ [%~ IF info.width %] size="[% info.width %]" style="width: [% info.width %]em;"[% END ~%]
+ class="
+ [%~ IF hinted %] hintable[% END ~%]
+ [%~ IF info.focus == 1 %] focus[% END ~%]
+ [%~ IF info.autocomplete == 1 %] autocomplete[% END ~%]
+ "
+ />
+ [%~ IF info.autocomplete == 1 %]<div id="ac_[% info.name %]_container"></div>[% END =%]
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+ [% IF info.message %]<p class="clear attention">[% c.loc(info.message) %]</p>[% END %]
+ </div>[%
+END;
+
+MACRO textarea_field(info) BLOCK; %]
+ <div class="text_group[% IF info.optional %] optional[% END %] [% IF info.class %][% info.class %][% END %]">
+ <label for="form_[% info.name %]"[% IF info.message %] class="attention"[% END %]>[% c.loc(info.label) %][% IF info.optional && !form.hide_optional %]<span class="optional">[% c.loc("FIELD OPTIONAL SPLAT") %][% ELSIF !info.optional && !form.hide_required %]<span class="required">[% c.loc("FIELD REQUIRED SPLAT") %]</span>[% END %]</label>
+ <textarea [%= ~%]
+ id="form_[% info.name %]" name="[% info.name %]"
+ class="
+ [%~ IF info.class %][% info.class %][% END ~%]
+ [%~ IF info.focus %] focus[% END ~%]
+ "
+ [%~ IF info.rows %] rows="[% info.rows %]"[% END ~%]
+ [%~ IF info.cols %] cols="[% info.cols %]" style="width: [% info.cols %]em"[% END ~%]
+ >
+ [%~ info.value | html ~%]
+ </textarea>
+ [% IF info.extra; "<p>&nbsp;"; info.extra; "</p>"; END %]
+ [% IF info.message %]<p class="attention">[% c.loc(info.message) %]</p>[% END %]
+ </div>[%
+END;
+
+MACRO readonly_field(info) BLOCK %]
+ <div id="form_[% info.name %]_fields" class="text_group[% IF info.optional %] optional[% END %]">
+ <label id="form_[% info.name %]_label" for="form_[% info.name %]"[% IF info.message %] class="attention"[% END %]>[% c.loc(info.label) %][% IF info.optional && !form.hide_optional %]<span class="optional">[% c.loc("FIELD OPTIONAL SPLAT") %][% ELSIF !info.optional && !form.hide_required %]<span class="required">[% c.loc("FIELD REQUIRED SPLAT") %]</span>[% END %]</label>
+ <input type="hidden" id="form_[% info.name %]" name="[% info.name %]" value="[% info.value | html %]"/>
+ <span class="readonly">[% info.value %]</span>
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+ [% IF info.message %]<p class="clear attention">[% c.loc(info.message) %]</p>[% END %]
+ </div>[%
+END;
+
+MACRO display_field(info) BLOCK %]
+ [% IF info.optional != 0; info.optional = 1; END; %]
+ <div id="form_[% info.name %]_fields" class="text_group[% IF info.optional %] optional[% END %]">
+ <label id="form_[% info.name %]_label" for="form_[% info.name %]"[% IF info.message %] class="attention"[% END %]>[% c.loc(info.label) %][% IF info.optional && !form.hide_optional %]<span class="optional">[% c.loc("FIELD OPTIONAL SPLAT") %][% ELSIF !info.optional && !form.hide_required %]<span class="required">[% c.loc("FIELD REQUIRED SPLAT") %]</span>[% END %]</label>
+ <span class="readonly" id="form_[% info.name %]">[% info.value %]</span>
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+ [% IF info.message %]<p class="clear attention">[% c.loc(info.message) %]</p>[% END %]
+ </div>[%
+END;
+
+
+MACRO checkbox_field(info) BLOCK %]
+ <div id="form_[% info.name %]_fields" class="checkbox text_group[% IF info.optional %] optional[% END %]">
+ <label for="form_[% info.name %]_[% info.value %]"[% IF info.message %] class="attention"[% END %]>[% c.loc(info.label) %]<span class="required">[% IF info.optional && !form.hide_optional %]<span class="optional">[% c.loc("FIELD OPTIONAL SPLAT") %][% ELSIF !info.optional && !form.hide_required %]<span class="required">[% c.loc("FIELD REQUIRED SPLAT") %]</span>[% END %]</label>
+ <input [% IF info.maxlength %]maxlength="[% info.maxlength %]"[% END %] [% IF info.width %]size="[% info.width %]"[% END %] type="[% info.type || 'checkbox' %]" id="form_[% info.name %]_[% info.value %]" name="[% info.name %]" value="[% info.value | html %]"
+ [%~ IF info.checked == 1 %] checked="checked"[% END ~%]
+ [%~ IF info.disabled == 1 %] disabled="disabled"[% END ~%]
+ />
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+ [% IF info.message %]<p class="clear attention">[% c.loc(info.message) %]</p>[% END %]
+ </div>[%
+END;
+
+MACRO radio_group(info) BLOCK;
+ classes = [ 'label' ];
+ IF info.message; classes.push('attention'); END; %]
+ <div id="form_[% info.name %]_fields" class="input_group[% IF info.optional %] optional[% END %]">
+ <div class="[% classes.join(' ') %]">[%= ~%]
+ [% c.loc(info.label) ~%]
+ [% IF info.optional && !form.hide_optional %]<span class="optional">[% c.loc("FIELD OPTIONAL SPLAT") %][% ELSIF !info.optional && !form.hide_required %]<span class="required">[% c.loc("FIELD REQUIRED SPLAT") %][% END %]
+ </div>
+ [%~ FOREACH key IN info.values.keys ~%]
+ <input [% IF info.maxlength %]maxlength="[% info.maxlength %]"[% END %] [% IF info.width %]size="[% info.width %]"[% END %] type="[% info.type || 'radio' %]" id="form_[% info.name %]_[% info.values.$key %]" name="[% info.name %]" value="[% info.values.$key | html %]"
+ [%~ IF info.value == info.values.$key =%]
+ checked="checked"
+ [%~ END ~%]
+ />
+ <label for="form_[% info.name %]_[% info.values.$key %]">[% key | html %]</label>
+ [% END %]
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+ [% IF info.message %]<p class="clear attention">[% c.loc(info.message) %]</p>[% END %]
+ </div>
+[% END;
+
+USE format;
+
+date_month_format = format("%02d");
+
+MACRO date_field(info) BLOCK;
+ IF !info.value; info.value = now; END;
+ IF info.no_day != 1;
+ day = info.value.strftime('%d');
+ END;
+ month = info.month || info.value.strftime('%m');
+ year = info.year || info.value.strftime('%Y');
+ start_year = info.start_year || 1920;
+ end_year = info.end_year || 2003;
+%]
+ [% IF !info.value && info.hint;
+ hinted = 1;
+ END; %]
+ <div id="form_[% info.name %]_fields" class="text_group[% IF info.optional %] optional[% END %]">
+ <label id="form_[% info.name %]_label" for="form_[% info.name %]"[% IF info.message %] class="attention"[% END %]>[% c.loc(info.label) %][% IF info.optional && !form.hide_optional %]<span class="optional">[% c.loc("FIELD OPTIONAL SPLAT") %][% ELSIF !info.optional && !form.hide_required %]<span class="required">[% c.loc("FIELD REQUIRED SPLAT") %]</span>[% END %]</label>
+ <select id="form_[% info.name %]" name="[% info.name %].month" class="inline">
+ [% FOREACH month_opt IN [ 0 .. 12 ] %]
+ <option value="[% month_opt %]"[% IF date_month_format(month_opt) == month %] selected="selected"[% END %]>[% month_opt || "MM" %]</option>
+ [% END %]
+ </select>
+[% IF info.no_day != 1 %]
+ <select name="[% info.name %].day" class="inline">
+ [% FOREACH day_opt IN [ 0 .. 31 ] %]
+ <option value="[% day_opt %]"[% IF date_month_format(day_opt) == day %] selected="selected"[% END %]>[% day_opt || "DD" %]</option>
+ [% END %]
+ </select>
+[% END %]
+ <select name="[% info.name %].year" class="inline">
+ <option value="0">[% c.loc('Year') %]</option>
+ [% FOREACH year_opt IN [ start_year .. end_year ] %]
+ <option value="[% year_opt %]"[% IF year_opt == year %] selected="selected"[% END %]>[% year_opt %]</option>
+ [% END %]
+ </select>
+ <a class="extra calendar-popup" name="cal_[% info.name %]" href="#[% info.name %]"><img src="[% static('images/calendar.png') %]" title="[% c.loc('Open Calendar') %]" alt="[% c.loc('Open Calendar') %]"></a>
+ <div id="cal_[% info.name %]" class="calendar"></div>
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+ [% IF info.message %]<p class="clear attention">[% c.loc(info.message) %]</p>[% END %]
+ </div>
+[% END;
+
+MACRO phone_field(info) BLOCK;
+ IF info.value;
+ area_code = info.value.substr(0, 3);
+ prefix = info.value.substr(3, 3);
+ last4 = info.value.substr(6);
+ END %]
+ [% IF !info.value && info.hint;
+ hinted = 1;
+ END; %]
+ <div id="form_[% info.name %]_fields" class="text_group[% IF info.optional %] optional[% END %]">
+ <label id="form_[% info.name %]_label" for="form_[% info.name %]"[% IF info.message %] class="attention"[% END %]>[% c.loc(info.label) %][% IF info.optional && !form.hide_optional %]<span class="optional">[% c.loc("FIELD OPTIONAL SPLAT") %][% ELSIF !info.optional && !form.hide_required %]<span class="required">[% c.loc("FIELD REQUIRED SPLAT") %]</span>[% END %]</label>
+ <span class="group">
+ (<input type="text" id="form_[% info.name %]" name="[% info.name %].areacode" value="[% area_code %]" size="3" class="inline">)
+ <input type="text" id="form_[% info.name %]" name="[% info.name %].prefix" value="[% prefix %]" size="3" class="inline">-
+ <input type="text" id="form_[% info.name %]" name="[% info.name %].last4" value="[% last4 %]" size="4" class="inline">
+ </span>
+ <span id="form_[% info.name %]_extra" class="extra">[% info.extra %]</span>
+ [% IF info.message %]<p class="clear attention">[% c.loc(info.message) %]</p>[% END %]
+ </div>[%
+END;
+
+MACRO address_field(info) BLOCK %]
+ <div id="form_[% info.name %]_fields" class="text_group[% IF info.optional %] optional[% END %]">
+ <label id="form_[% info.name %]_label" for="form_[% info.name %]"[% IF info.message %] class="attention"[% END %]>[% c.loc(info.label) %][% IF info.optional && !form.hide_optional %]<span class="optional">[% c.loc("FIELD OPTIONAL SPLAT") %][% ELSIF !info.optional && !form.hide_required %]<span class="required">[% c.loc("FIELD REQUIRED SPLAT") %]</span>[% END %]</label>
+ <div class="group inline">
+ <p>
+ <label for="address_1">Street:</label>
+ <input type="text" name="address_1" value="[% info.values.address_1 %]">
+ </p>
+ <p>
+ <label for="city">City:</label>
+ <input type="text" name="city" value="[% info.values.city %]">
+ </p>
+ <p>
+ <label for="state">State:</label>
+ <select name="state">
+ [% FOREACH state IN c.model('Schema::State').all %]
+ <option value="[% state.abbr %]" [% IF info.values.state == state.abbr %] selected="selected"[% END %]>[% state.full_name %]</option>
+ [% END %]
+ </select>
+ </p>
+ <p>
+ <label for="zip">Zip:</label>
+ <input type="text" name="zip" value="[% info.values.zip %]" style="width: 5em;" size="5">
+ </p>
+ </div>
+ [% IF info.message %]<p class="clear attention">[% c.loc(info.message) %]</p>[% END %]
+ </div>[%
+END;
+
+MACRO sort_link(key) BLOCK;
+ cur_dir = dir || 'DESC';
+ IF sort_by == key; cur_dir = cur_dir == 'DESC' ? 'ASC' : 'DESC'; END;
+ c.req.uri_with({ sort_by => key, dir => cur_dir });
+END;
+
+MACRO run_widget(name, args) BLOCK;
+ SET widge = widget.load(name, args);
+ WRAPPER "widgets/wrapper.tt";
+ INCLUDE "widgets/${widge.template}" args = widge.run(args);
+ END;
+ page.widgets.push(name);
+END;
+
+MACRO show_ad(category, name) BLOCK;
+ PROCESS "ads/${category}/${name}.tt";
+END;
+
+~%]
50 shared/site/shared/base.tt
@@ -0,0 +1,50 @@
+
+[%~
+
+MACRO ref(var) BLOCK;
+ var_ref = "$var";
+ var_ref.match('^([A-Z]+)\\(0x[0-9a-f]+\\)$').0;
+END;
+
+# Wraps c.uri_for to point to static resources either inside the
+# /root/static structure or explicit URIs. Assumes
+MACRO static(res, versioned, query) BLOCK;
+ uri_params = query || {};
+ IF res.match('^https?://') || res.match('^/');
+ res;
+ ELSIF versioned && static_build;
+ uri_params.ver = uri_params.ver || static_build;
+ c.uri_for( static_root, res, uri_params );
+ ELSE;
+ c.uri_for( static_root, res );
+ END;
+END;
+
+# Set up the default stash structure for the page
+IF !page || !ref(page) == 'HASH';
+ page = {};
+END;
+DEFAULT page.title = '';
+DEFAULT page.description = 'An enlightened pastebin for standalone or project use.';
+DEFAULT page.layout = 'default';
+DEFAULT page.header = 'default';
+DEFAULT page.nav = 'default';
+DEFAULT page.footer = 'default';
+DEFAULT page.language = c.config.language || 'en';
+DEFAULT page.head = {};
+DEFAULT page.head.stylesheets = [
+ 'http://yui.yahooapis.com/combo?3.0.0/build/cssreset/reset-min.css&3.0.0/build/cssfonts/fonts-min.css&3.0.0/build/cssbase/base-min.css'
+];
+DEFAULT page.head.scripts = [];
+DEFAULT page.body = {};
+DEFAULT page.body.classes = ['yui-skin-sam'];
+DEFAULT page.body.scripts = [
+ 'http://yui.yahooapis.com/combo?3.0.0/build/yui/yui-min.js',
+];
+DEFAULT page.crumbs = [];
+DEFAULT page.content_class = 'content';
+
+# Include global macros/vars/set up per implementation
+TRY; PROCESS site/global.tt; CATCH file; END;
+
+~%]
24 shared/site/shared/pager.tt
@@ -0,0 +1,24 @@
+<nav class="pager">
+ <p>[% c.loc('Results [_1] to [_2] of [_3], Page [_4] of [_5]', pager.first, pager.last, pager.total_entries, pager.current_page, pager.last_page) %]</p>
+ <ol>
+ <li class="first"><a href="[% c.req.uri_with({ page => pager.first_page }) %]"><img src="/static/images/actions/resultset_first.png"></a></li>
+ [% IF pager.current_page > pager.first_page %]
+ <li class="first"><a href="[% c.req.uri_with({ page => pager.previous_page }) %]">[% c.loc('Previous') %]</a></li>
+ [% ELSE %]
+ <li class="first">[% c.loc('Previous') %]</li>
+ [% END %]
+ [% FOREACH [ pager.first_page .. pager.last_page ] %]
+ [% IF loop.count == pager.current_page %]
+ <li>[% loop.count %]</li>
+ [% ELSE %]
+ <li><a href="[% c.req.uri_with({ page => loop.count }) %]">[% loop.count %]</a></li>
+ [% END %]
+ [% END %]
+ [% IF pager.current_page < pager.last_page %]
+ <li class="last"><a href="[% c.req.uri_with({ page => pager.next_page }) %]">[% c.loc('Next') %]</a></li>
+ [% ELSE %]
+ <li class="last">[% c.loc('Next') %]</li>
+ [% END %]
+ <li class="last"><a href="[% c.req.uri_with({ page => pager.last_page }) %]"><img src="/static/images/actions/resultset_last.png"></a></li>
+ </ol>
+</nav>
72 shared/site/shared/ticket_table.tt
@@ -0,0 +1,72 @@
+[%~
+
+USE Number.Format;
+
+tickets_open = 0;
+tickets_closed = 0;
+tickets_total = 0;
+
+~%]
+<table class="summary">
+ <tbody>
+ <tr class="head">
+ <th>[% c.loc('Ticket') %]</th>
+ <th>[% c.loc('Summary') %]</th>
+ <th>[% c.loc('Status') %]</th>
+ <th>[% c.loc('Owner') %]</th>
+ <th>[% c.loc('Date Due') %]</th>
+ <th>[% c.loc('Type') %]</th>
+ <th>[% c.loc('Priority') %]</th>
+ <th>[% c.loc('Component') %]</th>
+ </tr>
+[% FOREACH ticket IN tickets;
+ classes = [];
+
+ ticket_uri = c.uri_for_action('/ticket/object', [ ticket.id ]);
+ IF ticket.status.name == 'CLOSED';
+ classes.push('closed');
+ tickets_closed = tickets_closed + 1;
+ ELSE;
+ tickets_open = tickets_open + 1;
+ END;
+ IF ticket.needs_attention;
+ classes.push('imp');
+ END;
+ IF loop.index % 2 == 0;
+ classes.push('odd');
+ END;
+
+ tickets_total = tickets_total + 1;
+
+~%]
+ <tr class="[% classes.join(' ') %]">
+ <th class="link"><a href="[% ticket_uri %]">[% ticket.id %]</a></th>
+ <td class="link"><a href="[% ticket_uri %]">[% ticket.name | html %]</a></td>
+ <td>[% c.loc(ticket.status.name) %]</td>
+ <td>[% ticket.owner.person.token | html %]</td>
+ <td>[% due_date = ticket.due_date; IF due_date; %]<time datetime="[% due_date.dt_marker %]">[% pretty_date(due_date.dt_marker); %]</time>[% ELSE; "&mdash;"; END %]</td>
+ <td>[% c.loc(ticket.type.name) %]</td>
+ <td>[% c.loc(ticket.priority.name) %]</td>
+ <td>X</td>
+ </tr>
+[% END %]
+ </tbody>
+[% IF tickets_total %]
+ <tfoot>
+ <tr>
+ [%= SET complete_percent = ( tickets_closed / tickets_total ) * 100 ~%]
+ <td colspan="8">
+ <meter>
+ [% IF complete_percent == 100 %]
+ <img src="/static/images/actions/tick.png">
+ [% ELSE %]
+ <img src="[% c.uri_for('/chart/completion_pie', complete_percent) %]">
+ [% END %]
+ [% complete_percent | format_number %]% Complete
+ </meter>[%~ =%]
+ <details><a href="#">[% c.loc('[_1] Closed', [ tickets_closed ]) %]</a> + <a href="#">[% c.loc('[_1] Open', [ tickets_open ] ) %]</a> = <a href="#">[% c.loc('[_1] Total', [ tickets_total ] ) %]</a></details>
+ </td>
+ </tr>
+ </tfoot>
+[% END %]
+</table>
12 shared/site/wrapper.tt
@@ -0,0 +1,12 @@
+[%~
+# Process the appropriate layout
+IF page.layout == 'partial';
+ content;
+ELSE;
+ IF page.layout == 'none';
+ content WRAPPER site/html.tt;
+ ELSE;
+ content WRAPPER site/html.tt + "site/layout/${page.layout}.tt";
+ END;
+END;
+~%]
13 styleguide.yml
@@ -0,0 +1,13 @@
+---
+name: StyleGuide
+default_view: StyleGuide
+View::StyleGuide:
+ shared_root: __path_to(shared)__
+ designs:
+ NasaEms:
+ root: __path_to(designs/ems/root)__
+ static: __path_to(designs/ems/static)__
+ Plain:
+ root: __path_to(designs/plain/root)__
+ static: __path_to(designs/plain/static)__
+
10 t/01app.t
@@ -0,0 +1,10 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+BEGIN { use_ok 'Catalyst::Test', 'StyleGuide' }
+
+ok( request('/')->is_success, 'Request should succeed' );
+
+done_testing();
10 t/02pod.t
@@ -0,0 +1,10 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+eval "use Test::Pod 1.14";
+plan skip_all => 'Test::Pod 1.14 required' if $@;
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+
+all_pod_files_ok();
10 t/03podcoverage.t
@@ -0,0 +1,10 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+
+all_pod_coverage_ok();
Please sign in to comment.
Something went wrong with that request. Please try again.