Changeset 0a3bdfb1627f2d2ddac85121d5284626edf3397a
- Timestamp:
- 06/09/09 19:50:13
(4 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
| r43db6fd |
r0a3bdfb |
|
| 64 | 64 | } |
|---|
| 65 | 65 | } |
|---|
| 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 | |
|---|
| 77 | 69 | foreach ($sidvars as $sv) { |
|---|
| 78 | 70 | $sidtext = "<span class='sidvarspan'>$sv</span>"; |
|---|
| … | … | |
| 84 | 76 | ); |
|---|
| 85 | 77 | $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 | |
|---|
| 87 | 88 | foreach ($target_sid_map as $target_name => $sid_list) { |
|---|
| 88 | 89 | $params = array(); |
|---|
| … | … | |
| 137 | 138 | sidvars =[]; |
|---|
| 138 | 139 | |
|---|
| 139 | | $("#textvar").each ( function (i) { |
|---|
| | 140 | var template_e = $("#"+templateid); |
|---|
| | 141 | |
|---|
| | 142 | template_e.find("#textvar").each ( function (i) { |
|---|
| 140 | 143 | textvals+= "&"+$(this).attr('name')+"="+$(this).val(); |
|---|
| 141 | 144 | textvars[i] = $(this).attr('name'); |
|---|
| 142 | 145 | }); |
|---|
| 143 | 146 | |
|---|
| 144 | | |
|---|
| 145 | | $(".sidvar").each(function(i) { |
|---|
| | 147 | template_e.find(".sidvar").each(function(i) { |
|---|
| 146 | 148 | sidvars[i] = $(this).text(); |
|---|
| 147 | 149 | }); |
|---|
| … | … | |
| 149 | 151 | var sidvar_sid_map = Array(); |
|---|
| 150 | 152 | //this code to determine the sidvar is kind of hacky... |
|---|
| 151 | | $(".sid_select :selected").each(function(i, selected) { |
|---|
| | 153 | template_e.find(".sid_select :selected").each(function(i, selected) { |
|---|
| 152 | 154 | target_id = $(selected).attr("class"); |
|---|
| 153 | 155 | sidvarclass = $(selected).parents(".collapsable:eq(0)").find("span").attr("class"); |
|---|
| … | … | |
| 164 | 166 | if(sids.length > 0){ |
|---|
| 165 | 167 | var dataString = 'templateid='+templateid+'&textvars='+textvars.join(',')+'&sidvars='+sidvars.join(',')+textvals+sidvals; |
|---|
| 166 | | console.log("the datastring = ", dataString); |
|---|
| 167 | 168 | $.ajax({ |
|---|
| 168 | 169 | type: "POST", |
|---|