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