Changeset 94 for Dev


Ignore:
Timestamp:
08/31/11 15:14:34 (14 years ago)
Author:
fpvanagthoven
Message:

Pipeline now gets populated correctly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/classes/SessionCreationTool.php

    r93 r94  
    4848        <script type="text/javascript">
    4949            var pipelineCount = 0;
    50                                                                                                                                                                                                                                                                                                                                              
     50                                                                                                                                                                                                                                                                                                                                                    
    5151            // =============================================================
    52                                                                                                                                                                                                                                                                                                                                                                    
    53             function addSurvey() {     
     52                                                                                                                                                                                                                                                                                                                                                                           
     53            function addSurvey(surveyID) {     
    5454                var surveysList = document.getElementById("surveysList");
    5555                var entryType = "s";
    5656                var color = "#00ccff";
    57                
    58                 addFromList(surveysList, entryType, color);
    59             }
    60                    
    61             function addApplication()
     57                       
     58                addFromList(surveysList, entryType, color, surveyID);
     59            }
     60                           
     61            function addApplication(applicationID)
    6262            {
    6363                var applicationsList = document.getElementById("applicationsList");
    6464                var entryType = "a";
    6565                var color = "gold";
    66                
    67                 addFromList(applicationsList, entryType, color);
    68             }
    69                    
    70             function addFromList(list, entryType, color)
     66                       
     67                addFromList(applicationsList, entryType, color, applicationID);
     68            }
     69                           
     70            function addFromList(list, entryType, color, id)
    7171            {
    72                 if(list.selectedIndex != -1)
     72                if(list.selectedIndex != -1 || id != null)
    7373                {
    7474                    var pipeline = document.getElementById("pipeline");
    7575                    var entry = document.createElement("option");
    76                    
     76                           
    7777                    pipelineCount++;
    78                    
    79                     entry.setAttribute("value", list.options[list.selectedIndex].value);
    80                     entry.innerHTML = pipelineCount + ". " + list.options[list.selectedIndex].innerHTML;
    81                    
     78                           
     79                    if (id != null)
     80                    {
     81                        entry.setAttribute("value", id);
     82                        entry.innerHTML = pipelineCount + ". " + list.options.namedItem(id).innerHTML;
     83                    }
     84                    else
     85                    {
     86                        entry.setAttribute("value", list.options[list.selectedIndex].value);
     87                        entry.innerHTML = pipelineCount + ". " + list.options[list.selectedIndex].innerHTML;
     88                    }
     89                           
     90                           
    8291                    entry.style.backgroundColor = color;
    8392                    entry.name = pipelineCount + entryType;
    8493                    entry.entryType = entryType;
    85                    
     94                           
    8695                    pipeline.appendChild(entry);
    8796                }
    8897            }
    89                                                                                                                                                                                                                                            
     98                                                                                                                                                                                                                                                   
    9099            function addDashboard() {
    91100                pipelineCount++;
    92101                var pipeline = document.getElementById("pipeline");
    93                                                                                                                                                                                                                                                
     102                                                                                                                                                                                                                                                       
    94103                var entry = document.createElement("option");
    95104                entry.setAttribute("value", "dashboard");
     
    99108                entry.name = pipelineCount + "d";
    100109                entry.entryType = "d";
    101                                                                                                                                                                                                                                                
     110                                                                                                                                                                                                                                                       
    102111                pipeline.appendChild(entry);
    103112            }
    104                                                                                            
     113                                                                                                   
    105114            function removeFromPipeline() {
    106115                var pipeline = document.getElementById("pipeline");
     
    114123                        pipeline.options[index].selected = true;
    115124                    }
    116                                                                                    
     125                                                                                          
    117126                    for(var i = index; i < pipeline.length; i++)
    118127                    {
     
    126135                }
    127136            }
    128                                                                                                                                                                                                                                                              
     137                                                                                                                                                                                                                                                                    
    129138            function submitPipeline()
    130139            {
    131140                var form = document.getElementById("sessionCreationForm");
    132                                                                                                                                                                                                                                
     141                                                                                                                                                                                                                                       
    133142                var pipeline = document.getElementById("pipeline").options;
    134                                                                                                                                                                                                                                        
    135                                                                                                                                                                                                                                        
     143                                                                                                                                                                                                                                              
     144                                                                                                                                                                                                                                               
    136145                for (var i = 0; i < pipeline.length; i++)
    137146                {
     
    140149                    pipelineElem.value = pipeline[i].value;
    141150                    pipelineElem.type = "hidden";
    142                                                                                                                                                                                                                                    
     151                                                                                                                                                                                                                                           
    143152                    form.appendChild(pipelineElem);
    144153                }
    145                                                                                                                                                                                                                        
     154                                                                                                                                                                                                                               
    146155                var count = document.createElement("input");
    147156                count.name = "pipelineCount";
    148157                count.value = pipelineCount;
    149158                count.type = "hidden";
    150                                                                                                                                                                                                                        
     159                                                                                                                                                                                                                               
    151160                form.appendChild(count);
    152161            }
     
    289298                    </script>
    290299                    <?php
    291                 } else if (isset($this->session->pipeline[$i . 'd'])) {
     300                }
     301                else if (isset($this->session->pipeline[$i . 'a'])) {
     302                    ?>
     303                    <script type="text/javascript">
     304                        addApplication(<?php echo "'" . $this->session->pipeline[$i . 'a'] . "'"; ?>);
     305                    </script>
     306                    <?php
     307                }
     308                else if (isset($this->session->pipeline[$i . 'd'])) {
    292309                    ?>
    293310                    <script type="text/javascript">
Note: See TracChangeset for help on using the changeset viewer.