diff options
Diffstat (limited to 'src')
18 files changed, 390 insertions, 8 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 03990088..35a90edd 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php | |||
@@ -97,6 +97,8 @@ class WallabagRestController extends FOSRestController | |||
97 | * {"name"="url", "dataType"="string", "required"=true, "format"="http://www.test.com/article.html", "description"="Url for the entry."}, | 97 | * {"name"="url", "dataType"="string", "required"=true, "format"="http://www.test.com/article.html", "description"="Url for the entry."}, |
98 | * {"name"="title", "dataType"="string", "required"=false, "description"="Optional, we'll get the title from the page."}, | 98 | * {"name"="title", "dataType"="string", "required"=false, "description"="Optional, we'll get the title from the page."}, |
99 | * {"name"="tags", "dataType"="string", "required"=false, "format"="tag1,tag2,tag3", "description"="a comma-separated list of tags."}, | 99 | * {"name"="tags", "dataType"="string", "required"=false, "format"="tag1,tag2,tag3", "description"="a comma-separated list of tags."}, |
100 | * {"name"="starred", "dataType"="boolean", "required"=false, "format"="true or false", "description"="entry already starred"}, | ||
101 | * {"name"="archive", "dataType"="boolean", "required"=false, "format"="true or false", "description"="entry already archived"}, | ||
100 | * } | 102 | * } |
101 | * ) | 103 | * ) |
102 | * | 104 | * |
@@ -107,6 +109,8 @@ class WallabagRestController extends FOSRestController | |||
107 | $this->validateAuthentication(); | 109 | $this->validateAuthentication(); |
108 | 110 | ||
109 | $url = $request->request->get('url'); | 111 | $url = $request->request->get('url'); |
112 | $isArchived = $request->request->get('archive'); | ||
113 | $isStarred = $request->request->get('starred'); | ||
110 | 114 | ||
111 | $entry = $this->get('wallabag_core.content_proxy')->updateEntry( | 115 | $entry = $this->get('wallabag_core.content_proxy')->updateEntry( |
112 | new Entry($this->getUser()), | 116 | new Entry($this->getUser()), |
@@ -118,8 +122,17 @@ class WallabagRestController extends FOSRestController | |||
118 | $this->get('wallabag_core.content_proxy')->assignTagsToEntry($entry, $tags); | 122 | $this->get('wallabag_core.content_proxy')->assignTagsToEntry($entry, $tags); |
119 | } | 123 | } |
120 | 124 | ||
125 | if (true === (bool) $isStarred) { | ||
126 | $entry->setStarred(true); | ||
127 | } | ||
128 | |||
129 | if (true === (bool) $isArchived) { | ||
130 | $entry->setArchived(true); | ||
131 | } | ||
132 | |||
121 | $em = $this->getDoctrine()->getManager(); | 133 | $em = $this->getDoctrine()->getManager(); |
122 | $em->persist($entry); | 134 | $em->persist($entry); |
135 | |||
123 | $em->flush(); | 136 | $em->flush(); |
124 | 137 | ||
125 | $json = $this->get('serializer')->serialize($entry, 'json'); | 138 | $json = $this->get('serializer')->serialize($entry, 'json'); |
diff --git a/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php b/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php index 22894a77..630b75bf 100644 --- a/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php +++ b/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php | |||
@@ -162,6 +162,24 @@ class WallabagRestControllerTest extends WallabagApiTestCase | |||
162 | $this->assertCount(1, $content['tags']); | 162 | $this->assertCount(1, $content['tags']); |
163 | } | 163 | } |
164 | 164 | ||
165 | public function testPostArchivedEntry() | ||
166 | { | ||
167 | $this->client->request('POST', '/api/entries.json', array( | ||
168 | 'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', | ||
169 | 'archive' => true, | ||
170 | 'starred' => false, | ||
171 | )); | ||
172 | |||
173 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | ||
174 | |||
175 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
176 | |||
177 | $this->assertGreaterThan(0, $content['id']); | ||
178 | $this->assertEquals('http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', $content['url']); | ||
179 | $this->assertEquals(true, $content['is_archived']); | ||
180 | $this->assertEquals(false, $content['is_starred']); | ||
181 | } | ||
182 | |||
165 | public function testPatchEntry() | 183 | public function testPatchEntry() |
166 | { | 184 | { |
167 | $entry = $this->client->getContainer() | 185 | $entry = $this->client->getContainer() |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 902c8323..6c6caa24 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -215,6 +215,8 @@ Import contents: "Importer les contenus" | |||
215 | Import: "Importer" | 215 | Import: "Importer" |
216 | Import > Wallabag v1: "Importer > Wallabag v1" | 216 | Import > Wallabag v1: "Importer > Wallabag v1" |
217 | Import > Wallabag v2: "Importer > Wallabag v2" | 217 | Import > Wallabag v2: "Importer > Wallabag v2" |
218 | Mark all as read ?: "Marquer tout comme lu ?" | ||
219 | Mark all imported entries as read: "Marquer tous les contenus importés comme lus" | ||
218 | 220 | ||
219 | # Quickstart | 221 | # Quickstart |
220 | Quickstart: Pour bien débuter | 222 | Quickstart: Pour bien débuter |
diff --git a/src/Wallabag/ImportBundle/Controller/PocketController.php b/src/Wallabag/ImportBundle/Controller/PocketController.php index 1c1b4fa8..c88e115e 100644 --- a/src/Wallabag/ImportBundle/Controller/PocketController.php +++ b/src/Wallabag/ImportBundle/Controller/PocketController.php | |||
@@ -5,6 +5,8 @@ namespace Wallabag\ImportBundle\Controller; | |||
5 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | 5 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
6 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; | 6 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface; |
7 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | 7 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
8 | use Symfony\Component\HttpFoundation\Request; | ||
9 | use Symfony\Component\Form\Extension\Core\Type\CheckboxType; | ||
8 | 10 | ||
9 | class PocketController extends Controller | 11 | class PocketController extends Controller |
10 | { | 12 | { |
@@ -13,21 +15,31 @@ class PocketController extends Controller | |||
13 | */ | 15 | */ |
14 | public function indexAction() | 16 | public function indexAction() |
15 | { | 17 | { |
18 | $pocket = $this->get('wallabag_import.pocket.import'); | ||
19 | $form = $this->createFormBuilder($pocket) | ||
20 | ->add('read', CheckboxType::class, array( | ||
21 | 'label' => 'Mark all as read', | ||
22 | 'required' => false, | ||
23 | )) | ||
24 | ->getForm(); | ||
25 | |||
16 | return $this->render('WallabagImportBundle:Pocket:index.html.twig', [ | 26 | return $this->render('WallabagImportBundle:Pocket:index.html.twig', [ |
17 | 'import' => $this->get('wallabag_import.pocket.import'), | 27 | 'import' => $this->get('wallabag_import.pocket.import'), |
18 | 'has_consumer_key' => '' == trim($this->get('craue_config')->get('pocket_consumer_key')) ? false : true, | 28 | 'has_consumer_key' => '' == trim($this->get('craue_config')->get('pocket_consumer_key')) ? false : true, |
29 | 'form' => $form->createView(), | ||
19 | ]); | 30 | ]); |
20 | } | 31 | } |
21 | 32 | ||
22 | /** | 33 | /** |
23 | * @Route("/pocket/auth", name="import_pocket_auth") | 34 | * @Route("/pocket/auth", name="import_pocket_auth") |
24 | */ | 35 | */ |
25 | public function authAction() | 36 | public function authAction(Request $request) |
26 | { | 37 | { |
27 | $requestToken = $this->get('wallabag_import.pocket.import') | 38 | $requestToken = $this->get('wallabag_import.pocket.import') |
28 | ->getRequestToken($this->generateUrl('import', array(), UrlGeneratorInterface::ABSOLUTE_URL)); | 39 | ->getRequestToken($this->generateUrl('import', array(), UrlGeneratorInterface::ABSOLUTE_URL)); |
29 | 40 | ||
30 | $this->get('session')->set('import.pocket.code', $requestToken); | 41 | $this->get('session')->set('import.pocket.code', $requestToken); |
42 | $this->get('session')->set('read', $request->request->get('form')['read']); | ||
31 | 43 | ||
32 | return $this->redirect( | 44 | return $this->redirect( |
33 | 'https://getpocket.com/auth/authorize?request_token='.$requestToken.'&redirect_uri='.$this->generateUrl('import_pocket_callback', array(), UrlGeneratorInterface::ABSOLUTE_URL), | 45 | 'https://getpocket.com/auth/authorize?request_token='.$requestToken.'&redirect_uri='.$this->generateUrl('import_pocket_callback', array(), UrlGeneratorInterface::ABSOLUTE_URL), |
@@ -42,6 +54,8 @@ class PocketController extends Controller | |||
42 | { | 54 | { |
43 | $message = 'Import failed, please try again.'; | 55 | $message = 'Import failed, please try again.'; |
44 | $pocket = $this->get('wallabag_import.pocket.import'); | 56 | $pocket = $this->get('wallabag_import.pocket.import'); |
57 | $markAsRead = $this->get('session')->get('read'); | ||
58 | $this->get('session')->remove('read'); | ||
45 | 59 | ||
46 | // something bad happend on pocket side | 60 | // something bad happend on pocket side |
47 | if (false === $pocket->authorize($this->get('session')->get('import.pocket.code'))) { | 61 | if (false === $pocket->authorize($this->get('session')->get('import.pocket.code'))) { |
@@ -53,7 +67,7 @@ class PocketController extends Controller | |||
53 | return $this->redirect($this->generateUrl('import_pocket')); | 67 | return $this->redirect($this->generateUrl('import_pocket')); |
54 | } | 68 | } |
55 | 69 | ||
56 | if (true === $pocket->import()) { | 70 | if (true === $pocket->setMarkAsRead($markAsRead)->import()) { |
57 | $summary = $pocket->getSummary(); | 71 | $summary = $pocket->getSummary(); |
58 | $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.'; | 72 | $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.'; |
59 | } | 73 | } |
diff --git a/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php b/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php index 35fe620f..154a0769 100644 --- a/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php +++ b/src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php | |||
@@ -21,15 +21,18 @@ class WallabagV1Controller extends Controller | |||
21 | 21 | ||
22 | if ($form->isValid()) { | 22 | if ($form->isValid()) { |
23 | $file = $form->get('file')->getData(); | 23 | $file = $form->get('file')->getData(); |
24 | $markAsRead = $form->get('mark_as_read')->getData(); | ||
24 | $name = $this->getUser()->getId().'.json'; | 25 | $name = $this->getUser()->getId().'.json'; |
25 | 26 | ||
26 | if (in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes')) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { | 27 | if (in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes')) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { |
27 | $res = $wallabag | 28 | $res = $wallabag |
28 | ->setUser($this->getUser()) | 29 | ->setUser($this->getUser()) |
29 | ->setFilepath($this->getParameter('wallabag_import.resource_dir').'/'.$name) | 30 | ->setFilepath($this->getParameter('wallabag_import.resource_dir').'/'.$name) |
31 | ->setMarkAsRead($markAsRead) | ||
30 | ->import(); | 32 | ->import(); |
31 | 33 | ||
32 | $message = 'Import failed, please try again.'; | 34 | $message = 'Import failed, please try again.'; |
35 | |||
33 | if (true === $res) { | 36 | if (true === $res) { |
34 | $summary = $wallabag->getSummary(); | 37 | $summary = $wallabag->getSummary(); |
35 | $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.'; | 38 | $message = 'Import summary: '.$summary['imported'].' imported, '.$summary['skipped'].' already saved.'; |
diff --git a/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php b/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php index 2e6225f2..6dcd204a 100644 --- a/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php +++ b/src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php | |||
@@ -21,12 +21,14 @@ class WallabagV2Controller extends Controller | |||
21 | 21 | ||
22 | if ($form->isValid()) { | 22 | if ($form->isValid()) { |
23 | $file = $form->get('file')->getData(); | 23 | $file = $form->get('file')->getData(); |
24 | $markAsRead = $form->get('mark_as_read')->getData(); | ||
24 | $name = $this->getUser()->getId().'.json'; | 25 | $name = $this->getUser()->getId().'.json'; |
25 | 26 | ||
26 | if (in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes')) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { | 27 | if (in_array($file->getClientMimeType(), $this->getParameter('wallabag_import.allow_mimetypes')) && $file->move($this->getParameter('wallabag_import.resource_dir'), $name)) { |
27 | $res = $wallabag | 28 | $res = $wallabag |
28 | ->setUser($this->getUser()) | 29 | ->setUser($this->getUser()) |
29 | ->setFilepath($this->getParameter('wallabag_import.resource_dir').'/'.$name) | 30 | ->setFilepath($this->getParameter('wallabag_import.resource_dir').'/'.$name) |
31 | ->setMarkAsRead($markAsRead) | ||
30 | ->import(); | 32 | ->import(); |
31 | 33 | ||
32 | $message = 'Import failed, please try again.'; | 34 | $message = 'Import failed, please try again.'; |
diff --git a/src/Wallabag/ImportBundle/Form/Type/UploadImportType.php b/src/Wallabag/ImportBundle/Form/Type/UploadImportType.php index 2e6b59cb..38670379 100644 --- a/src/Wallabag/ImportBundle/Form/Type/UploadImportType.php +++ b/src/Wallabag/ImportBundle/Form/Type/UploadImportType.php | |||
@@ -6,6 +6,7 @@ use Symfony\Component\Form\AbstractType; | |||
6 | use Symfony\Component\Form\FormBuilderInterface; | 6 | use Symfony\Component\Form\FormBuilderInterface; |
7 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; | 7 | use Symfony\Component\Form\Extension\Core\Type\SubmitType; |
8 | use Symfony\Component\Form\Extension\Core\Type\FileType; | 8 | use Symfony\Component\Form\Extension\Core\Type\FileType; |
9 | use Symfony\Component\Form\Extension\Core\Type\CheckboxType; | ||
9 | 10 | ||
10 | class UploadImportType extends AbstractType | 11 | class UploadImportType extends AbstractType |
11 | { | 12 | { |
@@ -13,6 +14,10 @@ class UploadImportType extends AbstractType | |||
13 | { | 14 | { |
14 | $builder | 15 | $builder |
15 | ->add('file', FileType::class) | 16 | ->add('file', FileType::class) |
17 | ->add('mark_as_read', CheckboxType::class, array( | ||
18 | 'label' => 'Mark all as read', | ||
19 | 'required' => false, | ||
20 | )) | ||
16 | ->add('save', SubmitType::class) | 21 | ->add('save', SubmitType::class) |
17 | ; | 22 | ; |
18 | } | 23 | } |
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index 5dfd098c..238ddbd1 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php | |||
@@ -22,6 +22,7 @@ class PocketImport implements ImportInterface | |||
22 | private $consumerKey; | 22 | private $consumerKey; |
23 | private $skippedEntries = 0; | 23 | private $skippedEntries = 0; |
24 | private $importedEntries = 0; | 24 | private $importedEntries = 0; |
25 | private $markAsRead; | ||
25 | protected $accessToken; | 26 | protected $accessToken; |
26 | 27 | ||
27 | public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, Config $craueConfig) | 28 | public function __construct(TokenStorageInterface $tokenStorage, EntityManager $em, ContentProxy $contentProxy, Config $craueConfig) |
@@ -124,6 +125,26 @@ class PocketImport implements ImportInterface | |||
124 | } | 125 | } |
125 | 126 | ||
126 | /** | 127 | /** |
128 | * Set whether articles must be all marked as read. | ||
129 | * | ||
130 | * @param bool $markAsRead | ||
131 | */ | ||
132 | public function setMarkAsRead($markAsRead) | ||
133 | { | ||
134 | $this->markAsRead = $markAsRead; | ||
135 | |||
136 | return $this; | ||
137 | } | ||
138 | |||
139 | /** | ||
140 | * Get whether articles must be all marked as read. | ||
141 | */ | ||
142 | public function getRead() | ||
143 | { | ||
144 | return $this->markAsRead; | ||
145 | } | ||
146 | |||
147 | /** | ||
127 | * {@inheritdoc} | 148 | * {@inheritdoc} |
128 | */ | 149 | */ |
129 | public function import() | 150 | public function import() |
@@ -201,7 +222,7 @@ class PocketImport implements ImportInterface | |||
201 | $entry = $this->contentProxy->updateEntry($entry, $url); | 222 | $entry = $this->contentProxy->updateEntry($entry, $url); |
202 | 223 | ||
203 | // 0, 1, 2 - 1 if the item is archived - 2 if the item should be deleted | 224 | // 0, 1, 2 - 1 if the item is archived - 2 if the item should be deleted |
204 | if ($pocketEntry['status'] == 1) { | 225 | if ($pocketEntry['status'] == 1 || $this->markAsRead) { |
205 | $entry->setArchived(true); | 226 | $entry->setArchived(true); |
206 | } | 227 | } |
207 | 228 | ||
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php index 05bdb401..1d773d3b 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php | |||
@@ -19,6 +19,7 @@ class WallabagV1Import implements ImportInterface | |||
19 | protected $skippedEntries = 0; | 19 | protected $skippedEntries = 0; |
20 | protected $importedEntries = 0; | 20 | protected $importedEntries = 0; |
21 | protected $filepath; | 21 | protected $filepath; |
22 | protected $markAsRead; | ||
22 | 23 | ||
23 | public function __construct(EntityManager $em, ContentProxy $contentProxy) | 24 | public function __construct(EntityManager $em, ContentProxy $contentProxy) |
24 | { | 25 | { |
@@ -121,6 +122,18 @@ class WallabagV1Import implements ImportInterface | |||
121 | } | 122 | } |
122 | 123 | ||
123 | /** | 124 | /** |
125 | * Set whether articles must be all marked as read. | ||
126 | * | ||
127 | * @param bool $markAsRead | ||
128 | */ | ||
129 | public function setMarkAsRead($markAsRead) | ||
130 | { | ||
131 | $this->markAsRead = $markAsRead; | ||
132 | |||
133 | return $this; | ||
134 | } | ||
135 | |||
136 | /** | ||
124 | * @param $entries | 137 | * @param $entries |
125 | */ | 138 | */ |
126 | protected function parseEntries($entries) | 139 | protected function parseEntries($entries) |
@@ -160,7 +173,7 @@ class WallabagV1Import implements ImportInterface | |||
160 | ); | 173 | ); |
161 | } | 174 | } |
162 | 175 | ||
163 | $entry->setArchived($importedEntry['is_read']); | 176 | $entry->setArchived($importedEntry['is_read'] || $this->markAsRead); |
164 | $entry->setStarred($importedEntry['is_fav']); | 177 | $entry->setStarred($importedEntry['is_fav']); |
165 | 178 | ||
166 | $this->em->persist($entry); | 179 | $this->em->persist($entry); |
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV2Import.php b/src/Wallabag/ImportBundle/Import/WallabagV2Import.php index 7125eabc..c4bac561 100644 --- a/src/Wallabag/ImportBundle/Import/WallabagV2Import.php +++ b/src/Wallabag/ImportBundle/Import/WallabagV2Import.php | |||
@@ -51,7 +51,7 @@ class WallabagV2Import extends WallabagV1Import implements ImportInterface | |||
51 | $entry = new Entry($this->user); | 51 | $entry = new Entry($this->user); |
52 | $entry->setUrl($importedEntry['url']); | 52 | $entry->setUrl($importedEntry['url']); |
53 | $entry->setTitle($importedEntry['title']); | 53 | $entry->setTitle($importedEntry['title']); |
54 | $entry->setArchived($importedEntry['is_archived']); | 54 | $entry->setArchived($importedEntry['is_archived'] || $this->markAsRead); |
55 | $entry->setStarred($importedEntry['is_starred']); | 55 | $entry->setStarred($importedEntry['is_starred']); |
56 | $entry->setContent($importedEntry['content']); | 56 | $entry->setContent($importedEntry['content']); |
57 | $entry->setReadingTime($importedEntry['reading_time']); | 57 | $entry->setReadingTime($importedEntry['reading_time']); |
diff --git a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig index 8aa5da97..3365fc6a 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig | |||
@@ -19,6 +19,13 @@ | |||
19 | <blockquote>{{ import.description|trans }}</blockquote> | 19 | <blockquote>{{ import.description|trans }}</blockquote> |
20 | <p>{% trans %}You can import your data from your Pocket account. You just have to click on the below button and authorize the application to connect to getpocket.com.{% endtrans %}</p> | 20 | <p>{% trans %}You can import your data from your Pocket account. You just have to click on the below button and authorize the application to connect to getpocket.com.{% endtrans %}</p> |
21 | <form method="post" action="{{ path('import_pocket_auth') }}"> | 21 | <form method="post" action="{{ path('import_pocket_auth') }}"> |
22 | <div class="row"> | ||
23 | <div class="input-field col s6 with-checkbox"> | ||
24 | <h6>{% trans %}Mark all as read ?{% endtrans %}</h6> | ||
25 | {{ form_widget(form.read) }} | ||
26 | <label for="form_read">{% trans %}Mark all imported entries as read{% endtrans %}</label> | ||
27 | </div> | ||
28 | </div> | ||
22 | <button class="btn waves-effect waves-light" type="submit" name="action"> | 29 | <button class="btn waves-effect waves-light" type="submit" name="action"> |
23 | {% trans %}Connect to Pocket and import data{% endtrans %} | 30 | {% trans %}Connect to Pocket and import data{% endtrans %} |
24 | </button> | 31 | </button> |
diff --git a/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig index 1359f2e4..a418ed1c 100644 --- a/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig | |||
@@ -22,6 +22,11 @@ | |||
22 | <input class="file-path validate" type="text"> | 22 | <input class="file-path validate" type="text"> |
23 | </div> | 23 | </div> |
24 | </div> | 24 | </div> |
25 | <div class="input-field col s6 with-checkbox"> | ||
26 | <h6>{% trans %}Mark all as read ?{% endtrans %}</h6> | ||
27 | {{ form_widget(form.mark_as_read) }} | ||
28 | <label for="upload_import_file_mark_as_read">{% trans %}Mark all imported entries as read{% endtrans %}</label> | ||
29 | </div> | ||
25 | </div> | 30 | </div> |
26 | <div class="hidden">{{ form_rest(form) }}</div> | 31 | <div class="hidden">{{ form_rest(form) }}</div> |
27 | <button class="btn waves-effect waves-light" type="submit" name="action"> | 32 | <button class="btn waves-effect waves-light" type="submit" name="action"> |
diff --git a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php index 819bb0e6..7f97b0f5 100644 --- a/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php +++ b/src/Wallabag/ImportBundle/Tests/Controller/WallabagV1ControllerTest.php | |||
@@ -58,6 +58,50 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase | |||
58 | $this->assertContains('Import summary', $alert[0]); | 58 | $this->assertContains('Import summary', $alert[0]); |
59 | } | 59 | } |
60 | 60 | ||
61 | public function testImportWallabagWithFileAndMarkAllAsRead() | ||
62 | { | ||
63 | $this->logInAs('admin'); | ||
64 | $client = $this->getClient(); | ||
65 | |||
66 | $crawler = $client->request('GET', '/import/wallabag-v1'); | ||
67 | $form = $crawler->filter('form[name=upload_import_file] > button[type=submit]')->form(); | ||
68 | |||
69 | $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1-read.json', 'wallabag-v1-read.json'); | ||
70 | |||
71 | $data = array( | ||
72 | 'upload_import_file[file]' => $file, | ||
73 | 'upload_import_file[mark_as_read]' => 1, | ||
74 | ); | ||
75 | |||
76 | $client->submit($form, $data); | ||
77 | |||
78 | $this->assertEquals(302, $client->getResponse()->getStatusCode()); | ||
79 | |||
80 | $crawler = $client->followRedirect(); | ||
81 | |||
82 | $content1 = $client->getContainer() | ||
83 | ->get('doctrine.orm.entity_manager') | ||
84 | ->getRepository('WallabagCoreBundle:Entry') | ||
85 | ->findByUrlAndUserId( | ||
86 | 'http://gilbert.pellegrom.me/recreating-the-square-slider', | ||
87 | $this->getLoggedInUserId() | ||
88 | ); | ||
89 | |||
90 | $this->assertTrue($content1->isArchived()); | ||
91 | |||
92 | $content2 = $client->getContainer() | ||
93 | ->get('doctrine.orm.entity_manager') | ||
94 | ->getRepository('WallabagCoreBundle:Entry') | ||
95 | ->findByUrlAndUserId( | ||
96 | 'https://www.wallabag.org/features/', | ||
97 | $this->getLoggedInUserId() | ||
98 | ); | ||
99 | |||
100 | $this->assertTrue($content2->isArchived()); | ||
101 | |||
102 | $this->assertContains('Import summary', $client->getResponse()->getContent()); | ||
103 | } | ||
104 | |||
61 | public function testImportWallabagWithEmptyFile() | 105 | public function testImportWallabagWithEmptyFile() |
62 | { | 106 | { |
63 | $this->logInAs('admin'); | 107 | $this->logInAs('admin'); |
diff --git a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php index f44786b1..bc9e2f42 100644 --- a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php +++ b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php | |||
@@ -3,6 +3,7 @@ | |||
3 | namespace Wallabag\ImportBundle\Tests\Import; | 3 | namespace Wallabag\ImportBundle\Tests\Import; |
4 | 4 | ||
5 | use Wallabag\UserBundle\Entity\User; | 5 | use Wallabag\UserBundle\Entity\User; |
6 | use Wallabag\CoreBundle\Entity\Entry; | ||
6 | use Wallabag\ImportBundle\Import\PocketImport; | 7 | use Wallabag\ImportBundle\Import\PocketImport; |
7 | use GuzzleHttp\Client; | 8 | use GuzzleHttp\Client; |
8 | use GuzzleHttp\Subscriber\Mock; | 9 | use GuzzleHttp\Subscriber\Mock; |
@@ -265,9 +266,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase | |||
265 | ->method('getRepository') | 266 | ->method('getRepository') |
266 | ->willReturn($entryRepo); | 267 | ->willReturn($entryRepo); |
267 | 268 | ||
268 | $entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry') | 269 | $entry = new Entry($this->user); |
269 | ->disableOriginalConstructor() | ||
270 | ->getMock(); | ||
271 | 270 | ||
272 | $this->contentProxy | 271 | $this->contentProxy |
273 | ->expects($this->once()) | 272 | ->expects($this->once()) |
@@ -283,6 +282,95 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase | |||
283 | $this->assertEquals(['skipped' => 1, 'imported' => 1], $pocketImport->getSummary()); | 282 | $this->assertEquals(['skipped' => 1, 'imported' => 1], $pocketImport->getSummary()); |
284 | } | 283 | } |
285 | 284 | ||
285 | /** | ||
286 | * Will sample results from https://getpocket.com/developer/docs/v3/retrieve. | ||
287 | */ | ||
288 | public function testImportAndMarkAllAsRead() | ||
289 | { | ||
290 | $client = new Client(); | ||
291 | |||
292 | $mock = new Mock([ | ||
293 | new Response(200, ['Content-Type' => 'application/json'], Stream::factory(json_encode(['access_token' => 'wunderbar_token']))), | ||
294 | new Response(200, ['Content-Type' => 'application/json'], Stream::factory(' | ||
295 | { | ||
296 | "status": 1, | ||
297 | "list": { | ||
298 | "229279689": { | ||
299 | "item_id": "229279689", | ||
300 | "resolved_id": "229279689", | ||
301 | "given_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview", | ||
302 | "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland", | ||
303 | "favorite": "1", | ||
304 | "status": "1", | ||
305 | "resolved_title": "The Massive Ryder Cup Preview", | ||
306 | "resolved_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview", | ||
307 | "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.", | ||
308 | "is_article": "1", | ||
309 | "has_video": "1", | ||
310 | "has_image": "1", | ||
311 | "word_count": "3197" | ||
312 | }, | ||
313 | "229279690": { | ||
314 | "item_id": "229279689", | ||
315 | "resolved_id": "229279689", | ||
316 | "given_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview/2", | ||
317 | "given_title": "The Massive Ryder Cup Preview - The Triangle Blog - Grantland", | ||
318 | "favorite": "1", | ||
319 | "status": "0", | ||
320 | "resolved_title": "The Massive Ryder Cup Preview", | ||
321 | "resolved_url": "http://www.grantland.com/blog/the-triangle/post/_/id/38347/ryder-cup-preview", | ||
322 | "excerpt": "The list of things I love about the Ryder Cup is so long that it could fill a (tedious) novel, and golf fans can probably guess most of them.", | ||
323 | "is_article": "1", | ||
324 | "has_video": "0", | ||
325 | "has_image": "0", | ||
326 | "word_count": "3197" | ||
327 | } | ||
328 | } | ||
329 | } | ||
330 | ')), | ||
331 | ]); | ||
332 | |||
333 | $client->getEmitter()->attach($mock); | ||
334 | |||
335 | $pocketImport = $this->getPocketImport(); | ||
336 | |||
337 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | ||
338 | ->disableOriginalConstructor() | ||
339 | ->getMock(); | ||
340 | |||
341 | $entryRepo->expects($this->exactly(2)) | ||
342 | ->method('findByUrlAndUserId') | ||
343 | ->will($this->onConsecutiveCalls(false, false)); | ||
344 | |||
345 | $this->em | ||
346 | ->expects($this->exactly(2)) | ||
347 | ->method('getRepository') | ||
348 | ->willReturn($entryRepo); | ||
349 | |||
350 | // check that every entry persisted are archived | ||
351 | $this->em | ||
352 | ->expects($this->any()) | ||
353 | ->method('persist') | ||
354 | ->with($this->callback(function($persistedEntry) { | ||
355 | return $persistedEntry->isArchived(); | ||
356 | })); | ||
357 | |||
358 | $entry = new Entry($this->user); | ||
359 | |||
360 | $this->contentProxy | ||
361 | ->expects($this->exactly(2)) | ||
362 | ->method('updateEntry') | ||
363 | ->willReturn($entry); | ||
364 | |||
365 | $pocketImport->setClient($client); | ||
366 | $pocketImport->authorize('wunderbar_code'); | ||
367 | |||
368 | $res = $pocketImport->setMarkAsRead(true)->import(); | ||
369 | |||
370 | $this->assertTrue($res); | ||
371 | $this->assertEquals(['skipped' => 0, 'imported' => 2], $pocketImport->getSummary()); | ||
372 | } | ||
373 | |||
286 | public function testImportBadResponse() | 374 | public function testImportBadResponse() |
287 | { | 375 | { |
288 | $client = new Client(); | 376 | $client = new Client(); |
diff --git a/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php index 9a563a11..fbcd270d 100644 --- a/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php +++ b/src/Wallabag/ImportBundle/Tests/Import/WallabagV1ImportTest.php | |||
@@ -81,6 +81,39 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase | |||
81 | $this->assertEquals(['skipped' => 1, 'imported' => 3], $wallabagV1Import->getSummary()); | 81 | $this->assertEquals(['skipped' => 1, 'imported' => 3], $wallabagV1Import->getSummary()); |
82 | } | 82 | } |
83 | 83 | ||
84 | public function testImportAndMarkAllAsRead() | ||
85 | { | ||
86 | $wallabagV1Import = $this->getWallabagV1Import(); | ||
87 | $wallabagV1Import->setFilepath(__DIR__.'/../fixtures/wallabag-v1-read.json'); | ||
88 | |||
89 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | ||
90 | ->disableOriginalConstructor() | ||
91 | ->getMock(); | ||
92 | |||
93 | $entryRepo->expects($this->exactly(3)) | ||
94 | ->method('findByUrlAndUserId') | ||
95 | ->will($this->onConsecutiveCalls(false, false, false)); | ||
96 | |||
97 | $this->em | ||
98 | ->expects($this->any()) | ||
99 | ->method('getRepository') | ||
100 | ->willReturn($entryRepo); | ||
101 | |||
102 | // check that every entry persisted are archived | ||
103 | $this->em | ||
104 | ->expects($this->any()) | ||
105 | ->method('persist') | ||
106 | ->with($this->callback(function($persistedEntry) { | ||
107 | return $persistedEntry->isArchived(); | ||
108 | })); | ||
109 | |||
110 | $res = $wallabagV1Import->setMarkAsRead(true)->import(); | ||
111 | |||
112 | $this->assertTrue($res); | ||
113 | |||
114 | $this->assertEquals(['skipped' => 0, 'imported' => 3], $wallabagV1Import->getSummary()); | ||
115 | } | ||
116 | |||
84 | public function testImportBadFile() | 117 | public function testImportBadFile() |
85 | { | 118 | { |
86 | $wallabagV1Import = $this->getWallabagV1Import(); | 119 | $wallabagV1Import = $this->getWallabagV1Import(); |
diff --git a/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php index 3268cd3e..c461168c 100644 --- a/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php +++ b/src/Wallabag/ImportBundle/Tests/Import/WallabagV2ImportTest.php | |||
@@ -72,6 +72,39 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase | |||
72 | $this->assertEquals(['skipped' => 1, 'imported' => 2], $wallabagV2Import->getSummary()); | 72 | $this->assertEquals(['skipped' => 1, 'imported' => 2], $wallabagV2Import->getSummary()); |
73 | } | 73 | } |
74 | 74 | ||
75 | public function testImportAndMarkAllAsRead() | ||
76 | { | ||
77 | $wallabagV2Import = $this->getWallabagV2Import(); | ||
78 | $wallabagV2Import->setFilepath(__DIR__.'/../fixtures/wallabag-v2-read.json'); | ||
79 | |||
80 | $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') | ||
81 | ->disableOriginalConstructor() | ||
82 | ->getMock(); | ||
83 | |||
84 | $entryRepo->expects($this->exactly(2)) | ||
85 | ->method('findByUrlAndUserId') | ||
86 | ->will($this->onConsecutiveCalls(false, false)); | ||
87 | |||
88 | $this->em | ||
89 | ->expects($this->any()) | ||
90 | ->method('getRepository') | ||
91 | ->willReturn($entryRepo); | ||
92 | |||
93 | // check that every entry persisted are archived | ||
94 | $this->em | ||
95 | ->expects($this->any()) | ||
96 | ->method('persist') | ||
97 | ->with($this->callback(function($persistedEntry) { | ||
98 | return $persistedEntry->isArchived(); | ||
99 | })); | ||
100 | |||
101 | $res = $wallabagV2Import->setMarkAsRead(true)->import(); | ||
102 | |||
103 | $this->assertTrue($res); | ||
104 | |||
105 | $this->assertEquals(['skipped' => 0, 'imported' => 2], $wallabagV2Import->getSummary()); | ||
106 | } | ||
107 | |||
75 | public function testImportBadFile() | 108 | public function testImportBadFile() |
76 | { | 109 | { |
77 | $wallabagV1Import = $this->getWallabagV2Import(); | 110 | $wallabagV1Import = $this->getWallabagV2Import(); |
diff --git a/src/Wallabag/ImportBundle/Tests/fixtures/wallabag-v1-read.json b/src/Wallabag/ImportBundle/Tests/fixtures/wallabag-v1-read.json new file mode 100644 index 00000000..c4d1cf58 --- /dev/null +++ b/src/Wallabag/ImportBundle/Tests/fixtures/wallabag-v1-read.json | |||
@@ -0,0 +1,53 @@ | |||
1 | [ | ||
2 | { | ||
3 | "0": "3", | ||
4 | "1": "Features - wallabag", | ||
5 | "2": "https://www.wallabag.org/features/", | ||
6 | "3": "0", | ||
7 | "4": "1", | ||
8 | "5": "\n\t\t<p>Here are some features. If one is missing, you can <a href=\"https://github.com/wallabag/wallabag\">open a new issue</a>.</p>\n<ul class=\"list-group\"><li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> wallabag is free and open source. Forever.</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> No time to read? Save a link in your wallabag to read it later</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> Read the saved articles in a comfortable view: the content, only the content</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> You save all the content: text and pictures</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> You can easily migrate from others private services.</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> You like an article? Share it by email, on twitter or in your <a href=\"https://github.com/sebsauvage/Shaarli\">shaarli</a></li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> Because we are increasingly mobile, wallabag fits all your devices</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> Saving a link is so easy because we provide you many tools: extensions for Chrome and Firefox, iOS, Android and Windows Phone application, a bookmarklet, a simple field in your config webpage. <a title=\"Download wallabag\" href=\"https://www.wallabag.org/downloads/\">You can download third-party applications here</a>.</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> RSS feeds allows you to read your saved links in your RSS agregator</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> You can set tags to your entries.</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> wallabag is multilingual: french, english, spanish, german, italian, russian, persian, czech, polish, ukrainian and slovienian.</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> You’re not the only one at home to use wallabag? it’s good, wallabag is multi users</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> You prefer a dark template? Perfect, many templates are available in the configuration screen</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> Many storage allowed: sqlite, mysql and postgresql</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> Scroll position is saved: when you return on an article, you come back where you was. So convenient!</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> You can flattr flattrable articles directly from your wallabag</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> You want to retrieve your wallabag datas? hey, remember, wallabag is open source, you can export it</li>\n</ul>", | ||
9 | "6": "1", | ||
10 | "id": "3", | ||
11 | "title": "Features - wallabag", | ||
12 | "url": "https://www.wallabag.org/features/", | ||
13 | "is_read": "0", | ||
14 | "is_fav": "1", | ||
15 | "content": "\n\t\t<p>Here are some features. If one is missing, you can <a href=\"https://github.com/wallabag/wallabag\">open a new issue</a>.</p>\n<ul class=\"list-group\"><li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> wallabag is free and open source. Forever.</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> No time to read? Save a link in your wallabag to read it later</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> Read the saved articles in a comfortable view: the content, only the content</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> You save all the content: text and pictures</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> You can easily migrate from others private services.</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> You like an article? Share it by email, on twitter or in your <a href=\"https://github.com/sebsauvage/Shaarli\">shaarli</a></li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> Because we are increasingly mobile, wallabag fits all your devices</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> Saving a link is so easy because we provide you many tools: extensions for Chrome and Firefox, iOS, Android and Windows Phone application, a bookmarklet, a simple field in your config webpage. <a title=\"Download wallabag\" href=\"https://www.wallabag.org/downloads/\">You can download third-party applications here</a>.</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> RSS feeds allows you to read your saved links in your RSS agregator</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> You can set tags to your entries.</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> wallabag is multilingual: french, english, spanish, german, italian, russian, persian, czech, polish, ukrainian and slovienian.</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> You’re not the only one at home to use wallabag? it’s good, wallabag is multi users</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> You prefer a dark template? Perfect, many templates are available in the configuration screen</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> Many storage allowed: sqlite, mysql and postgresql</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> Scroll position is saved: when you return on an article, you come back where you was. So convenient!</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> You can flattr flattrable articles directly from your wallabag</li>\n<li class=\"list-group-item\"><span class=\"glyphicon glyphicon-ok\"></span> You want to retrieve your wallabag datas? hey, remember, wallabag is open source, you can export it</li>\n</ul>", | ||
16 | "user_id": "1", | ||
17 | "tags": "" | ||
18 | }, | ||
19 | { | ||
20 | "0": "10", | ||
21 | "1": "Recreating The Square Slider", | ||
22 | "2": "http://gilbert.pellegrom.me/recreating-the-square-slider", | ||
23 | "3": "0", | ||
24 | "4": "0", | ||
25 | "5": "<p>The new <a href=\"https://squareup.com\">Square</a> site is lovely and I really like the slider they have on the homepage. So I decided to try and recreate it in a simple and reusable way.</p>\n\n<p> \n <a href=\"http://gilbert.pellegrom.me/demo/square-slider\">Demo</a> | <a href=\"http://dev7studios.com/downloads/50\">Download</a>\n</p>\n\n\n\n<h3>The HTML</h3>\n\n<pre class=\"language-markup\"><code><div class=\"square-slider\"> \n <div class=\"slide slide1\">\n <div class=\"content light\">\n <h3>Recreating The Square Slider</h3>\n <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac eros et augue vulputate \n aliquet pellentesque vitae tortor. Pellentesque mi velit, euismod nec semper</p>\n </div>\n <img src=\"images/asset1.png\" alt=\"\" class=\"asset\" />\n </div>\n <div class=\"slide slide2\">\n <div class=\"content dark\">\n <h3>Looks Amazing Right?</h3>\n <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac eros et augue vulputate \n aliquet pellentesque vitae tortor. Pellentesque mi velit, euismod nec semper</p>\n </div>\n <img src=\"images/asset2.png\" alt=\"\" class=\"asset\" />\n </div>\n <div class=\"slide slide3 inverted\">\n <div class=\"content light\">\n <h3>And Simple To Use</h3>\n <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac eros et augue vulputate \n aliquet pellentesque vitae tortor. Pellentesque mi velit, euismod nec semper</p>\n </div>\n <img src=\"images/asset3.png\" alt=\"\" class=\"asset\" />\n </div>\n <a href=\"#\" class=\"prev\">Prev</a>\n <a href=\"#\" class=\"next\">Next</a>\n <div class=\"overlay\"></div>\n</div></code></pre>\n\n<h3>The CSS</h3>\n\n<pre class=\"language-css\"><code>.square-slider { \n overflow: hidden;\n position: relative;\n background: #fff;\n}\n.square-slider .slide {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: none;\n opacity: 0;\n -moz-opacity: 0;\n -moz-transition: opacity 800ms cubic-bezier(0.51, 0.01, 0.37, 0.98) 100ms;\n -webkit-transition: opacity 800ms cubic-bezier(0.51, 0.01, 0.37, 0.98) 100ms;\n -o-transition: opacity 800ms cubic-bezier(0.51, 0.01, 0.37, 0.98) 100ms;\n transition: opacity 800ms cubic-bezier(0.51, 0.01, 0.37, 0.98) 100ms;\n -moz-transform: translate3d(0, 0, 0);\n -webkit-transform: translate3d(0, 0, 0);\n -o-transform: translate3d(0, 0, 0);\n -ms-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n}\n.square-slider .slide:first-child { display: block; }\n.square-slider .slide:first-child,\n.square-slider .slide.active {\n opacity: 1;\n -moz-opacity: 1;\n}\n.square-slider .slide .content {\n position: absolute;\n top: 40%;\n left: 50%;\n margin-left: -450px;\n width: 360px;\n text-shadow: 0 1px 1px rgba(0,0,0,0.3);\n z-index: 7;\n -webkit-transition-property: -webkit-transform,opacity;\n -moz-transition-property: -moz-transform,opacity;\n -webkit-transition-duration: 800ms,700ms;\n -moz-transition-duration: 800ms,700ms;\n -webkit-transition-timing-function: cubic-bezier(0.51, 0.01, 0.37, 0.98);\n -moz-transition-timing-function: cubic-bezier(0.51, 0.01, 0.37, 0.98);\n -webkit-transform: translate3d(-30px, 0, 0);\n -moz-transform: translate(-30px, 0);\n}\n.square-slider .slide.inverted .content {\n left: auto;\n right: 50%;\n margin-left: 0;\n margin-right: -450px;\n -webkit-transform: translate3d(30px, 0, 0);\n -moz-transform: translate(30px, 0);\n}\n.square-slider .slide.active .content {\n -webkit-transform: translate3d(0, 0, 0);\n -moz-transform: translate(0, 0);\n}\n.square-slider .slide .asset {\n position: absolute;\n bottom: 0;\n left: 50%;\n -webkit-transition-property: -webkit-transform,opacity;\n -moz-transition-property: -moz-transform,opacity;\n -webkit-transition-duration: 800ms,700ms;\n -moz-transition-duration: 800ms,700ms;\n -webkit-transition-timing-function: cubic-bezier(0.51, 0.01, 0.37, 0.98);\n -moz-transition-timing-function: cubic-bezier(0.51, 0.01, 0.37, 0.98);\n -webkit-transform: translate3d(0, 0, 0);\n -moz-transform: translate(0, 0);\n}\n.square-slider .slide.inverted .asset {\n left: auto;\n right: 50%;\n}\n.square-slider .slide.active .asset {\n -webkit-transform: translate3d(-7px, 3px, 0);\n -moz-transform: translate(-7px, 3px);\n}\n.square-slider .slide.inverted.active .asset {\n -webkit-transform: translate3d(7px, 3px, 0);\n -moz-transform: translate(7px, 3px);\n}\n.square-slider .prev,\n.square-slider .next {\n background: url(images/nav.png) no-repeat;\n display: block;\n width: 67px;\n height: 67px;\n position: absolute;\n top: 50%;\n margin-top: -30px;\n z-index: 10;\n border: 0;\n text-indent: -9999px;\n display: none;\n opacity: 0.6;\n -moz-opacity: 0.6;\n -webkit-transition: opacity 0.5s ease-in;\n -moz-transition: opacity 0.5s ease-in;\n -ms-transition: opacity 0.5s ease-in;\n -o-transition: opacity 0.5s ease-in;\n transition: opacity 0.5s ease-in;\n}\n.square-slider .prev { \n left: 40px; \n background-position: 0 100%;\n}\n.square-slider .next { right: 40px; }\n.square-slider .prev:hover,\n.square-slider .next:hover {\n opacity: 1;\n -moz-opacity: 1;\n}\n.square-slider .overlay {\n position: absolute;\n top: 0;\n left: -100%;\n width: 300%;\n height: 100%;\n z-index: 5;\n -moz-box-shadow: inset 0px 0px 10px rgba(0,0,0,0.3);\n -webkit-box-shadow: inset 0px 0px 10px rgba(0,0,0,0.3);\n box-shadow: inset 0px 0px 10px rgba(0,0,0,0.3);\n}\n\n\n.square-slider {\n width: 100%;\n height: 550px;\n margin: 40px auto;\n}\n.square-slider .slide .content.light { color: #fff; }\n.square-slider .slide .content.dark { \n color: #333; \n text-shadow: 0 1px 1px rgba(255,255,255,0.3);\n}\n.square-slider .slide1 { background: url(images/bg1.jpg) no-repeat 50% 50%; }\n.square-slider .slide2 { background: url(images/bg2.jpg) no-repeat 50% 50%; }\n.square-slider .slide3 { background: url(images/bg3.jpg) no-repeat 50% 50%; }</code></pre>\n\n<h3>The Javascript (jQuery)</h3>\n\n<pre class=\"language-javascript\"><code>(function($){\n\n $('.square-slider').each(function(){\n var slider = $(this),\n slides = slider.find('.slide'),\n currentSlide = 0;\n\n slides.show();\n $(slides[currentSlide]).addClass('active');\n $('.next,.prev', slider).show();\n\n $('.prev', slider).on('click', function(){\n slides.removeClass('active');\n currentSlide--;\n if(currentSlide < 0) currentSlide = slides.length - 1;\n $(slides[currentSlide]).addClass('active');\n return false;\n });\n\n $('.next', slider).on('click', function(){\n slides.removeClass('active');\n currentSlide++;\n if(currentSlide > slides.length - 1) currentSlide = 0;\n $(slides[currentSlide]).addClass('active');\n return false;\n });\n });\n\n})(window.jQuery);</code></pre>\n\n<h3>A Few Notes</h3>\n\n<ul><li>Feel free to <a href=\"http://dev7studios.com/downloads/50\">download the source</a> and customise and use it in your own sites. <strong>Don’t</strong> use the images as they belong to <a href=\"https://squareup.com\">Square Inc</a>.</li>\n<li>Add the <code>.inverted</code> class to a <code>.slide</code> div to swap the position of the asset and content.</li>\n<li>Depending on the background you’ll want to use the <code>.light</code> or <code>.dark</code> class on the <code>.content</code> divs.</li>\n<li>This is pretty much cross browser (as in the slider itself will still work in most browsers, just not with the fancy transitions).</li>\n<li>If javascript is off (really?) it displays the first slide.</li>\n<li>Source code is Public domain.</li>\n</ul><p>Enjoy.</p>\n ", | ||
26 | "6": "1", | ||
27 | "id": "10", | ||
28 | "title": "Recreating The Square Slider", | ||
29 | "url": "http://gilbert.pellegrom.me/recreating-the-square-slider", | ||
30 | "is_read": "0", | ||
31 | "is_fav": "0", | ||
32 | "content": "<p>The new <a href=\"https://squareup.com\">Square</a> site is lovely and I really like the slider they have on the homepage. So I decided to try and recreate it in a simple and reusable way.</p>\n\n<p> \n <a href=\"http://gilbert.pellegrom.me/demo/square-slider\">Demo</a> | <a href=\"http://dev7studios.com/downloads/50\">Download</a>\n</p>\n\n\n\n<h3>The HTML</h3>\n\n<pre class=\"language-markup\"><code><div class=\"square-slider\"> \n <div class=\"slide slide1\">\n <div class=\"content light\">\n <h3>Recreating The Square Slider</h3>\n <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac eros et augue vulputate \n aliquet pellentesque vitae tortor. Pellentesque mi velit, euismod nec semper</p>\n </div>\n <img src=\"images/asset1.png\" alt=\"\" class=\"asset\" />\n </div>\n <div class=\"slide slide2\">\n <div class=\"content dark\">\n <h3>Looks Amazing Right?</h3>\n <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac eros et augue vulputate \n aliquet pellentesque vitae tortor. Pellentesque mi velit, euismod nec semper</p>\n </div>\n <img src=\"images/asset2.png\" alt=\"\" class=\"asset\" />\n </div>\n <div class=\"slide slide3 inverted\">\n <div class=\"content light\">\n <h3>And Simple To Use</h3>\n <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac eros et augue vulputate \n aliquet pellentesque vitae tortor. Pellentesque mi velit, euismod nec semper</p>\n </div>\n <img src=\"images/asset3.png\" alt=\"\" class=\"asset\" />\n </div>\n <a href=\"#\" class=\"prev\">Prev</a>\n <a href=\"#\" class=\"next\">Next</a>\n <div class=\"overlay\"></div>\n</div></code></pre>\n\n<h3>The CSS</h3>\n\n<pre class=\"language-css\"><code>.square-slider { \n overflow: hidden;\n position: relative;\n background: #fff;\n}\n.square-slider .slide {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: none;\n opacity: 0;\n -moz-opacity: 0;\n -moz-transition: opacity 800ms cubic-bezier(0.51, 0.01, 0.37, 0.98) 100ms;\n -webkit-transition: opacity 800ms cubic-bezier(0.51, 0.01, 0.37, 0.98) 100ms;\n -o-transition: opacity 800ms cubic-bezier(0.51, 0.01, 0.37, 0.98) 100ms;\n transition: opacity 800ms cubic-bezier(0.51, 0.01, 0.37, 0.98) 100ms;\n -moz-transform: translate3d(0, 0, 0);\n -webkit-transform: translate3d(0, 0, 0);\n -o-transform: translate3d(0, 0, 0);\n -ms-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n}\n.square-slider .slide:first-child { display: block; }\n.square-slider .slide:first-child,\n.square-slider .slide.active {\n opacity: 1;\n -moz-opacity: 1;\n}\n.square-slider .slide .content {\n position: absolute;\n top: 40%;\n left: 50%;\n margin-left: -450px;\n width: 360px;\n text-shadow: 0 1px 1px rgba(0,0,0,0.3);\n z-index: 7;\n -webkit-transition-property: -webkit-transform,opacity;\n -moz-transition-property: -moz-transform,opacity;\n -webkit-transition-duration: 800ms,700ms;\n -moz-transition-duration: 800ms,700ms;\n -webkit-transition-timing-function: cubic-bezier(0.51, 0.01, 0.37, 0.98);\n -moz-transition-timing-function: cubic-bezier(0.51, 0.01, 0.37, 0.98);\n -webkit-transform: translate3d(-30px, 0, 0);\n -moz-transform: translate(-30px, 0);\n}\n.square-slider .slide.inverted .content {\n left: auto;\n right: 50%;\n margin-left: 0;\n margin-right: -450px;\n -webkit-transform: translate3d(30px, 0, 0);\n -moz-transform: translate(30px, 0);\n}\n.square-slider .slide.active .content {\n -webkit-transform: translate3d(0, 0, 0);\n -moz-transform: translate(0, 0);\n}\n.square-slider .slide .asset {\n position: absolute;\n bottom: 0;\n left: 50%;\n -webkit-transition-property: -webkit-transform,opacity;\n -moz-transition-property: -moz-transform,opacity;\n -webkit-transition-duration: 800ms,700ms;\n -moz-transition-duration: 800ms,700ms;\n -webkit-transition-timing-function: cubic-bezier(0.51, 0.01, 0.37, 0.98);\n -moz-transition-timing-function: cubic-bezier(0.51, 0.01, 0.37, 0.98);\n -webkit-transform: translate3d(0, 0, 0);\n -moz-transform: translate(0, 0);\n}\n.square-slider .slide.inverted .asset {\n left: auto;\n right: 50%;\n}\n.square-slider .slide.active .asset {\n -webkit-transform: translate3d(-7px, 3px, 0);\n -moz-transform: translate(-7px, 3px);\n}\n.square-slider .slide.inverted.active .asset {\n -webkit-transform: translate3d(7px, 3px, 0);\n -moz-transform: translate(7px, 3px);\n}\n.square-slider .prev,\n.square-slider .next {\n background: url(images/nav.png) no-repeat;\n display: block;\n width: 67px;\n height: 67px;\n position: absolute;\n top: 50%;\n margin-top: -30px;\n z-index: 10;\n border: 0;\n text-indent: -9999px;\n display: none;\n opacity: 0.6;\n -moz-opacity: 0.6;\n -webkit-transition: opacity 0.5s ease-in;\n -moz-transition: opacity 0.5s ease-in;\n -ms-transition: opacity 0.5s ease-in;\n -o-transition: opacity 0.5s ease-in;\n transition: opacity 0.5s ease-in;\n}\n.square-slider .prev { \n left: 40px; \n background-position: 0 100%;\n}\n.square-slider .next { right: 40px; }\n.square-slider .prev:hover,\n.square-slider .next:hover {\n opacity: 1;\n -moz-opacity: 1;\n}\n.square-slider .overlay {\n position: absolute;\n top: 0;\n left: -100%;\n width: 300%;\n height: 100%;\n z-index: 5;\n -moz-box-shadow: inset 0px 0px 10px rgba(0,0,0,0.3);\n -webkit-box-shadow: inset 0px 0px 10px rgba(0,0,0,0.3);\n box-shadow: inset 0px 0px 10px rgba(0,0,0,0.3);\n}\n\n\n.square-slider {\n width: 100%;\n height: 550px;\n margin: 40px auto;\n}\n.square-slider .slide .content.light { color: #fff; }\n.square-slider .slide .content.dark { \n color: #333; \n text-shadow: 0 1px 1px rgba(255,255,255,0.3);\n}\n.square-slider .slide1 { background: url(images/bg1.jpg) no-repeat 50% 50%; }\n.square-slider .slide2 { background: url(images/bg2.jpg) no-repeat 50% 50%; }\n.square-slider .slide3 { background: url(images/bg3.jpg) no-repeat 50% 50%; }</code></pre>\n\n<h3>The Javascript (jQuery)</h3>\n\n<pre class=\"language-javascript\"><code>(function($){\n\n $('.square-slider').each(function(){\n var slider = $(this),\n slides = slider.find('.slide'),\n currentSlide = 0;\n\n slides.show();\n $(slides[currentSlide]).addClass('active');\n $('.next,.prev', slider).show();\n\n $('.prev', slider).on('click', function(){\n slides.removeClass('active');\n currentSlide--;\n if(currentSlide < 0) currentSlide = slides.length - 1;\n $(slides[currentSlide]).addClass('active');\n return false;\n });\n\n $('.next', slider).on('click', function(){\n slides.removeClass('active');\n currentSlide++;\n if(currentSlide > slides.length - 1) currentSlide = 0;\n $(slides[currentSlide]).addClass('active');\n return false;\n });\n });\n\n})(window.jQuery);</code></pre>\n\n<h3>A Few Notes</h3>\n\n<ul><li>Feel free to <a href=\"http://dev7studios.com/downloads/50\">download the source</a> and customise and use it in your own sites. <strong>Don’t</strong> use the images as they belong to <a href=\"https://squareup.com\">Square Inc</a>.</li>\n<li>Add the <code>.inverted</code> class to a <code>.slide</code> div to swap the position of the asset and content.</li>\n<li>Depending on the background you’ll want to use the <code>.light</code> or <code>.dark</code> class on the <code>.content</code> divs.</li>\n<li>This is pretty much cross browser (as in the slider itself will still work in most browsers, just not with the fancy transitions).</li>\n<li>If javascript is off (really?) it displays the first slide.</li>\n<li>Source code is Public domain.</li>\n</ul><p>Enjoy.</p>\n ", | ||
33 | "user_id": "1", | ||
34 | "tags": "" | ||
35 | }, | ||
36 | { | ||
37 | "0": "11", | ||
38 | "1": "J’aime le logiciel libre", | ||
39 | "2": "http://framablog.org/2015/02/14/jaime-le-logiciel-libre/", | ||
40 | "3": "0", | ||
41 | "4": "0", | ||
42 | "5": "\n <p>Aujourd’hui, c’est la <em>Saint Valentin</em>, et l’occasion de déclarer son amour des logiciels libres !</p>\n<p><a href=\"https://fsfe.org/campaigns/ilovefs/ilovefs.fr.html\"><img src=\"http://framablog.org/wp-content/uploads/2015/02/ilovefs-banner-extralarge.png\" alt=\"ilovefs-banner-extralarge\" width=\"627\" height=\"105\" class=\"aligncenter size-full wp-image-3239\" /></a></p>\n<p>Framasoft vous a déjà proposé <a href=\"http://framablog.org/2015/02/14/on-love-logiciel-libre/\">son adaptation délirante de poèmes</a> pour l’occasion, et voici une petite bande-dessinée qui synthétise l’événement :</p>\n<p><a href=\"http://framablog.org/wp-content/uploads/2015/02/dm_001_jaime_le_logiciel_libre.jpg\"><img src=\"http://framablog.org/wp-content/uploads/2015/02/dm_001_jaime_le_logiciel_libre.jpg\" alt=\"dm_001_jaime_le_logiciel_libre\" width=\"800\" height=\"1200\" class=\"aligncenter size-full wp-image-3265\" /></a></p>\n<p>Cette bande-dessinée est extraite du nouveau blog <a href=\"http://grisebouille.net/\">Grise Bouille</a> hébergé par Framasoft.</p>\n<p><em>Crédit : <a href=\"http://grisebouille.net/\">Simon Gee Giraudot</a> (Creative Commons By-Sa)</em></p>\n<div title=\"Diaspora*\"><a><span><img src=\"http://www.framablog.org/wp-content/uploads/2015/01/diaspora.jpg\" alt=\"\" /></span></a></div><div class=\"twoclick-js\"></div><div><h3><a href=\"http://framablog.org/author/gee/\" title=\"All posts by Gee\">Gee</a></h3><div class=\"bio-gravatar\"><img alt=\"\" src=\"http://0.gravatar.com/avatar/4f71e4ffe5d4d9d89b16949563cd41f3?s=90&d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D90&r=G\" class=\"avatar pull-left media-object avatar-90 photo\" height=\"90\" width=\"90\" /></div><a href=\"http://ptilouk.net/\" class=\"bio-icon bio-icon-website\"></a><a href=\"https://framasphere.org/u/gee\" class=\"bio-icon bio-icon-facebook\"></a><a href=\"https://twitter.com/ptilouk\" class=\"bio-icon bio-icon-twitter\"></a><p class=\"bio-description\">Auteur/dessinateur de bandes dessinées (Le Geektionnerd, Superflu, Bastards Inc, etc.) et doctorant en informatique sur son temps salarié.</p></div> ", | ||
43 | "6": "1", | ||
44 | "id": "11", | ||
45 | "title": "J’aime le logiciel libre", | ||
46 | "url": "http://framablog.org/2015/02/14/jaime-le-logiciel-libre/", | ||
47 | "is_read": "0", | ||
48 | "is_fav": "0", | ||
49 | "content": "\n <p>Aujourd’hui, c’est la <em>Saint Valentin</em>, et l’occasion de déclarer son amour des logiciels libres !</p>\n<p><a href=\"https://fsfe.org/campaigns/ilovefs/ilovefs.fr.html\"><img src=\"http://framablog.org/wp-content/uploads/2015/02/ilovefs-banner-extralarge.png\" alt=\"ilovefs-banner-extralarge\" width=\"627\" height=\"105\" class=\"aligncenter size-full wp-image-3239\" /></a></p>\n<p>Framasoft vous a déjà proposé <a href=\"http://framablog.org/2015/02/14/on-love-logiciel-libre/\">son adaptation délirante de poèmes</a> pour l’occasion, et voici une petite bande-dessinée qui synthétise l’événement :</p>\n<p><a href=\"http://framablog.org/wp-content/uploads/2015/02/dm_001_jaime_le_logiciel_libre.jpg\"><img src=\"http://framablog.org/wp-content/uploads/2015/02/dm_001_jaime_le_logiciel_libre.jpg\" alt=\"dm_001_jaime_le_logiciel_libre\" width=\"800\" height=\"1200\" class=\"aligncenter size-full wp-image-3265\" /></a></p>\n<p>Cette bande-dessinée est extraite du nouveau blog <a href=\"http://grisebouille.net/\">Grise Bouille</a> hébergé par Framasoft.</p>\n<p><em>Crédit : <a href=\"http://grisebouille.net/\">Simon Gee Giraudot</a> (Creative Commons By-Sa)</em></p>\n<div title=\"Diaspora*\"><a><span><img src=\"http://www.framablog.org/wp-content/uploads/2015/01/diaspora.jpg\" alt=\"\" /></span></a></div><div class=\"twoclick-js\"></div><div><h3><a href=\"http://framablog.org/author/gee/\" title=\"All posts by Gee\">Gee</a></h3><div class=\"bio-gravatar\"><img alt=\"\" src=\"http://0.gravatar.com/avatar/4f71e4ffe5d4d9d89b16949563cd41f3?s=90&d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D90&r=G\" class=\"avatar pull-left media-object avatar-90 photo\" height=\"90\" width=\"90\" /></div><a href=\"http://ptilouk.net/\" class=\"bio-icon bio-icon-website\"></a><a href=\"https://framasphere.org/u/gee\" class=\"bio-icon bio-icon-facebook\"></a><a href=\"https://twitter.com/ptilouk\" class=\"bio-icon bio-icon-twitter\"></a><p class=\"bio-description\">Auteur/dessinateur de bandes dessinées (Le Geektionnerd, Superflu, Bastards Inc, etc.) et doctorant en informatique sur son temps salarié.</p></div> ", | ||
50 | "user_id": "1", | ||
51 | "tags": "framasoft,tag" | ||
52 | } | ||
53 | ] | ||
diff --git a/src/Wallabag/ImportBundle/Tests/fixtures/wallabag-v2-read.json b/src/Wallabag/ImportBundle/Tests/fixtures/wallabag-v2-read.json new file mode 100644 index 00000000..3fa0bddf --- /dev/null +++ b/src/Wallabag/ImportBundle/Tests/fixtures/wallabag-v2-read.json | |||
@@ -0,0 +1,28 @@ | |||
1 | [ | ||
2 | { | ||
3 | "id": 4668, | ||
4 | "title": "Wikimedia Foundation removes The Diary of Anne Frank due to copyright law requirements « Wikimedia blog", | ||
5 | "url": "https://blog.wikimedia.org/2016/02/10/anne-frank-diary-removal/", | ||
6 | "is_archived": true, | ||
7 | "is_starred": false, | ||
8 | "content": "<p><a href=\"https://commons.wikimedia.org/wiki/File:AnneFrankSchoolPhoto.jpg\" rel=\"attachment wp-att-45105\"><img class=\"alignnone size-full wp-image-45105\" src=\"https://wikimediablog.files.wordpress.com/2016/02/annefrankschoolphoto.jpg?w=316&h=520\" alt=\"AnneFrankSchoolPhoto\" width=\"316\" height=\"520\"/></a><br/><small><i>Anne Frank in 1940. <a href=\"https://commons.wikimedia.org/wiki/File:AnneFrankSchoolPhoto.jpg\">Photo</a> by Collectie Anne Frank Stichting Amsterdam, public domain.</i></small></p>\n<p>Today, in an unfortunate example of the overreach of the United States’ current copyright law, the Wikimedia Foundation removed the Dutch-language text of <a href=\"https://en.wikipedia.org/wiki/The_Diary_of_a_Young_Girl\"><em>The Diary of a Young Girl</em></a>—more commonly known in English as the <em>Diary of Anne Frank—</em>from Wikisource.<sup id=\"one\"><a href=\"https://blog.wikimedia.org/2016/02/10/anne-frank-diary-removal/#cite1\">[1]</a></sup></p>\n<p>We took this action to comply with the United States’ <a href=\"https://en.wikipedia.org/wiki/Digital_Millennium_Copyright_Act\">Digital Millennium Copyright Act</a> (DMCA), as we believe the diary is still under US copyright protection under the law as it is currently written. Nevertheless, our removal serves as an excellent example of why the law should be changed to prevent repeated extensions of copyright terms, an issue that has plagued our communities <a href=\"https://en.wikipedia.org/wiki/Wikipedia:Wikipedia_Signpost/2014-02-26/News_and_notes\">for years</a>.</p>\n<h3>What prompted us to remove the diary?</h3>\n<p>The deletion was required because the Foundation is under the jurisdiction of US law and is therefore subject to the DMCA, specifically <a href=\"https://www.law.cornell.edu/uscode/text/17/512\" target=\"_blank\">title 17, chapter 5, section 512 of the United States Code</a>. As we <a href=\"https://meta.wikimedia.org/wiki/Legal/URAA_Statement\" target=\"_blank\">noted</a> in 2013, “The location of the servers, incorporation, and headquarters are just three of many factors that establish US jurisdiction … if infringing content is linked to or embedded in Wikimedia projects, then the Foundation may still be subject to liability for such use—either as a direct or contributory infringer.</p>\n<p>Based on email discussions sent to the Wikimedia Foundation at legal[at]wikimedia.org, we determined that the Wikimedia Foundation had either “actual knowledge” (i in the statute quoted below) or what is commonly called “red flag knowledge” (ii in the statute quoted below) that the Anne Frank text was hosted on Wikisource and was under copyright. The statute section states that a service provider is only protected by the DMCA when it:</p>\n<p><strong>(i) </strong>does not have actual knowledge that the material or an activity using the material on the system or network is infringing;</p>\n<p><strong>(ii) </strong>in the absence of such actual knowledge, is not aware of facts or circumstances from which infringing activity is apparent; or</p>\n<p>(The rest applies when we get a proper DMCA takedown notice.)</p>\n<p>Of particular concern, the US’ <a href=\"https://en.wikipedia.org/wiki/United_States_Court_of_Appeals_for_the_Ninth_Circuit\">9th Circuit Court of Appeals</a> stated in their ruling for <a href=\"http://law.justia.com/cases/federal/appellate-courts/ca9/09-55902/09-55902-2013-03-14.html\"><em>UMG Recordings, Inc. v. Shelter Capital Partners LLC</em></a> that in circumstances where a hosting provider (like the Wikimedia Foundation) is informed by a third party (like an unrelated user) about infringing copyrighted content, that would likely constitute either actual or red flag knowledge under the DMCA.</p>\n<p>We believe, based on the detail and specificity contained in the emails, that we received that we had actual knowledge sufficient for the DMCA to require us to perform a takedown even in the absence of a demand letter.</p>\n<h3>How is the diary still copyrighted?</h3>\n<p>You may wonder why or how the Anne Frank text is copyrighted at all, as <a href=\"https://en.wikipedia.org/wiki/Anne_Frank\">Anne Frank</a> died in February 1945. With 70 years having passed since her death, the text may have passed into public domain in the Netherlands on January 1, 2016, where it was first published, although <a href=\"http://www.npr.org/sections/thetwo-way/2015/12/31/461606275/mein-kampf-enters-public-domain-arguably-anne-franks-diary-may-too\">there is still some dispute about this</a>.</p>\n<p>However, in the United States, the Anne Frank original text will be under copyright until 2042. This is the result of several factors coming together, and the English-language Wikipedia has actually covered this issue with a multi-part test on its <a href=\"https://en.wikipedia.org/wiki/Wikipedia:Non-U.S._copyrights\">non-US copyrights content guideline.</a></p>\n<p>In short, there are three major laws that together make the diary still copyrighted:</p>\n<ol><li>In general, the U.S. copyright for works published before 1978 is 95 years from date of publication. This came about because copyrights in the U.S. were originally for 28 years, with the ability to then extend that for a second 28 years (making a total of 56). Starting with the <a href=\"https://en.wikipedia.org/wiki/Copyright_Act_of_1976\">1976 Copyright Act</a> and extending to several more acts, the renewal became automatic and was extended. Today, the total term of works published before 1978 is 95 years from date of publication.</li>\n<li>Foreign works of countries that are treaty partners to the United States are covered as if they were US works.</li>\n<li>Even if a country was not a treaty partner under copyright law at the time of a publication, the <a href=\"https://en.wikipedia.org/wiki/Uruguay_Round_Agreements_Act\">1994 Uruguay Round Agreements Act</a> (URAA) restored copyright to works that:\n<ul><li>had been published in a foreign country</li>\n<li>were still under copyright in that country in 1996</li>\n<li>and would have had U.S. copyright but for the fact they were published abroad.</li>\n</ul></li>\n</ol>\n<p>Court challenges to the URAA have all failed, with the most notable (<a href=\"https://en.wikipedia.org/wiki/Golan_v._Holder\"><em>Golan v. Holder</em></a>) resulting in a Supreme Court ruling that upheld the URAA.</p>\n<p>What that means for Anne Frank’s diary is unfortunately simple: no matter how it wound up in the United States and regardless of what formal copyright notices they used, the US grants it copyright until the year 2042, or 95 years after its original publication in 1947.</p>\n<p>Under current copyright law, this remains true regardless of its copyright status anywhere else in the world and regardless of whether it may have been in the public domain in the United States in the past.</p>\n<p><a href=\"https://wikimediafoundation.org/wiki/User:Jrogers_(WMF)\"><em>Jacob Rogers</em></a><em>, Legal Counsel*<br/>Wikimedia Foundation</em></p>\n<p><em>*Special thanks to </em><a href=\"https://wikimediafoundation.org/wiki/User:AMangalick_(WMF)\"><em>Anisha Mangalick</em></a><em>, Legal Fellow, for her assistance in this matter.</em></p>\n<p><a href=\"https://blog.wikimedia.org/2016/02/10/anne-frank-diary-removal/#one\">[1]</a> The diary text was originally located at <a href=\"https://nl.wikisource.org/wiki/Het_Achterhuis_(Anne_Frank)\" rel=\"nofollow\">https://nl.wikisource.org/wiki/Het_Achterhuis_(Anne_Frank)</a>.</p>\n<p><em>This article was edited to clarify that it is not just the location of the Wikimedia Foundation’s servers that determine whether we fall in US jurisdiction.</em></p>\n\t\t\t\t\t\t\t\t\t\t\t", | ||
9 | "mimetype": "text/html", | ||
10 | "language": "en", | ||
11 | "reading_time": 4, | ||
12 | "domain_name": "blog.wikimedia.org", | ||
13 | "tags": [] | ||
14 | }, | ||
15 | { | ||
16 | "id": 4667, | ||
17 | "title": "Tails - Tails 2.0.1 is out", | ||
18 | "url": "https://tails.boum.org/news/version_2.0.1/index.en.html", | ||
19 | "is_archived": false, | ||
20 | "is_starred": false, | ||
21 | "content": "<div id=\"pagebody\" readability=\"39\">\n<p>This release fixes <a href=\"https://tails.boum.org/security/Numerous_security_holes_in_2.0/index.en.html\">numerous security issues</a>. All users must upgrade as soon as possible.</p>\n<div class=\"toc\">\n<ol><li class=\"L1\"><a href=\"https://tails.boum.org/news/version_2.0.1/index.en.html#index1h1\">Changes</a></li>\n<li class=\"L1\"><a href=\"https://tails.boum.org/news/version_2.0.1/index.en.html#index2h1\">Known issues</a></li>\n<li class=\"L1\"><a href=\"https://tails.boum.org/news/version_2.0.1/index.en.html#index3h1\">Download or upgrade</a></li>\n<li class=\"L1\"><a href=\"https://tails.boum.org/news/version_2.0.1/index.en.html#index4h1\">What's coming up?</a></li>\n</ol></div>\n<h2>New features</h2>\n<ul><li readability=\"11\">\n<p>Tails now uses the GNOME Shell desktop environment, in its Classic mode. GNOME Shell provides a modern, simple, and actively developed desktop environment. The Classic mode keeps the traditional Applications, Places menu, and windows list. Accessibility and non-Latin input sources are also better integrated.</p>\n<p>To find your way around, <a href=\"https://tails.boum.org/doc/first_steps/introduction_to_gnome_and_the_tails_desktop/index.en.html\">read our introduction to GNOME and the Tails desktop.</a></p>\n<table class=\"img\"><caption>The desktop and Applications menu</caption>\n<tr><td><img alt=\"Tails 2.0 desktop with applications menu unfolded\" class=\"img\" height=\"384\" src=\"https://tails.boum.org/inc/release_notes/2.0/applications_menu.png\" width=\"512\"/></td>\n</tr></table><table class=\"img\"><caption>The activities overview</caption>\n<tr><td><img alt=\"Tails 2.0 activities overview\" class=\"img\" height=\"384\" src=\"https://tails.boum.org/inc/release_notes/2.0/activities_overview.png\" width=\"512\"/></td>\n</tr></table></li>\n</ul><h2>Upgrades and changes</h2>\n<ul><li readability=\"2\">\n<p>Debian 8 upgrades most included software, for example:</p>\n<ul><li>Many core GNOME utilities from 3.4 to 3.14: Files, Disks, Videos, etc.</li>\n<li>LibreOffice from 3.5 to 4.3</li>\n<li>PiTiVi from 0.15 to 0.93</li>\n<li>Git from 1.7.10 to 2.1.4</li>\n<li>Poedit from 1.5.4 to 1.6.10</li>\n<li>Liferea from 1.8.6 to 1.10</li>\n</ul></li>\n<li readability=\"1\">\n<p>Update Tor Browser to 5.5 (based on Firefox 38.6.0 ESR):</p>\n<ul><li>Add Japanese support.</li>\n</ul></li>\n<li readability=\"2\">\n<p>Remove the Windows camouflage which is currently broken in GNOME Shell. We started working on <a href=\"https://labs.riseup.net/code/issues/10830\">adding it back</a> but <a href=\"https://tails.boum.org/news/windows_camouflage_jessie/index.en.html\">your help is needed</a>!</p>\n</li>\n<li readability=\"1\">\n<p>Change to <code>systemd</code> as init system and use it to:</p>\n<ul><li>Sandbox many services using Linux namespaces and make them harder to exploit.</li>\n<li>Make the launching of Tor and the memory wipe on shutdown more robust.</li>\n<li>Sanitize our code base by replacing many custom scripts.</li>\n</ul></li>\n<li readability=\"1\">\n<p>Update most firmware packages which might improve hardware compatibility.</p>\n</li>\n<li readability=\"1\">\n<p>Notify the user if Tails is running from a non-free virtualization software.</p>\n</li>\n<li readability=\"3\">\n<p>Remove Claws Mail, replaced by <a href=\"https://tails.boum.org/doc/anonymous_internet/icedove/index.en.html\">Icedove</a>, a rebranded version of Mozilla Thunderbird.</p>\n</li>\n</ul><h2>Fixed problems</h2>\n<ul><li readability=\"1\">\n<p>HiDPI displays are better supported. (<a href=\"https://labs.riseup.net/code/issues/8659\">#8659</a>)</p>\n</li>\n<li readability=\"3\">\n<p>Remove the option to open a download with an external application in Tor Browser as this is usually impossible due to the AppArmor confinement. (<a href=\"https://labs.riseup.net/code/issues/9285\">#9285</a>)</p>\n</li>\n<li readability=\"1\">\n<p>Close Vidalia before restarting Tor.</p>\n</li>\n<li readability=\"2\">\n<p>Allow Videos to access the DVD drive. (<a href=\"https://labs.riseup.net/code/issues/10455\">#10455</a>, <a href=\"https://labs.riseup.net/code/issues/9990\">#9990</a>)</p>\n</li>\n<li readability=\"1\">\n<p>Allow configuring printers without administration password. (<a href=\"https://labs.riseup.net/code/issues/8443\">#8443</a>)</p>\n</li>\n</ul>\n<p>See the current list of <a href=\"https://tails.boum.org/support/known_issues/index.en.html\">known issues</a>.</p>\n<p>Go to the <a href=\"https://tails.boum.org/download/index.en.html\">download</a> or <a href=\"https://tails.boum.org/doc/first_steps/upgrade/index.en.html\">upgrade</a> page.</p>\n<p>If your Tails does not boot after an automatic upgrade, please <a href=\"https://tails.boum.org/doc/first_steps/upgrade/index.en.html#manual\">upgrade your Tails manually</a>.</p>\n<p>The next Tails release is <a href=\"https://tails.boum.org/contribute/calendar/\">scheduled</a> for March 08.</p>\n<p>Have a look at our <a href=\"https://labs.riseup.net/code/projects/tails/roadmap\">roadmap</a> to see where we are heading to.</p>\n<p>We need your help and there are many ways to <a href=\"https://tails.boum.org/contribute/index.en.html\">contribute to Tails</a> (<a href=\"https://tails.boum.org/contribute/how/donate/index.en.html\">donating</a> is only one of them). Come <a href=\"https://tails.boum.org/contribute/talk/\">talk to us</a>!</p>\n</div><div id=\"footer\" class=\"pagefooter\" role=\"contentinfo\" readability=\"15\">\n<p>Tags: <a href=\"https://tails.boum.org/tags/announce/\" rel=\"tag\">announce</a></p>\n<p>Pages linking to this one: <a href=\"https://tails.boum.org/inc/stable_i386_release_notes/index.en.html\">inc/stable i386 release notes</a> <a href=\"https://tails.boum.org/security/Numerous_security_holes_in_2.0/index.en.html\">security/Numerous security holes in 2.0</a></p>\n<p>Last edited Sat 13 Feb 2016 02:23:58 PM CET </p>\n</div>", | ||
22 | "mimetype": "text/html", | ||
23 | "language": "en", | ||
24 | "reading_time": 1, | ||
25 | "domain_name": "tails.boum.org", | ||
26 | "tags": [] | ||
27 | } | ||
28 | ] | ||