From 5341b5f6da8a16baba9fc5fb44e186cc5ad19e97 Mon Sep 17 00:00:00 2001 From: Sebastian Castro <90scastro@gmail.com> Date: Fri, 29 Mar 2019 10:05:53 +0100 Subject: [PATCH] Adds license url --- CHANGELOG.md | 1 + .../CoreBundle/Admin/ConfigurationAdmin.php | 3 +- .../CoreBundle/Command/MigrationCommand.php | 45 ++++++++++--------- .../CoreBundle/Document/Configuration.php | 25 +++++++++++ .../Controller/APIController.php | 8 ++-- 5 files changed, 56 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c964959..9ad8f8b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ v2.3.1 ====== +* FEATURE: Add license url for the data * BUG: Fix using images in marker popup template v2.3 diff --git a/src/Biopen/CoreBundle/Admin/ConfigurationAdmin.php b/src/Biopen/CoreBundle/Admin/ConfigurationAdmin.php index 92dd6faa..8c54ccd1 100755 --- a/src/Biopen/CoreBundle/Admin/ConfigurationAdmin.php +++ b/src/Biopen/CoreBundle/Admin/ConfigurationAdmin.php @@ -36,10 +36,11 @@ class ConfigurationAdmin extends AbstractAdmin $apiProperties = $dm->getRepository('BiopenGeoDirectoryBundle:Element')->findAllCustomProperties(); $formMapper - ->with('Le site', array('class' => 'col-md-6', "description" => '
')) + ->with('Le site', array('class' => 'col-md-6', "description" => '')) ->add('appName', null, array('label' => 'Nom du site')) ->add('appBaseline', null, array('label' => 'Description du site (baseline)','required' => false)) ->add('appTags', null, array('label' => 'Mot clés pour le référencement (séparés par une virgule)', 'required' => false)) + ->add('dataLicenseUrl', null, array('label' => 'Url de la licence qui protège vos données', 'required' => false)) ->end() ->with('Images générales', array('class' => 'col-md-6')) ->add('logo', 'sonata_type_model', $imagesOptions) diff --git a/src/Biopen/CoreBundle/Command/MigrationCommand.php b/src/Biopen/CoreBundle/Command/MigrationCommand.php index 2653cc72..98cccc26 100644 --- a/src/Biopen/CoreBundle/Command/MigrationCommand.php +++ b/src/Biopen/CoreBundle/Command/MigrationCommand.php @@ -15,6 +15,30 @@ use Symfony\Component\Process\Process; */ class MigrationCommand extends GoGoAbstractCommand { + // ----------------------------------------------------------------- + // DO NOT REMOVE A SINGLE ELEMENT OF THOSE ARRAYS, ONLY ADD NEW ONES + // ----------------------------------------------------------------- + public $migrations = [ + // March 2019 + // "db.Category.renameCollection('CategoryGroup')", + // "db.Option.renameCollection('Category')" + ]; + + public $commands = [ + // v2.3.1 + "app:elements:updateJson all" + ]; + + public $messages = [ + // v2.3.0 + "Un champ Image (url) est maintenant disponible dans la confiugration du formulaire !", + "Vous pouvez désormais customizer la popup qui s'affiche au survol d'un marqueur. Allez dans Personnalisation -> Marqueur / Popup", + "Nouvelle option pour le menu (Personnalisation -> La Carte -> onglet Menu) : afficher à côté de chaque catégories le nombre d'élements disponible pour cette catégorie", + // v2.3.1 + "Vous pouvez maintenant renseigner la licence qui protège vos données dans Personnalisation -> Configuration Générale" + ]; + + protected function gogoConfigure() { $this->setName('db:migrate') @@ -84,25 +108,4 @@ class MigrationCommand extends GoGoAbstractCommand $process = new Process("mongo {$db} --eval \"{$command}\""); return $process->start(); } - - // ----------------------------------------------------------------- - // DO NOT REMOVE A SINGLE ELEMENT OF THOSE ARRAYS, ONLY ADD NEW ONES - // ----------------------------------------------------------------- - public $migrations = [ - // March 2019 - // "db.Category.renameCollection('CategoryGroup')", - // "db.Option.renameCollection('Category')" - ]; - - public $commands = [ - // v2.3.1 - "app:elements:updateJson all" - ]; - - public $messages = [ - // v2.3.0 - "Un champ Image (url) est maintenant disponible dans la confiugration du formulaire !", - "Vous pouvez désormais customizer la popup qui s'affiche au survol d'un marqueur. Allez dans Personnalisation -> Marqueur / Popup", - "Nouvelle option pour le menu (Personnalisation -> La Carte -> onglet Menu) : afficher à côté de chaque catégories le nombre d'élements disponible pour cette catégorie" - ]; } \ No newline at end of file diff --git a/src/Biopen/CoreBundle/Document/Configuration.php b/src/Biopen/CoreBundle/Document/Configuration.php index ad961ca3..b5e62493 100644 --- a/src/Biopen/CoreBundle/Document/Configuration.php +++ b/src/Biopen/CoreBundle/Document/Configuration.php @@ -47,6 +47,9 @@ class Configuration implements \JsonSerializable // For meta keywords header protected $appTags; + /** @MongoDB\Field(type="string") */ + protected $dataLicenseUrl = "https://opendatacommons.org/licenses/odbl/summary/"; + // ---------------------------- // --------- IMAGES ----------- // ---------------------------- @@ -2981,4 +2984,26 @@ class Configuration implements \JsonSerializable if(!$this->marker) $this->marker = new ConfigurationMarker(); return $this->marker; } + + /** + * Set dataLicenseUrl + * + * @param string $dataLicenseUrl + * @return $this + */ + public function setDataLicenseUrl($dataLicenseUrl) + { + $this->dataLicenseUrl = $dataLicenseUrl; + return $this; + } + + /** + * Get dataLicenseUrl + * + * @return string $dataLicenseUrl + */ + public function getDataLicenseUrl() + { + return $this->dataLicenseUrl; + } } diff --git a/src/Biopen/GeoDirectoryBundle/Controller/APIController.php b/src/Biopen/GeoDirectoryBundle/Controller/APIController.php index c1b61d68..3e2da7bb 100755 --- a/src/Biopen/GeoDirectoryBundle/Controller/APIController.php +++ b/src/Biopen/GeoDirectoryBundle/Controller/APIController.php @@ -96,16 +96,16 @@ class APIController extends GoGoController else { $responseJson = '{ - "data":' . $elementsJson . ', - "ontology":"'. $ontology .'"'; + "licence": "' . $config->getDataLicenseUrl() . '", + "ontology":"'. $ontology . '"'; if (!$fullRepresentation) { $mapping = ['id', $config->getMarker()->getFieldsUsedByTemplate(), 'latitude', 'longitude', 'status', 'moderationState']; $responseJson .= ', "mapping":' . json_encode($mapping); } - - $responseJson .= '}'; + + $responseJson .= ', "data":' . $elementsJson . '}'; } // TODO count how much a user is using the API -- GitLab