aboutsummaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-01-21 08:53:09 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-01-31 14:48:26 +0100
commit63e40f2d7c4074aff0be587c828eb511a6b7c878 (patch)
tree038959b20e15c60841f8f3584c99068f52460939 /app
parent26975877d76a99f6a3153d3d3b4fc6c9f32687bc (diff)
downloadwallabag-63e40f2d7c4074aff0be587c828eb511a6b7c878.tar.gz
wallabag-63e40f2d7c4074aff0be587c828eb511a6b7c878.tar.zst
wallabag-63e40f2d7c4074aff0be587c828eb511a6b7c878.zip
Add CraueConfig for internal settings
Diffstat (limited to 'app')
-rw-r--r--app/AppKernel.php1
-rw-r--r--app/DoctrineMigrations/Version20160120200534_settings.php51
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml15
-rw-r--r--app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml15
-rw-r--r--app/Resources/CraueConfigBundle/views/Settings/modify.html.twig43
-rw-r--r--app/config/config.yml24
-rw-r--r--app/config/parameters.yml.dist28
-rw-r--r--app/config/routing.yml9
-rw-r--r--app/config/security.yml1
-rw-r--r--app/config/tests/parameters.yml.dist.mysql28
-rw-r--r--app/config/tests/parameters.yml.dist.pgsql28
-rw-r--r--app/config/tests/parameters.yml.dist.sqlite28
12 files changed, 140 insertions, 131 deletions
diff --git a/app/AppKernel.php b/app/AppKernel.php
index 7e76a9e9..82d3aa38 100644
--- a/app/AppKernel.php
+++ b/app/AppKernel.php
@@ -33,6 +33,7 @@ class AppKernel extends Kernel
33 new KPhoen\RulerZBundle\KPhoenRulerZBundle(), 33 new KPhoen\RulerZBundle\KPhoenRulerZBundle(),
34 new Wallabag\ImportBundle\WallabagImportBundle(), 34 new Wallabag\ImportBundle\WallabagImportBundle(),
35 new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), 35 new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
36 new Craue\ConfigBundle\CraueConfigBundle(),
36 ]; 37 ];
37 38
38 if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { 39 if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
diff --git a/app/DoctrineMigrations/Version20160120200534_settings.php b/app/DoctrineMigrations/Version20160120200534_settings.php
new file mode 100644
index 00000000..34809ff9
--- /dev/null
+++ b/app/DoctrineMigrations/Version20160120200534_settings.php
@@ -0,0 +1,51 @@
1<?php
2
3namespace Application\Migrations;
4
5use Doctrine\DBAL\Migrations\AbstractMigration;
6use Doctrine\DBAL\Schema\Schema;
7
8/**
9 * Auto-generated Migration: Please modify to your needs!
10 */
11class Version20160120200534_settings extends AbstractMigration
12{
13 /**
14 * @param Schema $schema
15 */
16 public function up(Schema $schema)
17 {
18 // this up() migration is auto-generated, please modify it to your needs
19 $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
20
21 $this->addSql('CREATE TABLE craue_config_setting (name VARCHAR(255) NOT NULL, value VARCHAR(255) DEFAULT NULL, section VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_B95BA9425E237E06 (name), PRIMARY KEY(name)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
22 $this->addSql("INSERT INTO `craue_config_setting` (`name`, `value`, `section`) VALUES
23 ('download_pictures', '1', 'entry'),
24 ('carrot', '1', 'entry'),
25 ('share_diaspora', '1', 'entry'),
26 ('diaspora_url', 'http://diasporapod.com', 'entry'),
27 ('share_shaarli', '1', 'entry'),
28 ('shaarli_url', 'http://myshaarli.com', 'entry'),
29 ('share_mail', '1', 'entry'),
30 ('share_twitter', '1', 'entry'),
31 ('export_epub', '1', 'export'),
32 ('export_mobi', '1', 'export'),
33 ('export_pdf', '1', 'export'),
34 ('pocket_consumer_key', NULL, 'import'),
35 ('show_printlink', '1', 'entry'),
36 ('wallabag_support_url', 'https://www.wallabag.org/pages/support.html', 'misc'),
37 ('wallabag_url', 'http://v2.wallabag.org', 'misc')"
38 );
39 }
40
41 /**
42 * @param Schema $schema
43 */
44 public function down(Schema $schema)
45 {
46 // this down() migration is auto-generated, please modify it to your needs
47 $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
48
49 $this->addSql('DROP TABLE craue_config_setting');
50 }
51}
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml
new file mode 100644
index 00000000..ea90460e
--- /dev/null
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml
@@ -0,0 +1,15 @@
1download_pictures: Download pictures on your server
2carrot: Enable share to Carrot
3diaspora_url: Diaspora URL, if the service is enabled
4export_epub: Enable ePub export
5export_mobi: Enable .mobi export
6export_pdf: Enable PDF export
7pocket_consumer_key: Consumer key for Pocket to import contents (https://getpocket.com/developer/docs/authentication)
8shaarli_url: URL de Shaarli, if the service is enabled
9share_diaspora: Enable share to Diaspora
10share_mail: Enable share by email
11share_shaarli: Enable share to Shaarli
12share_twitter: Enable share to Twitter
13show_printlink: Display a link to print content
14wallabag_support_url: Support URL for wallabag
15wallabag_url: URL of *your* wallabag instance
diff --git a/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml
new file mode 100644
index 00000000..19600045
--- /dev/null
+++ b/app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml
@@ -0,0 +1,15 @@
1download_pictures: Télécharger les images sur le serveur
2carrot: Activer le partage vers Carrot
3diaspora_url: URL de Diaspora, si le service Diaspora est activé
4export_epub: Activer l'export ePub
5export_mobi: Activer l'export .mobi
6export_pdf: Activer l'export PDF
7pocket_consumer_key: Clé d'authentification Pocket pour importer les données (https://getpocket.com/developer/docs/authentication)
8shaarli_url: URL de Shaarli, si le service Diaspora est activé
9share_diaspora: Activer le partage vers Diaspora
10share_mail: Activer le partage par email
11share_shaarli: Activer le partage vers Shaarli
12share_twitter: Activer le partage vers Twitter
13show_printlink: Afficher un lien pour imprimer
14wallabag_support_url: URL de support de wallabag
15wallabag_url: URL de *votre* instance de wallabag
diff --git a/app/Resources/CraueConfigBundle/views/Settings/modify.html.twig b/app/Resources/CraueConfigBundle/views/Settings/modify.html.twig
new file mode 100644
index 00000000..f44db420
--- /dev/null
+++ b/app/Resources/CraueConfigBundle/views/Settings/modify.html.twig
@@ -0,0 +1,43 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{% trans %}internal settings{% endtrans %}{% endblock %}
4
5{% block content %}
6 <div class="row">
7 <div class="col s12">
8 <div class="card-panel settings">
9 {{ form_start(form, {'attr': {'class': 'craue_config_settings_modify'}}) }}
10 {{ form_errors(form) }}
11
12 <div class="row">
13 <div class="div_tabs col s12">
14 <ul class="tabs">
15 {% for section in sections | craue_sortSections %}
16 <li class="tab col s3"><a href="#set-{{ section }}">{{ section | trans({}, 'CraueConfigBundle') }}</a></li>
17 {% endfor %}
18 </ul>
19 </div>
20
21 {% for section in sections | craue_sortSections %}
22 <div id="set-{{ section }}" class="col s12">
23 {% for setting in form.settings if setting.section.vars.value == section %}
24 {{ form_row(setting.name) }}
25 {{ form_row(setting.section) }}
26 {{ form_row(setting.value, {
27 'label': setting.name.vars.value | trans({}, 'CraueConfigBundle'),
28 }) }}
29 {% endfor %}
30 </div>
31 {% endfor %}
32 </div>
33
34 <button class="btn waves-effect waves-light" type="submit" name="action">
35 {{ 'modify_settings' | trans({}, 'CraueConfigBundle') }}
36 </button>
37
38 {{ form_rest(form) }}
39 {{ form_end(form) }}
40 </div>
41 </div>
42 </div>
43{% endblock %}
diff --git a/app/config/config.yml b/app/config/config.yml
index 58e1dd66..3c278ea6 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -28,6 +28,8 @@ framework:
28 assets: ~ 28 assets: ~
29 29
30wallabag_core: 30wallabag_core:
31 version: 2.0.0-alpha.1
32 paypal_url: "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9UBA65LG3FX9Y&lc=gb"
31 languages: 33 languages:
32 en: 'English' 34 en: 'English'
33 fr: 'Français' 35 fr: 'Français'
@@ -46,28 +48,6 @@ wallabag_import:
46twig: 48twig:
47 debug: "%kernel.debug%" 49 debug: "%kernel.debug%"
48 strict_variables: "%kernel.debug%" 50 strict_variables: "%kernel.debug%"
49 globals:
50 share_twitter: %share_twitter%
51 share_mail: %share_mail%
52 share_shaarli: %share_shaarli%
53 shaarli_url: %shaarli_url%
54 share_diaspora: %share_diaspora%
55 diaspora_url: %diaspora_url%
56 flattr: %flattr%
57 flattrable: 1
58 flattred: 2
59 carrot: %carrot%
60 show_printlink: %show_printlink%
61 export_epub: %export_epub%
62 export_mobi: %export_mobi%
63 export_pdf: %export_pdf%
64 export_csv: %export_csv%
65 export_json: %export_json%
66 export_txt: %export_txt%
67 export_xml: %export_xml%
68 version: %app.version%
69 twofactor_auth: %twofactor_auth%
70 paypal_url: "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9UBA65LG3FX9Y&lc=gb"
71 form_themes: 51 form_themes:
72 - "LexikFormFilterBundle:Form:form_div_layout.html.twig" 52 - "LexikFormFilterBundle:Form:form_div_layout.html.twig"
73 53
diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist
index 52d26cb4..3eeedb78 100644
--- a/app/config/parameters.yml.dist
+++ b/app/config/parameters.yml.dist
@@ -37,32 +37,6 @@ parameters:
37 # A secret key that's used to generate certain security-related tokens 37 # A secret key that's used to generate certain security-related tokens
38 secret: ThisTokenIsNotSoSecretChangeIt 38 secret: ThisTokenIsNotSoSecretChangeIt
39 39
40 # wallabag misc 40 # two factor stuff
41 app.version: 2.0.0-alpha
42 twofactor_auth: true 41 twofactor_auth: true
43 twofactor_sender: no-reply@wallabag.org 42 twofactor_sender: no-reply@wallabag.org
44
45 download_pictures: false # if true, pictures will be stored into data/assets for each article
46
47 # Entry view
48 share_twitter: true
49 share_mail: true
50 share_shaarli: true
51 shaarli_url: http://myshaarli.com
52 share_diaspora: true
53 diaspora_url: http://diasporapod.com
54 flattr: true
55 carrot: true
56 show_printlink: true
57 export_epub: true
58 export_mobi: true
59 export_pdf: true
60 export_csv: true
61 export_json: true
62 export_txt: true
63 export_xml: true
64 wallabag_url: http://v2.wallabag.org
65 wallabag_support_url: 'https://www.wallabag.org/pages/support.html'
66
67 # pocket import
68 pocket_consumer_key: xxxxxxxx
diff --git a/app/config/routing.yml b/app/config/routing.yml
index 84b98d23..c491d35d 100644
--- a/app/config/routing.yml
+++ b/app/config/routing.yml
@@ -22,7 +22,9 @@ rest :
22 22
23homepage: 23homepage:
24 path: "/{page}" 24 path: "/{page}"
25 defaults: { _controller: WallabagCoreBundle:Entry:showUnread, page : 1 } 25 defaults:
26 _controller: WallabagCoreBundle:Entry:showUnread
27 page : 1
26 requirements: 28 requirements:
27 page: \d+ 29 page: \d+
28 30
@@ -31,3 +33,8 @@ fos_user:
31 33
32fos_oauth_server_token: 34fos_oauth_server_token:
33 resource: "@FOSOAuthServerBundle/Resources/config/routing/token.xml" 35 resource: "@FOSOAuthServerBundle/Resources/config/routing/token.xml"
36
37craue_config_settings_modify:
38 path: /settings
39 defaults:
40 _controller: CraueConfigBundle:Settings:modify
diff --git a/app/config/security.yml b/app/config/security.yml
index a99a7d80..6f20490b 100644
--- a/app/config/security.yml
+++ b/app/config/security.yml
@@ -58,3 +58,4 @@ security:
58 - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } 58 - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
59 - { path: /(unread|starred|archive).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } 59 - { path: /(unread|starred|archive).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
60 - { path: ^/, roles: ROLE_USER } 60 - { path: ^/, roles: ROLE_USER }
61 - { path: ^/settings, roles: ROLE_SUPER_ADMIN }
diff --git a/app/config/tests/parameters.yml.dist.mysql b/app/config/tests/parameters.yml.dist.mysql
index 073f6c27..3244fd3a 100644
--- a/app/config/tests/parameters.yml.dist.mysql
+++ b/app/config/tests/parameters.yml.dist.mysql
@@ -27,32 +27,6 @@ parameters:
27 # A secret key that's used to generate certain security-related tokens 27 # A secret key that's used to generate certain security-related tokens
28 secret: ThisTokenIsNotSoSecretChangeIt 28 secret: ThisTokenIsNotSoSecretChangeIt
29 29
30 # wallabag misc 30 # two factor stuff
31 app.version: 2.0.0-alpha
32 twofactor_auth: true 31 twofactor_auth: true
33 twofactor_sender: no-reply@wallabag.org 32 twofactor_sender: no-reply@wallabag.org
34
35 download_pictures: false # if true, pictures will be stored into data/assets for each article
36
37 # Entry view
38 share_twitter: true
39 share_mail: true
40 share_shaarli: true
41 shaarli_url: http://myshaarli.com
42 share_diaspora: true
43 diaspora_url: http://diasporapod.com
44 flattr: true
45 carrot: true
46 show_printlink: true
47 export_epub: true
48 export_mobi: true
49 export_pdf: true
50 export_csv: true
51 export_json: true
52 export_txt: true
53 export_xml: true
54 wallabag_url: http://v2.wallabag.org
55 wallabag_support_url: 'https://www.wallabag.org/pages/support.html'
56
57 # pocket import
58 pocket_consumer_key: xxxxxxxx
diff --git a/app/config/tests/parameters.yml.dist.pgsql b/app/config/tests/parameters.yml.dist.pgsql
index 24a1818a..cee34473 100644
--- a/app/config/tests/parameters.yml.dist.pgsql
+++ b/app/config/tests/parameters.yml.dist.pgsql
@@ -27,32 +27,6 @@ parameters:
27 # A secret key that's used to generate certain security-related tokens 27 # A secret key that's used to generate certain security-related tokens
28 secret: ThisTokenIsNotSoSecretChangeIt 28 secret: ThisTokenIsNotSoSecretChangeIt
29 29
30 # wallabag misc 30 # two factor stuff
31 app.version: 2.0.0-alpha
32 twofactor_auth: true 31 twofactor_auth: true
33 twofactor_sender: no-reply@wallabag.org 32 twofactor_sender: no-reply@wallabag.org
34
35 download_pictures: false # if true, pictures will be stored into data/assets for each article
36
37 # Entry view
38 share_twitter: true
39 share_mail: true
40 share_shaarli: true
41 shaarli_url: http://myshaarli.com
42 share_diaspora: true
43 diaspora_url: http://diasporapod.com
44 flattr: true
45 carrot: true
46 show_printlink: true
47 export_epub: true
48 export_mobi: true
49 export_pdf: true
50 export_csv: true
51 export_json: true
52 export_txt: true
53 export_xml: true
54 wallabag_url: http://v2.wallabag.org
55 wallabag_support_url: 'https://www.wallabag.org/pages/support.html'
56
57 # pocket import
58 pocket_consumer_key: xxxxxxxx
diff --git a/app/config/tests/parameters.yml.dist.sqlite b/app/config/tests/parameters.yml.dist.sqlite
index c739f89b..a1535bc9 100644
--- a/app/config/tests/parameters.yml.dist.sqlite
+++ b/app/config/tests/parameters.yml.dist.sqlite
@@ -27,32 +27,6 @@ parameters:
27 # A secret key that's used to generate certain security-related tokens 27 # A secret key that's used to generate certain security-related tokens
28 secret: ThisTokenIsNotSoSecretChangeIt 28 secret: ThisTokenIsNotSoSecretChangeIt
29 29
30 # wallabag misc 30 # two factor stuff
31 app.version: 2.0.0-alpha
32 twofactor_auth: true 31 twofactor_auth: true
33 twofactor_sender: no-reply@wallabag.org 32 twofactor_sender: no-reply@wallabag.org
34
35 download_pictures: false # if true, pictures will be stored into data/assets for each article
36
37 # Entry view
38 share_twitter: true
39 share_mail: true
40 share_shaarli: true
41 shaarli_url: http://myshaarli.com
42 share_diaspora: true
43 diaspora_url: http://diasporapod.com
44 flattr: true
45 carrot: true
46 show_printlink: true
47 export_epub: true
48 export_mobi: true
49 export_pdf: true
50 export_csv: true
51 export_json: true
52 export_txt: true
53 export_xml: true
54 wallabag_url: http://v2.wallabag.org
55 wallabag_support_url: 'https://www.wallabag.org/pages/support.html'
56
57 # pocket import
58 pocket_consumer_key: xxxxxxxx