Changeset 93


Ignore:
Timestamp:
08/31/11 14:54:21 (14 years ago)
Author:
fpvanagthoven
Message:

Applications can now be added to the pipeline in SessionCreationTool?

File:
1 edited

Legend:

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

    r83 r93  
    2020        var_dump($_POST);
    2121        var_dump($session);
    22        
    2322        ?>
    2423
     
    4948        <script type="text/javascript">
    5049            var pipelineCount = 0;
    51                                                                                                                                                                                                                                                                                                                                      
     50                                                                                                                                                                                                                                                                                                                                            
    5251            // =============================================================
    53                                                                                                                                                                                                                                                                                                                                                            
    54             function addSurvey(surveyID) {       
     52                                                                                                                                                                                                                                                                                                                                                                   
     53            function addSurvey() {     
    5554                var surveysList = document.getElementById("surveysList");
    56                            
    57                 if(surveysList.selectedIndex != -1 || surveyID != null)
     55                var entryType = "s";
     56                var color = "#00ccff";
     57               
     58                addFromList(surveysList, entryType, color);
     59            }
     60                   
     61            function addApplication()
     62            {
     63                var applicationsList = document.getElementById("applicationsList");
     64                var entryType = "a";
     65                var color = "gold";
     66               
     67                addFromList(applicationsList, entryType, color);
     68            }
     69                   
     70            function addFromList(list, entryType, color)
     71            {
     72                if(list.selectedIndex != -1)
    5873                {
    5974                    var pipeline = document.getElementById("pipeline");
    6075                    var entry = document.createElement("option");
    61                            
    62                     if (surveyID != null)
    63                     {
    64                         pipelineCount++;
    65                         entry.setAttribute("value", surveyID);
    66                         entry.innerHTML = pipelineCount + ". " + surveysList.options.namedItem(surveyID).innerHTML;
    67                     }
    68                     else if(surveysList.selectedIndex != -1)
    69                     {
    70                         pipelineCount++;
    71                         entry.setAttribute("value", surveysList.options[surveysList.selectedIndex].value);
    72                                                                                                                                                                                            
    73                         entry.innerHTML = pipelineCount + ". " + surveysList.options[surveysList.selectedIndex].innerHTML;
    74                                                                                                                                                                                            
    75                     }
    76                     entry.style.backgroundColor = "#0090ac";
    77                     entry.name = pipelineCount + "s";
    78                     entry.entryType = "s";
    79                                                                                                                                                                                                                                                
     76                   
     77                    pipelineCount++;
     78                   
     79                    entry.setAttribute("value", list.options[list.selectedIndex].value);
     80                    entry.innerHTML = pipelineCount + ". " + list.options[list.selectedIndex].innerHTML;
     81                   
     82                    entry.style.backgroundColor = color;
     83                    entry.name = pipelineCount + entryType;
     84                    entry.entryType = entryType;
     85                   
    8086                    pipeline.appendChild(entry);
    81                 }                         
    82             }
    83                                                                                                                                                                                                                                    
     87                }
     88            }
     89                                                                                                                                                                                                                                           
    8490            function addDashboard() {
    8591                pipelineCount++;
    8692                var pipeline = document.getElementById("pipeline");
    87                                                                                                                                                                                                                                        
     93                                                                                                                                                                                                                                               
    8894                var entry = document.createElement("option");
    8995                entry.setAttribute("value", "dashboard");
     
    9399                entry.name = pipelineCount + "d";
    94100                entry.entryType = "d";
    95                                                                                                                                                                                                                                        
     101                                                                                                                                                                                                                                               
    96102                pipeline.appendChild(entry);
    97103            }
    98                                                                                    
     104                                                                                           
    99105            function removeFromPipeline() {
    100106                var pipeline = document.getElementById("pipeline");
     
    103109                    var index = pipeline.selectedIndex;
    104110                    pipeline.remove(index);
    105                     if (pipelineCount > 1)
     111                    if (pipelineCount > 1 &&
     112                        pipeline.options[index] != null)
    106113                    {
    107114                        pipeline.options[index].selected = true;
    108115                    }
    109                                                                            
     116                                                                                  
    110117                    for(var i = index; i < pipeline.length; i++)
    111118                    {
     
    119126                }
    120127            }
    121                                                                                                                                                                                                                                                      
     128                                                                                                                                                                                                                                                            
    122129            function submitPipeline()
    123130            {
    124131                var form = document.getElementById("sessionCreationForm");
    125                                                                                                                                                                                                                        
     132                                                                                                                                                                                                                               
    126133                var pipeline = document.getElementById("pipeline").options;
    127                                                                                                                                                                                                                                
    128                                                                                                                                                                                                                                
     134                                                                                                                                                                                                                                      
     135                                                                                                                                                                                                                                       
    129136                for (var i = 0; i < pipeline.length; i++)
    130137                {
     
    133140                    pipelineElem.value = pipeline[i].value;
    134141                    pipelineElem.type = "hidden";
    135                                                                                                                                                                                                                            
     142                                                                                                                                                                                                                                   
    136143                    form.appendChild(pipelineElem);
    137144                }
    138                                                                                                                                                                                                                
     145                                                                                                                                                                                                                       
    139146                var count = document.createElement("input");
    140147                count.name = "pipelineCount";
    141148                count.value = pipelineCount;
    142149                count.type = "hidden";
    143                                                                                                                                                                                                                
     150                                                                                                                                                                                                                       
    144151                form.appendChild(count);
    145152            }
     
    250257    private function addApplicationToPipelineButton() {
    251258        ?>
    252         <input type="button" class="surveyButton pipelineButton leftAlign leftPadding1" value="<=====" />
     259        <input type="button" class="surveyButton pipelineButton leftAlign leftPadding1" value="<=====" onclick="addApplication()"/>
    253260        <?php
    254261    }
Note: See TracChangeset for help on using the changeset viewer.