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