11
0
Fork 0
mirror of https://github.com/ChaosChemnitz/interfug15 synced 2025-06-28 13:36:07 +02:00

Auf Perl/Dancer2 umgebaut

Die zufälligen Farben sind dabei verloren gegangen - wenn ihr die
wirklich wollt, bau ich sie wieder ein.
This commit is contained in:
Moritz Grosch 2015-06-22 13:23:18 +02:00
parent cb501a7fbd
commit 1d19edc231
38 changed files with 274 additions and 126 deletions

View file

@ -1,19 +0,0 @@
<IfModule mod_rewrite.c>
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]
</IfModule>
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>

23
MANIFEST Normal file
View file

@ -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

17
MANIFEST.SKIP Normal file
View file

@ -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\/
^.-

26
Makefile.PL Normal file
View file

@ -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 <youremail@example.com>},
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-*' },
);

9
bin/app.psgi Executable file
View file

@ -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;

10
config.yml Normal file
View file

@ -0,0 +1,10 @@
appname: "ChaosChemnitz::Interfug15::Webseite"
layout: "main"
charset: "UTF-8"
template: "template_toolkit"
engines:
template:
template_toolkit:
start_tag: '<%'
end_tag: '%>'

11
cpanfile Normal file
View file

@ -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";
};

View file

@ -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

View file

@ -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

View file

@ -1,80 +0,0 @@
<?php
header("Cache-Control: no-cache, must-revalidate"); //HTTP 1.1
header("Pragma: no-cache"); //HTTP 1.0
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
$pageId=isset($_GET["page"])?$_GET["page"]:"home";
$pages=Array(
Array("name"=>"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")
);
?>
<!DOCTYPE html>
<html>
<head>
<title>INTERFUG #1//2015</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<link rel="shortcut icon" type="image/png" href="/img/icon.png">
<link rel="stylesheet" type="text/css" href="/css/style.css">
</head>
<body>
<table id="container" border="0" cellpadding="0" cellspacing="0">
<tr><td id="marx"></td>
<td id="main">
<header id="header">
<h1>INTERFUG #1//2015</h1>
</header>
<nav id="nav">
<ul>
<?php
foreach($pages as $p)
echo "<li><a href=\"".$p["url"]."\"".($pageId==$p["name"]?" class=\"active\"":"")."><span>".$p["title"]."</span></a></li>\n";
?>
</ul>
</nav>
<div>
<article>
<?php
/*<p>id: <?php echo $pageId; ?></p>*/
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;
}
?>
<footer id="footer" class="box" style="color:#C0C0C0">
<ul class="links">
<li><a href="https://chaoschemnitz.de/ChaosChemnitz:Impressum">Impressum</a></li>
<li>Design by ... + <a href="https://jdi.li/">/jdi/</a>.</li>
</ul>
</footer>
</article>
</div>
</td><td id="line"></td>
</tr>
</table>
</body>
</html>

View file

@ -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;

18
public/404.html Normal file
View file

@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Error 404</title>
<link rel="stylesheet" href="/css/error.css" />
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
</head>
<body>
<h1>Error 404</h1>
<div id="content">
<h2>Page Not Found</h2><p>Sorry, this is the void.</p>
</div>
<div id="footer">
Powered by <a href="http://perldancer.org/">Dancer2</a>.
</div>
</body>
</html>

18
public/500.html Normal file
View file

@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Error 500</title>
<link rel="stylesheet" href="/css/error.css" />
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
</head>
<body>
<h1>Error 500</h1>
<div id="content">
<h2>Internal Server Error</h2><p>Wooops, something went wrong</p>
</div>
<div id="footer">
Powered by <a href="http://perldancer.org/">Dancer2</a>.
</div>
</body>
</html>

View file

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 132 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 224 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 224 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 241 B

After

Width:  |  Height:  |  Size: 241 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 154 KiB

After

Width:  |  Height:  |  Size: 154 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 528 KiB

After

Width:  |  Height:  |  Size: 528 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 581 KiB

After

Width:  |  Height:  |  Size: 581 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 482 KiB

After

Width:  |  Height:  |  Size: 482 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Before After
Before After

View file

@ -1,24 +1,3 @@
<?php
//header("Cache-Control: no-cache, must-revalidate"); //HTTP 1.1
//header("Pragma: no-cache"); //HTTP 1.0
header("Expires: ".gmdate("D, d M Y H:i:s", time() + 180) ." GMT"); // Date in the past
header('Content-type: text/css');
$colors = Array(
Array("name"=>"red","rgb"=>"#e30613"),
Array("name"=>"green","rgb"=>"#3aaa35"),
Array("name"=>"blue","rgb"=>"#009fe3")
);
/*
*
.yellow{
color:#ffde00;
}
*
*/
$color=$colors[rand(0, 2)];
?>
@charset 'UTF-8'; @charset 'UTF-8';
/*********************************************************************************/ /*********************************************************************************/
@ -133,14 +112,14 @@ color:#ffde00;
#marx{ #marx{
min-width:130px; min-width:130px;
width:*; width:*;
background: url("/img/marx_<?php echo $color["name"]; ?>.png") no-repeat right; background: url("/img/marx_blue.png") no-repeat right;
background-size:cover; background-size:cover;
} }
#line{ #line{
min-width:130px; min-width:130px;
width:*; width:*;
background: url("/img/line_<?php echo $color["name"]; ?>.png") right; background: url("/img/line_blue.png") right;
background-size:contain; background-size:contain;
} }
@ -149,8 +128,8 @@ color:#ffde00;
width:700px; width:700px;
height: 100vh; height: 100vh;
min-width:500px; min-width:500px;
border-right: 4px solid <?php echo $color["rgb"]; ?>; border-right: 4px solid #009fe3;
border-left: 4px solid <?php echo $color["rgb"]; ?>; border-left: 4px solid #009fe3;
position: relative; position: relative;
} }
@ -211,7 +190,7 @@ color:#ffde00;
#nav li, header #nav li, header
{ {
border: 4px solid <?php echo $color["rgb"]; ?>; border: 4px solid #009fe3;
background: white; background: white;
margin-bottom:12px; margin-bottom:12px;
padding:4px; padding:4px;
@ -225,7 +204,7 @@ color:#ffde00;
#nav a span #nav a span
{ {
/*text-transform:*/ /*text-transform:*/
background:url("/img/texture_<?php echo $color["name"]; ?>.png") no-repeat right bottom; background:url("/img/texture_blue.png") no-repeat right bottom;
background-size:70%; background-size:70%;
font-family:'OCR'; font-family:'OCR';
display: inline-block; display: inline-block;

5
t/001_base.t Normal file
View file

@ -0,0 +1,5 @@
use strict;
use warnings;
use Test::More tests => 1;
use_ok 'ChaosChemnitz::Interfug15::Webseite';

15
t/002_index_route.t Normal file
View file

@ -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' );

43
views/layouts/main.tt Normal file
View file

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html>
<head>
<title>INTERFUG #1//2015</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<link rel="shortcut icon" type="image/png" href="/img/icon.png">
<link rel="stylesheet" type="text/css" href="/style/style.css">
</head>
<body>
<table id="container" border="0" cellpadding="0" cellspacing="0">
<tr><td id="marx"></td>
<td id="main">
<header id="header">
<h1>INTERFUG #1//2015</h1>
</header>
<nav id="nav">
<ul>
<% FOREACH page IN pages %>
<li><a href="<% page.url %>" <% IF page.url == request.path %>class="active"<% END %>><span><% page.name %></span></a></li>
<% END %>
</ul>
</nav>
<div>
<article>
<% content %>
<footer id="footer" class="box" style="color:#C0C0C0">
<ul class="links">
<li><a href="https://chaoschemnitz.de/ChaosChemnitz:Impressum">Impressum</a></li>
<li>Design by ... + <a href="https://jdi.li/">/jdi/</a>.</li>
<li>Perl application by <a href="https://lf-net.org/~littlefox/">LittleFox</a>.</li>
</ul>
</footer>
</article>
</div>
</td><td id="line"></td>
</tr>
</table>
</body>
</html>