diff --git a/component.json b/component.json index 00b2f94088..b15ba31cbb 100644 --- a/component.json +++ b/component.json @@ -23,6 +23,7 @@ "i18next": "~1.6", "sinon": "~1.7", "sinon-chai": "~2.4", - "js-fixtures": "https://github.com/badunk/js-fixtures/archive/master.zip" + "js-fixtures": "https://github.com/badunk/js-fixtures/archive/master.zip", + "bootstrap-multiselect": "https://github.com/davidstutz/bootstrap-multiselect.git" } } diff --git a/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php b/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php index b54f90083d..3ae012ab3b 100644 --- a/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php +++ b/lib/Alchemy/Phrasea/Form/Login/PhraseaRegisterForm.php @@ -74,31 +74,49 @@ class PhraseaRegisterForm extends AbstractType $builder->add('provider-id', 'hidden'); require_once($this->app['phraseanet.registry']->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php'); + $choices = array(); $baseIds = array(); foreach (\giveMeBases($this->app) as $sbas_id => $baseInsc) { if (($baseInsc['CollsCGU'] || $baseInsc['Colls']) && $baseInsc['inscript']) { if ($baseInsc['Colls']) { foreach ($baseInsc['Colls'] as $collId => $collName) { - $baseIds[\phrasea::baseFromColl($sbas_id, $collId, $this->app)] = $collName; + $baseId = \phrasea::baseFromColl($sbas_id, $collId, $this->app); + $sbasName= \phrasea::sbas_names($sbas_id, $this->app); + + if (!isset($choices[$sbasName])) { + $choices[$sbasName] = array(); + } + + $choices[$sbasName][$baseId] = \phrasea::bas_labels($baseId, $this->app); + $baseIds[] = $baseId; } } + if ($baseInsc['CollsCGU']) { foreach ($baseInsc['CollsCGU'] as $collId => $collName) { - $baseIds[\phrasea::baseFromColl($sbas_id, $collId, $this->app)] = $collName; + $baseId = \phrasea::baseFromColl($sbas_id, $collId, $this->app); + $sbasName= \phrasea::sbas_names($sbas_id, $this->app); + + if (!isset($choices[$sbasName])) { + $choices[$sbasName] = array(); + } + + $choices[$sbasName][$baseId] = \phrasea::bas_labels($baseId, $this->app); + $baseIds[] = $baseId; } } } } $builder->add('collections', 'choice', array( - 'choices' => $baseIds, + 'choices' => $choices, 'multiple' => true, - 'expanded' => true, + 'expanded' => false, 'constraints' => array( new Assert\Choice(array( - 'choices'=>array_keys($baseIds), - 'minMessage' => _('You must select at least {{ limit }} collection'), + 'choices' => array_flip($baseIds), + 'minMessage' => _('You must select at least {{ limit }} collection'), 'multiple' => true, 'min' => 1, )), diff --git a/lib/conf.d/minifyGroupsConfig.php b/lib/conf.d/minifyGroupsConfig.php index bcf94085af..5911f77778 100644 --- a/lib/conf.d/minifyGroupsConfig.php +++ b/lib/conf.d/minifyGroupsConfig.php @@ -21,6 +21,7 @@ $groups = array( '//assets/angular/angular.js', '//assets/angular-ui/build/angular-ui.js', '//assets/bootstrap-switch/static/js/bootstrapSwitch.js', + '//assets/bootstrap-multiselect/js/bootstrap-multiselect.js', '//assets/underscore/underscore.js' ), 'client' => array( diff --git a/templates/web/login/register-classic.html.twig b/templates/web/login/register-classic.html.twig index 9519f9b8a1..565c472221 100644 --- a/templates/web/login/register-classic.html.twig +++ b/templates/web/login/register-classic.html.twig @@ -1,6 +1,7 @@ {% extends "login/layout/sidebar-layout.html.twig" %} {% import "login/common/macros.html.twig" as auth_macro %} +{% import "common/macros.html.twig" as macro %} {% block title %} {% trans "Register" %} @@ -25,13 +26,10 @@