Subversion Repositories eFlore/Applications.del

Rev

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

Rev 1496 Rev 1501
Line 9... Line 9...
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;
Line 14... Line 15...
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;
Line 22... Line 23...
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;
-
 
27
	private String taxonPourRechercheEflore;
26
	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;
Line 81... Line 83...
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");
Line -... Line 90...
-
 
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);
-
 
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);
98
		rechercheParArguments.setTag(tag);
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);
-
 
132
			rechercheParArguments.setMotClefDel(tagDel);
-
 
133
			if(pageInt != null) setPageCouranteRechercheImages(pageInt);
-
 
134
		} else {
101
			rechercheParArguments.setMotClefDel(tagDel);
135
			if(pageInt != null)	setPageCouranteRechercheObservations(pageInt);			
Line 102... Line 136...
102
		}
136
		}
103
		
137
		
Line 104... Line 138...
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) {
Line 109... Line 143...
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;
Line 112... Line 146...
112
			}
146
			}
113
			
147
			
Line 123... Line 157...
123
				rechercheParArguments.setTriParNbTags(modeTri);
157
				rechercheParArguments.setTriParNbTags(modeTri);
124
			}
158
			}
Line 125... Line 159...
125
			
159
			
126
			if(tri.equals("date_observation")) {
160
			if(tri.equals("date_observation")) {
127
				rechercheParArguments.setTriParDate(modeTri);
161
				rechercheParArguments.setTriParDate(modeTri);
128
			}
-
 
129
			
162
			}			
Line 130... Line 163...
130
		}
163
		}
Line 131... Line 164...
131
		
164
		
Line 151... Line 184...
151
		
184
		
152
		informationsRechercheImage = rechercheParArguments;
185
		informationsRechercheImage = rechercheParArguments;
153
		informationsRechercheObservation = rechercheParArguments;
186
		informationsRechercheObservation = rechercheParArguments;
Line -... Line 187...
-
 
187
	}
-
 
188
	
-
 
189
	public void setIdProtocoleEnAttente(String idProtocole) {
-
 
190
		idProtocoleEnAttente = idProtocole;
-
 
191
	}
-
 
192
	
-
 
193
	public String getIdProtocoleEnAttente() {
-
 
194
		return idProtocoleEnAttente;
154
	}
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);
Line 302... Line 343...
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)) {
Line 305... Line 346...
305
			
346
			
306
			InformationsRecherche infoRecherche;
347
			InformationsRecherche infoRecherche;
-
 
348
			infoRecherche = cache.getInformationsRechercheImage();
-
 
349
			if (CacheClient.getInstance().getProtocoleCourant() != null) {
-
 
350
				infoRecherche.setIdProtocoleSelectionne(""+CacheClient.getInstance().getProtocoleCourant().getId());
307
			infoRecherche = cache.getInformationsRechercheImage();			
351
			}
Line 308... Line 352...
308
			argumentsRecherche = infoRecherche.versChaineRequete();
352
			argumentsRecherche = infoRecherche.versChaineRequete();
309
			
353
			
310
			if(!GWT.isScript()) {
354
			if(!GWT.isScript()) {
Line -... Line 355...
-
 
355
				argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
-
 
356
			}
-
 
357
			
311
				argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
358
			argumentsRecherche += (argumentsRecherche.isEmpty()) ? "" : "&";
312
			}
359
			argumentsRecherche += "page="+getPageCouranteRechercheImage()+"&pas="+getPasPagination();
313
			
360
			
Line 314... Line -...
314
			argumentsRecherche = (argumentsRecherche.isEmpty()) ? argumentsRecherche : "?" + argumentsRecherche;
-
 
315
			arguments = argumentsRecherche + "#" + ConstantesNavigation.PAGE_RECHERCHE_IMAGES;
-
 
316
			url = new Config().getUrl("del") + arguments;
-
 
317
 
361
			argumentsRecherche = (argumentsRecherche.isEmpty()) ? argumentsRecherche : "?" + argumentsRecherche;
Line 318... Line 362...
318
			if (CacheClient.getInstance().getProtocoleCourant() != null) {
362
			arguments = argumentsRecherche + "#" + ConstantesNavigation.PAGE_RECHERCHE_IMAGES;
319
				url += "~"+String.valueOf(CacheClient.getInstance().getProtocoleCourant().getId());
363
			url = new Config().getUrl("del") + arguments;
320
			}
364
 
-
 
365
		} else if (cache.getPageCourante().equals(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS) || cache.getPageCourante().equals("")) {
321
		} else if (cache.getPageCourante().equals(ConstantesNavigation.PAGE_RECHERCHE_OBSERVATIONS) || cache.getPageCourante().equals("")) {
366
			
Line 322... Line 367...
322
			
367
			InformationsRecherche infoRecherche;
323
			InformationsRecherche infoRecherche;
368
			infoRecherche = cache.getInformationsRechercheObservation();
324
			infoRecherche = cache.getInformationsRechercheObservation();
369
			argumentsRecherche = "masque.type="+statut;
-
 
370
			argumentsRecherche += "&page="+getPageCouranteRechercheObservations()+"&pas="+getPasPagination();
325
			argumentsRecherche = "masque.type="+statut;
371
			argumentsRecherche += "&"+infoRecherche.versChaineRequete();
326
			argumentsRecherche += "&"+infoRecherche.versChaineRequete();
372
			
327
			
373
			if(!GWT.isScript()) {
328
			if(!GWT.isScript()) {
374
				argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
329
				argumentsRecherche += "&gwt.codesvr="+Location.getParameter("gwt.codesvr")+"";
375
			}
Line 350... Line 396...
350
	public void mettreAjourUrlCourante() {
396
	public void mettreAjourUrlCourante() {
351
		mettreAJourUrlCouranteSansRecharger(genererUrlCourante());
397
		mettreAJourUrlCouranteSansRecharger(genererUrlCourante());
352
	}
398
	}
Line 353... Line 399...
353
	
399
	
-
 
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
354
	private static native void mettreAJourUrlCouranteSansRecharger(String nouvelleUrl) /*-{
403
		if(!!($wnd.history && $wnd.history.pushState)) {
-
 
404
    		$wnd.history.pushState(nouvelleUrl, "", nouvelleUrl);
355
    	$wnd.history.pushState(nouvelleUrl, "", nouvelleUrl);
405
    	}
Line 356... Line 406...
356
	}-*/;
406
	}-*/;