From bc78968764c741019a6b866ad434678cdbecbba4 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 20 Jan 2016 19:54:57 +0100 Subject: Move default configuration out of parameters These default configuration value shouldn't be in parameters.yml. --- src/Wallabag/CoreBundle/Command/InstallCommand.php | 8 ++++---- src/Wallabag/CoreBundle/Controller/ConfigController.php | 8 ++++---- .../CoreBundle/DependencyInjection/Configuration.php | 12 ++++++++++++ .../CoreBundle/DependencyInjection/WallabagCoreExtension.php | 5 +++++ src/Wallabag/CoreBundle/Resources/config/services.yml | 8 ++++---- 5 files changed, 29 insertions(+), 12 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index da099a19..7a7e3a64 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -205,10 +205,10 @@ class InstallCommand extends ContainerAwareCommand $em->persist($user); $config = new Config($user); - $config->setTheme($this->getContainer()->getParameter('theme')); - $config->setItemsPerPage($this->getContainer()->getParameter('items_on_page')); - $config->setRssLimit($this->getContainer()->getParameter('rss_limit')); - $config->setLanguage($this->getContainer()->getParameter('language')); + $config->setTheme($this->getContainer()->getParameter('wallabag_core.theme')); + $config->setItemsPerPage($this->getContainer()->getParameter('wallabag_core.items_on_page')); + $config->setRssLimit($this->getContainer()->getParameter('wallabag_core.rss_limit')); + $config->setLanguage($this->getContainer()->getParameter('wallabag_core.language')); $em->persist($config); diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 6c375909..4ece6431 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -133,10 +133,10 @@ class ConfigController extends Controller $userManager->updateUser($newUser, true); $config = new Config($newUser); - $config->setTheme($this->container->getParameter('theme')); - $config->setItemsPerPage($this->container->getParameter('items_on_page')); - $config->setRssLimit($this->container->getParameter('rss_limit')); - $config->setLanguage($this->container->getParameter('language')); + $config->setTheme($this->container->getParameter('wallabag_core.theme')); + $config->setItemsPerPage($this->container->getParameter('wallabag_core.items_on_page')); + $config->setRssLimit($this->container->getParameter('wallabag_core.rss_limit')); + $config->setLanguage($this->container->getParameter('wallabag_core.language')); $em->persist($config); diff --git a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php index 32acd1f1..4d5a63f8 100644 --- a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php +++ b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php @@ -17,6 +17,18 @@ class Configuration implements ConfigurationInterface ->arrayNode('languages') ->prototype('scalar')->end() ->end() + ->integerNode('items_on_page') + ->defaultValue(12) + ->end() + ->scalarNode('theme') + ->defaultValue('material') + ->end() + ->scalarNode('language') + ->defaultValue('en') + ->end() + ->integerNode('rss_limit') + ->defaultValue(50) + ->end() ->end() ; diff --git a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php index 9ff9b732..73bbffe1 100644 --- a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php +++ b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php @@ -13,7 +13,12 @@ class WallabagCoreExtension extends Extension { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); + $container->setParameter('wallabag_core.languages', $config['languages']); + $container->setParameter('wallabag_core.items_on_page', $config['items_on_page']); + $container->setParameter('wallabag_core.theme', $config['theme']); + $container->setParameter('wallabag_core.language', $config['language']); + $container->setParameter('wallabag_core.rss_limit', $config['rss_limit']); $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.yml'); diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 25d71cba..6a1afcc0 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml @@ -76,10 +76,10 @@ services: class: Wallabag\CoreBundle\EventListener\RegistrationConfirmedListener arguments: - "@doctrine.orm.entity_manager" - - %theme% - - %items_on_page% - - %rss_limit% - - %language% + - %wallabag_core.theme% + - %wallabag_core.items_on_page% + - %wallabag_core.rss_limit% + - %wallabag_core.language% tags: - { name: kernel.event_subscriber } -- cgit v1.2.3 From 26975877d76a99f6a3153d3d3b4fc6c9f32687bc Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 20 Jan 2016 20:00:12 +0100 Subject: Always include warning message We'll remove it later, on the stable release --- src/Wallabag/CoreBundle/Resources/views/base.html.twig | 4 +--- .../views/themes/material/Config/index.html.twig | 16 ++++++++-------- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Resources/views/base.html.twig b/src/Wallabag/CoreBundle/Resources/views/base.html.twig index 9e515a17..1742b4aa 100644 --- a/src/Wallabag/CoreBundle/Resources/views/base.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/base.html.twig @@ -68,10 +68,8 @@ {% block footer %}{% endblock %} - {% if warning_message %}
- {{ warning_message | raw }} + You're trying wallabag v2, which is in alpha version. If you find a bug, please have a look to our issues list and open a new if necessary
- {% endif %} 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 8743dc1d..1cae90a4 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 @@ -11,14 +11,14 @@
-- cgit v1.2.3 From 63e40f2d7c4074aff0be587c828eb511a6b7c878 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 21 Jan 2016 08:53:09 +0100 Subject: Add CraueConfig for internal settings --- .../CoreBundle/Controller/ConfigController.php | 1 + .../CoreBundle/Controller/StaticController.php | 5 ++++- .../DependencyInjection/Configuration.php | 4 ++++ .../DependencyInjection/WallabagCoreExtension.php | 2 ++ src/Wallabag/CoreBundle/Helper/EntriesExport.php | 7 +++--- .../CoreBundle/Resources/config/services.yml | 4 ++-- .../Resources/translations/messages.fr.yml | 1 + .../views/themes/baggy/Entry/entry.html.twig | 19 ++++++++-------- .../Resources/views/themes/baggy/layout.html.twig | 3 +++ .../views/themes/material/Entry/entry.html.twig | 25 +++++++++++----------- .../views/themes/material/layout.html.twig | 3 +++ 11 files changed, 45 insertions(+), 29 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 4ece6431..c7513f79 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -163,6 +163,7 @@ class ConfigController extends Controller 'username' => $user->getUsername(), 'token' => $config->getRssToken(), ), + 'twofactor_auth' => $this->getParameter('twofactor_auth'), )); } diff --git a/src/Wallabag/CoreBundle/Controller/StaticController.php b/src/Wallabag/CoreBundle/Controller/StaticController.php index 9ada371b..5b7bd56e 100644 --- a/src/Wallabag/CoreBundle/Controller/StaticController.php +++ b/src/Wallabag/CoreBundle/Controller/StaticController.php @@ -25,7 +25,10 @@ class StaticController extends Controller { return $this->render( 'WallabagCoreBundle:Static:about.html.twig', - array() + array( + 'version' => $this->getParameter('wallabag_core.version'), + 'paypal_url' => $this->getParameter('wallabag_core.paypal_url'), + ) ); } diff --git a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php index 4d5a63f8..bc405fdc 100644 --- a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php +++ b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php @@ -29,6 +29,10 @@ class Configuration implements ConfigurationInterface ->integerNode('rss_limit') ->defaultValue(50) ->end() + ->scalarNode('version') + ->end() + ->scalarNode('paypal_url') + ->end() ->end() ; diff --git a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php index 73bbffe1..9b4703e4 100644 --- a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php +++ b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php @@ -19,6 +19,8 @@ class WallabagCoreExtension extends Extension $container->setParameter('wallabag_core.theme', $config['theme']); $container->setParameter('wallabag_core.language', $config['language']); $container->setParameter('wallabag_core.rss_limit', $config['rss_limit']); + $container->setParameter('wallabag_core.version', $config['version']); + $container->setParameter('wallabag_core.paypal_url', $config['paypal_url']); $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.yml'); diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index 31a80d6e..965a40b6 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php @@ -8,6 +8,7 @@ use JMS\Serializer\SerializerBuilder; use PHPePub\Core\EPub; use PHPePub\Core\Structure\OPF\DublinCore; use Symfony\Component\HttpFoundation\Response; +use Craue\ConfigBundle\Util\Config; /** * This class doesn't have unit test BUT it's fully covered by a functional test with ExportControllerTest. @@ -27,12 +28,12 @@ class EntriesExport wallabagUrl = $wallabagUrl; + $this->wallabagUrl = $craueConfig->get('wallabag_url'); $this->logoPath = $logoPath; } diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 6a1afcc0..813f8a96 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml @@ -3,7 +3,7 @@ services: class: Wallabag\CoreBundle\Helper\DetectActiveTheme arguments: - "@security.token_storage" - - %theme% # default theme from parameters.yml + - %wallabag_core.theme% # custom form type wallabag_core.form.type.config: @@ -86,7 +86,7 @@ services: wallabag_core.helper.entries_export: class: Wallabag\CoreBundle\Helper\EntriesExport arguments: - - %wallabag_url% + - "@craue_config" - src/Wallabag/CoreBundle/Resources/public/themes/_global/img/appicon/apple-touch-icon-152.png wallabag.operator.array.matches: diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 20f4352b..cc814cc4 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -13,6 +13,7 @@ archive: 'Lus' all: 'Tous les articles' tags: 'Tags' config: 'Configuration' +internal settings: 'Configuration interne' import: 'Importer' howto: 'Aide' logout: 'Déconnexion' diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig index c23d0e27..27a88287 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig @@ -11,16 +11,15 @@
  • {% if entry.isArchived == 0 %}{% trans %}Mark as read{% endtrans %}{% else %}{% trans %}Mark as unread{% endtrans %}{% endif %}
  • {% trans %}Toggle favorite{% endtrans %}
  • {% trans %}Delete{% endtrans %}
  • - {% if share_twitter %}
  • {% endif %} - {% if share_mail %}
  • {% endif %} - {% if share_shaarli %}
  • {% trans %}shaarli{% endtrans %}
  • {% endif %} - {% if share_diaspora %}
  • {% trans %}diaspora{% endtrans %}
  • {% endif %} - {# {% if flattr %}{% if flattr.status == flattrable %}
  • {% trans %}flattr{% endtrans %}
  • {% elseif flattr.status == flattred %}
  • Carrot
  • {% endif %} - {% if show_printlink %}
  • {% trans %}Print{% endtrans %}
  • {% endif %} - {% if export_epub %}
  • EPUB
  • {% endif %} - {% if export_mobi %}
  • MOBI
  • {% endif %} - {% if export_pdf %}
  • PDF
  • {% endif %} + {% if craue_setting('share_twitter') %}
  • {% endif %} + {% if craue_setting('share_mail') %}
  • {% endif %} + {% if craue_setting('share_shaarli') %}
  • {% trans %}shaarli{% endtrans %}
  • {% endif %} + {% if craue_setting('share_diaspora') %}
  • {% trans %}diaspora{% endtrans %}
  • {% endif %} + {% if craue_setting('carrot') %}
  • Carrot
  • {% endif %} + {% if craue_setting('show_printlink') %}
  • {% trans %}Print{% endtrans %}
  • {% endif %} + {% if craue_setting('export_epub') %}
  • EPUB
  • {% endif %} + {% if craue_setting('export_mobi') %}
  • MOBI
  • {% endif %} + {% if craue_setting('export_pdf') %}
  • PDF
  • {% endif %}
  • {% trans %}Does this article appear wrong?{% endtrans %}
  • diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig index 3aead497..b630070c 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig @@ -51,6 +51,9 @@
  • {% trans %}config{% endtrans %}
  • + {% if is_granted('ROLE_SUPER_ADMIN') %} +
  • {% trans %}internal settings{% endtrans %}
  • + {% endif %}
  • {% trans %}import{% endtrans %}
  • {% trans %}howto{% endtrans %}
  • {% trans %}about{% endtrans %}
  • diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig index 31963ae8..dad96187 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig @@ -97,12 +97,11 @@
    @@ -114,13 +113,13 @@
      - {% if export_epub %}
    • EPUB
    • {% endif %} - {% if export_mobi %}
    • MOBI
    • {% endif %} - {% if export_pdf %}
    • PDF
    • {% endif %} - {% if export_csv %}
    • CSV
    • {% endif %} - {% if export_json %}
    • JSON
    • {% endif %} - {% if export_txt %}
    • TXT
    • {% endif %} - {% if export_xml %}
    • XML
    • {% endif %} + {% if craue_setting('export_epub') %}
    • EPUB
    • {% endif %} + {% if craue_setting('export_mobi') %}
    • MOBI
    • {% endif %} + {% if craue_setting('export_pdf') %}
    • PDF
    • {% endif %} + {% if craue_setting('export_csv') %}
    • CSV
    • {% endif %} + {% if craue_setting('export_json') %}
    • JSON
    • {% endif %} + {% if craue_setting('export_txt') %}
    • TXT
    • {% endif %} + {% if craue_setting('export_xml') %}
    • XML
    • {% endif %}
    diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig index a8b6dc3f..dff9e612 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig @@ -45,6 +45,9 @@
  • {% trans %}all{% endtrans %}
  • {% trans %}tags{% endtrans %}
  • {% trans %}config{% endtrans %}
  • + {% if is_granted('ROLE_SUPER_ADMIN') %} +
  • {% trans %}internal settings{% endtrans %}
  • + {% endif %}
  • {% trans %}import{% endtrans %}
  • {% trans %}howto{% endtrans %}
  • {% trans %}logout{% endtrans %}
  • -- cgit v1.2.3 From d6ba77e888064dcf5757fb008426eb8bfcd6dd4c Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 21 Jan 2016 12:23:45 +0100 Subject: Create internal setting on install & fixtures --- src/Wallabag/CoreBundle/Command/InstallCommand.php | 90 ++++++++++++++++ .../DataFixtures/ORM/LoadSettingData.php | 113 +++++++++++++++++++++ 2 files changed, 203 insertions(+) create mode 100644 src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 7a7e3a64..f6c85cf9 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -12,6 +12,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; use Symfony\Component\Console\Question\Question; use Wallabag\CoreBundle\Entity\Config; +use Craue\ConfigBundle\Entity\Setting; class InstallCommand extends ContainerAwareCommand { @@ -212,6 +213,95 @@ class InstallCommand extends ContainerAwareCommand $em->persist($config); + // cleanup before insert new stuff + $em->createQuery('DELETE FROM CraueConfigBundle:Setting')->execute(); + + $settings = [ + [ + 'name' => 'download_pictures', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'carrot', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'share_diaspora', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'diaspora_url', + 'value' => 'http://diasporapod.com', + 'section' => 'entry', + ], + [ + 'name' => 'share_shaarli', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'shaarli_url', + 'value' => 'http://myshaarli.com', + 'section' => 'entry', + ], + [ + 'name' => 'share_mail', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'share_twitter', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'export_epub', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'export_mobi', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'export_pdf', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'pocket_consumer_key', + 'value' => NULL, + 'section' => 'import', + ], + [ + 'name' => 'show_printlink', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'wallabag_support_url', + 'value' => 'https://www.wallabag.org/pages/support.html', + 'section' => 'misc', + ], + [ + 'name' => 'wallabag_url', + 'value' => 'http://v2.wallabag.org', + 'section' => 'misc', + ], + ]; + + foreach ($settings as $setting) { + $newSetting = new Setting(); + $newSetting->setName($setting['name']); + $newSetting->setValue($setting['value']); + $newSetting->setSection($setting['section']); + $em->persist($newSetting); + } + $em->flush(); $this->defaultOutput->writeln(''); diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php new file mode 100644 index 00000000..863d28f5 --- /dev/null +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php @@ -0,0 +1,113 @@ + 'download_pictures', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'carrot', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'share_diaspora', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'diaspora_url', + 'value' => 'http://diasporapod.com', + 'section' => 'entry', + ], + [ + 'name' => 'share_shaarli', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'shaarli_url', + 'value' => 'http://myshaarli.com', + 'section' => 'entry', + ], + [ + 'name' => 'share_mail', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'share_twitter', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'export_epub', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'export_mobi', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'export_pdf', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'pocket_consumer_key', + 'value' => NULL, + 'section' => 'import', + ], + [ + 'name' => 'show_printlink', + 'value' => '1', + 'section' => 'entry', + ], + [ + 'name' => 'wallabag_support_url', + 'value' => 'https://www.wallabag.org/pages/support.html', + 'section' => 'misc', + ], + [ + 'name' => 'wallabag_url', + 'value' => 'http://v2.wallabag.org', + 'section' => 'misc', + ], + ]; + + foreach ($settings as $setting) { + $newSetting = new Setting(); + $newSetting->setName($setting['name']); + $newSetting->setValue($setting['value']); + $newSetting->setSection($setting['section']); + $manager->persist($newSetting); + } + + $manager->flush(); + } + + /** + * {@inheritdoc} + */ + public function getOrder() + { + return 50; + } +} -- cgit v1.2.3 From 67c99849ae03d41e94b144321d627e8c6ddd5fa3 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 21 Jan 2016 12:24:27 +0100 Subject: Use alias to get container parameters --- src/Wallabag/CoreBundle/Controller/ConfigController.php | 8 ++++---- src/Wallabag/CoreBundle/Controller/RssController.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index c7513f79..25e69820 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -133,10 +133,10 @@ class ConfigController extends Controller $userManager->updateUser($newUser, true); $config = new Config($newUser); - $config->setTheme($this->container->getParameter('wallabag_core.theme')); - $config->setItemsPerPage($this->container->getParameter('wallabag_core.items_on_page')); - $config->setRssLimit($this->container->getParameter('wallabag_core.rss_limit')); - $config->setLanguage($this->container->getParameter('wallabag_core.language')); + $config->setTheme($this->getParameter('wallabag_core.theme')); + $config->setItemsPerPage($this->getParameter('wallabag_core.items_on_page')); + $config->setRssLimit($this->getParameter('wallabag_core.rss_limit')); + $config->setLanguage($this->getParameter('wallabag_core.language')); $em->persist($config); diff --git a/src/Wallabag/CoreBundle/Controller/RssController.php b/src/Wallabag/CoreBundle/Controller/RssController.php index 2b7ef598..a4f7a200 100644 --- a/src/Wallabag/CoreBundle/Controller/RssController.php +++ b/src/Wallabag/CoreBundle/Controller/RssController.php @@ -84,7 +84,7 @@ class RssController extends Controller $pagerAdapter = new DoctrineORMAdapter($qb->getQuery()); $entries = new Pagerfanta($pagerAdapter); - $perPage = $user->getConfig()->getRssLimit() ?: $this->container->getParameter('rss_limit'); + $perPage = $user->getConfig()->getRssLimit() ?: $this->getParameter('wallabag_core.rss_limit'); $entries->setMaxPerPage($perPage); return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array( -- cgit v1.2.3 From 2a58606983bd6091866a9f38149a87c25900decd Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 21 Jan 2016 12:24:35 +0100 Subject: Fix tests --- src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php index 7d75e2b7..a79d7b90 100644 --- a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php +++ b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php @@ -81,6 +81,7 @@ class InstallCommandTest extends WallabagCoreTestCase $this->assertContains('Step 1 of 4. Checking system requirements.', $tester->getDisplay()); $this->assertContains('Step 2 of 4. Setting up database.', $tester->getDisplay()); + $this->assertContains('Droping database, creating database and schema, clearing the cache', $tester->getDisplay()); $this->assertContains('Step 3 of 4. Administration setup.', $tester->getDisplay()); $this->assertContains('Step 4 of 4. Installing assets.', $tester->getDisplay()); -- cgit v1.2.3 From 1c7d66645b312ee41a392c1d154f49fb6a6ec389 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 21 Jan 2016 12:29:35 +0100 Subject: CS --- src/Wallabag/CoreBundle/Command/InstallCommand.php | 2 +- src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index f6c85cf9..096f306f 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -274,7 +274,7 @@ class InstallCommand extends ContainerAwareCommand ], [ 'name' => 'pocket_consumer_key', - 'value' => NULL, + 'value' => null, 'section' => 'import', ], [ diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php index 863d28f5..8e3c7b59 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php @@ -72,7 +72,7 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface ], [ 'name' => 'pocket_consumer_key', - 'value' => NULL, + 'value' => null, 'section' => 'import', ], [ -- cgit v1.2.3 From 07c9b1c98a104a88f6bd0c97b54a8783444a2ac4 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Fri, 22 Jan 2016 18:48:04 +0100 Subject: Fix permission to settings page --- .../Tests/Controller/SettingsControllerTest.php | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/Wallabag/CoreBundle/Tests/Controller/SettingsControllerTest.php (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Tests/Controller/SettingsControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/SettingsControllerTest.php new file mode 100644 index 00000000..354aedba --- /dev/null +++ b/src/Wallabag/CoreBundle/Tests/Controller/SettingsControllerTest.php @@ -0,0 +1,32 @@ +logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/settings'); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + } + + public function testSettingsWithNormalUser() + { + $this->logInAs('bob'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/settings'); + + $this->assertEquals(403, $client->getResponse()->getStatusCode()); + } +} -- cgit v1.2.3 From a74a6ca2b164447f2675a13840f862c2c4c672fd Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 31 Jan 2016 14:54:30 +0100 Subject: Add new export config --- src/Wallabag/CoreBundle/Command/InstallCommand.php | 20 ++++++++++++++++++++ .../CoreBundle/DataFixtures/ORM/LoadSettingData.php | 20 ++++++++++++++++++++ .../views/themes/material/Entry/entries.html.twig | 14 +++++++------- 3 files changed, 47 insertions(+), 7 deletions(-) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 096f306f..93792692 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -272,6 +272,26 @@ class InstallCommand extends ContainerAwareCommand 'value' => '1', 'section' => 'export', ], + [ + 'name' => 'export_csv', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'export_json', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'export_txt', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'export_xml', + 'value' => '1', + 'section' => 'export', + ], [ 'name' => 'pocket_consumer_key', 'value' => null, diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php index 8e3c7b59..5e89c2a9 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php @@ -70,6 +70,26 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface 'value' => '1', 'section' => 'export', ], + [ + 'name' => 'export_csv', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'export_json', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'export_txt', + 'value' => '1', + 'section' => 'export', + ], + [ + 'name' => 'export_xml', + 'value' => '1', + 'section' => 'export', + ], [ 'name' => 'pocket_consumer_key', 'value' => null, diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig index 6de800b9..c86b8d88 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig @@ -99,13 +99,13 @@ {% endif %}

    {% trans %}Export{% endtrans %}

    -- cgit v1.2.3