Subversion Repositories eFlore/Applications.cel

Rev

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

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