1 |
//+----------------------------------------------------------------------------------------------------------+
|
1 |
//+----------------------------------------------------------------------------------------------------------+
|
2 |
// Onglets et Portlets
|
2 |
// Onglets et Portlets
|
3 |
/**
|
3 |
/**
|
4 |
* Les variables suivantes ont été ajoutée par php
|
4 |
* Les variables suivantes ont été ajoutée par php
|
5 |
*
|
5 |
*
|
6 |
* var urlTexteBrutSectionWikiTpl : url pour obtenir le texte brut d'une section de wiki
|
6 |
* var urlTexteBrutSectionWikiTpl : url pour obtenir le texte brut d'une section de wiki
|
7 |
* var urlEditionSectionWikiTpl : url pour éditer une section du wiki
|
7 |
* var urlEditionSectionWikiTpl : url pour éditer une section du wiki
|
8 |
* var urlTexteFormateSectionWikiTpl : url pour obtenir le texte formaté en html d'une section de wiki
|
8 |
* var urlTexteFormateSectionWikiTpl : url pour obtenir le texte formaté en html d'une section de wiki
|
9 |
* var pageWikiTaxon : url pour obtenir le texte formaté en html d'une section de wiki
|
9 |
* var pageWikiTaxon : url pour obtenir le texte formaté en html d'une section de wiki
|
10 |
* var urlPopup = url de base pour les popup contenant du code un peu complexe
|
10 |
* var urlPopup = url de base pour les popup contenant du code un peu complexe
|
11 |
*
|
11 |
*
|
12 |
*/
|
12 |
*/
|
13 |
|
13 |
|
14 |
/**
|
14 |
/**
|
15 |
* Variables globales du script
|
15 |
* Variables globales du script
|
16 |
*/
|
16 |
*/
|
17 |
var modules = Array();
|
17 |
var modules = Array();
|
18 |
var REFERENTIEL = "<?php echo Registre::get('parametres.referentiel'); ?>";
|
18 |
var REFERENTIEL = "<?php echo Registre::get('parametres.referentiel'); ?>";
|
19 |
|
19 |
|
20 |
/** Classe Module
|
20 |
/** Classe Module
|
21 |
* Définit un module de type portlet
|
21 |
* Définit un module de type portlet
|
22 |
**/
|
22 |
**/
|
23 |
function Module(id, module, onglet, statique) {
|
23 |
function Module(id, module, onglet, statique) {
|
24 |
|
24 |
|
25 |
// Variables de classe : identifiant, titre, et le HTML du résumé à afficher dans le contenu
|
25 |
// Variables de classe : identifiant, titre, et le HTML du résumé à afficher dans le contenu
|
26 |
this.id = id;
|
26 |
this.id = id;
|
27 |
this.titre;
|
27 |
this.titre;
|
28 |
this.htmlResume;
|
28 |
this.htmlResume;
|
29 |
this.statique = statique;
|
29 |
this.statique = statique;
|
30 |
}
|
30 |
}
|
31 |
|
31 |
|
32 |
function getUrlVars() {
|
32 |
function getUrlVars() {
|
33 |
var vars = [], hash;
|
33 |
var vars = [], hash;
|
34 |
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
34 |
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
35 |
for (var i = 0; i < hashes.length; i++) {
|
35 |
for (var i = 0; i < hashes.length; i++) {
|
36 |
hash = hashes[i].split('=');
|
36 |
hash = hashes[i].split('=');
|
37 |
vars.push(hash[0]);
|
37 |
vars.push(hash[0]);
|
38 |
vars[hash[0]] = hash[1];
|
38 |
vars[hash[0]] = hash[1];
|
39 |
}
|
39 |
}
|
40 |
return vars;
|
40 |
return vars;
|
41 |
}
|
41 |
}
|
42 |
|
42 |
|
43 |
|
43 |
|
44 |
// remplace des liens directs vers les onglets par des liens permettant de ne charger
|
44 |
// remplace des liens directs vers les onglets par des liens permettant de ne charger
|
45 |
// que le contenu de l'onglet (pour le plugin tab)
|
45 |
// que le contenu de l'onglet (pour le plugin tab)
|
46 |
function remplacerUrlsOnglets() {
|
46 |
function remplacerUrlsOnglets() {
|
47 |
$(".lien-onglet").each(function() {
|
47 |
$(".lien-onglet").each(function() {
|
48 |
var urlOnglet = $(this).attr('href');
|
48 |
var urlOnglet = $(this).attr('href');
|
49 |
var urlVars = urlOnglet.slice(urlOnglet.indexOf('?') + 1);
|
49 |
var urlVars = urlOnglet.slice(urlOnglet.indexOf('?') + 1);
|
50 |
urlBase = base_url_application_onglets+"?"+urlVars;
|
50 |
urlBase = base_url_application_onglets+"?"+urlVars;
|
51 |
urlOnglet = urlBase.replace('action=fiche','action=onglet');
|
51 |
urlOnglet = urlBase.replace('action=fiche','action=onglet');
|
52 |
$(this).attr('href', urlOnglet);
|
52 |
$(this).attr('href', urlOnglet);
|
53 |
});
|
53 |
});
|
54 |
}
|
54 |
}
|
55 |
|
55 |
|
56 |
|
56 |
|
57 |
|
57 |
|
58 |
//+----------------------------------------------------------------------------------------------------------+
|
58 |
//+----------------------------------------------------------------------------------------------------------+
|
59 |
// Wikini Flora
|
59 |
// Wikini Flora
|
60 |
var htmlWikiOriginal = '';
|
60 |
var htmlWikiOriginal = '';
|
61 |
var objetContenuWiki = null;
|
61 |
var objetContenuWiki = null;
|
62 |
|
62 |
|
63 |
function getTemplateFormulaireEditionWiki(page, section, texte) {
|
63 |
function getTemplateFormulaireEditionWiki(page, section, texte) {
|
64 |
var urlWebServiceWiki = getUrlEditionPourPageEtSection(page, section);
|
64 |
var urlWebServiceWiki = getUrlEditionPourPageEtSection(page, section);
|
65 |
var formulaire =
|
65 |
var formulaire =
|
66 |
'<form method="post" id="formulaire_edition_wiki" name="formulaire_edition_wiki" action="'+urlWebServiceWiki+'">'+
|
66 |
'<form method="post" id="formulaire_edition_wiki" name="formulaire_edition_wiki" action="'+urlWebServiceWiki+'">'+
|
67 |
'<div>'+
|
67 |
'<div>'+
|
68 |
'<textarea id="pageContenu" name="pageContenu" class="champ_edition_wiki">'+texte+'</textarea>'+
|
68 |
'<textarea id="pageContenu" name="pageContenu" class="champ_edition_wiki">'+texte+'</textarea>'+
|
69 |
'</div>'+
|
69 |
'</div>'+
|
70 |
'<input type="hidden" name="pageSectionTitre" id="pageSectionTitre" value="'+section+'" />'+
|
70 |
'<input type="hidden" name="pageSectionTitre" id="pageSectionTitre" value="'+section+'" />'+
|
71 |
'<input type="submit" text="sauver" />'+
|
71 |
'<input type="submit" text="sauver" />'+
|
72 |
'<input class="bouton_annuler_edition" type="button" value="annuler" />';
|
72 |
'<input class="bouton_annuler_edition" type="button" value="annuler" />';
|
73 |
'</form>';
|
73 |
'</form>';
|
74 |
return formulaire;
|
74 |
return formulaire;
|
75 |
}
|
75 |
}
|
76 |
|
76 |
|
77 |
function getSection() {
|
77 |
function getSection() {
|
78 |
return objetContenuWiki.attr("title");
|
78 |
return objetContenuWiki.attr("title");
|
79 |
}
|
79 |
}
|
80 |
|
80 |
|
81 |
function getPageWikiTaxon() {
|
81 |
function getPageWikiTaxon() {
|
82 |
return pageWikiTaxon;
|
82 |
return pageWikiTaxon;
|
83 |
}
|
83 |
}
|
84 |
|
84 |
|
85 |
function getUrlEditionPourPageEtSection(page, section) {
|
85 |
function getUrlEditionPourPageEtSection(page, section) {
|
86 |
var url = urlEditionSectionWikiTpl.replace('{pageTag}', page).replace('{sectionTitre}', section);
|
86 |
var url = urlEditionSectionWikiTpl.replace('{pageTag}', page).replace('{sectionTitre}', section);
|
87 |
return url;
|
87 |
return url;
|
88 |
}
|
88 |
}
|
89 |
|
89 |
|
90 |
function getUrlTextePourPageSectionBrute(page, section) {
|
90 |
function getUrlTextePourPageSectionBrute(page, section) {
|
91 |
return urlTexteBrutSectionWikiTpl.replace('{pageTag}', page).replace('{sectionTitre}', section);
|
91 |
return urlTexteBrutSectionWikiTpl.replace('{pageTag}', page).replace('{sectionTitre}', section);
|
92 |
}
|
92 |
}
|
93 |
|
93 |
|
94 |
function getUrlTextePourPageSectionFormatee(page, section) {
|
94 |
function getUrlTextePourPageSectionFormatee(page, section) {
|
95 |
return urlTexteFormateSectionWikiTpl.replace('{pageTag}', page).replace('{sectionTitre}', section);
|
95 |
return urlTexteFormateSectionWikiTpl.replace('{pageTag}', page).replace('{sectionTitre}', section);
|
96 |
}
|
96 |
}
|
97 |
|
97 |
|
98 |
function remplacerContenuWikiParFormulaireEdition(objet_contenu) {
|
98 |
function remplacerContenuWikiParFormulaireEdition(objet_contenu) {
|
99 |
objetContenuWiki = objet_contenu;
|
99 |
objetContenuWiki = objet_contenu;
|
100 |
var adresse = getUrlEditionPourPageEtSection(getPageWikiTaxon(), getSection());
|
100 |
var adresse = getUrlEditionPourPageEtSection(getPageWikiTaxon(), getSection());
|
101 |
htmlWikiOriginal = objet_contenu.html();
|
101 |
htmlWikiOriginal = objet_contenu.html();
|
102 |
$.getJSON(adresse, function(data) {
|
102 |
$.getJSON(adresse, function(data) {
|
103 |
$(objetContenuWiki).removeClass('editable_sur_clic').html(getTemplateFormulaireEditionWiki(getPageWikiTaxon(), getSection(), data.texte));
|
103 |
$(objetContenuWiki).removeClass('editable_sur_clic').html(getTemplateFormulaireEditionWiki(getPageWikiTaxon(), getSection(), data.texte));
|
104 |
});
|
104 |
});
|
105 |
}
|
105 |
}
|
106 |
|
106 |
|
107 |
function gererEvenementsWiki() {
|
107 |
function gererEvenementsWiki() {
|
108 |
//TODO: ajout automatique d'un lien ouvrant une page d'aide (un popup) au formatage des pages wikini
|
108 |
//TODO: ajout automatique d'un lien ouvrant une page d'aide (un popup) au formatage des pages wikini
|
109 |
$('.editable_sur_clic').on('dblclick',function(event) {
|
109 |
$('.editable_sur_clic').on('dblclick',function(event) {
|
110 |
remplacerContenuWikiParFormulaireEdition($(this));
|
110 |
remplacerContenuWikiParFormulaireEdition($(this));
|
111 |
});
|
111 |
});
|
112 |
|
112 |
|
113 |
$('#formulaire_edition_wiki').on('submit',function(event) {
|
113 |
$('#formulaire_edition_wiki').on('submit',function(event) {
|
114 |
event.preventDefault();
|
114 |
event.preventDefault();
|
115 |
var valeurs = $(this).serialize();
|
115 |
var valeurs = $(this).serialize();
|
116 |
$.post($(this).attr('action'), valeurs, function(data) {
|
116 |
$.post($(this).attr('action'), valeurs, function(data) {
|
117 |
var adresse = getUrlTextePourPageSectionFormatee(getPageWikiTaxon(), getSection());
|
117 |
var adresse = getUrlTextePourPageSectionFormatee(getPageWikiTaxon(), getSection());
|
118 |
$.getJSON(adresse, function(data) {
|
118 |
$.getJSON(adresse, function(data) {
|
119 |
$(objetContenuWiki).addClass('editable_sur_clic').html(data.texte);
|
119 |
$(objetContenuWiki).addClass('editable_sur_clic').html(data.texte);
|
120 |
});
|
120 |
});
|
121 |
});
|
121 |
});
|
122 |
});
|
122 |
});
|
123 |
|
123 |
|
124 |
$('.bouton_annuler_edition').on('click', function(event) {
|
124 |
$('.bouton_annuler_edition').on('click', function(event) {
|
125 |
event.preventDefault();
|
125 |
event.preventDefault();
|
126 |
$(objetContenuWiki).addClass('editable_sur_clic').html(htmlWikiOriginal);
|
126 |
$(objetContenuWiki).addClass('editable_sur_clic').html(htmlWikiOriginal);
|
127 |
});
|
127 |
});
|
128 |
|
128 |
|
129 |
rendreLienAffichableDansNouvelleFenetre('.contenu_editable');
|
129 |
rendreLienAffichableDansNouvelleFenetre('.contenu_editable');
|
130 |
}
|
130 |
}
|
131 |
|
131 |
|
132 |
//+----------------------------------------------------------------------------------------------------------+
|
132 |
//+----------------------------------------------------------------------------------------------------------+
|
133 |
//Affichage dans une nouvelle fenetre
|
133 |
//Affichage dans une nouvelle fenetre
|
134 |
function rendreLienAffichableDansNouvelleFenetre(selecteur) {
|
134 |
function rendreLienAffichableDansNouvelleFenetre(selecteur) {
|
135 |
$(selecteur).find('a').on('click', function(event) {
|
135 |
$(selecteur).find('a').on('click', function(event) {
|
136 |
window.open($(this).attr('href'));
|
136 |
window.open($(this).attr('href'));
|
137 |
event.preventDefault();
|
137 |
event.preventDefault();
|
138 |
return false;
|
138 |
return false;
|
139 |
});
|
139 |
});
|
140 |
}
|
140 |
}
|
141 |
|
141 |
|
142 |
//+----------------------------------------------------------------------------------------------------------+
|
142 |
//+----------------------------------------------------------------------------------------------------------+
|
143 |
// Plier / déplier
|
143 |
// Plier / déplier
|
144 |
function plierTout() {
|
144 |
function plierTout() {
|
145 |
$('.nom').children('.imagetteMoins').removeClass('imagetteMoins').addClass('imagettePlus');
|
145 |
$('.nom').children('.imagetteMoins').removeClass('imagetteMoins').addClass('imagettePlus');
|
146 |
$('.plus').css('display', 'none');
|
146 |
$('.plus').css('display', 'none');
|
147 |
}
|
147 |
}
|
148 |
|
148 |
|
149 |
function deplierTout() {
|
149 |
function deplierTout() {
|
150 |
$('.nom').children('.imagettePlus').removeClass('imagettePlus').addClass('imagetteMoins');
|
150 |
$('.nom').children('.imagettePlus').removeClass('imagettePlus').addClass('imagetteMoins');
|
151 |
$('.plus').css('display', 'inline');
|
151 |
$('.plus').css('display', 'inline');
|
152 |
}
|
152 |
}
|
153 |
|
153 |
|
154 |
function gestionBiblio(parent) {
|
154 |
function gestionBiblio(parent) {
|
155 |
$('.nom').each(function () {
|
155 |
$('.nom').each(function () {
|
156 |
if ($(this).children('.plus').length == 0) {
|
156 |
if ($(this).children('.plus').length == 0) {
|
157 |
html = $(this).html();
|
157 |
html = $(this).html();
|
158 |
|
158 |
|
159 |
// La partie biblio commence au premier crochet ouvrant
|
159 |
// La partie biblio commence au premier crochet ouvrant
|
160 |
// ou bien au span de la biblio à exclure
|
160 |
// ou bien au span de la biblio à exclure
|
161 |
posCrochetGauche = html.indexOf('[');
|
161 |
posCrochetGauche = html.indexOf('[');
|
162 |
posbiblioAExclure = html.indexOf('<span class="bib_excl">');
|
162 |
posbiblioAExclure = html.indexOf('<span class="bib_excl">');
|
163 |
|
163 |
|
164 |
if(posCrochetGauche < 0 || (posbiblioAExclure > 0 && posbiblioAExclure < posCrochetGauche)) {
|
164 |
if(posCrochetGauche < 0 || (posbiblioAExclure > 0 && posbiblioAExclure < posCrochetGauche)) {
|
165 |
posCrochetGauche = posbiblioAExclure;
|
165 |
posCrochetGauche = posbiblioAExclure;
|
166 |
}
|
166 |
}
|
167 |
|
167 |
|
168 |
// console.log(posCrochetGauche+" "+posbiblioAExclure);
|
168 |
// console.log(posCrochetGauche+" "+posbiblioAExclure);
|
169 |
|
169 |
|
170 |
|
170 |
|
171 |
if (posCrochetGauche > 0) {
|
171 |
if (posCrochetGauche > 0) {
|
172 |
nom = html.substr(0, posCrochetGauche);
|
172 |
nom = html.substr(0, posCrochetGauche);
|
173 |
biblio = html.substr(posCrochetGauche, html.length);
|
173 |
biblio = html.substr(posCrochetGauche, html.length);
|
174 |
$(this).html(nom);
|
174 |
$(this).html(nom);
|
175 |
|
175 |
|
176 |
imagettePlus = document.createElement('div');
|
176 |
imagettePlus = document.createElement('div');
|
177 |
$(imagettePlus).addClass('imagettePlus');
|
177 |
$(imagettePlus).addClass('imagettePlus');
|
178 |
$(this).prepend($(imagettePlus));
|
178 |
$(this).prepend($(imagettePlus));
|
179 |
|
179 |
|
180 |
plus = document.createElement('span');
|
180 |
plus = document.createElement('span');
|
181 |
$(plus).addClass('plus');
|
181 |
$(plus).addClass('plus');
|
182 |
$(plus).html(biblio);
|
182 |
$(plus).html(biblio);
|
183 |
$(plus).hide();
|
183 |
$(plus).hide();
|
184 |
|
184 |
|
185 |
$(this).click(function(e) {
|
185 |
$(this).click(function(e) {
|
186 |
// test pour ne réagir que sur le clic sur le + ou -
|
186 |
// test pour ne réagir que sur le clic sur le + ou -
|
187 |
// TODO: fusionner ce bout de code en doublon avec synthese.js
|
187 |
// TODO: fusionner ce bout de code en doublon avec synthese.js
|
188 |
if($(e.target).hasClass("imagettePlus") || $(e.target).hasClass("imagetteMoins")) {
|
188 |
if($(e.target).hasClass("imagettePlus") || $(e.target).hasClass("imagetteMoins")) {
|
189 |
if (!$(this).children('.plus').is(':visible')) {
|
189 |
if (!$(this).children('.plus').is(':visible')) {
|
190 |
$(this).children('.imagettePlus').removeClass('imagettePlus').addClass('imagetteMoins');
|
190 |
$(this).children('.imagettePlus').removeClass('imagettePlus').addClass('imagetteMoins');
|
191 |
$(this).children('.plus').css('display', 'inline');
|
191 |
$(this).children('.plus').css('display', 'inline');
|
192 |
} else {
|
192 |
} else {
|
193 |
$(this).children('.imagetteMoins').removeClass('imagetteMoins').addClass('imagettePlus');
|
193 |
$(this).children('.imagetteMoins').removeClass('imagetteMoins').addClass('imagettePlus');
|
194 |
$(this).children('.plus').css('display', 'none');
|
194 |
$(this).children('.plus').css('display', 'none');
|
195 |
}
|
195 |
}
|
196 |
}
|
196 |
}
|
197 |
|
197 |
|
198 |
});
|
198 |
});
|
199 |
|
199 |
|
200 |
$(this).append($(plus));
|
200 |
$(this).append($(plus));
|
201 |
|
201 |
|
202 |
}
|
202 |
}
|
203 |
}
|
203 |
}
|
204 |
});
|
204 |
});
|
205 |
}
|
205 |
}
|
206 |
|
206 |
|
207 |
function gererEvenementsPliage() {
|
207 |
function gererEvenementsPliage() {
|
208 |
$('.lien_tout_deplier').on('click', function() {
|
208 |
$('.lien_tout_deplier').on('click', function() {
|
209 |
deplierTout();
|
209 |
deplierTout();
|
210 |
});
|
210 |
});
|
211 |
$('.lien_tout_plier').on('click', function() {
|
211 |
$('.lien_tout_plier').on('click', function() {
|
212 |
plierTout();
|
212 |
plierTout();
|
213 |
});
|
213 |
});
|
214 |
gestionBiblio(document);
|
214 |
gestionBiblio(document);
|
215 |
}
|
215 |
}
|
216 |
|
216 |
|
217 |
//+----------------------------------------------------------------------------------------------------------+
|
217 |
//+----------------------------------------------------------------------------------------------------------+
|
218 |
//Pop Up images
|
218 |
//Pop Up images
|
219 |
function ouvrirPopUpImg(event) {
|
219 |
function ouvrirPopUpImg(event) {
|
220 |
event.preventDefault();
|
220 |
event.preventDefault();
|
221 |
window.open($(this).attr('href'),"Photo_"+$(this).children("img").attr("data-num-image"),
|
221 |
window.open($(this).attr('href'),"Photo_"+$(this).children("img").attr("data-num-image"),
|
222 |
'"'+'height='+event.data.h+',width='+event.data.w+',top='+event.data.t+',left='+event.data.l
|
222 |
'"'+'height='+event.data.h+',width='+event.data.w+',top='+event.data.t+',left='+event.data.l
|
223 |
+',toolbar='+event.data.toolbar+',menubar='+event.data.menubar +',location='
|
223 |
+',toolbar='+event.data.toolbar+',menubar='+event.data.menubar +',location='
|
224 |
+event.data.location+',resizable='+event.data.resizable+',scrollbars='+event.data.scrollbars
|
224 |
+event.data.location+',resizable='+event.data.resizable+',scrollbars='+event.data.scrollbars
|
225 |
+',status='+event.data.status+'"');
|
225 |
+',status='+event.data.status+'"');
|
226 |
}
|
226 |
}
|
227 |
|
227 |
|
228 |
//+----------------------------------------------------------------------------------------------------------+
|
228 |
//+----------------------------------------------------------------------------------------------------------+
|
229 |
// Message de chargement pour les graphique écologie
|
229 |
// Message de chargement pour les graphique écologie
|
230 |
function gererChargementGraphiqueEcologie() {
|
230 |
function gererChargementGraphiqueEcologie() {
|
231 |
$('.ecologie_svg').addClass('chargement');
|
231 |
$('.ecologie_svg').addClass('chargement');
|
232 |
}
|
232 |
}
|
233 |
|
233 |
|
234 |
function gererAffichageLegendeEcologie() {
|
234 |
function gererAffichageLegendeEcologie() {
|
235 |
$('.voir').on('click', function() {
|
235 |
$('.voir').on('click', function() {
|
236 |
$(this).siblings('.legende_graphique').show();
|
236 |
$(this).siblings('.legende_graphique').show();
|
237 |
$(this).siblings('.cacher').show();
|
237 |
$(this).siblings('.cacher').show();
|
238 |
$(this).hide();
|
238 |
$(this).hide();
|
239 |
});
|
239 |
});
|
240 |
|
240 |
|
241 |
$('.cacher').on('click', function() {
|
241 |
$('.cacher').on('click', function() {
|
242 |
$(this).siblings('.legende_graphique').hide();
|
242 |
$(this).siblings('.legende_graphique').hide();
|
243 |
$(this).siblings('.voir').show();
|
243 |
$(this).siblings('.voir').show();
|
244 |
$(this).hide();
|
244 |
$(this).hide();
|
245 |
});
|
245 |
});
|
246 |
}
|
246 |
}
|
247 |
|
247 |
|
248 |
|
248 |
|
249 |
//+----------------------------------------------------------------------------------------------------------+
|
249 |
//+----------------------------------------------------------------------------------------------------------+
|
250 |
// Initialisation
|
250 |
// Initialisation
|
251 |
var fancyboxinitialise = false;
|
251 |
var fancyboxinitialise = false;
|
252 |
var param_popup_Coste = {h: 650, w: 550, t: 100, l: 100,
|
252 |
var param_popup_Coste = {h: 650, w: 550, t: 100, l: 100,
|
253 |
toolbar: 'no', menubar: 'no', location: 'no', resizable: 'yes', scrollbars: 'yes', status: 'no'};
|
253 |
toolbar: 'no', menubar: 'no', location: 'no', resizable: 'yes', scrollbars: 'yes', status: 'no'};
|
254 |
|
254 |
|
255 |
var param_popup_Cel = {h: 750, w: 630, t: 100, l: 100,
|
255 |
var param_popup_Cel = {h: 750, w: 630, t: 100, l: 100,
|
256 |
toolbar: 'no', menubar: 'no', location: 'no', resizable: 'yes', scrollbars: 'yes', status: 'no'};
|
256 |
toolbar: 'no', menubar: 'no', location: 'no', resizable: 'yes', scrollbars: 'yes', status: 'no'};
|
257 |
|
257 |
|
258 |
//Initialisation (uniquement sur la présence de la div bloc-fiche, qui contient la fiche eflore)
|
258 |
//Initialisation (uniquement sur la présence de la div bloc-fiche, qui contient la fiche eflore)
|
259 |
$(document).one('ficheSyntheseChargee', function() {
|
259 |
$(document).one('ficheSyntheseChargee', function() {
|
260 |
$('.lien_popup').on('click',function(event) {
|
260 |
$('.lien_popup').on('click',function(event) {
|
261 |
event.preventDefault();
|
261 |
event.preventDefault();
|
262 |
$.fancybox(this,{
|
262 |
$.fancybox(this,{
|
263 |
autoDimensions:false,
|
263 |
autoDimensions:false,
|
264 |
width:580
|
264 |
width:580
|
265 |
});
|
265 |
});
|
266 |
});
|
266 |
});
|
267 |
|
267 |
|
268 |
$('.lien_popup.lien_metadonnees').on('click',function(event) {
|
268 |
$('.lien_popup.lien_metadonnees').on('click',function(event) {
|
269 |
event.preventDefault();
|
269 |
event.preventDefault();
|
270 |
$.fancybox(this,{
|
270 |
$.fancybox(this,{
|
271 |
autoDimensions:true
|
271 |
autoDimensions:true
|
272 |
});
|
272 |
});
|
273 |
});
|
273 |
});
|
274 |
|
274 |
|
275 |
$('.lien-image-cel').on('click', param_popup_Cel , ouvrirPopUpImg);
|
275 |
$('.lien-image-cel').on('click', param_popup_Cel , ouvrirPopUpImg);
|
276 |
$('.lien-image-coste').on('click', param_popup_Coste , ouvrirPopUpImg);
|
276 |
$('.lien-image-coste').on('click', param_popup_Coste , ouvrirPopUpImg);
|
277 |
|
277 |
|
278 |
gererEvenementsWiki();
|
278 |
gererEvenementsWiki();
|
279 |
gererEvenementsPliage();
|
279 |
gererEvenementsPliage();
|
280 |
|
280 |
|
281 |
$('a.lien_retour_synthese').click(function(event) {
|
281 |
$('a.lien_retour_synthese').click(function(event) {
|
282 |
$('#onglet_synthese a').click();
|
282 |
$('#onglet_synthese a').click();
|
283 |
event.preventDefault();
|
283 |
event.preventDefault();
|
284 |
});
|
284 |
});
|
285 |
|
285 |
|
286 |
if($("#bloc-fiche").length > 0) {
|
286 |
if($("#bloc-fiche").length > 0) {
|
287 |
// initialisation de l'url avec l'onglet par défaut ou bien
|
287 |
// initialisation de l'url avec l'onglet par défaut ou bien
|
288 |
// celui qui a été explicitement demandé
|
288 |
// celui qui a été explicitement demandé
|
289 |
mettreAJourUrl(permalienNumNom+"-"+onglet, onglet);
|
289 |
mettreAJourUrl(permalienNumNom+"-"+onglet, onglet);
|
290 |
}
|
290 |
}
|
291 |
gererInteractionsPermaliens();
|
291 |
gererInteractionsPermaliens();
|
292 |
});
|
292 |
});
|
293 |
|
293 |
|
294 |
function ajouterEvenement(elementHtml, nomEvenement, functionCallBack) {
|
294 |
function ajouterEvenement(elementHtml, nomEvenement, functionCallBack) {
|
295 |
if(!!elementHtml && elementHtml != null) {
|
295 |
if(!!elementHtml && elementHtml != null) {
|
296 |
if(elementHtml.attachEvent) {// Internet Explorer
|
296 |
if(elementHtml.attachEvent) {// Internet Explorer
|
297 |
elementHtml.attachEvent("on" + nomEvenement, function() {functionCallBack.call(elementHtml);});
|
297 |
elementHtml.attachEvent("on" + nomEvenement, function() {functionCallBack.call(elementHtml);});
|
298 |
} else if(elementHtml.addEventListener) { // Firefox & autres
|
298 |
} else if(elementHtml.addEventListener) { // Firefox & autres
|
299 |
elementHtml.addEventListener(nomEvenement, functionCallBack, false);
|
299 |
elementHtml.addEventListener(nomEvenement, functionCallBack, false);
|
300 |
}
|
300 |
}
|
301 |
}
|
301 |
}
|
302 |
}
|
302 |
}
|
303 |
|
303 |
|
304 |
$(document).one('ongletRepartitionCharge', function() {
|
304 |
$(document).one('ongletRepartitionCharge', function() {
|
305 |
var contRepObs = $(".conteneur_repartition_observations");
|
305 |
var contRepObs = $(".conteneur_repartition_observations");
|
306 |
contRepObs.addClass("chargement_repartition");
|
306 |
contRepObs.addClass("chargement_repartition");
|
307 |
// utilisation d'une fonction native car jQuery refuse d'ajouter un évènement load
|
307 |
// utilisation d'une fonction native car jQuery refuse d'ajouter un évènement load
|
308 |
// sur autre chose qu'une image
|
308 |
// sur autre chose qu'une image
|
309 |
$('#repartition_observations').ready(function() {
|
309 |
$('#repartition_observations').ready(function() {
|
310 |
ajouterEvenement(document.getElementById("repartition_observations"), "load", function() {
|
310 |
ajouterEvenement(document.getElementById("repartition_observations"), "load", function() {
|
311 |
contRepObs.removeClass("chargement_repartition");
|
311 |
contRepObs.removeClass("chargement_repartition");
|
312 |
});
|
312 |
});
|
313 |
});
|
313 |
});
|
314 |
// lien "recalculer la carte de moissonnage"
|
314 |
// lien "recalculer la carte de moissonnage"
|
315 |
$('#lien_recalculer_carte').click(function() {
|
315 |
$('#lien_recalculer_carte').click(function() {
|
316 |
var carteMoissonnageSvg = $('#repartition_observations'); // c'est plutôt "moissonnage" que "répartition" => squelette pourave power
|
316 |
var carteMoissonnageSvg = $('#repartition_observations'); // c'est plutôt "moissonnage" que "répartition" => squelette pourave power
|
317 |
var urlCarte = carteMoissonnageSvg.attr("data");
|
317 |
var urlCarte = carteMoissonnageSvg.attr("data");
|
318 |
urlCarte += '&recalculer=1';
|
318 |
urlCarte += '&recalculer=1';
|
319 |
contRepObs.addClass("chargement_repartition");
|
319 |
contRepObs.addClass("chargement_repartition");
|
320 |
carteMoissonnageSvg.attr("data", urlCarte);ajouterEvenement(document.getElementById("repartition_observations"), "load", function() {
|
320 |
carteMoissonnageSvg.attr("data", urlCarte);ajouterEvenement(document.getElementById("repartition_observations"), "load", function() {
|
321 |
contRepObs.removeClass("chargement_repartition");
|
321 |
contRepObs.removeClass("chargement_repartition");
|
322 |
});
|
322 |
});
|
323 |
return false;
|
323 |
return false;
|
324 |
});
|
324 |
});
|
325 |
});
|
325 |
});
|
326 |
|
326 |
|
327 |
|
327 |
|
328 |
// À la fin du chargement de l'onglet Illustrations
|
328 |
// À la fin du chargement de l'onglet Illustrations
|
329 |
$(document).one('ongletIllustrationsCharge', function() {
|
329 |
$(document).one('ongletIllustrationsCharge', function() {
|
330 |
$('a.lien-images-organes.fourni').on('click', afficherOngletOrgane);
|
330 |
$('a.lien-images-organes.fourni').on('click', afficherOngletOrgane);
|
331 |
$('a.lien-grande-image-organe').on('click', afficherGrandeImageOrgane);
|
331 |
$('a.lien-grande-image-organe').on('click', afficherGrandeImageOrgane);
|
332 |
// pour que la galerie soit ouverte par défaut sur le premier organe non vide
|
332 |
// pour que la galerie soit ouverte par défaut sur le premier organe non vide
|
333 |
var premier = $('a.lien-images-organes.fourni').first().data('tag');
|
333 |
var premier = $('a.lien-images-organes.fourni').first().data('tag');
|
334 |
afficherOngletOrgane(null, premier);
|
334 |
afficherOngletOrgane(null, premier);
|
335 |
|
335 |
|
336 |
$('a.lien_telechargement_image').on('click',function(e) {
|
336 |
$('a.lien_telechargement_image').on('click',function(e) {
|
337 |
if($(e.target).data('oneclicked')!='yes')
|
337 |
if($(e.target).data('oneclicked')!='yes')
|
338 |
{
|
338 |
{
|
339 |
$(e.target).data('oneclicked','yes');
|
339 |
$(e.target).data('oneclicked','yes');
|
340 |
$(this).fancybox({
|
340 |
$(this).fancybox({
|
341 |
"type" : "iframe",
|
341 |
"type" : "iframe",
|
342 |
"autoDimensions" : false,
|
342 |
"autoDimensions" : false,
|
343 |
"width" : 800,
|
343 |
"width" : 800,
|
344 |
"height" : 405,
|
344 |
"height" : 405,
|
345 |
"titleShow" : false
|
345 |
"titleShow" : false
|
346 |
}).click();
|
346 |
}).click();
|
347 |
}
|
347 |
}
|
348 |
|
348 |
|
349 |
e.preventDefault();
|
349 |
e.preventDefault();
|
350 |
return false;
|
350 |
return false;
|
351 |
});
|
351 |
});
|
352 |
});
|
352 |
});
|
353 |
|
353 |
|
354 |
// Affiche les n images ayant le plus de votes, pour l'organe $tag
|
354 |
// Affiche les n images ayant le plus de votes, pour l'organe $tag
|
355 |
function afficherOngletOrgane(e, tag) {
|
355 |
function afficherOngletOrgane(e, tag) {
|
356 |
var onglets = $('div.onglet-organe'),
|
356 |
var onglets = $('div.onglet-organe'),
|
357 |
contenu = $('#galerie-organes-contenu'),
|
357 |
contenu = $('#galerie-organes-contenu'),
|
358 |
organeOnglet;
|
358 |
organeOnglet;
|
359 |
|
359 |
|
360 |
if (tag === undefined) {
|
360 |
if (tag === undefined) {
|
361 |
tag = $(this).data('tag')
|
361 |
tag = $(this).data('tag')
|
362 |
}
|
362 |
}
|
363 |
if ($(this).parent().hasClass('active')) { // replier
|
363 |
if ($(this).parent().hasClass('active')) { // replier
|
364 |
$(this).parent().removeClass('active')
|
364 |
$(this).parent().removeClass('active')
|
365 |
contenu.hide();
|
365 |
contenu.hide();
|
366 |
return false;
|
366 |
return false;
|
367 |
}
|
367 |
}
|
368 |
|
368 |
|
369 |
onglets.each(function() {
|
369 |
onglets.each(function() {
|
370 |
organeOnglet = $(this).data('tag');
|
370 |
organeOnglet = $(this).data('tag');
|
371 |
var li = $('a.lien-images-organes[data-tag="' + organeOnglet + '"]').parent();
|
371 |
var li = $('a.lien-images-organes[data-tag="' + organeOnglet + '"]').parent();
|
372 |
if (organeOnglet == tag) {
|
372 |
if (organeOnglet == tag) {
|
373 |
$(this).show();
|
373 |
$(this).show();
|
374 |
li.addClass('active');
|
374 |
li.addClass('active');
|
375 |
} else {
|
375 |
} else {
|
376 |
$(this).hide();
|
376 |
$(this).hide();
|
377 |
li.removeClass('active');
|
377 |
li.removeClass('active');
|
378 |
}
|
378 |
}
|
379 |
});
|
379 |
});
|
380 |
|
380 |
|
381 |
contenu.show();
|
381 |
contenu.show();
|
382 |
|
382 |
|
383 |
var premierLienGrandeImage = $('div.onglet-organe:visible').find('a.lien-grande-image-organe').first(),
|
383 |
var premierLienGrandeImage = $('div.onglet-organe:visible').find('a.lien-grande-image-organe').first(),
|
384 |
grandeImage = $('#grande-image-organe').find('img');
|
384 |
grandeImage = $('#grande-image-organe').find('img');
|
385 |
premierLienGrandeImage.trigger('click');
|
385 |
premierLienGrandeImage.trigger('click');
|
386 |
grandeImage.show('fast');
|
386 |
grandeImage.show('fast');
|
387 |
|
387 |
|
388 |
return false;
|
388 |
return false;
|
389 |
}
|
389 |
}
|
390 |
|
390 |
|
391 |
// Affiche en grand sous les miniatures l'image d'organe sur laquelle on a cliqué
|
391 |
// Affiche en grand sous les miniatures l'image d'organe sur laquelle on a cliqué
|
392 |
function afficherGrandeImageOrgane() {
|
392 |
function afficherGrandeImageOrgane() {
|
393 |
if ($(this).data('id-image') === "") {
|
393 |
if ($(this).data('id-image') === "") {
|
394 |
return false;
|
394 |
return false;
|
395 |
}
|
395 |
}
|
396 |
var grandeImage = $('#grande-image-organe').find('img'),
|
396 |
var grandeImage = $('#grande-image-organe').find('img'),
|
397 |
source = $(this).find('img').attr('src');
|
397 |
source = $(this).find('img').attr('src');
|
398 |
source = obtenirUrlMoyenFormatIdImage($(this).data('id-image'));
|
398 |
source = obtenirUrlMoyenFormatIdImage($(this).data('id-image'));
|
399 |
// chargement image et lien popup
|
399 |
// chargement image et lien popup
|
400 |
grandeImage.attr('src', source);
|
400 |
grandeImage.attr('src', source);
|
401 |
// important pour Pinterest et cie.
|
401 |
// important pour Pinterest et cie.
|
402 |
grandeImage.attr('alt', $(this).data('auteur') + ' - ' + $(this).data('titre'));
|
402 |
grandeImage.attr('alt', $(this).data('auteur') + ' - ' + $(this).data('titre'));
|
403 |
grandeImage.parent().attr('href',obtenirUrlGrandFormatIdImage($(this).data('id-image')));
|
403 |
grandeImage.parent().attr('href',obtenirUrlGrandFormatIdImage($(this).data('id-image')));
|
404 |
// métadonnées
|
404 |
// métadonnées
|
405 |
var metadonnees = ['id-image', 'titre', 'description', 'localisation', 'auteur'],
|
405 |
var metadonnees = ['id-image', 'titre', 'description', 'localisation', 'auteur'],
|
406 |
clef;
|
406 |
clef;
|
407 |
for (var i = 0; i < metadonnees.length; i++) {
|
407 |
for (var i = 0; i < metadonnees.length; i++) {
|
408 |
clef = metadonnees[i];
|
408 |
clef = metadonnees[i];
|
409 |
var contenu = $(this).data(clef);
|
409 |
var contenu = $(this).data(clef);
|
410 |
if(clef == 'id-image') {
|
410 |
if(clef == 'id-image') {
|
411 |
contenu +=
|
411 |
contenu +=
|
412 |
' <a title="T\xE9l\xE9charger cette image" class="lien_telechargement_image" href="'+urlBaseWidget+'telechargement?id_image='+$(this).data(clef)+'">'+
|
412 |
' <a title="T\xE9l\xE9charger cette image" class="lien_telechargement_image" href="'+urlBaseWidget+'telechargement?id_image='+$(this).data(clef)+'">'+
|
413 |
'<img class="icone_action_ill" src="'+urlCssImages+'sauver.png" />'+
|
413 |
'<img class="icone_action_ill" src="'+urlCssImages+'sauver.png" />'+
|
414 |
'</a> '+
|
414 |
'</a> '+
|
415 |
'<a title="Voir plus d\'informations sur cette image (s\'ouvre dans un popup)" class="lien-image-cel" href="'+urlPopup+'?module=popup-illustrations&action=fiche&referentiel=bdtfx&id=' + $(this).data('id-image')+'">'+
|
415 |
'<a title="Voir plus d\'informations sur cette image (s\'ouvre dans un popup)" class="lien-image-cel" href="'+urlPopup+'?module=popup-illustrations&action=fiche&referentiel=bdtfx&id=' + $(this).data('id-image')+'">'+
|
416 |
'<img class="icone_action_ill" src="'+urlCssImages+'infos_image.png" />'+
|
416 |
'<img class="icone_action_ill" src="'+urlCssImages+'infos_image.png" />'+
|
417 |
'</a>'+
|
417 |
'</a>'+
|
418 |
'<a style="float:right" title="Signaler une mauvaise identification ou en proposer une autre via l\'outil identiplante" class="signaler-mauvaise-identification" href="' + $(this).data('url-mauvaise-ident') + '" target="_blank">' +
|
418 |
'<a style="float:right" title="Signaler une mauvaise identification ou en proposer une autre via l\'outil identiplante" class="signaler-mauvaise-identification" href="' + $(this).data('url-mauvaise-ident') + '" target="_blank">' +
|
419 |
'<img class="icone_action_ill" src="'+urlCssImages+'mauvaise_id.png">Signaler une mauvaise identification' +
|
419 |
'<img class="icone_action_ill" src="'+urlCssImages+'mauvaise_id.png">Signaler une mauvaise identification' +
|
420 |
'</a>';
|
420 |
'</a>';
|
421 |
}
|
421 |
}
|
422 |
$('#grande-image-legende-' + clef).html(contenu);
|
422 |
$('#grande-image-legende-' + clef).html(contenu);
|
423 |
|
423 |
|
424 |
}
|
424 |
}
|
425 |
// valeurs génériques
|
425 |
// valeurs génériques
|
426 |
$('#grande-image-legende-' + clef).html($(this).data(clef));
|
426 |
$('#grande-image-legende-' + clef).html($(this).data(clef));
|
427 |
$('#grande-image-legende-date').html(formaterDateVersFrancais($(this).data('date')));
|
427 |
$('#grande-image-legende-date').html(formaterDateVersFrancais($(this).data('date')));
|
428 |
$('#grande-image-legende-id-destinataire').attr('href', urlPopup+'?module=popup-contact&action=form&referentiel='+REFERENTIEL+'&id_destinataire=' +
|
428 |
$('#grande-image-legende-id-destinataire').attr('href', urlPopup+'?module=popup-contact&action=form&referentiel='+REFERENTIEL+'&id_destinataire=' +
|
429 |
$(this).data('id-destinataire') + '&id_img=' + $(this).data('id-image'));
|
429 |
$(this).data('id-destinataire') + '&id_img=' + $(this).data('id-image'));
|
430 |
$('#grande-image-legende-id-destinataire').attr('title', "Envoyer un message \xE0 l'auteur \xE0 propos de cette image (n\xE9cessite d'\xEAtre identifi\xE9)");
|
430 |
$('#grande-image-legende-id-destinataire').attr('title', "Envoyer un message \xE0 l'auteur \xE0 propos de cette image (n\xE9cessite d'\xEAtre identifi\xE9)");
|
431 |
$('#grande-image-legende-auteur').attr('href', 'http://tela-botanica.org/profil:' + $(this).data('id-destinataire'));
|
431 |
$('#grande-image-legende-auteur').attr('href', 'http://tela-botanica.org/profil:' + $(this).data('id-destinataire'));
|
432 |
$('#grande-image-legende-auteur').attr('target', '_blank');
|
432 |
$('#grande-image-legende-auteur').attr('target', '_blank');
|
433 |
$('#grande-image-legende-auteur').attr('title', "Voir le profil de cet utilisateur (n\xE9cessite d'\xEAtre identifi\xE9)");
|
433 |
$('#grande-image-legende-auteur').attr('title', "Voir le profil de cet utilisateur (n\xE9cessite d'\xEAtre identifi\xE9)");
|
434 |
|
434 |
|
435 |
|
435 |
|
436 |
$('#grande-image-legende-id-image a.lien_telechargement_image').unbind('click.fb').fancybox({
|
436 |
$('#grande-image-legende-id-image a.lien_telechargement_image').unbind('click.fb').fancybox({
|
437 |
"type" : "iframe",
|
437 |
"type" : "iframe",
|
438 |
"autoDimensions" : false,
|
438 |
"autoDimensions" : false,
|
439 |
"width" : 800,
|
439 |
"width" : 800,
|
440 |
"height" : 405,
|
440 |
"height" : 405,
|
441 |
"titleShow" : false
|
441 |
"titleShow" : false
|
442 |
});
|
442 |
});
|
443 |
}
|
443 |
}
|
444 |
|
444 |
|
445 |
function obtenirUrlMoyenFormatIdImage(idImage) {
|
445 |
function obtenirUrlMoyenFormatIdImage(idImage) {
|
446 |
idImage = remplirChaineDebut(idImage, "0", 9);
|
446 |
idImage = remplirChaineDebut(idImage, "0", 9);
|
447 |
return urlImagesOrganesMoyenFormatTpl.replace('{id_image}', idImage);
|
447 |
return urlImagesOrganesMoyenFormatTpl.replace('{id_image}', idImage);
|
448 |
}
|
448 |
}
|
449 |
|
449 |
|
450 |
function obtenirUrlGrandFormatIdImage(idImage) {
|
450 |
function obtenirUrlGrandFormatIdImage(idImage) {
|
451 |
idImage = remplirChaineDebut(idImage, "0", 9);
|
451 |
idImage = remplirChaineDebut(idImage, "0", 9);
|
452 |
return urlImagesOrganesGrandFormatTpl.replace('{id_image}', idImage);
|
452 |
return urlImagesOrganesGrandFormatTpl.replace('{id_image}', idImage);
|
453 |
}
|
453 |
}
|
454 |
|
454 |
|
455 |
function remplirChaineDebut(chaine, remplissage, longueur) {
|
455 |
function remplirChaineDebut(chaine, remplissage, longueur) {
|
456 |
while(chaine.toString().length < longueur) {
|
456 |
while(chaine.toString().length < longueur) {
|
457 |
chaine = remplissage.toString()+chaine.toString();
|
457 |
chaine = remplissage.toString()+chaine.toString();
|
458 |
}
|
458 |
}
|
459 |
return chaine;
|
459 |
return chaine;
|
460 |
}
|
460 |
}
|
461 |
|
461 |
|
462 |
// transforme une date du type "2012-04-06" en "06 avril 2012"
|
462 |
// transforme une date du type "2012-04-06" en "06 avril 2012"
|
463 |
function formaterDateVersFrancais(date) {
|
463 |
function formaterDateVersFrancais(date) {
|
464 |
var mois = ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
|
464 |
var mois = ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'],
|
465 |
amj_hms = date.split(' '),
|
465 |
amj_hms = date.split(' '),
|
466 |
amj = amj_hms[0].split('-');
|
466 |
amj = amj_hms[0].split('-');
|
467 |
return amj[2] + ' ' + mois[parseInt(amj[1]) - 1] + ' ' + amj[0];
|
467 |
return amj[2] + ' ' + mois[parseInt(amj[1]) - 1] + ' ' + amj[0];
|
468 |
}
|
468 |
}
|
469 |
|
469 |
|
470 |
|
470 |
|
471 |
// ouvre le popup de galerie lors d'un clic sur l'illustration dans la fiche synthèse
|
471 |
// ouvre le popup de galerie lors d'un clic sur l'illustration dans la fiche synthèse
|
472 |
function gererClicIllustrationsFiche() {
|
472 |
function gererClicIllustrationsFiche() {
|
473 |
$('.illustration_cel').on('click', function() {
|
473 |
$('.illustration_cel').on('click', function() {
|
474 |
var url_image = $(this).attr('src');
|
474 |
var url_image = $(this).attr('src');
|
475 |
var titre = $('.nomenclature').first().text();
|
475 |
var titre = $('.nomenclature').first().text();
|
476 |
var url = urlPopup+"?module=popup-galerie&action=fiche&num_nom="+$(this).attr('data-num-nom')+"&titre="+encodeURIComponent(titre)+"&url_image="+encodeURIComponent(url_image)+"&referentiel="+REFERENTIEL;
|
476 |
var url = urlPopup+"?module=popup-galerie&action=fiche&num_nom="+$(this).attr('data-num-nom')+"&titre="+encodeURIComponent(titre)+"&url_image="+encodeURIComponent(url_image)+"&referentiel="+REFERENTIEL;
|
477 |
//var url = urlPopup+"?module=popup-galerie-organes&action=fiche&num_nom="+$(this).attr('data-num-nom')+"&titre="+encodeURIComponent(titre)+"&url_image="+encodeURIComponent(url_image)+"&referentiel="+REFERENTIEL;
|
477 |
//var url = urlPopup+"?module=popup-galerie-organes&action=fiche&num_nom="+$(this).attr('data-num-nom')+"&titre="+encodeURIComponent(titre)+"&url_image="+encodeURIComponent(url_image)+"&referentiel="+REFERENTIEL;
|
478 |
//alert(url);
|
478 |
//alert(url);
|
479 |
//return false;
|
479 |
//return false;
|
480 |
window.open(url, $(this).attr('data-num-nom'), 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, width='+(400)+', height='+(375));
|
480 |
window.open(url, $(this).attr('data-num-nom'), 'directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, width='+(400)+', height='+(375));
|
481 |
});
|
481 |
});
|
482 |
}
|
482 |
}
|
483 |
|
483 |
|
484 |
function ouvrirFenetreIllustrationFiche(url, titre, hauteur, largeur) {
|
484 |
function ouvrirFenetreIllustrationFiche(url, titre, hauteur, largeur) {
|
485 |
var fenetre = window.open('_blank', '','directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, width='+(largeur+17)+', height='+(hauteur+17));
|
485 |
var fenetre = window.open('_blank', '','directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no, width='+(largeur+17)+', height='+(hauteur+17));
|
486 |
var tmp = fenetre.document;
|
486 |
var tmp = fenetre.document;
|
487 |
tmp.write('<html><head><title>'+titre+'</title>');
|
487 |
tmp.write('<html><head><title>'+titre+'</title>');
|
488 |
tmp.write('</head><body>');
|
488 |
tmp.write('</head><body>');
|
489 |
tmp.write('<p style="height='+hauteur+'px;text-align:center;line-height='+hauteur+'px;"><img id="image_agrandie" height="'+hauteur+'" width="'+largeur+'" style="vertical-align:middle;" src="'+url+'" /></p>');
|
489 |
tmp.write('<p style="height='+hauteur+'px;text-align:center;line-height='+hauteur+'px;"><img id="image_agrandie" height="'+hauteur+'" width="'+largeur+'" style="vertical-align:middle;" src="'+url+'" /></p>');
|
490 |
tmp.write('</body></html>');
|
490 |
tmp.write('</body></html>');
|
491 |
tmp.close();
|
491 |
tmp.close();
|
492 |
}
|
492 |
}
|
493 |
|
493 |
|
494 |
|
494 |
|
495 |
// met à jour l'url dans la barre du navigateur ainsi que dans le permalien en bas
|
495 |
// met à jour l'url dans la barre du navigateur ainsi que dans le permalien en bas
|
496 |
// de la fiche
|
496 |
// de la fiche
|
497 |
function mettreAJourUrl(nouvelleUrl, etat) {
|
497 |
function mettreAJourUrl(nouvelleUrl, etat) {
|
498 |
$('#permalien_num_nom').val(nouvelleUrl);
|
498 |
$('#permalien_num_nom').val(nouvelleUrl);
|
499 |
if (!!(window.history && window.history.pushState)) {
|
499 |
if (!!(window.history && window.history.pushState)) {
|
500 |
var currentState = window.history.state;
|
500 |
var currentState = window.history.state;
|
501 |
if (currentState != nouvelleUrl && !!etat) {
|
501 |
if (currentState != nouvelleUrl && !!etat) {
|
502 |
window.history.pushState(etat, "", nouvelleUrl);
|
502 |
window.history.pushState(etat, "", nouvelleUrl);
|
503 |
}
|
503 |
}
|
504 |
}
|
504 |
}
|
505 |
}
|
505 |
}
|
506 |
|
506 |
|
507 |
function gererInteractionsPermaliens() {
|
507 |
function gererInteractionsPermaliens() {
|
508 |
$(".conteneur_permalien > a").each(function() {
|
508 |
$(".conteneur_permalien > a").each(function() {
|
509 |
var txt = '<input type="text" id="'+$(this).attr('id')+'" readonly="readonly" class="lien_externe" value="'+$(this).attr('href')+'">';
|
509 |
var txt = '<input type="text" id="'+$(this).attr('id')+'" readonly="readonly" class="lien_externe" value="'+$(this).attr('href')+'">';
|
510 |
$(this).replaceWith(txt);
|
510 |
$(this).replaceWith(txt);
|
511 |
});
|
511 |
});
|
512 |
$(".conteneur_permalien > input").each(function() {
|
512 |
$(".conteneur_permalien > input").each(function() {
|
513 |
$(this).attr('size', $(this).val().length - 7);
|
513 |
$(this).attr('size', $(this).val().length - 7);
|
514 |
});
|
514 |
});
|
515 |
$(".conteneur_permalien > input").hover(
|
515 |
$(".conteneur_permalien > input").hover(
|
516 |
function() {
|
516 |
function() {
|
517 |
$(this).select();
|
517 |
$(this).select();
|
518 |
}, function() {
|
518 |
}, function() {
|
519 |
// rien à faire sur le mouseout
|
519 |
// rien à faire sur le mouseout
|
520 |
}
|
520 |
}
|
521 |
);
|
521 |
);
|
522 |
}
|
522 |
}
|
523 |
|
523 |
|
524 |
function gererTemplatesChargementALaDemande() {
|
524 |
function gererTemplatesChargementALaDemande() {
|
525 |
$('.lien-ajax-tpl a.lien-ajax-tpl-chargement').on('click', function(e) {
|
525 |
$('.lien-ajax-tpl a.lien-ajax-tpl-chargement').on('click', function(e) {
|
526 |
if($(this).attr('data-loading') != "true") {
|
526 |
if($(this).attr('data-loading') != "true") {
|
527 |
$(this).attr('data-loading', "true");
|
527 |
$(this).attr('data-loading', "true");
|
528 |
e.preventDefault();
|
528 |
e.preventDefault();
|
529 |
urlTpl = $(this).attr('href');
|
529 |
urlTpl = $(this).attr('href');
|
530 |
$(this).hide();
|
530 |
$(this).hide();
|
531 |
thisElementParent = $(this).parent();
|
531 |
thisElementParent = $(this).parent();
|
532 |
thisElementParent.append("<div class='tab-chargement'>Chargement des informations...</div>");
|
532 |
thisElementParent.append("<div class='tab-chargement'>Chargement des informations...</div>");
|
533 |
$.get(urlTpl, function( data ) {
|
533 |
$.get(urlTpl, function( data ) {
|
534 |
thisElementParent.replaceWith( data );
|
534 |
thisElementParent.replaceWith( data );
|
535 |
});
|
535 |
});
|
536 |
return false;
|
536 |
return false;
|
537 |
}
|
537 |
}
|
538 |
});
|
538 |
});
|
539 |
}
|
539 |
}
|
540 |
|
540 |
|
541 |
$(document).ready(function() {
|
541 |
$(document).ready(function() {
|
542 |
gererChargementGraphiqueEcologie();
|
542 |
gererChargementGraphiqueEcologie();
|
543 |
gererAffichageLegendeEcologie();
|
543 |
gererAffichageLegendeEcologie();
|
544 |
gererTemplatesChargementALaDemande();
|
544 |
gererTemplatesChargementALaDemande();
|
545 |
if (document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1') === false) {
|
545 |
if (document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1') === false) {
|
546 |
$('.svg').each(function() {
|
546 |
$('.svg').each(function() {
|
547 |
var img = document.createElement('img');
|
547 |
var img = document.createElement('img');
|
548 |
img.src = $(this).attr('alt');
|
548 |
img.src = $(this).attr('alt');
|
549 |
$(this).replaceWith(img);
|
549 |
$(this).replaceWith(img);
|
550 |
});
|
550 |
});
|
551 |
}
|
551 |
}
|
- |
|
552 |
gererClicIllustrationsFiche();
|
552 |
});
|
553 |
});
|
553 |
|
554 |
|