From 73daaa979e7e6aed65d3ef48dd7bb602d07cfcb5 Mon Sep 17 00:00:00 2001 From: gildeluermoz Date: Wed, 27 Apr 2016 11:55:43 +0200 Subject: [PATCH 1/7] =?UTF-8?q?ajout=20d'une=20contrainte=20d'unicit=C3=A9?= =?UTF-8?q?=20sur=20le=20champ=20cd=5Fnom=20de=20bib=5Ftaxons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/taxhubdb.sql | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/data/taxhubdb.sql b/data/taxhubdb.sql index f778292f..83bacc60 100644 --- a/data/taxhubdb.sql +++ b/data/taxhubdb.sql @@ -538,6 +538,14 @@ ALTER TABLE ONLY cor_taxon_liste ADD CONSTRAINT cor_taxon_listes_bib_taxons_fkey FOREIGN KEY (id_taxon) REFERENCES bib_taxons(id_taxon); +-- +-- Name: fk_bib_taxons_taxref; Type: FK CONSTRAINT; Schema: taxonomie; Owner: geonatuser +-- + +ALTER TABLE taxonomie.bib_taxons + ADD CONSTRAINT unique_cd_nom UNIQUE (cd_nom); + + -- -- Name: fk_bib_taxons_taxref; Type: FK CONSTRAINT; Schema: taxonomie; Owner: geonatuser -- From 27571e25fc5413fac3c51087b47eedd9435e8c98 Mon Sep 17 00:00:00 2001 From: Amandine SAHL Date: Tue, 3 May 2016 19:01:44 +0200 Subject: [PATCH 2/7] 1er phase de nettoyage de la directive; correction du $watch --- web/app/bib_taxon/list/taxonsListControler.js | 31 +++---------------- .../directives/searchHierarchie-directive.js | 16 +--------- web/app/taxref/list/taxrefControler.js | 17 +++++----- 3 files changed, 15 insertions(+), 49 deletions(-) diff --git a/web/app/bib_taxon/list/taxonsListControler.js b/web/app/bib_taxon/list/taxonsListControler.js index 195f0101..256091b2 100644 --- a/web/app/bib_taxon/list/taxonsListControler.js +++ b/web/app/bib_taxon/list/taxonsListControler.js @@ -18,8 +18,8 @@ app.service('bibtaxonListSrv', function () { }; }); -app.controller('taxonsListCtrl',[ '$scope', '$http', '$filter','filterFilter', '$uibModal', 'ngTableParams', 'toaster','$rootScope','bibtaxonListSrv', - function($scope, $http, $filter, filterFilter, $modal, ngTableParams, toaster, $rootScope, bibtaxonListSrv) { +app.controller('taxonsListCtrl',[ '$scope', '$http', '$filter','filterFilter', '$uibModal', 'ngTableParams', 'toaster','bibtaxonListSrv', + function($scope, $http, $filter, filterFilter, $modal, ngTableParams, toaster,bibtaxonListSrv) { var self = this; self.route='taxons'; @@ -152,11 +152,11 @@ app.controller('taxonsListCtrl',[ '$scope', '$http', '$filter','filterFilter', ' if (self.filterBibtaxons.cd){ //Si cd_nom queryparam.params.cdNom = self.filterBibtaxons.cd; self.filterBibtaxons.lb = null; - $rootScope.$broadcast('hierachieDir:refreshHierarchy',{}); + self.filterBibtaxons.hierarchy = {}; } else if (self.filterBibtaxons.lb_nom) {//Si lb_nom queryparam.params.ilikelatin = self.filterBibtaxons.lb_nom; - $rootScope.$broadcast('hierachieDir:refreshHierarchy',{}); + self.filterBibtaxons.hierarchy = {}; } else if (self.filterBibtaxons.hierarchy) {//Si hierarchie queryparam.params.famille = (self.filterBibtaxons.hierarchy.famille) ? self.filterBibtaxons.hierarchy.famille : ''; @@ -171,28 +171,7 @@ app.controller('taxonsListCtrl',[ '$scope', '$http', '$filter','filterFilter', ' } self.refreshForm = function() { self.bibtaxonsList = {}; - $rootScope.$broadcast('hierachieDir:refreshHierarchy',{}); + self.filterBibtaxons = {'hierarchy' : {}}; } - self.findLbNomB = function(lb) { - getTaxonsByLbNom(lb).then(function(response) { - self.bibtaxonsList = response.data; - $rootScope.$broadcast('hierachieDir:refreshHierarchy',{}); - self.lb = null; - }); - }; - - //Récupérer une liste de taxons selon nom_latin - getTaxonsByLbNom = function(lb) { - self.validName == 'txRef' ? self.txRef = true : self.txRef = ''; - return $http.get("taxref/bibtaxons/?ilike="+lb+"&nom_valide="+self.txRef) - .success(function(response) { - return response ; - }) - .error(function(error) { - return error; - }); - }; - - }]); diff --git a/web/app/components/directives/searchHierarchie-directive.js b/web/app/components/directives/searchHierarchie-directive.js index ea26310d..e967954d 100644 --- a/web/app/components/directives/searchHierarchie-directive.js +++ b/web/app/components/directives/searchHierarchie-directive.js @@ -8,7 +8,7 @@ app.directive('searchHierachieDir', ['$http', function ($http) { }, link:function($scope, $element, $attrs) { //Initialisation - $scope.$watch($scope.taxHierarchieSelected, function() { + $scope.$watch('taxHierarchieSelected', function() { if ($scope.taxHierarchieSelected) { if ($scope.taxHierarchieSelected.regne) $scope.taxHierarchieSelectedKD = {'regne': $scope.taxHierarchieSelected.regne, 'nb_tx_kd': $scope.taxHierarchieSelected.nb_tx_kd }; else $scope.taxHierarchieSelectedKD = undefined; @@ -24,20 +24,6 @@ app.directive('searchHierachieDir', ['$http', function ($http) { }, true); - $scope.$on('hierachieDir:refreshHierarchy',function(event, data){ - $scope.refreshHierarchy(); - }); - - //fonction permettant de vider tous les champs de la recherche hierarchique - $scope.refreshHierarchy = function() { - this.taxHierarchieSelected = null; - this.taxHierarchieSelectedKD = null; - this.taxHierarchieSelectedPH = null; - this.taxHierarchieSelectedCL = null; - this.taxHierarchieSelectedOR = null; - this.taxHierarchieSelectedFM = null; - } - $scope.onSelect = function ($item, $model, $label) { $scope.$item = $item; $scope.$model = $model; diff --git a/web/app/taxref/list/taxrefControler.js b/web/app/taxref/list/taxrefControler.js index 8ce8c8de..f28b671f 100644 --- a/web/app/taxref/list/taxrefControler.js +++ b/web/app/taxref/list/taxrefControler.js @@ -18,8 +18,8 @@ app.service('taxrefTaxonListSrv', function () { }; }); -app.controller('taxrefCtrl', [ '$scope', '$http', '$filter','$uibModal', 'ngTableParams','$rootScope','taxrefTaxonListSrv', - function($scope, $http, $filter,$uibModal, ngTableParams, $rootScope,taxrefTaxonListSrv) { +app.controller('taxrefCtrl', [ '$scope', '$http', '$filter','$uibModal', 'ngTableParams','taxrefTaxonListSrv', + function($scope, $http, $filter,$uibModal, ngTableParams,taxrefTaxonListSrv) { var self = this; self.route='taxref'; //---------------------Valeurs par défaut ------------------------------------ @@ -109,20 +109,21 @@ app.controller('taxrefCtrl', [ '$scope', '$http', '$filter','$uibModal', 'ngTabl self.findInTaxref = function() { var queryparam = {params :{ 'is_ref':(self.filterTaxref.isRef) ? true : false, - 'is_inbibtaxons':(self.filterTaxref.isInBibtaxon) ? true : false + 'is_inbibtaxons':(self.filterTaxref.isInBibtaxon) ? true : false, + 'limit' : 500 }}; if (self.filterTaxref.hierarchy) { - queryparam.params.limit = (self.filterTaxref.hierarchy.limit) ? self.filterTaxref.hierarchy.limit : ''; + queryparam.params.limit = (self.filterTaxref.hierarchy.limit) ? self.filterTaxref.hierarchy.limit : '500'; } if (self.filterTaxref.cd){ //Si cd_nom queryparam.params.cdNom = self.filterTaxref.cd; self.filterTaxref.lb = null; - $rootScope.$broadcast('hierachieDir:refreshHierarchy',{}); + self.filterTaxref.hierarchy = {}; } else if (self.filterTaxref.lb_nom) {//Si lb_nom queryparam.params.ilike = self.filterTaxref.lb_nom; - $rootScope.$broadcast('hierachieDir:refreshHierarchy',{}); + self.filterTaxref.hierarchy = {}; } else if (self.filterTaxref.hierarchy) {//Si hierarchie queryparam.params.famille = (self.filterTaxref.hierarchy.famille) ? self.filterTaxref.hierarchy.famille : ''; @@ -136,9 +137,9 @@ app.controller('taxrefCtrl', [ '$scope', '$http', '$filter','$uibModal', 'ngTabl }); }; self.refreshForm = function() { - self.filterTaxref = {}; - $rootScope.$broadcast('hierachieDir:refreshHierarchy',{}); + self.filterTaxref = {'hierarchy':{}}; } + //-----------------------Bandeau recherche----------------------------------------------- //gestion du bandeau de recherche - Position LEFT self.getTaxrefIlike = function(val) { From 16443944c02a57a74450bb81d25ea15805c243ee Mon Sep 17 00:00:00 2001 From: Amandine SAHL Date: Wed, 4 May 2016 18:35:02 +0200 Subject: [PATCH 3/7] =?UTF-8?q?simplification=20et=20correction=20de=20la?= =?UTF-8?q?=20directive=20recherche=20hi=C3=A9rarchique=20-=20fix=20:=20#6?= =?UTF-8?q?6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../directives/searchHierarchie-directive.js | 23 ++++--------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/web/app/components/directives/searchHierarchie-directive.js b/web/app/components/directives/searchHierarchie-directive.js index e967954d..d69315a1 100644 --- a/web/app/components/directives/searchHierarchie-directive.js +++ b/web/app/components/directives/searchHierarchie-directive.js @@ -30,30 +30,15 @@ app.directive('searchHierachieDir', ['$http', function ($http) { $scope.$label = $label; this.taxHierarchieSelected = $item; - - this.taxHierarchieSelectedKD = {'regne' : $item.regne, 'nb_tx_kd' : $item.nb_tx_kd }; - - if ($item.phylum) this.taxHierarchieSelectedPH = {'phylum' : $item.phylum, 'nb_tx_ph' : $item.nb_tx_ph }; - else this.taxHierarchieSelectedPH = undefined; - - if ($item.classe) this.taxHierarchieSelectedCL = {'classe' : $item.classe, 'nb_tx_cl' : $item.nb_tx_cl }; - else this.taxHierarchieSelectedCL = undefined; - - if ($item.ordre) this.taxHierarchieSelectedOR = {'ordre' : $item.ordre, 'nb_tx_or' : $item.nb_tx_or }; - else this.taxHierarchieSelectedOR = undefined; - - if ($item.famille) this.taxHierarchieSelectedFM = {'famille' : $item.famille, 'nb_tx_fm' : $item.nb_tx_fm }; - else this.taxHierarchieSelectedFM = undefined; - }; $scope.getTaxonHierarchie = function(rang, val, model) { var queryparam = {params : {'ilike': val.trim()}} ; if (model) { - if ((model.regne) && ((rang !=='OR') || (rang !=='CL') || (rang !=='PH')|| (rang !=='KD'))) queryparam.params.regne = model.regne.trim(); - if ((model.phylum) && ((rang !=='OR') || (rang !=='CL') || (rang !=='PH'))) queryparam.params.phylum = model.phylum.trim(); - if ((model.classe) && ((rang !=='OR') || (rang !=='CL'))) queryparam.params.classe = model.classe.trim(); - if ((model.ordre) && (rang !=='OR')) queryparam.params.ordre = model.ordre.trim(); + if ((model.regne) && (rang !=='KD')) queryparam.params.regne = model.regne.trim(); + if ((model.phylum) && ((rang !=='PH') && (rang !=='KD'))) queryparam.params.phylum = model.phylum.trim(); + if ((model.classe) && ((rang !=='CL') && (rang !=='PH') && (rang !=='KD'))) queryparam.params.classe = model.classe.trim(); + if ((model.ordre) && ((rang !=='OR') && (rang !=='CL') && (rang !=='PH') && (rang !=='KD'))) queryparam.params.ordre = model.ordre.trim(); } return $http.get(this.searchUrl+rang, queryparam).then(function(response){ return response.data.map(function(item){ From d1f610ba29e36356e4dcd2ff82a7efdb59a72f04 Mon Sep 17 00:00:00 2001 From: amandine-sahl Date: Thu, 12 May 2016 17:11:11 +0200 Subject: [PATCH 4/7] modification formulaire edition du Taxon - fix : #61 --- web/app/bib_taxon/edit/taxons-form.html | 9 +++------ web/app/bib_taxon/edit/taxonsFormControler.js | 6 +----- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/web/app/bib_taxon/edit/taxons-form.html b/web/app/bib_taxon/edit/taxons-form.html index 7d555472..7b3b118b 100644 --- a/web/app/bib_taxon/edit/taxons-form.html +++ b/web/app/bib_taxon/edit/taxons-form.html @@ -22,22 +22,19 @@
- +
- +
- -
-
- +
diff --git a/web/app/bib_taxon/edit/taxonsFormControler.js b/web/app/bib_taxon/edit/taxonsFormControler.js index e653d364..77f8b307 100644 --- a/web/app/bib_taxon/edit/taxonsFormControler.js +++ b/web/app/bib_taxon/edit/taxonsFormControler.js @@ -48,11 +48,7 @@ function($scope, $routeParams, $http, locationHistoryService, $location, toaster }); } }); - - self.refreshTaxrefData = function() { - self.cd_nom = self.bibTaxon.cd_nom; - } - + //------------------------------ Chargement de la listes des attributs ----------------------/ ///bibattributs/Animalia/Autre $scope.$watch(function () { From 240cb8bbdf771b02e72d07b2873c1f83e2fc7f8a Mon Sep 17 00:00:00 2001 From: amandine-sahl Date: Thu, 12 May 2016 17:20:17 +0200 Subject: [PATCH 5/7] =?UTF-8?q?modification=20de=20la=20limite=20:=20nombr?= =?UTF-8?q?e=20par=20d=C3=A9faut=20et=20tooltip=20-=20cf=20#64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/app/components/directives/searchHierarchie-directive.js | 6 +++--- .../components/directives/searchHierarchie-template.html | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/web/app/components/directives/searchHierarchie-directive.js b/web/app/components/directives/searchHierarchie-directive.js index d69315a1..0f517a73 100644 --- a/web/app/components/directives/searchHierarchie-directive.js +++ b/web/app/components/directives/searchHierarchie-directive.js @@ -7,8 +7,9 @@ app.directive('searchHierachieDir', ['$http', function ($http) { searchUrl:'@', }, link:function($scope, $element, $attrs) { + var defaultLimit = 1000; //Initialisation - $scope.$watch('taxHierarchieSelected', function() { + $scope.$watch('taxHierarchieSelected', function(newVal, oldVal) { if ($scope.taxHierarchieSelected) { if ($scope.taxHierarchieSelected.regne) $scope.taxHierarchieSelectedKD = {'regne': $scope.taxHierarchieSelected.regne, 'nb_tx_kd': $scope.taxHierarchieSelected.nb_tx_kd }; else $scope.taxHierarchieSelectedKD = undefined; @@ -28,7 +29,6 @@ app.directive('searchHierachieDir', ['$http', function ($http) { $scope.$item = $item; $scope.$model = $model; $scope.$label = $label; - this.taxHierarchieSelected = $item; }; @@ -43,7 +43,7 @@ app.directive('searchHierachieDir', ['$http', function ($http) { return $http.get(this.searchUrl+rang, queryparam).then(function(response){ return response.data.map(function(item){ nbitem = (item.nb_tx_fm || item.nb_tx_or || item.nb_tx_cl || item.nb_tx_ph || item.nb_tx_kd); - item.limit = (nbitem>500) ? 500 : nbitem; + item.limit = (nbitem>defaultLimit) ? defaultLimit : nbitem; return item; }); }); diff --git a/web/app/components/directives/searchHierarchie-template.html b/web/app/components/directives/searchHierarchie-template.html index f85a9d9f..d6873706 100644 --- a/web/app/components/directives/searchHierarchie-template.html +++ b/web/app/components/directives/searchHierarchie-template.html @@ -43,9 +43,11 @@ class="form-control"/>
- +
- +
From 383aecfd357c9bec83324ad757f194a0cbc2f46d Mon Sep 17 00:00:00 2001 From: amandine-sahl Date: Thu, 12 May 2016 17:26:00 +0200 Subject: [PATCH 6/7] =?UTF-8?q?reinitialisation=20des=20listes=20apr=C3=A8?= =?UTF-8?q?s=20avoir=20rafraichi=20les=20formulaires=20de=20recherche=20-?= =?UTF-8?q?=20cf=20#63?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/app/bib_taxon/list/taxonsListControler.js | 4 +--- web/app/components/directives/searchHierarchie-directive.js | 1 - web/app/taxref/list/taxrefControler.js | 1 + 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/web/app/bib_taxon/list/taxonsListControler.js b/web/app/bib_taxon/list/taxonsListControler.js index 256091b2..5c775367 100644 --- a/web/app/bib_taxon/list/taxonsListControler.js +++ b/web/app/bib_taxon/list/taxonsListControler.js @@ -98,9 +98,6 @@ app.controller('taxonsListCtrl',[ '$scope', '$http', '$filter','filterFilter', ' } }); - self.findBibTaxonsByHierarchie = function(data) { - console.log('Recherche des bibtaxons'); - }; //---------------------FORMULAIRE de RECHERCHE --------------------------------------------------- self.getTaxrefIlike = function(val) { return $http.get('taxref/bibtaxons/', {params:{'ilike':val}}).then(function(response){ @@ -172,6 +169,7 @@ app.controller('taxonsListCtrl',[ '$scope', '$http', '$filter','filterFilter', ' self.refreshForm = function() { self.bibtaxonsList = {}; self.filterBibtaxons = {'hierarchy' : {}}; + self.findInBibTaxon(); } }]); diff --git a/web/app/components/directives/searchHierarchie-directive.js b/web/app/components/directives/searchHierarchie-directive.js index 0f517a73..98e87ff3 100644 --- a/web/app/components/directives/searchHierarchie-directive.js +++ b/web/app/components/directives/searchHierarchie-directive.js @@ -24,7 +24,6 @@ app.directive('searchHierachieDir', ['$http', function ($http) { } }, true); - $scope.onSelect = function ($item, $model, $label) { $scope.$item = $item; $scope.$model = $model; diff --git a/web/app/taxref/list/taxrefControler.js b/web/app/taxref/list/taxrefControler.js index f28b671f..93e87a4d 100644 --- a/web/app/taxref/list/taxrefControler.js +++ b/web/app/taxref/list/taxrefControler.js @@ -138,6 +138,7 @@ app.controller('taxrefCtrl', [ '$scope', '$http', '$filter','$uibModal', 'ngTabl }; self.refreshForm = function() { self.filterTaxref = {'hierarchy':{}}; + self.findInTaxref(); } //-----------------------Bandeau recherche----------------------------------------------- From 7a65d834b9bfa0a88485e2aa4a308cb05a17c3c9 Mon Sep 17 00:00:00 2001 From: amandine-sahl Date: Thu, 12 May 2016 17:39:31 +0200 Subject: [PATCH 7/7] suppression du bouton ajouter taxon - fix #59 --- web/app/bib_taxon/list/taxons.html | 5 ----- 1 file changed, 5 deletions(-) diff --git a/web/app/bib_taxon/list/taxons.html b/web/app/bib_taxon/list/taxons.html index a429bff7..029be584 100644 --- a/web/app/bib_taxon/list/taxons.html +++ b/web/app/bib_taxon/list/taxons.html @@ -107,11 +107,6 @@ -