<commit_before><?xml version="1.0" encoding="utf-8"?>
<!--
/*
    Weave (Web-based Analysis and Visualization Environment)
    Copyright (C) 2008-2011 University of Massachusetts Lowell

    This file is a part of Weave.

    Weave is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License, Version 3,
    as published by the Free Software Foundation.

    Weave 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Weave.  If not, see <http://www.gnu.org/licenses/>.
*/
-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#7B96B6" creationComplete="handleCreationComplete()" creationPolicy="all" xmlns:managers="weave.ui.admin.managers.*" xmlns:admin="weave.ui.admin.*" xmlns:ui="weave.ui.*">
	<mx:Panel
		headerHeight="25"
		title="Administration Console for Weave {version}"
		width="100%"
		height="100%"
		borderAlpha="0.5" backgroundColor="#DBDBDB" cornerRadius="0"
		bottom="10" top="10" right="10" left="10"
		paddingLeft="8" paddingRight="8" paddingTop="8" paddingBottom="8">
		<mx:ViewStack width="100%" height="100%" selectedIndex="{AdminInterface.instance.userHasAuthenticated ? 0 : (AdminInterface.instance.sqlConfigExists ? 1 : 2)}">
			<mx:VBox width="100%" height="100%">
				<mx:HBox width="100%">
					<!--mx:Button label="Import SQL data..." click="WizardPanel.createWizard(this, new SQLImportWizard())" toolTip="open dialog with wizard to import data from existing sql"/-->
					<mx:Button label="Import existing SQL data..." click="WizardPanel.createWizard(this, new SQLImportWizard())" toolTip="{Strings.tip_import_sql_data}"/>
					<mx:Button label="Import CSV data..." click="WizardPanel.createWizard(this, new CSVImportWizard())" toolTip="{Strings.tip_import_csv_data}"/>
					<mx:Button label="Import SHP and DBF data..." click="WizardPanel.createWizard(this, new SHPImportWizard())" toolTip="{Strings.tip_import_shp_and_dbf}"/>
					<ui:CustomVRule/>
					<mx:Button label="Open Weave" click="AdminInterface.instance.openWeavePopup();" toolTip="This will open Weave in a new browser window which allows you to save a new client configuration."/>
					<mx:Spacer width="100%"/>
					<mx:Label text="{'Signed in as: ' + AdminInterface.instance.activeConnectionName}" textAlign="right"/>
					<mx:Button label="Sign out" enabled="{AdminInterface.instance.sqlConfigExists == true}"
							   click="AdminInterface.instance.activeConnectionName = AdminInterface.instance.activePassword = '';"/>
				</mx:HBox>
				<mx:HRule width="100%"/>
				<mx:VDividedBox width="100%" height="100%" >
					<mx:TabNavigator id="tabNavigator" width="100%" height="100%" paddingBottom="8" paddingLeft="8" paddingRight="8" paddingTop="8" fontSize="10">
						<managers:ClientConfigurationManager id="clientConfig"/>
						<managers:DataTableManager/>
						<managers:GeometryCollectionManager/>
						<managers:SQLConnectionManager id="sqlConnectionManager"/>
					</mx:TabNavigator>
					<mx:TextArea width="100%" height="0%" id="messageTextArea" editable="false"/>
				</mx:VDividedBox>
			</mx:VBox>
			
			<mx:Box horizontalAlign="center" verticalAlign="middle" show="login.connectionInput.setFocus()">
				<admin:LoginPopup id="login"/>
			</mx:Box>
			
			<mx:VBox show="Alert.show(firstTimeTextArea.text, 'First time setup'); AdminInterface.instance.getConnectionNames();">
				<ui:AutoResizingTextArea id="firstTimeTextArea" text="Before you can continue, you must set up at least one database connection and specify where to store Weave configuration information." editable="false" wordWrap="true" width="100%" backgroundAlpha="0" borderStyle="none" selectable="false"/>
				<managers:SQLConnectionManager/>
			</mx:VBox>
		</mx:ViewStack>
	</mx:Panel>
	
	<!--
	<mx:VRule width="25" height="17"/>
	<mx:Button label="Import Connection(s)..." click="openImportDialog()" toolTip="open dialog with wizard to import  existing connections say to data commons, other servers, etc"/>
	<mx:VRule width="25" height="17"/>
	<mx:Button label="Load Configuration..." toolTip="would open dialog to load saved settings for the admin console (preferences)"/>
	<mx:Button label="Save Configuration..." toolTip="would open dialog to save settings for the admin console (preferences)"/>
	<mx:HBox width="100%" verticalAlign="middle">
	<mx:Button label="Add" toolTip="would add a item of type (whatever the tab selected is) to the same level as a selected item, or root if nothing selected."/>
	<mx:Button label="Remove" toolTip="would delete a selected item - with confirm dialog"/>
	</mx:HBox>
	-->					
	
	<mx:Script>
		<![CDATA[
			import mx.binding.utils.BindingUtils;
			import mx.controls.Alert;
			import mx.controls.TextArea;
			import mx.managers.PopUpManager;
			
			import weave.Strings;
			import weave.Weave;
			import weave.services.AdminInterface;
			import weave.services.WeaveAdminService;
			import weave.ui.WeaveProgressBar;
			import weave.ui.admin.LoginPopup;
			import weave.ui.admin.WizardPanel;
			import weave.ui.admin.wizards.CSVImportWizard;
			import weave.ui.admin.wizards.SHPImportWizard;
			import weave.ui.admin.wizards.SQLImportWizard;
			
			private static const version:String = Weave.properties.version.value;
			private var loginPopup:LoginPopup;
			
			private function handleCreationComplete():void
			{
				WeaveAdminService.messageLogCallbacks.addImmediateCallback(this, handleMessageLog);
				function handleMessageLog():void
				{
					messageTextArea.text = WeaveAdminService.messageLog.join('\n\n');
					messageTextArea.validateProperties();
					messageTextArea.verticalScrollPosition = messageTextArea.maxVerticalScrollPosition;
					if (messageTextArea.height == 0)
						messageTextArea.percentHeight = 15;
				}

				BindingUtils.bindSetter(handlePermissionChange, AdminInterface.instance, "currentUserIsSuperuser");
				function handlePermissionChange(isSuperuser:Boolean):void
				{
					if (isSuperuser != (tabNavigator == sqlConnectionManager.parent))
					{
						if (isSuperuser)
						{
							tabNavigator.addChild(sqlConnectionManager);
						}
						else
						{
							tabNavigator.removeChild(sqlConnectionManager);
						}
					}
				}
				
				PopUpManager.createPopUp(this, WeaveProgressBar);
			}
			
		]]>
	</mx:Script>
</mx:Application><commit_msg>Added ACS header tool, mostly hidden.<commit_after><?xml version="1.0" encoding="utf-8"?>
<!--
/*
    Weave (Web-based Analysis and Visualization Environment)
    Copyright (C) 2008-2011 University of Massachusetts Lowell

    This file is a part of Weave.

    Weave is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License, Version 3,
    as published by the Free Software Foundation.

    Weave 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Weave.  If not, see <http://www.gnu.org/licenses/>.
*/
-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#7B96B6" creationComplete="handleCreationComplete()" creationPolicy="all" xmlns:managers="weave.ui.admin.managers.*" xmlns:admin="weave.ui.admin.*" xmlns:ui="weave.ui.*">
	<mx:Script>
		<![CDATA[
			import flash.desktop.Clipboard;
			import flash.desktop.ClipboardFormats;
		]]>
	</mx:Script>
	<mx:Panel
		headerHeight="25"
		title="Administration Console for Weave {version}"
		width="100%"
		height="100%"
		borderAlpha="0.5" backgroundColor="#DBDBDB" cornerRadius="0"
		bottom="10" top="10" right="10" left="10"
		paddingLeft="8" paddingRight="8" paddingTop="8" paddingBottom="8">
		<mx:ViewStack width="100%" height="100%" selectedIndex="{AdminInterface.instance.userHasAuthenticated ? 0 : (AdminInterface.instance.sqlConfigExists ? 1 : 2)}">
			<mx:VBox width="100%" height="100%">
				<mx:HBox width="100%">
					<!--mx:Button label="Import SQL data..." click="WizardPanel.createWizard(this, new SQLImportWizard())" toolTip="open dialog with wizard to import data from existing sql"/-->
					<mx:Button label="Import existing SQL data..." click="WizardPanel.createWizard(this, new SQLImportWizard())" toolTip="{Strings.tip_import_sql_data}"/>
					<mx:Button label="Import CSV data..." click="WizardPanel.createWizard(this, new CSVImportWizard())" toolTip="{Strings.tip_import_csv_data}"/>
					<mx:Button label="Import SHP and DBF data..." click="WizardPanel.createWizard(this, new SHPImportWizard())" toolTip="{Strings.tip_import_shp_and_dbf}"/>
					<ui:CustomVRule/>
					<mx:Button label="Open Weave" click="AdminInterface.instance.openWeavePopup();" toolTip="This will open Weave in a new browser window which allows you to save a new client configuration."/>
					<mx:Spacer width="100%"/>
					<mx:Label text="{'Signed in as: ' + AdminInterface.instance.activeConnectionName}" textAlign="right"/>
					<mx:Button label="Sign out" enabled="{AdminInterface.instance.sqlConfigExists == true}"
							   click="AdminInterface.instance.activeConnectionName = AdminInterface.instance.activePassword = '';"/>
				</mx:HBox>
				<mx:HRule width="100%"/>
				<mx:VDividedBox width="100%" height="100%" >
					<mx:TabNavigator id="tabNavigator" width="100%" height="100%" paddingBottom="8" paddingLeft="8" paddingRight="8" paddingTop="8" fontSize="10">
						<managers:ClientConfigurationManager id="clientConfig"/>
						<managers:DataTableManager/>
						<managers:GeometryCollectionManager/>
						<managers:SQLConnectionManager id="sqlConnectionManager"/>
						<mx:VBox id="acsTab" label="ACS Header tool">
							<mx:Label text="Paste the header rows you want to combine."/>
							<mx:TextArea width="100%" height="100%" id="acsInput" change="mergeHeaderRows()"/>
							<ui:Indent label="Separator used when merging header rows:">
								<mx:TextInput id="acsSeparator" text=" - " change="mergeHeaderRows()"/>
							</ui:Indent>
							<mx:HBox>
								<mx:Label text="Merged header rows:"/>
								<mx:Spacer width="100%"/>
								<mx:Button label="Copy to clipboard" click="Clipboard.generalClipboard.setData(ClipboardFormats.TEXT_FORMAT, acsOutput.text);"/>
							</mx:HBox>
							<mx:TextArea width="100%" height="100%" id="acsOutput"/>
						</mx:VBox>
					</mx:TabNavigator>
					<mx:TextArea width="100%" height="0%" id="messageTextArea" editable="false"/>
				</mx:VDividedBox>
			</mx:VBox>
			
			<mx:Box horizontalAlign="center" verticalAlign="middle" show="login.connectionInput.setFocus()">
				<admin:LoginPopup id="login"/>
			</mx:Box>
			
			<mx:VBox show="Alert.show(firstTimeTextArea.text, 'First time setup'); AdminInterface.instance.getConnectionNames();">
				<ui:AutoResizingTextArea id="firstTimeTextArea" text="Before you can continue, you must set up at least one database connection and specify where to store Weave configuration information." editable="false" wordWrap="true" width="100%" backgroundAlpha="0" borderStyle="none" selectable="false"/>
				<managers:SQLConnectionManager/>
			</mx:VBox>
		</mx:ViewStack>
	</mx:Panel>
	
	<!--
	<mx:VRule width="25" height="17"/>
	<mx:Button label="Import Connection(s)..." click="openImportDialog()" toolTip="open dialog with wizard to import  existing connections say to data commons, other servers, etc"/>
	<mx:VRule width="25" height="17"/>
	<mx:Button label="Load Configuration..." toolTip="would open dialog to load saved settings for the admin console (preferences)"/>
	<mx:Button label="Save Configuration..." toolTip="would open dialog to save settings for the admin console (preferences)"/>
	<mx:HBox width="100%" verticalAlign="middle">
	<mx:Button label="Add" toolTip="would add a item of type (whatever the tab selected is) to the same level as a selected item, or root if nothing selected."/>
	<mx:Button label="Remove" toolTip="would delete a selected item - with confirm dialog"/>
	</mx:HBox>
	-->					
	
	<mx:Script>
		<![CDATA[
			import weave.api.reportError;
			import weave.api.WeaveAPI;
			import weave.data.CSVParser;
			import weave.utils.VectorUtils;
			import mx.binding.utils.BindingUtils;
			import mx.controls.Alert;
			import mx.controls.TextArea;
			import mx.managers.PopUpManager;
			
			import weave.Strings;
			import weave.Weave;
			import weave.services.AdminInterface;
			import weave.services.WeaveAdminService;
			import weave.ui.WeaveProgressBar;
			import weave.ui.admin.LoginPopup;
			import weave.ui.admin.WizardPanel;
			import weave.ui.admin.wizards.CSVImportWizard;
			import weave.ui.admin.wizards.SHPImportWizard;
			import weave.ui.admin.wizards.SQLImportWizard;
			
			private static const version:String = Weave.properties.version.value;
			private var loginPopup:LoginPopup;
			
			private function handleCreationComplete():void
			{
				WeaveAdminService.messageLogCallbacks.addImmediateCallback(this, handleMessageLog);
				function handleMessageLog():void
				{
					messageTextArea.text = WeaveAdminService.messageLog.join('\n\n');
					messageTextArea.validateProperties();
					messageTextArea.verticalScrollPosition = messageTextArea.maxVerticalScrollPosition;
					if (messageTextArea.height == 0)
						messageTextArea.percentHeight = 15;
				}

				BindingUtils.bindSetter(updateACSTool, AdminInterface.instance, "activeConnectionName");
				function updateACSTool(name:String):void
				{
					if (acsTab.parent)
						acsTab.parent.removeChild(acsTab);
					if (name == 'resd')
						tabNavigator.addChild(acsTab);
				}
				
				BindingUtils.bindSetter(handlePermissionChange, AdminInterface.instance, "currentUserIsSuperuser");
				function handlePermissionChange(isSuperuser:Boolean):void
				{
					if (isSuperuser != (tabNavigator == sqlConnectionManager.parent))
					{
						if (isSuperuser)
						{
							tabNavigator.addChild(sqlConnectionManager);
						}
						else
						{
							tabNavigator.removeChild(sqlConnectionManager);
						}
					}
				}
				
				PopUpManager.createPopUp(this, WeaveProgressBar);
			}
			
			private function mergeHeaderRows():void
			{
				try
				{
					var table:Array = WeaveAPI.CSVParser.parseCSV(acsInput.text);
					if (table.length > 10)
						table.length = 10;
					var joined:Array = VectorUtils.joinItems(table, acsSeparator.text, false);
					acsOutput.text = WeaveAPI.CSVParser.createCSV([joined]);
				}
				catch (e:Error)
				{
					reportError(e);
				}
			}
		]]>
	</mx:Script>
</mx:Application>
{'fraction_non_alphanumeric': 0.13250084373945326, 'fraction_numerical': 0.015727303408707392, 'mean_word_length': 4.459100957995578, 'pattern_counts': {'":': 0, '<': 123, '<?xml version=': 2, '>': 124, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3690903', 'n_tokens_mistral': 5340, 'n_tokens_neox': 4364, 'n_words': 1051}