Index: /code/branches/dockingsystem2/data/gui/layouts/DockingDialog.layout
===================================================================
--- /code/branches/dockingsystem2/data/gui/layouts/DockingDialog.layout	(revision 8434)
+++ /code/branches/dockingsystem2/data/gui/layouts/DockingDialog.layout	(revision 8434)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<GUILayout >
+    <Window Type="MenuWidgets/StaticImage" Name="orxonox/DockingBackground" >
+        <Property Name="FrameEnabled" Value="False" />
+        <Property Name="InheritsAlpha" Value="False" />
+        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+        <Property Name="BackgroundEnabled" Value="False" />
+        <Window Type="MenuWidgets/StaticText" Name="orxonox/DockingTitle" >
+            <Property Name="Text" Value="Docking" />
+            <Property Name="Alpha" Value="0.8" />
+            <Property Name="InheritsAlpha" Value="False" />
+            <Property Name="HorzFormatting" Value="HorzCentred" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="VertFormatting" Value="TopAligned" />
+            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2875,0},{0.75,0},{0.7,0}}" />
+            <Window Type="MenuWidgets/Listbox" Name="orxonox/DockingDocks" >
+                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.85,0}}" />
+            </Window>
+        </Window>
+        <Window Type="MenuWidgets/Button" Name="orxonox/DockingDockButton" >
+            <Property Name="Text" Value="Dock" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.2875,0},{0.725,0},{0.4875,0},{0.775,0}}" />
+            <Event Name="Clicked" Function="DockingDialog.dockButton_clicked"/>
+        </Window>
+        <Window Type="MenuWidgets/Button" Name="orxonox/DockingCancelButton" >
+            <Property Name="Text" Value="Cancel" />
+            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.725,0},{0.7125,0},{0.775,0}}" />
+            <Event Name="Clicked" Function="DockingDialog.cancelButton_clicked"/>
+        </Window>
+    </Window>
+</GUILayout>
Index: /code/branches/dockingsystem2/data/gui/scripts/DockingDialog.lua
===================================================================
--- /code/branches/dockingsystem2/data/gui/scripts/DockingDialog.lua	(revision 8434)
+++ /code/branches/dockingsystem2/data/gui/scripts/DockingDialog.lua	(revision 8434)
@@ -0,0 +1,58 @@
+-- DockingDialog.lua
+
+local P = createMenuSheet("DockingDialog")
+
+P.docks = {}
+
+function P.onLoad()
+    
+end
+
+function P.onShow()
+    P.update()
+    orxonox.CommandExecutor:execute("pause")
+end
+
+function P.onHide()
+    orxonox.CommandExecutor:execute("pause")
+end
+
+function P.update()
+    -- update dock list
+    P.docks = {}
+    local docks = orxonox.Dock:getNumberOfActiveDocks()
+    for i = 0, docks-1 do
+        table.insert(P.docks, orxonox.Dock:getActiveDockAtIndex(i))
+    end
+
+    local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/DockingDocks"))
+    listbox:resetList()
+
+    for k in pairs(P.docks) do
+        local item = CEGUI.createListboxTextItem("Dock " .. k)
+        item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
+        listbox:addItem(item)
+    end
+end
+
+function P.dockButton_clicked(e)
+    local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/DockingDocks"))
+    local choice = listbox:getFirstSelectedItem()
+    if choice ~= nil then
+        local index = listbox:getItemIndex(choice)
+        local dock = P.docks[index+1]
+        cout(0, index )--.. ": " .. P.docks[index])
+        if dock ~= nil then
+            cout(0, "LUA>Docking")
+            dock:dock()
+        end
+    end
+    hideMenuSheet(P.name)
+end
+
+function P.cancelButton_clicked(e)
+    --P.hideMe()
+    hideMenuSheet(P.name)
+end
+
+return P
Index: /code/branches/dockingsystem2/data/levels/docking.oxw
===================================================================
--- /code/branches/dockingsystem2/data/levels/docking.oxw	(revision 8433)
+++ /code/branches/dockingsystem2/data/levels/docking.oxw	(revision 8434)
@@ -27,27 +27,32 @@
     <Light type="directional" position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
 
+
+
     <?lua for i = 1, 10, 1 do ?>
-      <SpawnPoint position="<?lua print(math.random() * 500 - 250) ?>,<?lua print(math.random() * 500 - 250) ?>,<?lua print(math.random() * 500 - 250) ?>" lookat="0,0,0" spawnclass="SpaceShip" pawndesign="spaceshipassff" />
+      <SpawnPoint position="<?lua print(math.random() * 200 - 100) ?>,<?lua print(math.random() * 200 - 100) ?>,<?lua print(math.random() * 200 - 100) ?>" lookat="0,0,0" spawnclass="SpaceShip" pawndesign="spaceshipassff" />
     <?lua end ?>
 
-    <Dock position="-50,-100,50">
-            <effects>
-                <DockToShip target="theDestroyer" />
-            </effects>
-            <events>
-                <execute>
-                    <EventListener event="dockMe" />
-                </execute>
-            </events>
-            <attached>
-                <DistanceTrigger position="0,0,0" distance="20" target="Pawn" beaconMode="exclude" targetname="destroyerBeacon" name="dockMe" />
-                <Billboard material="Examples/Flare" colour="1.0, 0, 0" />
-            </attached>
-        </Dock>
-
-
-    
+
+
+
+    <Dock>
+        <effects>
+            <DockToShip target="destroyer" />
+        </effects>
+        <events>
+            <execute>
+                <EventListener event="dockMe" />
+            </execute>
+        </events>
+        <attached>
+            <DistanceTrigger position="0,0,0" distance="50" target="Pawn" beaconMode="exclude" targetname="destroyerBeacon" name="dockMe" />
+            <Billboard material="Examples/Flare" colour="1.0, 0, 0" />
+        </attached>
+    </Dock>
+
+
 
       <SpaceShip
+   position               = "-150,-50,-100"
    hudtemplate            = "spaceshiphud"
    camerapositiontemplate = "spaceshipassffcameras"
@@ -71,6 +76,6 @@
   >
     <attached>
-        <DistanceTriggerBeacon name="beacon1" />
-        <DockingTarget name="asdf" />
+        <DistanceTriggerBeacon name="bcnSpaceShip1" />
+        <DockingTarget name="spaceShip1" />
 
       <Model position="0,0,0" yaw="90" pitch="-90" roll="0" scale="4" mesh="assff.mesh" />
@@ -96,5 +101,5 @@
 
     <Destroyer
-      position          = "100,150,0"
+      position          = "100,150,100"
       collisionType     = "dynamic"
       mass              = "100000"
@@ -108,6 +113,6 @@
       <attached>
 
-        <DistanceTriggerBeacon name="destroyerBeacon" />
-        <DockingTarget name="theDestroyer" />
+        <DistanceTriggerBeacon name="bcnDestroyer" />
+        <DockingTarget name="destroyer" />
 
 
Index: /code/branches/dockingsystem2/src/modules/docking/CMakeLists.txt
===================================================================
--- /code/branches/dockingsystem2/src/modules/docking/CMakeLists.txt	(revision 8433)
+++ /code/branches/dockingsystem2/src/modules/docking/CMakeLists.txt	(revision 8434)
@@ -10,4 +10,5 @@
   FIND_HEADER_FILES
   TOLUA_FILES
+    Dock.h
   PCH_FILE
     DockingPrecompiledHeaders.h
Index: /code/branches/dockingsystem2/src/modules/docking/Dock.cc
===================================================================
--- /code/branches/dockingsystem2/src/modules/docking/Dock.cc	(revision 8433)
+++ /code/branches/dockingsystem2/src/modules/docking/Dock.cc	(revision 8434)
@@ -34,14 +34,19 @@
 #include "Dock.h"
 
+#include "core/CoreIncludes.h"
+#include "core/LuaState.h"
+#include "core/GUIManager.h"
 #include "infos/HumanPlayer.h"
 #include "worldentities/pawns/Pawn.h"
 #include "interfaces/PlayerTrigger.h"
-#include "controllers/HumanController.h"
 #include "core/command/ConsoleCommand.h"
 
-
+#include "ToluaBindDocking.h"
 
 namespace orxonox
 {
+    // Register tolua_open function when loading the library
+    DeclareToluaInterface(Docking);
+
     CreateFactory(Dock);
 
@@ -111,10 +116,15 @@
         COUT(0) << "Dock triggered by player: " << player->getName() << ".." << std::endl;
 
-        if(bTriggered) {
+        if(bTriggered)
+        {
             // Add player to this Docks candidates
             candidates.insert(player);
 
+            // Show docking dialog
+            GUIManager::showGUI("DockingDialog");
             //DockingEffect::invokeEffect(docking::DOCKING, player, effects_);
-        } else {
+        }
+        else
+        {
             // Remove player from candidates list
             candidates.erase(player);
@@ -127,7 +137,9 @@
 
 
-    void Dock::cmdDock() {
-        PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
-        for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it) {
+    void Dock::cmdDock()
+    {
+        PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
+        for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
+        {
             if(it->dock(player))
                 break;
@@ -135,7 +147,9 @@
     }
 
-    void Dock::cmdUndock() {
-        PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
-        for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it) {
+    void Dock::cmdUndock()
+    {
+        PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
+        for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
+        {
             if(it->undock(player))
                 break;
@@ -144,8 +158,10 @@
 
 
-    bool Dock::dock(PlayerInfo* player) {
+    bool Dock::dock(PlayerInfo* player)
+    {
         // Check if player is a candidate
-        if(candidates.find(player) == candidates.end()) {
-            COUT(0) << "Player is not a candidate!";
+        if(candidates.find(player) == candidates.end())
+        {
+            COUT(0) << "Player is not a candidate!" << std::endl;
             return false;
         }
@@ -158,7 +174,9 @@
     }
 
-    bool Dock::undock(PlayerInfo* player) {
+    bool Dock::undock(PlayerInfo* player)
+    {
         // Check if player is docked to this Dock
-        if(docked.find(player) == docked.end()) {
+        if(docked.find(player) == docked.end())
+        {
             COUT(0) << "Player is not docked to this Dock." << std::endl;
             return false;
@@ -173,5 +191,34 @@
 
 
-    bool Dock::addEffect(DockingEffect* effect) {
+    unsigned int Dock::getNumberOfActiveDocks()
+    {
+        int i = 0;
+        PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
+        for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
+        {
+            if(it->candidates.find(player) != it->candidates.end())
+                i++;
+        }
+        return i;
+    }
+
+    Dock* Dock::getActiveDockAtIndex(unsigned int index)
+    {
+        PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
+        for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
+        {
+            if(it->candidates.find(player) != it->candidates.end())
+            {
+                if(index == 0)
+                    return *it;
+                index--;
+            }
+        }
+        return NULL;
+    }
+
+
+    bool Dock::addEffect(DockingEffect* effect)
+    {
         assert(effect);
         effects.push_back(effect);
@@ -179,7 +226,9 @@
     }
 
-    const DockingEffect* Dock::getEffect(unsigned int index) const {
+    const DockingEffect* Dock::getEffect(unsigned int index) const
+    {
         int i = index;
-        for (std::list<DockingEffect*>::const_iterator effect = this->effects.begin(); effect != this->effects.end(); ++effect) {
+        for (std::list<DockingEffect*>::const_iterator effect = this->effects.begin(); effect != this->effects.end(); ++effect)
+        {
             if(i == 0)
                return *effect;
Index: /code/branches/dockingsystem2/src/modules/docking/Dock.h
===================================================================
--- /code/branches/dockingsystem2/src/modules/docking/Dock.h	(revision 8433)
+++ /code/branches/dockingsystem2/src/modules/docking/Dock.h	(revision 8434)
@@ -43,12 +43,15 @@
 
 #include "worldentities/StaticEntity.h"
-#include "notifications/NotificationManager.h"
+#include "controllers/HumanController.h"
 
 #include "DockingEffect.h"
 #include "DockingPrereqs.h"
 
-namespace orxonox {
+namespace orxonox // tolua_export
+{  // tolua_export
 
-    class _DockingExport Dock : public StaticEntity {
+    class _DockingExport Dock  // tolua_export
+        : public StaticEntity
+    { // tolua_export
     public:
         Dock(BaseObject* creator);
@@ -66,4 +69,8 @@
         bool undock(PlayerInfo* player); //!< Undocks a player (player must be docked)
 
+        void dock() { this->dock(HumanController::getLocalControllerSingleton()->getPlayer()); } // tolua_export
+        static unsigned int getNumberOfActiveDocks(); // tolua_export
+        static Dock* getActiveDockAtIndex(unsigned int index); // tolua_export
+
         static void cmdDock();
         static void cmdUndock();
@@ -73,8 +80,6 @@
         std::set<PlayerInfo*> docked; //!< A set of all docked players
         std::list<DockingEffect*> effects; //!< The list of DockingEffects to be executed when a player docks.
-    };
-
-
-}
+    }; // tolua_export
+} // tolua_export
 
 #endif /* _Dock_H__ */
