Commit d4f6d577 authored by Hermann Mayer's avatar Hermann Mayer

Added RSS format template for blog/article show. (Activity Feeds, eg. Comments).

parent 51a953da
......@@ -25,7 +25,7 @@ class BlogController extends Controller
* @access public
* @return void
*/
public function showAction($slug)
public function showAction($slug, $_format)
{
// Get Entity Manager
$em = $this->getDoctrine()->getEntityManager();
......@@ -41,7 +41,7 @@ class BlogController extends Controller
}
// Return the rendered result
return $this->render('JityHomepageBundle:Blog:show.html.twig', array(
return $this->render('JityHomepageBundle:Blog:show_article.' . $_format . '.twig', array(
'article' => $article
));
}
......
......@@ -26,7 +26,31 @@ class Load05SectionData extends AbstractFixture implements OrderedFixtureInterfa
* @return void
*/
public function load(ObjectManager $manager)
{
{
// Build Quick Operations Section
$quickOperationsPage = new Section();
$quickOperationsPage
->setGroup($this->getReference('author-group'))
->setTitle('Quick Operations')
->setContent('<p>
Als Administrator oder Autor bietet Ihnen diese Sektion
Mittel um die aktuelle Seite zu verändern.
</p>
<p>
<a href="{{ path(\'author_page_edit\', { \'id\': page.id }) }}" class="btn btn-danger" title="Seite bearbeiten">
<img src="{{ asset("bundles/jityhomepage/img/glyphicons_030_pencil.png") }}" />
</a>
<a href="{{ path(\'author_page_new\') }}" class="btn btn-danger" title="Neue Seite anlegen">
<img src="{{ asset("bundles/jityhomepage/img/glyphicons_036_file.png") }}" />
</a>
</p>')
->addSidebar($this->getReference('default-sidebar'))
;
/*
* --------------------------------------------------------------------
*/
// Build Share Section
$share = new Section();
$share
......@@ -55,21 +79,18 @@ Freunden und Bekannten über Googles Soziales Netzwerk oder über Facebook.
*/
// Build Favorites Section
$favorites = new Section();
$favorites
$follow = new Section();
$follow
->setGroup($this->getReference('anonymous-group'))
->setTitle('Favoriten')
->setTitle('Folgen')
->setContent('<p>
Indem Sie diese Seite zu ihren permanenten Favoriten hinzufügen,
können Sie diese unabhängig von Gerät oder Browser abrufen. Dazu
werden Favoriten für Sie in der Applikation gespeichert.
Sie können den Aktivitäten dieses Artikels, mittels RSS Feed, folgen.
</p>
<p>
<a href="{{ path(\'page\') }}" class="btn btn-danger" title="Zu den Favoriten hinzufügen">
<img src="{{ asset("bundles/jityhomepage/img/glyphicons_012_heart_plus.png") }}" />
<a href="{{ app.request.uri }}.rss" class="btn btn-danger" title="RSS Feed abonnieren">
<img src="{{ asset("bundles/jityhomepage/img/glyphicons_397_rss.png") }}" />
</a>
</p>')
->addSidebar($this->getReference('default-sidebar'))
->addSidebar($this->getReference('blog-sidebar'))
;
......@@ -77,24 +98,23 @@ werden Favoriten für Sie in der Applikation gespeichert.
* --------------------------------------------------------------------
*/
// Build Quick Operations Section
$quickOperationsPage = new Section();
$quickOperationsPage
->setGroup($this->getReference('author-group'))
->setTitle('Quick Operations')
// Build Favorites Section
$favorites = new Section();
$favorites
->setGroup($this->getReference('anonymous-group'))
->setTitle('Merken')
->setContent('<p>
Als Administrator oder Autor bietet Ihnen diese Sektion
Mittel um die aktuelle Seite zu verändern.
Indem Sie diese Seite zu ihren permanenten Favoriten hinzufügen,
können Sie diese unabhängig von Gerät oder Browser abrufen. Dazu
werden Favoriten für Sie in der Applikation gespeichert.
</p>
<p>
<a href="{{ path(\'author_page_edit\', { \'id\': page.id }) }}" class="btn btn-danger" title="Seite bearbeiten">
<img src="{{ asset("bundles/jityhomepage/img/glyphicons_030_pencil.png") }}" />
</a>
<a href="{{ path(\'author_page_new\') }}" class="btn btn-danger" title="Neue Seite anlegen">
<img src="{{ asset("bundles/jityhomepage/img/glyphicons_036_file.png") }}" />
<a href="{{ path(\'page\') }}" class="btn btn-danger" title="Zu den Favoriten hinzufügen">
<img src="{{ asset("bundles/jityhomepage/img/glyphicons_012_heart_plus.png") }}" />
</a>
</p>')
->addSidebar($this->getReference('default-sidebar'))
->addSidebar($this->getReference('blog-sidebar'))
;
/*
......@@ -139,16 +159,18 @@ Mittel um den aktuellen Artikel zu verändern.
*/
// Save all Metadata
$manager->persist($share);
$manager->persist($favorites);
$manager->persist($quickOperationsPage);
$manager->persist($quickOperationsArticle);
$manager->persist($share);
$manager->persist($follow);
$manager->persist($favorites);
$manager->persist($archiv);
// Flush to Database
$manager->flush();
$this->addReference('share-section', $share);
$this->addReference('follow-section', $share);
$this->addReference('favorites-section', $favorites);
$this->addReference('quickOperationsPage-section', $quickOperationsPage);
$this->addReference('quickOperationsArticle-section', $quickOperationsArticle);
......
......@@ -30,7 +30,7 @@ class OAuthUserProvider implements OAuthAwareUserProviderInterface
*/
public function __construct(EntityManager $em, $session)
{
$this->em = $em;
$this->em = $em;
$this->session = $session;
}
......
......@@ -9,6 +9,14 @@ hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /connect
hwi_oauth_connect:
resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
prefix: /connect
hwi_oauth_login:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /connect
google_login:
pattern: /login/check/google
......
article:
pattern: /{slug}
defaults: { _controller: JityHomepageBundle:Blog:show }
pattern: /{slug}.{_format}
defaults: { _controller: JityHomepageBundle:Blog:show, _format: html }
requirements:
_format: html|rss
article_comment_create:
pattern: /comment/{id}/create
......
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:atom="http://www.w3.org/2005/Atom"
version="2.0">
<channel>
{% set host = app.request.scheme ~ '://' ~ app.request.httpHost %}
<title>{{ article.title }} - Aktivitäten</title>
<link>{{ host }}</link>
<description>Aktivitäten in Bezug auf {{ article.title }}</description>
<language>de-de</language>
<pubDate>{{ article.createdAt|date('r') }}</pubDate>
<image>
<url>{{ host ~ asset('apple-touch-icon.png') }}</url>
<title>{{ host|capitalize }}</title>
<link>{{ host }}</link>
</image>
{% if article.comments %}
{% set url = url('article', {slug: article.slug}) %}
{% for comment in article.comments %}
{% set author = "Anonymous" %}
{% set authorEmail = "" %}
{% set authorAvatar = "" %}
{% if comment.author %}
{% set author = comment.author.firstName ~ " " ~ comment.author.lastName %}
{% set authorEmail = ", " ~ comment.author.email %}
{% set authorAvatar = comment.author.picture %}
{% endif %}
<item>
<title>{{ author }} hat einen Kommentar verfasst</title>
<description>{{ comment.content }}</description>
<content:encoded>
<![CDATA[
<img src="{{ authorAvatar }}" width="100" height="100" vspace="3" hspace="8" align="left"/>
{{ comment.content }}
]]>
</content:encoded>
<link>{{ url }}#comment-{{ comment.id }}</link>
<author>{{ author }}{{ authorEmail }}</author>
<guid>a{{ article.id }}c{{ comment.id }}</guid>
<pubDate>{{ comment.createdAt|date('r') }}</pubDate>
</item>
{% endfor %}
{% else %}
{% endif %}
</channel>
</rss>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment