From af807431b138be861e910221ab1d92e40cd561ed Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Mon, 18 Nov 2013 15:07:13 +0100 Subject: [PATCH] Add configuration form types --- .../Form/Configuration/ClientFormType.php | 91 ++++++++++++++ .../Configuration/DailymotionFormType.php | 60 +++++++++ .../Form/Configuration/DisplayFormType.php | 52 ++++++++ .../Form/Configuration/EmailFormType.php | 61 +++++++++ .../Configuration/ExecutablesFormType.php | 67 ++++++++++ .../Form/Configuration/FlickrFormType.php | 61 +++++++++ .../Form/Configuration/FtpExportFormType.php | 41 ++++++ .../Form/Configuration/HomepageFormType.php | 36 ++++++ .../Form/Configuration/HttpServerFormType.php | 43 +++++++ .../MainConfigurationFormType.php | 119 ++++++++++++++++++ .../Configuration/MaintenanceFormType.php | 41 ++++++ .../Form/Configuration/ModulesFormType.php | 47 +++++++ .../PhraseanetClientAPIFormType.php | 41 ++++++ .../Form/Configuration/PushFormType.php | 38 ++++++ .../Configuration/RegistrationFormType.php | 40 ++++++ .../Form/Configuration/ReportFormType.php | 36 ++++++ .../Form/Configuration/RobotsFormType.php | 46 +++++++ .../Configuration/SearchEngineFormType.php | 46 +++++++ .../Form/Configuration/StorageFormType.php | 32 +++++ .../Configuration/WebservicesFormType.php | 52 ++++++++ .../Form/Configuration/YoutubeFormType.php | 65 ++++++++++ .../Form/Configuration/ClientFormTypeTest.php | 29 +++++ .../Configuration/DailymotionFormTypeTest.php | 29 +++++ .../Configuration/DisplayFormTypeTest.php | 29 +++++ .../Form/Configuration/EmailFormTypeTest.php | 29 +++++ .../Configuration/ExecutablesFormTypeTest.php | 29 +++++ .../Form/Configuration/FlickrFormTypeTest.php | 29 +++++ .../Configuration/FtpExportFormTypeTest.php | 29 +++++ .../Configuration/HomepageFormTypeTest.php | 29 +++++ .../Configuration/HttpServerFormTypeTest.php | 27 ++++ .../MainConfigurationFormTypeTest.php | 28 +++++ .../Configuration/MaintenanceFormTypeTest.php | 27 ++++ .../Configuration/ModulesFormTypeTest.php | 29 +++++ .../PhraseanetClientAPIFormTypeTest.php | 29 +++++ .../Form/Configuration/PushFormTypeTest.php | 27 ++++ .../RegistrationFormTypeTest.php | 29 +++++ .../Form/Configuration/ReportFormTypeTest.php | 29 +++++ .../Form/Configuration/RobotsFormTypeTest.php | 27 ++++ .../SearchEngineFormTypeTest.php | 29 +++++ .../Configuration/StorageFormTypeTest.php | 27 ++++ .../Configuration/WebservicesFormTypeTest.php | 27 ++++ .../Configuration/YoutubeFormTypeTest.php | 29 +++++ 42 files changed, 1711 insertions(+) create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/ClientFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/DailymotionFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/DisplayFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/EmailFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/ExecutablesFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/FlickrFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/FtpExportFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/HomepageFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/HttpServerFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/MainConfigurationFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/MaintenanceFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/ModulesFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/PhraseanetClientAPIFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/PushFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/RegistrationFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/ReportFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/RobotsFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/SearchEngineFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/StorageFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/WebservicesFormType.php create mode 100644 lib/Alchemy/Phrasea/Form/Configuration/YoutubeFormType.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/ClientFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/DailymotionFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/DisplayFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/EmailFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/ExecutablesFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/FlickrFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/FtpExportFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/HomepageFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/HttpServerFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/MainConfigurationFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/MaintenanceFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/ModulesFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/PhraseanetClientAPIFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/PushFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/RegistrationFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/ReportFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/RobotsFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/SearchEngineFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/StorageFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/WebservicesFormTypeTest.php create mode 100644 tests/Alchemy/Tests/Phrasea/Form/Configuration/YoutubeFormTypeTest.php diff --git a/lib/Alchemy/Phrasea/Form/Configuration/ClientFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/ClientFormType.php new file mode 100644 index 0000000000..d928265654 --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/ClientFormType.php @@ -0,0 +1,91 @@ +add('GV_download_max', 'integer', array( + 'label' => _('Maximum megabytes allowed for download'), + 'data' => 120, + 'help_message' => _('If request is bigger, then mail is still available'), + )); + $builder->add('GV_ong_search', 'integer', array( + 'label' => _('Search tab position'), + 'data' => 1, + )); + $builder->add('GV_ong_advsearch', 'integer', array( + 'label' => _('Advanced search tab position'), + 'data' => 2, + )); + $builder->add('GV_ong_topics', 'integer', array( + 'label' => _('Topics tab position'), + 'data' => 0, + )); + $builder->add('GV_ong_actif', 'integer', array( + 'label' => _('Active tab position'), + 'data' => 1, + )); + + $builder->add('GV_client_render_topics', 'choice', array( + 'label' => _('Topics display mode'), + 'data' => 'tree', + 'choices' => array('tree' => _('Trees'), 'popups' => _('Drop-down')), + )); + + $builder->add('GV_rollover_reg_preview', 'checkbox', array( + 'label' => _('Enable roll-over on stories'), + 'data' => true, + )); + $builder->add('GV_rollover_chu', 'checkbox', array( + 'label' => _('Enable roll-over on basket elements'), + 'data' => true, + )); + + $builder->add('GV_client_coll_ckbox', 'choice', array( + 'label' => _('Collections display mode'), + 'data' => 'checkbox', + 'choices' => array('popup' => _('Drop-down'), 'checkbox' => _('Check-box')), + )); + + $builder->add('GV_viewSizeBaket', 'checkbox', array( + 'label' => _('Display the total size of the document basket'), + 'data' => true, + )); + $builder->add('GV_clientAutoShowProposals', 'checkbox', array( + 'label' => _('Display proposals tab'), + 'data' => true, + )); + $builder->add('GV_needAuth2DL', 'checkbox', array( + 'label' => _('Require authentication to download documents'), + 'data' => true, + 'help_message' => _('Used for guest account'), + )); + $builder->add('GV_requireTOUValidationForExport', 'checkbox', array( + 'label' => _('Users must accept Terms of Use for each export'), + 'data' => false, + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/DailymotionFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/DailymotionFormType.php new file mode 100644 index 0000000000..9dcc897384 --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/DailymotionFormType.php @@ -0,0 +1,60 @@ +generator = $generator; + } + + public function buildForm(FormBuilderInterface $builder, array $options) + { + $create_api_dailymotion = 'http://www.dailymotion.com/profile/developer'; + + try { + $dailymotion_callback = $this->generator->generate('prod_bridge_callback', array('api_name' => 'dailymotion'), UrlGenerator::ABSOLUTE_URL); + } catch (RouteNotFoundException $e) { + $dailymotion_callback = null; + } + + + $builder->add('GV_dailymotion_api', 'checkbox', array( + 'label' => _('Use Dailymotion API'), + 'data' => false, + 'help_message' => sprintf(_('Create API account at %s, then use %s as callback URL value'), $create_api_dailymotion, $dailymotion_callback), + )); + + $builder->add('GV_dailymotion_client_id', 'text', array( + 'label' => _('Dailymotion public key'), + )); + $builder->add('GV_dailymotion_client_secret', 'text', array( + 'label' => _('Dailymotion secret key'), + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/DisplayFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/DisplayFormType.php new file mode 100644 index 0000000000..3a0d774977 --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/DisplayFormType.php @@ -0,0 +1,52 @@ +add('GV_adminMail', 'text', array( + 'label' => _('Admin email'), + )); + $builder->add('GV_view_bas_and_coll', 'checkbox', array( + 'label' => _('Display the name of databases and collections'), + 'data' => true, + )); + $builder->add('GV_choose_export_title', 'checkbox', array( + 'label' => _('Choose the title of the document to export'), + 'data' => false, + )); + $builder->add('GV_default_export_title', 'choice', array( + 'label' => _('Default export title'), + 'data' => 'title', + 'choices' => array('title' => _('Document title'), 'original' => _('Original name')), + )); + $builder->add('GV_social_tools', 'choice', array( + 'label' => _('Enable this setting to share on Facebook and Twitter'), + 'data' => 'none', + 'choices' => array('none' => _('Disabled'), 'publishers' => _('Publishers'), 'all' => _('Enabled')), + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/EmailFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/EmailFormType.php new file mode 100644 index 0000000000..6165112dd8 --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/EmailFormType.php @@ -0,0 +1,61 @@ +add('GV_defaulmailsenderaddr', 'text', array( + 'label' => _('Default mail sender address'), + 'data' => 'phraseanet@example.com', + )); + $builder->add('GV_email_prefix', 'text', array( + 'label' => _('Prefix for notification emails'), + )); + $builder->add('GV_smtp', 'checkbox', array( + 'label' => _('Use a SMTP server'), + )); + $builder->add('GV_smtp_auth', 'checkbox', array( + 'label' => _('Enable SMTP authentication'), + )); + $builder->add('GV_smtp_host', 'text', array( + 'label' => _('SMTP host'), + )); + $builder->add('GV_smtp_port', 'text', array( + 'label' => _('SMTP port'), + )); + $builder->add('GV_smtp_secure', 'choice', array( + 'label' => _('SMTP encryption'), + 'data' => 'tls', + 'choices' => array('none' => _('None'), 'ssl' => 'SSL', 'tls' => 'TLS'), + )); + $builder->add('GV_smtp_user', 'text', array( + 'label' => _('SMTP user'), + )); + $builder->add('GV_smtp_password', 'text', array( + 'label' => _('SMTP password'), + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/ExecutablesFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/ExecutablesFormType.php new file mode 100644 index 0000000000..c75674cd7d --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/ExecutablesFormType.php @@ -0,0 +1,67 @@ +add('GV_h264_streaming', 'checkbox', array( + 'label' => _('Enable H264 stream mode'), + 'data' => false, + 'help_message' => _('Use with mod_token. Attention requires the apache modules and mod_h264_streaming mod_auth_token'), + )); + $builder->add('GV_mod_auth_token_directory', 'text', array( + 'label' => _('Auth_token mount point'), + )); + $builder->add('GV_mod_auth_token_directory_path', 'text', array( + 'label' => _('Auth_token directory path'), + )); + $builder->add('GV_mod_auth_token_passphrase', 'text', array( + 'label' => _('Auth_token passphrase'), + 'help_message' => _('Defined in Apache configuration'), + )); + $builder->add('GV_PHP_INI', 'text', array( + 'label' => _('php.ini path'), + 'help_message' => _('Empty if not used'), + )); + + $imagineDoc = 'http://imagine.readthedocs.org/en/latest/usage/introduction.html'; + $builder->add('GV_imagine_driver', 'choice', array( + 'label' => _('Imagine driver'), + 'data' => '', + 'help_message' => _(sprintf('See documentation at %s', $imagineDoc)), + 'choices' => array('' => 'Auto', 'gmagick' => 'GraphicsMagick', 'imagick' => 'ImageMagick', 'gd' => 'GD') + )); + + $builder->add('GV_ffmpeg_threads', 'integer', array( + 'label' => _('Number of threads to use for FFMpeg'), + 'data' => 2, + )); + $builder->add('GV_pdfmaxpages', 'integer', array( + 'label' => _('Maximum number of pages to be extracted from PDF'), + 'data' => 5, + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/FlickrFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/FlickrFormType.php new file mode 100644 index 0000000000..f399c7fa28 --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/FlickrFormType.php @@ -0,0 +1,61 @@ +generator = $generator; + } + + public function buildForm(FormBuilderInterface $builder, array $options) + { + $create_api_flickr = 'https://secure.flickr.com/services/apps/create/'; + + try { + $flickr_callback = $this->generator->generate('prod_bridge_callback', array('api_name' => 'flickr'), UrlGenerator::ABSOLUTE_URL); + } catch (RouteNotFoundException $e) { + $flickr_callback = null; + } + + + $builder->add('GV_flickr_api', 'checkbox', array( + 'label' => _('Use Flickr API'), + 'data' => false, + 'help_message' => sprintf(_('Create API account at %s, then use %s as callback URL value'), $create_api_flickr, $flickr_callback), + )); + + + $builder->add('GV_flickr_client_id', 'text', array( + 'label' => _('Flickr public key'), + )); + $builder->add('GV_flickr_client_secret', 'text', array( + 'label' => _('Flickr secret key'), + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/FtpExportFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/FtpExportFormType.php new file mode 100644 index 0000000000..a0a8fb5300 --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/FtpExportFormType.php @@ -0,0 +1,41 @@ +add('GV_activeFTP', 'checkbox', array( + 'label' => _('Enable FTP export'), + 'data' => false, + 'help_message' => _('Available in multi-export tab'), + )); + $builder->add('GV_ftp_for_user', 'checkbox', array( + 'label' => _('Enable FTP for users'), + 'data' => false, + 'help_message' => _('By default it is available for admins'), + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/HomepageFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/HomepageFormType.php new file mode 100644 index 0000000000..7c6ab48759 --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/HomepageFormType.php @@ -0,0 +1,36 @@ +add('GV_home_publi', 'choice', array( + 'label' => _('Homepage slideshow'), + 'data' => 'GALLERIA', + 'choices' => array('DISPLAYx1' => _('Single image'), 'SCROLL' => _('Slide show'), 'COOLIRIS' => 'Cooliris', 'CAROUSEL' => _('Carousel'), 'GALLERIA' => _('Gallery')), + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/HttpServerFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/HttpServerFormType.php new file mode 100644 index 0000000000..f168607eed --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/HttpServerFormType.php @@ -0,0 +1,43 @@ +availableLanguages = $availableLanguages; + } + + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder->add('GV_default_lng', 'choice', array( + 'multiple' => false, + 'expanded' => false, + 'choices' => $this->availableLanguages, + 'label' => _('Default language'), + 'data' => 'fr_FR', + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/MainConfigurationFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/MainConfigurationFormType.php new file mode 100644 index 0000000000..5140c66104 --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/MainConfigurationFormType.php @@ -0,0 +1,119 @@ +languages = $languages; + $this->generator = $generator; + } + + public function buildForm(FormBuilderInterface $builder, array $options) + { + $builder->add('http', new HttpServerFormType($this->languages), array( + 'label' => _('HTTP Server'), + 'required' => false, + )); + $builder->add('maintenance', new MaintenanceFormType(), array( + 'label' => _('Maintenance state'), + 'required' => false, + )); + $builder->add('webservices', new WebservicesFormType(), array( + 'label' => _('Webservices connectivity'), + 'required' => false, + )); + $builder->add('youtube-api', new YoutubeFormType($this->generator), array( + 'label' => _('Youtube connectivity'), + 'required' => false, + )); + $builder->add('flickr-api', new FlickrFormType($this->generator), array( + 'label' => _('FlickR connectivity'), + 'required' => false, + )); + $builder->add('dailymotion-api', new DailymotionFormType($this->generator), array( + 'label' => _('Dailymotion connectivity'), + 'required' => false, + )); + $builder->add('phraseanet-client', new PhraseanetClientAPIFormType(), array( + 'label' => _('Phraseanet client API'), + 'required' => false, + )); + $builder->add('storage', new StorageFormType(), array( + 'label' => _('Documents storage'), + 'required' => false, + )); + $builder->add('executables', new ExecutablesFormType(), array( + 'label' => _('Executables settings'), + 'required' => false, + )); + $builder->add('homepage', new HomepageFormType(), array( + 'label' => _('Main configuration'), + 'required' => false, + )); + $builder->add('display', new DisplayFormType(), array( + 'label' => _('Homepage'), + 'required' => false, + )); + $builder->add('searchengine', new SearchEngineFormType(), array( + 'label' => _('Search engine'), + 'required' => false, + )); + $builder->add('report', new ReportFormType(), array( + 'label' => _('Report'), + 'required' => false, + )); + $builder->add('modules', new ModulesFormType(), array( + 'label' => _('Additionnal modules'), + 'required' => false, + )); + $builder->add('email', new EmailFormType(), array( + 'label' => _('Emails'), + 'required' => false, + )); + $builder->add('client', new FtpExportFormType(), array( + 'label' => _('FTP Export'), + 'required' => false, + )); + $builder->add('client', new ClientFormType(), array( + 'label' => _('Client'), + 'required' => false, + )); + $builder->add('registration', new RegistrationFormType(), array( + 'label' => _('Registration'), + 'required' => false, + )); + $builder->add('push', new PushFormType(), array( + 'label' => _('Push configuration'), + 'required' => false, + )); + $builder->add('robots', new RobotsFormType(), array( + 'label' => _('Robot indexing'), + 'required' => false, + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/MaintenanceFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/MaintenanceFormType.php new file mode 100644 index 0000000000..84e7155938 --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/MaintenanceFormType.php @@ -0,0 +1,41 @@ +add('GV_message', 'text', array( + 'label' => _('Maintenance message'), + 'data' => 'The application is down for maintenance', + )); + $builder->add('GV_message_on', 'checkbox', array( + 'label' => _('Enable maintenance message broadcast'), + 'data' => false, + )); + $builder->add('GV_log_errors', 'checkbox', array( + 'label' => _('Log errors'), + 'data' => false, + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/ModulesFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/ModulesFormType.php new file mode 100644 index 0000000000..32abe810e9 --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/ModulesFormType.php @@ -0,0 +1,47 @@ +add('GV_thesaurus', 'checkbox', array( + 'label' => _('Enable thesaurus'), + 'data' => true, + )); + $builder->add('GV_multiAndReport', 'checkbox', array( + 'label' => _('Enable multi-doc mode'), + 'data' => true, + )); + $builder->add('GV_seeOngChgDoc', 'checkbox', array( + 'label' => _('Enable HD substitution'), + 'data' => true, + )); + $builder->add('GV_seeNewThumb', 'checkbox', array( + 'label' => _('Enable thumbnail substitution'), + 'data' => true, + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/PhraseanetClientAPIFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/PhraseanetClientAPIFormType.php new file mode 100644 index 0000000000..0a8adcaaa5 --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/PhraseanetClientAPIFormType.php @@ -0,0 +1,41 @@ +add('GV_client_navigator', 'checkbox', array( + 'label' => _('Authorize *Phraseanet Navigator*'), + 'data' => true, + 'help_message' => _('*Phraseanet Navigator* is a smartphone application that allow user to connect on this instance'), + )); + + $builder->add('GV_client_officeplugin', 'checkbox', array( + 'label' => _('Authorize Microsoft Office Plugin to connect.'), + 'data' => true, + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/PushFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/PushFormType.php new file mode 100644 index 0000000000..510d38ded4 --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/PushFormType.php @@ -0,0 +1,38 @@ +add('GV_validation_reminder', 'integer', array( + 'label' => _('Number of days before the end of the validation to send a reminder email'), + 'data' => 2, + )); + $builder->add('GV_val_expiration', 'integer', array( + 'label' => _('Default validation links duration'), + 'data' => 10, + 'help_message' => _('If set to 0, duration is permanent'), + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/RegistrationFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/RegistrationFormType.php new file mode 100644 index 0000000000..8fff8ecfd3 --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/RegistrationFormType.php @@ -0,0 +1,40 @@ +add('GV_autoselectDB', 'checkbox', array( + 'label' => _('Auto select databases'), + 'data' => true, + 'help_message' => _('This option disables the selecting of the databases on which a user can register himself, and registration is made on all granted databases.'), + )); + $builder->add('GV_autoregister', 'checkbox', array( + 'label' => _('Enable auto registration'), + 'data' => false, + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/ReportFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/ReportFormType.php new file mode 100644 index 0000000000..7611394173 --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/ReportFormType.php @@ -0,0 +1,36 @@ +add('GV_anonymousReport', 'checkbox', array( + 'label' => _('Anonymous report'), + 'data' => false, + 'help_message' => _('Hide information about users'), + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/RobotsFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/RobotsFormType.php new file mode 100644 index 0000000000..dc84a96258 --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/RobotsFormType.php @@ -0,0 +1,46 @@ +add('GV_homeTitle', 'text', array( + 'label' => _('Application title'), + 'data' => 'Phraseanet', + )); + $builder->add('GV_metaKeywords', 'text', array( + 'label' => _('Keywords used for indexing purposes by search engines robots'), + )); + $builder->add('GV_metaDescription', 'textarea', array( + 'label' => _('Application description'), + )); + $builder->add('GV_googleAnalytics', 'text', array( + 'label' => _('Google Analytics identifier'), + )); + $builder->add('GV_allow_search_engine', 'checkbox', array( + 'label' => _('Allow the website to be indexed by search engines like Google'), + 'data' => true, + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/SearchEngineFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/SearchEngineFormType.php new file mode 100644 index 0000000000..8762616a3b --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/SearchEngineFormType.php @@ -0,0 +1,46 @@ +add('GV_min_letters_truncation', 'integer', array( + 'label' => _('Minimum number of letters before truncation'), + 'data' => 1, + 'help_message' => _('Used in search engine'), + )); + $builder->add('GV_defaultQuery', 'text', array( + 'label' => _('Default query'), + 'data' => 'all', + )); + $builder->add('GV_defaultQuery_type', 'choice', array( + 'label' => _('Default searched type'), + 'data' => 0, + 'help_message' => _('Used when opening the application'), + 'choices' => array('0' => _('Documents'), '1' => _('Stories')), + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/StorageFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/StorageFormType.php new file mode 100644 index 0000000000..a9084e3ae9 --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/StorageFormType.php @@ -0,0 +1,32 @@ +add('GV_base_datapath_noweb', 'text', array( + 'label' => _('Default path for datas'), + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/WebservicesFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/WebservicesFormType.php new file mode 100644 index 0000000000..29364f5c2d --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/WebservicesFormType.php @@ -0,0 +1,52 @@ +http://www.google.com/recaptcha'; + + $builder->add('GV_google_api', 'checkbox', array( + 'label' => _('Use Google Chart API'), + 'data' => true, + )); + $builder->add('GV_i18n_service', 'text', array( + 'label' => _('Geonames server address'), + 'data' => 'https://geonames.alchemyasp.com/', + )); + $builder->add('GV_captchas', 'checkbox', array( + 'label' => _('Use recaptcha API'), + 'data' => false, + 'help_message' => _(sprintf('See documentation at %s', $recaptchaDoc)), + )); + $builder->add('GV_captcha_public_key', 'text', array( + 'label' => _('Recaptcha public key'), + 'data' => '', + )); + $builder->add('GV_captcha_private_key', 'text', array( + 'label' => _('Recaptcha private key'), + 'data' => '', + )); + } + + public function getName() + { + return null; + } +} diff --git a/lib/Alchemy/Phrasea/Form/Configuration/YoutubeFormType.php b/lib/Alchemy/Phrasea/Form/Configuration/YoutubeFormType.php new file mode 100644 index 0000000000..ae6b0b1c64 --- /dev/null +++ b/lib/Alchemy/Phrasea/Form/Configuration/YoutubeFormType.php @@ -0,0 +1,65 @@ +generator = $generator; + } + + public function buildForm(FormBuilderInterface $builder, array $options) + { + $dashboard_youtube = 'https://code.google.com/apis/youtube/dashboard/'; + $youtube_console_url = 'https://code.google.com/apis/console/'; + + try { + $youtube_callback = $this->generator->generate('prod_bridge_callback', array('api_name' => 'youtube'), UrlGenerator::ABSOLUTE_URL); + } catch (RouteNotFoundException $e) { + $youtube_callback = null; + } + + $builder->add('GV_youtube_api', 'checkbox', array( + 'label' => _('Use youtube API'), + 'data' => false, + 'help_message' => sprintf(_('Create API account at %s, then use %s as callback URL value'), $youtube_console_url, $youtube_callback), + )); + + + $builder->add('GV_youtube_client_id', 'text', array( + 'label' => _('Youtube public key'), + )); + $builder->add('GV_youtube_client_secret', 'text', array( + 'label' => _('Youtube secret key'), + )); + $builder->add('GV_youtube_dev_key', 'text', array( + 'label' => _('Youtube developer key'), + 'help_message' => sprintf(_('See %s'), $dashboard_youtube), + )); + } + + public function getName() + { + return null; + } +} diff --git a/tests/Alchemy/Tests/Phrasea/Form/Configuration/ClientFormTypeTest.php b/tests/Alchemy/Tests/Phrasea/Form/Configuration/ClientFormTypeTest.php new file mode 100644 index 0000000000..78fba6da35 --- /dev/null +++ b/tests/Alchemy/Tests/Phrasea/Form/Configuration/ClientFormTypeTest.php @@ -0,0 +1,29 @@ + 'french')); + } +} diff --git a/tests/Alchemy/Tests/Phrasea/Form/Configuration/MainConfigurationFormTypeTest.php b/tests/Alchemy/Tests/Phrasea/Form/Configuration/MainConfigurationFormTypeTest.php new file mode 100644 index 0000000000..cdcedaf82c --- /dev/null +++ b/tests/Alchemy/Tests/Phrasea/Form/Configuration/MainConfigurationFormTypeTest.php @@ -0,0 +1,28 @@ + 'french'), self::$DI['app']['url_generator']); + } +} diff --git a/tests/Alchemy/Tests/Phrasea/Form/Configuration/MaintenanceFormTypeTest.php b/tests/Alchemy/Tests/Phrasea/Form/Configuration/MaintenanceFormTypeTest.php new file mode 100644 index 0000000000..4c29d43b55 --- /dev/null +++ b/tests/Alchemy/Tests/Phrasea/Form/Configuration/MaintenanceFormTypeTest.php @@ -0,0 +1,27 @@ +