Project

General

Profile

1 4080 daigle
 /*
2
  *   '$RCSfile$'
3
  *     Purpose: Default style sheet for admin web pages
4
  *   Copyright: 2008 Regents of the University of California and the
5
  *               National Center for Ecological Analysis and Synthesis
6
  *     Authors: Matt Jones
7
  *
8
  *    '$Author$'
9
  *      '$Date$'
10
  *  '$Revision$'
11
  *
12
  * This program is free software; you can redistribute it and/or modify
13
  * it under the terms of the GNU General Public License as published by
14
  * the Free Software Foundation; either version 2 of the License, or
15
  * (at your option) any later version.
16
  *
17
  * This program is distributed in the hope that it will be useful,
18
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
  * GNU General Public License for more details.
21
  *
22
  * You should have received a copy of the GNU General Public License
23
  * along with this program; if not, write to the Free Software
24
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
  */
26
27 4752 daigle
function createExclusionList() {
28
	exclusionList = new Array();
29
}
30
31
function addExclusion(exclusionName) {
32
	exclusionList.push(exclusionName);
33
}
34
35
function validateForm(form_ref) {
36
    for (i = 0; i < form_ref.length; i++) {
37 4080 daigle
        if (form_ref.elements[i].value == "") {
38 4752 daigle
        	excludeThisField="false";
39
        	for (j = 0; j < exclusionList.length; j++) {
40
        		if (exclusionList[j] == form_ref.elements[i].id) {
41
        			excludeThisField="true";
42
        		}
43
        	}
44
        	if (excludeThisField == "true") {
45
            	alert("All form fields must be populated");
46
            	return false;
47
            }
48 4080 daigle
        }
49
    }
50
    return true;
51
}
52
53 4544 daigle
function submitForm(form_ref) {
54 4080 daigle
	form_ref.submit();
55
}
56
57 4544 daigle
function validateAndSubmitForm(form_ref) {
58
	if (!validateForm(form_ref)) {
59
		return false;
60
	}
61 4080 daigle
	form_ref.submit();
62 4544 daigle
63 4080 daigle
}
64
65
function forward(location) {
66
	window.location = location;
67
}
68
69
function toggleHiddenRow(thisObj, id) {
70
	if (thisObj.checked) {
71
		showRow(id);
72
	} else {
73
		hideObject(id);
74
	}
75
}
76
77
function toggleHiddenInline(thisObj, id) {
78
	if (thisObj.checked) {
79
		showInline(id);
80
	} else {
81
		hideObject(id);
82
	}
83
}
84
85
function toggleHiddenTable(thisObj, id) {
86
	if (thisObj.checked) {
87
		showSection(id);
88
	} else {
89
		hideObject(id);
90
	}
91
}
92
93
function hideObject(objectID)
94
{
95
	document.getElementById(objectID).style.display = 'none';
96
}
97
98
function showRow(objectID)
99
{
100
	document.getElementById(objectID).style.display = 'table-row';
101
}
102
103
function showInline(objectID)
104
{
105
        document.getElementById(objectID).style.display = 'inline';
106
}
107
108
function showSection(objectID)
109
{
110
	document.getElementById(objectID).style.display = 'table';
111
}
112
113 4100 daigle
function toggleHiddenDefaultText(radioName, activeSkinName) {
114
	radioList = document.getElementsByName(radioName);
115
	for (i = 0; i < radioList.length; i++) {
116
		radioId = radioList[i].id;
117
		nameArray = radioId.split("-", 1);
118
		radioSkinName = nameArray[0];
119
		if (radioSkinName == activeSkinName) {
120
			document.getElementById("hiding-default-" + radioSkinName).style.display = 'inline';
121
		} else {
122
			document.getElementById("hiding-default-" + radioSkinName).style.display = 'none';
123
		}
124
	}
125
}
126
127 4176 daigle
function helpWindow(context, helpFile) {
128 6989 jones
	fileLoc = context + "/" + helpFile;
129
	window.open(fileLoc,'mywindow','width=1050,height=800,scrollbars=yes,location=no,status=no');
130 4176 daigle
}
131 4100 daigle