1 |
1929
|
brooke
|
/*
|
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$'
|
12 |
|
|
* '$Date$'
|
13 |
|
|
* '$Revision$'
|
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 |
3728
|
leinfelder
|
|
83 |
|
|
function prependUrl(prefix, path) {
|
84 |
1929
|
brooke
|
|
85 |
3728
|
leinfelder
|
var retUrl = path;
|
86 |
|
|
if ( !_isBlank(path) ) {
|
87 |
|
|
if ( !_isBlank(prefix) ) {
|
88 |
3737
|
leinfelder
|
//check if absolute
|
89 |
3728
|
leinfelder
|
if (path.indexOf("http") < 0) {
|
90 |
3737
|
leinfelder
|
//check if the server has been assumed with a leading "/"
|
91 |
|
|
if (path.indexOf("/") != 0) {
|
92 |
|
|
retUrl = prefix + "/" + path;
|
93 |
|
|
}
|
94 |
3728
|
leinfelder
|
}
|
95 |
|
|
}
|
96 |
|
|
}
|
97 |
|
|
return retUrl;
|
98 |
|
|
}
|
99 |
1929
|
brooke
|
|
100 |
|
|
|
101 |
|
|
/**
|
102 |
|
|
* inserts the first half of the template table that surrounds the page's'
|
103 |
|
|
* content, including the the optional header and left column areas
|
104 |
|
|
* referenced by the HEADER_URL and LEFTCOL_URL settings
|
105 |
|
|
*/
|
106 |
3728
|
leinfelder
|
function insertTemplateOpening(serverContextUrl) {
|
107 |
1929
|
brooke
|
|
108 |
|
|
//table opening tag
|
109 |
|
|
document.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" "
|
110 |
|
|
+" class=\""+TEMPLATE_TABLE_CLASS+"\">");
|
111 |
|
|
//first row is header
|
112 |
|
|
document.write("<tr><td "+_getColSpanString()+" class=\""+TEMPLATE_HEADERROW_CLASS+"\">");
|
113 |
|
|
|
114 |
3728
|
leinfelder
|
//make any relative paths into absolute paths
|
115 |
|
|
HEADER_URL = prependUrl(serverContextUrl, HEADER_URL);
|
116 |
|
|
|
117 |
1929
|
brooke
|
//content for the header (if any)
|
118 |
|
|
_createIFrameWithURL(HEADER_URL, IFRAME_HEADER_CLASS);
|
119 |
|
|
|
120 |
|
|
document.write("</td></tr><tr>");
|
121 |
|
|
|
122 |
|
|
//content for the left column (if any)
|
123 |
|
|
if (!_isBlank(LEFTCOL_URL)) {
|
124 |
|
|
|
125 |
|
|
document.write("<td class=\""+TEMPLATE_LEFTCOL_CLASS+"\">");
|
126 |
|
|
|
127 |
3728
|
leinfelder
|
//make any relative paths into absolute paths
|
128 |
|
|
LEFTCOL_URL = prependUrl(serverContextUrl, LEFTCOL_URL);
|
129 |
|
|
|
130 |
1929
|
brooke
|
_createIFrameWithURL(LEFTCOL_URL, IFRAME_LEFTCOL_CLASS);
|
131 |
|
|
|
132 |
|
|
document.write("</td>");
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
//main content area
|
136 |
|
|
document.write("<td class=\""+TEMPLATE_CONTENTAREA_CLASS+"\">");
|
137 |
|
|
}
|
138 |
|
|
|
139 |
|
|
/**
|
140 |
|
|
* inserts the last half of the template table that surrounds the page's'
|
141 |
|
|
* content, including the optional right column and footer areas
|
142 |
|
|
* referenced by the RIGHTCOL_URL and FOOTER_URL settings
|
143 |
|
|
*/
|
144 |
3728
|
leinfelder
|
function insertTemplateClosing(serverContextUrl) {
|
145 |
1929
|
brooke
|
|
146 |
|
|
//right column
|
147 |
|
|
document.write("</td>");
|
148 |
|
|
|
149 |
|
|
//content for the right column (if any)
|
150 |
|
|
if (!_isBlank(RIGHTCOL_URL)) {
|
151 |
|
|
|
152 |
|
|
document.write("<td class=\""+TEMPLATE_RIGHTCOL_CLASS+"\">");
|
153 |
|
|
|
154 |
3728
|
leinfelder
|
//make any relative paths into absolute paths
|
155 |
|
|
RIGHTCOL_URL = prependUrl(serverContextUrl, RIGHTCOL_URL);
|
156 |
|
|
|
157 |
1929
|
brooke
|
_createIFrameWithURL(RIGHTCOL_URL, IFRAME_RIGHTCOL_CLASS);
|
158 |
|
|
|
159 |
|
|
document.write("</td>");
|
160 |
|
|
}
|
161 |
|
|
|
162 |
|
|
//last row is footer
|
163 |
|
|
document.write("</tr><tr><td "+_getColSpanString()+" class=\""
|
164 |
|
|
+TEMPLATE_FOOTERROW_CLASS+"\">");
|
165 |
|
|
|
166 |
3728
|
leinfelder
|
//make any relative paths into absolute paths
|
167 |
|
|
FOOTER_URL = prependUrl(serverContextUrl, FOOTER_URL);
|
168 |
|
|
|
169 |
1929
|
brooke
|
//content for the footer (if any)
|
170 |
|
|
_createIFrameWithURL(FOOTER_URL, IFRAME_FOOTER_CLASS);
|
171 |
|
|
|
172 |
|
|
//close table
|
173 |
|
|
document.write("</td></tr></table>");
|
174 |
|
|
|
175 |
|
|
}
|
176 |
|
|
|
177 |
|
|
|
178 |
|
|
/**
|
179 |
|
|
* inserts the header referenced by the SEARCHBOX_URL setting
|
180 |
|
|
*/
|
181 |
3728
|
leinfelder
|
function insertSearchBox(serverContextUrl) {
|
182 |
1929
|
brooke
|
|
183 |
|
|
if (!_isBlank(SEARCHBOX_URL)) {
|
184 |
3728
|
leinfelder
|
|
185 |
|
|
//make any relative paths into absolute paths
|
186 |
|
|
SEARCHBOX_URL = prependUrl(serverContextUrl, SEARCHBOX_URL);
|
187 |
1929
|
brooke
|
|
188 |
|
|
_createIFrameWithURL(SEARCHBOX_URL, IFRAME_SEARCHBOX_CLASS);
|
189 |
|
|
}
|
190 |
|
|
|
191 |
|
|
}
|
192 |
|
|
|
193 |
3034
|
perry
|
|
194 |
1929
|
brooke
|
/**
|
195 |
3034
|
perry
|
* inserts the header referenced by the SEARCHBOX_URL setting
|
196 |
|
|
*/
|
197 |
3728
|
leinfelder
|
function insertMap(serverContextUrl) {
|
198 |
3034
|
perry
|
|
199 |
|
|
if (!_isBlank(MAP_URL)) {
|
200 |
3728
|
leinfelder
|
//make any relative paths into absolute paths
|
201 |
|
|
MAP_URL = prependUrl(serverContextUrl, MAP_URL);
|
202 |
3034
|
perry
|
|
203 |
|
|
_createIFrameWithURL(MAP_URL, IFRAME_MAP_CLASS);
|
204 |
|
|
}
|
205 |
|
|
|
206 |
|
|
}
|
207 |
|
|
|
208 |
|
|
/**
|
209 |
2743
|
costa
|
* inserts the header referenced by the ADVANCED_SEARCHBOX_URL setting
|
210 |
|
|
*/
|
211 |
3728
|
leinfelder
|
function insertAdvancedSearchBox(serverContextUrl) {
|
212 |
2743
|
costa
|
|
213 |
|
|
if (!_isBlank(ADVANCED_SEARCHBOX_URL)) {
|
214 |
3728
|
leinfelder
|
//make any relative paths into absolute paths
|
215 |
|
|
ADVANCED_SEARCHBOX_URL = prependUrl(serverContextUrl, ADVANCED_SEARCHBOX_URL);
|
216 |
|
|
|
217 |
2743
|
costa
|
_createIFrameWithURL(ADVANCED_SEARCHBOX_URL, IFRAME_ADVANCED_SEARCHBOX_CLASS);
|
218 |
|
|
}
|
219 |
|
|
|
220 |
|
|
}
|
221 |
|
|
|
222 |
|
|
/**
|
223 |
1929
|
brooke
|
* inserts the header referenced by the LOGINBOX_URL setting
|
224 |
|
|
*/
|
225 |
3728
|
leinfelder
|
function insertLoginBox(serverContextUrl) {
|
226 |
1929
|
brooke
|
|
227 |
|
|
if (!_isBlank(LOGINBOX_URL)) {
|
228 |
3728
|
leinfelder
|
|
229 |
|
|
//make any relative paths into absolute paths
|
230 |
|
|
LOGINBOX_URL = prependUrl(serverContextUrl, LOGINBOX_URL);
|
231 |
1929
|
brooke
|
|
232 |
|
|
_createIFrameWithURL(LOGINBOX_URL, IFRAME_LOGINBOX_CLASS);
|
233 |
|
|
}
|
234 |
|
|
|
235 |
|
|
}
|
236 |
|
|
|
237 |
|
|
|
238 |
|
|
/**
|
239 |
|
|
* inserts an iframe into the document and assigns it the passed source URL
|
240 |
|
|
* and class attribute
|
241 |
|
|
*/
|
242 |
|
|
function _createIFrameWithURL(targetURL, cssClass) {
|
243 |
|
|
|
244 |
|
|
|
245 |
|
|
if (_isBlank(targetURL)) {
|
246 |
|
|
|
247 |
|
|
document.write(" ");
|
248 |
|
|
|
249 |
|
|
} else {
|
250 |
|
|
|
251 |
|
|
document.write("<iframe src=\""+targetURL+"\" class=\""+cssClass+"\" "
|
252 |
2931
|
anderson
|
+" id=\"" + cssClass + "\""
|
253 |
|
|
+" name=\"" + cssClass + "\""
|
254 |
|
|
+ "\" marginwidth=\"0\" scrolling=\"no\" "
|
255 |
1937
|
brooke
|
+" marginheight=\"0\" marginwidth=\"0\" scrolling=\"no\" "
|
256 |
|
|
+" border=\"0\" frameborder=\"0\" framespacing=\"0\" "
|
257 |
|
|
+" hspace=\"0\" vspace=\"0\">Your browser does not support"
|
258 |
|
|
+" the iframe tag. <a href=\""+targetURL+"\" "
|
259 |
|
|
+"target=\"_blank\">This content</a>"
|
260 |
|
|
+" should have been displayed at this location</iframe>");
|
261 |
1929
|
brooke
|
}
|
262 |
|
|
}
|
263 |
|
|
|
264 |
|
|
|
265 |
|
|
|
266 |
|
|
function _isBlank(testString) {
|
267 |
|
|
|
268 |
|
|
return ( !testString
|
269 |
|
|
|| testString==null
|
270 |
|
|
|| (testString.replace(/^\s*/, '').replace(/\s*$/,'')==""));
|
271 |
|
|
}
|
272 |
|
|
|
273 |
|
|
|
274 |
|
|
function _getColSpanString() {
|
275 |
|
|
|
276 |
|
|
var colspan = 1;
|
277 |
|
|
if (!_isBlank(LEFTCOL_URL)) colspan++;
|
278 |
|
|
if (!_isBlank(RIGHTCOL_URL)) colspan++;
|
279 |
|
|
if (colspan==1) return "";
|
280 |
|
|
else return " colspan=\""+colspan+"\" ";
|
281 |
|
|
}
|
282 |
|
|
|
283 |
2942
|
jones
|
function submitbrowseform(action,form_ref) {
|
284 |
|
|
form_ref.action.value=action;
|
285 |
|
|
form_ref.submit();
|
286 |
|
|
}
|