Index: /Dev/trunk/classes/Session.php
===================================================================
--- /Dev/trunk/classes/Session.php	(revision 68)
+++ /Dev/trunk/classes/Session.php	(revision 69)
@@ -8,12 +8,49 @@
 class Session {
 
-    private $name;
-    private $description;
-    private $date;
-    private $application;
-    private $pipeline;
+    public $title;
+    public $description;
+    public $pipeline;
+    public $count;
 
-    public function __construct() {
+    public function __construct($title, $description) {
+        $this->title = $title;
+        $this->description = $description;
+        $this->count = 0;
         
+        $this->pipeline = array();
+    }
+    
+    public static function getSession($info)
+    {
+        if (!empty($info))
+        {
+            $title = $info['sessionTitle'];
+            $description = $info['sessionDescription'];
+            $session = new Session($title, $description);
+            $session->count = $info['pipelineCount'];
+            
+            $pipelineCount = 1;
+            for ($i = 1; $i < $session->count + 1; $i++)
+            {
+                if (isset($info[$i . 's']))
+                {
+                    $session->pipeline[$i . 's'] = $info[$i . 's'];
+                }
+                else if (isset($info[$i . 'd']))
+                {
+                    $session->pipeline[$i . 'd'] = $info[$i . 'd'];
+                }
+                else if (isset($info[$i . 'a']))
+                {
+                    $session->pipeline[$i . 'a'] = $info[$i . 'a'];
+                }
+
+                $pipelineCount++;
+            }
+            
+            return $session;
+        }
+        else
+            return null;
     }
 
Index: /Dev/trunk/classes/SessionCreationTool.php
===================================================================
--- /Dev/trunk/classes/SessionCreationTool.php	(revision 68)
+++ /Dev/trunk/classes/SessionCreationTool.php	(revision 69)
@@ -17,4 +17,5 @@
 
         $this->javascript();
+        var_dump($session);
         var_dump($_POST);
         ?>
@@ -26,4 +27,5 @@
                 $this->description();
                 $this->pipeline();
+                $this->surveysApplications();
 
                 $this->makeSessionButton();
@@ -32,4 +34,5 @@
         </div>
         <?php
+        $this->populatePipeline();
     }
 
@@ -43,57 +46,38 @@
         <script type="text/javascript">
             var pipelineCount = 0;
-            var surveys = new Array();
-                            
-            init();
+                                                                                                                                                                                                                                                                             
+            // =============================================================
+                                                                                                                                                                                                                                                                                                    
+            function addSurvey(surveyID) {
+                pipelineCount++;
                                                                                                                                                                         
-            function init() {
-                loadSurveys();
-                loadApplications();
-            }
-                                                                                                                                                                        
-            function loadSurveys() {
-        <?php
-        foreach ($this->surveys as $survey) {
-            ?>
-                        var title = <?php echo "'" . $survey->title . "'"; ?>;
-                        var id = <?php echo "'" . $survey->id . "'"; ?>;
-                        var survey = new Survey(title, id);
-                        surveys.push(survey);
-            <?php
-        }
-        ?>
-            }
-                                                                                                                                                            
-            function loadApplications() {
-                                                                                                                                                                
-            }
-                                                                                                                                                            
-            function Survey(title, id)
-            {
-                this.title = title;
-                this.id = id;
-            }
-                                                                                                                                                            
-            // =============================================================
-                                                                                                                                                            
-            function addSurvey() {
-                pipelineCount++;
-                                
                 var pipeline = document.getElementById("pipeline");
                 var surveysList = document.getElementById("surveysList");
-                                                        
+                                                                                                                                                                                                
                 var entry = document.createElement("option");
-                entry.setAttribute("value", surveys[surveysList.selectedIndex].id);
+                                                                                                                                        
+                if (surveyID != null)
+                {
+                    entry.setAttribute("value", surveyID);
+                    entry.innerHTML = pipelineCount + ". " + surveysList.options.namedItem(surveyID).innerHTML;
+                }
+                else
+                {
+                    entry.setAttribute("value", surveysList.options[surveysList.selectedIndex].value);
+                                                                                                                                    
+                    entry.innerHTML = pipelineCount + ". " + surveysList.options[surveysList.selectedIndex].innerHTML;
+                                                                                                                                    
+                }
                 entry.style.backgroundColor = "#0090ac";
-                entry.innerHTML = pipelineCount + ". " + surveys[surveysList.selectedIndex].title;
                 entry.name = pipelineCount + "s";
-                                                
+                entry.entryType = "s";
+                                                                                                                                                                                        
                 pipeline.appendChild(entry);
             }
-                                    
+                                                                                                                                                                            
             function addDashboard() {
                 pipelineCount++;
                 var pipeline = document.getElementById("pipeline");
-                                        
+                                                                                                                                                                                
                 var entry = document.createElement("option");
                 entry.setAttribute("value", "dashboard");
@@ -102,15 +86,35 @@
                 entry.innerHTML = pipelineCount + ". " + "Dashboard";
                 entry.name = pipelineCount + "d";
-                                        
+                entry.entryType = "d";
+                                                                                                                                                                                
                 pipeline.appendChild(entry);
             }
-                                                     
+                            
+            function removeFromPipeline() {
+                var pipeline = document.getElementById("pipeline");
+                if (pipeline.selectedIndex != null)
+                {
+                    var index = pipeline.selectedIndex;
+                    pipeline.remove(index);
+                   
+                    for(var i = index; i < pipeline.length; i++)
+                        {
+                            var entry = pipeline.options[i];
+                            entry.name = "" + (i+1) + entry.entryType;
+                            var htmlStr = entry.innerHTML;
+                            var dotIndex = htmlStr.indexOf('.');
+                            entry.innerHTML = (i+1) + htmlStr.substr(dotIndex);
+                        }
+                    pipelineCount--;
+                }
+            }
+                                                                                                                                                                                             
             function submitPipeline()
             {
                 var form = document.getElementById("sessionCreationForm");
-                        
+                                                                                                                                                                
                 var pipeline = document.getElementById("pipeline").options;
-                               
-                                
+                                                                                                                                                                       
+                                                                                                                                                                        
                 for (var i = 0; i < pipeline.length; i++)
                 {
@@ -119,8 +123,14 @@
                     pipelineElem.value = pipeline[i].value;
                     pipelineElem.type = "hidden";
-                            
+                                                                                                                                                                    
                     form.appendChild(pipelineElem);
                 }
-                                
+                                                                                                                                                        
+                var count = document.createElement("input");
+                count.name = "pipelineCount";
+                count.value = pipelineCount;
+                count.type = "hidden";
+                                                                                                                                                        
+                form.appendChild(count);
             }
         </script>
@@ -156,7 +166,13 @@
                 <?php
                 $this->addDashboardToPipelineButton();
+                $this->removeFromPipelineButton();
                 ?>
             </div>
         </div>
+        <?php
+    }
+
+    private function surveysApplications() {
+        ?>
         <div id="surveysApplicationsWrapper">
             <div id="surveysForPipelineWrapper">
@@ -164,5 +180,5 @@
                 <?php
                 $this->surveysSelect();
-                $this->addSurveyToPipelineButton()
+                $this->addSurveyToPipelineButton();
                 ?>
             </div>
@@ -180,7 +196,5 @@
     private function pipelineSelect() {
         ?>
-        <select id="pipeline" size="1000">
-
-        </select>
+        <select id="pipeline" size="1000"></select>
         <?php
     }
@@ -192,5 +206,5 @@
             foreach ($this->surveys as $survey) {
                 ?>
-                <option value="<?php echo $survey->id; ?>">
+                <option name="<?php echo $survey->id; ?>" value="<?php echo $survey->id; ?>">
                     <?php echo $survey->title; ?>
                 </option>
@@ -223,5 +237,11 @@
     private function addDashboardToPipelineButton() {
         ?>
-        <input type="button" class="surveyButton nextLine pipelineButton leftAlign leftPadding1" value="+ Dashboard" onclick="addDashboard()"/>
+        <input type="button" class="surveyButton pipelineButton leftAlign leftPadding1" value="+ Dashboard" onclick="addDashboard()"/>
+        <?php
+    }
+
+    private function removeFromPipelineButton() {
+        ?>
+        <input type="button" class="surveyButton" value="x" onclick="removeFromPipeline()"/>
         <?php
     }
@@ -231,4 +251,25 @@
         <input type="submit" id="makeSessionButton" class="topRight surveyButton" value="Make session" />
         <?php
+    }
+
+    private function populatePipeline() {
+
+        if (isset($this->session)) {
+            for ($i = 1; $i < $this->session->count + 1; $i++) {
+                if (isset($this->session->pipeline[$i . 's'])) {
+                    ?>
+                    <script type="text/javascript">
+                        addSurvey(<?php echo "'" . $this->session->pipeline[$i . 's'] . "'"; ?>);
+                    </script>
+                    <?php
+                } else if (isset($this->session->pipeline[$i . 'd'])) {
+                    ?>
+                    <script type="text/javascript">
+                        addDashboard();
+                    </script>
+                    <?php
+                }
+            }
+        }
     }
 
Index: /Dev/trunk/classes/SurveyCreationTool.php
===================================================================
--- /Dev/trunk/classes/SurveyCreationTool.php	(revision 68)
+++ /Dev/trunk/classes/SurveyCreationTool.php	(revision 69)
@@ -15,5 +15,5 @@
         $this->survey = $survey;
         $this->timeStamp = $timeStamp;
-var_dump($_POST);
+
         if (isset($this->survey->id))
             SurveyCreationTool::javascript($this->survey->id);
Index: /Dev/trunk/sessioncreation.php
===================================================================
--- /Dev/trunk/sessioncreation.php	(revision 68)
+++ /Dev/trunk/sessioncreation.php	(revision 69)
@@ -4,5 +4,10 @@
 if (is_null($_SESSION['username']))
     redirect('index.php');
+
+$session = Session::getSession($_POST);
 ?>
+
+
+
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -22,5 +27,5 @@
             <div id="content">
                 <?php
-                    new SessionCreationTool();
+                    new SessionCreationTool($session);
                 ?>
             </div>
