Select to view content in your preferred language

Login Screen for the Flexviewer

37026
121
03-15-2011 10:52 AM
andrewj_ca
Frequent Contributor
Just posted some code for a Flexviewer login screen.  I hope somebody can get some use from this.

http://www.arcgis.com/home/item.html?id=baebcaf317994d63902bc9735c0657e0
Tags (2)
0 Kudos
121 Replies
WillHughes1
Frequent Contributor
Can someone post the process for implementing this capability?

I replaced the index.mxml file with modified URL reference to the ../ArcGIS_Security/Service.asmx?WSDL";

I am confused as to where the user/pwd is stored. Is it in the index.mxml file? username and password OR is it in the ArcGIS_Security/sites/users.xml file?

I get the login screen to show up but when I enter in the username and password I get an "internal database error."

Can someone help?
Thanks.

Will
0 Kudos
andrewj_ca
Frequent Contributor
wthughes

I have a gmail account, email me and I'll send a contact number.  I'm eastern standard time and leaving for the day but we should be able to connect tomorrow.
0 Kudos
WillHughes1
Frequent Contributor
Actually I figured it out. The problem was that I needed to convert the ArcGIS_Security folder to an application in IIS.
Thanks.
Great work here. Very useful.

Will
0 Kudos
StanMcShinsky
Frequent Contributor
Actually I figured it out. The problem was that I needed to convert the ArcGIS_Security folder to an application in IIS.


That was the piece I was missing. I had to Google how to do that, but it was easy once Will posted that above. Thanks.

Thanks for the login widget Andrew.

-Stan
0 Kudos
MarkYerington
Frequent Contributor
How do I add users to the users.xml
0 Kudos
MarkYerington
Frequent Contributor
Never mind I figured the users out, but how do i get the siteUsage.log to work.
0 Kudos
AdiKurniawan
Emerging Contributor
dear all, especially to Mr. Andrew, thank's for share this code.

I'm newbie in ArcGIS Flexviewer.
I Have a little problem to use this code.
How do use this code (step by step to compile this code in Adobe Flash Builder)?

Any body can help me?

FYI, I use Flexviewer 2.2 and Flash Builder 4

Thank You.
0 Kudos
PetrTrefil
Deactivated User
Just posted some code for a Flexviewer login screen.  I hope somebody can get some use from this.

http://www.arcgis.com/home/item.html?id=baebcaf317994d63902bc9735c0657e0



Hi, Andrew,
please, can You give me advice, how to practicaly implement code for login screen i FlexViewer. We use Flex 1.3. I dowloaded source code, but I am not programmer, so I don´t know what next to do.
I would like users have to login before Flex app start. List of users and their passwords could be in sites\users.xml.
Thanks  Petr
0 Kudos
PetrTrefil
Deactivated User
Code has been upated to include a sample asp web service for user validiation.  Please remember to specify from URL in the index.mxml file.  It currently says 'localhost'.  Cheers


Hi,
content of me actual index.html in Flex 1.3 is :
<?xml version="1.0" encoding="utf-8"?>
<!--
////////////////////////////////////////////////////////////////////////////////
//
//  ESRI, Inc
//  Copyright 2008 ESRI, Inc
//  All Rights Reserved.
//
//  NOTICE: ESRI permits you to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
preloader = "preloaders.Preloader_1"
preloader = "preloaders.MyDownloadProgressBar"
preloader = "preloaders.CustomPreloader"
preloader = "mx.preloaders.DownloadProgressBar"
-->
<mx:Application xmlns:mx   ="http://www.adobe.com/2006/mxml"
             xmlns    ="com.esri.solutions.flexviewer.*"
             layout    ="absolute"
             applicationComplete ="registerGlobalKeyHandler()"
             styleName   ="plain"
             backgroundColor  ="#6E6E6E"
    preloader   ="preloaders.CustomPreloader">

<!--
/**
* The site container has six major components:
*  - ConfigManager: loads configuration file (config.xml), parse it and submit to event bus.
*  - Controller   : holds branding UI elements and application navigation items such as menus.
*  - DataManager  : manages data generated during a user session.
*  - WidgetManager: manages widgets during the user session.
*  - MapManager   : manages map(s) such as base map and live maps used during the user session.
*/
-->

<mx:Script>
  <![CDATA[
   import com.esri.solutions.flexviewer.components.Banner;
   import com.esri.solutions.flexviewer.AppEvent; 
   import mx.managers.IDragManager;
   import mx.managers.HistoryManager;
   import com.esri.ags.layers.Layer;

   private var iDragManager:IDragManager;
   private var hist:HistoryManager;
  
   [Bindable]
   public static var rozhod:Boolean = false;
   [Bindable]
   public static var hod:Number = NaN;
   [Bindable]
   public static var sirka:Number = 250;
   [Bindable]
   public static var vyska:Number = 50;
   [Bindable]
   public static var slider_tip:String = "Prolínání mapových d�?l";

   private function faderFade(evt:Event):void
      {
    var lyr:Layer = SiteContainer.getInstance().controller.map.getLayer("Základní mapa");
       var lyr2:Layer = SiteContainer.getInstance().controller.map.getLayer("Ortofoto mapa");
       lyr.visible = true;
       lyr2.visible = true;
       lyr.alpha = (1 - fader.value);
       lyr2.alpha = fader.value;
      }
   public static function faderReset(evt:Event):void
      {
    var lyr:Layer = SiteContainer.getInstance().controller.map.getLayer("Základní mapa");
       var lyr2:Layer = SiteContainer.getInstance().controller.map.getLayer("Ortofoto mapa");
       lyr.visible = true;
       lyr2.visible = false;
       lyr.alpha = 1;
       lyr2.alpha = 0;
    hod = NaN;
    hod = 0;
      }
   public static function faderSat(evt:Event):void
      {
    var lyr:Layer = SiteContainer.getInstance().controller.map.getLayer("Základní mapa");
       var lyr2:Layer = SiteContainer.getInstance().controller.map.getLayer("Ortofoto mapa");
       lyr.visible = false;
       lyr2.visible = true;
       lyr.alpha = 0;
       lyr2.alpha = 1;
    hod = NaN;
    hod = 1;
      }

   private function registerGlobalKeyHandler() :void
   {
    stage.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown);
   
   }
  
 
   private function handleKeyDown(event:KeyboardEvent) :void
   {
    if ((event.shiftKey) && (event.keyCode == 27))
    {
     SiteContainer.dispatchEvent(new AppEvent(AppEvent.SET_MAP_NAVIGATION, false, false, null));
    }
   }

  ]]>
</mx:Script>

<SiteContainer id="container" backgroundColor="#FFFFFF">
    <configManager> <ConfigManager/> </configManager>
       <uiManager>     <UIManager/>     </uiManager>
       <controller>    <Controller x="20" y="20"/>    </controller>
       <dataManager>   <DataManager/>   </dataManager>
       <widgetManager> <WidgetManagerDocked/> </widgetManager>
       <mapManager>    <MapManager/> </mapManager>
</SiteContainer>

    <mx:Number id="HORIZONTAL_MAX">
        {int((container.width - canvas.width) / 2)}
    </mx:Number>
    <mx:Number id="Z_value">
        {int(100-(fader.value*100))}
    </mx:Number>
    <mx:Number id="S_value">
        {int(fader.value*100)}
    </mx:Number>


<!-- <mx:Canvas width="25" x="20" bottom="75" height="145" styleName="WidgetCanvas" toolTip="Prolínání mapových d�?l">
       <mx:VSlider dataTipOffset="-60" tickLength="3" tickOffset="-1" id="fader" x="2" y="20" width="20" height="100" minimum="0" maximum="1"  snapInterval="0.05" liveDragging="true" allowTrackClick="true" enabled="true" change="faderFade(event)" value="0" showTrackHighlight="false" invertThumbDirection="true"/>
       <mx:TextArea toolTip="Satelitní mapa" borderStyle="none" backgroundAlpha="0" selectable="false" editable="false" textAlign="left" text="S" x="6" y="5" width="20" height="20"></mx:TextArea>
       <mx:TextArea toolTip="Základní mapa" borderStyle="none" backgroundAlpha="0" selectable="false" editable="false" text="Z" x="6" bottom="2" width="20" height="20"></mx:TextArea>
    </mx:Canvas> -->

<mx:Canvas id="canvas" visible="true" width="{sirka}" bottom="15" height="{vyska}" left="{HORIZONTAL_MAX}" styleName="WidgetCanvas" toolTip="Prolínání mapových d�?l"> <!--Pokud bych cht�?l skovávat celý canvas a ne jenom disablovat HSlider musel bych nastavit visible="{rozhod}"-->
       <mx:HSlider toolTip="{slider_tip}" visible="{rozhod}" showDataTip="false" tickLength="3" tickOffset="-1" id="fader" x="75" y="5" width="100" height="20" minimum="0" maximum="1"  snapInterval="0.02" liveDragging="true" allowTrackClick="true" enabled="{rozhod}" change="faderFade(event)" value="{hod}" showTrackHighlight="false" invertThumbDirection="false"/>

<!--       <mx:TextArea toolTip="Základní mapa" borderStyle="none" backgroundAlpha="0" selectable="false" editable="false" textAlign="right" text="Základní" x="5" y="6" width="65" height="20"></mx:TextArea> -->
       <mx:Button fillColors="#777777, #333333, #999999, #333333" color="#ffffff" textRollOverColor="#ffffff" themeColor="#666666" visible="{rozhod}" id="butZ" toolTip="Základní mapa" enabled="{rozhod}" textAlign="center" click="faderReset(event)" label="ZM" x="5" y="6" width="65" height="20"/>
       <mx:TextArea toolTip="Základní mapa" visible="{rozhod}" borderStyle="none" backgroundAlpha="0" selectable="false" editable="false" textAlign="center" text="{Z_value} %" x="5" y="26" width="65" height="20"></mx:TextArea>

<!--       <mx:TextArea toolTip="Satelitní mapa" borderStyle="none" backgroundAlpha="0" selectable="false" editable="false" text="Satelitní" x="180" y="6"  width="65" height="20"></mx:TextArea> -->
       <mx:Button fillColors="#777777, #333333, #999999, #333333" color="#ffffff" textRollOverColor="#ffffff" themeColor="#666666" visible="{rozhod}" id="butS" toolTip="Satelitní mapa" enabled="{rozhod}" textAlign="center" click="faderSat(event)" label="OM" x="180" y="6" width="65" height="20"/>
       <mx:TextArea toolTip="Ortofoto mapa" visible="{rozhod}" borderStyle="none" backgroundAlpha="0" selectable="false" editable="false" textAlign="center" text="{S_value} %" x="180" y="26"  width="65" height="20"></mx:TextArea>

       <mx:TextArea toolTip="Aktuální m�?�?ítko" borderStyle="none" backgroundAlpha="0" selectable="false" editable="false" textAlign="center" text="{Banner.mapscale}" x="75" y="25"  width="100" height="20"></mx:TextArea> <!-- x="75" y="25" -->

<!--       <mx:TextArea toolTip="Satelitní mapa" borderStyle="none" backgroundAlpha="0" selectable="false" editable="false" text="Satelitní" x="180" y="6"  width="65" height="20"></mx:TextArea> -->
</mx:Canvas>

</mx:Application>


I suppose that is necessary to change some part with code from your  index.html.
But I don't know what parts.
Thank for your help.

Petr
0 Kudos
NathanRobbins
Emerging Contributor
Hi, Andrew,
please, can You give me advice, how to practicaly implement code for login screen i FlexViewer. We use Flex 1.3. I dowloaded source code, but I am not programmer, so I don´t know what next to do.
I would like users have to login before Flex app start. List of users and their passwords could be in sites\users.xml.
Thanks  Petr


I am also trying to get this working and I am not a programmer. I have Adobe Flex 3 and I have copied the index.mxml file into my src folder and built the application. I also copied the ArcGIS_Security folder into my root application folder. I noticed someone said you had to copy this to asp. Not sure how to do that. Any help would be appreciated. Thanks, Nathan
0 Kudos