Commit 950aa60f authored by Hermann Mayer's avatar Hermann Mayer

Removed AcmeBundle. Upgraded Application to Symfony 2.1. Added a EventListener…

Removed AcmeBundle. Upgraded Application to Symfony 2.1. Added a EventListener Class to HomepageBundle. Many Code Cleanups.
parent 71b9426d
......@@ -24,7 +24,6 @@ class AppKernel extends Kernel
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
......
......@@ -110,80 +110,91 @@
<div class="container">
<div class="row">
{% if app.session.hasFlash('notice') %}
<p class="box info">
{{ app.session.flash('notice') }}
</p>
{% endif %}
{% if app.session.hasFlash('success') %}
<p class="box success">
{{ app.session.flash('success') }}
</p>
{% endif %}
{% if app.session.hasFlash('error') %}
<p class="box error">
{{ app.session.flash('error') }}
</p>
{% endif %}
{% block base_content %}{% endblock %}
{% block base_content %}
{% for flashMessage in app.session.flashbag.get('notice') %}
<div class="alert alert-block alert-info fade in">
<button data-dismiss="alert" class="close" type="button">×</button>
<p>
<i class="icon-info-sign icon-white"></i> {{ flashMessage }}
</p>
</div>
{% endfor %}
{% for flashMessage in app.session.flashbag.get('success') %}
<div class="alert alert-block alert-success fade in">
<button data-dismiss="alert" class="close" type="button">×</button>
<p>
<i class="icon-ok-sign icon-white"></i> {{ flashMessage }}
</p>
</div>
{% endfor %}
{% for flashMessage in app.session.flashbag.get('error') %}
<div class="alert alert-block alert-error fade in">
<button data-dismiss="alert" class="close" type="button">×</button>
<p>
<i class="icon-warning-sign icon-white"></i> {{ flashMessage }}
</p>
</div>
{% endfor %}
{% endblock %}
<br>
</div>
</div>
<div class="push"><!--//--></div>
</div>
<div class="push"><!--//--></div>
</div>
<footer>
<div class="container">
<footer>
<div class="container">
<div class="row">
<div class="row">
<div class="span2">
<p class="center"><img src="{{ asset('bundles/jityhomepage/img/signature.png') }}" alt=""></p>
<p class="center"><small >&copy; Hermann Mayer 2012</small></p>
</div>
<div class="span2">
<p class="center"><img src="{{ asset('bundles/jityhomepage/img/signature.png') }}" alt=""></p>
<p class="center"><small >&copy; Hermann Mayer 2012</small></p>
</div>
<div class="span6">
<h5>Über das Projekt</h5>
<p><small>
Diese Website wurde mit <a target="_blank" href="http://symfony.com">Symfony 2</a> und
der <a target="_blank" href="http://twitter.github.com/bootstrap/">Twitter Bootstrap</a> realisiert.
Die Icons wurden zur Verfügung gestellt von <a href="http://glyphicons.com">Glyphicons</a>. Der Quellcode
des Projekts ist Open
Source lizenziert und steht in meinem selbst betriebenen Gitorious zur Verfügung.
Haben Sie fragen, oder Anregungen? Kein Problem &ndash; Nebenstehend finden Sie
weiterführende Verweise zu meinen Kontaktdaten und den Services die ich anbiete.
</small></p>
</div>
<div class="span6">
<h5>Über das Projekt</h5>
<p><small>
Diese Website wurde mit <a target="_blank" href="http://symfony.com">Symfony 2</a> und
der <a target="_blank" href="http://twitter.github.com/bootstrap/">Twitter Bootstrap</a> realisiert.
Die Icons wurden zur Verfügung gestellt von <a href="http://glyphicons.com">Glyphicons</a>. Der Quellcode
des Projekts ist Open
Source lizenziert und steht in meinem selbst betriebenen Gitorious zur Verfügung.
Haben Sie fragen, oder Anregungen? Kein Problem &ndash; Nebenstehend finden Sie
weiterführende Verweise zu meinen Kontaktdaten und den Services die ich anbiete.
</small></p>
</div>
<div class="span3">
<h5>Services und Allgemeines</h5>
<p><small>
Unter anderem biete ich folgende Diensten an:
<a target="_blank" href="http://gitorious.hermann-mayer.net">Gitorious</a>,
<a target="_blank" href="http://projects.hermann-mayer.net/">Chiliprojects</a> und
<a target="_blank" href="http://ebay-tool.hermann-mayer.net/">eBay Tool</a>.
Allgemeine Informationen können Sie aus folgenden Quellen beziehen:
<a target="_blank" href="#">Impressum</a>,
<a target="_blank" href="#">Über mich</a> und
<a target="_blank" href="#">Kontakt</a>.
</small></p>
<div class="span3">
<h5>Services und Allgemeines</h5>
<p><small>
Unter anderem biete ich folgende Diensten an:
<a target="_blank" href="http://gitorious.hermann-mayer.net">Gitorious</a>,
<a target="_blank" href="http://projects.hermann-mayer.net/">Chiliprojects</a> und
<a target="_blank" href="http://ebay-tool.hermann-mayer.net/">eBay Tool</a>.
Allgemeine Informationen können Sie aus folgenden Quellen beziehen:
<a target="_blank" href="#">Impressum</a>,
<a target="_blank" href="#">Über mich</a> und
<a target="_blank" href="#">Kontakt</a>.
</small></p>
</div>
</div>
</div>
</div>
</footer>
{% javascripts
'@JityHomepageBundle/Resources/public/js/*.js'
filter='?closure'
%}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
{% block javascripts %}{% endblock %}
</body>
</footer>
{% javascripts
'@JityHomepageBundle/Resources/public/js/*.js'
filter='?closure'
%}
<script type="text/javascript" src="{{ asset_url }}"></script>
{% endjavascripts %}
{% block javascripts %}{% endblock %}
</body>
</html>
......@@ -24,3 +24,4 @@ assetic:
swiftmailer:
delivery_address: hermann.mayer92@gmail.com
......@@ -25,3 +25,4 @@ assetic:
jar: %kernel.root_dir%/java/compiler.jar
yui_css:
jar: %kernel.root_dir%/java/yuicompressor-2.4.7.jar
<?php
namespace Acme\DemoBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class AcmeDemoBundle extends Bundle
{
}
<?php
namespace Acme\DemoBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Acme\DemoBundle\Form\ContactType;
// these import the "@Route" and "@Template" annotations
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
class DemoController extends Controller
{
/**
* @Route("/", name="_demo")
* @Template()
*/
public function indexAction()
{
return array();
}
/**
* @Route("/hello/{name}", name="_demo_hello")
* @Template()
*/
public function helloAction($name)
{
return array('name' => $name);
}
/**
* @Route("/contact", name="_demo_contact")
* @Template()
*/
public function contactAction()
{
$form = $this->get('form.factory')->create(new ContactType());
$request = $this->get('request');
if ('POST' == $request->getMethod()) {
$form->bindRequest($request);
if ($form->isValid()) {
$mailer = $this->get('mailer');
// .. setup a message and send it
// http://symfony.com/doc/current/cookbook/email.html
$this->get('session')->setFlash('notice', 'Message sent!');
return new RedirectResponse($this->generateUrl('_demo'));
}
}
return array('form' => $form->createView());
}
}
<?php
namespace Acme\DemoBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Security\Core\SecurityContext;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use JMS\SecurityExtraBundle\Annotation\Secure;
/**
* @Route("/demo/secured")
*/
class SecuredController extends Controller
{
/**
* @Route("/login", name="_demo_login")
* @Template()
*/
public function loginAction()
{
if ($this->get('request')->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
$error = $this->get('request')->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
} else {
$error = $this->get('request')->getSession()->get(SecurityContext::AUTHENTICATION_ERROR);
}
return array(
'last_username' => $this->get('request')->getSession()->get(SecurityContext::LAST_USERNAME),
'error' => $error,
);
}
/**
* @Route("/login_check", name="_security_check")
*/
public function securityCheckAction()
{
// The security layer will intercept this request
}
/**
* @Route("/logout", name="_demo_logout")
*/
public function logoutAction()
{
// The security layer will intercept this request
}
/**
* @Route("/hello", defaults={"name"="World"}),
* @Route("/hello/{name}", name="_demo_secured_hello")
* @Template()
*/
public function helloAction($name)
{
return array('name' => $name);
}
/**
* @Route("/hello/admin/{name}", name="_demo_secured_hello_admin")
* @Secure(roles="ROLE_ADMIN")
* @Template()
*/
public function helloadminAction($name)
{
return array('name' => $name);
}
}
<?php
namespace Acme\DemoBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class WelcomeController extends Controller
{
public function indexAction()
{
/*
* The action's view can be rendered using render() method
* or @Template annotation as demonstrated in DemoController.
*
*/
return $this->render('AcmeDemoBundle:Welcome:index.html.twig');
}
}
<?php
namespace Acme\DemoBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\Config\FileLocator;
class AcmeDemoExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.xml');
}
public function getAlias()
{
return 'acme_demo';
}
}
<?php
namespace Acme\DemoBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
class ContactType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('email', 'email');
$builder->add('message', 'textarea');
}
public function getName()
{
return 'contact';
}
}
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="twig.extension.acme.demo" class="Acme\DemoBundle\Twig\Extension\DemoExtension" public="false">
<tag name="twig.extension" />
<argument type="service" id="twig.loader" />
</service>
<service id="acme.demo.listener" class="Acme\DemoBundle\EventListener\ControllerListener">
<tag name="kernel.event_listener" event="kernel.controller" method="onKernelController" />
<argument type="service" id="twig.extension.acme.demo" />
</service>
</services>
</container>
/*
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 2.8.2r1
Reset
*/
html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var,optgroup{font-style:inherit;font-weight:inherit;}del,ins{text-decoration:none;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:baseline;}sub{vertical-align:baseline;}legend{color:#000;}input,button,textarea,select,optgroup,option{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;}input,button,textarea,select{*font-size:100%;}
html, body
{
background-color: #EFEFEF;
}
body
{
font-size: 14px;
font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
color: #313131;
}
a
{
color: #08C;
text-decoration: none;
}
a:hover
{
text-decoration: underline;
}
strong
{
font-weight: bold;
}
em
{
font-style: italic;
}
h1, h2, h3
{
font-family: Georgia, "Times New Roman", Times, serif;
color: #404040;
}
h1
{
font-size: 45px;
padding-bottom: 30px;
}
h2
{
font-weight: bold;
color: #FFFFFF;
/* Font is duplicated of body (sans-serif) */
font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
margin-bottom: 10px;
background-color: #aacd4e;
padding: 2px 4px;
display: inline-block;
text-transform: uppercase;
}
p
{
line-height: 20px;
padding-bottom: 20px;
}
ul#demo-list a
{
background: url(../images/blue-arrow.png) no-repeat right 6px;
padding-right: 10px;
margin-right: 30px;
}
ul, ol
{
padding-left: 20px;
}
li
{
padding-bottom: 18px;
}
ol li
{
list-style-type: decimal;
}
ul li
{
list-style-type: none;
}
#symfony-header
{
position: relative;
padding: 30px 30px 20px 30px;
}
#symfony-wrapper
{
width: 970px;
margin: 0 auto;
}
.symfony-content
{
background-color: white;
border: 1px solid #DFDFDF;
padding: 50px;
-moz-border-radius: 16px;
-webkit-border-radius: 16px;
border-radius: 16px;
margin-bottom: 20px;
word-wrap: break-word;
}
#symfony-search
{
position: absolute;
top: 50px;
right: 30px;
}
#symfony-search input[type="search"]
{
-webkit-appearance: textfield;
}
#symfony-search-field
{
width: 190px;
}
#symfony-search label
{
display: block;
float: left;
width: 20px;
height: 25px;
background: url(../images/search.png) no-repeat left 5px;
}
#symfony-search label span
{
display: none;
}
input[type=text], input[type=password]
{
border: 1px solid #DADADA;
background: white url(../images/field-background.gif) repeat-x left top;
padding: 5px 6px;
color: #565656;
font-family: 'Lucida Sans Unicode', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
.symfony-button-grey,
.symfony-button-green
{
font-size: 0.85em;
font-weight: bold;
cursor: pointer;
display: inline-block;
outline: none;
text-align: center;
text-transform: uppercase;
padding: 3px 10px;
text-shadow: 0 1px 1px rgba(0,0,0,.3);
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.symfony-button-grey
{
color: #868686;
font-weight: normal;
padding: 5px 10px;
border: solid 1px #d7d7d7;
background: #ffffff;
background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#d7d7d7));
background: -moz-linear-gradient(top, #ffffff, #d7d7d7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#d7d7d7');
}
.symfony-button-green
{
padding: 5px 12px;
color: white;
border: solid 1px #a7da39;
background: #a7da39;
background: -webkit-gradient(linear, left top, left bottom, from(#a7da39), to(#6a9211));
background: -moz-linear-gradient(top, #a7da39, #6a9211);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#a7da39', endColorstr='#6a9211');
}
.symfony-blocks-welcome
{
overflow: hidden;
}
.symfony-blocks-welcome > div
{
background-color: whitesmoke;
float: left;
width: 240px;
margin-right: 14px;
text-align: center;
padding: 26px 20px;
}
.symfony-blocks-welcome > div.block-demo
{
margin-right: 0;
}
.symfony-blocks-welcome .illustration
{
padding-bottom: 20px;
}
.symfony-blocks-help
{
overflow: hidden;
}
.symfony-blocks-help
{
margin-top: 30px;
padding: 18px;
border: 1px solid #E6E6E6;
}
.symfony-blocks-help > div
{
width: 254px;
float: left;
}
.flash-message
{
padding: 10px;
margin: 5px;
margin-top: 15px;
background-color: #ffe;
}
.error
{
color: red;
}
#login label, #contact_form label
{
display: block;
float: left;
width: 90px;
}
ul#menu
{
float: right;
margin-bottom: 20px;
padding-left: 0;
}
#menu li
{
padding-left: 0;
margin-right: 10px;
display: inline;
}