Index: Dev/trunk/applicationcreation.php
===================================================================
--- Dev/trunk/applicationcreation.php	(revision 88)
+++ Dev/trunk/applicationcreation.php	(revision 89)
@@ -7,18 +7,16 @@
     redirect('index.php');
 
-$application = null;
+$savedApplication = null;
 
-/* TODO: Bas! Dit aanpassen zodat application wordt opgeslagen. */
-if(isset($_POST['applicationUID']))
+if(isset($_POST['applicationUID']) && $_POST['applicationUID'] != "")
 {
-    $id = $_POST['applicationUID'];
-    $title = $_POST['applicationTitle'];
-    $description = $_POST['applicationDescription'];
-    $application = new Application($id, $title, $description);
-        
-    $applicationDBI = new ApplicationDatabaseInterface($id);
-    $applicationDBI->setApplicationInfo($_POST);
+    $applicationUID = $_POST['applicationUID'];
+    $applicationDBI = new ApplicationDatabaseInterface($applicationUID);
+
+    $info = $applicationDBI->getApplicationInfo($applicationUID);
+    var_dump($info);
+    $savedApplication = Application::getApplication($info);
 }
-else if(isset($_POST['applicationTitle']))
+else if(isset($_POST['applicationTitle'])) //save for first time
 {
     $title = $_POST['applicationTitle'];
@@ -26,10 +24,12 @@
     $application = new Application($title, $description);
         
-    $applicationDBI = new ApplicationDatabaseInterface(null);
+    $applicationDBI = new ApplicationDatabaseInterface($_POST['applicationUID']);
     $applicationDBI->setApplicationInfo($_POST);
     $applicationID = $applicationDBI->getApplicationID();
     $info = $applicationDBI->getApplicationInfo($applicationID);
+    $savedApplication = Application::getApplication($info);
+    
+    
 }
-
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
@@ -38,5 +38,5 @@
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
     <head>
-        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
             <title>Application Creation</title>
             <?php new StyleSheet(); ?>
@@ -50,5 +50,5 @@
             <div id="content">
                 <?php
-                    new ApplicationCreationTool($application);
+                    new ApplicationCreationTool($savedApplication);
                 ?>
             </div>
Index: Dev/trunk/classes/Application.php
===================================================================
--- Dev/trunk/classes/Application.php	(revision 88)
+++ Dev/trunk/classes/Application.php	(revision 89)
@@ -20,5 +20,13 @@
 	$this->style = $style;
     }
-
+    
+    public static function getApplication($info)
+    {
+        return new Application(
+                $info['applicationID'],
+                $info['applicationTitle'],
+                $info['applicationDescription'],
+                $info['applicationStyle']);
+    }
 
 }
Index: Dev/trunk/classes/ApplicationCreationTool.php
===================================================================
--- Dev/trunk/classes/ApplicationCreationTool.php	(revision 88)
+++ Dev/trunk/classes/ApplicationCreationTool.php	(revision 89)
@@ -10,71 +10,83 @@
  * @author fpvanagthoven
  */
-class ApplicationCreationTool
-{
-	private $application;
+class ApplicationCreationTool {
 
-	public function __construct($application = null)
-	{
-		$this->application = $application;
+    private $application;
 
-		$this->javascript();
+    public function __construct($application = null) {
+        $this->application = $application;
 
-		$this->init();
-	}
+        $this->javascript();
 
-	private function javascript()
-	{
-		?>
-		<script type="text/javascript" src="js/creation.js"></script>
-		<script language="JavaScript" type="text/javascript">
+        $this->init();
+    }
 
-		</script>
-		<?php
-	}
+    private function javascript() {
+        ?>
+        <script type="text/javascript" src="js/creation.js"></script>
+        <script language="JavaScript" type="text/javascript">
+            function save(id){
+                var form = document.getElementById('applicationCreationForm');
+                var applicationUID = id;
+                                        
+                var applicationIDInput = document.createElement('input');
+                applicationIDInput.name = 'applicationUID';
+                applicationIDInput.value = applicationUID;
+                applicationIDInput.type = 'hidden';
+                                
+                form.appendChild(applicationIDInput);
+                                
+                form.submit();
+            }
+        </script>
+        <?php
+    }
 
-	private function init()
-	{
-		?>
-		<div class="creation">
-			<form id="applicationCreationForm" action="" method="post">
-				<?php
-				$this->title();
-				$this->description();
+    private function init() {
+        ?>
+        <div class="creation">
+            <form id="applicationCreationForm" action="" method="post">
+                <?php
+                $this->title();
+                $this->description();
 
-				$this->done();
-				?>
-			</form>
-		</div>
-		<?php
-	}
+                $this->save();
+                ?>
+            </form>
+        </div>
+        <?php
+    }
 
-	private function title()
-	{
-		if (isset($this->application->title))
-			$value = $this->application->title;
-		else
-			$value = 'Untitled Application';
-		?>
-		<input type="text" id="applicationTitle" class="titleBox" name="applicationTitle" value="<?php echo str_replace("\"", "&quot;", $value); ?>" onblur="handleBlur(this)" onfocus="handleFocus(this)" />
-		<?php
-	}
+    private function title() {
+        if (isset($this->application->title))
+            $value = $this->application->title;
+        else
+            $value = 'Untitled Application';
+        ?>
+        <input type="text" id="applicationTitle" class="titleBox" name="applicationTitle" value="<?php echo str_replace("\"", "&quot;", $value); ?>" onblur="handleBlur(this)" onfocus="handleFocus(this)" />
+        <?php
+    }
 
-	private function description()
-	{
-		if (isset($this->application->description))
-			$value = $this->application->description;
-		else
-			$value = 'Write a description for this application here.';
-		?>
-		<textarea id="applicationDescription" class="descriptionBox" name="applicationDescription" onblur="handleBlur(this)" onfocus="handleFocus(this)"><?php echo $value; ?></textarea>
-		<?php
-	}
+    private function description() {
+        if (isset($this->application->description))
+            $value = $this->application->description;
+        else
+            $value = 'Write a description for this application here.';
+        ?>
+        <textarea id="applicationDescription" class="descriptionBox" name="applicationDescription" onblur="handleBlur(this)" onfocus="handleFocus(this)"><?php echo $value; ?></textarea>
+        <?php
+    }
 
-	private function done()
-	{
-		?>
-		<input type="submit" class="surveyButton topRight" value="Done" />
-		<?php
-	}
+    private function save() {
+        if (isset($this->application)) {
+            $id = $this->application->id;
+        } else {
+            $id = null;
+        }
+        ?>
+        <input type="button" onclick="save('<?php echo $id; ?>')" class="surveyButton topRight" value="Save" />
+        <?php
+    }
+
 }
 ?>
Index: Dev/trunk/js/menu.js
===================================================================
--- Dev/trunk/js/menu.js	(revision 88)
+++ Dev/trunk/js/menu.js	(revision 89)
@@ -17,2 +17,20 @@
     }
 }
+
+function loadApplication()
+{
+    var form = document.getElementById('loadApplicationForm');
+    var select = document.getElementById('applicationsToLoad');
+    var applicationUID = select.valueOf().value;
+    
+    if (applicationUID != '')
+    {
+        var applicationInput = document.createElement('input');
+        applicationInput.name = 'applicationUID';
+        applicationInput.value = applicationUID;
+        applicationInput.type = "hidden";
+       
+        form.appendChild(applicationInput);
+        form.submit();
+    }
+}
