Changeset 0a3bdfb1627f2d2ddac85121d5284626edf3397a

Show
Ignore:
Timestamp:
06/09/09 19:50:13 (5 years ago)
Author:
Umar Farooq <umar@omniti.com>
git-committer:
Umar Farooq <umar@omniti.com> 1244577013 +0000
git-parent:

[4555bbf6728dd4841601de69068a3c062a88b2de]

git-author:
Umar Farooq <umar@omniti.com> 1244577013 +0000
Message:

sidvars in templates can have their own set of valid sids for creating graphs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ui/web/htdocs/template_browse_json.php

    r43db6fd r0a3bdfb  
    6464        } 
    6565      } 
    66  
    67          $target_sid_map = array(); 
    68  
    69          foreach ($template->sids() as $item) {  
    70             foreach ($item as $match) { 
    71                     if(!isset($target_sid_map[$match[target]])) { 
    72                         $target_sid_map[$match[target]] = array(); 
    73                     } 
    74                        $target_sid_map[$match[target]][] = $match[sid]; 
    75             } 
    76          } 
     66          
     67         $valid_sids = $template->sids(); 
     68 
    7769         foreach ($sidvars as $sv) { 
    7870                 $sidtext = "<span class='sidvarspan'>$sv</span>"; 
     
    8476                           ); 
    8577                 $bag[] = $jitem; 
    86                   
     78 
     79                 $target_sid_map = array(); 
     80 
     81                 foreach ($valid_sids[$sv] as $match) { 
     82                   if(!isset($target_sid_map[$match[target]])) { 
     83                     $target_sid_map[$match[target]] = array(); 
     84                   } 
     85                   $target_sid_map[$match[target]][] = $match[sid]; 
     86                 } 
     87 
    8788                 foreach ($target_sid_map as $target_name => $sid_list) { 
    8889                    $params = array(); 
     
    137138sidvars =[]; 
    138139 
    139 $("#textvar").each ( function (i) { 
     140var template_e = $("#"+templateid); 
     141 
     142template_e.find("#textvar").each ( function (i) { 
    140143        textvals+=  "&"+$(this).attr('name')+"="+$(this).val(); 
    141144        textvars[i] = $(this).attr('name'); 
    142145}); 
    143146 
    144  
    145 $(".sidvar").each(function(i) { 
     147template_e.find(".sidvar").each(function(i) { 
    146148    sidvars[i] = $(this).text(); 
    147149}); 
     
    149151var sidvar_sid_map = Array(); 
    150152//this code to determine the sidvar is kind of hacky... 
    151 $(".sid_select :selected").each(function(i, selected) { 
     153template_e.find(".sid_select :selected").each(function(i, selected) { 
    152154         target_id = $(selected).attr("class"); 
    153155         sidvarclass = $(selected).parents(".collapsable:eq(0)").find("span").attr("class"); 
     
    164166if(sids.length > 0){ 
    165167        var dataString = 'templateid='+templateid+'&textvars='+textvars.join(',')+'&sidvars='+sidvars.join(',')+textvals+sidvals; 
    166         console.log("the datastring = ", dataString); 
    167168        $.ajax({ 
    168169                type: "POST",