Skip to content
Snippets Groups Projects
Commit e228a5cd authored by Adrien Pavie's avatar Adrien Pavie
Browse files

Merge from master

parents 8df3b2e6 5679c97a
No related tags found
No related merge requests found
Showing with 141 additions and 98 deletions
...@@ -134,8 +134,8 @@ gogo-update: ## Update a PROD server to the lastest version of gogocarto ...@@ -134,8 +134,8 @@ gogo-update: ## Update a PROD server to the lastest version of gogocarto
$(YARN) install $(YARN) install
$(GULP) build $(GULP) build
$(GULP) production $(GULP) production
$(YARN) encore production $(YARN) encore production
$(SYMFONY) db:migrate make purge
make purge $(SYMFONY) db:migrate
make hide-deploy-message make hide-deploy-message
service cron start service cron start
\ No newline at end of file
...@@ -99,4 +99,10 @@ pre { ...@@ -99,4 +99,10 @@ pre {
.form-control { .form-control {
height: 30px; height: 30px;
padding: 3px 12px; padding: 3px 12px;
}
.select2-container .select2-choice {
height: 30px;
}
.select2-choice>span:first-child, .select2-chosen, .select2-container .select2-choices .select2-search-field input {
padding: 5px 12px;
} }
\ No newline at end of file
...@@ -7,7 +7,8 @@ for file in var/file_queues/custom_domain_to_remove/* ...@@ -7,7 +7,8 @@ for file in var/file_queues/custom_domain_to_remove/*
do do
if [ -e $file ] if [ -e $file ]
then then
CUSTOM_URL=`cat $file` fileContent=`cat $file`
CUSTOM_URL=($fileContent) # get first word
echo "\n\n\nRemoving subdomain for $file : $CUSTOM_URL" echo "\n\n\nRemoving subdomain for $file : $CUSTOM_URL"
if [ -n "$CUSTOM_URL" ]; then if [ -n "$CUSTOM_URL" ]; then
echo "Remove previous certificates if exists" echo "Remove previous certificates if exists"
...@@ -24,19 +25,24 @@ do ...@@ -24,19 +25,24 @@ do
done done
for file in var/file_queues/custom_domain_to_configure/* for file in var/file_queues/custom_domain_to_configure/*
do do
if [ -e $file ] if [ -e $file ]
then then
arguments=`cat $file` if [[ $(find "$file" -mmin +300 -print) ]]; then
echo "\n\n\nConfigure new domain for $file : $arguments" echo "File $file is older than 5 hours, so deleting it"
mv $file var/file_queues/custom_domain_to_remove/
if sh bin/configure_custom_domain.sh $arguments
then
echo "Successfully configured $file, the file queue can now be deleted"
service nginx reload
rm $file
else else
echo "Problem while configuring $file" arguments=`cat $file`
fi echo "\n\n\nConfigure new domain for $file : $arguments"
if sh bin/configure_custom_domain.sh $arguments
then
echo "Successfully configured $file, the file queue can now be deleted"
service nginx reload
rm $file
else
echo "Problem while configuring $file"
fi
fi
fi fi
done done
# Put parameters here that don't need to change on each machine where the app is deployed # Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration # https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters: parameters:
app.version: 3.2.1 app.version: 3.2.2
use_as_sass: "%env(USE_AS_SAAS)%" use_as_sass: "%env(USE_AS_SAAS)%"
locale: fr locale: fr
router.request_context.host: '%env(string:BASE_URL)%' router.request_context.host: '%env(string:BASE_URL)%'
......
...@@ -231,6 +231,12 @@ services: ...@@ -231,6 +231,12 @@ services:
arguments: [~, App\Document\Configuration, 'App\Controller\Admin\ConfigurationAdminController'] arguments: [~, App\Document\Configuration, 'App\Controller\Admin\ConfigurationAdminController']
tags: tags:
- { name: sonata.admin, manager_type: doctrine_mongodb, group: custom, label: App Mobile } - { name: sonata.admin, manager_type: doctrine_mongodb, group: custom, label: App Mobile }
admin.custom_js_css_config:
class: App\Admin\ConfigurationCustomJsCssAdmin
arguments: [~, App\Document\Configuration, 'App\Controller\Admin\ConfigurationAdminController']
tags:
- { name: sonata.admin, manager_type: doctrine_mongodb, group: custom, label: Custom Css / Js }
admin.email_config: admin.email_config:
class: App\Admin\ConfigurationMailAdmin class: App\Admin\ConfigurationMailAdmin
......
...@@ -103,7 +103,7 @@ Here are the following cron tab you need to configure ...@@ -103,7 +103,7 @@ Here are the following cron tab you need to configure
@daily php GOGOCARTO_DIR/bin/console --env=prod app:projects:check-for-deleting @daily php GOGOCARTO_DIR/bin/console --env=prod app:projects:check-for-deleting
# Next one is for custom domain, it works only with NGINX # Next one is for custom domain, it works only with NGINX
* * * * * cd GOGOCARTO_DIR && sh bin/execute_custom_domain.sh 0 * * * * cd GOGOCARTO_DIR &&bash bin/execute_custom_domain.sh
``` ```
### Updating GoGoCarto ### Updating GoGoCarto
......
...@@ -30,7 +30,7 @@ class ConfigurationAdmin extends ConfigurationAbstractAdmin ...@@ -30,7 +30,7 @@ class ConfigurationAdmin extends ConfigurationAbstractAdmin
->add('appName', null, ['label' => 'Nom du site']) ->add('appName', null, ['label' => 'Nom du site'])
->add('appBaseline', null, ['label' => 'Description du site (baseline)', 'required' => false]) ->add('appBaseline', null, ['label' => 'Description du site (baseline)', 'required' => false])
->add('appTags', null, ['label' => 'Mot clés pour le référencement (séparés par une virgule)', 'required' => false]) ->add('appTags', null, ['label' => 'Mot clés pour le référencement (séparés par une virgule)', 'required' => false])
->add('customDomain', UrlType::class, ['label' => "Utiliser un nom de domaine personnalisé (exple macarte.org au lieu de macarte.gogocarto.fr). Après avoir acheté le nom de domaine macarte.org, vous devez d'abords le rediriger sur l'adresse IP du serveur GoGoCarto (" . $_SERVER['SERVER_ADDR'] ."). Ensuite renseignez ici le nom de votre domaine, et attendez quelques minutes le temps que cela soit configuré par GoGoCarto", 'required' => false]) ->add('customDomain', UrlType::class, ['label' => "Utiliser un nom de domaine personnalisé (exple macarte.org au lieu de macarte.gogocarto.fr). Après avoir acheté le nom de domaine macarte.org, vous devez d'abords le rediriger sur l'adresse IP du serveur GoGoCarto (" . $_SERVER['SERVER_ADDR'] ."). Ensuite renseignez ici le nom de votre domaine, et attendez le temps que cela soit configuré par GoGoCarto (une tentative est effectuée toute les heures). GoGoCarto abandonne au bout de 4 tentatives", 'label_attr' => ['title' => 'Si au bout de plusieurs heures rien ne se passe, vous devrez remettre vide la configuration du sous domaine, sauvegarder, puis la reremplir pour créer un nouvel essai'], 'required' => false])
->add('dataLicenseUrl', null, ['label' => 'Url de la licence qui protège vos données', 'required' => false]) ->add('dataLicenseUrl', null, ['label' => 'Url de la licence qui protège vos données', 'required' => false])
->end() ->end()
->with('Images générales', ['class' => 'col-md-6']) ->with('Images générales', ['class' => 'col-md-6'])
......
<?php
namespace App\Admin;
use Sonata\AdminBundle\Form\FormMapper;
class ConfigurationCustomJsCssAdmin extends ConfigurationAbstractAdmin
{
protected $baseRouteName = 'gogo_core_bundle_config_custom_js_css_admin_classname';
protected $baseRoutePattern = 'gogo/core/configuration-custom-js-css';
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->tab('Custom Style')
->with('Entrez du code CSS qui sera chargé sur toutes les pages publiques')
->add('customCSS', null, ['label' => 'Custom CSS', 'attr' => ['class' => 'gogo-code-editor', 'format' => 'css', 'height' => '500'], 'required' => false])
->end()
->end()
->tab('Custom Javascript')
->with('Entrez du code Javascript qui sera chargé sur toutes les pages publiques')
->add('customJavascript', null, ['label' => 'Custom Javascript', 'attr' => ['class' => 'gogo-code-editor', 'format' => 'javascript', 'height' => '500'], 'required' => false])
->end()
->end()
;
}
}
...@@ -19,60 +19,43 @@ class ConfigurationStyleAdmin extends ConfigurationAbstractAdmin ...@@ -19,60 +19,43 @@ class ConfigurationStyleAdmin extends ConfigurationAbstractAdmin
protected function configureFormFields(FormMapper $formMapper) protected function configureFormFields(FormMapper $formMapper)
{ {
$featureStyle = ['class' => 'col-md-6 col-lg-3'];
$contributionStyle = ['class' => 'col-md-6 col-lg-4'];
$mailStyle = ['class' => 'col-md-12 col-lg-6'];
$featureFormOption = ['delete' => false, 'required' => false, 'label_attr' => ['style' => 'display:none']];
$featureFormTypeOption = ['edit' => 'inline'];
$formMapper $formMapper
->tab('Style') ->with('Thème et polices', ['class' => 'col-md-6'])
->with('Thème et polices', ['class' => 'col-md-6']) ->add('theme', ChoiceType::class, ['label' => 'Thème', 'choices' => ['Défaut' => 'default', 'Flat' => 'flat', 'Près de chez Nous' => 'presdecheznous', 'Transiscope' => 'transiscope']])
->add('theme', ChoiceType::class, ['label' => 'Thème', 'choices' => ['Défaut' => 'default', 'Flat' => 'flat', 'Près de chez Nous' => 'presdecheznous', 'Transiscope' => 'transiscope']]) ->add('mainFont', null, ['label' => 'Police principale', 'attr' => ['class' => 'gogo-font-picker']])
->add('mainFont', null, ['label' => 'Police principale', 'attr' => ['class' => 'gogo-font-picker']]) ->add('titleFont', null, ['label' => 'Police de titre', 'attr' => ['class' => 'gogo-font-picker']])
->add('titleFont', null, ['label' => 'Police de titre', 'attr' => ['class' => 'gogo-font-picker']])
->end()
->with('Couleurs principales', ['class' => 'col-md-6'])
->add('textColor', null, ['label' => 'Couleur de texte', 'attr' => ['class' => 'gogo-color-picker']])
->add('primaryColor', null, ['label' => 'Couleur Primaire', 'attr' => ['class' => 'gogo-color-picker']])
->add('backgroundColor', null, ['label' => 'Couleur de fond de page', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->end()
->with("Charger d'autres polices et icones")
->add('fontImport', null, ['label' => 'Lien pour le CDN des polices', 'required' => false])
->add('iconImport', null, ['label' => 'Lien pour le CDN des icones (par défault, les icones de FontAwesome sont chargées)', 'required' => false])
->end()
->with('Autres couleurs', ['class' => 'col-md-6'])
->add('secondaryColor', null, ['label' => 'Couleur Secondaire', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('headerColor', null, ['label' => 'Couleur fond header', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('headerTextColor', null, ['label' => 'Couleur texte header', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('headerHoverColor', null, ['label' => 'Couleur texte survol header', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('contentBackgroundColor', null, ['label' => 'Couleur arrière plan du contenu des pages', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('contentBackgroundElementBodyColor', null, ['label' => 'Couleur arrière plan du contenu de la fiche détail', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('homeBackgroundColor', null, ['label' => "Couleur arrière plan de la page d'accueil", 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('searchBarColor', null, ['label' => 'Couleur bar de recherche', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('interactiveSectionColor', null, ['label' => 'Couleur section pour voter dans la fiche détail', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->end()
->with('Couleurs avancées', ['class' => 'col-md-6'])
->add('textDarkColor', null, ['label' => 'Couleur text foncé', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('textDarkSoftColor', null, ['label' => 'Couleur text foncé adoucie', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('textLightColor', null, ['label' => 'Couleur texte clair', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('textLightSoftColor', null, ['label' => 'Couleur text clair adoucie', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('errorColor', null, ['label' => "Couleur d'erreur", 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('disableColor', null, ['label' => 'Couleur désactivé', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('pendingColor', null, ['label' => 'Couleur en attente de validation', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->end()
->end() ->end()
->tab('Custom Style') ->with('Couleurs principales', ['class' => 'col-md-6'])
->with('Entrez du code CSS qui sera chargé sur toutes les pages publiques') ->add('textColor', null, ['label' => 'Couleur de texte', 'attr' => ['class' => 'gogo-color-picker']])
->add('customCSS', null, ['label' => 'Custom CSS', 'attr' => ['class' => 'gogo-code-editor', 'format' => 'css', 'height' => '500'], 'required' => false]) ->add('primaryColor', null, ['label' => 'Couleur Primaire', 'attr' => ['class' => 'gogo-color-picker']])
->end() ->add('backgroundColor', null, ['label' => 'Couleur de fond de page', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->end()
->with("Charger d'autres polices et icones")
->add('fontImport', null, ['label' => 'Lien pour le CDN des polices', 'required' => false])
->add('iconImport', null, ['label' => 'Lien pour le CDN des icones (par défault, les icones de FontAwesome sont chargées)', 'required' => false])
->end() ->end()
->tab('Custom Javascript') ->with('Autres couleurs', ['class' => 'col-md-6'])
->with('Entrez du code Javascript qui sera chargé sur toutes les pages publiques') ->add('secondaryColor', null, ['label' => 'Couleur Secondaire', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('customJavascript', null, ['label' => 'Custom Javascript', 'attr' => ['class' => 'gogo-code-editor', 'format' => 'javascript', 'height' => '500'], 'required' => false]) ->add('headerColor', null, ['label' => 'Couleur fond header', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->end() ->add('headerTextColor', null, ['label' => 'Couleur texte header', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('headerHoverColor', null, ['label' => 'Couleur texte survol header', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('contentBackgroundColor', null, ['label' => 'Couleur arrière plan du contenu des pages', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('contentBackgroundElementBodyColor', null, ['label' => 'Couleur arrière plan du contenu de la fiche détail', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('homeBackgroundColor', null, ['label' => "Couleur arrière plan de la page d'accueil", 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('searchBarColor', null, ['label' => 'Couleur bar de recherche', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('interactiveSectionColor', null, ['label' => 'Couleur section pour voter dans la fiche détail', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->end() ->end()
->with('Couleurs avancées', ['class' => 'col-md-6'])
->add('textDarkColor', null, ['label' => 'Couleur text foncé', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('textDarkSoftColor', null, ['label' => 'Couleur text foncé adoucie', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('textLightColor', null, ['label' => 'Couleur texte clair', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('textLightSoftColor', null, ['label' => 'Couleur text clair adoucie', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('errorColor', null, ['label' => "Couleur d'erreur", 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('disableColor', null, ['label' => 'Couleur désactivé', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->add('pendingColor', null, ['label' => 'Couleur en attente de validation', 'attr' => ['class' => 'gogo-color-picker'], 'required' => false])
->end()
; ;
} }
} }
...@@ -6,6 +6,7 @@ use App\Document\MigrationState; ...@@ -6,6 +6,7 @@ use App\Document\MigrationState;
use App\Services\AsyncService; use App\Services\AsyncService;
use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\DocumentManager;
use App\Services\DocumentManagerFactory; use App\Services\DocumentManagerFactory;
use Symfony\Component\Console\Command\Command;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
...@@ -15,7 +16,7 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt ...@@ -15,7 +16,7 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInt
* Command to update database when schema need migration * Command to update database when schema need migration
* Also provide some update message in the admin dashboard. * Also provide some update message in the admin dashboard.
*/ */
class MigrationCommand extends GoGoAbstractCommand class MigrationCommand extends Command
{ {
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// DO NOT REMOVE A SINGLE ELEMENT OF THOSE ARRAYS, ONLY ADD NEW ONES // DO NOT REMOVE A SINGLE ELEMENT OF THOSE ARRAYS, ONLY ADD NEW ONES
...@@ -35,11 +36,9 @@ class MigrationCommand extends GoGoAbstractCommand ...@@ -35,11 +36,9 @@ class MigrationCommand extends GoGoAbstractCommand
// v3.2 // v3.2
'db.Configuration.updateMany({}, {$set: {"user.loginWithLesCommuns": true, "user.loginWithLesGoogle": true, "user.loginWithFacebook": true}});', 'db.Configuration.updateMany({}, {$set: {"user.loginWithLesCommuns": true, "user.loginWithLesGoogle": true, "user.loginWithFacebook": true}});',
'db.Option.updateMany({}, {$set: {osmTags: {}}})', 'db.Option.updateMany({}, {$set: {osmTags: {}}})',
'db.Element.find({}).forEach(function(e) { 'var mapping = {};
for(var prop in e.privateData) { e.data[prop] = e.privateData[prop]; } db.Element.find({ privateData: { $exists: true, $ne: {} } }).forEach(function(doc){Object.keys(doc.privateData).forEach(function(key){mapping["privateData." + key]="data." + key})});
delete e.privateData; db.Element.updateMany({ privateData: { $exists: true, $ne: {} } }, {$rename: mapping})'
db.Element.save(e);
});'
]; ];
public static $commands = [ public static $commands = [
...@@ -76,22 +75,28 @@ class MigrationCommand extends GoGoAbstractCommand ...@@ -76,22 +75,28 @@ class MigrationCommand extends GoGoAbstractCommand
"La connexion via un compte tiers (Google, Facebook, LesCommuns.org) est maintenant possible ! Changez la configuration dans Utilisateurs -> Configuration" "La connexion via un compte tiers (Google, Facebook, LesCommuns.org) est maintenant possible ! Changez la configuration dans Utilisateurs -> Configuration"
]; ];
public function __construct(DocumentManagerFactory $dm, LoggerInterface $commandsLogger, public function __construct(DocumentManagerFactory $dmFactory, LoggerInterface $commandsLogger,
TokenStorageInterface $security, TokenStorageInterface $security,
AsyncService $asyncService) AsyncService $asyncService)
{ {
$this->asyncService = $asyncService; $this->asyncService = $asyncService;
parent::__construct($dm, $commandsLogger, $security); $this->dm = $dmFactory->getRootManager();
$this->dmFactory = $dmFactory;
$this->logger = $commandsLogger;
$this->security = $security;
parent::__construct();
} }
protected function gogoConfigure(): void protected function configure(): void
{ {
$this->setName('db:migrate') $this->setName('db:migrate')
->setDescription('Update datatabse each time after code update'); ->setDescription('Update datatabse each time after code update');
} }
protected function gogoExecute(DocumentManager $dm, InputInterface $input, OutputInterface $output): void protected function execute(InputInterface $input, OutputInterface $output): void
{ {
$dm = $this->dm;
$this->output = $output;
$migrationState = $dm->query('MigrationState')->getQuery()->getSingleResult(); $migrationState = $dm->query('MigrationState')->getQuery()->getSingleResult();
if (null == $migrationState) { // Meaning the migration state was not yet in the place in the code if (null == $migrationState) { // Meaning the migration state was not yet in the place in the code
$migrationState = new MigrationState(); $migrationState = new MigrationState();
...@@ -109,11 +114,10 @@ class MigrationCommand extends GoGoAbstractCommand ...@@ -109,11 +114,10 @@ class MigrationCommand extends GoGoAbstractCommand
$migrationsToRun = array_unique($migrationsToRun); $migrationsToRun = array_unique($migrationsToRun);
foreach ($dbs as $db) { foreach ($dbs as $db) {
foreach ($migrationsToRun as $migration) { foreach ($migrationsToRun as $migration) {
$this->log('run migration '.$migration.' on project '.$db); $this->log('run migration '.$migration, $db);
$this->runMongoCommand($dm, $db, $migration); $this->runMongoCommand($dm, $db, $migration);
} }
} }
$this->log(count($migrationsToRun).' migrations performed');
} else { } else {
$this->log('No Migrations to perform'); $this->log('No Migrations to perform');
} }
...@@ -123,10 +127,9 @@ class MigrationCommand extends GoGoAbstractCommand ...@@ -123,10 +127,9 @@ class MigrationCommand extends GoGoAbstractCommand
if (count(self::$commands) > $migrationState->getCommandsIndex()) { if (count(self::$commands) > $migrationState->getCommandsIndex()) {
$commandsToRun = array_slice(self::$commands, $migrationState->getCommandsIndex()); $commandsToRun = array_slice(self::$commands, $migrationState->getCommandsIndex());
$commandsToRun = array_unique($commandsToRun); $commandsToRun = array_unique($commandsToRun);
$this->log(count($commandsToRun).' commands to run');
foreach ($dbs as $db) { foreach ($dbs as $db) {
foreach ($commandsToRun as $command) { foreach ($commandsToRun as $command) {
$this->log('call command '.$command.' on project '.$db); $this->log('call command '.$command, $db);
$this->asyncService->callCommand($command, [], $db); $this->asyncService->callCommand($command, [], $db);
} }
} }
...@@ -136,15 +139,13 @@ class MigrationCommand extends GoGoAbstractCommand ...@@ -136,15 +139,13 @@ class MigrationCommand extends GoGoAbstractCommand
if (count(self::$messages) > $migrationState->getMessagesIndex()) { if (count(self::$messages) > $migrationState->getMessagesIndex()) {
$messagesToAdd = array_slice(self::$messages, $migrationState->getMessagesIndex()); $messagesToAdd = array_slice(self::$messages, $migrationState->getMessagesIndex());
$this->log(count($messagesToAdd).' messages to add');
foreach ($dbs as $db) { foreach ($dbs as $db) {
$this->log('add message on project '.$db); $this->log(count($messagesToAdd).' messages to add', $db);
foreach ($messagesToAdd as $message) { foreach ($messagesToAdd as $message) {
// create a GoGoLogUpdate // create a GoGoLogUpdate
$this->asyncService->callCommand('gogolog:add:message', ['"'.$message.'"'], $db); $this->asyncService->callCommand('gogolog:add:message', ['"'.$message.'"'], $db);
} }
} }
$this->log(count($messagesToAdd).' messages added to admin dashboard');
} else { } else {
$this->log('No Messages to add to dashboard'); $this->log('No Messages to add to dashboard');
} }
...@@ -165,4 +166,18 @@ class MigrationCommand extends GoGoAbstractCommand ...@@ -165,4 +166,18 @@ class MigrationCommand extends GoGoAbstractCommand
$db = $mongo->selectDB($dbName); $db = $mongo->selectDB($dbName);
return $db->execute($command); return $db->execute($command);
} }
protected function log($message, $db = null)
{
if ($db) $message = "DB {$db} : $message";
$this->logger->info($message);
$this->output->writeln($message);
}
protected function error($message, $db = null)
{
if ($db) $message = "DB {$this->db} : $message";
$this->logger->error($message);
$this->output->writeln('ERROR '.$message);
}
} }
...@@ -378,9 +378,7 @@ class Element ...@@ -378,9 +378,7 @@ class Element
public function isSynchedWithExternalDatabase() public function isSynchedWithExternalDatabase()
{ {
// TODO is should be configured on the external source (i.e the import) return $this->getIsExternal() && $this->getSource()->getIsSynchronized();
// not all the import will want the imported data to be editable and synchronized
return $this->getIsExternal() && $this->getSource()->getSourceType() == 'osm';
} }
public function getShowUrlFromController($router) public function getShowUrlFromController($router)
......
...@@ -6,15 +6,16 @@ use Doctrine\ODM\MongoDB\DocumentManager; ...@@ -6,15 +6,16 @@ use Doctrine\ODM\MongoDB\DocumentManager;
use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Routing\RouterInterface;
class GoGoCartoJsService class GoGoCartoJsService
{ {
public function __construct(DocumentManager $dm, TokenStorageInterface $securityContext, public function __construct(DocumentManager $dm, TokenStorageInterface $securityContext,
UrlService $urlService, SessionInterface $session) RouterInterface $router, SessionInterface $session)
{ {
$this->dm = $dm; $this->dm = $dm;
$this->securityContext = $securityContext; $this->securityContext = $securityContext;
$this->urlService = $urlService; $this->router = $router;
$this->session = $session; $this->session = $session;
} }
...@@ -227,6 +228,6 @@ class GoGoCartoJsService ...@@ -227,6 +228,6 @@ class GoGoCartoJsService
private function getAbsolutePath($route, $params = []) private function getAbsolutePath($route, $params = [])
{ {
return $this->urlService->generateUrl($route, $params); return $this->router->generate($route, $params, UrlGeneratorInterface::ABSOLUTE_URL);
} }
} }
...@@ -37,9 +37,9 @@ class UrlService ...@@ -37,9 +37,9 @@ class UrlService
elseif($domainName instanceof Configuration) { elseif($domainName instanceof Configuration) {
$config = $domainName; $config = $domainName;
$domainName = $domainName->getDbName(); $domainName = $domainName->getDbName();
} }
// When using from a command (without REQUEST) we want to use the customDomain (for emails for example)
if ($config && $config->getCustomDomain()) { if ($config && $config->getCustomDomain() && empty($_REQUEST)) {
$url .= rtrim($config->getCustomDomain(), '/'); $url .= rtrim($config->getCustomDomain(), '/');
} else { } else {
$url .= "$this->baseProtocol://"; $url .= "$this->baseProtocol://";
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
.sp-preview, .sp-dd { display: none; } .sp-preview, .sp-dd { display: none; }
.default-color { .default-color {
height: 34px; height: 30px;
position: absolute; position: absolute;
width: 40px; width: 40px;
border: 1px solid #ccd6de; border: 1px solid #ccd6de;
......
...@@ -9,15 +9,15 @@ ...@@ -9,15 +9,15 @@
<th>{{ key }}</th> <th>{{ key }}</th>
<td> <td>
{% set type = "text" %} {% set type = "text" %}
{% set disabled = false %} {% set readonly = false %}
{% if not is_string(value) and not is_numeric(value) %} {% if not is_string(value) and not is_numeric(value) %}
{% set disabled = true %} {% set readonly = true %}
{% set value = value|json_encode %} {% set value = value|json_encode %}
{% endif %} {% endif %}
{% if key matches '/^osm\:/' %} {% if key matches '/^osm\:/' %}
{% set disabled = true %} {% set readonly = true %}
{% endif %} {% endif %}
<input type="{{ type }}" class="form-control" {{ disabled ? 'disabled="disabled"' : '' }} <input type="{{ type }}" class="form-control" {{ readonly ? 'readonly="readonly"' : '' }}
name="{{ 'data[' ~ key ~ ']'}}" value="{{ value }}" /> name="{{ 'data[' ~ key ~ ']'}}" value="{{ value }}" />
</td> </td>
</tr> </tr>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment