Subversion Repositories eFlore/Applications.del

Rev

Rev 1496 | Rev 1517 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1496 Rev 1501
1
package org.tela_botanica.del.client.cache;
1
package org.tela_botanica.del.client.cache;
2
 
2
 
3
import java.util.Arrays;
3
import java.util.Arrays;
4
import java.util.List;
4
import java.util.List;
5
 
5
 
6
import org.tela_botanica.del.client.config.Config;
6
import org.tela_botanica.del.client.config.Config;
7
import org.tela_botanica.del.client.gestionhistorique.ConstantesNavigation;
7
import org.tela_botanica.del.client.gestionhistorique.ConstantesNavigation;
8
import org.tela_botanica.del.client.modeles.Image;
8
import org.tela_botanica.del.client.modeles.Image;
9
import org.tela_botanica.del.client.modeles.InformationsRecherche;
9
import org.tela_botanica.del.client.modeles.InformationsRecherche;
10
import org.tela_botanica.del.client.modeles.ModeTri;
10
import org.tela_botanica.del.client.modeles.ModeTri;
11
import org.tela_botanica.del.client.modeles.Observation;
11
import org.tela_botanica.del.client.modeles.Observation;
12
import org.tela_botanica.del.client.modeles.Protocole;
12
import org.tela_botanica.del.client.modeles.Protocole;
13
import org.tela_botanica.del.client.modeles.Utilisateur;
13
import org.tela_botanica.del.client.modeles.Utilisateur;
-
 
14
import org.tela_botanica.del.client.utils.URLUtils;
14
 
15
 
15
import com.google.gwt.core.client.GWT;
16
import com.google.gwt.core.client.GWT;
16
import com.google.gwt.user.client.Window;
17
import com.google.gwt.user.client.Window;
17
import com.google.gwt.user.client.Window.Location;
18
import com.google.gwt.user.client.Window.Location;
18
 
19
 
19
public class CacheClient {
20
public class CacheClient {
20
 
21
 
21
	private List<Protocole> listeProtocoles;
22
	private List<Protocole> listeProtocoles;
22
	
23
	
23
	private String home = ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS;
24
	private String home = ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS;
24
	private Observation observationCourante;
25
	private Observation observationCourante;
25
	private Image imageCourante;
26
	private Image imageCourante;
26
	private String taxonPourRechercheEflore;
27
	private String taxonPourRechercheEflore;
-
 
28
	private String idProtocoleEnAttente = null;
27
	private Protocole protocoleCourant;
29
	private Protocole protocoleCourant;
28
	private String referentielCourant;
30
	private String referentielCourant;
29
	private int numPageRechercheImage = 0;
31
	private int numPageRechercheImage = 0;
30
	private int nbTotalImagesRecherchees = 0;
32
	private int nbTotalImagesRecherchees = 0;
31
	
33
	
32
	private boolean referentielNonModifiable = false;
34
	private boolean referentielNonModifiable = false;
33
 
35
 
34
	private int pasPagination = 12;
36
	private int pasPagination = 12;
35
	private int pageCouranteRechercheImage = 1;
37
	private int pageCouranteRechercheImage = 1;
36
	private int pageCouranteRechercheObservations = 1;
38
	private int pageCouranteRechercheObservations = 1;
37
	private InformationsRecherche informationsRechercheImage;
39
	private InformationsRecherche informationsRechercheImage;
38
	private InformationsRecherche informationsRechercheObservation;
40
	private InformationsRecherche informationsRechercheObservation;
39
	private Utilisateur utilisateur;
41
	private Utilisateur utilisateur;
40
	private String pageCourante = home;
42
	private String pageCourante = home;
41
	private String statut;
43
	private String statut;
42
	private String[] statutsPossibles = {ConstantesNavigation.PARAM_TYPE_TOUS, 
44
	private String[] statutsPossibles = {ConstantesNavigation.PARAM_TYPE_TOUS, 
43
										ConstantesNavigation.PARAM_TYPE_A_DETERMINER,
45
										ConstantesNavigation.PARAM_TYPE_A_DETERMINER,
44
										ConstantesNavigation.PARAM_TYPE_EN_DISCUSSION,
46
										ConstantesNavigation.PARAM_TYPE_EN_DISCUSSION,
45
										ConstantesNavigation.PARAM_TYPE_VALIDEES};
47
										ConstantesNavigation.PARAM_TYPE_VALIDEES};
46
	
48
	
47
	public void supprimerFiltreStatut() {
49
	public void supprimerFiltreStatut() {
48
		this.statut = null;
50
		this.statut = null;
49
	}
51
	}
50
	
52
	
51
	public void setFiltreStatut(String statut) {
53
	public void setFiltreStatut(String statut) {
52
		this.statut = statut;
54
		this.statut = statut;
53
	}
55
	}
54
	
56
	
55
	public String getFiltreStatut() {
57
	public String getFiltreStatut() {
56
		return this.statut;
58
		return this.statut;
57
	}
59
	}
58
	
60
	
59
	public String getPageCourante() {
61
	public String getPageCourante() {
60
		return pageCourante;
62
		return pageCourante;
61
	}
63
	}
62
 
64
 
63
	public void setPageCourante(String pageCourante) {
65
	public void setPageCourante(String pageCourante) {
64
		this.pageCourante = pageCourante;
66
		this.pageCourante = pageCourante;
65
	}
67
	}
66
 
68
 
67
	private static CacheClient instance;
69
	private static CacheClient instance;
68
 
70
 
69
	private CacheClient() {
71
	private CacheClient() {
70
		instance = this;
72
		instance = this;
71
	}
73
	}
72
 
74
 
73
	public void initialiserAvecParametres() {
75
	public void initialiserAvecParametres() {
74
		String rechercheLibre = Location.getParameter("masque");
76
		String rechercheLibre = Location.getParameter("masque");
75
		String famille = Location.getParameter("masque.famille");
77
		String famille = Location.getParameter("masque.famille");
76
		String taxon = Location.getParameter("masque.ns");
78
		String taxon = Location.getParameter("masque.ns");
77
		String genre = Location.getParameter("masque.genre");
79
		String genre = Location.getParameter("masque.genre");
78
		String commune = Location.getParameter("masque.commune");
80
		String commune = Location.getParameter("masque.commune");
79
		String dept = Location.getParameter("masque.departement");
81
		String dept = Location.getParameter("masque.departement");
80
		String auteur = Location.getParameter("masque.auteur");
82
		String auteur = Location.getParameter("masque.auteur");
81
		String date = Location.getParameter("masque.date");
83
		String date = Location.getParameter("masque.date");
82
		String tag = Location.getParameter("masque.tag");
84
		String tag = Location.getParameter("masque.tag");
83
		String tagCel = Location.getParameter("masque.tag_cel");
85
		String tagCel = Location.getParameter("masque.tag_cel");
84
		String tagDel = Location.getParameter("masque.tag_pictoflora");
86
		String tagDel = Location.getParameter("masque.tag_pictoflora");
85
		String referentiel = Location.getParameter("masque.referentiel");
87
		String referentiel = Location.getParameter("masque.referentiel");
86
		
-
 
-
 
88
		String protocole = Location.getParameter("protocole");
87
		String statutParam = Location.getParameter("masque.type");
89
		String statutParam = Location.getParameter("masque.type");
-
 
90
		
-
 
91
		String page = Location.getParameter("page");
-
 
92
		Integer pageInt = null;
-
 
93
		try {
-
 
94
			pageInt =  Integer.parseInt(page);
-
 
95
		} catch (Exception e) {
-
 
96
			pageInt = null;
-
 
97
		}
-
 
98
		
-
 
99
		String pas = Location.getParameter("pas");	
-
 
100
		Integer pasInt = null;
-
 
101
		if(pas != null) {
-
 
102
			try {
-
 
103
				pasInt =  Integer.parseInt(pas);
-
 
104
			} catch (Exception e) {
-
 
105
				pasInt = null;
-
 
106
			}
-
 
107
		}
88
		
108
		
89
		InformationsRecherche rechercheParArguments = new InformationsRecherche();
109
		InformationsRecherche rechercheParArguments = new InformationsRecherche();
90
		rechercheParArguments.setRechercheLibre(rechercheLibre);
110
		rechercheParArguments.setRechercheLibre(rechercheLibre);
91
		rechercheParArguments.setFamille(famille);
111
		rechercheParArguments.setFamille(famille);
92
		rechercheParArguments.setTaxon(taxon);
112
		rechercheParArguments.setTaxon(taxon);
93
		rechercheParArguments.setGenre(genre);
113
		rechercheParArguments.setGenre(genre);
94
		rechercheParArguments.setCommune(commune);
114
		rechercheParArguments.setCommune(commune);
95
		rechercheParArguments.setDepartement(dept);
115
		rechercheParArguments.setDepartement(dept);
96
		rechercheParArguments.setAuteur(auteur);
116
		rechercheParArguments.setAuteur(auteur);
97
		rechercheParArguments.setDate(date);
117
		rechercheParArguments.setDate(date);
98
		rechercheParArguments.setTag(tag);
118
		rechercheParArguments.setTag(tag);
-
 
119
		
-
 
120
		if(protocole != null && !protocole.equals("")) {
-
 
121
			CacheClient.getInstance().setIdProtocoleEnAttente(protocole);
-
 
122
			rechercheParArguments.setIdProtocoleSelectionne(protocole);
-
 
123
		} else if(URLUtils.getURLSpecialParameterValue() != null) {
-
 
124
			CacheClient.getInstance().setIdProtocoleEnAttente(URLUtils.getURLSpecialParameterValue());
-
 
125
			rechercheParArguments.setIdProtocoleSelectionne(URLUtils.getURLSpecialParameterValue());
-
 
126
		}
-
 
127
		
-
 
128
		if(pasInt != null) setPasPagination(pasInt);
-
 
129
				
99
		if(pageCourante.equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {
130
		if(pageCourante.equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {
100
			rechercheParArguments.setMotClefCel(tagCel);
131
			rechercheParArguments.setMotClefCel(tagCel);
101
			rechercheParArguments.setMotClefDel(tagDel);
132
			rechercheParArguments.setMotClefDel(tagDel);
-
 
133
			if(pageInt != null) setPageCouranteRechercheImages(pageInt);
-
 
134
		} else {
-
 
135
			if(pageInt != null)	setPageCouranteRechercheObservations(pageInt);			
102
		}
136
		}
103
		
137
		
104
		
138
		
105
		String tri = Location.getParameter("tri");		
139
		String tri = Location.getParameter("tri");		
106
		String ordre = Location.getParameter("ordre");
140
		String ordre = Location.getParameter("ordre");
107
		
141
		
108
		if(tri != null) {
142
		if(tri != null) {
109
			ModeTri modeTri = ModeTri.TRI_ASCENDANT;
143
			ModeTri modeTri = ModeTri.TRI_ASCENDANT;
110
			if(ordre.equals("asc")) {
144
			if(ordre != null && ordre.equals("asc")) {
111
				modeTri = ModeTri.TRI_ASCENDANT;
145
				modeTri = ModeTri.TRI_ASCENDANT;
112
			}
146
			}
113
			
147
			
114
			if(ordre.equals("desc")) {
148
			if(ordre != null && ordre.equals("desc")) {
115
				modeTri = ModeTri.TRI_DESCENDANT;
149
				modeTri = ModeTri.TRI_DESCENDANT;
116
			}
150
			}
117
			
151
			
118
			if(tri.equals("votes")) {
152
			if(tri.equals("votes")) {
119
				rechercheParArguments.setTriParNbVotes(modeTri);
153
				rechercheParArguments.setTriParNbVotes(modeTri);
120
			}
154
			}
121
			
155
			
122
			if(tri.equals("tags")) {
156
			if(tri.equals("tags")) {
123
				rechercheParArguments.setTriParNbTags(modeTri);
157
				rechercheParArguments.setTriParNbTags(modeTri);
124
			}
158
			}
125
			
159
			
126
			if(tri.equals("date_observation")) {
160
			if(tri.equals("date_observation")) {
127
				rechercheParArguments.setTriParDate(modeTri);
161
				rechercheParArguments.setTriParDate(modeTri);
128
			}
162
			}			
129
			
-
 
130
		}
163
		}
131
		
164
		
132
		rechercheParArguments.setMotClef(tag);
165
		rechercheParArguments.setMotClef(tag);
133
		
166
		
134
		// si le référentiel est passé dans l'url alors il ne doit pas être modifiable
167
		// si le référentiel est passé dans l'url alors il ne doit pas être modifiable
135
		if(referentiel != null && !referentiel.equals("")) {
168
		if(referentiel != null && !referentiel.equals("")) {
136
			setReferentielCourant(referentiel);
169
			setReferentielCourant(referentiel);
137
			rechercheParArguments.setReferentiel(referentiel);
170
			rechercheParArguments.setReferentiel(referentiel);
138
			referentielNonModifiable = true;
171
			referentielNonModifiable = true;
139
		}
172
		}
140
		
173
		
141
		if(Location.getParameterMap().size() == 0) {
174
		if(Location.getParameterMap().size() == 0) {
142
			// par défaut l'application s'ouvre sur l'onglet à déterminer
175
			// par défaut l'application s'ouvre sur l'onglet à déterminer
143
			statut = ConstantesNavigation.PARAM_TYPE_DEFAUT;
176
			statut = ConstantesNavigation.PARAM_TYPE_DEFAUT;
144
		} else {
177
		} else {
145
			if(Arrays.asList(statutsPossibles).contains(statutParam)) {
178
			if(Arrays.asList(statutsPossibles).contains(statutParam)) {
146
				statut = statutParam;
179
				statut = statutParam;
147
			} else {
180
			} else {
148
				statut = ConstantesNavigation.PARAM_TYPE_DEFAUT;
181
				statut = ConstantesNavigation.PARAM_TYPE_DEFAUT;
149
			}
182
			}
150
		}
183
		}
151
		
184
		
152
		informationsRechercheImage = rechercheParArguments;
185
		informationsRechercheImage = rechercheParArguments;
153
		informationsRechercheObservation = rechercheParArguments;
186
		informationsRechercheObservation = rechercheParArguments;
154
	}
187
	}
-
 
188
	
-
 
189
	public void setIdProtocoleEnAttente(String idProtocole) {
-
 
190
		idProtocoleEnAttente = idProtocole;
-
 
191
	}
-
 
192
	
-
 
193
	public String getIdProtocoleEnAttente() {
-
 
194
		return idProtocoleEnAttente;
-
 
195
	}
155
	
196
 
156
	public Utilisateur getUtilisateur() {
197
	public Utilisateur getUtilisateur() {
157
		if (this.utilisateur == null) {
198
		if (this.utilisateur == null) {
158
			this.utilisateur = new Utilisateur(null, null);
199
			this.utilisateur = new Utilisateur(null, null);
159
		}
200
		}
160
		return this.utilisateur;
201
		return this.utilisateur;
161
	}
202
	}
162
	
203
	
163
	public void setUtilisateur(Utilisateur utilisateur) {
204
	public void setUtilisateur(Utilisateur utilisateur) {
164
		this.utilisateur = utilisateur; 
205
		this.utilisateur = utilisateur; 
165
	}
206
	}
166
	
207
	
167
	public void setHome(String home) {
208
	public void setHome(String home) {
168
		this.home = home;
209
		this.home = home;
169
		setPageCourante(home);
210
		setPageCourante(home);
170
	}
211
	}
171
	
212
	
172
	public String getHome() {
213
	public String getHome() {
173
		return home;
214
		return home;
174
	}
215
	}
175
	
216
	
176
	public Observation getObservationCourante() {
217
	public Observation getObservationCourante() {
177
		return observationCourante;
218
		return observationCourante;
178
	}
219
	}
179
 
220
 
180
	public void setObservationCourante(Observation observationCourante) {
221
	public void setObservationCourante(Observation observationCourante) {
181
		this.observationCourante = observationCourante;
222
		this.observationCourante = observationCourante;
182
	}
223
	}
183
 
224
 
184
	public static CacheClient getInstance() {
225
	public static CacheClient getInstance() {
185
		if (instance == null) {
226
		if (instance == null) {
186
			instance = new CacheClient();
227
			instance = new CacheClient();
187
		}
228
		}
188
		return instance;
229
		return instance;
189
	}
230
	}
190
 
231
 
191
	public String getTaxonPourRechercheEflore() {
232
	public String getTaxonPourRechercheEflore() {
192
		return taxonPourRechercheEflore;
233
		return taxonPourRechercheEflore;
193
	}
234
	}
194
 
235
 
195
	public void setTaxonPourRechercheEflore(String taxonPourRechercheEflore) {
236
	public void setTaxonPourRechercheEflore(String taxonPourRechercheEflore) {
196
		this.taxonPourRechercheEflore = taxonPourRechercheEflore;
237
		this.taxonPourRechercheEflore = taxonPourRechercheEflore;
197
	}
238
	}
198
 
239
 
199
	public int getNumPageRechercheImage() {
240
	public int getNumPageRechercheImage() {
200
		return numPageRechercheImage;
241
		return numPageRechercheImage;
201
	}
242
	}
202
 
243
 
203
	// Pour la recherche :
244
	// Pour la recherche :
204
	public int getPasPagination() {
245
	public int getPasPagination() {
205
		return pasPagination;
246
		return pasPagination;
206
	}
247
	}
207
 
248
 
208
	public void setPasPagination(int pasPagination) {
249
	public void setPasPagination(int pasPagination) {
209
		this.pasPagination = pasPagination;
250
		this.pasPagination = pasPagination;
210
	}
251
	}
211
 
252
 
212
	public void setPageCouranteRechercheImages(int pageCouranteRecherche) {
253
	public void setPageCouranteRechercheImages(int pageCouranteRecherche) {
213
		this.pageCouranteRechercheImage = pageCouranteRecherche;
254
		this.pageCouranteRechercheImage = pageCouranteRecherche;
214
	}
255
	}
215
 
256
 
216
	public int getPageCouranteRechercheImage() {
257
	public int getPageCouranteRechercheImage() {
217
		return this.pageCouranteRechercheImage;
258
		return this.pageCouranteRechercheImage;
218
	}
259
	}
219
 
260
 
220
	public void setNbTotalImagesRecherchees(int nbTotalImagesRecherchees) {
261
	public void setNbTotalImagesRecherchees(int nbTotalImagesRecherchees) {
221
		this.nbTotalImagesRecherchees = nbTotalImagesRecherchees;
262
		this.nbTotalImagesRecherchees = nbTotalImagesRecherchees;
222
	}
263
	}
223
 
264
 
224
	public int getNbTotalImagesRecherchees() {
265
	public int getNbTotalImagesRecherchees() {
225
		return this.nbTotalImagesRecherchees;
266
		return this.nbTotalImagesRecherchees;
226
	}
267
	}
227
 
268
 
228
	public Image getImageCourante() {
269
	public Image getImageCourante() {
229
		return imageCourante;
270
		return imageCourante;
230
	}
271
	}
231
 
272
 
232
	public void setImageCourante(Image imageCourante) {
273
	public void setImageCourante(Image imageCourante) {
233
		this.imageCourante = imageCourante;
274
		this.imageCourante = imageCourante;
234
	}
275
	}
235
	
276
	
236
	public void setListeProtocoles(List<Protocole> listeProtocole) {
277
	public void setListeProtocoles(List<Protocole> listeProtocole) {
237
		this.listeProtocoles = listeProtocole;
278
		this.listeProtocoles = listeProtocole;
238
	}
279
	}
239
	
280
	
240
	public List<Protocole> getListeProtocoles() {
281
	public List<Protocole> getListeProtocoles() {
241
		return this.listeProtocoles;
282
		return this.listeProtocoles;
242
	}
283
	}
243
 
284
 
244
	public Protocole getProtocoleCourant() {
285
	public Protocole getProtocoleCourant() {
245
		return protocoleCourant;
286
		return protocoleCourant;
246
	}
287
	}
247
 
288
 
248
	public void setProtocoleCourant(Protocole protocoleCourant) {
289
	public void setProtocoleCourant(Protocole protocoleCourant) {
249
		this.protocoleCourant = protocoleCourant;
290
		this.protocoleCourant = protocoleCourant;
250
	}
291
	}
251
 
292
 
252
	public InformationsRecherche getInformationsRechercheImage() {
293
	public InformationsRecherche getInformationsRechercheImage() {
253
		if(informationsRechercheImage == null) {
294
		if(informationsRechercheImage == null) {
254
			informationsRechercheImage = new InformationsRecherche();
295
			informationsRechercheImage = new InformationsRecherche();
255
		}
296
		}
256
		return informationsRechercheImage;
297
		return informationsRechercheImage;
257
	}
298
	}
258
 
299
 
259
	public InformationsRecherche getInformationsRechercheObservation() {
300
	public InformationsRecherche getInformationsRechercheObservation() {
260
		if(informationsRechercheObservation == null) {
301
		if(informationsRechercheObservation == null) {
261
			informationsRechercheObservation = new InformationsRecherche();
302
			informationsRechercheObservation = new InformationsRecherche();
262
		}
303
		}
263
		return informationsRechercheObservation;
304
		return informationsRechercheObservation;
264
	}
305
	}
265
 
306
 
266
	public void setInformationsRechercheImage(InformationsRecherche informationsRechercheImage) {
307
	public void setInformationsRechercheImage(InformationsRecherche informationsRechercheImage) {
267
		this.informationsRechercheImage = informationsRechercheImage;
308
		this.informationsRechercheImage = informationsRechercheImage;
268
	}
309
	}
269
 
310
 
270
	public void setInformationsRechercheObservation(InformationsRecherche informationsRechercheObservation) {
311
	public void setInformationsRechercheObservation(InformationsRecherche informationsRechercheObservation) {
271
		this.informationsRechercheObservation = informationsRechercheObservation;
312
		this.informationsRechercheObservation = informationsRechercheObservation;
272
	}
313
	}
273
 
314
 
274
	public int getPageCouranteRechercheObservations() {
315
	public int getPageCouranteRechercheObservations() {
275
		return pageCouranteRechercheObservations;
316
		return pageCouranteRechercheObservations;
276
	}
317
	}
277
 
318
 
278
	public void setPageCouranteRechercheObservations(int pageCouranteRechercheObservations) {
319
	public void setPageCouranteRechercheObservations(int pageCouranteRechercheObservations) {
279
		this.pageCouranteRechercheObservations = pageCouranteRechercheObservations;
320
		this.pageCouranteRechercheObservations = pageCouranteRechercheObservations;
280
	}
321
	}
281
	
322
	
282
	public void setReferentielCourant(String referentielCourant) {
323
	public void setReferentielCourant(String referentielCourant) {
283
		this.referentielCourant = referentielCourant;
324
		this.referentielCourant = referentielCourant;
284
	}
325
	}
285
	
326
	
286
	public String getReferentielCourant() {
327
	public String getReferentielCourant() {
287
		return referentielCourant;
328
		return referentielCourant;
288
	}
329
	}
289
	
330
	
290
	public void setReferentielNonModifiable(boolean referentielNonModifiable) {
331
	public void setReferentielNonModifiable(boolean referentielNonModifiable) {
291
		this.referentielNonModifiable = referentielNonModifiable;
332
		this.referentielNonModifiable = referentielNonModifiable;
292
	}
333
	}
293
	
334
	
294
	public boolean getReferentielNonModifiable() {
335
	public boolean getReferentielNonModifiable() {
295
		return referentielNonModifiable;
336
		return referentielNonModifiable;
296
	}
337
	}
297
	
338
	
298
	public String genererUrlCourante() {
339
	public String genererUrlCourante() {
299
		String url = Window.Location.getHref();
340
		String url = Window.Location.getHref();
300
		CacheClient cache = CacheClient.getInstance();
341
		CacheClient cache = CacheClient.getInstance();
301
		
342
		
302
		String arguments = "";
343
		String arguments = "";
303
		String argumentsRecherche = "";
344
		String argumentsRecherche = "";
304
		if (cache.getPageCourante().equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {
345
		if (cache.getPageCourante().equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {
305
			
346
			
306
			InformationsRecherche infoRecherche;
347
			InformationsRecherche infoRecherche;
307
			infoRecherche = cache.getInformationsRechercheImage();			
348
			infoRecherche = cache.getInformationsRechercheImage();
-
 
349
			if (CacheClient.getInstance().getProtocoleCourant() != null) {
-
 
350
				infoRecherche.setIdProtocoleSelectionne(""+CacheClient.getInstance().getProtocoleCourant().getId());
-
 
351
			}
308
			argumentsRecherche = infoRecherche.versChaineRequete();
352
			argumentsRecherche = infoRecherche.versChaineRequete();
309
			
353
			
310
			if(!GWT.isScript()) {
354
			if(!GWT.isScript()) {
311
				argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
355
				argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
312
			}
356
			}
-
 
357
			
-
 
358
			argumentsRecherche += (argumentsRecherche.isEmpty()) ? "" : "&";
-
 
359
			argumentsRecherche += "page="+getPageCouranteRechercheImage()+"&pas="+getPasPagination();
313
			
360
			
314
			argumentsRecherche = (argumentsRecherche.isEmpty()) ? argumentsRecherche : "?" + argumentsRecherche;
361
			argumentsRecherche = (argumentsRecherche.isEmpty()) ? argumentsRecherche : "?" + argumentsRecherche;
315
			arguments = argumentsRecherche + "#" + ConstantesNavigation.PAGE_RECHERCHE_IMAGES;
362
			arguments = argumentsRecherche + "#" + ConstantesNavigation.PAGE_RECHERCHE_IMAGES;
316
			url = new Config().getUrl("del") + arguments;
363
			url = new Config().getUrl("del") + arguments;
317
 
-
 
318
			if (CacheClient.getInstance().getProtocoleCourant() != null) {
-
 
319
				url += "~"+String.valueOf(CacheClient.getInstance().getProtocoleCourant().getId());
-
 
320
			}
364
 
321
		} else if (cache.getPageCourante().equals(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS) || cache.getPageCourante().equals("")) {
365
		} else if (cache.getPageCourante().equals(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS) || cache.getPageCourante().equals("")) {
322
			
366
			
323
			InformationsRecherche infoRecherche;
367
			InformationsRecherche infoRecherche;
324
			infoRecherche = cache.getInformationsRechercheObservation();
368
			infoRecherche = cache.getInformationsRechercheObservation();
325
			argumentsRecherche = "masque.type="+statut;
369
			argumentsRecherche = "masque.type="+statut;
-
 
370
			argumentsRecherche += "&page="+getPageCouranteRechercheObservations()+"&pas="+getPasPagination();
326
			argumentsRecherche += "&"+infoRecherche.versChaineRequete();
371
			argumentsRecherche += "&"+infoRecherche.versChaineRequete();
327
			
372
			
328
			if(!GWT.isScript()) {
373
			if(!GWT.isScript()) {
329
				argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
374
				argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
330
			}
375
			}
-
 
376
			
331
			arguments = "?"+argumentsRecherche + "#" + ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS;
377
			arguments = "?"+argumentsRecherche + "#" + ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS;
332
			url = new Config().getUrl("del") + arguments;
378
			url = new Config().getUrl("del") + arguments;
333
		} else if (cache.getPageCourante().contains(ConstantesNavigation.PAGE_VALIDATION) || cache.getPageCourante().contains(ConstantesNavigation.PAGE_VALIDATION_PICTOFLORA)) {
379
		} else if (cache.getPageCourante().contains(ConstantesNavigation.PAGE_VALIDATION) || cache.getPageCourante().contains(ConstantesNavigation.PAGE_VALIDATION_PICTOFLORA)) {
334
			url = new Config().getUrl("del");
380
			url = new Config().getUrl("del");
335
			if(!GWT.isScript()) {
381
			if(!GWT.isScript()) {
336
				url += "?gwt.codesvr="+Location.getParameter("gwt.codesvr");
382
				url += "?gwt.codesvr="+Location.getParameter("gwt.codesvr");
337
			}
383
			}
338
			url += "#"+cache.getPageCourante();
384
			url += "#"+cache.getPageCourante();
339
		}
385
		}
340
		// remplacements batards pour corriger l'url
386
		// remplacements batards pour corriger l'url
341
		// TODO: factoriser toute la fonction 
387
		// TODO: factoriser toute la fonction 
342
		url = url.replaceAll("&#", "#");
388
		url = url.replaceAll("&#", "#");
343
		url = url.replaceAll("&&", "&");
389
		url = url.replaceAll("&&", "&");
344
		url = url.replaceAll("\\?&", "?");
390
		url = url.replaceAll("\\?&", "?");
345
		
391
		
346
		return url;
392
		return url;
347
	}
393
	}
348
	
394
	
349
	
395
	
350
	public void mettreAjourUrlCourante() {
396
	public void mettreAjourUrlCourante() {
351
		mettreAJourUrlCouranteSansRecharger(genererUrlCourante());
397
		mettreAJourUrlCouranteSansRecharger(genererUrlCourante());
352
	}
398
	}
353
	
399
	
354
	private static native void mettreAJourUrlCouranteSansRecharger(String nouvelleUrl) /*-{
400
	private static native void mettreAJourUrlCouranteSansRecharger(String nouvelleUrl) /*-{
-
 
401
		// javascript double negative trick
-
 
402
		// pour plus d'info http://stackoverflow.com/questions/4686583/can-someone-explain-this-double-negative-trick
-
 
403
		if(!!($wnd.history && $wnd.history.pushState)) {
355
    	$wnd.history.pushState(nouvelleUrl, "", nouvelleUrl);
404
    		$wnd.history.pushState(nouvelleUrl, "", nouvelleUrl);
-
 
405
    	}
356
	}-*/;
406
	}-*/;
357
	
407
	
358
}
408
}