Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1940 Rev 1966
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.List;
5
import java.util.List;
6
import java.util.Map;
6
import java.util.Map;
7
 
7
 
8
import com.google.gwt.i18n.client.Dictionary;
8
import com.google.gwt.i18n.client.Dictionary;
9
import com.google.gwt.user.client.Window;
9
import com.google.gwt.user.client.Window;
-
 
10
import com.google.gwt.user.client.Window.Location;
10
 
11
 
11
/**
12
/**
12
 * Classe chargeant certains paramètres de configuration à partir d'un fichier
13
 * Classe chargeant certains paramètres de configuration à partir d'un fichier
13
 * javascript (config.js)
14
 * javascript (config.js)
14
 * 
15
 * 
15
 * @author aurelien
16
 * @author aurelien
16
 * 
17
 * 
17
 */
18
 */
18
public class Configuration {
19
public class Configuration {
19
 
20
 
20
	/**
21
	/**
21
	 * L'url de base du serveur jrest
22
	 * L'url de base du serveur jrest
22
	 */
23
	 */
23
	private static String serviceBaseUrl;
24
	private static String serviceBaseUrl;
24
 
25
 
25
	private static String imageBaseUrl;
26
	private static String imageBaseUrl;
26
	
27
	
27
	private static String suiviBugUrl ;
28
	private static String suiviBugUrl ;
28
	
29
	
29
	private static String aideBaseUrl ;
30
	private static String aideBaseUrl ;
30
	
31
	
31
	private static String emailContact;
32
	private static String emailContact;
32
	
33
	
33
	private static String referentielGeo ;
34
	private static String referentielGeo ;
34
	
35
	
35
	private static String cleGoogleMaps ;
36
	private static String cleGoogleMaps ;
36
 
37
 
37
	private static String lienEfloreBaseUrl;
38
	private static String lienEfloreBaseUrl;
38
	
39
	
39
	private static String refTax;
40
	private static String refTax;
40
	
41
	
41
	private static String refTaxVersion;
42
	private static String refTaxVersion;
42
	
43
	
43
	private static String licence ="";
44
	private static String licence ="";
44
	
45
	
45
	private static String formatOriginal = "";
46
	private static String formatOriginal = "";
46
	
47
	
47
	private static String formatZoom = "";
48
	private static String formatZoom = "";
48
	
49
	
49
	private static String formatGalerie = "";
50
	private static String formatGalerie = "";
50
	
51
	
51
	private static String formatListe = "";
52
	private static String formatListe = "";
52
 
53
 
53
	private static String utiliseRedirectionImage;
54
	private static String utiliseRedirectionImage;
54
 
55
 
55
	private static String imageRedirectUrl;
56
	private static String imageRedirectUrl;
56
	
57
	
57
	private static String tailleMaxUpload;
58
	private static String tailleMaxUpload;
58
	
59
	
59
	private static List<InfosReferentielNom> referentielsDispos; 
60
	private static List<InfosReferentielNom> referentielsDispos; 
60
	
61
	
61
	private static String activerSaisieChampsEtendus = "0";
62
	private static String activerSaisieChampsEtendus = "0";
62
 
63
 
63
	/**
64
	/**
64
	 * Constructeur sans argument
65
	 * Constructeur sans argument
65
	 */
66
	 */
66
	public Configuration() {
67
	public Configuration() {
67
		// on utilise le dictionnaire d'internationalisation pour lire les
68
		// on utilise le dictionnaire d'internationalisation pour lire les
68
		// variables du fichier javascript
69
		// variables du fichier javascript
69
		
70
		
70
		//if(GWT.isScript()) {
71
		//if(GWT.isScript()) {
71
			serviceBaseUrl = Dictionary.getDictionary("configuration").get(
72
			serviceBaseUrl = Dictionary.getDictionary("configuration").get(
72
					"serviceBaseUrl");
73
					"serviceBaseUrl");
73
			
74
			
74
			emailContact = Dictionary.getDictionary("configuration").get(
75
			emailContact = Dictionary.getDictionary("configuration").get(
75
			"emailContact");
76
			"emailContact");
76
			
77
			
77
			suiviBugUrl = Dictionary.getDictionary("configuration").get(
78
			suiviBugUrl = Dictionary.getDictionary("configuration").get(
78
			"suiviBugUrl");
79
			"suiviBugUrl");
79
			
80
			
80
			imageBaseUrl = Dictionary.getDictionary("configuration").get(
81
			imageBaseUrl = Dictionary.getDictionary("configuration").get(
81
			"imageBaseUrl");
82
			"imageBaseUrl");
82
			
83
			
83
			aideBaseUrl = Dictionary.getDictionary("configuration").get(
84
			aideBaseUrl = Dictionary.getDictionary("configuration").get(
84
			"aideBaseUrl");
85
			"aideBaseUrl");
85
			
86
			
86
			referentielGeo = Dictionary.getDictionary("configuration").get(
87
			referentielGeo = Dictionary.getDictionary("configuration").get(
87
			"referentielGeo");
88
			"referentielGeo");
88
			
89
			
89
			cleGoogleMaps = Dictionary.getDictionary("configuration").get(
90
			cleGoogleMaps = Dictionary.getDictionary("configuration").get(
90
			"cleGoogleMaps");
91
			"cleGoogleMaps");
91
			
92
			
92
			lienEfloreBaseUrl = Dictionary.getDictionary("configuration").get(
93
			lienEfloreBaseUrl = Dictionary.getDictionary("configuration").get(
93
			"lienEfloreBaseUrl");
94
			"lienEfloreBaseUrl");
94
			
95
			
95
			formatOriginal = Dictionary.getDictionary("configuration").get(
96
			formatOriginal = Dictionary.getDictionary("configuration").get(
96
			"formatOriginal");
97
			"formatOriginal");
97
			
98
			
98
			formatZoom = Dictionary.getDictionary("configuration").get(
99
			formatZoom = Dictionary.getDictionary("configuration").get(
99
			"formatZoom");
100
			"formatZoom");
100
			
101
			
101
			formatGalerie = Dictionary.getDictionary("configuration").get(
102
			formatGalerie = Dictionary.getDictionary("configuration").get(
102
			"formatGalerie");
103
			"formatGalerie");
103
			
104
			
104
			formatListe = Dictionary.getDictionary("configuration").get(
105
			formatListe = Dictionary.getDictionary("configuration").get(
105
			"formatListe");
106
			"formatListe");
106
			
107
			
107
			utiliseRedirectionImage = Dictionary.getDictionary("configuration").get(
108
			utiliseRedirectionImage = Dictionary.getDictionary("configuration").get(
108
			"utiliseRedirectionImage");
109
			"utiliseRedirectionImage");
109
			
110
			
110
			imageRedirectUrl = Dictionary.getDictionary("configuration").get(
111
			imageRedirectUrl = Dictionary.getDictionary("configuration").get(
111
			"imageRedirectUrl");
112
			"imageRedirectUrl");
112
			
113
			
113
			tailleMaxUpload = Dictionary.getDictionary("configuration").get(
114
			tailleMaxUpload = Dictionary.getDictionary("configuration").get(
114
			"tailleMaxUpload");
115
			"tailleMaxUpload");
115
			
116
			
116
			referentielsDispos = parserReferentielsDispos(Dictionary.getDictionary("configuration").get(
117
			referentielsDispos = parserReferentielsDispos(Dictionary.getDictionary("configuration").get(
117
					"referentielsDispos"));
118
					"referentielsDispos"));
118
			
119
			
119
			activerSaisieChampsEtendus = Dictionary.getDictionary("configuration").get(
120
			activerSaisieChampsEtendus = Dictionary.getDictionary("configuration").get(
120
			"activerSaisieChampsEtendus");
121
			"activerSaisieChampsEtendus");
-
 
122
			
-
 
123
			// Pour test, l'activation de l'ajout des champs étendus est activable ou désactivable par 
-
 
124
			// l'url 
-
 
125
			if(Location.getParameter("activerSaisieChampsEtendus") != null) {
-
 
126
				if(Location.getParameter("activerSaisieChampsEtendus").equals("1")) {
-
 
127
					activerSaisieChampsEtendus = "1";
-
 
128
				} else if(Location.getParameter("activerSaisieChampsEtendus").equals("0")) {
-
 
129
					activerSaisieChampsEtendus = "0";
-
 
130
				} 
-
 
131
			}
121
	}
132
	}
122
	
133
	
123
	private List<InfosReferentielNom> parserReferentielsDispos(String chaineListeReferentiels) {
134
	private List<InfosReferentielNom> parserReferentielsDispos(String chaineListeReferentiels) {
124
		String[] tabReferentiels = chaineListeReferentiels.split(";");
135
		String[] tabReferentiels = chaineListeReferentiels.split(";");
125
		List<InfosReferentielNom> referentiels = new ArrayList<InfosReferentielNom>(tabReferentiels.length);
136
		List<InfosReferentielNom> referentiels = new ArrayList<InfosReferentielNom>(tabReferentiels.length);
126
		for (int i = 0; i < tabReferentiels.length; i++) {
137
		for (int i = 0; i < tabReferentiels.length; i++) {
127
			InfosReferentielNom infoRef = new InfosReferentielNom(tabReferentiels[i]);
138
			InfosReferentielNom infoRef = new InfosReferentielNom(tabReferentiels[i]);
128
			referentiels.add(infoRef);
139
			referentiels.add(infoRef);
129
		}
140
		}
130
		return referentiels;
141
		return referentiels;
131
	}
142
	}
132
 
143
 
133
	/**
144
	/**
134
	 * Accesseur pour l'url de base du serveur jrest
145
	 * Accesseur pour l'url de base du serveur jrest
135
	 * 
146
	 * 
136
	 * @return une url de la forme http://emplacement_serveur/jrest
147
	 * @return une url de la forme http://emplacement_serveur/jrest
137
	 */
148
	 */
138
	public static String getServiceBaseUrl() {
149
	public static String getServiceBaseUrl() {
139
		return serviceBaseUrl;
150
		return serviceBaseUrl;
140
	}
151
	}
141
	
152
	
142
	/**
153
	/**
143
	 * Accesseur pour l'url de base du suivi de bug
154
	 * Accesseur pour l'url de base du suivi de bug
144
	 * 
155
	 * 
145
	 * @return une url pointant vers le suivi des bugs
156
	 * @return une url pointant vers le suivi des bugs
146
	 */
157
	 */
147
	public static String getSuiviBugUrl() {
158
	public static String getSuiviBugUrl() {
148
		return suiviBugUrl;
159
		return suiviBugUrl;
149
	}
160
	}
150
	
161
	
151
	/**
162
	/**
152
	 * Accesseur pour l'url de base des images
163
	 * Accesseur pour l'url de base des images
153
	 * 
164
	 * 
154
	 * @return une url pointant vers la racine du dossier contenant les images
165
	 * @return une url pointant vers la racine du dossier contenant les images
155
	 */
166
	 */
156
	public static String getImageBaseUrl() {
167
	public static String getImageBaseUrl() {
157
		return imageBaseUrl ;
168
		return imageBaseUrl ;
158
	}
169
	}
159
	
170
	
160
	/**
171
	/**
161
	 * Accesseur pour l'url de base de l'aide
172
	 * Accesseur pour l'url de base de l'aide
162
	 * 
173
	 * 
163
	 * @return une url pointant vers la racine de l'aide
174
	 * @return une url pointant vers la racine de l'aide
164
	 */
175
	 */
165
	public static String getAideBaseUrl() {
176
	public static String getAideBaseUrl() {
166
		return aideBaseUrl ;
177
		return aideBaseUrl ;
167
	}
178
	}
168
	
179
	
169
	/**
180
	/**
170
	 * Accesseur pour l'email de contact du carnet en ligne
181
	 * Accesseur pour l'email de contact du carnet en ligne
171
	 * 
182
	 * 
172
	 * @return une chaine contenant l'email de contact
183
	 * @return une chaine contenant l'email de contact
173
	 */
184
	 */
174
	public static String getEmailContact() {
185
	public static String getEmailContact() {
175
		return emailContact;
186
		return emailContact;
176
	}
187
	}
177
	
188
	
178
	/**
189
	/**
179
	 * Accesseur pour le référentiel geo
190
	 * Accesseur pour le référentiel geo
180
	 * 
191
	 * 
181
	 * @return le référentiel geo
192
	 * @return le référentiel geo
182
	 */
193
	 */
183
	public static String getReferentielGeo() {
194
	public static String getReferentielGeo() {
184
		return referentielGeo ;
195
		return referentielGeo ;
185
	}
196
	}
186
	
197
	
187
	/**
198
	/**
188
	 * Accesseur pour la clé google maps
199
	 * Accesseur pour la clé google maps
189
	 * 
200
	 * 
190
	 * @return la clé google maps
201
	 * @return la clé google maps
191
	 */
202
	 */
192
	public static String getCleGoogleMaps() {
203
	public static String getCleGoogleMaps() {
193
		return cleGoogleMaps ;
204
		return cleGoogleMaps ;
194
	}
205
	}
195
 
206
 
196
	public static String getLienEfloreBaseUrl() {
207
	public static String getLienEfloreBaseUrl() {
197
		return lienEfloreBaseUrl;	
208
		return lienEfloreBaseUrl;	
198
	}
209
	}
199
	
210
	
200
	public static String getLicence() {
211
	public static String getLicence() {
201
		return licence;
212
		return licence;
202
	}
213
	}
203
	
214
	
204
	public static String getFormatOriginal() {
215
	public static String getFormatOriginal() {
205
		return formatOriginal;
216
		return formatOriginal;
206
	}
217
	}
207
	
218
	
208
	public static String getFormatZoom() {
219
	public static String getFormatZoom() {
209
		return formatZoom;
220
		return formatZoom;
210
	}
221
	}
211
	
222
	
212
	public static String getFormatGalerie() {
223
	public static String getFormatGalerie() {
213
		return formatGalerie;
224
		return formatGalerie;
214
	}
225
	}
215
	
226
	
216
	public static String getFormatListe() {
227
	public static String getFormatListe() {
217
		return formatListe;
228
		return formatListe;
218
	}
229
	}
219
 
230
 
220
	public static boolean utiliseRedirectionImages() {	
231
	public static boolean utiliseRedirectionImages() {	
221
		return utiliseRedirectionImage.equals("1");
232
		return utiliseRedirectionImage.equals("1");
222
	}
233
	}
223
 
234
 
224
	public static String getImageRedirectUrl() {		
235
	public static String getImageRedirectUrl() {		
225
		return imageRedirectUrl;	
236
		return imageRedirectUrl;	
226
	}
237
	}
227
	
238
	
228
	public static String getTailleMaxUpload() {
239
	public static String getTailleMaxUpload() {
229
		return tailleMaxUpload;
240
		return tailleMaxUpload;
230
	}
241
	}
231
	
242
	
232
	public static List<InfosReferentielNom> getReferentielsDispos() {
243
	public static List<InfosReferentielNom> getReferentielsDispos() {
233
		return referentielsDispos;
244
		return referentielsDispos;
234
	}
245
	}
235
	
246
	
236
	public static boolean saisieChampsEtendusActivee() {
247
	public static boolean saisieChampsEtendusActivee() {
237
		return activerSaisieChampsEtendus.equals("1");
248
		return activerSaisieChampsEtendus.equals("1");
238
	}
249
	}
239
}
250
}