echo 'wallabag is now installed';
echo "\r\n";
-echo 'Just execute the following commands for using wallabag:';
+echo 'Just execute `php app/console server:run` for using wallabag:';
echo "\r\n";
-echo 'cd web';
-echo "\r\n";
-echo 'php -S localhost:8000';
\ No newline at end of file
+echo 'http://localhost:8000';
\ No newline at end of file
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+use Symfony\Component\HttpFoundation\Request;
use WallabagBundle\Repository;
+use WallabagBundle\Entity\Entries;
class EntryController extends Controller
{
/**
+ * Shows unread entries for current user
+ *
* @Route("/unread", name="unread")
+ * @return \Symfony\Component\HttpFoundation\Response
*/
public function showUnreadAction()
{
$repository = $this->getDoctrine()->getRepository('WallabagBundle:Entries');
- $entries = $repository->findUnreadByUser(1);
+ $entries = $repository->findUnreadByUser(1, 0);
return $this->render(
'WallabagBundle:Entry:entries.html.twig',
array('entries' => $entries)
);
-
}
/**
+ * Shows read entries for current user
+ *
* @Route("/archive", name="archive")
+ * @return \Symfony\Component\HttpFoundation\Response
*/
public function showArchiveAction()
{
$repository = $this->getDoctrine()->getRepository('WallabagBundle:Entries');
- $entries = $repository->findArchiveByUser(1);
+ $entries = $repository->findArchiveByUser(1, 0);
return $this->render(
'WallabagBundle:Entry:entries.html.twig',
array('entries' => $entries)
);
-
}
/**
+ * Shows starred entries for current user
+ *
* @Route("/starred", name="starred")
+ * @return \Symfony\Component\HttpFoundation\Response
*/
public function showStarredAction()
{
$repository = $this->getDoctrine()->getRepository('WallabagBundle:Entries');
- $entries = $repository->findStarredByUser(1);
+ $entries = $repository->findStarredByUser(1, 0);
return $this->render(
'WallabagBundle:Entry:entries.html.twig',
array('entries' => $entries)
);
-
}
/**
+ * Shows entry content
+ *
+ * @param Entries $entry
* @Route("/view/{id}", requirements={"id" = "\d+"}, name="view")
+ * @return \Symfony\Component\HttpFoundation\Response
*/
- public function viewAction($id)
+ public function viewAction(Entries $entry)
{
- $repository = $this->getDoctrine()->getRepository('WallabagBundle:Entries');
- $entry = $repository->find($id);
-
return $this->render(
'WallabagBundle:Entry:entry.html.twig',
array('entry' => $entry)
);
+ }
+
+ /**
+ * Changes read status for an entry
+ *
+ * @param Request $request
+ * @param Entries $entry
+ * @Route("/archive/{id}", requirements={"id" = "\d+"}, name="archive_entry")
+ * @return \Symfony\Component\HttpFoundation\RedirectResponse
+ */
+ public function toggleArchiveAction(Request $request, Entries $entry)
+ {
+ $entry->toggleArchive();
+ $this->getDoctrine()->getManager()->flush();
+
+ $this->get('session')->getFlashBag()->add(
+ 'notice',
+ 'Entry archived'
+ );
+
+ return $this->redirect($request->headers->get('referer'));
+ }
+
+ /**
+ * Changes favorite status for an entry
+ *
+ * @param Request $request
+ * @param Entries $entry
+ * @Route("/star/{id}", requirements={"id" = "\d+"}, name="star_entry")
+ * @return \Symfony\Component\HttpFoundation\RedirectResponse
+ */
+ public function toggleStarAction(Request $request, Entries $entry)
+ {
+ $entry->toggleStar();
+ $this->getDoctrine()->getManager()->flush();
+
+ $this->get('session')->getFlashBag()->add(
+ 'notice',
+ 'Entry starred'
+ );
+
+ return $this->redirect($request->headers->get('referer'));
+ }
+
+ /**
+ * Deletes entry
+ *
+ * @param Request $request
+ * @param Entries $entry
+ * @Route("/delete/{id}", requirements={"id" = "\d+"}, name="delete_entry")
+ * @return \Symfony\Component\HttpFoundation\RedirectResponse
+ */
+ public function deleteEntryAction(Request $request, Entries $entry)
+ {
+ $em = $this->getDoctrine()->getEntityManager();
+ $em->remove($entry);
+ $em->flush();
+
+ $this->get('session')->getFlashBag()->add(
+ 'notice',
+ 'Entry deleted'
+ );
+ return $this->redirect($request->headers->get('referer'));
}
}
--- /dev/null
+<?php
+
+namespace WallabagBundle\Controller;
+
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
+use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+
+class StaticController extends Controller
+{
+ /**
+ * @Route("/about", name="about")
+ */
+ public function aboutAction()
+ {
+ return $this->render(
+ 'WallabagBundle:Static:about.html.twig',
+ array()
+ );
+ }
+}
return $this->isRead;
}
+ public function toggleArchive()
+ {
+ $this->isRead = $this->getIsRead() ^ 1;
+ return $this;
+ }
+
/**
* Set isFav
*
return $this->isFav;
}
+ public function toggleStar()
+ {
+ $this->isFav = $this->getIsFav() ^ 1;
+
+ return $this;
+ }
+
/**
* Set content
*
use Doctrine\ORM\Query;
use Doctrine\ORM\EntityRepository;
+use Doctrine\ORM\Tools\Pagination\Paginator;
-/**
- * EntriesRepository
- *
- * This class was generated by the Doctrine ORM. Add your own custom
- * repository methods below.
- */
class EntriesRepository extends EntityRepository
{
- public function findUnreadByUser($userId)
+ public function findUnreadByUser($userId, $firstResult, $maxResults = 12)
{
$qb = $this->createQueryBuilder('e')
->select('e')
+ ->setFirstResult($firstResult)
+ ->setMaxResults($maxResults)
->where('e.isRead = 0')
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
- ->getQuery()
- ->getResult(Query::HYDRATE_ARRAY);
+ ->getQuery();
- return $qb;
+ $pag = new Paginator($qb);
+
+ return $pag;
}
- public function findArchiveByUser($userId)
+ public function findArchiveByUser($userId, $firstResult, $maxResults = 12)
{
$qb = $this->createQueryBuilder('e')
->select('e')
+ ->setFirstResult($firstResult)
+ ->setMaxResults($maxResults)
->where('e.isRead = 1')
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
->getQuery()
return $qb;
}
- public function findStarredByUser($userId)
+ public function findStarredByUser($userId, $firstResult, $maxResults = 12)
{
$qb = $this->createQueryBuilder('e')
->select('e')
+ ->setFirstResult($firstResult)
+ ->setMaxResults($maxResults)
->where('e.isFav = 1')
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
->getQuery()
{% endblock %}
{% block content %}
+ {% block pager %}
+ {% if entries is not empty %}
+ <div class="results">
+ <div class="nb-results">{{ entries.count }} {% trans %}entries{% endtrans %}</div>
+ <div class="pagination">
+ {% for p in range(1, entries.count) %}
+ <li>
+ <a href="{{ path(app.request.attributes.get('_route'), {'page': p}) }}">{{ p }}</a>
+ </li>
+ {% endfor %}
+ </div>
+ </div>
+ {% endif %}
+ {% endblock %}
{% if entries is empty %}
<div class="messages warning"><p>{% trans %}No articles found.{% endtrans %}</p></div>
{% endif %}
<ul class="tools links">
- <li><a title="{% trans %}Toggle mark as read{% endtrans %}" class="tool icon-check icon {% if entry.isRead == 0 %}archive-off{% else %}archive{% endif %}" href="./?action=toggle_archive&id={{ entry.id|e }}"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li>
- <li><a title="{% trans %}toggle favorite{% endtrans %}" class="tool icon-star icon {% if entry.isFav == 0 %}fav-off{% else %}fav{% endif %}" href="./?action=toggle_fav&id={{ entry.id|e }}"><span>{% trans %}toggle favorite{% endtrans %}</span></a></li>
- <li><a title="{% trans %}delete{% endtrans %}" class="tool delete icon-trash icon" href="./?action=delete&id={{ entry.id|e }}"><span>{% trans %}delete{% endtrans %}</span></a></li>
+ <li><a title="{% trans %}Toggle mark as read{% endtrans %}" class="tool icon-check icon {% if entry.isRead == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li>
+ <li><a title="{% trans %}toggle favorite{% endtrans %}" class="tool icon-star icon {% if entry.isFav == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{% trans %}toggle favorite{% endtrans %}</span></a></li>
+ <li><a title="{% trans %}delete{% endtrans %}" class="tool delete icon-trash icon" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{% trans %}delete{% endtrans %}</span></a></li>
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon-link icon"><span>{{ entry.url | e | domainName }}</span></a></li>
</ul>
<p>{{ entry.content|striptags|slice(0, 300) }}...</p>
<ul class="links">
<li class="topPosF"><a href="#top" title="{% trans %}Back to top{% endtrans %}" class="tool top icon icon-arrow-up-thick"><span>{% trans %}Back to top{% endtrans %}</span></a></li>
<li><a href="{{ entry.url|e }}" target="_blank" title="{% trans %}original{% endtrans %} : {{ entry.title|e }}" class="tool link icon icon-link"><span>{{ entry.url | e | domainName }}</span></a></li>
- <li><a title="{% trans %}Mark as read{% endtrans %}" class="tool icon icon-check {% if entry.isRead == 0 %}archive-off{% else %}archive{% endif %}" href="javascript: void(null);" id="markAsRead"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li>
- <li><a title="{% trans %}Favorite{% endtrans %}" class="tool icon icon-star {% if entry.isFav == 0 %}fav-off{% else %}fav{% endif %}" href="javascript: void(null);" id="setFav"><span>{% trans %}Toggle favorite{% endtrans %}</span></a></li>
- <li><a title="{% trans %}Delete{% endtrans %}" class="tool delete icon icon-trash" href="./?action=delete&id={{ entry.id|e }}"><span>{% trans %}Delete{% endtrans %}</span></a></li>
+ <li><a title="{% trans %}Mark as read{% endtrans %}" class="tool icon icon-check {% if entry.isRead == 0 %}archive-off{% else %}archive{% endif %}" href="{{ path('archive_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle mark as read{% endtrans %}</span></a></li>
+ <li><a title="{% trans %}Favorite{% endtrans %}" class="tool icon icon-star {% if entry.isFav == 0 %}fav-off{% else %}fav{% endif %}" href="{{ path('star_entry', { 'id': entry.id }) }}"><span>{% trans %}Toggle favorite{% endtrans %}</span></a></li>
+ <li><a title="{% trans %}Delete{% endtrans %}" class="tool delete icon icon-trash" href="{{ path('delete_entry', { 'id': entry.id }) }}"><span>{% trans %}Delete{% endtrans %}</span></a></li>
{% if share_twitter %}<li><a href="https://twitter.com/home?status={{entry.title|url_encode}}%20{{ entry.url|url_encode }}%20via%20@wallabagapp" target="_blank" class="tool twitter icon icon-twitter" title="{% trans %}Tweet{% endtrans %}"><span>{% trans %}Tweet{% endtrans %}</span></a></li>{% endif %}
{% if share_mail %}<li><a href="mailto:?subject={{ entry.title|url_encode }}&body={{ entry.url|url_encode }}%20via%20@wallabagapp" class="tool email icon icon-mail" title="{% trans %}Email{% endtrans %}"><span>{% trans %}Email{% endtrans %}</span></a></li>{% endif %}
{% if share_shaarli %}<li><a href="{{ shaarli_url }}/index.php?post={{ entry.url|url_encode }}&title={{ entry.title|url_encode }}" target="_blank" class="tool shaarli" title="{% trans %}shaarli{% endtrans %}"><span>{% trans %}shaarli{% endtrans %}</span></a></li>{% endif %}
$(document).ready(function() {
// toggle read property of current article
- $('#markAsRead').click(function(){
+ /* $('#markAsRead').click(function(){
$("body").css("cursor", "wait");
- $.ajax( { url: './?action=toggle_archive&id={{ entry.id|e }}' }).done(
+ $.ajax( { url: '{{ path('archive_entry', { 'id': entry.id }) }}' }).done(
function( data ) {
if ( data == '1' ) {
if ( $('#markAsRead').hasClass("archive-off") ) {
}
});
$("body").css("cursor", "auto");
- });
+ });*/
// toggle favorite property of current article
- $('#setFav').click(function(){
+ /* $('#setFav').click(function(){
$("body").css("cursor", "wait");
- $.ajax( { url: './?action=toggle_fav&id={{ entry.id|e }}' }).done(
+ $.ajax( { url: '{{ path('star_entry', { 'id': entry.id }) }}' }).done(
function( data ) {
if ( data == '1' ) {
if ( $('#setFav').hasClass("fav-off") ) {
}
});
$("body").css("cursor", "auto");
- });
+ });*/
$(window).scroll(function(e){
var scrollTop = $(window).scrollTop();
--- /dev/null
+{% extends "WallabagBundle::layout.html.twig" %}
+
+{% block title %}{% trans %}About{% endtrans %}{% endblock %}
+{% block menu %}
+{% include "WallabagBundle::_menu.html.twig" %}
+{% endblock %}
+{% block content %}
+ <h2>{% trans %}About wallabag{% endtrans %}</h2>
+
+ <dl>
+ <dt>{% trans %}Project website{% endtrans %}</dt>
+ <dd><a href="https://www.wallabag.org">https://www.wallabag.org</a></dd>
+
+ <dt>{% trans %}Main developer{% endtrans %}</dt>
+ <dd><a href="mailto:nicolas@loeuillet.org">Nicolas Lœuillet</a> — <a href="http://cdetc.fr">{% trans %}website{% endtrans %}</a></dd>
+
+ <dt>{% trans %}Contributors:{% endtrans %}</dt>
+ <dd><a href="https://github.com/wallabag/wallabag/graphs/contributors">{% trans %}on Github{% endtrans %}</a></dd>
+
+ <dt>{% trans %}Bug reports{% endtrans %}</dt>
+ <dd><a href="https://support.wallabag.org">{% trans %}On our support website{% endtrans %}</a> {% trans %}or{% endtrans %} <a href="https://github.com/wallabag/wallabag/issues">{% trans %}on Github{% endtrans %}</a></dd>
+
+ <dt>{% trans %}License{% endtrans %}</dt>
+ <dd><a href="http://en.wikipedia.org/wiki/MIT_License">MIT</a></dd>
+
+ <dt>{% trans %}Version{% endtrans %}</dt>
+ <dd></dd>
+ </dl>
+
+ <p>{% trans %}wallabag is a read-it-later application: you can save a web page by keeping only content. Elements like ads or menus are deleted.{% endtrans %}</p>
+
+ <h2>{% trans %}Getting help{% endtrans %}</h2>
+
+ <dl>
+ <dt>{% trans %}Documentation{% endtrans %}</dt>
+ <dd><a href="docs/">Offline documentation</a> and <a href="https://doc.wallabag.org/">online documentation</a> (up to date)</dd>
+
+ <dt>{% trans %}Support{% endtrans %}</dt>
+ <dd><a href="http://support.wallabag.org/">http://support.wallabag.org/</a></dd>
+ </dl>
+
+ <h2>{% trans %}Helping wallabag{% endtrans %}</h2>
+
+ <p>{% trans %}wallabag is free and opensource. You can help us:{% endtrans %}</p>
+
+ <dl>
+ <dt><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9UBA65LG3FX9Y&lc=gb">{% trans %}via Paypal{% endtrans %}</a></dt>
+
+ <dt><a href="https://flattr.com/thing/1265480">{% trans %}via Flattr{% endtrans %}</a></dt>
+ </dl>
+
+ <h2>{% trans %}Credits{% endtrans %}</h2>
+ <dl>
+ <dt>PHP Readability</dt>
+ <dd><a href="https://bitbucket.org/fivefilters/php-readability">https://bitbucket.org/fivefilters/php-readability</a></dd>
+
+ <dt>Full Text RSS</dt>
+ <dd><a href="http://code.fivefilters.org/full-text-rss/src">http://code.fivefilters.org/full-text-rss/src</a></dd>
+
+ <dt>logo by Maylis Agniel</dt>
+ <dd><a href="https://github.com/wallabag/logo">https://github.com/wallabag/logo</a></dd>
+
+ <dt>icons</dt>
+ <dd><a href="http://icomoon.io">http://icomoon.io</a></dd>
+
+ <dt>PHP Simple HTML DOM Parser</dt>
+ <dd><a href="http://simplehtmldom.sourceforge.net/">http://simplehtmldom.sourceforge.net/</a></dd>
+
+ <dt>Session</dt>
+ <dd><a href="https://github.com/tontof/kriss_feed/blob/master/src/class/Session.php">https://github.com/tontof/kriss_feed/blob/master/src/class/Session.php</a></dd>
+
+ <dt>Twig</dt>
+ <dd><a href="http://twig.sensiolabs.org">http://twig.sensiolabs.org</a></dd>
+
+ <dt>Flash messages</dt>
+ <dd><a href="https://github.com/plasticbrain/PHP-Flash-Messages">https://github.com/plasticbrain/PHP-Flash-Messages</a></dd>
+
+ <dt>Pagination</dt>
+ <dd><a href="https://github.com/daveismyname/pagination">https://github.com/daveismyname/pagination</a></dd>
+
+ <dt>PHPePub</dt>
+ <dd><a href="https://github.com/Grandt/PHPePub/">https://github.com/Grandt/PHPePub/</a></dd>
+ </dl>
+{% endblock %}
<li><a href="{{ path('archive') }}"}>{% trans %}archive{% endtrans %}</a></li>
<li><a href="./?view=tags">{% trans %}tags{% endtrans %}</a></li>
<li style="position: relative;"><a href="javascript: void(null);" id="bagit">{% trans %}save a link{% endtrans %}</a>
-
+ {% include "WallabagBundle::_save_form.html.twig" %}
</li>
<li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans %}search{% endtrans %}</a>
-
+ {% include "WallabagBundle::_search_form.html.twig" %}
</li>
<li><a href="./?view=config">{% trans %}config{% endtrans %}</a></li>
- <li><a href="./?view=about">{% trans %}about{% endtrans %}</a></li>
+ <li><a href={{ path('about') }}>{% trans %}about{% endtrans %}</a></li>
<li><a class="icon icon-power" href="./?logout" title="{% trans %}logout{% endtrans %}">{% trans %}logout{% endtrans %}</a></li>
</ul>
--- /dev/null
+<div id="bagit-form" class="messages info popup-form">
+ <form method="get" action="index.php" target="_blank" id="bagit-form-form">
+ <h2>{% trans %}Save a link{% endtrans %}</h2>
+ <a href="javascript: void(null);" id="bagit-form-close" class="close-button--popup close-button">×</a>
+ <input type="hidden" name="autoclose" value="1" />
+ <input required placeholder="example.com/article" class="addurl" id="plainurl" name="plainurl" type="url" />
+ <span id="add-link-result"></span>
+ <input type="submit" value="{% trans %}save link!"{% endtrans %} />
+ </form>
+</div>
--- /dev/null
+<div id="search-form" class="messages info popup-form">
+<form method="get" action="index.php">
+ <h2>{% trans %}Search{% endtrans %}</h2>
+ <a href="javascript: void(null);" id="search-form-close" class="close-button--popup close-button">×</a>
+ <input type="hidden" name="view" value="search"></input>
+ <input required placeholder="{% trans %}Enter your search here{% endtrans %}" type="text" name="search" id="searchfield"><br>
+ <input id="submit-search" type="submit" value="{% trans %}Search{% endtrans %}"></input>
+</form>
+</div>
<div id="main">
{% block menu %}{% endblock %}
{% block precontent %}{% endblock %}
- {% block messages %}
- {% include "WallabagBundle::_messages.html.twig" %}
- {% endblock %}
+ {% for flashMessage in app.session.flashbag.get('notice') %}
+ <div class="flash-notice">
+ {{ flashMessage }}
+ </div>
+ {% endfor %}
<div id="content" class="w600p center">
{% block content %}{% endblock %}
</div>