source: BMXNET_RPMS_dotNET_UTILITIES-BMX/branch/IHS BMX Framework/IndianHealthService.BMXNet.Doc/Help/Scripts/CommonUtilities.js@ 1172

Last change on this file since 1172 was 1146, checked in by Sam Habiel, 14 years ago

Initial Import of BMX4

File size: 9.4 KB
Line 
1function codeBlockHandler(id, data, value, curvedTabCollections, tabCollections, blockCollections)
2{
3 var names = value.split(' ');
4
5 //Blocks
6 for(var blockCount = 0; blockCount < blockCollections.length; blockCount++)
7 {
8 toggleStyle(blockCollections[blockCount], 'x-lang', names[0], 'display', 'block', 'none');
9 }
10
11 //curvedTabs
12 for(var curvedTabCount = 0; curvedTabCount < curvedTabCollections.length; curvedTabCount++)
13 {
14 curvedToggleClass(curvedTabCollections[curvedTabCount], 'x-lang',names[0]);
15 }
16
17 //Tabs
18 for(var tabCount = 0; tabCount < tabCollections.length; tabCount++)
19 {
20 toggleClass(tabCollections[tabCount], 'x-lang', names[0], 'activeTab', 'tab');
21 }
22}
23
24function styleSheetHandler(id, data, value, curvedTabCollections, tabCollections, blockCollections)
25{
26 var names = value.split(' ');
27 var name = names[1];
28 toggleInlineStyle(name);
29}
30
31function persistenceHandler(id, data, value, curvedTabCollections, tabCollections, blockCollections)
32{
33 data.set('lang', value);
34 data.save();
35}
36
37function languageHandler(id, data, value, curvedTabCollections, tabCollections, blockCollections)
38{
39 var names = value.split(' ');
40 toggleLanguage(id, 'x-lang', names[0]);
41}
42
43toggleInlineStyle = function(name)
44{
45 var sd = getStyleDictionary();
46 if (name == 'cs') {
47 sd['span.cs'].display = 'inline';
48 sd['span.vb'].display = 'none';
49 sd['span.cpp'].display = 'none';
50 } else if (name == 'vb') {
51 sd['span.cs'].display = 'none';
52 sd['span.vb'].display = 'inline';
53 sd['span.cpp'].display = 'none';
54 } else if (name == 'cpp') {
55 sd['span.cs'].display = 'none';
56 sd['span.vb'].display = 'none';
57 sd['span.cpp'].display = 'inline';
58 } else {
59 }
60}
61
62toggleLanguage = function(id, data, value)
63{
64 var tNodes = getChildNodes('languageFilterToolTip');
65
66 for(var labelCount=0; labelCount < tNodes.length; labelCount++)
67 {
68 if(tNodes[labelCount].tagName != 'IMG' && tNodes[labelCount].tagName != '/IMG')
69 {
70 if(tNodes[labelCount].getAttribute('id').indexOf(value) >= 0)
71 {
72 tNodes[labelCount].style['display'] = 'inline';
73 }
74 else
75 {
76 tNodes[labelCount].style['display'] = 'none';
77 }
78 }
79 }
80
81 var languageNodes = getChildNodes(id);
82
83 for(var languageCount=0; languageCount < languageNodes.length; languageCount++)
84 {
85 if(languageNodes[languageCount].tagName == 'DIV');
86 {
87 if(languageNodes[languageCount].getAttribute('id'))
88 {
89 var imageNodes = getChildNodes(languageNodes[languageCount].getAttribute('id'))[0];
90 if (languageNodes[languageCount].getAttribute('id') == value)
91 {
92 imageNodes.src = radioSelectImage.src;
93 }
94 else
95 {
96 imageNodes.src = radioUnSelectImage.src;
97 }
98 }
99 }
100 }
101}
102
103toggleStyle = function(blocks, attributeName, attributeValue, styleName, trueStyleValue, falseStyleValue)
104{
105 var blockNodes = getChildNodes(blocks);
106
107 for(var blockCount=0; blockCount < blockNodes.length; blockCount++)
108 {
109 var blockElement = blockNodes[blockCount].getAttribute(attributeName);
110 if (blockElement == attributeValue) blockNodes[blockCount].style[styleName] = trueStyleValue;
111 else blockNodes[blockCount].style[styleName] = falseStyleValue;
112 }
113}
114
115curvedToggleClass = function(curvedTabs, attributeName, attributeValue)
116{
117 var curvedTabNodes = getChildNodes(curvedTabs);
118
119 for(var curvedTabCount=0; curvedTabCount < curvedTabNodes.length; curvedTabCount++)
120 {
121 var curvedTabElement = curvedTabNodes[curvedTabCount].getAttribute(attributeName);
122 if (curvedTabElement == attributeValue)
123 {
124 if (curvedTabNodes[curvedTabCount].className == 'leftTab' || curvedTabNodes[curvedTabCount].className == 'activeLeftTab')
125 {
126 curvedTabNodes[curvedTabCount].className = 'activeLeftTab';
127 }
128 else if(curvedTabNodes[curvedTabCount].className == 'rightTab' || curvedTabNodes[curvedTabCount].className == 'activeRightTab')
129 {
130 curvedTabNodes[curvedTabCount].className = 'activeRightTab';
131 }
132 else if(curvedTabNodes[curvedTabCount].className == 'middleTab' || curvedTabNodes[curvedTabCount].className == 'activeMiddleTab')
133 {
134 curvedTabNodes[curvedTabCount].className = 'activeMiddleTab';
135 }
136 }
137 else
138 {
139 if (curvedTabNodes[curvedTabCount].className == 'leftTab' || curvedTabNodes[curvedTabCount].className == 'activeLeftTab')
140 {
141 curvedTabNodes[curvedTabCount].className = 'leftTab';
142 }
143 else if(curvedTabNodes[curvedTabCount].className == 'rightTab' || curvedTabNodes[curvedTabCount].className == 'activeRightTab')
144 {
145 curvedTabNodes[curvedTabCount].className = 'rightTab';
146 }
147 else if(curvedTabNodes[curvedTabCount].className == 'middleTab' || curvedTabNodes[curvedTabCount].className == 'activeMiddleTab')
148 {
149 curvedTabNodes[curvedTabCount].className = 'middleTab';
150 }
151 }
152 }
153}
154
155toggleClass = function(tabs, attributeName, attributeValue, trueClass, falseClass)
156{
157 var tabNodes = getChildNodes(tabs);
158
159 for(var tabCount=0; tabCount < tabNodes.length; tabCount++)
160 {
161 var tabElement = tabNodes[tabCount].getAttribute(attributeName);
162
163 if (tabElement == attributeValue)
164 {
165 if(tabNodes[tabCount].className == 'leftGrad' || tabNodes[tabCount].className == 'activeLeftGrad')
166 {
167 tabNodes[tabCount].className = 'activeLeftGrad';
168 }
169 else if (tabNodes[tabCount].className == 'rightGrad' || tabNodes[tabCount].className == 'activeRightGrad')
170 {
171 tabNodes[tabCount].className = 'activeRightGrad';
172 }
173 else tabNodes[tabCount].className = trueClass;
174 }
175 else
176 {
177 if(tabNodes[tabCount].className == 'leftGrad' || tabNodes[tabCount].className == 'activeLeftGrad')
178 {
179 tabNodes[tabCount].className = 'leftGrad';
180 }
181 else if (tabNodes[tabCount].className == 'rightGrad' || tabNodes[tabCount].className == 'activeRightGrad')
182 {
183 tabNodes[tabCount].className = 'rightGrad';
184 }
185 else tabNodes[tabCount].className = falseClass;
186 }
187 }
188}
189
190getChildNodes = function(node)
191{
192 var element = document.getElementById(node);
193
194 // get the children
195 if (element.tagName == 'TABLE')
196 {
197 // special handling for tables
198 var bodies = element.tBodies;
199 for(i = 0; i < bodies.length; i++)
200 {
201 var nodes = bodies[i].rows;
202 return nodes;
203 }
204 }
205 else
206 {
207 // all other cases
208 var nodes = element.childNodes;
209 return nodes;
210 }
211}
212
213process = function(list, methodName, typeName) {
214 var listNodes = getChildNodes(list);
215
216 for(var i=0; i < listNodes.length; i++)
217 {
218 var listElement = listNodes[i];
219
220 if (typeName == 'type' && tf != null) getInstanceDelegate(tf,methodName)(listElement);
221 else if (typeName == 'member' && mf != null) getInstanceDelegate(mf, methodName)(listElement);
222 }
223}
224
225function getStyleDictionary() {
226 var styleDictionary = new Array();
227
228 // iterate through stylesheets
229 var sheets = document.styleSheets;
230
231 for(var i=0; i<sheets.length;i++) {
232 var sheet = sheets[i];
233
234 // Ignore sheets at ms-help Urls
235 if (sheet.href.substr(0,8) == 'ms-help:') continue;
236
237 // get sheet rules
238 var rules = sheet.cssRules;
239
240 if (rules == null) rules = sheet.rules;
241
242 // iterate through rules
243 for(j=0; j<rules.length; j++) {
244 var rule = rules[j];
245
246 // Ignore ones that aren't defined
247 if(rule.selectorText == null)
248 continue;
249
250 // add rule to dictionary
251 styleDictionary[rule.selectorText.toLowerCase()] = rule.style;
252 }
253 }
254
255 return(styleDictionary);
256}
257
258function toggleCheck(imageElement)
259{
260 if(imageElement.src == checkBoxSelectImage.src)
261 {
262 imageElement.src = checkBoxUnSelectImage.src;
263 return false;
264 }
265 else
266 {
267 imageElement.src = checkBoxSelectImage.src;
268 return true;
269 }
270}
271
272function mouseOverCheck(imageElement, selected, unselected, selected_hover, unselected_hover)
273{
274 if(imageElement.src == selected.src)
275 {
276 imageElement.src = selected_hover.src;
277 }
278 else if(imageElement.src == unselected.src)
279 {
280 imageElement.src = unselected_hover.src;
281 }
282}
283
284
285function mouseOutCheck(imageElement, selected, unselected, selected_hover, unselected_hover)
286{
287 if(imageElement.src == selected_hover.src)
288 {
289 imageElement.src = selected.src;
290 }
291 else if(imageElement.src == unselected_hover.src)
292 {
293 imageElement.src = unselected.src;
294 }
295}
296
297function toggleSelect(imageElement, section)
298{
299 if(imageElement.src == twirlSelectImage.src)
300 {
301 imageElement.src = twirlUnSelectImage.src;
302 section.style['display'] = 'none';
303 }
304 else
305 {
306 imageElement.src = twirlSelectImage.src;
307 section.style['display'] = 'block';
308 }
309}
310
311function changeLanguage(data, name, style) {
312 if (languageFilter == null) return;
313
314 languageFilter.changeLanguage(data, name, style);
315}
316
317function processSubgroup(subgroup, typeName) {
318 if (typeName == 'type' && tf != null) tf.subgroup = subgroup;
319 else if (typeName == 'member' && mf != null) mf.subgroup = subgroup;
320}
321
322function toggleCheckState(visibility, value) {
323 if (mf == null) return;
324 mf[visibility] = value;
325}
326
327
328
Note: See TracBrowser for help on using the repository browser.