Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2614 Rev 2695
1
package org.tela_botanica.client.modeles.objets;
1
package org.tela_botanica.client.modeles.objets;
2
 
2
 
3
import java.util.ArrayList;
3
import java.util.ArrayList;
4
import java.util.HashMap;
4
import java.util.HashMap;
5
import java.util.Iterator;
5
import java.util.Iterator;
6
import java.util.List;
6
import java.util.List;
7
import java.util.Map;
7
import java.util.Map;
8
 
8
 
9
import com.google.gwt.i18n.client.Dictionary;
9
import com.google.gwt.i18n.client.Dictionary;
10
import com.google.gwt.json.client.JSONObject;
10
import com.google.gwt.json.client.JSONObject;
11
import com.google.gwt.json.client.JSONParser;
11
import com.google.gwt.json.client.JSONParser;
12
import com.google.gwt.json.client.JSONValue;
12
import com.google.gwt.json.client.JSONValue;
13
import com.google.gwt.user.client.Window;
13
import com.google.gwt.user.client.Window;
14
import com.google.gwt.user.client.Window.Location;
14
import com.google.gwt.user.client.Window.Location;
15
import com.sun.org.apache.bcel.internal.generic.RETURN;
15
import com.sun.org.apache.bcel.internal.generic.RETURN;
16
 
16
 
17
/**
17
/**
18
 * Classe chargeant certains paramètres de configuration à partir d'un fichier
18
 * Classe chargeant certains paramètres de configuration à partir d'un fichier
19
 * javascript (config.js)
19
 * javascript (config.js)
20
 * 
20
 * 
21
 * @author aurelien
21
 * @author aurelien
22
 * 
22
 * 
23
 */
23
 */
24
public class Configuration {
24
public class Configuration {
25
 
25
 
26
	/**
26
	/**
27
	 * L'url de base du serveur jrest
27
	 * L'url de base du serveur jrest
28
	 */
28
	 */
29
	private static String serviceBaseUrl;
29
	private static String serviceBaseUrl;
30
 
30
 
31
	private static String imageBaseUrl;
31
	private static String imageBaseUrl;
32
	
32
	
33
	private static String suiviBugUrl ;
33
	private static String suiviBugUrl ;
34
	
34
	
35
	private static String aideBaseUrl ;
35
	private static String aideBaseUrl ;
36
 
36
 
37
	private static String remarquesBaseUrl ;
37
	private static String remarquesBaseUrl ;
38
	
38
	
39
	private static String serviceContact;
39
	private static String serviceContact;
40
	
40
	
41
	private static String referentielGeo ;
41
	private static String referentielGeo ;
42
	
42
	
43
	private static String cleGoogleMaps ;
43
	private static String cleGoogleMaps ;
44
 
44
 
45
	private static String lienEfloreBaseUrl;
45
	private static String lienEfloreBaseUrl;
46
	
46
	
47
	private static String refTax;
47
	private static String refTax;
48
	
48
	
49
	private static String refTaxVersion;
49
	private static String refTaxVersion;
50
	
50
	
51
	private static String licence ="";
51
	private static String licence ="";
52
	
52
	
53
	private static String formatOriginal = "";
53
	private static String formatOriginal = "";
54
	
54
	
55
	private static String formatZoom = "";
55
	private static String formatZoom = "";
56
	
56
	
57
	private static String formatGalerie = "";
57
	private static String formatGalerie = "";
58
	
58
	
59
	private static String formatListe = "";
59
	private static String formatListe = "";
60
 
60
 
61
	private static String utiliseRedirectionImage;
61
	private static String utiliseRedirectionImage;
62
 
62
 
63
	private static String imageRedirectUrl;
63
	private static String imageRedirectUrl;
64
	
64
	
65
	private static String tailleMaxUpload;
65
	private static String tailleMaxUpload;
66
	
66
	
67
	private static List<InfosReferentielNom> referentielsDispos; 
67
	private static List<InfosReferentielNom> referentielsDispos; 
68
	
68
	
69
	private static String activerSaisieChampsEtendus = "0";
69
	private static String activerSaisieChampsEtendus = "0";
70
	
70
	
71
	private static String wikiDescriptionChampsEtendusPageUrl = "";
71
	private static String wikiDescriptionChampsEtendusPageUrl = "";
72
	
72
	
73
	private static String wikiDescriptionChampsEtendusRestUrl = "";
73
	private static String wikiDescriptionChampsEtendusRestUrl = "";
74
	
74
	
75
	private static String wikiDescriptionChampsEtendusRestUrlOptions = "";
75
	private static String wikiDescriptionChampsEtendusRestUrlOptions = "";
76
	
76
	
77
	private static String wikiDescriptionChampsEtendusUrlOptionsPageTpl = "";
77
	private static String wikiDescriptionChampsEtendusUrlOptionsPageTpl = "";
78
	
78
	
79
	private static String langueDefaut = "";
79
	private static String langueDefaut = "";
80
	
80
	
81
	private static String languesDisponibles = "";
81
	private static String languesDisponibles = "";
-
 
82
	
-
 
83
	private static String chorologieAvertissementCourriel = "";
82
 
84
 
83
	/**
85
	/**
84
	 * Constructeur sans argument
86
	 * Constructeur sans argument
85
	 */
87
	 */
86
	public Configuration() {
88
	public Configuration() {
87
		// on utilise le dictionnaire d'internationalisation pour lire les
89
		// on utilise le dictionnaire d'internationalisation pour lire les
88
		// variables du fichier javascript
90
		// variables du fichier javascript
89
		
91
		
90
		//if(GWT.isScript()) {
92
		//if(GWT.isScript()) {
91
			serviceBaseUrl = Dictionary.getDictionary("configuration").get(
93
			serviceBaseUrl = Dictionary.getDictionary("configuration").get(
92
					"serviceBaseUrl");
94
					"serviceBaseUrl");
93
			
95
			
94
			serviceContact = Dictionary.getDictionary("configuration").get(
96
			serviceContact = Dictionary.getDictionary("configuration").get(
95
			"serviceContact");
97
			"serviceContact");
96
			
98
			
97
			suiviBugUrl = Dictionary.getDictionary("configuration").get(
99
			suiviBugUrl = Dictionary.getDictionary("configuration").get(
98
			"suiviBugUrl");
100
			"suiviBugUrl");
99
			
101
			
100
			imageBaseUrl = Dictionary.getDictionary("configuration").get(
102
			imageBaseUrl = Dictionary.getDictionary("configuration").get(
101
			"imageBaseUrl");
103
			"imageBaseUrl");
102
			
104
			
103
			aideBaseUrl = Dictionary.getDictionary("configuration").get(
105
			aideBaseUrl = Dictionary.getDictionary("configuration").get(
104
			"aideBaseUrl");
106
			"aideBaseUrl");
105
			
107
			
106
			remarquesBaseUrl = Dictionary.getDictionary("configuration").get(
108
			remarquesBaseUrl = Dictionary.getDictionary("configuration").get(
107
			"remarquesBaseUrl");
109
			"remarquesBaseUrl");
108
			
110
			
109
			referentielGeo = Dictionary.getDictionary("configuration").get(
111
			referentielGeo = Dictionary.getDictionary("configuration").get(
110
			"referentielGeo");
112
			"referentielGeo");
111
			
113
			
112
			cleGoogleMaps = Dictionary.getDictionary("configuration").get(
114
			cleGoogleMaps = Dictionary.getDictionary("configuration").get(
113
			"cleGoogleMaps");
115
			"cleGoogleMaps");
114
			
116
			
115
			lienEfloreBaseUrl = Dictionary.getDictionary("configuration").get(
117
			lienEfloreBaseUrl = Dictionary.getDictionary("configuration").get(
116
			"lienEfloreBaseUrl");
118
			"lienEfloreBaseUrl");
117
			
119
			
118
			formatOriginal = Dictionary.getDictionary("configuration").get(
120
			formatOriginal = Dictionary.getDictionary("configuration").get(
119
			"formatOriginal");
121
			"formatOriginal");
120
			
122
			
121
			formatZoom = Dictionary.getDictionary("configuration").get(
123
			formatZoom = Dictionary.getDictionary("configuration").get(
122
			"formatZoom");
124
			"formatZoom");
123
			
125
			
124
			formatGalerie = Dictionary.getDictionary("configuration").get(
126
			formatGalerie = Dictionary.getDictionary("configuration").get(
125
			"formatGalerie");
127
			"formatGalerie");
126
			
128
			
127
			formatListe = Dictionary.getDictionary("configuration").get(
129
			formatListe = Dictionary.getDictionary("configuration").get(
128
			"formatListe");
130
			"formatListe");
129
			
131
			
130
			utiliseRedirectionImage = Dictionary.getDictionary("configuration").get(
132
			utiliseRedirectionImage = Dictionary.getDictionary("configuration").get(
131
			"utiliseRedirectionImage");
133
			"utiliseRedirectionImage");
132
			
134
			
133
			imageRedirectUrl = Dictionary.getDictionary("configuration").get(
135
			imageRedirectUrl = Dictionary.getDictionary("configuration").get(
134
			"imageRedirectUrl");
136
			"imageRedirectUrl");
135
			
137
			
136
			tailleMaxUpload = Dictionary.getDictionary("configuration").get(
138
			tailleMaxUpload = Dictionary.getDictionary("configuration").get(
137
			"tailleMaxUpload");
139
			"tailleMaxUpload");
138
			
140
			
139
			referentielsDispos = parserReferentielsDispos(Dictionary.getDictionary("configuration").get(
141
			referentielsDispos = parserReferentielsDispos(Dictionary.getDictionary("configuration").get(
140
					"referentielsDispos"));
142
					"referentielsDispos"));
141
			
143
			
142
			activerSaisieChampsEtendus = Dictionary.getDictionary("configuration").get(
144
			activerSaisieChampsEtendus = Dictionary.getDictionary("configuration").get(
143
			"activerSaisieChampsEtendus");
145
			"activerSaisieChampsEtendus");
144
			
146
			
145
			wikiDescriptionChampsEtendusPageUrl = Dictionary.getDictionary("configuration").get(
147
			wikiDescriptionChampsEtendusPageUrl = Dictionary.getDictionary("configuration").get(
146
			"wikiDescriptionChampsEtendusPageUrl");
148
			"wikiDescriptionChampsEtendusPageUrl");
147
			
149
			
148
			wikiDescriptionChampsEtendusRestUrl = Dictionary.getDictionary("configuration").get(
150
			wikiDescriptionChampsEtendusRestUrl = Dictionary.getDictionary("configuration").get(
149
			"wikiDescriptionChampsEtendusRestUrl");
151
			"wikiDescriptionChampsEtendusRestUrl");
150
			
152
			
151
			wikiDescriptionChampsEtendusRestUrlOptions = Dictionary.getDictionary("configuration").get(
153
			wikiDescriptionChampsEtendusRestUrlOptions = Dictionary.getDictionary("configuration").get(
152
			"wikiDescriptionChampsEtendusRestUrlOptions");
154
			"wikiDescriptionChampsEtendusRestUrlOptions");
153
			
155
			
154
			wikiDescriptionChampsEtendusUrlOptionsPageTpl = Dictionary.getDictionary("configuration").get(
156
			wikiDescriptionChampsEtendusUrlOptionsPageTpl = Dictionary.getDictionary("configuration").get(
155
			"wikiDescriptionChampsEtendusUrlOptionsPageTpl");
157
			"wikiDescriptionChampsEtendusUrlOptionsPageTpl");
156
			
158
			
157
			langueDefaut = Dictionary.getDictionary("configuration").get("langueDefaut");
159
			langueDefaut = Dictionary.getDictionary("configuration").get("langueDefaut");
158
			
160
			
159
			languesDisponibles = Dictionary.getDictionary("configuration").get("languesDisponibles");
161
			languesDisponibles = Dictionary.getDictionary("configuration").get("languesDisponibles");
-
 
162
			
-
 
163
			chorologieAvertissementCourriel = Dictionary.getDictionary("configuration").get("chorologieAvertissementCourriel");
160
			
164
				
161
			// Pour test, l'activation de l'ajout des champs étendus est activable ou désactivable par 
165
			// Pour test, l'activation de l'ajout des champs étendus est activable ou désactivable par 
162
			// l'url 
166
			// l'url 
163
			if(Location.getParameter("activerSaisieChampsEtendus") != null) {
167
			if(Location.getParameter("activerSaisieChampsEtendus") != null) {
164
				if(Location.getParameter("activerSaisieChampsEtendus").equals("1")) {
168
				if(Location.getParameter("activerSaisieChampsEtendus").equals("1")) {
165
					activerSaisieChampsEtendus = "1";
169
					activerSaisieChampsEtendus = "1";
166
				} else if(Location.getParameter("activerSaisieChampsEtendus").equals("0")) {
170
				} else if(Location.getParameter("activerSaisieChampsEtendus").equals("0")) {
167
					activerSaisieChampsEtendus = "0";
171
					activerSaisieChampsEtendus = "0";
168
				} 
172
				} 
169
			}
173
			}
170
	}
174
	}
171
	
175
	
172
	private List<InfosReferentielNom> parserReferentielsDispos(String chaineListeReferentiels) {
176
	private List<InfosReferentielNom> parserReferentielsDispos(String chaineListeReferentiels) {
173
		String[] tabReferentiels = chaineListeReferentiels.split(";");
177
		String[] tabReferentiels = chaineListeReferentiels.split(";");
174
		List<InfosReferentielNom> referentiels = new ArrayList<InfosReferentielNom>(tabReferentiels.length);
178
		List<InfosReferentielNom> referentiels = new ArrayList<InfosReferentielNom>(tabReferentiels.length);
175
		for (int i = 0; i < tabReferentiels.length; i++) {
179
		for (int i = 0; i < tabReferentiels.length; i++) {
176
			InfosReferentielNom infoRef = new InfosReferentielNom(tabReferentiels[i]);
180
			InfosReferentielNom infoRef = new InfosReferentielNom(tabReferentiels[i]);
177
			referentiels.add(infoRef);
181
			referentiels.add(infoRef);
178
		}
182
		}
179
		return referentiels;
183
		return referentiels;
180
	}
184
	}
181
 
185
 
182
	/**
186
	/**
183
	 * Accesseur pour l'url de base du serveur jrest
187
	 * Accesseur pour l'url de base du serveur jrest
184
	 * 
188
	 * 
185
	 * @return une url de la forme http://emplacement_serveur/jrest
189
	 * @return une url de la forme http://emplacement_serveur/jrest
186
	 */
190
	 */
187
	public static String getServiceBaseUrl() {
191
	public static String getServiceBaseUrl() {
188
		return serviceBaseUrl;
192
		return serviceBaseUrl;
189
	}
193
	}
190
	
194
	
191
	/**
195
	/**
192
	 * Accesseur pour l'url de base du suivi de bug
196
	 * Accesseur pour l'url de base du suivi de bug
193
	 * 
197
	 * 
194
	 * @return une url pointant vers le suivi des bugs
198
	 * @return une url pointant vers le suivi des bugs
195
	 */
199
	 */
196
	public static String getSuiviBugUrl() {
200
	public static String getSuiviBugUrl() {
197
		return suiviBugUrl;
201
		return suiviBugUrl;
198
	}
202
	}
199
	
203
	
200
	/**
204
	/**
201
	 * Accesseur pour l'url de base des images
205
	 * Accesseur pour l'url de base des images
202
	 * 
206
	 * 
203
	 * @return une url pointant vers la racine du dossier contenant les images
207
	 * @return une url pointant vers la racine du dossier contenant les images
204
	 */
208
	 */
205
	public static String getImageBaseUrl() {
209
	public static String getImageBaseUrl() {
206
		return imageBaseUrl ;
210
		return imageBaseUrl ;
207
	}
211
	}
208
	
212
	
209
	/**
213
	/**
210
	 * Accesseur pour l'url de base de l'aide
214
	 * Accesseur pour l'url de base de l'aide
211
	 * 
215
	 * 
212
	 * @return une url pointant vers la racine de l'aide
216
	 * @return une url pointant vers la racine de l'aide
213
	 */
217
	 */
214
	public static String getAideBaseUrl() {
218
	public static String getAideBaseUrl() {
215
		return aideBaseUrl ;
219
		return aideBaseUrl ;
216
	}
220
	}
217
	
221
	
218
	/**
222
	/**
219
	 * Accesseur pour l'url de base du widget de remarques
223
	 * Accesseur pour l'url de base du widget de remarques
220
	 * 
224
	 * 
221
	 * @return une url pointant vers la racine du widget (sans paramètres)
225
	 * @return une url pointant vers la racine du widget (sans paramètres)
222
	 */
226
	 */
223
	public static String getRemarquesBaseUrl() {
227
	public static String getRemarquesBaseUrl() {
224
		return remarquesBaseUrl;
228
		return remarquesBaseUrl;
225
	}
229
	}
226
	
230
	
227
	/**
231
	/**
228
	 * Accesseur pour le service de contact du carnet en ligne
232
	 * Accesseur pour le service de contact du carnet en ligne
229
	 * 
233
	 * 
230
	 * @return une chaine contenant le service de contact
234
	 * @return une chaine contenant le service de contact
231
	 */
235
	 */
232
	public static String getServiceContact() {
236
	public static String getServiceContact() {
233
		return serviceContact;
237
		return serviceContact;
234
	}
238
	}
235
	
239
	
236
	/**
240
	/**
237
	 * Accesseur pour le référentiel geo
241
	 * Accesseur pour le référentiel geo
238
	 * 
242
	 * 
239
	 * @return le référentiel geo
243
	 * @return le référentiel geo
240
	 */
244
	 */
241
	public static String getReferentielGeo() {
245
	public static String getReferentielGeo() {
242
		return referentielGeo ;
246
		return referentielGeo ;
243
	}
247
	}
244
	
248
	
245
	/**
249
	/**
246
	 * Accesseur pour la clé google maps
250
	 * Accesseur pour la clé google maps
247
	 * 
251
	 * 
248
	 * @return la clé google maps
252
	 * @return la clé google maps
249
	 */
253
	 */
250
	public static String getCleGoogleMaps() {
254
	public static String getCleGoogleMaps() {
251
		return cleGoogleMaps ;
255
		return cleGoogleMaps ;
252
	}
256
	}
253
 
257
 
254
	public static String getLienEfloreBaseUrl() {
258
	public static String getLienEfloreBaseUrl() {
255
		return lienEfloreBaseUrl;	
259
		return lienEfloreBaseUrl;	
256
	}
260
	}
257
	
261
	
258
	public static String getLicence() {
262
	public static String getLicence() {
259
		return licence;
263
		return licence;
260
	}
264
	}
261
	
265
	
262
	public static String getFormatOriginal() {
266
	public static String getFormatOriginal() {
263
		return formatOriginal;
267
		return formatOriginal;
264
	}
268
	}
265
	
269
	
266
	public static String getFormatZoom() {
270
	public static String getFormatZoom() {
267
		return formatZoom;
271
		return formatZoom;
268
	}
272
	}
269
	
273
	
270
	public static String getFormatGalerie() {
274
	public static String getFormatGalerie() {
271
		return formatGalerie;
275
		return formatGalerie;
272
	}
276
	}
273
	
277
	
274
	public static String getFormatListe() {
278
	public static String getFormatListe() {
275
		return formatListe;
279
		return formatListe;
276
	}
280
	}
277
 
281
 
278
	public static boolean utiliseRedirectionImages() {	
282
	public static boolean utiliseRedirectionImages() {	
279
		return utiliseRedirectionImage.equals("1");
283
		return utiliseRedirectionImage.equals("1");
280
	}
284
	}
281
 
285
 
282
	public static String getImageRedirectUrl() {		
286
	public static String getImageRedirectUrl() {		
283
		return imageRedirectUrl;	
287
		return imageRedirectUrl;	
284
	}
288
	}
285
	
289
	
286
	public static String getTailleMaxUpload() {
290
	public static String getTailleMaxUpload() {
287
		return tailleMaxUpload;
291
		return tailleMaxUpload;
288
	}
292
	}
289
	
293
	
290
	public static List<InfosReferentielNom> getReferentielsDispos() {
294
	public static List<InfosReferentielNom> getReferentielsDispos() {
291
		return referentielsDispos;
295
		return referentielsDispos;
292
	}
296
	}
293
	
297
	
294
	public static boolean saisieChampsEtendusActivee() {
298
	public static boolean saisieChampsEtendusActivee() {
295
		return activerSaisieChampsEtendus.equals("1");
299
		return activerSaisieChampsEtendus.equals("1");
296
	}
300
	}
297
	
301
	
298
	public static String getWikiDescriptionChampsEtendusPageUrl() {
302
	public static String getWikiDescriptionChampsEtendusPageUrl() {
299
		return wikiDescriptionChampsEtendusPageUrl;
303
		return wikiDescriptionChampsEtendusPageUrl;
300
	}
304
	}
301
	
305
	
302
	public static String getWikiDescriptionChampsEtendusRestUrl() {
306
	public static String getWikiDescriptionChampsEtendusRestUrl() {
303
		return wikiDescriptionChampsEtendusRestUrl;
307
		return wikiDescriptionChampsEtendusRestUrl;
304
	}
308
	}
305
	
309
	
306
	public static String getWikiDescriptionChampsEtendusUrlOptions() {
310
	public static String getWikiDescriptionChampsEtendusUrlOptions() {
307
		return wikiDescriptionChampsEtendusRestUrlOptions;
311
		return wikiDescriptionChampsEtendusRestUrlOptions;
308
	}
312
	}
309
	
313
	
310
	public static String getWikiDescriptionChampsEtendusUrlOptionsPageTpl() {
314
	public static String getWikiDescriptionChampsEtendusUrlOptionsPageTpl() {
311
		return wikiDescriptionChampsEtendusUrlOptionsPageTpl;
315
		return wikiDescriptionChampsEtendusUrlOptionsPageTpl;
312
	}
316
	}
313
	
317
	
314
	
318
	
315
	public static String getLangueDefaut() {
319
	public static String getLangueDefaut() {
316
		return langueDefaut;
320
		return langueDefaut;
317
	}
321
	}
318
	
322
	
319
	public static String getLanguesDisponibles() {
323
	public static String getLanguesDisponibles() {
320
		return languesDisponibles;
324
		return languesDisponibles;
321
	}
325
	}
-
 
326
	
-
 
327
	public static String getChorologieAvertissementCourriel() {
-
 
328
		return chorologieAvertissementCourriel;
-
 
329
	}
322
}
330
}