mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-15 18:00:36 +01:00
some parameters, new entry form, etc.
This commit is contained in:
parent
163eae0bb1
commit
b84a80559a
@ -44,6 +44,9 @@ twig:
|
||||
export_epub: %export_epub%
|
||||
export_mobi: %export_mobi%
|
||||
export_pdf: %export_pdf%
|
||||
version: %app.version%
|
||||
paypal_url: "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9UBA65LG3FX9Y&lc=gb"
|
||||
flattr_url: "https://flattr.com/thing/1265480"
|
||||
|
||||
# Assetic Configuration
|
||||
assetic:
|
||||
|
@ -19,4 +19,24 @@ parameters:
|
||||
# A secret key that's used to generate certain security-related tokens
|
||||
secret: ThisTokenIsNotSoSecretChangeIt
|
||||
|
||||
download_pictures: false # if true, pictures will be stored into data/assets for each article
|
||||
# wallabag misc
|
||||
app.version: 2.0.0-alpha
|
||||
|
||||
download_pictures: false # if true, pictures will be stored into data/assets for each article
|
||||
|
||||
# Entry view
|
||||
share_twitter: true
|
||||
share_mail: true
|
||||
share_shaarli: true
|
||||
shaarli_url: http://myshaarli.com
|
||||
share_diaspora: true
|
||||
diaspora_url: http://diasporapod.com
|
||||
flattr: true
|
||||
carrot: true
|
||||
show_printlink: true
|
||||
export_epub: true
|
||||
export_mobi: true
|
||||
export_pdf: true
|
||||
|
||||
# List view
|
||||
items_on_page: 12
|
@ -1,3 +1,7 @@
|
||||
app:
|
||||
resource: @WallabagBundle/Controller/
|
||||
type: annotation
|
||||
|
||||
homepage:
|
||||
pattern: /
|
||||
defaults: { _controller: WallabagBundle:Entry:showUnread }
|
@ -7,9 +7,51 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use WallabagBundle\Repository;
|
||||
use WallabagBundle\Entity\Entries;
|
||||
use Wallabag\Wallabag\Tools;
|
||||
use Wallabag\Wallabag\Url;
|
||||
|
||||
class EntryController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @Route("/new", name="new_entry")
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function addEntryAction(Request $request)
|
||||
{
|
||||
$entry = new Entries();
|
||||
$entry->setUserId(1);
|
||||
|
||||
$form = $this->createFormBuilder($entry)
|
||||
->add('url', 'url')
|
||||
->add('save', 'submit')
|
||||
->getForm();
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isValid()) {
|
||||
|
||||
$content = Tools::getPageContent(new Url($entry->getUrl()));
|
||||
var_dump($content);die;
|
||||
|
||||
$em = $this->getDoctrine()->getEntityManager();
|
||||
$em->persist($entry);
|
||||
$em->flush();
|
||||
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
'notice',
|
||||
'Entry saved'
|
||||
);
|
||||
|
||||
return $this->redirect($this->generateUrl('homepage'));
|
||||
}
|
||||
|
||||
return $this->render('WallabagBundle:Entry:new.html.twig', array(
|
||||
'form' => $form->createView(),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows unread entries for current user
|
||||
*
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace WallabagBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
/**
|
||||
* Entries
|
||||
@ -31,6 +32,7 @@ class Entries
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @Assert\NotBlank()
|
||||
* @ORM\Column(name="url", type="text", nullable=true)
|
||||
*/
|
||||
private $url;
|
||||
|
@ -8,6 +8,14 @@ use Doctrine\ORM\Tools\Pagination\Paginator;
|
||||
|
||||
class EntriesRepository extends EntityRepository
|
||||
{
|
||||
/**
|
||||
* Retrieves unread entries for a user
|
||||
*
|
||||
* @param $userId
|
||||
* @param $firstResult
|
||||
* @param int $maxResults
|
||||
* @return Paginator
|
||||
*/
|
||||
public function findUnreadByUser($userId, $firstResult, $maxResults = 12)
|
||||
{
|
||||
$qb = $this->createQueryBuilder('e')
|
||||
@ -18,11 +26,19 @@ class EntriesRepository extends EntityRepository
|
||||
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
|
||||
->getQuery();
|
||||
|
||||
$pag = new Paginator($qb);
|
||||
$paginator = new Paginator($qb);
|
||||
|
||||
return $pag;
|
||||
return $paginator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves read entries for a user
|
||||
*
|
||||
* @param $userId
|
||||
* @param $firstResult
|
||||
* @param int $maxResults
|
||||
* @return Paginator
|
||||
*/
|
||||
public function findArchiveByUser($userId, $firstResult, $maxResults = 12)
|
||||
{
|
||||
$qb = $this->createQueryBuilder('e')
|
||||
@ -31,12 +47,21 @@ class EntriesRepository extends EntityRepository
|
||||
->setMaxResults($maxResults)
|
||||
->where('e.isRead = 1')
|
||||
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
|
||||
->getQuery()
|
||||
->getResult(Query::HYDRATE_ARRAY);
|
||||
->getQuery();
|
||||
|
||||
return $qb;
|
||||
$paginator = new Paginator($qb);
|
||||
|
||||
return $paginator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves starred entries for a user
|
||||
*
|
||||
* @param $userId
|
||||
* @param $firstResult
|
||||
* @param int $maxResults
|
||||
* @return Paginator
|
||||
*/
|
||||
public function findStarredByUser($userId, $firstResult, $maxResults = 12)
|
||||
{
|
||||
$qb = $this->createQueryBuilder('e')
|
||||
@ -45,9 +70,10 @@ class EntriesRepository extends EntityRepository
|
||||
->setMaxResults($maxResults)
|
||||
->where('e.isFav = 1')
|
||||
->andWhere('e.userId =:userId')->setParameter('userId', $userId)
|
||||
->getQuery()
|
||||
->getResult(Query::HYDRATE_ARRAY);
|
||||
->getQuery();
|
||||
|
||||
return $qb;
|
||||
$paginator = new Paginator($qb);
|
||||
|
||||
return $paginator;
|
||||
}
|
||||
}
|
||||
|
11
src/WallabagBundle/Resources/views/Entry/new.html.twig
Normal file
11
src/WallabagBundle/Resources/views/Entry/new.html.twig
Normal file
@ -0,0 +1,11 @@
|
||||
{% extends "WallabagBundle::layout.html.twig" %}
|
||||
|
||||
{% block title %}{% trans %}Save new entry{% endtrans %}{% endblock %}
|
||||
|
||||
{% block menu %}
|
||||
{% include "WallabagBundle::_menu.html.twig" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{{ form(form) }}
|
||||
{% endblock %}
|
@ -14,7 +14,7 @@
|
||||
<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>
|
||||
<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>
|
||||
@ -24,7 +24,7 @@
|
||||
<dd><a href="http://en.wikipedia.org/wiki/MIT_License">MIT</a></dd>
|
||||
|
||||
<dt>{% trans %}Version{% endtrans %}</dt>
|
||||
<dd></dd>
|
||||
<dd>{{ version }}</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>
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
<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>
|
||||
<dd><a href="https://doc.wallabag.org/">Online documentation</a></dd>
|
||||
|
||||
<dt>{% trans %}Support{% endtrans %}</dt>
|
||||
<dd><a href="http://support.wallabag.org/">http://support.wallabag.org/</a></dd>
|
||||
@ -44,41 +44,8 @@
|
||||
<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="{{ paypal_url }}">{% trans %}via Paypal{% endtrans %}</a></dt>
|
||||
|
||||
<dt><a href="https://flattr.com/thing/1265480">{% trans %}via Flattr{% endtrans %}</a></dt>
|
||||
<dt><a href="{{ flattr_url }}">{% 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 %}
|
||||
|
@ -4,9 +4,7 @@
|
||||
<li><a href="{{ path('starred') }}">{% trans %}favorites{% endtrans %}</a></li>
|
||||
<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><a href="{{ path('new_entry') }}">{% trans %}save a link{% endtrans %}</a></li>
|
||||
<li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans %}search{% endtrans %}</a>
|
||||
{% include "WallabagBundle::_search_form.html.twig" %}
|
||||
</li>
|
||||
|
Loading…
Reference in New Issue
Block a user