Subversion Repositories eFlore/Applications.cel

Rev

Rev 2636 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2636 Rev 2656
Line 13... Line 13...
13
 *    - Deconnexion : appel du service de deconnexion, et appel de la re-initialisation de l'affichage pour le nouvel identifiant utilisateur obtenu (identifiant  de session)
13
 *    - Deconnexion : appel du service de deconnexion, et appel de la re-initialisation de l'affichage pour le nouvel identifiant utilisateur obtenu (identifiant  de session)
14
 */
14
 */
Line 15... Line 15...
15
 
15
 
Line -... Line 16...
-
 
16
package org.tela_botanica.client.vues;
-
 
17
 
-
 
18
import java.util.Iterator;
16
package org.tela_botanica.client.vues;
19
import java.util.List;
17
 
20
 
18
import org.tela_botanica.client.CarnetEnLigneMediateur;
21
import org.tela_botanica.client.CarnetEnLigneMediateur;
Line -... Line 22...
-
 
22
import org.tela_botanica.client.i18n.Msg;
-
 
23
import org.tela_botanica.client.modeles.objets.Configuration;
19
import org.tela_botanica.client.i18n.Msg;
24
 
20
import org.tela_botanica.client.modeles.objets.Configuration;
25
import com.google.gwt.event.dom.client.ChangeEvent;
-
 
26
import com.google.gwt.event.dom.client.ChangeHandler;
-
 
27
import com.google.gwt.http.client.URL;
21
 
28
import com.google.gwt.user.client.Window;
22
import com.google.gwt.http.client.URL;
29
import com.google.gwt.user.client.ui.HTML;
23
import com.google.gwt.user.client.Window;
30
import com.google.gwt.user.client.ui.ListBox;
24
import com.gwtext.client.core.EventCallback;
31
import com.gwtext.client.core.EventCallback;
25
import com.gwtext.client.core.EventObject;
32
import com.gwtext.client.core.EventObject;
Line 45... Line 52...
45
	
52
	
46
  /**
53
  /**
47
   * Texte lié à la connexion.
54
   * Texte lié à la connexion.
48
   * 
55
   * 
49
   */
-
 
-
 
56
   */
50
  
57
  private HTML htmlEtatConnexion = new HTML();
Line -... Line 58...
-
 
58
  private String labelEtatConnexion = null;
-
 
59
  
51
  private String labelEtatConnexion = null;
60
  private ListBox listeLangues = null;
52
 
61
 
53
  /**
62
  /**
54
   * Ouh c'est pas beau, ça ! Mais avec Google Web Toolshit, ça
63
   * Ouh c'est pas beau, ça ! Mais avec Google Web Toolshit, ça
55
   * marche toujours mieux que quand on fait des trucs beaux :-)
64
   * marche toujours mieux que quand on fait des trucs beaux :-)
Line 77... Line 86...
77
    this.setId("panneau_etat_connexion");
86
    this.setId("panneau_etat_connexion");
Line 78... Line 87...
78
	
87
	
79
	// Pas de word wrap
88
	// Pas de word wrap
Line 80... Line 89...
80
	labelEtatConnexion="";
89
	labelEtatConnexion="";
Line -... Line 90...
-
 
90
	
-
 
91
	initialiserListeLangues();
-
 
92
	
Line 81... Line 93...
81
	
93
	this.add(listeLangues);
-
 
94
	htmlEtatConnexion.setHTML(labelEtatConnexion+liens);
Line -... Line 95...
-
 
95
	this.add(htmlEtatConnexion);
-
 
96
	
-
 
97
	ajouterListeners();	
-
 
98
  }
-
 
99
  
-
 
100
  private void initialiserListeLangues() {
-
 
101
	  listeLangues = new ListBox();
-
 
102
	  listeLangues.getElement().setId("liste_selection_langue");
-
 
103
	  List<String> languesDispos = Msg.getLanguesDisponibles();
-
 
104
	  int indexLangue = 0;
-
 
105
	  for (Iterator<String> iterator = languesDispos.iterator(); iterator.hasNext();) {
-
 
106
		  String langue = iterator.next();
-
 
107
		  listeLangues.addItem(Msg.get("intitule-langue", langue), langue);
-
 
108
		  if(langue.equals(Msg.getLangue())) {
Line -... Line 109...
-
 
109
			  listeLangues.setSelectedIndex(indexLangue);
-
 
110
		  }
-
 
111
		  indexLangue++;
-
 
112
	  }
-
 
113
  }
-
 
114
	
-
 
115
  private void ajouterListeners() {
-
 
116
	  listeLangues.addChangeHandler(new ChangeHandler() {	
-
 
117
		@Override
82
	this.setHtml(labelEtatConnexion+liens);
118
		public void onChange(ChangeEvent event) {
-
 
119
			int indexLangue = listeLangues.getSelectedIndex();
-
 
120
			String urlCourante = Window.Location.getHref();
Line 83... Line 121...
83
 
121
			String urlBase = urlCourante;
-
 
122
			if(urlCourante.contains("?")) {
-
 
123
				urlBase = urlCourante.substring(0, urlCourante.indexOf("?"));
Line 84... Line 124...
84
	
124
			}
85
	ajouterListeners();
125
			String urlLangue = urlBase+"?lang="+listeLangues.getValue(indexLangue);
86
	
126
			Window.Location.replace(urlLangue);
87
		
127
			
Line 122... Line 162...
122
						});
162
					  });
123
					}
163
				  }
124
				}
164
			  }
125
			});
165
		  });
126
		}
166
	  }
-
 
167
	  
-
 
168
	  
127
	}
169
  }
Line 128... Line 170...
128
 
170
 
129
/**
171
  /**
130
 * Affichage de l'etat de connexion
172
   * Affichage de l'etat de connexion
Line 138... Line 180...
138
		labelEtatConnexion = "<div id=\"etatConnexion\">"+Msg.get("connecte-en-tant-que", params)+" <a id=\"lienDeconnexion\" href=\"#\">("+Msg.get("deconnexion")+")</a>" ;
180
		  labelEtatConnexion = "<div id=\"etatConnexion\">"+Msg.get("connecte-en-tant-que", params)+" <a id=\"lienDeconnexion\" href=\"#\">("+Msg.get("deconnexion")+")</a>" ;
139
		labelEtatConnexion += "</div>" ;
181
		  labelEtatConnexion += "</div>" ;
Line 140... Line 182...
140
		
182
 
141
		
183
 
Line 142... Line 184...
142
		labelEtatConnexion += liens ;
184
		  labelEtatConnexion += liens ;
143
		setHtml(labelEtatConnexion);
185
		  htmlEtatConnexion.setHTML(labelEtatConnexion);
144
 
186
 
145
		ExtElement lienDeco = Ext.get("lienDeconnexion");
187
		  ExtElement lienDeco = Ext.get("lienDeconnexion");
Line 178... Line 220...
178
	}
220
	  }
179
	else
221
	  else
180
	{
222
	  {
181
		labelEtatConnexion = "<div id=\"etatConnexion\"> "+Msg.get("cel-utilisation")+", <a id=\"lienConnexion\" href=\"#\">"+Msg.get("identifiez-vous")+"</a> "+Msg.get("pour-transmettre-tela")+"</div>";
223
		  labelEtatConnexion = "<div id=\"etatConnexion\"> "+Msg.get("cel-utilisation")+", <a id=\"lienConnexion\" href=\"#\">"+Msg.get("identifiez-vous")+"</a> "+Msg.get("pour-transmettre-tela")+"</div>";
182
		labelEtatConnexion += liens ;
224
		  labelEtatConnexion += liens ;
183
		setHtml(labelEtatConnexion);
225
		  htmlEtatConnexion.setHTML(labelEtatConnexion);
184
		ExtElement lienCo = Ext.get("etatConnexion");
226
		  ExtElement lienCo = Ext.get("etatConnexion");
185
		if(lienCo != null) {
227
		  if(lienCo != null) {
186
			lienCo.addListener("click", new EventCallback() {
228
			  lienCo.addListener("click", new EventCallback() {
Line 187... Line 229...
187
 
229