Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
amandine-sahl committed May 12, 2016
2 parents 6da06bb + 7a65d83 commit bc7285b
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 92 deletions.
8 changes: 8 additions & 0 deletions data/taxhubdb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
--
Expand Down
9 changes: 3 additions & 6 deletions web/app/bib_taxon/edit/taxons-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,19 @@
<div class="form-group form-group-sm">
<label class="col-sm-2 control-label" for="sm">Nom latin</label>
<div class="col-sm-10">
<input class="form-control" type="text" id="sm" ng-model="ctrl.bibTaxon.nom_latin" placeholder="Nom latin">
<input class="form-control" type="text" id="sm" ng-model="ctrl.bibTaxon.nom_latin" placeholder="Nom latin" ng-disabled="true">
</div>
</div>
<div class="form-group form-group-sm">
<label class="col-sm-2 control-label" for="sm">Auteur</label>
<div class="col-sm-10">
<input class="form-control" type="text" id="sm" ng-model="ctrl.bibTaxon.auteur" placeholder="Auteur">
<input class="form-control" type="text" id="sm" ng-model="ctrl.bibTaxon.auteur" placeholder="Auteur" ng-disabled="true">
</div>
</div>
<div class="form-group form-group-sm">
<label class="col-sm-2 control-label" for="sm">cd_nom</label>
<div class="col-sm-6">
<input class="form-control" type="text" id="sm" ng-model="ctrl.bibTaxon.cd_nom" placeholder="cd_nom (taxref)" required>
</div>
<div class="col-sm-4">
<button class="btn btn-success glyphicon glyphicon-refresh" ng-click="ctrl.refreshTaxrefData()">Rafraichir</button>
<input class="form-control" type="text" id="sm" ng-model="ctrl.bibTaxon.cd_nom" placeholder="cd_nom (taxref)" required ng-disabled="true">
</div>
</div>
<uib-tabset active="activeForm">
Expand Down
6 changes: 1 addition & 5 deletions web/app/bib_taxon/edit/taxonsFormControler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
5 changes: 0 additions & 5 deletions web/app/bib_taxon/list/taxons.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@
</table>
</div>
</div>
<div class="panel-footer">
<a class="btn btn-success" href="#/taxonform">
<span class="glyphicon glyphicon-leaf"></span> Ajouter un taxon
</a>
</div>
</div>

<hr>
Expand Down
35 changes: 6 additions & 29 deletions web/app/bib_taxon/list/taxonsListControler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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){
Expand Down Expand Up @@ -152,11 +149,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 : '';
Expand All @@ -171,28 +168,8 @@ app.controller('taxonsListCtrl',[ '$scope', '$http', '$filter','filterFilter', '
}
self.refreshForm = function() {
self.bibtaxonsList = {};
$rootScope.$broadcast('hierachieDir:refreshHierarchy',{});
self.filterBibtaxons = {'hierarchy' : {}};
self.findInBibTaxon();
}

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;
});
};


}]);
44 changes: 7 additions & 37 deletions web/app/components/directives/searchHierarchie-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ app.directive('searchHierachieDir', ['$http', function ($http) {
searchUrl:'@',
},
link:function($scope, $element, $attrs) {
var defaultLimit = 1000;
//Initialisation
$scope.$watch($scope.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;
Expand All @@ -23,56 +24,25 @@ 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;
$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){
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;
});
});
Expand Down
6 changes: 4 additions & 2 deletions web/app/components/directives/searchHierarchie-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@
class="form-control"/>
</div>
<div class="col-md-4">
<label class="col-md-2 control-label" for="tbLimit">Limit</label>
<label class="col-md-2 control-label" for="tbLimit"
title="Nombre maximum de résultats renvoyés">Limite</label>
<div class="col-md-6">
<input type="text" id="tbLimit" class="form-control" aria-describedby="sizing-addon2" ng-model="taxHierarchieSelected.limit" placeholder="limiter les résultats" >
<input type="text" id="tbLimit" class="form-control"
ng-model="taxHierarchieSelected.limit" placeholder="limiter les résultats">
</div>
</div>
</div>
Expand Down
18 changes: 10 additions & 8 deletions web/app/taxref/list/taxrefControler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ------------------------------------
Expand Down Expand Up @@ -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 : '';
Expand All @@ -136,9 +137,10 @@ app.controller('taxrefCtrl', [ '$scope', '$http', '$filter','$uibModal', 'ngTabl
});
};
self.refreshForm = function() {
self.filterTaxref = {};
$rootScope.$broadcast('hierachieDir:refreshHierarchy',{});
self.filterTaxref = {'hierarchy':{}};
self.findInTaxref();
}

//-----------------------Bandeau recherche-----------------------------------------------
//gestion du bandeau de recherche - Position LEFT
self.getTaxrefIlike = function(val) {
Expand Down

0 comments on commit bc7285b

Please sign in to comment.