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;
+    }
+
 }
 ?>
Index: Dev/trunk/css/awesome.css
===================================================================
--- Dev/trunk/css/awesome.css	(revision 144)
+++ Dev/trunk/css/awesome.css	(revision 146)
@@ -260,4 +260,15 @@
     -moz-border-radius: 6px;
     border-radius: 6px;
+}
+
+
+.surveyButton.dis {
+    color: #666;
+}
+
+.surveyButton.dis:hover {
+    background-color: transparent;
+    color: #666;
+    border-color: #555;
 }
 
@@ -648,5 +659,4 @@
 
 .seqContent .displayStep {
-    /*height: 140px;*/
     width: 52px;
     padding: 0;
@@ -666,5 +676,5 @@
 
 .seqContent .displayStep p{
-    margin-top: 55px;
+    margin-top: 5px;
     font-weight: normal;
     font-size: 0.875em;
@@ -697,4 +707,5 @@
     /*width: 40%;*/
     float: left;
+    margin: 1em 2em 0 0;
     /*background-image: url('../images/bg/sequencerBG.png');*/
     background-image: linear-gradient(top, #B0B0B0 21%, #888888 80%);
@@ -727,6 +738,7 @@
     margin: 0 0 5px 0;
     border: 1px solid #000;
-    border-radius: 5px;
-    -moz-border-radius: 5px;
+    border-radius: 6px;
+    -moz-border-radius: 6px;
+    cursor: pointer;
 }
 
@@ -737,5 +749,7 @@
 
 #toolbox .buttonIcon {
-    margin: 0 10px 0 5px;
+    border: none;
+    border-radius: 6px;
+    margin: 0 10px 0 0;
     float: left;
 }
Index: Dev/trunk/js/sequencerScripts.js
===================================================================
--- Dev/trunk/js/sequencerScripts.js	(revision 146)
+++ Dev/trunk/js/sequencerScripts.js	(revision 146)
@@ -0,0 +1,72 @@
+/* 
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+function IsItemSelected(check, target) {
+    if (check.value) {
+        target.disabled = false;
+    }
+    else {
+        target.disabled = true;
+    }
+}
+
+function IsCheckEnabled(check, target) {
+    if (check.checked) {
+        target.disabled = false;
+        this.removeClass(target, "dis");
+        
+    }
+    else {
+        target.disabled = true;
+        this.addClass(target, "dis");
+    }
+}
+
+function SubmitToolbox() {
+    document.forms['toolbox'].submit();
+}
+
+
+
+/*
+ * Selection code
+ * 
+ */
+
+function checkSelectedStep(number){
+    document.sequencer.selectedStep.value = number;
+    document.refresh();
+}
+
+function highlightSelectedStep() {
+    
+}
+
+
+
+
+
+
+
+
+
+
+// Class manipulation
+
+function hasClass(ele,cls) {
+	return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
+}
+ 
+function addClass(ele,cls) {
+	if (!this.hasClass(ele,cls)) ele.className += " "+cls;
+}
+ 
+function removeClass(ele,cls) {
+	if (hasClass(ele,cls)) {
+    	var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
+		ele.className=ele.className.replace(reg,' ');
+	}
+}
+
Index: Dev/trunk/pipelineEditor.php
===================================================================
--- Dev/trunk/pipelineEditor.php	(revision 144)
+++ Dev/trunk/pipelineEditor.php	(revision 146)
@@ -2,26 +2,20 @@
 require 'classes/master.php'; //should be at top of every page
 
+/* if (!isset($_SESSION['user'])){
+  redirect('index.php');
+  } */
 
-$pipeline = $_SESSION['currentPipeline'];
+//var_dump($_POST);
 
-// generate a set array of pipeline contents, in lieue of working database interface
-//if (isset($pipeline)){
-//$pipeline = array(new Step("Questionnaire", "Questionnaire 1", 1), new Step("Dashboard", "Dashboard 1", 2), new Step("Application", "Application 1", 3));
-//}
-//else {
-    $pipeline = $_SESSION['currentPipeline'];
-//}
-
-if (isset($_POST['objectToCreate'])){
-    $pipeline[] = new Step($_POST['objectToCreate'], $_POST['objectToCreate']." NEW", 4);
-    unset($_POST);
+if (isset($_SESSION['currentPipeline'])) {
+    $sequencer = new PipelineSequencer($_SESSION['currentPipeline'], "Test Pipeline #1", 1);
+} else {
+    $sequencer = new PipelineSequencer(null, "Test Pipeline #1", 1);
 }
 
-$_SESSION['currentPipeline'] = $pipeline;
+$sequencer->GetFromDB();    // doesn't actually currently get from db, uses session/post as a temporary alternative.
 
-$pipelineCount = 3;
-$pipelineName = "Test pipeline";
 
-$dbi = new DatabaseInterface();       //mkdir error?!?!?!
+//$dbi = new DatabaseInterface();
 ?>
 
@@ -36,18 +30,18 @@
         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
         <title></title>
-        <?php new StyleSheet("awesome"); ?>
+<?php new StyleSheet("awesome"); ?>
         <script type="text/javascript" src="js/menu.js"></script>
         <script type="text/javascript" src="js/jquery.jps"></script>
-        <script type="text/javascript" src="js/editorScripts.js"></script>
+        <script type="text/javascript" src="js/sequencerScripts.js"></script>
     </head>
     <body>
         <div id="header">
-            <?php new Logo(); ?>
+<?php new Logo(); ?>
         </div>
 
         <div id="wrapper">
             <div id="content">
-                <?php new pipelineSequencer($pipeline); ?>
-                <?php new Toolbox(); ?>
+<?php $sequencer->DrawSequencer(); ?>
+                <?php $toolbox = new Toolbox(); ?>
             </div>
     </body>
