Subversion Repositories Sites.outils-naturalistes.fr

Rev

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

Rev 3 Rev 8
Line 8... Line 8...
8
jQuery(document).ready(function($) {
8
jQuery(document).ready(function($) {
9
  $('a[rel*=facebox]').facebox({
9
  $('a[rel*=facebox]').facebox({
10
    loading_image : 'squelettes/images/loading.gif',
10
    loading_image : 'squelettes/images/loading.gif',
11
    close_image   : 'squelettes/images/closelabel.gif'
11
    close_image   : 'squelettes/images/closelabel.gif'
12
  }) 
12
  }) 
13
})
-
 
14
13
})
-
 
14
 
-
 
15
 
-
 
16
function changerAccordeonOuOnglets(ongletId) {
-
 
17
 
-
 
18
  i = 0 ;
-
 
19
  max = $(".lien_onglet").length ;
-
 
20
  
-
 
21
  if(consultation) {
-
 
22
 
-
 
23
      $("#lien_onglet_0").parent().nextAll().each(function () {
-
 
24
	  $(this).hide();
-
 
25
      });
-
 
26
 
-
 
27
      $("#lien_onglet_"+ongletId).parent().nextAll().each(function () {
-
 
28
	  $(this).show();
-
 
29
      });
-
 
30
 
-
 
31
      $("#lien_onglet_"+(ongletId+1)).parent().nextAll().each(function () {
-
 
32
	  $(this).hide();
-
 
33
      });
-
 
34
 
-
 
35
    for(i = 0 ; i <= max ; i++) {
-
 
36
      	$("#lien_onglet_"+i).parent().show();
-
 
37
	$("#lien_onglet_"+i).removeClass("item_actif")
-
 
38
    }
-
 
39
 
-
 
40
    $("#lien_onglet_"+ongletId).addClass("item_actif");
-
 
41
    $("#fin_onglet").parent().nextAll().each(function () {
-
 
42
	  $(this).show();
-
 
43
      });
-
 
44
  }
-
 
45
  else {
-
 
46
 
-
 
47
      $("#lien_onglet_0").parent().parent().nextAll().each(function () {
-
 
48
	  $(this).hide();
-
 
49
      });
-
 
50
 
-
 
51
      $("#lien_onglet_"+ongletId).parent().parent().nextAll().each(function () {
-
 
52
	  $(this).show();
-
 
53
      });
-
 
54
 
-
 
55
      $("#lien_onglet_"+(ongletId+1)).parent().parent().nextAll().each(function () {
-
 
56
	  $(this).hide();
-
 
57
      });
-
 
58
 
-
 
59
    for(i = 0 ; i <= max ; i++) {
-
 
60
    	$("#onglet_"+i).removeClass("onglet_actif");
-
 
61
    }
-
 
62
 
-
 
63
    $("#onglet_"+ongletId).addClass("onglet_actif") ;
-
 
64
    //window.alert("l'onglet avec id "+"#lien_onglet_"+ongletId+"prend la classe item_actif");
-
 
65
    
-
 
66
    $("#fin_onglet").parent().parent().nextAll().each(function () {
-
 
67
	  $(this).show();
-
 
68
    });
-
 
69
  }
-
 
70
}
-
 
71
 
-
 
72
function ajouterAccordeonOuOnglets() {
-
 
73
 
-
 
74
  onglets = $(".lien_onglet") ;
-
 
75
  consultation = false;
-
 
76
 
-
 
77
  fiche_consultation = $(".BAZ_fiche_titre_application");
-
 
78
  bouton_valider = $("input[name=\"valider\"]");
-
 
79
  if(fiche_consultation.length != 0 || bouton_valider.html() == null) {
-
 
80
     consultation = true ;
-
 
81
  }
-
 
82
  else {
-
 
83
      htmlOnglets = '<div id="selecteur_onglets" class="onglets">   <ul id="liste_onglets">';
-
 
84
  }
-
 
85
 
-
 
86
  for(i = 0 ; i < onglets.length; i++)  
-
 
87
  {
-
 
88
    lienEnCours = onglets[i];
-
 
89
      lienEnCours.setAttribute("id","lien_onglet_"+(i));
-
 
90
    
-
 
91
    if(!consultation) {
-
 
92
      htmlOnglets += '<li><a id="onglet_'+i+'" href="javascript:changerAccordeonOuOnglets('+i+','+consultation+');">'+$('#lien_onglet_'+(i)).html()+'</a></li>';
-
 
93
    }
-
 
94
  }
-
 
95
  
-
 
96
  if(!consultation) {
-
 
97
    htmlOnglets += '</ul></div><hr style="clear: both; visibility: hidden">' ;
-
 
98
    $("#formulaire").before(htmlOnglets);
-
 
99
    $(".lien_onglet").parent().hide();
-
 
100
    
-
 
101
	$("input[type=\"submit\"][name=\"valider\"]").bind("click",function(event) 
-
 
102
	{
-
 
103
		event.preventDefault();
-
 
104
		validerFormulaire(true);
-
 
105
	});
-
 
106
	
-
 
107
	$("input[type=\"submit\"][name=\"valider\"]").before("<input type=\"button\" id=\"sauvegarde_form\" onclick=\"validerFormulaire(false)\" value=\"sauvegarder\" />")
-
 
108
	
-
 
109
  }
-
 
110
  else
-
 
111
  {
-
 
112
 	  lien_ici = '<li><a id="onglet_lien_ici" href="#">Application</a></li>' ;
-
 
113
	  lien_forge =  $("#bf_lien_forge_description");
-
 
114
	  lien_demo =  $("#bf_lien_demo_description");
-
 
115
	  lien_forum =  $("#bf_lien_forum_description");
-
 
116
	  
-
 
117
	  htmlOnglets = '<div id="selecteur_onglets" class="onglets">   <ul id="liste_onglets">';
-
 
118
	  htmlOnglets += lien_ici ;
-
 
119
	  htmlOnglets += '<li><a id="onglet_lien_forum" href="http://'+lien_forum.html().replace(/^\s*|\s*$/g,'')+'">Liste de discussion</a></li>' ;
-
 
120
	  htmlOnglets += '<li><a id="onglet_lien_demo" href="http://'+lien_demo.html().replace(/^\s*|\s*$/g,'')+'">Espace d&eacute;mo</a></li>' ;
-
 
121
	  htmlOnglets += '<li><a id="onglet_lien_forge" href="http://'+lien_forge.html().replace(/^\s*|\s*$/g,'')+'">T&eacute;l&eacute;chargement et forge</a></li>' ;
-
 
122
	  htmlOnglets += '</ul></div><hr style="clear: both; visibility: hidden">' ;
-
 
123
	  
-
 
124
	  titres_appli = $(".BAZ_titre_application") ;
-
 
125
	  titre_appli = titres_appli[0];
-
 
126
	  titre_appli.setAttribute("id","lien_onglet_ext");
-
 
127
	  $("#lien_onglet_ext").after(htmlOnglets);
-
 
128
	  
-
 
129
	  lien_demo.hide();
-
 
130
	  lien_forge.hide();
-
 
131
	  lien_forum.hide();
-
 
132
	  
-
 
133
	  $("#bf_lien_forge_rubrique").hide();
-
 
134
	  $("#bf_lien_demo_rubrique").hide();
-
 
135
	  $("#bf_lien_forum_rubrique").hide();
-
 
136
	  
-
 
137
	  $("#lien_onglet_ext").hide();
-
 
138
  }
-
 
139
  
-
 
140
  $(".BAZ_bulle_corps_application").before('<hr style="clear: both; visibility: hidden">');
-
 
141
 
-
 
142
  for(j = 0 ; j < onglets.length; j++)
-
 
143
  {
-
 
144
    ajouterListenersAccordeonOuOnglets(j,consultation) ;
-
 
145
  }
-
 
146
 
-
 
147
  changerAccordeonOuOnglets(0,consultation);
-
 
148
}
-
 
149
 
-
 
150
function ajouterListenersAccordeonOuOnglets(id,consultation) {
-
 
151
  if(consultation) {
-
 
152
    $("#lien_onglet_"+id).bind("click", function() {changerAccordeonOuOnglets(id,consultation);});
-
 
153
  }
-
 
154
}
-
 
155
 
-
 
156
function validerFormulaire(verifier) {
-
 
157
	if(verifier == true) {
-
 
158
		try { if(validate_formulaire(document.getElementById("formulaire"))) { $("#formulaire").submit();}  } catch(e) { window.alert(e.message); return true; };
-
 
159
	}
-
 
160
	else {
-
 
161
		$("#formulaire").submit();
-
 
162
	}
-
 
163
}
-
 
164
 
-
 
165
$(document).ready(ajouterAccordeonOuOnglets);
-
 
166
15
167