PageSourceSearch

https://www.littlebirdiehome.com/vlInclude/types.js

js littlebirdiehome.com collected 2026-09-26 11:44:58 UTC 15,631 bytes, 549 lines download raw bytes

1/*
2     Copyright 2005 Speartek, Inc.
3
4     All rights reserved.
5
6     All materials contained in this file are protected by United States copyright law
7     and may not be reproduced, distributed, transmitted, displayed, published or
8     broadcast without the prior written permission of Speartek, Inc.
9     You may not alter or remove this notice.
10*/
11function tAllHiddenInput(obj, objName)
12{
13	var aryTmp = new Array();
14	var strSelect = '';
15		for(var i = 0; i < obj.length; i++)
16		{
17			aryTmp = obj[i];
18			strSelect += '<input type="hidden" name="' + objName + '_' + obj[i][0] + '" id="' + objName + '_' + obj[i][0] + '" value="' + obj[i][1] + '"/>';
19		}
20	document.write(strSelect);
21}//end of tAllHiddenInput()
22/*	obj is the Type Array
23	name is the name of the value
24*/
25function tGetTypeID(obj, name)
26{
27	var aryTmp = new Array();
28		for(var i = 0; i < obj.length; i++)
29		{
30			aryTmp = obj[i];
31			if(aryTmp[0].toUpperCase() == name.toUpperCase()){return aryTmp[1]}
32		}
33		return null;
34}//end of tGetTypeID()
35function tHiddenInput(obj, name, tagName)
36{	
37	document.write('<input type="hidden" name="' + tagName + '" id="' + tagName + '" value="' + tGetTypeID(obj, name) + '"/>');
38}
39/*	obj is the Type Array
40	selected is the name of the value
41	name is the name of the tag
42*/
43function tSelect(obj, selected, tagName, aryDisplay, blnSort, addlOptions, sFilter)
44{
45	var aryTmp = new Array();
46	sFilter = (sFilter==null)? '' : ',' + sFilter + ',';
47	addlOptions = (addlOptions==null)? '' : ' ' + addlOptions;
48	var strSelect = '<select id="' + tagName + '"  name="' + tagName + '" class="FormElementInput"' + addlOptions + '>';
49		if(arguments[3])
50		{
51			for(var i = 0; i < aryDisplay.length; i++)
52			{
53				strSelect += '<option value="' + aryDisplay[i][1] + '">' + aryDisplay[i][0] + '</option>';
54			}
55		}
56		if (arguments[4])
57		{
58			obj.sort(); //sort by first element -psb
59		}
60		for(var i = 0; i < obj.length; i++)
61		{
62			if(obj[i][1] == selected)
63			{
64				strSelect += '<option value="' + obj[i][1] + '" selected>' + obj[i][0] + '</option>';
65			}else if(sFilter.length == 0 || sFilter.indexOf(','+obj[i][1]+',') != -1){
66				strSelect += '<option value="' + obj[i][1] + '">' + obj[i][0] + '</option>';
67			}
68		}
69		strSelect += '</select>';
70	document.write(strSelect);
71}
72/*	obj is the Type Array
73	selected is the name of the value
74	name is the name of the tag
75*/
76function tMultiSelect(obj, selected, tagName, aryDisplay, blnSort)
77{
78	var aryTmp = new Array();
79	var strSelect = '<select name="' + tagName + '" id="' + tagName + '" multiple size="4">';
80		if(arguments[3])
81		{
82			for(var i = 0; i < aryDisplay.length; i++)
83			{
84				strSelect += '<option value=\"' + aryDisplay[i][1] + '\">' + aryDisplay[i][0] + '</option>';
85			}
86		}		
87		if (arguments[4])
88		{
89			obj.sort(); //sort by first element -psb
90		}
91		for(var i = 0; i < obj.length; i++)		
92		{
93			if(obj[i][1] == selected)
94			{
95				strSelect += '<option value=\"' + obj[i][1] + '\" selected>' + obj[i][0] + '</option>';
96			}else{
97				strSelect += '<option value=\"' + obj[i][1] + '\">' + obj[i][0] + '</option>';
98			}
99		}
100		strSelect += '</select>';
101	document.write(strSelect);
102}
103/*	obj is the Type Array
104	selected is the name of the value
105	name is the name of the tag
106*/
107function tCheckBox(obj, selected, tagName)
108{
109	var aryTmp = new Array();
110	var strSelect = '';
111	try
112	{
113		for(var i = 0; i < obj.length; i++)
114		{
115			aryTmp = obj[i];
116			if(aryTmp[1] == selected)
117			{
118				strSelect += aryTmp[0] + '<input type="checkbox" value="' + aryTmp[1] + '" name="' + tagName + '" ="' + tagName + '" />';
119			}else{
120				strSelect += aryTmp[0] + '<input type="checkbox" value="' + aryTmp[1] + '" name="' + tagName + '" id="' + tagName + '" checked />';
121			}
122		}
123		strSelect += '</select>';
124	}
125	catch(er)
126	{
127	}
128	document.write(strSelect);
129}
130//#############################################################################################
131//############################## Security Functions ###########################################
132//#############################################################################################
133function tSelectAllSecurity(formName)
134{
135	try
136	{
137		if(document[formName]['AllSecurityLevels'].checked)
138		{
139			for(var i = 0; i < SECURITY_TYPES.length; i++)
140			{
141				if(document[formName][SECURITY_TYPES[i][0]])
142				{
143					document[formName][SECURITY_TYPES[i][0]].checked = true;
144				}
145			}
146		}
147		tSecuritySum(formName);
148	}
149	catch(er){}
150}
151function tSecuritySum(formName)
152{
153	try
154	{
155		var SecSum = 0;
156		if(document[formName]['AllSecurityLevels'])
157		{
158			if(document[formName]['AllSecurityLevels'].checked)
159			{
160				SecSum = 2147483647;
161			}else{
162				for(var i = 0; i < SECURITY_TYPES.length; i++)
163				{
164					if(document[formName][SECURITY_TYPES[i][0]])
165					{
166						if(document[formName][SECURITY_TYPES[i][0]].checked)
167						{
168							SecSum += Math.pow(2, (SECURITY_TYPES[i][1] - 1));
169						}
170					}else if((SECURITY_TYPES[i][0].toUpperCase() == 'MASTERADMIN') || SECURITY_TYPES[i][0].toUpperCase() == 'SITEADMIN'){
171						SecSum += Math.pow(2, (SECURITY_TYPES[i][1] - 1));
172					}
173				}
174			}
175			document[formName]['SecurityLevel'].value = SecSum;
176		}
177	}
178	catch(er){}
179}
180function tIsChecked(tag, formName)
181{
182	try
183	{
184		tag = GetTag(tag);
185		if(document[formName]['AllSecurityLevels'].checked)
186		{
187			if(!tag.checked)
188			{
189				tag.checked = true;
190				throw 'You must uncheck All Security Levels before you can remove another Security Level';
191			}
192		}
193		tSecuritySum(formName);
194	}
195	catch(er)
196	{
197		alert(er);
198	}
199}
200function tSecurity(tag, formName, selectedValue)
201{
202	try
203	{
204		var strOut = '<table>';
205		tag = GetTag(tag);
206
207		strOut += '<tr><td><input type="checkbox" name="AllSecurityLevels" id="AllSecurityLevels" value="2147483647" onclick="tSelectAllSecurity(\'' + formName + '\');"';
208		if(selectedValue == 2147483647){strOut += ' checked'}
209		strOut += '/></td>';
210		strOut += '<td class="Primary">&nbsp;All Security Levels</td></tr>';
211
212		for(var i = 0; i < SECURITY_TYPES.length; i++)
213		{
214			if((SECURITY_TYPES[i][0].toUpperCase() != 'MASTERADMIN') && (SECURITY_TYPES[i][0].toUpperCase() != 'SITEADMIN'))
215			{
216				strOut += '<tr><td><input type="checkbox" name="' + SECURITY_TYPES[i][0] + '" id="' + SECURITY_TYPES[i][0] + '" value="' + Math.pow(2, (SECURITY_TYPES[i][1] - 1)) + '" onclick="tIsChecked(this, \'' + formName + '\');"';
217				if(selectedValue & Math.pow(2, (SECURITY_TYPES[i][1] - 1))){strOut += ' checked'}
218				strOut += '/></td>';
219				strOut += '<td class="Primary">&nbsp;' + SECURITY_TYPES[i][0] + '</td></tr>'
220			}
221		}
222
223		strOut += '<tr><td colspan="2"><input type="hidden" name="SecurityLevel" id="SecurityLevel" value=""/>';
224		strOut += '<input type="hidden" name="MasterAdminSecurityTypeID" id="MasterAdminSecurityTypeID" value="' + tGetTypeID(SECURITY_TYPES, 'MasterAdmin').toString() + '"/>';
225		strOut += '<input type="hidden" name="SiteAdminSecurityTypeID" id="SiteAdminSecurityTypeID" value="' + tGetTypeID(SECURITY_TYPES, 'SiteAdmin').toString() + '"/>';
226		strOut += '</td></tr>';
227		strOut += '</table>';
228		tag.innerHTML = strOut;
229		tSecuritySum(formName);
230	}
231	catch(er)
232	{
233	}
234}
235//#########################################################################################################
236//################################ Second Gen Types Functions #############################################
237//#########################################################################################################
238/*	obj is the Type Array
239	name is the name of the value
240*/
241function ttGetTypeID(aryTypes, typeName)
242{
243	try
244	{
245		for(var i = 0; i < aryTypes.length; i++)
246		{
247			if(aryTypes[i][0].toUpperCase() == typeName.toUpperCase()){return aryTypes[i][1]}
248		}
249	}
250	catch(er)
251	{
252	}
253}
254function ttGetTypeName(aryTypes, typeId)
255{
256	try
257	{
258		for(var i = 0; i < aryTypes.length; i++)
259		{
260			if(aryTypes[i][1] == typeId){return aryTypes[i][0]}
261		}
262	}
263	catch(er)
264	{
265	}
266}
267function ttSelect(tag, aryTypes, selectedID, formName, tagName, aryDisplay)
268{
269	try
270	{
271		var strSelect = '<select name="' + tagName + '" id="' + tagName + '">';
272
273		if(arguments[5])
274		{
275			for(var i = 0; i < aryDisplay.length; i++)
276			{
277				strSelect += '<option value="' + aryDisplay[i][1] + '">' + aryDisplay[i][0] + '</option>';
278			}
279		}
280		for(var i = 0; i < aryTypes.length; i++)
281		{
282			if(aryTypes[i][1] == selectedID)
283			{
284				strSelect += '<option value="' + aryTypes[i][1] + '" selected>' + aryTypes[i][0] + '</option>';
285			}
286			else
287			{
288				strSelect += '<option value="' + aryTypes[i][1] + '">' + aryTypes[i][0] + '</option>';
289			}
290		}
291		strSelect += '</select>'
292	}
293	catch(er){}
294	GetTag(tag).innerHTML = strSelect
295}
296function ttMultiSelect(tag, aryTypes, selectedID, formName, tagName, aryDisplay)
297{
298	//!!
299	//!tag CANNOT EQUAL tagName!
300	//!!
301	try
302	{
303		var strSelect = '<select name="' + tagName + '" id="' + tagName + '" multiple>';
304		tag = GetTag(tag);
305
306		if(arguments[5])
307		{
308			for(var i = 0; i < aryDisplay.length; i++)
309			{
310				strSelect += '<option value="' + aryDisplay[i][1] + '">' + aryDisplay[i][0] + '</option>';
311			}
312		}
313		for(var i = 0; i < aryTypes.length; i++)
314		{
315			if(aryTypes[i][1] == selectedID)
316			{
317				strSelect += '<option value="' + aryTypes[i][1] + '" selected>' + aryTypes[i][0] + '</option>';
318			}else{
319				strSelect += '<option value="' + aryTypes[i][1] + '">' + aryTypes[i][0] + '</option>';
320			}
321		}
322		strSelect += '</select>';
323	}
324	catch(er)
325	{
326	}
327	tag.innerHTML = strSelect;
328	return document[formName][tagName];
329}
330function ttCheckBox(tag, aryTypes, selectedID, formName, tagName)
331{
332	try
333	{
334		var strSelect = '';
335		tag  = GetTag(tag);
336
337		for(var i = 0; i < aryTypes.length; i++)
338		{
339			if(aryTypes[i][1] == selectedID)
340			{
341				strSelect += aryTypes[i][0] + '<input type="checkbox" value="' + aryTypes[i][1] + '" name="' + tagName + '" id="' + tagName + '" checked />';
342			}else{
343				strSelect += aryTypes[i][0] + '<input type="checkbox" value="' + aryTypes[i][1] + '" name="' + tagName + '" id="' + tagName + '" />';
344			}
345		}
346		strSelect += '</select>';
347	}
348	catch(er)
349	{
350	}
351	tag.innerHTML = strSelect;
352	return document[formName][tagName];
353}
354function ttHiddenInput(tag, aryTypes, typeName, formName, tagName)
355{
356	try
357	{
358		tag = GetTag(tag);
359		tag.innerHTML = '<input type="hidden" name="' + tagName + '" id="' + tagName + '" value="' + tGetTypeID(aryTypes, typeName) + '"/>';
360	}
361	catch(er)
362	{
363	}
364	return document[formName][tagName];
365}
366function ttAllHiddenInput(tag, aryTypes, tagName)
367{
368	try
369	{
370		var strSelect = '';
371		tag = GetTag(tag);
372		for(var i = 0; i < aryTypes.length; i++)
373		{
374			strSelect += '<input type="hidden" name="' + tagName + '_' + aryTypes[i][0] + '" id="' + tagName + '_' + aryTypes[i][0] + '" value="' + aryTypes[i][1] + '"/>';
375		}
376	}
377	catch(er)
378	{
379	}
380	tag.innerHTML = strSelect;
381}
382
383/*
384
385The previous version seem to work - but I'll keep the code for this one here.
386
387function ttAllHiddenInput(tag, aryTypes, tagName)
388{
389	try
390	{		
391		var input = document.createElement("input");
392		tag = GetTag(tagID);					
393						
394		for(var i = 0; i < aryTypes.length; i++)
395		{		        
396				input.name=tagName+"_"+ aryTypes[i][0] ;
397				input.type="hidden";
398				input.id=tagName+"_"+ aryTypes[i][0] ;
399				input.value=aryTypes[i][1];
400								
401				tag.appendChild(input);
402		}		
403	}
404	catch(er)
405	{
406		
407	}		
408}
409
410*/
411
412//FUNCTIONS TO INTERACT WITH ARRAYS
413function GetArrayValue(ArrayName, ID, Column){
414	// assumes the first column is the ID column - johnt 8/14/2001
415	try	{
416		var val = '' ;
417		var i = 0 ;
418		var found = false ;
419		while((i < ArrayName.length) && (!found)){
420			if(ArrayName[i][0] == ID){
421				val = ArrayName[i][Column] ;
422				found = true;
423			}
424			i++ ;
425		}
426		return val ;
427	}
428	catch(er){}
429}
430
431function GetArrayID(ArrayName, SearchString, SearchColumn, FilterString, FilterColumn)
432{
433	// assumes the first column is the ID column - johnt 9/18/2001
434	// returns zero if id not found
435	try
436	{
437		var val = 0 ;
438		var i = 0 ;
439		var found = false ;
440		
441		while((i < ArrayName.length) && (!found))
442		{
443			var filtermatch = true ;
444			if(FilterString!=='')
445			{
446				filtermatch = (ArrayName[i][FilterColumn] == FilterString);
447			}
448			if(filtermatch)
449			{
450				var upperValue = ArrayName[i][SearchColumn].toString().toUpperCase();
451				if(upperValue == SearchString.toString().toUpperCase())
452				{
453					val = ArrayName[i][0] ;
454					found = true;
455				}
456			}
457			i++ ;
458		}
459		return val ;
460	}
461	catch(er){}
462}
463function arySelect(aryName, valueColumn, displayColumn, selectedValue, tagName, aryDisplay, blnSort)
464{
465	var aryTmp = new Array();
466	var strSelect = '<select name="' + tagName + '" id="' + tagName + '">';
467		if(arguments[5])
468		{
469			for(var i = 0; i < aryDisplay.length; i++)
470			{
471				strSelect += '<option value=\"' + aryDisplay[i][1] + '\">' + aryDisplay[i][0] + '</option>';
472			}
473		}
474		if (arguments[6])
475		{
476			aryName.sort(); //sort by first element -psb
477		}
478		for(var i = 0; i < aryName.length; i++)
479		{
480			if(aryName[i][valueColumn] == selectedValue)
481			{
482				strSelect += '<option value=\"' + aryName[i][valueColumn] + '\" selected>' + aryName[i][displayColumn] + '</option>';
483			}else{
484				strSelect += '<option value=\"' + aryName[i][valueColumn] + '\">' + aryName[i][displayColumn] + '</option>';
485			}
486		}
487		strSelect += '</select>';
488	document.write(strSelect);
489}
490
491function ttTargetSecurityType(tag, aryTypes, selectedID, formName, tagName)
492{
493	// This function is used to created a dropdown list of SecurityTypes based on the UIZones 
494	// value passed in.  The main purpose of this function is to create the dropdown list
495	// of securitytypes that a person can connect a login to.  It allows you to control 
496	// the  security types that the person can see and select from
497	try
498	{
499		var strSelect = '<select name=\"' + tagName + '\" id=\"id' + tagName + '\">';
500		tag = GetTag(tag);
501
502		for(var i = 0; i < aryTypes.length; i++)
503		{
504			if(aryTypes[i][1] == selectedID)
505			{
506				strSelect += '<option value=\"' + aryTypes[i][1] + '\" selected>' + aryTypes[i][0] + '</option>';
507			}else{
508				strSelect += '<option value=\"' + aryTypes[i][1] + '\">' + aryTypes[i][0] + '</option>';
509			}
510		}
511		strSelect += '</select>';
512	}
513	catch(er)
514	{
515	}
516	tag.innerHTML = strSelect;
517	return document[formName][tagName];
518}
519
520function ttTargetSecurityTypeAuthPros(tag, aryTypes, selectedID, formName, tagName)
521{
522	// This function is used to created a dropdown list of SecurityTypes based on the UIZones 
523	// value passed in.  The main purpose of this function is to create the dropdown list
524	// of securitytypes that a person can connect a login to.  It allows you to control 
525	// the  security types that the person can see and select from
526	try
527	{
528		var strSelect = '<select name=\"' + tagName + '\" id=\"id' + tagName + '\">';
529		tag = GetTag(tag);
530
531		for(var i = 0; i < aryTypes.length; i++)
532		{
533			if(aryTypes[i][1] != "6" && aryTypes[i][1] != "7" ){ //SiteAdmin & MasterAdmin
534				if(aryTypes[i][1] == selectedID)
535				{
536					strSelect += '<option value=\"' + aryTypes[i][1] + '\" selected>' + aryTypes[i][0] + '</option>';
537				}else{
538					strSelect += '<option value=\"' + aryTypes[i][1] + '\">' + aryTypes[i][0] + '</option>';
539				}
540			}
541		}
542		strSelect += '</select>';
543	}
544	catch(er)
545	{
546	}
547	tag.innerHTML = strSelect;
548	return document[formName][tagName];
549}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.