1
|
/*
|
2
|
* '$RCSfile$'
|
3
|
* Purpose: Default style sheet for KNB project web pages
|
4
|
* Using this stylesheet rather than placing styles directly in
|
5
|
* the KNB web documents allows us to globally change the
|
6
|
* formatting styles of the entire site in one easy place.
|
7
|
* Copyright: 2000 Regents of the University of California and the
|
8
|
* National Center for Ecological Analysis and Synthesis
|
9
|
* Authors: Matt Jones
|
10
|
*
|
11
|
* '$Author: costa $'
|
12
|
* '$Date: 2005-11-16 10:31:23 -0800 (Wed, 16 Nov 2005) $'
|
13
|
* '$Revision: 2743 $'
|
14
|
*
|
15
|
* This program is free software; you can redistribute it and/or modify
|
16
|
* it under the terms of the GNU General Public License as published by
|
17
|
* the Free Software Foundation; either version 2 of the License, or
|
18
|
* (at your option) any later version.
|
19
|
*
|
20
|
* This program is distributed in the hope that it will be useful,
|
21
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
22
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
23
|
* GNU General Public License for more details.
|
24
|
*
|
25
|
* You should have received a copy of the GNU General Public License
|
26
|
* along with this program; if not, write to the Free Software
|
27
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
28
|
*/
|
29
|
|
30
|
|
31
|
/**
|
32
|
* NOTE: THIS SCRIPT EXPECTS YOU ALREADY TO HAVE IMPORTED THE FOLLOWING
|
33
|
* VARIABLES, WHICH ARE TYPICALLY DEFINED IN style/skins/qformat/qformat.js:
|
34
|
*
|
35
|
* Location of the header that will be displayed at the top of the page
|
36
|
* HEADER_URL
|
37
|
*
|
38
|
* Location of the header that will be displayed at the top of the page
|
39
|
* LEFTCOL_URL
|
40
|
*
|
41
|
* Location of the header that will be displayed at the top of the page
|
42
|
* RIGHTCOL_URL
|
43
|
*
|
44
|
* Location of the header that will be displayed at the top of the page
|
45
|
* FOOTER_URL
|
46
|
*
|
47
|
* header iframe class
|
48
|
* IFRAME_HEADER_CLASS
|
49
|
*
|
50
|
* left column iframe class
|
51
|
* IFRAME_LEFTCOL_CLASS
|
52
|
*
|
53
|
* right column iframe class
|
54
|
* IFRAME_RIGHTCOL_CLASS
|
55
|
*
|
56
|
* footer iframe class
|
57
|
* IFRAME_FOOTER_CLASS
|
58
|
*
|
59
|
* entire table class
|
60
|
* TEMPLATE_TABLE_CLASS
|
61
|
*
|
62
|
* header table-cell class. Note you should not set css "width" on this, since it
|
63
|
* includes a colspan
|
64
|
* TEMPLATE_HEADERROW_CLASS
|
65
|
*
|
66
|
* left column table-cell class. Note that restricting css "height" on this may
|
67
|
* affect visibility of the main content, since it's in the same table row
|
68
|
* TEMPLATE_LEFTCOL_CLASS
|
69
|
*
|
70
|
* main central content table-cell class. Note that css attributes set here may
|
71
|
* apply to the content nested inside this cell
|
72
|
* TEMPLATE_CONTENTAREA_CLASS
|
73
|
*
|
74
|
* rigth column table-cell class. Note that restricting css "height" on this may
|
75
|
* affect visibility of the main content, since it's in the same table row
|
76
|
* TEMPLATE_RIGHTCOL_CLASS
|
77
|
*
|
78
|
* footer table-cell class. Note you should not set "width" on this, since it
|
79
|
* includes a colspan
|
80
|
* TEMPLATE_FOOTERROW_CLASS
|
81
|
*/
|
82
|
|
83
|
|
84
|
|
85
|
/**
|
86
|
* inserts the first half of the template table that surrounds the page's'
|
87
|
* content, including the the optional header and left column areas
|
88
|
* referenced by the HEADER_URL and LEFTCOL_URL settings
|
89
|
*/
|
90
|
function insertTemplateOpening() {
|
91
|
|
92
|
//table opening tag
|
93
|
document.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" "
|
94
|
+" class=\""+TEMPLATE_TABLE_CLASS+"\">");
|
95
|
//first row is header
|
96
|
document.write("<tr><td "+_getColSpanString()+" class=\""+TEMPLATE_HEADERROW_CLASS+"\">");
|
97
|
|
98
|
//content for the header (if any)
|
99
|
_createIFrameWithURL(HEADER_URL, IFRAME_HEADER_CLASS);
|
100
|
|
101
|
document.write("</td></tr><tr>");
|
102
|
|
103
|
//content for the left column (if any)
|
104
|
if (!_isBlank(LEFTCOL_URL)) {
|
105
|
|
106
|
document.write("<td class=\""+TEMPLATE_LEFTCOL_CLASS+"\">");
|
107
|
|
108
|
_createIFrameWithURL(LEFTCOL_URL, IFRAME_LEFTCOL_CLASS);
|
109
|
|
110
|
document.write("</td>");
|
111
|
}
|
112
|
|
113
|
//main content area
|
114
|
document.write("<td class=\""+TEMPLATE_CONTENTAREA_CLASS+"\">");
|
115
|
}
|
116
|
|
117
|
/**
|
118
|
* inserts the last half of the template table that surrounds the page's'
|
119
|
* content, including the optional right column and footer areas
|
120
|
* referenced by the RIGHTCOL_URL and FOOTER_URL settings
|
121
|
*/
|
122
|
function insertTemplateClosing() {
|
123
|
|
124
|
//right column
|
125
|
document.write("</td>");
|
126
|
|
127
|
//content for the right column (if any)
|
128
|
if (!_isBlank(RIGHTCOL_URL)) {
|
129
|
|
130
|
document.write("<td class=\""+TEMPLATE_RIGHTCOL_CLASS+"\">");
|
131
|
|
132
|
_createIFrameWithURL(RIGHTCOL_URL, IFRAME_RIGHTCOL_CLASS);
|
133
|
|
134
|
document.write("</td>");
|
135
|
}
|
136
|
|
137
|
//last row is footer
|
138
|
document.write("</tr><tr><td "+_getColSpanString()+" class=\""
|
139
|
+TEMPLATE_FOOTERROW_CLASS+"\">");
|
140
|
|
141
|
//content for the footer (if any)
|
142
|
_createIFrameWithURL(FOOTER_URL, IFRAME_FOOTER_CLASS);
|
143
|
|
144
|
//close table
|
145
|
document.write("</td></tr></table>");
|
146
|
|
147
|
}
|
148
|
|
149
|
|
150
|
/**
|
151
|
* inserts the header referenced by the SEARCHBOX_URL setting
|
152
|
*/
|
153
|
function insertSearchBox() {
|
154
|
|
155
|
if (!_isBlank(SEARCHBOX_URL)) {
|
156
|
|
157
|
_createIFrameWithURL(SEARCHBOX_URL, IFRAME_SEARCHBOX_CLASS);
|
158
|
}
|
159
|
|
160
|
}
|
161
|
|
162
|
/**
|
163
|
* inserts the header referenced by the ADVANCED_SEARCHBOX_URL setting
|
164
|
*/
|
165
|
function insertAdvancedSearchBox() {
|
166
|
|
167
|
if (!_isBlank(ADVANCED_SEARCHBOX_URL)) {
|
168
|
|
169
|
_createIFrameWithURL(ADVANCED_SEARCHBOX_URL, IFRAME_ADVANCED_SEARCHBOX_CLASS);
|
170
|
}
|
171
|
|
172
|
}
|
173
|
|
174
|
/**
|
175
|
* inserts the header referenced by the LOGINBOX_URL setting
|
176
|
*/
|
177
|
function insertLoginBox() {
|
178
|
|
179
|
if (!_isBlank(LOGINBOX_URL)) {
|
180
|
|
181
|
_createIFrameWithURL(LOGINBOX_URL, IFRAME_LOGINBOX_CLASS);
|
182
|
}
|
183
|
|
184
|
}
|
185
|
|
186
|
|
187
|
/**
|
188
|
* inserts an iframe into the document and assigns it the passed source URL
|
189
|
* and class attribute
|
190
|
*/
|
191
|
function _createIFrameWithURL(targetURL, cssClass) {
|
192
|
|
193
|
|
194
|
if (_isBlank(targetURL)) {
|
195
|
|
196
|
document.write(" ");
|
197
|
|
198
|
} else {
|
199
|
|
200
|
document.write("<iframe src=\""+targetURL+"\" class=\""+cssClass+"\" "
|
201
|
+" marginheight=\"0\" marginwidth=\"0\" scrolling=\"no\" "
|
202
|
+" border=\"0\" frameborder=\"0\" framespacing=\"0\" "
|
203
|
+" hspace=\"0\" vspace=\"0\">Your browser does not support"
|
204
|
+" the iframe tag. <a href=\""+targetURL+"\" "
|
205
|
+"target=\"_blank\">This content</a>"
|
206
|
+" should have been displayed at this location</iframe>");
|
207
|
}
|
208
|
}
|
209
|
|
210
|
|
211
|
|
212
|
function _isBlank(testString) {
|
213
|
|
214
|
return ( !testString
|
215
|
|| testString==null
|
216
|
|| (testString.replace(/^\s*/, '').replace(/\s*$/,'')==""));
|
217
|
}
|
218
|
|
219
|
|
220
|
function _getColSpanString() {
|
221
|
|
222
|
var colspan = 1;
|
223
|
if (!_isBlank(LEFTCOL_URL)) colspan++;
|
224
|
if (!_isBlank(RIGHTCOL_URL)) colspan++;
|
225
|
if (colspan==1) return "";
|
226
|
else return " colspan=\""+colspan+"\" ";
|
227
|
}
|
228
|
|