diff options
-rw-r--r-- | app/config/config.yml | 3 | ||||
-rw-r--r-- | app/config/parameters.yml.dist | 22 | ||||
-rw-r--r-- | app/config/routing.yml | 4 | ||||
-rw-r--r-- | src/WallabagBundle/Controller/EntryController.php | 42 | ||||
-rw-r--r-- | src/WallabagBundle/Entity/Entries.php | 2 | ||||
-rw-r--r-- | src/WallabagBundle/Repository/EntriesRepository.php | 42 | ||||
-rw-r--r-- | src/WallabagBundle/Resources/views/Entry/new.html.twig | 11 | ||||
-rwxr-xr-x | src/WallabagBundle/Resources/views/Static/about.html.twig | 43 | ||||
-rw-r--r-- | src/WallabagBundle/Resources/views/_menu.html.twig | 4 |
9 files changed, 123 insertions, 50 deletions
diff --git a/app/config/config.yml b/app/config/config.yml index c6bed797..455345f4 100644 --- a/app/config/config.yml +++ b/app/config/config.yml | |||
@@ -44,6 +44,9 @@ twig: | |||
44 | export_epub: %export_epub% | 44 | export_epub: %export_epub% |
45 | export_mobi: %export_mobi% | 45 | export_mobi: %export_mobi% |
46 | export_pdf: %export_pdf% | 46 | export_pdf: %export_pdf% |
47 | version: %app.version% | ||
48 | paypal_url: "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9UBA65LG3FX9Y&lc=gb" | ||
49 | flattr_url: "https://flattr.com/thing/1265480" | ||
47 | 50 | ||
48 | # Assetic Configuration | 51 | # Assetic Configuration |
49 | assetic: | 52 | assetic: |
diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index 5ccac492..36e3fe7f 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist | |||
@@ -19,4 +19,24 @@ parameters: | |||
19 | # A secret key that's used to generate certain security-related tokens | 19 | # A secret key that's used to generate certain security-related tokens |
20 | secret: ThisTokenIsNotSoSecretChangeIt | 20 | secret: ThisTokenIsNotSoSecretChangeIt |
21 | 21 | ||
22 | download_pictures: false # if true, pictures will be stored into data/assets for each article \ No newline at end of file | 22 | # wallabag misc |
23 | app.version: 2.0.0-alpha | ||
24 | |||
25 | download_pictures: false # if true, pictures will be stored into data/assets for each article | ||
26 | |||
27 | # Entry view | ||
28 | share_twitter: true | ||
29 | share_mail: true | ||
30 | share_shaarli: true | ||
31 | shaarli_url: http://myshaarli.com | ||
32 | share_diaspora: true | ||
33 | diaspora_url: http://diasporapod.com | ||
34 | flattr: true | ||
35 | carrot: true | ||
36 | show_printlink: true | ||
37 | export_epub: true | ||
38 | export_mobi: true | ||
39 | export_pdf: true | ||
40 | |||
41 | # List view | ||
42 | items_on_page: 12 \ No newline at end of file | ||
diff --git a/app/config/routing.yml b/app/config/routing.yml index a748d532..d0ece8e3 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml | |||
@@ -1,3 +1,7 @@ | |||
1 | app: | 1 | app: |
2 | resource: @WallabagBundle/Controller/ | 2 | resource: @WallabagBundle/Controller/ |
3 | type: annotation | 3 | type: annotation |
4 | |||
5 | homepage: | ||
6 | pattern: / | ||
7 | defaults: { _controller: WallabagBundle:Entry:showUnread } \ No newline at end of file | ||
diff --git a/src/WallabagBundle/Controller/EntryController.php b/src/WallabagBundle/Controller/EntryController.php index fbbb76aa..dc1876fa 100644 --- a/src/WallabagBundle/Controller/EntryController.php +++ b/src/WallabagBundle/Controller/EntryController.php | |||
@@ -7,9 +7,51 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |||
7 | use Symfony\Component\HttpFoundation\Request; | 7 | use Symfony\Component\HttpFoundation\Request; |
8 | use WallabagBundle\Repository; | 8 | use WallabagBundle\Repository; |
9 | use WallabagBundle\Entity\Entries; | 9 | use WallabagBundle\Entity\Entries; |
10 | use Wallabag\Wallabag\Tools; | ||
11 | use Wallabag\Wallabag\Url; | ||
10 | 12 | ||
11 | class EntryController extends Controller | 13 | class EntryController extends Controller |
12 | { | 14 | { |
15 | |||
16 | /** | ||
17 | * @param Request $request | ||
18 | * @Route("/new", name="new_entry") | ||
19 | * @return \Symfony\Component\HttpFoundation\Response | ||
20 | */ | ||
21 | public function addEntryAction(Request $request) | ||
22 | { | ||
23 | $entry = new Entries(); | ||
24 | $entry->setUserId(1); | ||
25 | |||
26 | $form = $this->createFormBuilder($entry) | ||
27 | ->add('url', 'url') | ||
28 | ->add('save', 'submit') | ||
29 | ->getForm(); | ||
30 | |||
31 | $form->handleRequest($request); | ||
32 | |||
33 | if ($form->isValid()) { | ||
34 | |||
35 | $content = Tools::getPageContent(new Url($entry->getUrl())); | ||
36 | var_dump($content);die; | ||
37 | |||
38 | $em = $this->getDoctrine()->getEntityManager(); | ||
39 | $em->persist($entry); | ||
40 | $em->flush(); | ||
41 | |||
42 | $this->get('session')->getFlashBag()->add( | ||
43 | 'notice', | ||
44 | 'Entry saved' | ||
45 | ); | ||
46 | |||
47 | return $this->redirect($this->generateUrl('homepage')); | ||
48 | } | ||
49 | |||
50 | return $this->render('WallabagBundle:Entry:new.html.twig', array( | ||
51 | 'form' => $form->createView(), | ||
52 | )); | ||
53 | } | ||
54 | |||
13 | /** | 55 | /** |
14 | * Shows unread entries for current user | 56 | * Shows unread entries for current user |
15 | * | 57 | * |
diff --git a/src/WallabagBundle/Entity/Entries.php b/src/WallabagBundle/Entity/Entries.php index b364e0c3..5849a216 100644 --- a/src/WallabagBundle/Entity/Entries.php +++ b/src/WallabagBundle/Entity/Entries.php | |||
@@ -3,6 +3,7 @@ | |||
3 | namespace WallabagBundle\Entity; | 3 | namespace WallabagBundle\Entity; |
4 | 4 | ||
5 | use Doctrine\ORM\Mapping as ORM; | 5 | use Doctrine\ORM\Mapping as ORM; |
6 | use Symfony\Component\Validator\Constraints as Assert; | ||
6 | 7 | ||
7 | /** | 8 | /** |
8 | * Entries | 9 | * Entries |
@@ -31,6 +32,7 @@ class Entries | |||
31 | /** | 32 | /** |
32 | * @var string | 33 | * @var string |
33 | * | 34 | * |
35 | * @Assert\NotBlank() | ||
34 | * @ORM\Column(name="url", type="text", nullable=true) | 36 | * @ORM\Column(name="url", type="text", nullable=true) |
35 | */ | 37 | */ |
36 | private $url; | 38 | private $url; |
diff --git a/src/WallabagBundle/Repository/EntriesRepository.php b/src/WallabagBundle/Repository/EntriesRepository.php index c4428a1d..3eb1733d 100644 --- a/src/WallabagBundle/Repository/EntriesRepository.php +++ b/src/WallabagBundle/Repository/EntriesRepository.php | |||
@@ -8,6 +8,14 @@ use Doctrine\ORM\Tools\Pagination\Paginator; | |||
8 | 8 | ||
9 | class EntriesRepository extends EntityRepository | 9 | class EntriesRepository extends EntityRepository |
10 | { | 10 | { |
11 | /** | ||
12 | * Retrieves unread entries for a user | ||
13 | * | ||
14 | * @param $userId | ||
15 | * @param $firstResult | ||
16 | * @param int $maxResults | ||
17 | * @return Paginator | ||
18 | */ | ||
11 | public function findUnreadByUser($userId, $firstResult, $maxResults = 12) | 19 | public function findUnreadByUser($userId, $firstResult, $maxResults = 12) |
12 | { | 20 | { |
13 | $qb = $this->createQueryBuilder('e') | 21 | $qb = $this->createQueryBuilder('e') |
@@ -18,11 +26,19 @@ class EntriesRepository extends EntityRepository | |||
18 | ->andWhere('e.userId =:userId')->setParameter('userId', $userId) | 26 | ->andWhere('e.userId =:userId')->setParameter('userId', $userId) |
19 | ->getQuery(); | 27 | ->getQuery(); |
20 | 28 | ||
21 | $pag = new Paginator($qb); | 29 | $paginator = new Paginator($qb); |
22 | 30 | ||
23 | return $pag; | 31 | return $paginator; |
24 | } | 32 | } |
25 | 33 | ||
34 | /** | ||
35 | * Retrieves read entries for a user | ||
36 | * | ||
37 | * @param $userId | ||
38 | * @param $firstResult | ||
39 | * @param int $maxResults | ||
40 | * @return Paginator | ||
41 | */ | ||
26 | public function findArchiveByUser($userId, $firstResult, $maxResults = 12) | 42 | public function findArchiveByUser($userId, $firstResult, $maxResults = 12) |
27 | { | 43 | { |
28 | $qb = $this->createQueryBuilder('e') | 44 | $qb = $this->createQueryBuilder('e') |
@@ -31,12 +47,21 @@ class EntriesRepository extends EntityRepository | |||
31 | ->setMaxResults($maxResults) | 47 | ->setMaxResults($maxResults) |
32 | ->where('e.isRead = 1') | 48 | ->where('e.isRead = 1') |
33 | ->andWhere('e.userId =:userId')->setParameter('userId', $userId) | 49 | ->andWhere('e.userId =:userId')->setParameter('userId', $userId) |
34 | ->getQuery() | 50 | ->getQuery(); |
35 | ->getResult(Query::HYDRATE_ARRAY); | 51 | |
52 | $paginator = new Paginator($qb); | ||
36 | 53 | ||
37 | return $qb; | 54 | return $paginator; |
38 | } | 55 | } |
39 | 56 | ||
57 | /** | ||
58 | * Retrieves starred entries for a user | ||
59 | * | ||
60 | * @param $userId | ||
61 | * @param $firstResult | ||
62 | * @param int $maxResults | ||
63 | * @return Paginator | ||
64 | */ | ||
40 | public function findStarredByUser($userId, $firstResult, $maxResults = 12) | 65 | public function findStarredByUser($userId, $firstResult, $maxResults = 12) |
41 | { | 66 | { |
42 | $qb = $this->createQueryBuilder('e') | 67 | $qb = $this->createQueryBuilder('e') |
@@ -45,9 +70,10 @@ class EntriesRepository extends EntityRepository | |||
45 | ->setMaxResults($maxResults) | 70 | ->setMaxResults($maxResults) |
46 | ->where('e.isFav = 1') | 71 | ->where('e.isFav = 1') |
47 | ->andWhere('e.userId =:userId')->setParameter('userId', $userId) | 72 | ->andWhere('e.userId =:userId')->setParameter('userId', $userId) |
48 | ->getQuery() | 73 | ->getQuery(); |
49 | ->getResult(Query::HYDRATE_ARRAY); | 74 | |
75 | $paginator = new Paginator($qb); | ||
50 | 76 | ||
51 | return $qb; | 77 | return $paginator; |
52 | } | 78 | } |
53 | } | 79 | } |
diff --git a/src/WallabagBundle/Resources/views/Entry/new.html.twig b/src/WallabagBundle/Resources/views/Entry/new.html.twig new file mode 100644 index 00000000..78da791f --- /dev/null +++ b/src/WallabagBundle/Resources/views/Entry/new.html.twig | |||
@@ -0,0 +1,11 @@ | |||
1 | {% extends "WallabagBundle::layout.html.twig" %} | ||
2 | |||
3 | {% block title %}{% trans %}Save new entry{% endtrans %}{% endblock %} | ||
4 | |||
5 | {% block menu %} | ||
6 | {% include "WallabagBundle::_menu.html.twig" %} | ||
7 | {% endblock %} | ||
8 | |||
9 | {% block content %} | ||
10 | {{ form(form) }} | ||
11 | {% endblock %} \ No newline at end of file | ||
diff --git a/src/WallabagBundle/Resources/views/Static/about.html.twig b/src/WallabagBundle/Resources/views/Static/about.html.twig index 1a3c927e..752526e1 100755 --- a/src/WallabagBundle/Resources/views/Static/about.html.twig +++ b/src/WallabagBundle/Resources/views/Static/about.html.twig | |||
@@ -14,7 +14,7 @@ | |||
14 | <dt>{% trans %}Main developer{% endtrans %}</dt> | 14 | <dt>{% trans %}Main developer{% endtrans %}</dt> |
15 | <dd><a href="mailto:nicolas@loeuillet.org">Nicolas Lœuillet</a> — <a href="http://cdetc.fr">{% trans %}website{% endtrans %}</a></dd> | 15 | <dd><a href="mailto:nicolas@loeuillet.org">Nicolas Lœuillet</a> — <a href="http://cdetc.fr">{% trans %}website{% endtrans %}</a></dd> |
16 | 16 | ||
17 | <dt>{% trans %}Contributors:{% endtrans %}</dt> | 17 | <dt>{% trans %}Contributors ♥:{% endtrans %}</dt> |
18 | <dd><a href="https://github.com/wallabag/wallabag/graphs/contributors">{% trans %}on Github{% endtrans %}</a></dd> | 18 | <dd><a href="https://github.com/wallabag/wallabag/graphs/contributors">{% trans %}on Github{% endtrans %}</a></dd> |
19 | 19 | ||
20 | <dt>{% trans %}Bug reports{% endtrans %}</dt> | 20 | <dt>{% trans %}Bug reports{% endtrans %}</dt> |
@@ -24,7 +24,7 @@ | |||
24 | <dd><a href="http://en.wikipedia.org/wiki/MIT_License">MIT</a></dd> | 24 | <dd><a href="http://en.wikipedia.org/wiki/MIT_License">MIT</a></dd> |
25 | 25 | ||
26 | <dt>{% trans %}Version{% endtrans %}</dt> | 26 | <dt>{% trans %}Version{% endtrans %}</dt> |
27 | <dd></dd> | 27 | <dd>{{ version }}</dd> |
28 | </dl> | 28 | </dl> |
29 | 29 | ||
30 | <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> | 30 | <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 @@ | |||
33 | 33 | ||
34 | <dl> | 34 | <dl> |
35 | <dt>{% trans %}Documentation{% endtrans %}</dt> | 35 | <dt>{% trans %}Documentation{% endtrans %}</dt> |
36 | <dd><a href="docs/">Offline documentation</a> and <a href="https://doc.wallabag.org/">online documentation</a> (up to date)</dd> | 36 | <dd><a href="https://doc.wallabag.org/">Online documentation</a></dd> |
37 | 37 | ||
38 | <dt>{% trans %}Support{% endtrans %}</dt> | 38 | <dt>{% trans %}Support{% endtrans %}</dt> |
39 | <dd><a href="http://support.wallabag.org/">http://support.wallabag.org/</a></dd> | 39 | <dd><a href="http://support.wallabag.org/">http://support.wallabag.org/</a></dd> |
@@ -44,41 +44,8 @@ | |||
44 | <p>{% trans %}wallabag is free and opensource. You can help us:{% endtrans %}</p> | 44 | <p>{% trans %}wallabag is free and opensource. You can help us:{% endtrans %}</p> |
45 | 45 | ||
46 | <dl> | 46 | <dl> |
47 | <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> | 47 | <dt><a href="{{ paypal_url }}">{% trans %}via Paypal{% endtrans %}</a></dt> |
48 | 48 | ||
49 | <dt><a href="https://flattr.com/thing/1265480">{% trans %}via Flattr{% endtrans %}</a></dt> | 49 | <dt><a href="{{ flattr_url }}">{% trans %}via Flattr{% endtrans %}</a></dt> |
50 | </dl> | 50 | </dl> |
51 | |||
52 | <h2>{% trans %}Credits{% endtrans %}</h2> | ||
53 | <dl> | ||
54 | <dt>PHP Readability</dt> | ||
55 | <dd><a href="https://bitbucket.org/fivefilters/php-readability">https://bitbucket.org/fivefilters/php-readability</a></dd> | ||
56 | |||
57 | <dt>Full Text RSS</dt> | ||
58 | <dd><a href="http://code.fivefilters.org/full-text-rss/src">http://code.fivefilters.org/full-text-rss/src</a></dd> | ||
59 | |||
60 | <dt>logo by Maylis Agniel</dt> | ||
61 | <dd><a href="https://github.com/wallabag/logo">https://github.com/wallabag/logo</a></dd> | ||
62 | |||
63 | <dt>icons</dt> | ||
64 | <dd><a href="http://icomoon.io">http://icomoon.io</a></dd> | ||
65 | |||
66 | <dt>PHP Simple HTML DOM Parser</dt> | ||
67 | <dd><a href="http://simplehtmldom.sourceforge.net/">http://simplehtmldom.sourceforge.net/</a></dd> | ||
68 | |||
69 | <dt>Session</dt> | ||
70 | <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> | ||
71 | |||
72 | <dt>Twig</dt> | ||
73 | <dd><a href="http://twig.sensiolabs.org">http://twig.sensiolabs.org</a></dd> | ||
74 | |||
75 | <dt>Flash messages</dt> | ||
76 | <dd><a href="https://github.com/plasticbrain/PHP-Flash-Messages">https://github.com/plasticbrain/PHP-Flash-Messages</a></dd> | ||
77 | |||
78 | <dt>Pagination</dt> | ||
79 | <dd><a href="https://github.com/daveismyname/pagination">https://github.com/daveismyname/pagination</a></dd> | ||
80 | |||
81 | <dt>PHPePub</dt> | ||
82 | <dd><a href="https://github.com/Grandt/PHPePub/">https://github.com/Grandt/PHPePub/</a></dd> | ||
83 | </dl> | ||
84 | {% endblock %} | 51 | {% endblock %} |
diff --git a/src/WallabagBundle/Resources/views/_menu.html.twig b/src/WallabagBundle/Resources/views/_menu.html.twig index 4c6a0a1b..419a676b 100644 --- a/src/WallabagBundle/Resources/views/_menu.html.twig +++ b/src/WallabagBundle/Resources/views/_menu.html.twig | |||
@@ -4,9 +4,7 @@ | |||
4 | <li><a href="{{ path('starred') }}">{% trans %}favorites{% endtrans %}</a></li> | 4 | <li><a href="{{ path('starred') }}">{% trans %}favorites{% endtrans %}</a></li> |
5 | <li><a href="{{ path('archive') }}"}>{% trans %}archive{% endtrans %}</a></li> | 5 | <li><a href="{{ path('archive') }}"}>{% trans %}archive{% endtrans %}</a></li> |
6 | <li><a href="./?view=tags">{% trans %}tags{% endtrans %}</a></li> | 6 | <li><a href="./?view=tags">{% trans %}tags{% endtrans %}</a></li> |
7 | <li style="position: relative;"><a href="javascript: void(null);" id="bagit">{% trans %}save a link{% endtrans %}</a> | 7 | <li><a href="{{ path('new_entry') }}">{% trans %}save a link{% endtrans %}</a></li> |
8 | {% include "WallabagBundle::_save_form.html.twig" %} | ||
9 | </li> | ||
10 | <li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans %}search{% endtrans %}</a> | 8 | <li style="position: relative;"><a href="javascript: void(null);" id="search">{% trans %}search{% endtrans %}</a> |
11 | {% include "WallabagBundle::_search_form.html.twig" %} | 9 | {% include "WallabagBundle::_search_form.html.twig" %} |
12 | </li> | 10 | </li> |