aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-09-16 22:22:25 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-09-16 22:22:25 +0200
commitebe0787e093f4f2934430033015d6ebad1c64dca (patch)
tree0e28c1da4fdb1ee48ae021a4e63d9a8ee1ec302d /src
parent4fc998245c56ad95c1e753ab52b0c702d4a8a59d (diff)
downloadwallabag-ebe0787e093f4f2934430033015d6ebad1c64dca.tar.gz
wallabag-ebe0787e093f4f2934430033015d6ebad1c64dca.tar.zst
wallabag-ebe0787e093f4f2934430033015d6ebad1c64dca.zip
Moved Pocket token to user config
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php5
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php3
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php5
-rw-r--r--src/Wallabag/CoreBundle/Entity/Config.php31
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/ConfigType.php3
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.da.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.de.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.es.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.it.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig12
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig12
-rw-r--r--src/Wallabag/ImportBundle/Controller/PocketController.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/PocketImport.php10
-rw-r--r--src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig8
21 files changed, 79 insertions, 23 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 4b1ec02a..bd7b55f9 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -317,11 +317,6 @@ class InstallCommand extends ContainerAwareCommand
317 'section' => 'export', 317 'section' => 'export',
318 ], 318 ],
319 [ 319 [
320 'name' => 'pocket_consumer_key',
321 'value' => null,
322 'section' => 'import',
323 ],
324 [
325 'name' => 'import_with_redis', 320 'name' => 'import_with_redis',
326 'value' => '0', 321 'value' => '0',
327 'section' => 'import', 322 'section' => 'import',
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
index 03be9667..921c739f 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
@@ -20,6 +20,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
20 $adminConfig->setItemsPerPage(30); 20 $adminConfig->setItemsPerPage(30);
21 $adminConfig->setReadingSpeed(1); 21 $adminConfig->setReadingSpeed(1);
22 $adminConfig->setLanguage('en'); 22 $adminConfig->setLanguage('en');
23 $adminConfig->setPocketConsumerKey('xxxxx');
23 24
24 $manager->persist($adminConfig); 25 $manager->persist($adminConfig);
25 26
@@ -30,6 +31,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
30 $bobConfig->setItemsPerPage(10); 31 $bobConfig->setItemsPerPage(10);
31 $bobConfig->setReadingSpeed(1); 32 $bobConfig->setReadingSpeed(1);
32 $bobConfig->setLanguage('fr'); 33 $bobConfig->setLanguage('fr');
34 $bobConfig->setPocketConsumerKey(null);
33 35
34 $manager->persist($bobConfig); 36 $manager->persist($bobConfig);
35 37
@@ -40,6 +42,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
40 $emptyConfig->setItemsPerPage(10); 42 $emptyConfig->setItemsPerPage(10);
41 $emptyConfig->setReadingSpeed(1); 43 $emptyConfig->setReadingSpeed(1);
42 $emptyConfig->setLanguage('en'); 44 $emptyConfig->setLanguage('en');
45 $emptyConfig->setPocketConsumerKey(null);
43 46
44 $manager->persist($emptyConfig); 47 $manager->persist($emptyConfig);
45 48
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
index 3ed6bafe..9425f961 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
@@ -91,11 +91,6 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface
91 'section' => 'export', 91 'section' => 'export',
92 ], 92 ],
93 [ 93 [
94 'name' => 'pocket_consumer_key',
95 'value' => null,
96 'section' => 'import',
97 ],
98 [
99 'name' => 'import_with_redis', 94 'name' => 'import_with_redis',
100 'value' => '0', 95 'value' => '0',
101 'section' => 'import', 96 'section' => 'import',
diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php
index a25656d3..d0f0e3f3 100644
--- a/src/Wallabag/CoreBundle/Entity/Config.php
+++ b/src/Wallabag/CoreBundle/Entity/Config.php
@@ -81,6 +81,13 @@ class Config
81 private $readingSpeed; 81 private $readingSpeed;
82 82
83 /** 83 /**
84 * @var string
85 *
86 * @ORM\Column(name="pocket_consumer_key", type="string", nullable=true)
87 */
88 private $pocketConsumerKey;
89
90 /**
84 * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config") 91 * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
85 */ 92 */
86 private $user; 93 private $user;
@@ -279,6 +286,30 @@ class Config
279 } 286 }
280 287
281 /** 288 /**
289 * Set pocketConsumerKey.
290 *
291 * @param string $pocketConsumerKey
292 *
293 * @return Config
294 */
295 public function setPocketConsumerKey($pocketConsumerKey)
296 {
297 $this->pocketConsumerKey = $pocketConsumerKey;
298
299 return $this;
300 }
301
302 /**
303 * Get pocketConsumerKey.
304 *
305 * @return string
306 */
307 public function getPocketConsumerKey()
308 {
309 return $this->pocketConsumerKey;
310 }
311
312 /**
282 * @param TaggingRule $rule 313 * @param TaggingRule $rule
283 * 314 *
284 * @return Config 315 * @return Config
diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php
index 7d25cc80..0bac2874 100644
--- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php
@@ -52,6 +52,9 @@ class ConfigType extends AbstractType
52 'choices' => array_flip($this->languages), 52 'choices' => array_flip($this->languages),
53 'label' => 'config.form_settings.language_label', 53 'label' => 'config.form_settings.language_label',
54 ]) 54 ])
55 ->add('pocket_consumer_key', null, [
56 'label' => 'config.form_settings.pocket_consumer_key_label',
57 ])
55 ->add('save', SubmitType::class, [ 58 ->add('save', SubmitType::class, [
56 'label' => 'config.form.save', 59 'label' => 'config.form.save',
57 ]) 60 ])
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index 4e5ed9ae..0a7c6e8c 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -68,6 +68,7 @@ config:
68 # 200_word: 'I read ~200 words per minute' 68 # 200_word: 'I read ~200 words per minute'
69 # 300_word: 'I read ~300 words per minute' 69 # 300_word: 'I read ~300 words per minute'
70 # 400_word: 'I read ~400 words per minute' 70 # 400_word: 'I read ~400 words per minute'
71 pocket_consumer_key_label: Brugers nøgle til Pocket for at importere materialer
71 form_rss: 72 form_rss:
72 description: 'RSS-feeds fra wallabag gør det muligt at læse de artikler, der gemmes i wallabag, med din RSS-læser. Det kræver, at du genererer et token først.' 73 description: 'RSS-feeds fra wallabag gør det muligt at læse de artikler, der gemmes i wallabag, med din RSS-læser. Det kræver, at du genererer et token først.'
73 token_label: 'RSS-Token' 74 token_label: 'RSS-Token'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
index 107187bf..a400686e 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -68,6 +68,7 @@ config:
68 200_word: 'Ich lese ~200 Wörter pro Minute' 68 200_word: 'Ich lese ~200 Wörter pro Minute'
69 300_word: 'Ich lese ~300 Wörter pro Minute' 69 300_word: 'Ich lese ~300 Wörter pro Minute'
70 400_word: 'Ich lese ~400 Wörter pro Minute' 70 400_word: 'Ich lese ~400 Wörter pro Minute'
71 pocket_consumer_key_label: Consumer-Key für Pocket, um Inhalte zu importieren
71 form_rss: 72 form_rss:
72 description: 'Die RSS-Feeds von wallabag erlauben es dir, deine gespeicherten Artikel mit deinem bevorzugten RSS-Reader zu lesen. Vorher musst du jedoch einen Token erstellen.' 73 description: 'Die RSS-Feeds von wallabag erlauben es dir, deine gespeicherten Artikel mit deinem bevorzugten RSS-Reader zu lesen. Vorher musst du jedoch einen Token erstellen.'
73 token_label: 'RSS-token' 74 token_label: 'RSS-token'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index ac60295f..2d097caf 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -68,6 +68,7 @@ config:
68 200_word: 'I read ~200 words per minute' 68 200_word: 'I read ~200 words per minute'
69 300_word: 'I read ~300 words per minute' 69 300_word: 'I read ~300 words per minute'
70 400_word: 'I read ~400 words per minute' 70 400_word: 'I read ~400 words per minute'
71 pocket_consumer_key_label: Consumer key for Pocket to import contents
71 form_rss: 72 form_rss:
72 description: 'RSS feeds provided by wallabag allow you to read your saved articles with your favourite RSS reader. You need to generate a token first.' 73 description: 'RSS feeds provided by wallabag allow you to read your saved articles with your favourite RSS reader. You need to generate a token first.'
73 token_label: 'RSS token' 74 token_label: 'RSS token'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
index 1082e6de..1dbff022 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -68,6 +68,7 @@ config:
68 200_word: 'Leo ~200 palabras por minuto' 68 200_word: 'Leo ~200 palabras por minuto'
69 300_word: 'Leo ~300 palabras por minuto' 69 300_word: 'Leo ~300 palabras por minuto'
70 400_word: 'Leo ~400 palabras por minuto' 70 400_word: 'Leo ~400 palabras por minuto'
71 # pocket_consumer_key_label: Consumer key for Pocket to import contents
71 form_rss: 72 form_rss:
72 description: 'Los feeds RSS de wallabag permiten leer los artículos guardados con su lector RSS favorito. Necesita generar un token primero' 73 description: 'Los feeds RSS de wallabag permiten leer los artículos guardados con su lector RSS favorito. Necesita generar un token primero'
73 token_label: 'RSS token' 74 token_label: 'RSS token'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
index 78317a9c..ad13c940 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -68,6 +68,7 @@ config:
68 200_word: 'من تقریباً ۲۰۰ واژه را در دقیقه می‌خوانم' 68 200_word: 'من تقریباً ۲۰۰ واژه را در دقیقه می‌خوانم'
69 300_word: 'من تقریباً ۳۰۰ واژه را در دقیقه می‌خوانم' 69 300_word: 'من تقریباً ۳۰۰ واژه را در دقیقه می‌خوانم'
70 400_word: 'من تقریباً ۴۰۰ واژه را در دقیقه می‌خوانم' 70 400_word: 'من تقریباً ۴۰۰ واژه را در دقیقه می‌خوانم'
71 pocket_consumer_key_label: کلید کاربری Pocket برای درون‌ریزی مطالب
71 form_rss: 72 form_rss:
72 description: 'با خوراک آر-اس-اس که wallabag در اختیارتان می‌گذارد، می‌توانید مقاله‌های ذخیره‌شده را در نرم‌افزار آر-اس-اس دلخواه خود بخوانید. برای این کار نخست باید یک کد بسازید.' 73 description: 'با خوراک آر-اس-اس که wallabag در اختیارتان می‌گذارد، می‌توانید مقاله‌های ذخیره‌شده را در نرم‌افزار آر-اس-اس دلخواه خود بخوانید. برای این کار نخست باید یک کد بسازید.'
73 token_label: 'کد آر-اس-اس' 74 token_label: 'کد آر-اس-اس'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index 50515d80..35e5c9d0 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -68,6 +68,7 @@ config:
68 200_word: 'Je lis environ 200 mots par minute' 68 200_word: 'Je lis environ 200 mots par minute'
69 300_word: 'Je lis environ 300 mots par minute' 69 300_word: 'Je lis environ 300 mots par minute'
70 400_word: 'Je lis environ 400 mots par minute' 70 400_word: 'Je lis environ 400 mots par minute'
71 pocket_consumer_key_label: Clé d'authentification Pocket pour importer les données
71 form_rss: 72 form_rss:
72 description: "Les flux RSS fournis par wallabag vous permettent de lire vos articles sauvegardés dans votre lecteur de flux préféré. Pour pouvoir les utiliser, vous devez d'abord créer un jeton." 73 description: "Les flux RSS fournis par wallabag vous permettent de lire vos articles sauvegardés dans votre lecteur de flux préféré. Pour pouvoir les utiliser, vous devez d'abord créer un jeton."
73 token_label: 'Jeton RSS' 74 token_label: 'Jeton RSS'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
index 5badeffc..5bc896c3 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -68,6 +68,7 @@ config:
68 200_word: 'Leggo ~200 parole al minuto' 68 200_word: 'Leggo ~200 parole al minuto'
69 300_word: 'Leggo ~300 parole al minuto' 69 300_word: 'Leggo ~300 parole al minuto'
70 400_word: 'Leggo ~400 parole al minuto' 70 400_word: 'Leggo ~400 parole al minuto'
71 pocket_consumer_key_label: Consumer key per Pocket per importare i contenuti
71 form_rss: 72 form_rss:
72 description: 'I feed RSS generati da wallabag ti permettono di leggere i tuoi contenuti salvati con il tuo lettore di RSS preferito. Prima, devi generare un token.' 73 description: 'I feed RSS generati da wallabag ti permettono di leggere i tuoi contenuti salvati con il tuo lettore di RSS preferito. Prima, devi generare un token.'
73 token_label: 'RSS token' 74 token_label: 'RSS token'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index 2383886c..b0194c59 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -68,6 +68,7 @@ config:
68 200_word: "Legissi a l'entorn de 200 mots per minuta" 68 200_word: "Legissi a l'entorn de 200 mots per minuta"
69 300_word: "Legissi a l'entorn de 300 mots per minuta" 69 300_word: "Legissi a l'entorn de 300 mots per minuta"
70 400_word: "Legissi a l'entorn de 400 mots per minuta" 70 400_word: "Legissi a l'entorn de 400 mots per minuta"
71 pocket_consumer_key_label: Clau d'autentificacion Pocket per importar las donadas
71 form_rss: 72 form_rss:
72 description: "Los fluxes RSS fornits per wallabag vos permeton de legir vòstres articles salvagardats dins vòstre lector de fluxes preferit. Per los poder emplegar, vos cal, d'en primièr crear un geton." 73 description: "Los fluxes RSS fornits per wallabag vos permeton de legir vòstres articles salvagardats dins vòstre lector de fluxes preferit. Per los poder emplegar, vos cal, d'en primièr crear un geton."
73 token_label: 'Geton RSS' 74 token_label: 'Geton RSS'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index 40cd2b71..6412ad16 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -68,6 +68,7 @@ config:
68 200_word: 'Czytam ~200 słów na minutę' 68 200_word: 'Czytam ~200 słów na minutę'
69 300_word: 'Czytam ~300 słów na minutę' 69 300_word: 'Czytam ~300 słów na minutę'
70 400_word: 'Czytam ~400 słów na minutę' 70 400_word: 'Czytam ~400 słów na minutę'
71 pocket_consumer_key_label: Klucz klienta Pocket do importu zawartości
71 form_rss: 72 form_rss:
72 description: 'Kanały RSS prowadzone przez wallabag pozwalają Ci na czytanie twoich zapisanych artykułów w twoium ulubionym czytniku RSS. Musisz najpierw wynegenerować tokena.‌' 73 description: 'Kanały RSS prowadzone przez wallabag pozwalają Ci na czytanie twoich zapisanych artykułów w twoium ulubionym czytniku RSS. Musisz najpierw wynegenerować tokena.‌'
73 token_label: 'Token RSS' 74 token_label: 'Token RSS'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
index b18eab9e..11b744c7 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -68,6 +68,7 @@ config:
68 # 200_word: 'I read ~200 words per minute' 68 # 200_word: 'I read ~200 words per minute'
69 # 300_word: 'I read ~300 words per minute' 69 # 300_word: 'I read ~300 words per minute'
70 # 400_word: 'I read ~400 words per minute' 70 # 400_word: 'I read ~400 words per minute'
71 pocket_consumer_key_label: Cheie consumator pentru importarea contentului din Pocket
71 form_rss: 72 form_rss:
72 description: 'Feed-urile RSS oferite de wallabag îți permit să-ți citești articolele salvate în reader-ul tău preferat RSS.' 73 description: 'Feed-urile RSS oferite de wallabag îți permit să-ți citești articolele salvate în reader-ul tău preferat RSS.'
73 token_label: 'RSS-Token' 74 token_label: 'RSS-Token'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
index 82fa93af..d6aaacfe 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -68,6 +68,7 @@ config:
68 # 200_word: 'I read ~200 words per minute' 68 # 200_word: 'I read ~200 words per minute'
69 # 300_word: 'I read ~300 words per minute' 69 # 300_word: 'I read ~300 words per minute'
70 # 400_word: 'I read ~400 words per minute' 70 # 400_word: 'I read ~400 words per minute'
71 # pocket_consumer_key_label: Consumer key for Pocket to import contents
71 form_rss: 72 form_rss:
72 description: 'wallabag RSS akışı kaydetmiş olduğunuz makalelerini favori RSS okuyucunuzda görüntülemenizi sağlar. Bunu yapabilmek için öncelikle belirteç (token) oluşturmalısınız.' 73 description: 'wallabag RSS akışı kaydetmiş olduğunuz makalelerini favori RSS okuyucunuzda görüntülemenizi sağlar. Bunu yapabilmek için öncelikle belirteç (token) oluşturmalısınız.'
73 token_label: 'RSS belirteci (token)' 74 token_label: 'RSS belirteci (token)'
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig
index f89265d4..6446cf2c 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig
@@ -44,6 +44,18 @@
44 </div> 44 </div>
45 </fieldset> 45 </fieldset>
46 46
47 <fieldset class="w500p inline">
48 <div class="row">
49 {{ form_label(form.config.pocket_consumer_key) }}
50 {{ form_errors(form.config.pocket_consumer_key) }}
51 {{ form_widget(form.config.pocket_consumer_key) }}
52 <p>
53 &raquo;
54 <a href="https://getpocket.com/developer/docs/authentication">https://getpocket.com/developer/docs/authentication</a>
55 </p>
56 </div>
57 </fieldset>
58
47 {{ form_rest(form.config) }} 59 {{ form_rest(form.config) }}
48 </form> 60 </form>
49 61
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
index bf390e89..5330c353 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
@@ -62,6 +62,18 @@
62 </div> 62 </div>
63 </div> 63 </div>
64 64
65 <div class="row">
66 <div class="input-field col s12">
67 {{ form_label(form.config.pocket_consumer_key) }}
68 {{ form_errors(form.config.pocket_consumer_key) }}
69 {{ form_widget(form.config.pocket_consumer_key) }}
70 <p>
71 &raquo;
72 <a href="https://getpocket.com/developer/docs/authentication">https://getpocket.com/developer/docs/authentication</a>
73 </p>
74 </div>
75 </div>
76
65 {{ form_widget(form.config.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }} 77 {{ form_widget(form.config.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
66 {{ form_rest(form.config) }} 78 {{ form_rest(form.config) }}
67 </form> 79 </form>
diff --git a/src/Wallabag/ImportBundle/Controller/PocketController.php b/src/Wallabag/ImportBundle/Controller/PocketController.php
index 1f92c182..56be5cbf 100644
--- a/src/Wallabag/ImportBundle/Controller/PocketController.php
+++ b/src/Wallabag/ImportBundle/Controller/PocketController.php
@@ -44,7 +44,7 @@ class PocketController extends Controller
44 44
45 return $this->render('WallabagImportBundle:Pocket:index.html.twig', [ 45 return $this->render('WallabagImportBundle:Pocket:index.html.twig', [
46 'import' => $this->getPocketImportService(), 46 'import' => $this->getPocketImportService(),
47 'has_consumer_key' => '' == trim($this->get('craue_config')->get('pocket_consumer_key')) ? false : true, 47 'has_consumer_key' => '' === trim($this->getUser()->getConfig()->getPocketConsumerKey()) ? false : true,
48 'form' => $form->createView(), 48 'form' => $form->createView(),
49 ]); 49 ]);
50 } 50 }
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php
index cc6faf1f..40603c90 100644
--- a/src/Wallabag/ImportBundle/Import/PocketImport.php
+++ b/src/Wallabag/ImportBundle/Import/PocketImport.php
@@ -13,16 +13,14 @@ use Craue\ConfigBundle\Util\Config;
13class PocketImport extends AbstractImport 13class PocketImport extends AbstractImport
14{ 14{
15 private $client; 15 private $client;
16 private $consumerKey;
17 private $accessToken; 16 private $accessToken;
18 17
19 const NB_ELEMENTS = 5000; 18 const NB_ELEMENTS = 5000;
20 19
21 public function __construct(EntityManager $em, ContentProxy $contentProxy, Config $craueConfig) 20 public function __construct(EntityManager $em, ContentProxy $contentProxy)
22 { 21 {
23 $this->em = $em; 22 $this->em = $em;
24 $this->contentProxy = $contentProxy; 23 $this->contentProxy = $contentProxy;
25 $this->consumerKey = $craueConfig->get('pocket_consumer_key');
26 $this->logger = new NullLogger(); 24 $this->logger = new NullLogger();
27 } 25 }
28 26
@@ -72,7 +70,7 @@ class PocketImport extends AbstractImport
72 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/request', 70 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/request',
73 [ 71 [
74 'body' => json_encode([ 72 'body' => json_encode([
75 'consumer_key' => $this->consumerKey, 73 'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(),
76 'redirect_uri' => $redirectUri, 74 'redirect_uri' => $redirectUri,
77 ]), 75 ]),
78 ] 76 ]
@@ -102,7 +100,7 @@ class PocketImport extends AbstractImport
102 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/authorize', 100 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/authorize',
103 [ 101 [
104 'body' => json_encode([ 102 'body' => json_encode([
105 'consumer_key' => $this->consumerKey, 103 'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(),
106 'code' => $code, 104 'code' => $code,
107 ]), 105 ]),
108 ] 106 ]
@@ -131,7 +129,7 @@ class PocketImport extends AbstractImport
131 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/get', 129 $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/get',
132 [ 130 [
133 'body' => json_encode([ 131 'body' => json_encode([
134 'consumer_key' => $this->consumerKey, 132 'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(),
135 'access_token' => $this->accessToken, 133 'access_token' => $this->accessToken,
136 'detailType' => 'complete', 134 'detailType' => 'complete',
137 'state' => 'all', 135 'state' => 'all',
diff --git a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig
index aa5941b7..6195fa07 100644
--- a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig
+++ b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig
@@ -12,11 +12,7 @@
12 <div class="card-panel red white-text"> 12 <div class="card-panel red white-text">
13 {{ 'import.pocket.config_missing.description'|trans }} 13 {{ 'import.pocket.config_missing.description'|trans }}
14 14
15 {% if is_granted('ROLE_SUPER_ADMIN') %} 15 {{ 'import.pocket.config_missing.admin_message'|trans({'%keyurls%': '<a href="' ~ path('config') ~ '">', '%keyurle%':'</a>'})|raw }}
16 {{ 'import.pocket.config_missing.admin_message'|trans({'%keyurls%': '<a href="' ~ path('craue_config_settings_modify') ~ '#set-import">', '%keyurle%':'</a>'})|raw }}
17 {% else %}
18 {{ 'import.pocket.config_missing.user_message'|trans }}
19 {% endif %}
20 </div> 16 </div>
21 {% endif %} 17 {% endif %}
22 18
@@ -31,7 +27,7 @@
31 {{ form_label(form.mark_as_read) }} 27 {{ form_label(form.mark_as_read) }}
32 </div> 28 </div>
33 </div> 29 </div>
34 <button class="btn waves-effect waves-light" type="submit" name="action"> 30 <button class="btn waves-effect waves-light" type="submit" name="action" {% if not has_consumer_key %}disabled="disabled"{% endif %}>
35 {{ 'import.pocket.connect_to_pocket'|trans }} 31 {{ 'import.pocket.connect_to_pocket'|trans }}
36 </button> 32 </button>
37 </form> 33 </form>