Subversion Repositories eFlore/Applications.cel

Rev

Rev 2063 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2063 Rev 2064
Line 40... Line 40...
40
DEFAULT CHARACTER SET = utf8
40
DEFAULT CHARACTER SET = utf8
41
COLLATE = utf8_general_ci;
41
COLLATE = utf8_general_ci;
Line 42... Line 42...
42
 
42
 
-
 
43
 
-
 
44
-- -----------------------------------------------------
-
 
45
-- Table `cel_arbre_mots_cles_images`
-
 
46
-- -----------------------------------------------------
-
 
47
DROP TABLE IF EXISTS `cel_arbre_mots_cles_images` ;
-
 
48
 
-
 
49
CREATE  TABLE IF NOT EXISTS `cel_arbre_mots_cles_images` (
-
 
50
  `id_mot_cle` INT NOT NULL ,
-
 
51
  `chemin` VARCHAR(2048) NULL ,
-
 
52
  `mot_cle` VARCHAR(80) NULL ,
-
 
53
  `id_utilisateur` VARCHAR(255) NULL ,
-
 
54
  PRIMARY KEY (`id_mot_cle`) )
-
 
55
ENGINE = MyISAM;
-
 
56
 
43
 
57
 
44
-- -----------------------------------------------------
58
-- -----------------------------------------------------
45
-- Table `cel_mots_cles_images_liaison`
59
-- Table `cel_mots_cles_images_liaison`
Line 46... Line 60...
46
-- -----------------------------------------------------
60
-- -----------------------------------------------------
Line 59... Line 73...
59
DROP TABLE IF EXISTS `cel_images` ;
73
DROP TABLE IF EXISTS `cel_images` ;
Line 60... Line 74...
60
 
74
 
61
CREATE  TABLE IF NOT EXISTS `cel_images` (
75
CREATE  TABLE IF NOT EXISTS `cel_images` (
62
  `id_image` BIGINT NOT NULL AUTO_INCREMENT ,
76
  `id_image` BIGINT NOT NULL AUTO_INCREMENT ,
63
  `ordre` BIGINT NOT NULL ,
77
  `ordre` BIGINT NOT NULL ,
64
  `ce_utilisateur` VARCHAR(32) NOT NULL COMMENT 'L\'id utilisateur est un int mais on utilise un varchar pour stocker des observations avec des identifiants temporaires\n' ,
78
  `ce_utilisateur` VARCHAR(255) NOT NULL COMMENT 'L\'id utilisateur est un int mais on utilise un varchar pour stocker des observations avec des identifiants temporaires\n' ,
65
  `prenom_utilisateur` VARCHAR(255) NULL DEFAULT NULL ,
79
  `prenom_utilisateur` VARCHAR(255) NULL DEFAULT NULL ,
66
  `nom_utilisateur` VARCHAR(255) NULL DEFAULT NULL ,
80
  `nom_utilisateur` VARCHAR(255) NULL DEFAULT NULL ,
67
  `courriel_utilisateur` VARCHAR(255) NULL DEFAULT NULL ,
81
  `courriel_utilisateur` VARCHAR(255) NULL DEFAULT NULL ,
68
  `hauteur` INT NOT NULL ,
82
  `hauteur` INT NOT NULL ,
Line 133... Line 147...
133
COLLATE = utf8_general_ci
147
COLLATE = utf8_general_ci
134
COMMENT = 'Stockage d\'infos supplémentaires sur une observation';
148
COMMENT = 'Stockage d\'infos supplémentaires sur une observation';
Line 135... Line 149...
135
 
149
 
136
 
150
 
137
-- -----------------------------------------------------
151
-- -----------------------------------------------------
138
-- Table `cel_arbre_mots_cles_images`
152
-- Table `cel_arbre_mots_cles_obs`
Line 139... Line 153...
139
-- -----------------------------------------------------
153
-- -----------------------------------------------------
140
DROP TABLE IF EXISTS `cel_arbre_mots_cles_images` ;
154
DROP TABLE IF EXISTS `cel_arbre_mots_cles_obs` ;
141
 
155
 
142
CREATE  TABLE IF NOT EXISTS `cel_arbre_mots_cles_images` (
156
CREATE  TABLE IF NOT EXISTS `cel_arbre_mots_cles_obs` (
143
  `id_mot_cle` INT NOT NULL ,
157
  `id_mot_cle` INT NOT NULL ,
144
  `chemin` VARCHAR(2048) NULL ,
158
  `chemin` VARCHAR(2048) NULL ,
145
  `mot_cle` VARCHAR(255) NULL ,
159
  `mot_cle` VARCHAR(80) NULL ,
Line 202... Line 216...
202
  PRIMARY KEY (`id_observation`) ,
216
  PRIMARY KEY (`id_observation`) ,
203
  UNIQUE INDEX `id_obs` (`ce_utilisateur` ASC, `ordre` ASC) ,
217
  UNIQUE INDEX `id_obs` (`ce_utilisateur` ASC, `ordre` ASC) ,
204
  INDEX `date_creation` (`ce_utilisateur`(10) ASC, `date_creation` ASC) ,
218
  INDEX `date_creation` (`ce_utilisateur`(10) ASC, `date_creation` ASC) ,
205
  INDEX `coordonnees` (`latitude` ASC, `longitude` ASC) ,
219
  INDEX `coordonnees` (`latitude` ASC, `longitude` ASC) ,
206
  INDEX `nom_retenu` (`nom_ret` ASC) ,
220
  INDEX `nom_retenu` (`nom_ret` ASC) ,
207
  INDEX `date_observation` (`date_observation` ASC) COMMENT ' /* comment truncated */ /*index sur (bdtfx,bdtfx,isfan)*/' ,
221
  INDEX `date_observation` (`date_observation` ASC) COMMENT ' /* comment truncated */ /*Index sur (bdtfx,bdtfx,isfan)*/' ,
208
  INDEX `nom_referentiel` (`nom_referentiel`(5) ASC) COMMENT ' /* comment truncated */ /*date_transmission : nécessaire à l'ORDER BY utilisé dans la liste d'observation de DEL*/' ,
222
  INDEX `nom_referentiel` (`nom_referentiel`(5) ASC) COMMENT ' /* comment truncated */ /*Date_transmission : nécessaire à l'ORDER BY utilisé dans la liste d'observation de DEL*/' ,
209
  INDEX `date_transmission` (`date_transmission` DESC) COMMENT ' /* comment truncated */ /*nécessaire à CEL/DEL qui officie avec transmission = 1*/' ,
223
  INDEX `date_transmission` (`date_transmission` DESC) COMMENT ' /* comment truncated */ /*Nécessaire à CEL/DEL qui officie avec transmission = 1*/' ,
210
  INDEX `transmission` (`transmission` ASC) )
224
  INDEX `transmission` (`transmission` ASC) )
211
ENGINE = MyISAM
225
ENGINE = MyISAM
212
DEFAULT CHARACTER SET = utf8
226
DEFAULT CHARACTER SET = utf8
213
COLLATE = utf8_general_ci;
227
COLLATE = utf8_general_ci;
Line 247... Line 261...
247
COLLATE = utf8_general_ci
261
COLLATE = utf8_general_ci
248
COMMENT = 'Stockage d\'info supplémentaires sur une image';
262
COMMENT = 'Stockage d\'info supplémentaires sur une image';
Line 249... Line 263...
249
 
263
 
250
 
-
 
251
-- -----------------------------------------------------
-
 
252
-- Table `cel_arbre_mots_cles_obs`
-
 
253
-- -----------------------------------------------------
-
 
254
DROP TABLE IF EXISTS `cel_arbre_mots_cles_obs` ;
-
 
255
 
-
 
256
CREATE  TABLE IF NOT EXISTS `cel_arbre_mots_cles_obs` (
-
 
257
  `id_mot_cle` INT NOT NULL ,
-
 
258
  `chemin` VARCHAR(2048) NULL ,
-
 
259
  `mot_cle` VARCHAR(255) NULL ,
-
 
260
  `id_utilisateur` VARCHAR(255) NULL ,
-
 
261
  PRIMARY KEY (`id_mot_cle`) )
-
 
262
ENGINE = MyISAM;
-
 
263
 
-
 
264
 
264
 
265
-- -----------------------------------------------------
265
-- -----------------------------------------------------
266
-- Placeholder table for view `cel_utilisateurs`
266
-- Placeholder table for view `cel_utilisateurs`
Line 267... Line 267...
267
-- -----------------------------------------------------
267
-- -----------------------------------------------------
Line 275... Line 275...
275
-- -----------------------------------------------------
275
-- -----------------------------------------------------
276
-- View `cel_utilisateurs`
276
-- View `cel_utilisateurs`
277
-- -----------------------------------------------------
277
-- -----------------------------------------------------
278
DROP VIEW IF EXISTS `cel_utilisateurs` ;
278
DROP VIEW IF EXISTS `cel_utilisateurs` ;
279
DROP TABLE IF EXISTS `cel_utilisateurs`;
279
DROP TABLE IF EXISTS `cel_utilisateurs`;
280
CREATE  OR REPLACE VIEW `cel_utilisateurs` AS 
280
CREATE  OR REPLACE VIEW `cel_utilisateurs` AS 
281
	SELECT at.U_ID AS id_utilisateur, at.U_SURNAME AS prenom, at.U_NAME AS nom, at.U_MAIL AS courriel, at.U_PASSWD AS mot_de_passe,  
281
	SELECT at.U_ID AS id_utilisateur, at.U_SURNAME AS prenom, at.U_NAME AS nom, at.U_MAIL AS courriel, at.U_PASSWD AS mot_de_passe,  
282
		ui.licence_acceptee, ui.admin, ui.preferences, ui.date_premiere_utilisation 
282
		ui.licence_acceptee, ui.admin, ui.preferences, ui.date_premiere_utilisation 
283
	FROM tela_prod_v4.annuaire_tela AS at
283
	FROM tela_prod_v4.annuaire_tela AS at
284
		LEFT JOIN cel_utilisateurs_infos AS ui ON (ui.id_utilisateur = at.U_ID);
284
		LEFT JOIN cel_utilisateurs_infos AS ui ON (ui.id_utilisateur = at.U_ID);
Line 285... Line 285...
285
 
285
 
286
-- -----------------------------------------------------
286
-- -----------------------------------------------------
287
-- View `cel_tapir`
287
-- View `cel_tapir`
288
-- -----------------------------------------------------
288
-- -----------------------------------------------------
289
DROP VIEW IF EXISTS `cel_tapir` ;
289
DROP VIEW IF EXISTS `cel_tapir` ;
290
DROP TABLE IF EXISTS `cel_tapir`;
290
DROP TABLE IF EXISTS `cel_tapir`;
291
CREATE  OR REPLACE VIEW `cel_tapir` AS 
291
CREATE  OR REPLACE VIEW `cel_tapir` AS 
292
	select concat(_utf8'urn:lsid:tela-botanica.org:cel:',`o`.`id_observation`) AS `guid`,
292
	select concat(_utf8'urn:lsid:tela-botanica.org:cel:',`o`.`id_observation`) AS `guid`,
293
		`o`.`id_observation` AS `observation_id`,
293
		`o`.`id_observation` AS `observation_id`,
294
		date_format(`o`.`date_observation`,'%Y-%m-%d') AS `observation_date`,
294
		date_format(`o`.`date_observation`,'%Y-%m-%d') AS `observation_date`,
295
		`o`.`nom_sel` AS `nom_scientifique_complet`,
295
		`o`.`nom_sel` AS `nom_scientifique_complet`,
296
		`o`.`nom_sel_nn` AS `nom_num_nomenclatural`,
296
		`o`.`nom_sel_nn` AS `nom_num_nomenclatural`,
297
		`o`.`nt` AS `nom_num_taxonomique`,
297
		`o`.`nt` AS `nom_num_taxonomique`,
298
		`o`.`famille` AS `nom_famille`,
298
		`o`.`famille` AS `nom_famille`,
299
		concat(_utf8'',`zg`.`nom`,' [INSEE:',`zg`.`code`,']') AS `lieu_commune_nom_complet`,
299
		concat(_utf8'',`zg`.`nom`,' [INSEE:',`zg`.`code`,']') AS `lieu_commune_nom_complet`,
300
		`zg`.`nom` AS `lieu_commune_nom`,
300
		`zg`.`nom` AS `lieu_commune_nom`,
301
		`zg`.`code` AS `lieu_commune_code_insee`,
301
		`zg`.`code` AS `lieu_commune_code_insee`,
302
		if((`zg`.`code` <> ''), 'Lion1906 version 26-05-2008 - http://www.lion1906.com/', NULL) AS `lieu_commune_source`,
302
		if((`zg`.`code` <> ''), 'Lion1906 version 26-05-2008 - http://www.lion1906.com/', NULL) AS `lieu_commune_source`,
303
		format(if((`o`.`latitude` <> ''), `o`.`latitude`, `zg`.`wgs84_latitude`), 5) AS `lieu_latitude`,
303
		format(if((`o`.`latitude` <> ''), `o`.`latitude`, `zg`.`wgs84_latitude`), 5) AS `lieu_latitude`,
304
		format(if((`o`.`longitude` <> ''), `o`.`longitude`, `zg`.`wgs84_longitude`), 5) AS `lieu_longitude`,
304
		format(if((`o`.`longitude` <> ''), `o`.`longitude`, `zg`.`wgs84_longitude`), 5) AS `lieu_longitude`,
305
		`o`.`geodatum` AS `lieu_geodatum`,
305
		`o`.`geodatum` AS `lieu_geodatum`,
306
		if((`o`.`geodatum` <> ''), 'Coordonnées issues de l''utilisation de Google Map', NULL) AS `lieu_georeference_source`,
306
		if((`o`.`geodatum` <> ''), 'Coordonnées issues de l''utilisation de Google Map', NULL) AS `lieu_georeference_source`,
307
		`o`.`lieudit` AS `lieu_localite`,
307
		`o`.`lieudit` AS `lieu_localite`,
308
		`o`.`prenom_utilisateur` AS `observateur_prenom`,
308
		`o`.`prenom_utilisateur` AS `observateur_prenom`,
309
		`o`.`nom_utilisateur` AS `observateur_nom`,
309
		`o`.`nom_utilisateur` AS `observateur_nom`,
310
		`o`.`courriel_utilisateur` AS `observateur_courriel`,
310
		`o`.`courriel_utilisateur` AS `observateur_courriel`,
311
		concat(`o`.`prenom_utilisateur`,_utf8' ',`o`.`nom_utilisateur`) AS `observateur_nom_complet`,
311
		concat(`o`.`prenom_utilisateur`,_utf8' ',`o`.`nom_utilisateur`) AS `observateur_nom_complet`,
312
		concat_ws(' ',`o`.`prenom_utilisateur`,`o`.`nom_utilisateur`,concat('<',`o`.`courriel_utilisateur`,'>')) AS `observateur_intitule`,
312
		concat_ws(' ',`o`.`prenom_utilisateur`,`o`.`nom_utilisateur`,concat('<',`o`.`courriel_utilisateur`,'>')) AS `observateur_intitule`,
313
		`o`.`commentaire` AS `observation_commentaire`,
313
		`o`.`commentaire` AS `observation_commentaire`,
314
		concat(_utf8'nom_num_nomenclatural=',`o`.`nom_sel_nn`,'; ',
314
		concat(_utf8'nom_num_nomenclatural=',`o`.`nom_sel_nn`,'; ',
315
			'nom_ret=',encodeToDcsv(`o`.`nom_ret`),'; ',
315
			'nom_ret=',encodeToDcsv(`o`.`nom_ret`),'; ',
316
			'nom_num_ret=',`o`.`nom_ret_nn`,'; ',
316
			'nom_num_ret=',`o`.`nom_ret_nn`,'; ',
317
			'nom_num_taxonomique=',`o`.`nt`,'; ',
317
			'nom_num_taxonomique=',`o`.`nt`,'; ',
318
			'nom_referentiel=',encodeToDcsv(`o`.`nom_referentiel`),'; ',
318
			'nom_referentiel=',encodeToDcsv(`o`.`nom_referentiel`),'; ',
319
			'saisie_date_transmission=',`o`.`date_transmission`,'; ',
319
			'saisie_date_transmission=',`o`.`date_transmission`,'; ',
320
			'saisie_date_creation=',`o`.`date_creation`,'; ',
320
			'saisie_date_creation=',`o`.`date_creation`,'; ',
321
			'ordre=',`o`.`ordre`,'; ',
321
			'ordre=',`o`.`ordre`,'; ',
322
			'station=',encodeToDcsv(`o`.`station`),'; ',
322
			'station=',encodeToDcsv(`o`.`station`),'; ',
323
			'milieu=',encodeToDcsv(`o`.`milieu`),'; ',
323
			'milieu=',encodeToDcsv(`o`.`milieu`),'; ',
324
			'mots_cles=',encodeToDcsv(`o`.`mots_cles_texte`),'; ',
324
			'mots_cles=',encodeToDcsv(`o`.`mots_cles_texte`),'; ',
325
			'zg_utm_secteur=',encodeToDcsv(`zg`.`utm_secteur`),'; ',
325
			'zg_utm_secteur=',encodeToDcsv(`zg`.`utm_secteur`),'; ',
326
			'zg_date_modification=',`zg`.`date_modification`) AS `observation_information_complement`,
326
			'zg_date_modification=',`zg`.`date_modification`) AS `observation_information_complement`,
327
		`o`.`date_modification` AS `saisie_date_modification`,
327
		`o`.`date_modification` AS `saisie_date_modification`,
328
		`o`.`date_creation` AS `saisie_date_creation` 
328
		`o`.`date_creation` AS `saisie_date_creation` 
329
	from (`cel_obs` `o` 
329
	from (`cel_obs` `o` 
330
		left join `cel_zones_geo` `zg` on((`o`.`ce_zone_geo` = `zg`.`id_zone_geo`))) 
330
		left join `cel_zones_geo` `zg` on((`o`.`ce_zone_geo` = `zg`.`id_zone_geo`))) 
331
	where `o`.`transmission` = 1 
331
	where `o`.`transmission` = 1 
Line 332... Line 332...
332
		AND (`o`.`mots_cles_texte` NOT LIKE '%sensible%' OR `o`.`mots_cles_texte` IS NULL);
332
		AND (`o`.`mots_cles_texte` NOT LIKE '%sensible%' OR `o`.`mots_cles_texte` IS NULL);
333
 
333
 
334
 
334
 
-
 
335
SET SQL_MODE=@OLD_SQL_MODE;