Removed the Acme bundle

This commit is contained in:
Polonkai Gergely 2012-07-03 16:58:35 +02:00
parent 1af3a30c2a
commit 8b0e8e1a29
27 changed files with 0 additions and 834 deletions

View File

@ -1,9 +0,0 @@
<?php
namespace Acme\DemoBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class AcmeDemoBundle extends Bundle
{
}

View File

@ -1,57 +0,0 @@
<?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());
}
}

View File

@ -1,69 +0,0 @@
<?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);
}
}

View File

@ -1,18 +0,0 @@
<?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');
}
}

View File

@ -1,22 +0,0 @@
<?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';
}
}

View File

@ -1,25 +0,0 @@
<?php
namespace Acme\DemoBundle\EventListener;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Acme\DemoBundle\Twig\Extension\DemoExtension;
class ControllerListener
{
protected $extension;
public function __construct(DemoExtension $extension)
{
$this->extension = $extension;
}
public function onKernelController(FilterControllerEvent $event)
{
if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
$this->extension->setController($event->getController());
}
}
}

View File

@ -1,20 +0,0 @@
<?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';
}
}

View File

@ -1,18 +0,0 @@
<?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>

View File

@ -1,294 +0,0 @@
/*
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;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 737 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -1,15 +0,0 @@
{% extends "AcmeDemoBundle::layout.html.twig" %}
{% block title "Symfony - Contact form" %}
{% block content %}
<form action="{{ path('_demo_contact') }}" method="POST" id="contact_form">
{{ form_errors(form) }}
{{ form_row(form.email) }}
{{ form_row(form.message) }}
{{ form_rest(form) }}
<input type="submit" value="Send" class="symfony-button-grey" />
</form>
{% endblock %}

View File

@ -1,9 +0,0 @@
{% extends "AcmeDemoBundle::layout.html.twig" %}
{% block title "Hello " ~ name %}
{% block content %}
<h1>Hello {{ name }}!</h1>
{% endblock %}
{% set code = code(_self) %}

View File

@ -1,14 +0,0 @@
{% extends "AcmeDemoBundle::layout.html.twig" %}
{% block title "Symfony - Demos" %}
{% block content_header '' %}
{% block content %}
<h1>Available demos</h1>
<ul id="demo-list">
<li><a href="{{ path('_demo_hello', {'name': 'World'}) }}">Hello World</a></li>
<li><a href="{{ path('_demo_secured_hello', {'name': 'World'}) }}">Access the secured area</a> <a href="{{ path('_demo_login') }}">Go to the login page</a></li>
{# <li><a href="{{ path('_demo_contact') }}">Send a Message</a></li> #}
</ul>
{% endblock %}

View File

@ -1,11 +0,0 @@
{% extends "AcmeDemoBundle:Secured:layout.html.twig" %}
{% block title "Hello " ~ name %}
{% block content %}
<h1>Hello {{ name }}!</h1>
<a href="{{ path('_demo_secured_hello_admin', { 'name': name }) }}">Hello resource secured for <strong>admin</strong> only.</a>
{% endblock %}
{% set code = code(_self) %}

View File

@ -1,9 +0,0 @@
{% extends "AcmeDemoBundle:Secured:layout.html.twig" %}
{% block title "Hello " ~ name %}
{% block content %}
<h1>Hello {{ name }} secured for Admins only!</h1>
{% endblock %}
{% set code = code(_self) %}

View File

@ -1,6 +0,0 @@
{% extends "AcmeDemoBundle::layout.html.twig" %}
{% block content_header_more %}
{{ parent() }}
<li>logged in as <strong>{{ app.user ? app.user.username : 'Anonymous' }}</strong> - <a href="{{ path('_demo_logout') }}">Logout</a></li>
{% endblock %}

View File

@ -1,29 +0,0 @@
{% extends 'AcmeDemoBundle::layout.html.twig' %}
{% block content %}
<h1>Login</h1>
<p>
Choose between two default users: <em>user/userpass</em> <small>(ROLE_USER)</small> or <em>admin/adminpass</em> <small>(ROLE_ADMIN)</small>
</p>
{% if error %}
<div class="error">{{ error.message }}</div>
{% endif %}
<form action="{{ path("_security_check") }}" method="post" id="login">
<div>
<label for="username">Username</label>
<input type="text" id="username" name="_username" value="{{ last_username }}" />
</div>
<div>
<label for="password">Password</label>
<input type="password" id="password" name="_password" />
</div>
<input type="submit" class="symfony-button-grey" value="LOGIN" />
</form>
{% endblock %}
{% set code = code(_self) %}

View File

@ -1,63 +0,0 @@
{% extends 'AcmeDemoBundle::layout.html.twig' %}
{% block title %}Symfony - Welcome{% endblock %}
{% block content_header '' %}
{% block content %}
<h1>Welcome!</h1>
<p>Congratulations! You have successfully installed a new Symfony application.</p>
<div class="symfony-blocks-welcome">
<div class="block-quick-tour">
<div class="illustration">
<img src="{{ asset('bundles/acmedemo/images/welcome-quick-tour.gif') }}" alt="Quick tour" />
</div>
<a class="symfony-button-green" href="http://symfony.com/doc/current/quick_tour/index.html">Read the Quick Tour</a>
</div>
{% if app.environment == 'dev' %}
<div class="block-configure">
<div class="illustration">
<img src="{{ asset('bundles/acmedemo/images/welcome-configure.gif') }}" alt="Configure your application" />
</div>
<a class="symfony-button-green" href="{{ path('_configurator_home') }}">Configure</a>
</div>
{% endif %}
<div class="block-demo">
<div class="illustration">
<img src="{{ asset('bundles/acmedemo/images/welcome-demo.gif') }}" alt="Demo" />
</div>
<a class="symfony-button-green" href="{{ path('_demo') }}">Run The Demo</a>
</div>
</div>
<div class="symfony-blocks-help">
<div class="block-documentation">
<ul>
<li><strong>Documentation</strong></li>
<li><a href="http://symfony.com/doc/current/book/index.html">The Book</a></li>
<li><a href="http://symfony.com/doc/current/cookbook/index.html">The Cookbook</a></li>
<li><a href="http://symfony.com/doc/current/components/index.html">The Components</a></li>
<li><a href="http://symfony.com/doc/current/reference/index.html">Reference</a></li>
<li><a href="http://symfony.com/doc/current/glossary.html">Glossary</a></li>
</ul>
</div>
<div class="block-documentation-more">
<ul>
<li><strong>Sensio</strong></li>
<li><a href="http://trainings.sensiolabs.com">Trainings</a></li>
<li><a href="http://books.sensiolabs.com">Books</a></li>
</ul>
</div>
<div class="block-community">
<ul>
<li><strong>Community</strong></li>
<li><a href="http://symfony.com/irc">IRC channel</a></li>
<li><a href="http://symfony.com/mailing-lists">Mailing lists</a></li>
<li><a href="http://forum.symfony-project.org">Forum</a></li>
<li><a href="http://symfony.com/doc/current/contributing/index.html">Contributing</a></li>
</ul>
</div>
</div>
{% endblock %}

View File

@ -1,49 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>{% block title %}Demo Bundle{% endblock %}</title>
<link rel="icon" sizes="16x16" href="{{ asset('favicon.ico') }}" />
<link rel="stylesheet" href="{{ asset('bundles/acmedemo/css/demo.css') }}" />
</head>
<body>
<div id="symfony-wrapper">
<div id="symfony-header">
<a href="{{ path('_welcome') }}">
<img src="{{ asset('bundles/acmedemo/images/logo.gif') }}" alt="Symfony logo" />
</a>
<form id="symfony-search" method="GET" action="http://symfony.com/search">
<label for="symfony-search-field"><span>Search on Symfony Website</span></label>
<input name="q" id="symfony-search-field" type="search" placeholder="Search on Symfony website" class="medium_txt" />
<input type="submit" class="symfony-button-grey" value="OK" />
</form>
</div>
{% for flashMessage in app.session.flashbag.get('notice') %}
<div class="flash-message">
<em>Notice</em>: {{ flashMessage }}
</div>
{% endfor %}
{% block content_header %}
<ul id="menu">
{% block content_header_more %}
<li><a href="{{ path('_demo') }}">Demo Home</a></li>
{% endblock %}
</ul>
<div style="clear: both"></div>
{% endblock %}
<div class="symfony-content">
{% block content %}
{% endblock %}
</div>
{% if code is defined %}
<h2>Code behind this page</h2>
<div class="symfony-content">{{ code|raw }}</div>
{% endif %}
</div>
</body>
</html>

View File

@ -1,17 +0,0 @@
<?php
namespace Acme\DemoBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class DemoControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();
$crawler = $client->request('GET', '/demo/hello/Fabien');
$this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0);
}
}

View File

@ -1,80 +0,0 @@
<?php
namespace Acme\DemoBundle\Twig\Extension;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Bundle\TwigBundle\Loader\FilesystemLoader;
use CG\Core\ClassUtils;
class DemoExtension extends \Twig_Extension
{
protected $loader;
protected $controller;
public function __construct(FilesystemLoader $loader)
{
$this->loader = $loader;
}
public function setController($controller)
{
$this->controller = $controller;
}
/**
* {@inheritdoc}
*/
public function getFunctions()
{
return array(
'code' => new \Twig_Function_Method($this, 'getCode', array('is_safe' => array('html'))),
);
}
public function getCode($template)
{
$controller = htmlspecialchars($this->getControllerCode(), ENT_QUOTES, 'UTF-8');
$template = htmlspecialchars($this->getTemplateCode($template), ENT_QUOTES, 'UTF-8');
// remove the code block
$template = str_replace('{% set code = code(_self) %}', '', $template);
return <<<EOF
<p><strong>Controller Code</strong></p>
<pre>$controller</pre>
<p><strong>Template Code</strong></p>
<pre>$template</pre>
EOF;
}
protected function getControllerCode()
{
$class = get_class($this->controller[0]);
if (class_exists('CG\Core\ClassUtils')) {
$class = ClassUtils::getUserClass($class);
}
$r = new \ReflectionClass($class);
$m = $r->getMethod($this->controller[1]);
$code = file($r->getFilename());
return ' '.$m->getDocComment()."\n".implode('', array_slice($code, $m->getStartline() - 1, $m->getEndLine() - $m->getStartline() + 1));
}
protected function getTemplateCode($template)
{
return $this->loader->getSource($template->getTemplateName());
}
/**
* Returns the name of the extension.
*
* @return string The extension name
*/
public function getName()
{
return 'demo';
}
}