From 1d19edc231739d19bf7d6f2a4c31d89244d2c666 Mon Sep 17 00:00:00 2001 From: Moritz Grosch Date: Mon, 22 Jun 2015 13:23:18 +0200 Subject: [PATCH] Auf Perl/Dancer2 umgebaut MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Die zufälligen Farben sind dabei verloren gegangen - wenn ihr die wirklich wollt, bau ich sie wieder ein. --- .htaccess | 19 ----- MANIFEST | 23 +++++ MANIFEST.SKIP | 17 ++++ Makefile.PL | 26 ++++++ bin/app.psgi | 9 ++ config.yml | 10 +++ cpanfile | 11 +++ environments/development.yml | 23 +++++ environments/production.yml | 16 ++++ index.php | 80 ------------------ lib/ChaosChemnitz/Interfug15/Webseite.pm | 34 ++++++++ public/404.html | 18 ++++ public/500.html | 18 ++++ {img => public/img}/chch_nacht.jpg | Bin {img => public/img}/line_blue.png | Bin {img => public/img}/line_green.png | Bin {img => public/img}/line_red.png | Bin {img => public/img}/marx_blue.png | Bin {img => public/img}/marx_green.png | Bin {img => public/img}/marx_red.png | Bin .../img}/raw/interfug stamp_final_6er_a4.svg | 0 {img => public/img}/raw/schema.png | Bin {img => public/img}/raw/schema.svg | 0 {img => public/img}/raw/schema.xcf | Bin {img => public/img}/raw/texture.svg | 0 {img => public/img}/texture_blue.png | Bin {img => public/img}/texture_green.png | Bin {img => public/img}/texture_red.png | Bin {misc => public/misc}/ocr_a_regular.ttf | Bin style/style.css.php => public/style/style.css | 33 ++------ t/001_base.t | 5 ++ t/002_index_route.t | 15 ++++ text/anreise.html => views/anreise.tt | 0 text/cfp.html => views/cfp.tt | 0 text/home.html => views/home.tt | 0 text/kontakt.html => views/kontakt.tt | 0 views/layouts/main.tt | 43 ++++++++++ text/tickets.html => views/tickets.tt | 0 38 files changed, 274 insertions(+), 126 deletions(-) delete mode 100755 .htaccess create mode 100644 MANIFEST create mode 100644 MANIFEST.SKIP create mode 100644 Makefile.PL create mode 100755 bin/app.psgi create mode 100644 config.yml create mode 100644 cpanfile create mode 100644 environments/development.yml create mode 100644 environments/production.yml delete mode 100644 index.php create mode 100644 lib/ChaosChemnitz/Interfug15/Webseite.pm create mode 100644 public/404.html create mode 100644 public/500.html rename {img => public/img}/chch_nacht.jpg (100%) rename {img => public/img}/line_blue.png (100%) rename {img => public/img}/line_green.png (100%) rename {img => public/img}/line_red.png (100%) rename {img => public/img}/marx_blue.png (100%) rename {img => public/img}/marx_green.png (100%) rename {img => public/img}/marx_red.png (100%) rename {img => public/img}/raw/interfug stamp_final_6er_a4.svg (100%) rename {img => public/img}/raw/schema.png (100%) rename {img => public/img}/raw/schema.svg (100%) rename {img => public/img}/raw/schema.xcf (100%) rename {img => public/img}/raw/texture.svg (100%) rename {img => public/img}/texture_blue.png (100%) rename {img => public/img}/texture_green.png (100%) rename {img => public/img}/texture_red.png (100%) rename {misc => public/misc}/ocr_a_regular.ttf (100%) rename style/style.css.php => public/style/style.css (81%) create mode 100644 t/001_base.t create mode 100644 t/002_index_route.t rename text/anreise.html => views/anreise.tt (100%) rename text/cfp.html => views/cfp.tt (100%) rename text/home.html => views/home.tt (100%) rename text/kontakt.html => views/kontakt.tt (100%) create mode 100644 views/layouts/main.tt rename text/tickets.html => views/tickets.tt (100%) diff --git a/.htaccess b/.htaccess deleted file mode 100755 index a17e112..0000000 --- a/.htaccess +++ /dev/null @@ -1,19 +0,0 @@ - -RewriteEngine On -RewriteBase / -RewriteRule ^index\.php$ - [L] -RewriteCond %{REQUEST_FILENAME} !-f - -RewriteRule ^css/([a-z\-]+)\.css$ style/$1.css.php [L] -RewriteRule ^([a-z]+)/?$ index.php?page=$1 [L] - -#RewriteRule ^robots\.txt$ robots.php [L] -#RewriteRule ^Sitemap\.xml$ sitemap.php [L] -#RewriteRule ^js/([^/\.]+)\.js$ script.php?id=$1 [L] -#RewriteRule ^data/([A-Za-z0-9]{32})/?$ media.php?id=$1&raw=true [L] -#RewriteRule ^([a-z0-9]{32})/?$ index.php?id=$1 [L] -#RewriteRule ^([^/\.]+)/([^/\.]+)/(.) - [F,L] - - -Header set Cache-Control "max-age=604800, public" - diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..52da1ac --- /dev/null +++ b/MANIFEST @@ -0,0 +1,23 @@ +MANIFEST +cpanfile +config.yml +Makefile.PL +MANIFEST.SKIP +t/002_index_route.t +t/001_base.t +public/favicon.ico +public/dispatch.cgi +public/404.html +public/dispatch.fcgi +public/500.html +public/css/style.css +public/css/error.css +public/images/perldancer.jpg +public/images/perldancer-bg.jpg +public/javascripts/jquery.js +lib/ChaosChemnitz/Interfug15/Webseite.pm +environments/development.yml +environments/production.yml +bin/app.psgi +views/index.tt +views/layouts/main.tt diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP new file mode 100644 index 0000000..5839d49 --- /dev/null +++ b/MANIFEST.SKIP @@ -0,0 +1,17 @@ +^\.git\/ +maint +^tags$ +.last_cover_stats +Makefile$ +^blib +^pm_to_blib +^.*.bak +^.*.old +^t.*sessions +^cover_db +^.*\.log +^.*\.swp$ +MYMETA.* +^.gitignore +^.svn\/ +^.- diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..c11a5b4 --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,26 @@ +use strict; +use warnings; +use ExtUtils::MakeMaker; + +# Normalize version strings like 6.30_02 to 6.3002, +# so that we can do numerical comparisons on it. +my $eumm_version = $ExtUtils::MakeMaker::VERSION; +$eumm_version =~ s/_//; + +WriteMakefile( + NAME => 'ChaosChemnitz::Interfug15::Webseite', + AUTHOR => q{YOUR NAME }, + VERSION_FROM => 'lib/ChaosChemnitz/Interfug15/Webseite.pm', + ABSTRACT => 'YOUR APPLICATION ABSTRACT', + ($eumm_version >= 6.3001 + ? ('LICENSE'=> 'perl') + : ()), + PL_FILES => {}, + PREREQ_PM => { + 'Test::More' => 0, + 'YAML' => 0, + 'Dancer2' => 0.160000, + }, + dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, + clean => { FILES => 'ChaosChemnitz-Interfug15-Webseite-*' }, +); diff --git a/bin/app.psgi b/bin/app.psgi new file mode 100755 index 0000000..f5fdf63 --- /dev/null +++ b/bin/app.psgi @@ -0,0 +1,9 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use FindBin; +use lib "$FindBin::Bin/../lib"; + +use ChaosChemnitz::Interfug15::Webseite; +ChaosChemnitz::Interfug15::Webseite->to_app; diff --git a/config.yml b/config.yml new file mode 100644 index 0000000..020cd5e --- /dev/null +++ b/config.yml @@ -0,0 +1,10 @@ +appname: "ChaosChemnitz::Interfug15::Webseite" +layout: "main" +charset: "UTF-8" +template: "template_toolkit" +engines: + template: + template_toolkit: + start_tag: '<%' + end_tag: '%>' + diff --git a/cpanfile b/cpanfile new file mode 100644 index 0000000..5a618da --- /dev/null +++ b/cpanfile @@ -0,0 +1,11 @@ +requires "Dancer2" => "0.160000"; + +recommends "YAML" => "0"; +recommends "URL::Encode::XS" => "0"; +recommends "CGI::Deurl::XS" => "0"; +recommends "HTTP::Parser::XS" => "0"; + +on "test" => sub { + requires "Test::More" => "0"; + requires "HTTP::Request::Common" => "0"; +}; diff --git a/environments/development.yml b/environments/development.yml new file mode 100644 index 0000000..b63fe64 --- /dev/null +++ b/environments/development.yml @@ -0,0 +1,23 @@ +# configuration file for development environment + +# the logger engine to use +# console: log messages to STDOUT (your console where you started the +# application server) +# file: log message to a file in log/ +logger: "console" + +# the log level for this environment +# core is the lowest, it shows Dancer2's core log messages as well as yours +# (debug, info, warning and error) +log: "core" + +# should Dancer2 consider warnings as critical errors? +warnings: 1 + +# should Dancer2 show a stacktrace when an error is caught? +# if set to yes, public/500.html will be ignored and either +# views/500.tt, 'error_template' template, or a default error template will be used. +show_errors: 1 + +# print the banner +startup_info: 1 diff --git a/environments/production.yml b/environments/production.yml new file mode 100644 index 0000000..41b436f --- /dev/null +++ b/environments/production.yml @@ -0,0 +1,16 @@ +# configuration file for production environment + +# only log warning and error messsages +log: "warning" + +# log message to a file in logs/ +logger: "file" + +# don't consider warnings critical +warnings: 0 + +# hide errors +show_errors: 0 + +# disable server tokens in production environments +no_server_tokens: 1 diff --git a/index.php b/index.php deleted file mode 100644 index d77bdc9..0000000 --- a/index.php +++ /dev/null @@ -1,80 +0,0 @@ -"home","url"=>"/","title"=>"Home"), -Array("name"=>"cfp","url"=>"/cfp","title"=>"call for papers"), -Array("name"=>"tickets","url"=>"/tickets","title"=>"Tickets"), -Array("name"=>"anreise","url"=>"/anreise","title"=>"Anreise"), -Array("name"=>"kontakt","url"=>"/kontakt","title"=>"Kontakt") -); -?> - - - - INTERFUG #1//2015 - - - - - - - - - - - - -
- - -
-
- id:

*/ - switch($pageId){ - - case "cfp": - echo file_get_contents("text/cfp.html"); - break; - - case "tickets": - echo file_get_contents("text/tickets.html"); - break; - - case "anreise": - echo file_get_contents("text/anreise.html"); - break; - - case "kontakt": - echo file_get_contents("text/kontakt.html"); - break; - - default: - echo file_get_contents("text/home.html"); - break; - } - ?> - -
-
-
- - - diff --git a/lib/ChaosChemnitz/Interfug15/Webseite.pm b/lib/ChaosChemnitz/Interfug15/Webseite.pm new file mode 100644 index 0000000..f6c53c8 --- /dev/null +++ b/lib/ChaosChemnitz/Interfug15/Webseite.pm @@ -0,0 +1,34 @@ +package ChaosChemnitz::Interfug15::Webseite; +use Dancer2; + +our $VERSION = '0.1'; + +our $PAGES = [ + { url => '/', name => 'Startseite' }, + { url => '/anreise', name => 'Anreise' }, + { url => '/cfp', name => 'Call for Papers' }, + { url => '/kontakt', name => 'Kontakt' }, + { url => '/tickets', name => 'Tickets' }, +]; + +get '/' => sub { + template 'home', { pages => $PAGES }; +}; + +get '/anreise' => sub { + template 'anreise', { pages => $PAGES }; +}; + +get '/cfp' => sub { + template 'cfp', { pages => $PAGES }; +}; + +get '/kontakt' => sub { + template 'kontakt', { pages => $PAGES }; +}; + +get '/tickets' => sub { + template 'tickets', { pages => $PAGES }; +}; + +true; diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..c214958 --- /dev/null +++ b/public/404.html @@ -0,0 +1,18 @@ + + + +Error 404 + + + + +

Error 404

+
+

Page Not Found

Sorry, this is the void.

+
+ + + diff --git a/public/500.html b/public/500.html new file mode 100644 index 0000000..2878db6 --- /dev/null +++ b/public/500.html @@ -0,0 +1,18 @@ + + + +Error 500 + + + + +

Error 500

+
+

Internal Server Error

Wooops, something went wrong

+
+ + + diff --git a/img/chch_nacht.jpg b/public/img/chch_nacht.jpg similarity index 100% rename from img/chch_nacht.jpg rename to public/img/chch_nacht.jpg diff --git a/img/line_blue.png b/public/img/line_blue.png similarity index 100% rename from img/line_blue.png rename to public/img/line_blue.png diff --git a/img/line_green.png b/public/img/line_green.png similarity index 100% rename from img/line_green.png rename to public/img/line_green.png diff --git a/img/line_red.png b/public/img/line_red.png similarity index 100% rename from img/line_red.png rename to public/img/line_red.png diff --git a/img/marx_blue.png b/public/img/marx_blue.png similarity index 100% rename from img/marx_blue.png rename to public/img/marx_blue.png diff --git a/img/marx_green.png b/public/img/marx_green.png similarity index 100% rename from img/marx_green.png rename to public/img/marx_green.png diff --git a/img/marx_red.png b/public/img/marx_red.png similarity index 100% rename from img/marx_red.png rename to public/img/marx_red.png diff --git a/img/raw/interfug stamp_final_6er_a4.svg b/public/img/raw/interfug stamp_final_6er_a4.svg similarity index 100% rename from img/raw/interfug stamp_final_6er_a4.svg rename to public/img/raw/interfug stamp_final_6er_a4.svg diff --git a/img/raw/schema.png b/public/img/raw/schema.png similarity index 100% rename from img/raw/schema.png rename to public/img/raw/schema.png diff --git a/img/raw/schema.svg b/public/img/raw/schema.svg similarity index 100% rename from img/raw/schema.svg rename to public/img/raw/schema.svg diff --git a/img/raw/schema.xcf b/public/img/raw/schema.xcf similarity index 100% rename from img/raw/schema.xcf rename to public/img/raw/schema.xcf diff --git a/img/raw/texture.svg b/public/img/raw/texture.svg similarity index 100% rename from img/raw/texture.svg rename to public/img/raw/texture.svg diff --git a/img/texture_blue.png b/public/img/texture_blue.png similarity index 100% rename from img/texture_blue.png rename to public/img/texture_blue.png diff --git a/img/texture_green.png b/public/img/texture_green.png similarity index 100% rename from img/texture_green.png rename to public/img/texture_green.png diff --git a/img/texture_red.png b/public/img/texture_red.png similarity index 100% rename from img/texture_red.png rename to public/img/texture_red.png diff --git a/misc/ocr_a_regular.ttf b/public/misc/ocr_a_regular.ttf similarity index 100% rename from misc/ocr_a_regular.ttf rename to public/misc/ocr_a_regular.ttf diff --git a/style/style.css.php b/public/style/style.css similarity index 81% rename from style/style.css.php rename to public/style/style.css index 9d385c6..6ebdd3e 100644 --- a/style/style.css.php +++ b/public/style/style.css @@ -1,24 +1,3 @@ -"red","rgb"=>"#e30613"), -Array("name"=>"green","rgb"=>"#3aaa35"), -Array("name"=>"blue","rgb"=>"#009fe3") -); -/* - * -.yellow{ -color:#ffde00; -} - * - */ - $color=$colors[rand(0, 2)]; -?> - @charset 'UTF-8'; /*********************************************************************************/ @@ -133,14 +112,14 @@ color:#ffde00; #marx{ min-width:130px; width:*; - background: url("/img/marx_.png") no-repeat right; + background: url("/img/marx_blue.png") no-repeat right; background-size:cover; } #line{ min-width:130px; width:*; - background: url("/img/line_.png") right; + background: url("/img/line_blue.png") right; background-size:contain; } @@ -149,8 +128,8 @@ color:#ffde00; width:700px; height: 100vh; min-width:500px; - border-right: 4px solid ; - border-left: 4px solid ; + border-right: 4px solid #009fe3; + border-left: 4px solid #009fe3; position: relative; } @@ -211,7 +190,7 @@ color:#ffde00; #nav li, header { - border: 4px solid ; + border: 4px solid #009fe3; background: white; margin-bottom:12px; padding:4px; @@ -225,7 +204,7 @@ color:#ffde00; #nav a span { /*text-transform:*/ - background:url("/img/texture_.png") no-repeat right bottom; + background:url("/img/texture_blue.png") no-repeat right bottom; background-size:70%; font-family:'OCR'; display: inline-block; diff --git a/t/001_base.t b/t/001_base.t new file mode 100644 index 0000000..0330a69 --- /dev/null +++ b/t/001_base.t @@ -0,0 +1,5 @@ +use strict; +use warnings; + +use Test::More tests => 1; +use_ok 'ChaosChemnitz::Interfug15::Webseite'; diff --git a/t/002_index_route.t b/t/002_index_route.t new file mode 100644 index 0000000..3006c66 --- /dev/null +++ b/t/002_index_route.t @@ -0,0 +1,15 @@ +use strict; +use warnings; + +use ChaosChemnitz::Interfug15::Webseite; +use Test::More tests => 2; +use Plack::Test; +use HTTP::Request::Common; + +my $app = ChaosChemnitz::Interfug15::Webseite->to_app; +is( ref $app, 'CODE', 'Got app' ); + +my $test = Plack::Test->create($app); +my $res = $test->request( GET '/' ); + +ok( $res->is_success, '[GET /] successful' ); diff --git a/text/anreise.html b/views/anreise.tt similarity index 100% rename from text/anreise.html rename to views/anreise.tt diff --git a/text/cfp.html b/views/cfp.tt similarity index 100% rename from text/cfp.html rename to views/cfp.tt diff --git a/text/home.html b/views/home.tt similarity index 100% rename from text/home.html rename to views/home.tt diff --git a/text/kontakt.html b/views/kontakt.tt similarity index 100% rename from text/kontakt.html rename to views/kontakt.tt diff --git a/views/layouts/main.tt b/views/layouts/main.tt new file mode 100644 index 0000000..7832e88 --- /dev/null +++ b/views/layouts/main.tt @@ -0,0 +1,43 @@ + + + + INTERFUG #1//2015 + + + + + + + + + + + + +
+ + +
+ +
+
+ + + diff --git a/text/tickets.html b/views/tickets.tt similarity index 100% rename from text/tickets.html rename to views/tickets.tt