]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Moved Pocket token to user config
authorJeremy Benoist <jeremy.benoist@gmail.com>
Fri, 16 Sep 2016 20:22:25 +0000 (22:22 +0200)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Fri, 16 Sep 2016 20:22:25 +0000 (22:22 +0200)
34 files changed:
app/DoctrineMigrations/Version20160916201049.php [new file with mode: 0644]
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.da.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.de.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.es.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fa.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.it.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.oc.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pl.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.ro.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.tr.yml [new file with mode: 0644]
src/Wallabag/CoreBundle/Command/InstallCommand.php
src/Wallabag/CoreBundle/DataFixtures/ORM/LoadConfigData.php
src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php
src/Wallabag/CoreBundle/Entity/Config.php
src/Wallabag/CoreBundle/Form/Type/ConfigType.php
src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
src/Wallabag/ImportBundle/Controller/PocketController.php
src/Wallabag/ImportBundle/Import/PocketImport.php
src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig
tests/Wallabag/ImportBundle/Import/PocketImportTest.php

diff --git a/app/DoctrineMigrations/Version20160916201049.php b/app/DoctrineMigrations/Version20160916201049.php
new file mode 100644 (file)
index 0000000..ac8e696
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+
+namespace Application\Migrations;
+
+use Doctrine\DBAL\Migrations\AbstractMigration;
+use Doctrine\DBAL\Schema\Schema;
+use Symfony\Component\DependencyInjection\ContainerAwareInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+class Version20160916201049 extends AbstractMigration implements ContainerAwareInterface
+{
+    /**
+     * @var ContainerInterface
+     */
+    private $container;
+
+    public function setContainer(ContainerInterface $container = null)
+    {
+        $this->container = $container;
+    }
+
+    private function getTable($tableName)
+    {
+        return $this->container->getParameter('database_table_prefix') . $tableName;
+    }
+
+    /**
+     * @param Schema $schema
+     */
+    public function up(Schema $schema)
+    {
+        $this->addSql('ALTER TABLE '.$this->getTable('config').' ADD pocket_consumer_key VARCHAR(255) DEFAULT NULL');
+    }
+
+    /**
+     * @param Schema $schema
+     */
+    public function down(Schema $schema)
+    {
+        $this->abortIf($this->connection->getDatabasePlatform()->getName() == 'sqlite', 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
+
+        $this->addSql('ALTER TABLE `'.$this->getTable('config').'` DROP pocket_consumer_key');
+    }
+}
index 905d7b2bcd54539a73bea952332a25041d8a66c3..85079330fc7b1063635fd337122ee2e557dcb2d7 100644 (file)
@@ -8,7 +8,6 @@ export_csv: Aktiver eksport til CSV
 export_json: Aktiver eksport til JSON
 export_txt: Aktiver eksport til TXT
 export_xml: Aktiver eksport til XML
-pocket_consumer_key: Brugers nøgle til Pocket for at importere materialer (https://getpocket.com/developer/docs/authentication)
 # import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
 # import_with_redis: Enable Redis to import data asynchronously
 shaarli_url: Shaarli-URL, hvis tjenesten er aktiv
index eab50ff274947dd75bd5f4720a09c417a0ebba2f..eaba14cd5deeb3655a7eccd1fb419a135488d0a4 100644 (file)
@@ -8,7 +8,6 @@ export_csv: CSV-Export aktivieren
 export_json: JSON-Export aktivieren
 export_txt: TXT-Export aktivieren
 export_xml: XML-Export aktivieren
-pocket_consumer_key: Consumer-Key für Pocket, um Inhalte zu importieren (https://getpocket.com/developer/docs/authentication)
 # import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
 # import_with_redis: Enable Redis to import data asynchronously
 shaarli_url: Shaarli-URL, sofern der Service aktiviert ist
index 446c9d05587292504207285219f4ec9e4286861d..8aaa27e766ed2b26cb2cc515171c82c38c43f5a8 100644 (file)
@@ -8,7 +8,6 @@ export_csv: Enable CSV export
 export_json: Enable JSON export
 export_txt: Enable TXT export
 export_xml: Enable XML export
-pocket_consumer_key: Consumer key for Pocket to import contents (https://getpocket.com/developer/docs/authentication)
 import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
 import_with_redis: Enable Redis to import data asynchronously
 shaarli_url: Shaarli URL, if the service is enabled
index 42f48bf746d539e58e6c5a91aba046d57fafd04d..bf3a79af85225e89bd9d80ebf926dd0ac5acf669 100644 (file)
@@ -8,7 +8,6 @@ export_csv: Activar exportación a CSV
 export_json: Activar exportación a JSON
 export_txt: Activar exportación a TXT
 export_xml: Activar exportación a XML
-pocket_consumer_key: Consumer key for Pocket to import contents (https://getpocket.com/developer/docs/authentication)
 # import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
 # import_with_redis: Enable Redis to import data asynchronously
 shaarli_url: Shaarli URL, si el servicio está activado
index 6fc17c98043fd31c58ea2f7939a8e8718121b386..d86c434333262d2b5a115e7e35b000be338eb165 100644 (file)
@@ -8,7 +8,6 @@ export_csv:  فعال‌سازی برون‌سپاری به CSV
 export_json:  فعال‌سازی برون‌سپاری به JSON
 export_txt:  فعال‌سازی برون‌سپاری به TXT
 export_xml:  فعال‌سازی برون‌سپاری به XML
-pocket_consumer_key: کلید کاربری Pocket برای درون‌ریزی مطالب (https://getpocket.com/developer/docs/authentication)
 # import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
 # import_with_redis: Enable Redis to import data asynchronously
 shaarli_url: نشانی Shaarli، اگر فعال بود
index 08351b7765dca6beda1f449e2ace73716968f155..5e1ecf26c8a100229c0c5b5112e88a305aa68dd4 100644 (file)
@@ -8,7 +8,6 @@ export_csv: Activer l'export CSV
 export_json: Activer l'export JSON
 export_txt: Activer l'export TXT
 export_xml: Activer l'export XML
-pocket_consumer_key: Clé d'authentification Pocket pour importer les données (https://getpocket.com/developer/docs/authentication)
 import_with_rabbitmq: Activer RabbitMQ pour gérer les imports de façon asynchrone
 import_with_redis: Activer Redis pour gérer les imports de façon asynchrone
 shaarli_url: URL de Shaarli, si le service Shaarli est activé
index 0c8a906da9ec395871ef4724b75b872db79c8983..9d820e4bc28f63076e292ebcff889bffb500ded5 100644 (file)
@@ -8,7 +8,6 @@ export_csv: Abilita esportazione CSV
 export_json: Abilita esportazione JSON
 export_txt: Abilita esportazione TXT
 export_xml: Abilita esportazione XML
-pocket_consumer_key: Consumer key per Pocket per importare i contenuti (https://getpocket.com/developer/docs/authentication)
 # import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
 # import_with_redis: Enable Redis to import data asynchronously
 shaarli_url: Shaarli URL, se il servizio è abilitato
index f578095e1ea4763b75ca11f7fbfd2566abf518ed..49dc77326c80884418ca8a5ded7aaf1668bbfe82 100644 (file)
@@ -8,7 +8,6 @@ export_csv: Activar l'expòrt CSV
 export_json: Activar l'expòrt JSON
 export_txt: Activar l'expòrt TXT
 export_xml: Activar l'expòrt XML
-pocket_consumer_key: Clau d'autentificacion Pocket per importar las donadas (https://getpocket.com/developer/docs/authentication)
 # import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
 # import_with_redis: Enable Redis to import data asynchronously
 shaarli_url: URL de Shaarli, se lo servici Shaarli es activat
index 351ee2a8e12f2c0a1e988697a0178279f54de8de..2365f2b3b1dee349b55f53f47645b6b8e471cdf1 100644 (file)
@@ -8,7 +8,6 @@ export_csv: Włącz eksport do CSV
 export_json: Włącz eksport do JSON
 export_txt: Włącz eksport do TXT
 export_xml: Włącz eksport do XML
-pocket_consumer_key: Klucz klienta Pocket do importu zawartości (https://getpocket.com/developer/docs/authentication)
 # import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
 # import_with_redis: Enable Redis to import data asynchronously
 shaarli_url: Adress URL Shaarli, jeżeli usługa jest włączona
index b9b41ee72d96de4ec50a344f1ed32e6095c95406..20d664f7ec4b975d30d4e737c05695db395e1e6e 100644 (file)
@@ -8,7 +8,6 @@ export_csv: Permite exportare CSV
 export_json: Permite exportare JSON
 export_txt: Permite exportare TXT
 export_xml: Permite exportare XML
-pocket_consumer_key: Cheie consumator pentru importarea contentului din Pocket (https://getpocket.com/developer/docs/authentication)
 # import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
 # import_with_redis: Enable Redis to import data asynchronously
 shaarli_url: Shaarli URL, dacă serviciul este permis
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.tr.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.tr.yml
new file mode 100644 (file)
index 0000000..4b4d3ed
--- /dev/null
@@ -0,0 +1,31 @@
+# download_pictures: Download pictures on your server
+# carrot: Enable share to Carrot
+# diaspora_url: Diaspora URL, if the service is enabled
+# export_epub: Enable ePub export
+# export_mobi: Enable .mobi export
+# export_pdf: Enable PDF export
+# export_csv: Enable CSV export
+# export_json: Enable JSON export
+# export_txt: Enable TXT export
+# export_xml: Enable XML export
+# import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
+# import_with_redis: Enable Redis to import data asynchronously
+# shaarli_url: Shaarli URL, if the service is enabled
+# share_diaspora: Enable share to Diaspora
+# share_mail: Enable share by email
+# share_shaarli: Enable share to Shaarli
+# share_twitter: Enable share to Twitter
+# show_printlink: Display a link to print content
+# wallabag_support_url: Support URL for wallabag
+# wallabag_url: URL of *your* wallabag instance
+# entry: "article"
+# export: "export"
+# import: "import"
+# misc: "misc"
+# modify_settings: "apply"
+# piwik_host: Host of your website in Piwik
+# piwik_site_id: ID of your website in Piwik
+# piwik_enabled: Enable Piwik
+# demo_mode_enabled: "Enable demo mode ? (only used for the wallabag public demo)"
+# demo_mode_username: "Demo user"
+# share_public: Allow public url for entries
index 4b1ec02aa0535d055099698dc926043fb7c9cbe3..bd7b55f924ed2e60db89b0a4e002125cfa655a2f 100644 (file)
@@ -316,11 +316,6 @@ class InstallCommand extends ContainerAwareCommand
                 'value' => '1',
                 'section' => 'export',
             ],
-            [
-                'name' => 'pocket_consumer_key',
-                'value' => null,
-                'section' => 'import',
-            ],
             [
                 'name' => 'import_with_redis',
                 'value' => '0',
index 03be96670adccabc63e36a62d125553fd47a6c35..921c739fff1ba44b130e763161e3e5283542b410 100644 (file)
@@ -20,6 +20,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
         $adminConfig->setItemsPerPage(30);
         $adminConfig->setReadingSpeed(1);
         $adminConfig->setLanguage('en');
+        $adminConfig->setPocketConsumerKey('xxxxx');
 
         $manager->persist($adminConfig);
 
@@ -30,6 +31,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
         $bobConfig->setItemsPerPage(10);
         $bobConfig->setReadingSpeed(1);
         $bobConfig->setLanguage('fr');
+        $bobConfig->setPocketConsumerKey(null);
 
         $manager->persist($bobConfig);
 
@@ -40,6 +42,7 @@ class LoadConfigData extends AbstractFixture implements OrderedFixtureInterface
         $emptyConfig->setItemsPerPage(10);
         $emptyConfig->setReadingSpeed(1);
         $emptyConfig->setLanguage('en');
+        $emptyConfig->setPocketConsumerKey(null);
 
         $manager->persist($emptyConfig);
 
index 3ed6bafece85117c1b0e562c2e0796fa8428605a..9425f961fd9668fa7fc47029405e5fd8eb920607 100644 (file)
@@ -90,11 +90,6 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface
                 'value' => '1',
                 'section' => 'export',
             ],
-            [
-                'name' => 'pocket_consumer_key',
-                'value' => null,
-                'section' => 'import',
-            ],
             [
                 'name' => 'import_with_redis',
                 'value' => '0',
index a25656d3b36597a38661b050f5bcebe95a071eb7..d0f0e3f38809dc00331327a1f6e9706fcd405572 100644 (file)
@@ -80,6 +80,13 @@ class Config
      */
     private $readingSpeed;
 
+    /**
+     * @var string
+     *
+     * @ORM\Column(name="pocket_consumer_key", type="string", nullable=true)
+     */
+    private $pocketConsumerKey;
+
     /**
      * @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
      */
@@ -278,6 +285,30 @@ class Config
         return $this->readingSpeed;
     }
 
+    /**
+     * Set pocketConsumerKey.
+     *
+     * @param string $pocketConsumerKey
+     *
+     * @return Config
+     */
+    public function setPocketConsumerKey($pocketConsumerKey)
+    {
+        $this->pocketConsumerKey = $pocketConsumerKey;
+
+        return $this;
+    }
+
+    /**
+     * Get pocketConsumerKey.
+     *
+     * @return string
+     */
+    public function getPocketConsumerKey()
+    {
+        return $this->pocketConsumerKey;
+    }
+
     /**
      * @param TaggingRule $rule
      *
index 7d25cc80597a06c70544fba356c0d99101e916e4..0bac28740a99c0784f00d664a57458726e7a297f 100644 (file)
@@ -52,6 +52,9 @@ class ConfigType extends AbstractType
                 'choices' => array_flip($this->languages),
                 'label' => 'config.form_settings.language_label',
             ])
+            ->add('pocket_consumer_key', null, [
+                'label' => 'config.form_settings.pocket_consumer_key_label',
+            ])
             ->add('save', SubmitType::class, [
                 'label' => 'config.form.save',
             ])
index 4e5ed9aeadd2cd80b375943b9ef2bce8786204b9..0a7c6e8cf6812b636efe8857fcf1dbc6a4b78cb3 100644 (file)
@@ -68,6 +68,7 @@ config:
             # 200_word: 'I read ~200 words per minute'
             # 300_word: 'I read ~300 words per minute'
             # 400_word: 'I read ~400 words per minute'
+        pocket_consumer_key_label: Brugers nøgle til Pocket for at importere materialer
     form_rss:
         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.'
         token_label: 'RSS-Token'
index 107187bf7cbc181793ddb481ec6c2d9d0cf564b5..a400686eafdcdb34e4355de453e77f03f5d0188f 100644 (file)
@@ -68,6 +68,7 @@ config:
             200_word: 'Ich lese ~200 Wörter pro Minute'
             300_word: 'Ich lese ~300 Wörter pro Minute'
             400_word: 'Ich lese ~400 Wörter pro Minute'
+        pocket_consumer_key_label: Consumer-Key für Pocket, um Inhalte zu importieren
     form_rss:
         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.'
         token_label: 'RSS-token'
index ac60295f6639d2840331c73383c48cbd502099fb..2d097cafd054eb91838b0a980dd019d97eb1dfab 100644 (file)
@@ -68,6 +68,7 @@ config:
             200_word: 'I read ~200 words per minute'
             300_word: 'I read ~300 words per minute'
             400_word: 'I read ~400 words per minute'
+        pocket_consumer_key_label: Consumer key for Pocket to import contents
     form_rss:
         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.'
         token_label: 'RSS token'
index 1082e6de2c7b5d8a9d1fdfb253fc79411d4d81a7..1dbff0225c391cf400fd5c2790b96ec5178a380d 100644 (file)
@@ -68,6 +68,7 @@ config:
             200_word: 'Leo ~200 palabras por minuto'
             300_word: 'Leo ~300 palabras por minuto'
             400_word: 'Leo ~400 palabras por minuto'
+        # pocket_consumer_key_label: Consumer key for Pocket to import contents
     form_rss:
         description: 'Los feeds RSS de wallabag permiten leer los artículos guardados con su lector RSS favorito. Necesita generar un token primero'
         token_label: 'RSS token'
index 78317a9ca41f827756f6d9405afcd48a2d2f256c..ad13c9404b8c5cbf667a56234ad144427c628795 100644 (file)
@@ -68,6 +68,7 @@ config:
             200_word: 'من تقریباً ۲۰۰ واژه را در دقیقه می‌خوانم'
             300_word: 'من تقریباً ۳۰۰ واژه را در دقیقه می‌خوانم'
             400_word: 'من تقریباً ۴۰۰ واژه را در دقیقه می‌خوانم'
+        pocket_consumer_key_label: کلید کاربری Pocket برای درون‌ریزی مطالب
     form_rss:
         description: 'با خوراک آر-اس-اس که wallabag در اختیارتان می‌گذارد، می‌توانید مقاله‌های ذخیره‌شده را در نرم‌افزار آر-اس-اس دلخواه خود بخوانید. برای این کار نخست باید یک کد بسازید.'
         token_label: 'کد آر-اس-اس'
index 50515d80254be564035027f1b18630f6fcb94bd3..35e5c9d075964ddf59386ffb8b7c518aec406fd6 100644 (file)
@@ -68,6 +68,7 @@ config:
             200_word: 'Je lis environ 200 mots par minute'
             300_word: 'Je lis environ 300 mots par minute'
             400_word: 'Je lis environ 400 mots par minute'
+        pocket_consumer_key_label: Clé d'authentification Pocket pour importer les données
     form_rss:
         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."
         token_label: 'Jeton RSS'
index 5badeffc54af1f49868d3373f7830b4f352a0d66..5bc896c3d1e6b886885cffe4e2625a7ffc58c48a 100644 (file)
@@ -68,6 +68,7 @@ config:
             200_word: 'Leggo ~200 parole al minuto'
             300_word: 'Leggo ~300 parole al minuto'
             400_word: 'Leggo ~400 parole al minuto'
+        pocket_consumer_key_label: Consumer key per Pocket per importare i contenuti
     form_rss:
         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.'
         token_label: 'RSS token'
index 2383886c737359fd521e2ed89b23bef26cd8e5b2..b0194c5948b9a2af9f086e3d7839fc02632b4e12 100644 (file)
@@ -68,6 +68,7 @@ config:
             200_word: "Legissi a l'entorn de 200 mots per minuta"
             300_word: "Legissi a l'entorn de 300 mots per minuta"
             400_word: "Legissi a l'entorn de 400 mots per minuta"
+        pocket_consumer_key_label: Clau d'autentificacion Pocket per importar las donadas
     form_rss:
         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."
         token_label: 'Geton RSS'
index 40cd2b71cdeab0e1cbd2aaf362c00fae2f241d4f..6412ad16945073998fd404464f84d540991f858a 100644 (file)
@@ -68,6 +68,7 @@ config:
             200_word: 'Czytam ~200 słów na minutę'
             300_word: 'Czytam ~300 słów na minutę'
             400_word: 'Czytam ~400 słów na minutę'
+        pocket_consumer_key_label: Klucz klienta Pocket do importu zawartości
     form_rss:
         description: 'Kanały RSS prowadzone przez wallabag pozwalają Ci na czytanie twoich zapisanych artykułów w twoium ulubionym czytniku RSS. Musisz najpierw wynegenerować tokena.‌'
         token_label: 'Token RSS'
index b18eab9e3d72770a719970a053b5449cac89169f..11b744c762eba4a9e63bf8f61f26cad5030fb4ce 100644 (file)
@@ -68,6 +68,7 @@ config:
             # 200_word: 'I read ~200 words per minute'
             # 300_word: 'I read ~300 words per minute'
             # 400_word: 'I read ~400 words per minute'
+        pocket_consumer_key_label: Cheie consumator pentru importarea contentului din Pocket
     form_rss:
         description: 'Feed-urile RSS oferite de wallabag îți permit să-ți citești articolele salvate în reader-ul tău preferat RSS.'
         token_label: 'RSS-Token'
index 82fa93af07e9f1775aafc5866ec3dcd3eb3512d9..d6aaacfec4255b92b42242334f27661a728eafef 100644 (file)
@@ -68,6 +68,7 @@ config:
             # 200_word: 'I read ~200 words per minute'
             # 300_word: 'I read ~300 words per minute'
             # 400_word: 'I read ~400 words per minute'
+        # pocket_consumer_key_label: Consumer key for Pocket to import contents
     form_rss:
         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.'
         token_label: 'RSS belirteci (token)'
index f89265d403605f6943a33b8a44d652dcf3b78bbf..6446cf2c33823d2f5fd724fa454bcb7b5dbaa37a 100644 (file)
             </div>
         </fieldset>
 
+        <fieldset class="w500p inline">
+            <div class="row">
+                {{ form_label(form.config.pocket_consumer_key) }}
+                {{ form_errors(form.config.pocket_consumer_key) }}
+                {{ form_widget(form.config.pocket_consumer_key) }}
+                <p>
+                    &raquo;
+                    <a href="https://getpocket.com/developer/docs/authentication">https://getpocket.com/developer/docs/authentication</a>
+                </p>
+            </div>
+        </fieldset>
+
         {{ form_rest(form.config) }}
     </form>
 
index bf390e8994d81d81b96ce3d45cc0357959b1eac6..5330c35392d92f3dc7c442141e09e88b95201fcf 100644 (file)
                                 </div>
                             </div>
 
+                            <div class="row">
+                                <div class="input-field col s12">
+                                    {{ form_label(form.config.pocket_consumer_key) }}
+                                    {{ form_errors(form.config.pocket_consumer_key) }}
+                                    {{ form_widget(form.config.pocket_consumer_key) }}
+                                    <p>
+                                        &raquo;
+                                        <a href="https://getpocket.com/developer/docs/authentication">https://getpocket.com/developer/docs/authentication</a>
+                                    </p>
+                                </div>
+                            </div>
+
                             {{ form_widget(form.config.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
                             {{ form_rest(form.config) }}
                         </form>
index 1f92c1828c00c8c92553ccaad58b1a53fcced6cb..56be5cbfd8e56215f5b5a5bc22e063922ee0e221 100644 (file)
@@ -44,7 +44,7 @@ class PocketController extends Controller
 
         return $this->render('WallabagImportBundle:Pocket:index.html.twig', [
             'import' => $this->getPocketImportService(),
-            'has_consumer_key' => '' == trim($this->get('craue_config')->get('pocket_consumer_key')) ? false : true,
+            'has_consumer_key' => '' === trim($this->getUser()->getConfig()->getPocketConsumerKey()) ? false : true,
             'form' => $form->createView(),
         ]);
     }
index cc6faf1f5860c3166393739dec53e0c5a0e822d5..40603c904b54e270c66bdfbc08ff8e628701f92b 100644 (file)
@@ -13,16 +13,14 @@ use Craue\ConfigBundle\Util\Config;
 class PocketImport extends AbstractImport
 {
     private $client;
-    private $consumerKey;
     private $accessToken;
 
     const NB_ELEMENTS = 5000;
 
-    public function __construct(EntityManager $em, ContentProxy $contentProxy, Config $craueConfig)
+    public function __construct(EntityManager $em, ContentProxy $contentProxy)
     {
         $this->em = $em;
         $this->contentProxy = $contentProxy;
-        $this->consumerKey = $craueConfig->get('pocket_consumer_key');
         $this->logger = new NullLogger();
     }
 
@@ -72,7 +70,7 @@ class PocketImport extends AbstractImport
         $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/request',
             [
                 'body' => json_encode([
-                    'consumer_key' => $this->consumerKey,
+                    'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(),
                     'redirect_uri' => $redirectUri,
                 ]),
             ]
@@ -102,7 +100,7 @@ class PocketImport extends AbstractImport
         $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/oauth/authorize',
             [
                 'body' => json_encode([
-                    'consumer_key' => $this->consumerKey,
+                    'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(),
                     'code' => $code,
                 ]),
             ]
@@ -131,7 +129,7 @@ class PocketImport extends AbstractImport
         $request = $this->client->createRequest('POST', 'https://getpocket.com/v3/get',
             [
                 'body' => json_encode([
-                    'consumer_key' => $this->consumerKey,
+                    'consumer_key' => $this->user->getConfig()->getPocketConsumerKey(),
                     'access_token' => $this->accessToken,
                     'detailType' => 'complete',
                     'state' => 'all',
index aa5941b703d06192ab40335379f5d0848b2ec351..6195fa073e165f5fa4160bc76ae93b162d9a22d0 100644 (file)
                 <div class="card-panel red white-text">
                     {{ 'import.pocket.config_missing.description'|trans }}
 
-                    {% if is_granted('ROLE_SUPER_ADMIN') %}
-                        {{ 'import.pocket.config_missing.admin_message'|trans({'%keyurls%': '<a href="' ~ path('craue_config_settings_modify') ~ '#set-import">', '%keyurle%':'</a>'})|raw }}
-                    {% else %}
-                        {{ 'import.pocket.config_missing.user_message'|trans }}
-                    {% endif %}
+                    {{ 'import.pocket.config_missing.admin_message'|trans({'%keyurls%': '<a href="' ~ path('config') ~ '">', '%keyurle%':'</a>'})|raw }}
                 </div>
             {% endif %}
 
@@ -31,7 +27,7 @@
                         {{ form_label(form.mark_as_read) }}
                     </div>
                 </div>
-                <button class="btn waves-effect waves-light" type="submit" name="action">
+                <button class="btn waves-effect waves-light" type="submit" name="action" {% if not has_consumer_key %}disabled="disabled"{% endif %}>
                     {{ 'import.pocket.connect_to_pocket'|trans }}
                 </button>
             </form>
index a3f68892f40b7420356939a0ab3e0d453a66aedf..48fbbfb615ea7fd97abf184bee3b601635a017f1 100644 (file)
@@ -4,6 +4,7 @@ namespace Tests\Wallabag\ImportBundle\Import;
 
 use Wallabag\UserBundle\Entity\User;
 use Wallabag\CoreBundle\Entity\Entry;
+use Wallabag\CoreBundle\Entity\Config;
 use Wallabag\ImportBundle\Import\PocketImport;
 use GuzzleHttp\Client;
 use GuzzleHttp\Subscriber\Mock;
@@ -27,6 +28,11 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
     {
         $this->user = new User();
 
+        $config = new Config($this->user);
+        $config->setPocketConsumerKey('xxx');
+
+        $this->user->setConfig($config);
+
         $this->contentProxy = $this->getMockBuilder('Wallabag\CoreBundle\Helper\ContentProxy')
             ->disableOriginalConstructor()
             ->getMock();
@@ -35,19 +41,9 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
             ->disableOriginalConstructor()
             ->getMock();
 
-        $config = $this->getMockBuilder('Craue\ConfigBundle\Util\Config')
-            ->disableOriginalConstructor()
-            ->getMock();
-
-        $config->expects($this->any())
-            ->method('get')
-            ->with('pocket_consumer_key')
-            ->willReturn($consumerKey);
-
         $pocket = new PocketImport(
             $this->em,
-            $this->contentProxy,
-            $config
+            $this->contentProxy
         );
         $pocket->setUser($this->user);