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