Subversion Repositories eFlore/Applications.cel

Rev

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

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