10,4 → 10,156 |
loading_image : 'squelettes/images/loading.gif', |
close_image : 'squelettes/images/closelabel.gif' |
}) |
}) |
}) |
|
|
function changerAccordeonOuOnglets(ongletId) { |
|
i = 0 ; |
max = $(".lien_onglet").length ; |
|
if(consultation) { |
|
$("#lien_onglet_0").parent().nextAll().each(function () { |
$(this).hide(); |
}); |
|
$("#lien_onglet_"+ongletId).parent().nextAll().each(function () { |
$(this).show(); |
}); |
|
$("#lien_onglet_"+(ongletId+1)).parent().nextAll().each(function () { |
$(this).hide(); |
}); |
|
for(i = 0 ; i <= max ; i++) { |
$("#lien_onglet_"+i).parent().show(); |
$("#lien_onglet_"+i).removeClass("item_actif") |
} |
|
$("#lien_onglet_"+ongletId).addClass("item_actif"); |
$("#fin_onglet").parent().nextAll().each(function () { |
$(this).show(); |
}); |
} |
else { |
|
$("#lien_onglet_0").parent().parent().nextAll().each(function () { |
$(this).hide(); |
}); |
|
$("#lien_onglet_"+ongletId).parent().parent().nextAll().each(function () { |
$(this).show(); |
}); |
|
$("#lien_onglet_"+(ongletId+1)).parent().parent().nextAll().each(function () { |
$(this).hide(); |
}); |
|
for(i = 0 ; i <= max ; i++) { |
$("#onglet_"+i).removeClass("onglet_actif"); |
} |
|
$("#onglet_"+ongletId).addClass("onglet_actif") ; |
//window.alert("l'onglet avec id "+"#lien_onglet_"+ongletId+"prend la classe item_actif"); |
|
$("#fin_onglet").parent().parent().nextAll().each(function () { |
$(this).show(); |
}); |
} |
} |
|
function ajouterAccordeonOuOnglets() { |
|
onglets = $(".lien_onglet") ; |
consultation = false; |
|
fiche_consultation = $(".BAZ_fiche_titre_application"); |
bouton_valider = $("input[name=\"valider\"]"); |
if(fiche_consultation.length != 0 || bouton_valider.html() == null) { |
consultation = true ; |
} |
else { |
htmlOnglets = '<div id="selecteur_onglets" class="onglets"> <ul id="liste_onglets">'; |
} |
|
for(i = 0 ; i < onglets.length; i++) |
{ |
lienEnCours = onglets[i]; |
lienEnCours.setAttribute("id","lien_onglet_"+(i)); |
|
if(!consultation) { |
htmlOnglets += '<li><a id="onglet_'+i+'" href="javascript:changerAccordeonOuOnglets('+i+','+consultation+');">'+$('#lien_onglet_'+(i)).html()+'</a></li>'; |
} |
} |
|
if(!consultation) { |
htmlOnglets += '</ul></div><hr style="clear: both; visibility: hidden">' ; |
$("#formulaire").before(htmlOnglets); |
$(".lien_onglet").parent().hide(); |
|
$("input[type=\"submit\"][name=\"valider\"]").bind("click",function(event) |
{ |
event.preventDefault(); |
validerFormulaire(true); |
}); |
|
$("input[type=\"submit\"][name=\"valider\"]").before("<input type=\"button\" id=\"sauvegarde_form\" onclick=\"validerFormulaire(false)\" value=\"sauvegarder\" />") |
|
} |
else |
{ |
lien_ici = '<li><a id="onglet_lien_ici" href="#">Application</a></li>' ; |
lien_forge = $("#bf_lien_forge_description"); |
lien_demo = $("#bf_lien_demo_description"); |
lien_forum = $("#bf_lien_forum_description"); |
|
htmlOnglets = '<div id="selecteur_onglets" class="onglets"> <ul id="liste_onglets">'; |
htmlOnglets += lien_ici ; |
htmlOnglets += '<li><a id="onglet_lien_forum" href="http://'+lien_forum.html().replace(/^\s*|\s*$/g,'')+'">Liste de discussion</a></li>' ; |
htmlOnglets += '<li><a id="onglet_lien_demo" href="http://'+lien_demo.html().replace(/^\s*|\s*$/g,'')+'">Espace démo</a></li>' ; |
htmlOnglets += '<li><a id="onglet_lien_forge" href="http://'+lien_forge.html().replace(/^\s*|\s*$/g,'')+'">Téléchargement et forge</a></li>' ; |
htmlOnglets += '</ul></div><hr style="clear: both; visibility: hidden">' ; |
|
titres_appli = $(".BAZ_titre_application") ; |
titre_appli = titres_appli[0]; |
titre_appli.setAttribute("id","lien_onglet_ext"); |
$("#lien_onglet_ext").after(htmlOnglets); |
|
lien_demo.hide(); |
lien_forge.hide(); |
lien_forum.hide(); |
|
$("#bf_lien_forge_rubrique").hide(); |
$("#bf_lien_demo_rubrique").hide(); |
$("#bf_lien_forum_rubrique").hide(); |
|
$("#lien_onglet_ext").hide(); |
} |
|
$(".BAZ_bulle_corps_application").before('<hr style="clear: both; visibility: hidden">'); |
|
for(j = 0 ; j < onglets.length; j++) |
{ |
ajouterListenersAccordeonOuOnglets(j,consultation) ; |
} |
|
changerAccordeonOuOnglets(0,consultation); |
} |
|
function ajouterListenersAccordeonOuOnglets(id,consultation) { |
if(consultation) { |
$("#lien_onglet_"+id).bind("click", function() {changerAccordeonOuOnglets(id,consultation);}); |
} |
} |
|
function validerFormulaire(verifier) { |
if(verifier == true) { |
try { if(validate_formulaire(document.getElementById("formulaire"))) { $("#formulaire").submit();} } catch(e) { window.alert(e.message); return true; }; |
} |
else { |
$("#formulaire").submit(); |
} |
} |
|
$(document).ready(ajouterAccordeonOuOnglets); |