Index: Dev/trunk/classes/ApplicationCreationTool.php
===================================================================
--- Dev/trunk/classes/ApplicationCreationTool.php	(revision 75)
+++ 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
+    }
+
 }
 ?>
