New file |
0,0 → 1,95 |
<!-- DEBUT FORM_NOM --> |
<script type="text/javascript"> |
<!-- |
var AUTOCOMPLETION_ELEMENTS_NBRE = 50; |
var URL_SERVICE_AUTOCOMPLETION_NOM_SCI_TPL = "<?= $efloreRechercheSciUrlTpl; ?>"; |
var URL_SERVICE_AUTOCOMPLETION_NOM_VERNA_TPL = "<?= $efloreRechercheVernaUrlTpl; ?>"; |
var URL_BASE_FICHE_TAXON_TPL = "<?= $ficheTaxonUrlTpl; ?>"; |
var VALEUR_DEFAUT_NOM_SCI = "Saisir un nom scientifique (sans auteur)"; |
var VALEUR_DEFAUT_NOM_VERNA = "Saisir un nom commun"; |
var VALEUR_DEFAUT_AU = ""; |
var VALEUR_DEFAUT_BIB = ""; |
var VALEUR_DEFAUT_DATE = ""; |
var URL_BASE_FICHE_TAXON = "<?= $ficheTaxonUrlTplDefaut; ?>"; |
<?php $refs_urls = json_encode($referentielsConsultationUrls); ?> |
var REFERENTIELS_CONSULTATION_URLS = <?= $refs_urls; ?>; |
<?php $refs_verna = json_encode($referentielsVernasDispos); ?> |
var REFERENTIELS_VERNA_DISPOS = <?= $refs_verna; ?>; |
var URL_SERVICE_AUTOCOMPLETION_NOM_SCI = "<?= $efloreRechercheSciUrlDefaut; ?>"; |
var URL_SERVICE_AUTOCOMPLETION_NOM_VERNA = "<?= $efloreRechercheVernaUrlDefaut; ?>"; |
|
function gererVisibiliteSelecteurNom() { |
ref_sci = $(".selection-referentiel[disabled=disabled]").attr("name"); |
$("#eflore_nomenclature_referentiel").val(ref_sci); |
URL_SERVICE_AUTOCOMPLETION_NOM_SCI = URL_SERVICE_AUTOCOMPLETION_NOM_SCI_TPL.replace("{referentiel}", ref_sci); |
URL_BASE_FICHE_TAXON = REFERENTIELS_CONSULTATION_URLS[ref_sci]+URL_BASE_FICHE_TAXON_TPL.replace("{referentiel}", ref_sci); |
console.log(URL_BASE_FICHE_TAXON); |
if(REFERENTIELS_VERNA_DISPOS[ref_sci] != undefined) { |
URL_SERVICE_AUTOCOMPLETION_NOM_VERNA = URL_SERVICE_AUTOCOMPLETION_NOM_VERNA_TPL.replace("{referentiel}", REFERENTIELS_VERNA_DISPOS[ref_sci]); |
$("#type_nom_vernaculaire").parent().css("visibility","visible"); |
} else { |
$("#type_nom_vernaculaire").parent().css("visibility","hidden"); |
$("#type_nom_scientifique").attr('checked', 'checked'); |
$('#nom').val(); |
$('#nom').attr("placeholder", ""); |
} |
$('#ef-form-nomenclature').attr("action", REFERENTIELS_CONSULTATION_URLS[ref_sci]); |
} |
|
function mettreEnValeurReferentielSelectionne(bouton) { |
$(".selection-referentiel").removeAttr("disabled"); |
$(".selection-referentiel").removeClass("referentiel-selectionne"); |
bouton.attr("disabled","disabled"); |
bouton.addClass("referentiel-selectionne"); |
gererVisibiliteSelecteurNom(); |
} |
|
function initialiser() { |
$.getScript("<?= $efloreScriptUrl; ?>").done(function(script, textStatus) { |
// la fonction initialiserMoteur est la fonction d'initialisation du script de recherche tiré d'eflore |
// elle utilise les variable définies ci dessus, et elle est donc chargée après. |
initialiserMoteur(); |
$(".selection-referentiel").click(function () { |
mettreEnValeurReferentielSelectionne($(this)); |
}); |
mettreEnValeurReferentielSelectionne($($(".selection-referentiel")[0])); |
}); |
} |
|
// --> |
</script> |
<div class="importance1" id="conteneur-recherche"> |
<h1 class="titre-widget">Cherchez une plante de <span class="zone-choix-referentiel"> |
<?php $premier_ref = true; ?> |
<?php foreach($referentielsSciDispos as $code => $intitule) : ?> |
<span class="referentiel"> |
<input type="button" class="selection-referentiel" id="referentiel_<?= $code ?>" name="<?= $code; ?>" value="<?= $intitule; ?>" <?= $premier_ref ? 'disabled="disabled"' : ""; ?> /> |
</span> |
<?php $premier_ref = false; ?> |
<?php endforeach; ?> |
</span> </h1> |
<form id="ef-form-nomenclature" name="ef-form-nomenclature" action="<?= $efloreConsultationUrl; ?>" method="get"> |
<fieldset class="ef-groupe-champs"> |
<span class="zone-choix-type-nom"> |
<span class="type-nom"> |
<input type="radio" id="type_nom_scientifique" name="type_nom" value="nom_scientifique" checked="checked" /> |
<label for="type_nom_scientifique">Nom scientifique</label> |
</span> |
<span class="type-nom"> |
<input type="radio" id="type_nom_vernaculaire" name="type_nom" value="nom_vernaculaire" /> |
<label for="type_nom_vernaculaire" title="(en français, allemand, anglais, catalan, espagnol, italien ou néerlandais)">Nom commun</label> |
</span> |
</span> |
<input type="text" aria-haspopup="true" aria-autocomplete="list" role="textbox" autocomplete="off" id="nom" name="nom" class="champ ui-autocomplete-input" size="30" maxlength="255" /> |
<span id="zone-liens-recherche"> |
<input type="hidden" id="eflore_nomenclature_niveau" name="niveau" value="2" /> |
<input type="hidden" id="eflore_nomenclature_module" name="module" value="recherche" /> |
<input type="hidden" id="eflore_nomenclature_referentiel" name="referentiel" value="<?= array_shift(array_keys($referentielsSciDispos)); ?>" /> |
<input type="hidden" id="eflore_nomenclature_action" name="action" value="rechercheSimple" /> |
<input type="submit" id="eflore_nomenclature_submit" name="submit" value="OK" class="ok" /> |
<input type="submit" id="eflore_nomenclature_fiche" name="acces_fiche" value="Accès fiche" /> |
</span> |
</fieldset> |
</form> |
</div> |
<!-- FIN FORM_NOM --> |