Index: Dev/trunk/classes/DisplayStep.php
===================================================================
--- Dev/trunk/classes/DisplayStep.php	(revision 144)
+++ Dev/trunk/classes/DisplayStep.php	(revision 146)
@@ -45,5 +45,5 @@
         //output a display object
         //echo '<div class="displayStep"><div class="displayStepIcon" style="background-image: url('.$this->imageURL.');"></div>'.$this->caption.'</div>'."\n";
-        echo '<div class="displayStep"><div class="displayStepIcon"><img src="' . $this->imageURL . '" /></div>' . $this->caption . '</div>';
+        echo '<div class="displayStep" onClick="checkSelectedStep('.$this->id.');"><div class="displayStepIcon"><img src="' . $this->imageURL . '" /></div>' . $this->caption . '</div>';
     }
 
Index: Dev/trunk/classes/PipelineInfoPanel.php
===================================================================
--- Dev/trunk/classes/PipelineInfoPanel.php	(revision 146)
+++ Dev/trunk/classes/PipelineInfoPanel.php	(revision 146)
@@ -0,0 +1,21 @@
+<?php
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * Info panel, to the side of the Toolbox, showing various stats and links for the current pipeline.
+ *
+ * @author Thijs Schipper
+ */
+class PipelineInfoPanel {
+    private $linkedSequencer;
+    
+    public function __construct(){
+        
+    }
+}
+
+?>
Index: Dev/trunk/classes/Step.php
===================================================================
--- Dev/trunk/classes/Step.php	(revision 144)
+++ Dev/trunk/classes/Step.php	(revision 146)
@@ -17,15 +17,44 @@
     public $name;
     public $id;
+    // merging step and displayStep
+
+    public $imageURL;
 
     public function __construct($t, $n, $i) {
 
         if (strtolower($t) == "application" || strtolower($t) == "dashboard" || strtolower($t) == "questionnaire") {
+            $this->type = $t;
             $this->name = $n;
-            $this->type = $t;
             $this->id = $i;
+        } else {
+            die("Invalid type given: " . $t . "\n $n $i");
         }
-        else {
-            die("Invalid type given: ".$t."\n $n $i");
+
+        switch (strtolower($this->type)) {
+            case "questionnaire":
+                $this->imageURL = "images/icons/questionnaire.png";
+                break;
+            case "dashboard":
+                $this->imageURL = "images/icons/dashboard.png";
+                break;
+            case "application":
+                $this->imageURL = "images/icons/application.png";
+                break;
+            default:
+                $this->imageURL = "images/icons/unknowntype.png";
+                break;
         }
+    }
+
+    public function AdjustID($offset) {
+        $this->id += $offset;
+    }
+
+    public function DrawStep() {
+        if (isset($this->type) && isset($this->imageURL) && isset($this->name)) {
+            ?>
+<div class="displayStep" onClick="checkSelectedStep('<?php echo $this->id; ?>');"><div class="displayStepIcon"><img src="<?php echo $this->imageURL; ?>" /></div><?php echo $this->name; ?></div>
+<?php        
+}
     }
 
Index: Dev/trunk/classes/pipelineSequencer.php
===================================================================
--- Dev/trunk/classes/pipelineSequencer.php	(revision 144)
+++ Dev/trunk/classes/pipelineSequencer.php	(revision 146)
@@ -10,32 +10,25 @@
  * @author HP
  */
-class pipelineSequencer {
+class PipelineSequencer {
 
     // properties
-    private $steps;
-    private $title = "testSequencer";
-    private $id = 1;
+    private $pipeline = array();
+    private $name = "testSequencer";
     private $numStepsInArray = 0;
-    private $maxNumStepsInArray = 8;
+    private $maxNumStepsInArray = 10;
     private $selectedStep;
 
-    public function __construct($steps) {
-        $this->steps = $steps;
-        $this->selectedStep = $this->steps[2];
+    public function __construct($pipeline, $name, $id) {
+        $this->pipeline = $pipeline;
+        $this->name = $name;
+    }
 
-        $this->moveStep(1);
-
-//        echo '<br /><fieldset id="sequencer">'."\n\n";
-//        echo '<div class="title">Name: '.$this->title.'</div>';
-//        echo '<div class="seqContent">'."\n\n";
-//        echo '';
-//        echo '</div>';
-//        echo '</fieldset>';
+    public function DrawSequencer() {
         ?>
         <br /><form name="sequencer" action="pipelineEditor.php" method="post"><fieldset id="sequencer">
-                <div class="title">Name: <?php echo $this->title; ?> </div>
+                <div class="title">Name: <?php echo $this->name; ?> </div>
 
                 <div class="seqContent">
-                    <?php $this->drawSteps(); ?>          
+                    <?php $this->DrawSteps(); ?>          
                 </div>
 
@@ -45,6 +38,6 @@
                     <input type="submit" name="editSelected" value="Edit step" class="surveyButton" />
                     <input type="submit" name="deleteSelected" value="Delete step" class="surveyButton" />
-                    <input type="submit" name="clearPipeline" value="Clear pipeline" class="" disabled="true" />
-                    <input type="checkbox" name="confirmClear" />Really clear?
+                    <input type="submit" name="clearPipeline" value="Clear pipeline" class="surveyButton dis" disabled="true"/>
+                    <input type="checkbox" name="confirmClear" onChange="IsCheckEnabled(this, document.sequencer.clearPipeline);" />Really clear?
                     <input type="hidden" name="selectedStep" />
                 </div>
@@ -54,6 +47,14 @@
     }
 
-    public function AddStep($step) {
-        $this->steps[] = $step;
+    public function AddStep($newStep) {
+        $n = 1;
+        foreach ($this->pipeline as $existingStep) {
+            if ($existingStep->name == $newStep . " $n") {
+                $n++;
+            }
+        }
+
+        $this->pipeline[] = new Step($newStep, $newStep . " " . $n, count($this->pipeline) + 1);
+        //var_dump($this->pipeline);
         ?>
         <script type="text/javascript">
@@ -65,25 +66,34 @@
     public function RemoveStep($targetStep) {
 
-        $tempArray;
-        foreach ($this->steps as $step) {
-            if ($step != targetStep) {
+        $tempArray = array();
+        $removed = false;
+        foreach ($this->pipeline as $step) {
+            if ($step->id != $targetStep) {
                 $tempArray[] = $step;
+                if ($removed) {
+                    $step::AdjustID(-1);
+                }
+            } else {
+                $removed = true;
             }
         }
-        $this->steps = $tempArray;
+        $this->pipeline = $tempArray;
     }
 
-    public function GetSteps() {
-        return $this->steps;
+    public function GetPipeline() {
+        return $this->pipeline;
     }
 
-    public function drawSteps() {
+    public function DrawSteps() {
         //draw the actual icons in the container div.
-        foreach ($this->steps as $step) {
-            if ($this->numStepsInArray < $this->maxNumStepsInArray) {
-                new DisplayStep($step->type, null, $step->name, $step->id);
-                $this->numStepsInArray++;
-                if ($this->numStepsInArray < $this->maxNumStepsInArray && $this->numStepsInArray < count($this->steps)) {
-                    echo "<div class='divider'></div>";
+        if (!empty($this->pipeline)) {
+            foreach ($this->pipeline as $step) {
+                if ($this->numStepsInArray < $this->maxNumStepsInArray) {
+                    //var_dump($step);
+                    $step->DrawStep();
+                    $this->numStepsInArray++;
+                    if ($this->numStepsInArray < $this->maxNumStepsInArray && $this->numStepsInArray < count($this->pipeline)) {
+                        echo "<div class='divider'></div>";
+                    }
                 }
             }
@@ -91,10 +101,10 @@
     }
 
-    public function moveStep($direction) {
-        $key = array_search($this->selectedStep, $this->steps);
-        echo $key;
+    public function MoveStep($direction) {
+        $key = array_search($this->selectedStep, $this->pipeline);
+        //echo $key;
     }
 
-    private function moveEntry(&$array, $key, $dir) {
+    private function MoveEntry(&$array, $key, $dir) {
         if ($dir == -1) {   // move up
             if ($key > 0) {
@@ -110,4 +120,55 @@
     }
 
+    public function SetSelected($key) {
+
+        if ($key > 0 && $key < count($this->pipeline)) {
+            $this->selectedStep = $key;
+        }
+    }
+
+    public function GetName($name) {
+        if ($name && $name != "") {
+            $this->name = $name;
+        }
+    }
+
+    public function GetFromDB() {
+
+        if (isset($_POST['destroy'])) {
+            unset($_POST['destroy']);
+            unset($_SESSION['currentPipeline']);
+        }
+
+        if (isset($_POST['clearPipeline'])) {
+            $this->pipeline = array();
+            $_SESSION['currentPipeline'] = $this->pipeline;
+        }
+
+        if (isset($_SESSION['currentPipeline']) && !empty($_SESSION['currentPipeline'])) {      // take pipeline from session data
+            $this->pipeline = $_SESSION['currentPipeline'];
+        } else {
+            $pipeline = array();
+        }
+
+        if (isset($_POST['objectToCreate'])) {      // user clicked a button in the toolbox.
+            //$this->pipeline[] = new Step($_POST['objectToCreate'], $_POST['objectToCreate'] . " NEW", null);
+            $this::AddStep($_POST['objectToCreate']);
+        }
+
+        if (isset($_POST['deleteSelected'])) {
+            if (isset($_POST['selectedStep'])) {
+                $this->RemoveStep($_POST['selectedStep']);
+            }
+        }
+
+        //var_dump($_POST);
+
+        if (isset($_POST['selectedStep'])) {
+            $this::SetSelected($_POST['selectedStep']);
+        }
+
+        $_SESSION['currentPipeline'] = $this->pipeline;
+    }
+
 }
 ?>
