/*---------------- FILE HEADER --------------------------------------- This file is part of Geoide. Copyright (C) 2005-2006 by: IDgis B.V. http://www.idgis.nl This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact: Herman Assink IDgis bv P.O. Box 15 7450 AA Holten The Netherlands E-Mail: herman.assink@idgis.nl * @version 1.4.0 * @author IDgis team * ------------------------------------------------------------------------*/ import nl.idgis.giclient.gui.ContainerContent; import nl.idgis.giclient.io.SessionResponse; import nl.idgis.giclient.io.SessionResponseListener; import nl.idgis.giclient.io.XMLResponse; import nl.idgis.giclient.io.XMLResponseListener; import nl.idgis.giclient.util.XMLTools; import nl.idgis.giclient.util.Strings; import mx.controls.TextInput; import mx.utils.Delegate; class nl.idgis.giclient.gui.authenticationviewer.AuthenticationViewer extends ContainerContent/* implements SessionResponseListener, XMLResponseListener*/ { // private var currentUserText:String = null; //private var signOutText:String = null; /* function onLoad():Void { currentUserText = // "Huidige gebruiker: " ( Strings.getFile("Geoide").getString("CurrentUser")); signOutText = // "Afmelden"; ( Strings.getFile("Geoide").getString("LogOff")); drawAll(); } private function drawAll():Void { var textFormat:TextFormat = new TextFormat(); textFormat.font = "_sans"; textFormat.size = 10; createTextField("textField", 0, 0, 0, 120, 40); this["textField"].setNewTextFormat(textFormat); //TODO: autentication //this["textField"].text = currentUserText + ruler.getGIS().getGICapabilities().getAuthenticationUserName(); this["textField"].text = ""; attachMovie("Button", "button", 1, {_y: 40, label: signOutText}); this["button"].addEventListener("click", onClickButton); _parent.refreshPane(); } function onClickButton(eventObject:Object):Void { _parent.stopSession(); } private function stopSession():Void { var sessionResponse:SessionResponse = new SessionResponse(this); //sessionResponse.load(ruler.getGIClientConfig().getServerPath() + "sessionservlet"); } function onLoadSessionResponse(sessionResponse:SessionResponse):Void { var xmlResponse:XMLResponse = new XMLResponse(this, "request=StartSession"); //xmlResponse.setPath(ruler.getGIClientConfig().getServerPath()); xmlResponse.load(); } function onLoadXMLResponse(xmlResponse:XMLResponse):Void { var authenticationNode:XMLNode = XMLTools.getChild("Authentication", xmlResponse.firstChild); var authenticationUserName:String = XMLTools.getStringValue("UserName", authenticationNode); //if (authenticationUserName != ruler.getGIS().getGICapabilities().getAuthenticationUserName()) { //trace("RESET CAPABILITIES"); //} else { //trace("SAME USER"); //} }*/ private var currentAuthentication:Number; private var authentications:Array; private var callback:Function = null; private var usernameInput:TextInput = null; private var passwordInput:TextInput = null; private var title:TextField = null; function doLogin() { if(currentAuthentication < authentications.length) { title.text = authentications[currentAuthentication].getLoginTitle(); usernameInput.text = ""; passwordInput.text = ""; } else { callback(); frame.removeMovieClip(); } } function onLoginClicked():Void { authentications[currentAuthentication].setCredentials(usernameInput.text, passwordInput.text); currentAuthentication++; doLogin(); } function onLoad():Void { callback = frame.contentProperties["callback"]; authentications = frame.contentProperties["authentications"]; currentAuthentication = 0; moveTo(0, 0); lineTo(0, 10); var textFormat:TextFormat = new TextFormat(); textFormat.font = "_sans"; textFormat.size = 12; title = createTextField("title", getNextHighestDepth(), 25, 10, 500, 20); title.setNewTextFormat(textFormat); title.text = "$title$"; var username:TextField = createTextField("username", getNextHighestDepth(), 25, 35, 120, 20); username.setNewTextFormat(textFormat); username.text = "Username:"; usernameInput = TextInput(attachMovie("TextInput", "usernameInput", getNextHighestDepth(), {_x: 100, _y: 35, _width: 150})); var password:TextField = createTextField("password", getNextHighestDepth(), 25, 60, 120, 40); password.setNewTextFormat(textFormat); password.text = "Password:"; passwordInput = TextInput(attachMovie("TextInput", "passwordInput", getNextHighestDepth(), {_x: 100, _y: 60, _width: 150})); passwordInput.password = true; var loginButton:MovieClip = attachMovie("Button", "loginButton", this.getNextHighestDepth(), {_visible: true, _width: 100, _x: 90, _y: 95, label: "Login"}); loginButton.addEventListener("click", Delegate.create(this, onLoginClicked)); _parent.refreshPane(); doLogin(); } }