diff --git a/app/config/config.yml b/app/config/config.yml index 25f664719..ca7fb467d 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -58,7 +58,7 @@ doctrine: # e.g. database_path: "%kernel.root_dir%/data/data.db3" # 2. Uncomment database_path in parameters.yml.dist # 3. Uncomment next line: - # path: "%database_path%" + path: "%database_path%" orm: auto_generate_proxy_classes: "%kernel.debug%" diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index 26a23f540..5ccac4922 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -7,7 +7,7 @@ parameters: database_user: root database_password: ~ # You should uncomment this if you want use pdo_sqlite - # database_path: "%kernel.root_dir%/data.db3" + database_path: "%kernel.root_dir%/data/db/poche.sqlite" mailer_transport: smtp mailer_host: 127.0.0.1 diff --git a/src/Wallabag/Wallabag/Database.php b/src/Wallabag/Wallabag/Database.php index fa1329101..47fa99aa8 100755 --- a/src/Wallabag/Wallabag/Database.php +++ b/src/Wallabag/Wallabag/Database.php @@ -11,6 +11,7 @@ namespace Wallabag\Wallabag; use \PDO; +use WallabagBundle\Entity; class Database { diff --git a/src/WallabagBundle/Controller/DefaultController.php b/src/WallabagBundle/Controller/DefaultController.php deleted file mode 100644 index 1030b7a68..000000000 --- a/src/WallabagBundle/Controller/DefaultController.php +++ /dev/null @@ -1,17 +0,0 @@ -render('default/index.html.twig'); - } -} diff --git a/src/WallabagBundle/Controller/EntryController.php b/src/WallabagBundle/Controller/EntryController.php new file mode 100644 index 000000000..0c0c15690 --- /dev/null +++ b/src/WallabagBundle/Controller/EntryController.php @@ -0,0 +1,25 @@ +getDoctrine()->getRepository('WallabagBundle:Entries'); + $entries = $repository->findUnreadByUser(1); + + return $this->render( + 'WallabagBundle:Entry:entries.html.twig', + array('entries' => $entries) + ); + + } +} diff --git a/src/WallabagBundle/DependencyInjection/WallabagExtension.php b/src/WallabagBundle/DependencyInjection/WallabagExtension.php new file mode 100644 index 000000000..cfdb21fc8 --- /dev/null +++ b/src/WallabagBundle/DependencyInjection/WallabagExtension.php @@ -0,0 +1,22 @@ +load('services.xml'); + } + + public function getAlias() + { + return 'wallabag'; + } +} diff --git a/src/WallabagBundle/Entity/Config.php b/src/WallabagBundle/Entity/Config.php new file mode 100644 index 000000000..8b692cefd --- /dev/null +++ b/src/WallabagBundle/Entity/Config.php @@ -0,0 +1,95 @@ +id; + } + + /** + * Set name + * + * @param string $name + * @return Config + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set value + * + * @param string $value + * @return Config + */ + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + /** + * Get value + * + * @return string + */ + public function getValue() + { + return $this->value; + } +} diff --git a/src/WallabagBundle/Entity/Config.php~ b/src/WallabagBundle/Entity/Config.php~ new file mode 100644 index 000000000..8b692cefd --- /dev/null +++ b/src/WallabagBundle/Entity/Config.php~ @@ -0,0 +1,95 @@ +id; + } + + /** + * Set name + * + * @param string $name + * @return Config + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set value + * + * @param string $value + * @return Config + */ + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + /** + * Get value + * + * @return string + */ + public function getValue() + { + return $this->value; + } +} diff --git a/src/WallabagBundle/Entity/Entries.php b/src/WallabagBundle/Entity/Entries.php new file mode 100644 index 000000000..69c6be0d7 --- /dev/null +++ b/src/WallabagBundle/Entity/Entries.php @@ -0,0 +1,215 @@ +id; + } + + /** + * Set title + * + * @param string $title + * @return Entries + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set url + * + * @param string $url + * @return Entries + */ + public function setUrl($url) + { + $this->url = $url; + + return $this; + } + + /** + * Get url + * + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Set isRead + * + * @param string $isRead + * @return Entries + */ + public function setIsRead($isRead) + { + $this->isRead = $isRead; + + return $this; + } + + /** + * Get isRead + * + * @return string + */ + public function getIsRead() + { + return $this->isRead; + } + + /** + * Set isFav + * + * @param string $isFav + * @return Entries + */ + public function setIsFav($isFav) + { + $this->isFav = $isFav; + + return $this; + } + + /** + * Get isFav + * + * @return string + */ + public function getIsFav() + { + return $this->isFav; + } + + /** + * Set content + * + * @param string $content + * @return Entries + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * Get content + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Set userId + * + * @param string $userId + * @return Entries + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId + * + * @return string + */ + public function getUserId() + { + return $this->userId; + } +} diff --git a/src/WallabagBundle/Entity/Entries.php~ b/src/WallabagBundle/Entity/Entries.php~ new file mode 100644 index 000000000..69c6be0d7 --- /dev/null +++ b/src/WallabagBundle/Entity/Entries.php~ @@ -0,0 +1,215 @@ +id; + } + + /** + * Set title + * + * @param string $title + * @return Entries + */ + public function setTitle($title) + { + $this->title = $title; + + return $this; + } + + /** + * Get title + * + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Set url + * + * @param string $url + * @return Entries + */ + public function setUrl($url) + { + $this->url = $url; + + return $this; + } + + /** + * Get url + * + * @return string + */ + public function getUrl() + { + return $this->url; + } + + /** + * Set isRead + * + * @param string $isRead + * @return Entries + */ + public function setIsRead($isRead) + { + $this->isRead = $isRead; + + return $this; + } + + /** + * Get isRead + * + * @return string + */ + public function getIsRead() + { + return $this->isRead; + } + + /** + * Set isFav + * + * @param string $isFav + * @return Entries + */ + public function setIsFav($isFav) + { + $this->isFav = $isFav; + + return $this; + } + + /** + * Get isFav + * + * @return string + */ + public function getIsFav() + { + return $this->isFav; + } + + /** + * Set content + * + * @param string $content + * @return Entries + */ + public function setContent($content) + { + $this->content = $content; + + return $this; + } + + /** + * Get content + * + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Set userId + * + * @param string $userId + * @return Entries + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId + * + * @return string + */ + public function getUserId() + { + return $this->userId; + } +} diff --git a/src/WallabagBundle/Entity/Entry.php~ b/src/WallabagBundle/Entity/Entry.php~ new file mode 100644 index 000000000..ebcdf53af --- /dev/null +++ b/src/WallabagBundle/Entity/Entry.php~ @@ -0,0 +1,74 @@ +id; + } + + /** + * Set value + * + * @param string $value + * @return Tags + */ + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + /** + * Get value + * + * @return string + */ + public function getValue() + { + return $this->value; + } +} diff --git a/src/WallabagBundle/Entity/Tags.php~ b/src/WallabagBundle/Entity/Tags.php~ new file mode 100644 index 000000000..c0c78ee51 --- /dev/null +++ b/src/WallabagBundle/Entity/Tags.php~ @@ -0,0 +1,65 @@ +id; + } + + /** + * Set value + * + * @param string $value + * @return Tags + */ + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + /** + * Get value + * + * @return string + */ + public function getValue() + { + return $this->value; + } +} diff --git a/src/WallabagBundle/Entity/TagsEntries.php b/src/WallabagBundle/Entity/TagsEntries.php new file mode 100644 index 000000000..448c54fac --- /dev/null +++ b/src/WallabagBundle/Entity/TagsEntries.php @@ -0,0 +1,95 @@ +id; + } + + /** + * Set entryId + * + * @param integer $entryId + * @return TagsEntries + */ + public function setEntryId($entryId) + { + $this->entryId = $entryId; + + return $this; + } + + /** + * Get entryId + * + * @return integer + */ + public function getEntryId() + { + return $this->entryId; + } + + /** + * Set tagId + * + * @param integer $tagId + * @return TagsEntries + */ + public function setTagId($tagId) + { + $this->tagId = $tagId; + + return $this; + } + + /** + * Get tagId + * + * @return integer + */ + public function getTagId() + { + return $this->tagId; + } +} diff --git a/src/WallabagBundle/Entity/TagsEntries.php~ b/src/WallabagBundle/Entity/TagsEntries.php~ new file mode 100644 index 000000000..448c54fac --- /dev/null +++ b/src/WallabagBundle/Entity/TagsEntries.php~ @@ -0,0 +1,95 @@ +id; + } + + /** + * Set entryId + * + * @param integer $entryId + * @return TagsEntries + */ + public function setEntryId($entryId) + { + $this->entryId = $entryId; + + return $this; + } + + /** + * Get entryId + * + * @return integer + */ + public function getEntryId() + { + return $this->entryId; + } + + /** + * Set tagId + * + * @param integer $tagId + * @return TagsEntries + */ + public function setTagId($tagId) + { + $this->tagId = $tagId; + + return $this; + } + + /** + * Get tagId + * + * @return integer + */ + public function getTagId() + { + return $this->tagId; + } +} diff --git a/src/WallabagBundle/Entity/Users.php b/src/WallabagBundle/Entity/Users.php new file mode 100644 index 000000000..a48f2240f --- /dev/null +++ b/src/WallabagBundle/Entity/Users.php @@ -0,0 +1,155 @@ +id; + } + + /** + * Set username + * + * @param string $username + * @return Users + */ + public function setUsername($username) + { + $this->username = $username; + + return $this; + } + + /** + * Get username + * + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Set password + * + * @param string $password + * @return Users + */ + public function setPassword($password) + { + $this->password = $password; + + return $this; + } + + /** + * Get password + * + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * Set name + * + * @param string $name + * @return Users + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set email + * + * @param string $email + * @return Users + */ + public function setEmail($email) + { + $this->email = $email; + + return $this; + } + + /** + * Get email + * + * @return string + */ + public function getEmail() + { + return $this->email; + } +} diff --git a/src/WallabagBundle/Entity/Users.php~ b/src/WallabagBundle/Entity/Users.php~ new file mode 100644 index 000000000..a48f2240f --- /dev/null +++ b/src/WallabagBundle/Entity/Users.php~ @@ -0,0 +1,155 @@ +id; + } + + /** + * Set username + * + * @param string $username + * @return Users + */ + public function setUsername($username) + { + $this->username = $username; + + return $this; + } + + /** + * Get username + * + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Set password + * + * @param string $password + * @return Users + */ + public function setPassword($password) + { + $this->password = $password; + + return $this; + } + + /** + * Get password + * + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * Set name + * + * @param string $name + * @return Users + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set email + * + * @param string $email + * @return Users + */ + public function setEmail($email) + { + $this->email = $email; + + return $this; + } + + /** + * Get email + * + * @return string + */ + public function getEmail() + { + return $this->email; + } +} diff --git a/src/WallabagBundle/Entity/UsersConfig.php b/src/WallabagBundle/Entity/UsersConfig.php new file mode 100644 index 000000000..8af283cc4 --- /dev/null +++ b/src/WallabagBundle/Entity/UsersConfig.php @@ -0,0 +1,125 @@ +id; + } + + /** + * Set userId + * + * @param string $userId + * @return UsersConfig + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId + * + * @return string + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set name + * + * @param string $name + * @return UsersConfig + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set value + * + * @param string $value + * @return UsersConfig + */ + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + /** + * Get value + * + * @return string + */ + public function getValue() + { + return $this->value; + } +} diff --git a/src/WallabagBundle/Entity/UsersConfig.php~ b/src/WallabagBundle/Entity/UsersConfig.php~ new file mode 100644 index 000000000..8af283cc4 --- /dev/null +++ b/src/WallabagBundle/Entity/UsersConfig.php~ @@ -0,0 +1,125 @@ +id; + } + + /** + * Set userId + * + * @param string $userId + * @return UsersConfig + */ + public function setUserId($userId) + { + $this->userId = $userId; + + return $this; + } + + /** + * Get userId + * + * @return string + */ + public function getUserId() + { + return $this->userId; + } + + /** + * Set name + * + * @param string $name + * @return UsersConfig + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set value + * + * @param string $value + * @return UsersConfig + */ + public function setValue($value) + { + $this->value = $value; + + return $this; + } + + /** + * Get value + * + * @return string + */ + public function getValue() + { + return $this->value; + } +} diff --git a/src/WallabagBundle/Repository/EntriesRepository.php b/src/WallabagBundle/Repository/EntriesRepository.php new file mode 100644 index 000000000..4c13c9c2f --- /dev/null +++ b/src/WallabagBundle/Repository/EntriesRepository.php @@ -0,0 +1,35 @@ +createQueryBuilder('e') + ->where('e.is_read = 0') + ->andWhere('e.user_id = :userId') + ->setParameter('userId', $userId) + ->getQuery(); + }*/ + public function findUnreadByUser($userId) + { + $qb = $this->createQueryBuilder('e') + ->select('e') + ->where('e.isRead = 0') + ->andWhere('e.userId =:userId')->setParameter('userId', $userId) + ->getQuery() + ->getResult(Query::HYDRATE_ARRAY); + + return $qb; + } +} diff --git a/src/WallabagBundle/Resources/config/routing.yml b/src/WallabagBundle/Resources/config/routing.yml new file mode 100644 index 000000000..ad79b1f08 --- /dev/null +++ b/src/WallabagBundle/Resources/config/routing.yml @@ -0,0 +1,3 @@ +_wllbg: + resource: "@WallabagBundle/Controller/EntryController.php" + type: annotation diff --git a/src/WallabagBundle/Resources/config/services.xml b/src/WallabagBundle/Resources/config/services.xml new file mode 100644 index 000000000..02d82643c --- /dev/null +++ b/src/WallabagBundle/Resources/config/services.xml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/src/WallabagBundle/Resources/views/Entry/entries.html.twig b/src/WallabagBundle/Resources/views/Entry/entries.html.twig new file mode 100644 index 000000000..f4d7a7ab8 --- /dev/null +++ b/src/WallabagBundle/Resources/views/Entry/entries.html.twig @@ -0,0 +1,26 @@ +{% extends "WallabagBundle::layout.html.twig" %} + +{% block title "Unread" %} + +{% block content_header '' %} + +{% block content %} + {% for entry in entries %} +
+

{{ entry.title|raw }}

+ {% if entry.content| readingTime > 0 %} +
{% trans %}estimated reading time :{% endtrans %} {{ entry.content| readingTime }} min
+ {% else %} +
{% trans %}estimated reading time :{% endtrans %} < 1 min
+ {% endif %} + + +

{{ entry.content|striptags|slice(0, 300) }}...

+
+ {% endfor %} +{% endblock %} diff --git a/src/WallabagBundle/Resources/views/_bookmarklet.html.twig b/src/WallabagBundle/Resources/views/_bookmarklet.html.twig new file mode 100644 index 000000000..d432909a3 --- /dev/null +++ b/src/WallabagBundle/Resources/views/_bookmarklet.html.twig @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/WallabagBundle/Resources/views/_footer.html.twig b/src/WallabagBundle/Resources/views/_footer.html.twig new file mode 100644 index 000000000..c897a97e4 --- /dev/null +++ b/src/WallabagBundle/Resources/views/_footer.html.twig @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/src/WallabagBundle/Resources/views/_head.html.twig b/src/WallabagBundle/Resources/views/_head.html.twig new file mode 100755 index 000000000..7ef79a2f0 --- /dev/null +++ b/src/WallabagBundle/Resources/views/_head.html.twig @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/WallabagBundle/Resources/views/_messages.html.twig b/src/WallabagBundle/Resources/views/_messages.html.twig new file mode 100644 index 000000000..e69de29bb diff --git a/src/WallabagBundle/Resources/views/_top.html.twig b/src/WallabagBundle/Resources/views/_top.html.twig new file mode 100755 index 000000000..576df8064 --- /dev/null +++ b/src/WallabagBundle/Resources/views/_top.html.twig @@ -0,0 +1,6 @@ +
+

+ {% block logo %}wallabag logo{% endblock %} + +

+
diff --git a/src/WallabagBundle/Resources/views/layout.html.twig b/src/WallabagBundle/Resources/views/layout.html.twig new file mode 100644 index 000000000..4a3f0f5cb --- /dev/null +++ b/src/WallabagBundle/Resources/views/layout.html.twig @@ -0,0 +1,31 @@ + + + + + + + + + + + {% block title %}{% endblock %} - wallabag + {% include "WallabagBundle::_head.html.twig" %} + {% include "WallabagBundle::_bookmarklet.html.twig" %} + + +{% include "WallabagBundle::_top.html.twig" %} +
+ {% block menu %}{% endblock %} + {% block precontent %}{% endblock %} + {% block messages %} + {% include "WallabagBundle::_messages.html.twig" %} + {% endblock %} +
+ {% block content %}{% endblock %} +
+
+{% include "WallabagBundle::_footer.html.twig" %} + + \ No newline at end of file diff --git a/src/WallabagBundle/Tests/Controller/DefaultControllerTest.php b/src/WallabagBundle/Tests/Controller/DefaultControllerTest.php index e90224389..64b389bbe 100644 --- a/src/WallabagBundle/Tests/Controller/DefaultControllerTest.php +++ b/src/WallabagBundle/Tests/Controller/DefaultControllerTest.php @@ -4,7 +4,7 @@ namespace WallabagBundle\Tests\Controller; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class DefaultControllerTest extends WebTestCase +class EntryControllerTest extends WebTestCase { public function testIndex() { diff --git a/src/WallabagBundle/Twig/Extension/WallabagExtension.php b/src/WallabagBundle/Twig/Extension/WallabagExtension.php new file mode 100644 index 000000000..741fb1910 --- /dev/null +++ b/src/WallabagBundle/Twig/Extension/WallabagExtension.php @@ -0,0 +1,41 @@ +