Subversion Repositories eFlore/Applications.cel

Rev

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

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