Subversion Repositories eFlore/Applications.del

Rev

Rev 1517 | Rev 1551 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1517 Rev 1549
Line 19... Line 19...
19
 
19
 
Line 20... Line 20...
20
public class CacheClient {
20
public class CacheClient {
Line 21... Line -...
21
 
-
 
22
	private List<Protocole> listeProtocoles;
21
 
23
	
22
	private List<Protocole> listeProtocoles;
24
	private String home = ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS;
23
	
25
	private Observation observationCourante;
24
	private Observation observationCourante;
26
	private Image imageCourante;
25
	private Image imageCourante;
Line 37... Line 36...
37
	private int pageCouranteRechercheImage = 1;
36
	private int pageCouranteRechercheImage = 1;
38
	private int pageCouranteRechercheObservations = 1;
37
	private int pageCouranteRechercheObservations = 1;
39
	private InformationsRecherche informationsRechercheImage;
38
	private InformationsRecherche informationsRechercheImage;
40
	private InformationsRecherche informationsRechercheObservation;
39
	private InformationsRecherche informationsRechercheObservation;
41
	private Utilisateur utilisateur;
40
	private Utilisateur utilisateur;
42
	private String pageCourante = home;
41
	private String pageCourante = "";
43
	private String statut;
42
	private String statut;
-
 
43
	private String[] statutsPossibles = {
44
	private String[] statutsPossibles = {ConstantesNavigation.PARAM_TYPE_TOUS, 
44
		ConstantesNavigation.PARAM_TYPE_TOUS, 
45
										ConstantesNavigation.PARAM_TYPE_A_DETERMINER,
45
		ConstantesNavigation.PARAM_TYPE_A_DETERMINER,
46
										ConstantesNavigation.PARAM_TYPE_EN_DISCUSSION,
46
		ConstantesNavigation.PARAM_TYPE_EN_DISCUSSION,
47
										ConstantesNavigation.PARAM_TYPE_VALIDEES};
47
		ConstantesNavigation.PARAM_TYPE_VALIDEES
-
 
48
	};
Line 48... Line 49...
48
	
49
	
49
	public void supprimerFiltreStatut() {
50
	public void supprimerFiltreStatut() {
50
		this.statut = null;
51
		this.statut = null;
Line 71... Line 72...
71
	private CacheClient() {
72
	private CacheClient() {
72
		instance = this;
73
		instance = this;
73
	}
74
	}
Line 74... Line 75...
74
 
75
 
-
 
76
	public void initialiserAvecParametres() {
-
 
77
		String urlCourante = Window.Location.getHref();
-
 
78
		Config config = new Config();
75
	public void initialiserAvecParametres() {
79
		String urlAppliImg = config.getUrl("pictoflora");
76
		
-
 
77
		if(Location.getPath().contains("identiplante")) {
80
		
78
			if(Location.getHash().contains(ConstantesNavigation.PAGE_VALIDATION)) {
81
		if (Location.getHash().contains(ConstantesNavigation.PAGE_DETAIL_OBS)) {
79
				setPageCourante(ConstantesNavigation.PAGE_VALIDATION+"~"+URLUtils.getURLSpecialParameterValue());
-
 
80
			} else {
-
 
81
				setPageCourante(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS);
-
 
82
			}
-
 
83
		} else if(Location.getPath().contains("pictoflora")) {
82
			setPageCourante(ConstantesNavigation.PAGE_DETAIL_OBS+"~"+URLUtils.getURLSpecialParameterValue());
84
			if(Location.getHash().contains(ConstantesNavigation.PAGE_VALIDATION_PICTOFLORA)) {
83
		} else if (Location.getHash().contains(ConstantesNavigation.PAGE_DETAIL_IMG)) {
85
				setPageCourante(ConstantesNavigation.PAGE_VALIDATION+URLUtils.getURLSpecialParameterValue());
84
			setPageCourante(ConstantesNavigation.PAGE_DETAIL_IMG+"~"+URLUtils.getURLSpecialParameterValue());
86
			} else {
85
		} else {
87
				setPageCourante(ConstantesNavigation.PAGE_RECHERCHE_IMAGES);
-
 
88
			}
86
			setPageCourante("");
-
 
87
		}
Line 89... Line 88...
89
		}
88
		GWT.log("initialiserAvecParametres:"+getPageCourante());
90
		
89
		
91
		String rechercheLibre = Location.getParameter("masque");
90
		String rechercheLibre = Location.getParameter("masque");
92
		String famille = Location.getParameter("masque.famille");
91
		String famille = Location.getParameter("masque.famille");
Line 138... Line 137...
138
		} else if(URLUtils.getURLSpecialParameterValue() != null) {
137
		} else if (URLUtils.getURLSpecialParameterValue() != null) {
139
			CacheClient.getInstance().setIdProtocoleEnAttente(URLUtils.getURLSpecialParameterValue());
138
			CacheClient.getInstance().setIdProtocoleEnAttente(URLUtils.getURLSpecialParameterValue());
140
			rechercheParArguments.setIdProtocoleSelectionne(URLUtils.getURLSpecialParameterValue());
139
			rechercheParArguments.setIdProtocoleSelectionne(URLUtils.getURLSpecialParameterValue());
141
		}
140
		}
Line -... Line 141...
-
 
141
		
142
		
142
		if (pasInt != null) {
-
 
143
			setPasPagination(pasInt);
Line 143... Line 144...
143
		if(pasInt != null) setPasPagination(pasInt);
144
		}
144
				
145
		
145
		if(pageCourante.equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {
146
		if (urlCourante.contains(urlAppliImg)) {
-
 
147
			rechercheParArguments.setMotClefCel(tagCel);
146
			rechercheParArguments.setMotClefCel(tagCel);
148
			rechercheParArguments.setMotClefDel(tagDel);
-
 
149
			if (pageInt != null) {
147
			rechercheParArguments.setMotClefDel(tagDel);
150
				setPageCouranteRechercheImages(pageInt);
-
 
151
			}
148
			if(pageInt != null) setPageCouranteRechercheImages(pageInt);
152
		} else {
-
 
153
			if (pageInt != null) {
149
		} else {
154
				setPageCouranteRechercheObservations(pageInt);
Line 150... Line 155...
150
			if(pageInt != null)	setPageCouranteRechercheObservations(pageInt);			
155
			}
151
		}
156
		}
Line 220... Line 225...
220
	public void setUtilisateur(Utilisateur utilisateur) {
225
	public void setUtilisateur(Utilisateur utilisateur) {
221
		this.utilisateur = utilisateur; 
226
		this.utilisateur = utilisateur; 
222
	}
227
	}
Line 223... Line 228...
223
	
228
	
224
	public void setHome(String home) {
-
 
225
		this.home = home;
229
	public void setHome(String home) {
226
		setPageCourante(home);
230
		setPageCourante(home);
Line 227... Line 231...
227
	}
231
	}
228
	
232
	
229
	public String getHome() {
233
	public String getHome() {
Line 230... Line 234...
230
		return home;
234
		return "";
231
	}
235
	}
232
	
236
	
Line 351... Line 355...
351
	public boolean getReferentielNonModifiable() {
355
	public boolean getReferentielNonModifiable() {
352
		return referentielNonModifiable;
356
		return referentielNonModifiable;
353
	}
357
	}
Line 354... Line 358...
354
	
358
	
355
	public String genererUrlCourante() {
359
	public String genererUrlCourante() {
-
 
360
		String urlCourante = Window.Location.getHref();
-
 
361
		Config config = new Config();
-
 
362
		String urlAppliObs = config.getUrl("identiplante");
-
 
363
		String urlAppliImg = config.getUrl("pictoflora");
356
		String url = Window.Location.getHref();
364
		String url = urlCourante;
357
		String arguments = "";
-
 
Line -... Line 365...
-
 
365
		String arguments = "";
358
		String argumentsRecherche = "";
366
		
-
 
367
		//GWT.log("URL courante:"+urlCourante);
Line -... Line 368...
-
 
368
		//GWT.log("IdentiPlante:"+urlCourante.contains(urlAppliObs));
359
		
369
		//GWT.log("PictoFlora:"+urlCourante.contains(urlAppliImg));
360
		if (getPageCourante().equals(ConstantesNavigation.PAGE_RECHERCHE_IMAGES)) {
370
		
-
 
371
		if (urlCourante.contains(urlAppliImg)) {
361
			
372
			InformationsRecherche infoRecherche;
362
			InformationsRecherche infoRecherche;
373
			infoRecherche = getInformationsRechercheImage();
363
			infoRecherche = getInformationsRechercheImage();
374
			
364
			if (CacheClient.getInstance().getProtocoleCourant() != null) {
-
 
365
				infoRecherche.setIdProtocoleSelectionne(""+CacheClient.getInstance().getProtocoleCourant().getId());
-
 
366
			}
-
 
367
			argumentsRecherche = infoRecherche.versChaineRequete();
-
 
368
			
-
 
369
			if(!GWT.isScript()) {
-
 
370
				argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
-
 
371
			}
-
 
Line 372... Line -...
372
			
-
 
373
			argumentsRecherche += (argumentsRecherche.isEmpty()) ? "" : "&";
375
			if (CacheClient.getInstance().getProtocoleCourant() != null) {
374
			argumentsRecherche += "page="+getPageCouranteRechercheImage()+"&pas="+getPasPagination();
376
				infoRecherche.setIdProtocoleSelectionne("" + CacheClient.getInstance().getProtocoleCourant().getId());
375
			
377
			}
376
			argumentsRecherche = (argumentsRecherche.isEmpty()) ? argumentsRecherche : "?" + argumentsRecherche;
-
 
Line -... Line 378...
-
 
378
			
-
 
379
			arguments = infoRecherche.versChaineRequete();
377
			arguments = argumentsRecherche;
380
			arguments += (arguments.isEmpty()) ? "" : "&";
378
			url = new Config().getUrl("pictoflora") + arguments;
381
			arguments += "page="+getPageCouranteRechercheImage()+"&pas="+getPasPagination();
379
			url += "#"+ConstantesNavigation.PAGE_RECHERCHE_IMAGES;
-
 
380
		} else if (getPageCourante().equals(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS) || getPageCourante().equals("")) {
-
 
381
			
-
 
Line 382... Line 382...
382
			InformationsRecherche infoRecherche;
382
 
-
 
383
			url = config.getUrl("pictoflora");
383
			infoRecherche = getInformationsRechercheObservation();
384
		} else if (urlCourante.contains(urlAppliObs)) {
384
			argumentsRecherche = "masque.type="+statut;
-
 
Line 385... Line -...
385
			argumentsRecherche += "&page="+getPageCouranteRechercheObservations()+"&pas="+getPasPagination();
-
 
386
			argumentsRecherche += "&"+infoRecherche.versChaineRequete();
-
 
387
			
-
 
388
			if(!GWT.isScript()) {
-
 
389
				argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
-
 
390
			}
-
 
391
			
385
			InformationsRecherche infoRecherche;
392
			arguments = "?"+argumentsRecherche;
-
 
393
			url = new Config().getUrl("identiplante") + arguments;
-
 
394
			url += "#"+ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS;
386
			infoRecherche = getInformationsRechercheObservation();
-
 
387
			
395
		} else if (getPageCourante().contains(ConstantesNavigation.PAGE_VALIDATION) || getPageCourante().contains(ConstantesNavigation.PAGE_VALIDATION_PICTOFLORA)) {
388
			arguments = "masque.type="+statut;
396
			url = new Config().getUrl("del");
389
			arguments += "&page="+getPageCouranteRechercheObservations()+"&pas="+getPasPagination();
397
			if(getPageCourante().contains(ConstantesNavigation.PAGE_VALIDATION)) {
-
 
398
				url = new Config().getUrl("identiplante");
-
 
399
			} else {
390
			arguments += "&"+infoRecherche.versChaineRequete();
-
 
391
			
-
 
392
			url = config.getUrl("identiplante");
-
 
393
		}
-
 
394
		
400
				url = new Config().getUrl("pictoflora");
395
		if (!GWT.isScript()) {
401
			}
396
			arguments += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
402
			if(!GWT.isScript()) {
397
		}
403
				url += "?gwt.codesvr="+Location.getParameter("gwt.codesvr");
398
		arguments = (arguments.isEmpty()) ? "" : "?" + arguments;
404
			}
399
		String signet = getPageCourante().equals("") ? "" : "#" + getPageCourante();
Line -... Line 400...
-
 
400
		url += arguments + signet;
-
 
401
		
405
			url += "#"+getPageCourante();
402
		// remplacements batards pour corriger l'url
406
		}
403
		// TODO: factoriser toute la fonction 
Line 407... Line -...
407
		// remplacements batards pour corriger l'url
-
 
408
		// TODO: factoriser toute la fonction 
404
		url = url.replaceAll("&#", "#");
409
		url = url.replaceAll("&#", "#");
405
		url = url.replaceAll("&&", "&");
410
		url = url.replaceAll("&&", "&");
406
		url = url.replaceAll("\\?&", "?");
Line 411... Line 407...
411
		url = url.replaceAll("\\?&", "?");
407