Index: binaries/data/mods/public/gui/session/diplomacy_window.xml
===================================================================
--- binaries/data/mods/public/gui/session/diplomacy_window.xml	(revision 0)
+++ binaries/data/mods/public/gui/session/diplomacy_window.xml	(working copy)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<objects>
+	<object type="text" style="TitleText" size="50%-96 -16 50%+96 16">
+		<translatableAttribute id="caption">Diplomacy</translatableAttribute>
+	</object>
+
+	<object name="diplomacyHeader" size="32 32 100%-32 64">
+		<object name="diplomacyHeaderName" size="0 0 150 100%" type="text" style="chatPanel" ghost="true">
+			<translatableAttribute id="caption">Name</translatableAttribute>
+		</object>
+		<object name="diplomacyHeaderCiv" size="150 0 250 100%" type="text" style="chatPanel" ghost="true">
+			<translatableAttribute id="caption">Civilization</translatableAttribute>
+		</object>
+		<object name="diplomacyHeaderTeam" size="250 0 300 100%" type="text" style="chatPanel" ghost="true">
+			<translatableAttribute id="caption">Team</translatableAttribute>
+		</object>
+		<object name="diplomacyHeaderTheirs" size="300 0 360 100%" type="text" style="chatPanel" ghost="true">
+			<translatableAttribute id="caption">Theirs</translatableAttribute>
+		</object>
+		<object name="diplomacyHeaderAlly" size="100%-180 0 100%-160 100%" type="text" style="chatPanel" tooltip_style="sessionToolTipBold">
+			<translatableAttribute id="caption">A</translatableAttribute>
+			<translatableAttribute id="tooltip">Ally</translatableAttribute>
+		</object>
+		<object name="diplomacyHeaderNeutral" size="100%-160 0 100%-140 100%" type="text" style="chatPanel" tooltip_style="sessionToolTipBold">
+			<translatableAttribute id="caption">N</translatableAttribute>
+			<translatableAttribute id="tooltip">Neutral</translatableAttribute>
+		</object>
+		<object name="diplomacyHeaderEnemy" size="100%-140 0 100%-120 100%" type="text" style="chatPanel" tooltip_style="sessionToolTipBold">
+			<translatableAttribute id="caption">E</translatableAttribute>
+			<translatableAttribute id="tooltip">Enemy</translatableAttribute>
+		</object>
+		<object name="diplomacyHeaderTribute" size="100%-110 0 100% 100%" type="text" style="chatPanel">
+			<translatableAttribute id="caption">Tribute</translatableAttribute>
+		</object>
+	</object>
+	<object size="32 64 100%-32 384">
+		<repeat count="16">
+			<object name="diplomacyPlayer[n]" size="0 0 100% 20" type="image" hidden="false">
+				<object name="diplomacyPlayerName[n]" size="0 0 150 100%" type="text" style="chatPanel" ghost="true"/>
+				<object name="diplomacyPlayerCiv[n]" size="150 0 250 100%" type="text" style="chatPanel" ghost="true"/>
+				<object name="diplomacyPlayerTeam[n]" size="250 0 300 100%" type="text" style="chatPanel" ghost="true"/>
+				<object name="diplomacyPlayerTheirs[n]" size="300 0 360 100%" type="text" style="chatPanel" ghost="true"/>
+
+				<!-- Diplomatic stance - selection -->
+				<object name="diplomacyPlayerAlly[n]" size="100%-180 0 100%-160 100%" type="button" style="StoneButton" hidden="true"/>
+				<object name="diplomacyPlayerNeutral[n]" size="100%-160 0 100%-140 100%" type="button" style="StoneButton" hidden="true"/>
+				<object name="diplomacyPlayerEnemy[n]" size="100%-140 0 100%-120 100%" type="button" style="StoneButton" hidden="true"/>
+
+				<!-- Tribute -->
+				<object name="diplomacyPlayerTributeFood[n]" size="100%-110 0 100%-90 100%" type="button" style="iconButton" tooltip_style="sessionToolTipBold" hidden="true">
+					<object name="diplomacyPlayerTributeFoodImage[n]" type="image" size="0 0 100% 100%" sprite="stretched:session/icons/resources/food.png" ghost="true"/>
+				</object>
+				<object name="diplomacyPlayerTributeWood[n]" size="100%-90 0 100%-70 100%" type="button" style="iconButton" tooltip_style="sessionToolTipBold" hidden="true">
+					<object name="diplomacyPlayerTributeWoodImage[n]" type="image" size="0 0 100% 100%" sprite="stretched:session/icons/resources/wood.png" ghost="true"/>
+				</object>
+				<object name="diplomacyPlayerTributeStone[n]" size="100%-70 0 100%-50 100%" type="button" style="iconButton" tooltip_style="sessionToolTipBold" hidden="true">
+					<object name="diplomacyPlayerTributeStoneImage[n]" type="image" size="0 0 100% 100%" sprite="stretched:session/icons/resources/stone.png" ghost="true"/>
+				</object>
+				<object name="diplomacyPlayerTributeMetal[n]" size="100%-50 0 100%-30 100%" type="button" style="iconButton" tooltip_style="sessionToolTipBold" hidden="true">
+					<object name="diplomacyPlayerTributeMetalImage[n]" type="image" size="0 0 100% 100%" sprite="stretched:session/icons/resources/metal.png" ghost="true"/>
+				</object>
+			</object>
+		</repeat>
+	</object>
+
+	<object size="50%-64 100%-50 50%+64 100%-22" type="button" style="StoneButton">
+		<translatableAttribute id="caption">Close</translatableAttribute>
+		<action on="Press">closeDiplomacy();</action>
+	</object>
+</objects>

Property changes on: binaries/data/mods/public/gui/session/diplomacy_window.xml
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/xml
\ No newline at end of property
Index: binaries/data/mods/public/gui/session/session.xml
===================================================================
--- binaries/data/mods/public/gui/session/session.xml	(revision 15322)
+++ binaries/data/mods/public/gui/session/session.xml	(working copy)
@@ -8,15 +8,8 @@
 <script file="gui/common/music.js"/>
 <script file="gui/common/timer.js"/>
 <script file="gui/common/colorFades.js"/>
-<script file="gui/session/session.js"/>
-<script file="gui/session/selection.js"/>
 <script file="gui/session/placement.js"/>
-<script file="gui/session/input.js"/>
-<script file="gui/session/menu.js"/>
-<script file="gui/session/selection_details.js"/>
-<script file="gui/session/unit_commands.js"/>
-<script file="gui/session/messages.js"/>
-<script file="gui/session/utility_functions.js"/>
+<script directory="gui/session/"/>
 
 <object name="sn" hotkey="session.gui.toggle">
 	<action on="Tick">
@@ -417,77 +410,9 @@
 		type="image"
 		hidden="true"
 		sprite="ModernDialog"
-	>
-		<object type="text" style="TitleText" size="50%-96 -16 50%+96 16">
-			<translatableAttribute id="caption">Diplomacy</translatableAttribute>
-		</object>
+        include="gui/session/diplomacy_window.xml"
+	/>
 
-		<object name="diplomacyHeader" size="32 32 100%-32 64">
-			<object name="diplomacyHeaderName" size="0 0 150 100%" type="text" style="chatPanel" ghost="true">
-				<translatableAttribute id="caption">Name</translatableAttribute>
-			</object>
-			<object name="diplomacyHeaderCiv" size="150 0 250 100%" type="text" style="chatPanel" ghost="true">
-				<translatableAttribute id="caption">Civilization</translatableAttribute>
-			</object>
-			<object name="diplomacyHeaderTeam" size="250 0 300 100%" type="text" style="chatPanel" ghost="true">
-				<translatableAttribute id="caption">Team</translatableAttribute>
-			</object>
-			<object name="diplomacyHeaderTheirs" size="300 0 360 100%" type="text" style="chatPanel" ghost="true">
-				<translatableAttribute id="caption">Theirs</translatableAttribute>
-			</object>
-			<object name="diplomacyHeaderAlly" size="100%-180 0 100%-160 100%" type="text" style="chatPanel" tooltip_style="sessionToolTipBold">
-				<translatableAttribute id="caption">A</translatableAttribute>
-				<translatableAttribute id="tooltip">Ally</translatableAttribute>
-			</object>
-			<object name="diplomacyHeaderNeutral" size="100%-160 0 100%-140 100%" type="text" style="chatPanel" tooltip_style="sessionToolTipBold">
-				<translatableAttribute id="caption">N</translatableAttribute>
-				<translatableAttribute id="tooltip">Neutral</translatableAttribute>
-			</object>
-			<object name="diplomacyHeaderEnemy" size="100%-140 0 100%-120 100%" type="text" style="chatPanel" tooltip_style="sessionToolTipBold">
-				<translatableAttribute id="caption">E</translatableAttribute>
-				<translatableAttribute id="tooltip">Enemy</translatableAttribute>
-			</object>
-			<object name="diplomacyHeaderTribute" size="100%-110 0 100% 100%" type="text" style="chatPanel">
-				<translatableAttribute id="caption">Tribute</translatableAttribute>
-			</object>
-		</object>
-
-		<object size="32 64 100%-32 384">
-			<repeat count="16">
-				<object name="diplomacyPlayer[n]" size="0 0 100% 20" type="image" hidden="false">
-					<object name="diplomacyPlayerName[n]" size="0 0 150 100%" type="text" style="chatPanel" ghost="true"/>
-					<object name="diplomacyPlayerCiv[n]" size="150 0 250 100%" type="text" style="chatPanel" ghost="true"/>
-					<object name="diplomacyPlayerTeam[n]" size="250 0 300 100%" type="text" style="chatPanel" ghost="true"/>
-					<object name="diplomacyPlayerTheirs[n]" size="300 0 360 100%" type="text" style="chatPanel" ghost="true"/>
-
-					<!-- Diplomatic stance - selection -->
-					<object name="diplomacyPlayerAlly[n]" size="100%-180 0 100%-160 100%" type="button" style="StoneButton" hidden="true"/>
-					<object name="diplomacyPlayerNeutral[n]" size="100%-160 0 100%-140 100%" type="button" style="StoneButton" hidden="true"/>
-					<object name="diplomacyPlayerEnemy[n]" size="100%-140 0 100%-120 100%" type="button" style="StoneButton" hidden="true"/>
-
-					<!-- Tribute -->
-					<object name="diplomacyPlayerTributeFood[n]" size="100%-110 0 100%-90 100%" type="button" style="iconButton" tooltip_style="sessionToolTipBold" hidden="true">
-						<object name="diplomacyPlayerTributeFoodImage[n]" type="image" size="0 0 100% 100%" sprite="stretched:session/icons/resources/food.png" ghost="true"/>
-					</object>
-					<object name="diplomacyPlayerTributeWood[n]" size="100%-90 0 100%-70 100%" type="button" style="iconButton" tooltip_style="sessionToolTipBold" hidden="true">
-						<object name="diplomacyPlayerTributeWoodImage[n]" type="image" size="0 0 100% 100%" sprite="stretched:session/icons/resources/wood.png" ghost="true"/>
-					</object>
-					<object name="diplomacyPlayerTributeStone[n]" size="100%-70 0 100%-50 100%" type="button" style="iconButton" tooltip_style="sessionToolTipBold" hidden="true">
-						<object name="diplomacyPlayerTributeStoneImage[n]" type="image" size="0 0 100% 100%" sprite="stretched:session/icons/resources/stone.png" ghost="true"/>
-					</object>
-					<object name="diplomacyPlayerTributeMetal[n]" size="100%-50 0 100%-30 100%" type="button" style="iconButton" tooltip_style="sessionToolTipBold" hidden="true">
-						<object name="diplomacyPlayerTributeMetalImage[n]" type="image" size="0 0 100% 100%" sprite="stretched:session/icons/resources/metal.png" ghost="true"/>
-					</object>
-				</object>
-			</repeat>
-		</object>
-
-		<object size="50%-64 100%-50 50%+64 100%-22" type="button" style="StoneButton">
-            <translatableAttribute id="caption">Close</translatableAttribute>
-		    <action on="Press">closeDiplomacy();</action>
-		</object>
-	</object>
-
 	<!-- ================================  ================================ -->
 	<!-- Trade Window -->
 	<!-- ================================  ================================ -->
Index: source/gui/CGUI.cpp
===================================================================
--- source/gui/CGUI.cpp	(revision 15322)
+++ source/gui/CGUI.cpp	(working copy)
@@ -1110,6 +1110,7 @@
 	ATTR(file);
 	ATTR(id);
 	ATTR(context);
+	ATTR(include);
 
 	//
 	//	Read Style and set defaults
@@ -1140,7 +1141,9 @@
 
 	bool NameSet = false;
 	bool ManuallySetZ = false; // if z has been manually set, this turn true
+	bool ExternalChildren = false;
 
+	CStrW inclusionPath;
 	CStr hotkeyTag;
 
 	// Now we can iterate all attributes and store
@@ -1170,6 +1173,13 @@
 			continue;
 		}
 
+		if (attr.Name == attr_include)
+		{
+			ExternalChildren = true;
+			inclusionPath = attr.Value.FromUTF8();
+			continue;
+		}
+
 		// Wire up the hotkey tag, if it has one
 		if (attr.Name == attr_hotkey)
 			hotkeyTag = attr.Value;
@@ -1211,9 +1221,31 @@
 	//	Read Children
 	//
 
-	// Iterate children
 	XMBElementList children = Element.GetChildNodes();
+	CXeromyces XeroChildren;
+	if (ExternalChildren)
+	{
+		Paths.insert(inclusionPath);
 
+		if (XeroChildren.Load(g_VFS, inclusionPath) == PSRETURN_OK)
+		{
+			XMBElement node = XeroChildren.GetRoot();
+
+			CStr root_name (XeroChildren.GetElementString(node.GetNodeName()));
+
+			if (root_name == "objects")
+				children = node.GetChildNodes();
+			else
+				LOGERROR(L"GUI: Error reading included XML: %ls, root element must have the name 'objects'.", inclusionPath.c_str());
+		}
+		else
+			LOGERROR(L"GUI: Error reading included XML: %ls", inclusionPath.c_str());
+
+		// set pFile to the new CXeromyces file, as it's only used to handle the children from now on
+		pFile = &XeroChildren;
+	}
+
+	// Iterate children
 	for (i=0; i<children.Count; ++i)
 	{
 		// Get node
@@ -1433,6 +1465,25 @@
 		}
 	}
 
+	CStrW directory (Element.GetAttributes().GetNamedItem( pFile->GetAttributeID("directory") ).FromUTF8());
+	if (!directory.empty())
+	{
+		VfsPaths pathnames;
+		vfs::GetPathnames(g_VFS, directory, L"*.js", pathnames);
+		for (VfsPaths::iterator it = pathnames.begin(); it != pathnames.end(); ++it)
+		{
+			Paths.insert(*it);
+			try
+			{
+				m_ScriptInterface->LoadGlobalScriptFile(*it);
+			}
+			catch (PSERROR_Scripting& e)
+			{
+				LOGERROR(L"GUI: Error executing script %ls: %hs", directory.c_str(), e.what());
+			}
+		}
+	}
+
 	// Execute inline scripts
 	try
 	{
