1 |
<?php |
---|
2 |
/** |
---|
3 |
* @project Chameleon |
---|
4 |
* @revision $Id: ExtractWFSData.phtml,v 1.9 2004/12/03 03:31:54 pspencer Exp $ |
---|
5 |
* @purpose This the main user interface page for the extract WFS data |
---|
6 |
* widget. |
---|
7 |
* @author William A. Bronsema, C.E.T. (dev@dmsolutions.ca) |
---|
8 |
* @copyright |
---|
9 |
* <b>Copyright (c) 2003, DM Solutions Group Inc.</b> |
---|
10 |
* Permission is hereby granted, free of charge, to any person obtaining a |
---|
11 |
* copy of this software and associated documentation files (the "Software"), |
---|
12 |
* to deal in the Software without restriction, including without limitation |
---|
13 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
---|
14 |
* and/or sell copies of the Software, and to permit persons to whom the |
---|
15 |
* Software is furnished to do so, subject to the following conditions: |
---|
16 |
* |
---|
17 |
* The above copyright notice and this permission notice shall be included |
---|
18 |
* in all copies or substantial portions of the Software. |
---|
19 |
* |
---|
20 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
21 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
22 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
---|
23 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
24 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
---|
25 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
---|
26 |
* DEALINGS IN THE SOFTWARE. |
---|
27 |
**/ |
---|
28 |
|
---|
29 |
// include the supporting php code |
---|
30 |
include( "./ExtractWFSData.php" ); |
---|
31 |
|
---|
32 |
// force download if requested |
---|
33 |
if ( isset( $szDownloadUrl ) && strlen( $szDownloadUrl ) > 0 ) |
---|
34 |
{ |
---|
35 |
$_SESSION['DOWNLOADFILE'] = $szDownloadUrl.$szFile.$szExt; |
---|
36 |
if (stristr($_SESSION['DOWNLOADFILE'], 'http://') == false ) |
---|
37 |
$_SESSION['DOWNLOADFILE'] = 'http://'.$_SERVER['HTTP_HOST'].'/'.$_SESSION['DOWNLOADFILE']; |
---|
38 |
$_SESSION['DOWNLOADFILE_SAVEAS'] = 'wfs_extraction'.$szExt; |
---|
39 |
session_write_close(); |
---|
40 |
header("Location: ../download.phtml?".SID ); |
---|
41 |
} |
---|
42 |
?> |
---|
43 |
<html> |
---|
44 |
<head> |
---|
45 |
<title><?php echo $oMLT->get("0", "Extract WFS Data") ?></title> |
---|
46 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
47 |
<link rel="stylesheet" type="text/css" href=" <?php echo $szCSSFile ?> "> |
---|
48 |
<style type="text/css"> |
---|
49 |
<!-- .reset |
---|
50 |
/* Defines the style of text labels. |
---|
51 |
- Basic useage sets the size, colour and font of any labels of input |
---|
52 |
elements. */ |
---|
53 |
{ |
---|
54 |
font-family: Arial, Helvetica, sans-serif; |
---|
55 |
font-size: 8px; |
---|
56 |
color: #ff0000; |
---|
57 |
} --> |
---|
58 |
</style> |
---|
59 |
<script language="JavaScript" src="<?php echo $_SESSION['gszCoreWebPath']; ?>/widgets/js/cwc_dhtml.js" type="text/javascript"></script> |
---|
60 |
<script language="JavaScript" src="<?php echo $_SESSION['gszCoreWebPath']; ?>/widgets/js/cwc_button.js" type="text/javascript"></script> |
---|
61 |
<script language="javascript" type="text/javascript"> |
---|
62 |
<?php |
---|
63 |
// check selected count and give meassage |
---|
64 |
if ( $nCount <= 0 ) |
---|
65 |
{ |
---|
66 |
// give message |
---|
67 |
echo "alert('".$oMLT->get("1", "There is no active layer selected. You must select a layer inorder to use this tool." )."');"; |
---|
68 |
|
---|
69 |
// exit |
---|
70 |
echo "window.close();"; |
---|
71 |
} |
---|
72 |
|
---|
73 |
// give a warning message |
---|
74 |
if ( $nCount > 1 ) |
---|
75 |
{ |
---|
76 |
// give message |
---|
77 |
echo "alert('".$oMLT->get("3", "More than one layer has been selected. Only the `%1\$s` layer will be processed.", array( $szSelectedLayerName ) )."');"; |
---|
78 |
} |
---|
79 |
|
---|
80 |
// give notice that errors occurred and the process cannot continue |
---|
81 |
if ( strlen( $szErrorNotice ) > 0 ) |
---|
82 |
{ |
---|
83 |
// give message |
---|
84 |
echo "alert('".$szErrorNotice."');"; |
---|
85 |
} |
---|
86 |
?> |
---|
87 |
|
---|
88 |
/** |
---|
89 |
* doneLoading() |
---|
90 |
* |
---|
91 |
* Postcondition: This function executes after the page has loaded. |
---|
92 |
* |
---|
93 |
* @return void. |
---|
94 |
**/ |
---|
95 |
function doneLoading() |
---|
96 |
{ |
---|
97 |
// give the window focus |
---|
98 |
window.focus(); |
---|
99 |
|
---|
100 |
// return |
---|
101 |
return; |
---|
102 |
} |
---|
103 |
|
---|
104 |
/** |
---|
105 |
* execute() |
---|
106 |
* |
---|
107 |
* Postcondition: This function submits the page to perform the extraction. |
---|
108 |
* |
---|
109 |
* @return void. |
---|
110 |
**/ |
---|
111 |
function execute() |
---|
112 |
{ |
---|
113 |
// set the flag to execute data extraction |
---|
114 |
document.forms[0].txtExtract.value = 1; |
---|
115 |
|
---|
116 |
// submit the page |
---|
117 |
document.forms[0].submit(); |
---|
118 |
|
---|
119 |
// return |
---|
120 |
return; |
---|
121 |
} |
---|
122 |
|
---|
123 |
function clearStatus() |
---|
124 |
{ |
---|
125 |
// reset the status |
---|
126 |
document.forms[0].txtStatus.value=""; |
---|
127 |
} |
---|
128 |
|
---|
129 |
function checkFileName() |
---|
130 |
{ |
---|
131 |
// check file name |
---|
132 |
szFileName = document.forms[0].txtDLFilename.value; |
---|
133 |
nPos = szFileName.indexOf( "'" ); |
---|
134 |
if ( nPos >= 0 ) |
---|
135 |
{ |
---|
136 |
// remove the decimal and anything after |
---|
137 |
document.forms[0].txtDLFilename.value = szFileName.substr( 0, nPos ); |
---|
138 |
|
---|
139 |
// default if nothing left |
---|
140 |
if ( nPos == 0 ) |
---|
141 |
document.forms[0].txtDLFilename.value = ""; |
---|
142 |
|
---|
143 |
// return |
---|
144 |
return true; |
---|
145 |
} |
---|
146 |
nPos = szFileName.indexOf( "\"" ); |
---|
147 |
if ( nPos >= 0 ) |
---|
148 |
{ |
---|
149 |
// remove the decimal and anything after |
---|
150 |
document.forms[0].txtDLFilename.value = szFileName.substr( 0, nPos ); |
---|
151 |
|
---|
152 |
// default if nothing left |
---|
153 |
if ( nPos == 0 ) |
---|
154 |
document.forms[0].txtDLFilename.value = ""; |
---|
155 |
|
---|
156 |
// return |
---|
157 |
return true; |
---|
158 |
} |
---|
159 |
|
---|
160 |
nPos = szFileName.indexOf( "\\" ); |
---|
161 |
if ( nPos >= 0 ) |
---|
162 |
{ |
---|
163 |
// remove the decimal and anything after |
---|
164 |
document.forms[0].txtDLFilename.value = szFileName.substr( 0, nPos ); |
---|
165 |
|
---|
166 |
// default if nothing left |
---|
167 |
if ( nPos == 0 ) |
---|
168 |
document.forms[0].txtDLFilename.value = ""; |
---|
169 |
|
---|
170 |
// return |
---|
171 |
return true; |
---|
172 |
} |
---|
173 |
} |
---|
174 |
|
---|
175 |
function CloseWindow() |
---|
176 |
{ |
---|
177 |
window.close(); |
---|
178 |
} |
---|
179 |
</script> |
---|
180 |
</head> |
---|
181 |
<body class="page" onload="javascript:doneLoading()"> |
---|
182 |
<form> |
---|
183 |
|
---|
184 |
<?php |
---|
185 |
|
---|
186 |
// display error if ogr module is not loaded |
---|
187 |
if ( !$bModuleFound ) |
---|
188 |
{ |
---|
189 |
// get labels |
---|
190 |
$szLabel1 = $oMLT->get('0', 'Extract WFS Data'); |
---|
191 |
$szLabel2 = $oMLT->get('21', 'Error:<br>Required module not found.<br>This widget requires the following PHP module(s):').$szROIExists; |
---|
192 |
|
---|
193 |
// output |
---|
194 |
exit( <<<EOT |
---|
195 |
<table border="0" cellpadding="1" cellspacing="10"> |
---|
196 |
<tr> |
---|
197 |
<td class="layoutTable"> |
---|
198 |
<table class="titleArea" width="100%" border="0" cellpadding="4" cellspacing="0"> |
---|
199 |
<tr> |
---|
200 |
<td><span class="title">{$szLabel1}</span></td> |
---|
201 |
</tr> |
---|
202 |
</table> |
---|
203 |
<table class="contentArea" width="100%" border="0" cellpadding="4" cellspacing="0"> |
---|
204 |
<tr> |
---|
205 |
<td align="center"><p class="helpArea">{$szLabel2}<br><br>{$szOGRModuleName}<br> </p></td> |
---|
206 |
</tr> |
---|
207 |
</table> |
---|
208 |
</td> |
---|
209 |
</tr> |
---|
210 |
<tr> |
---|
211 |
<td align="right">{$szCloseButton}</td> |
---|
212 |
</tr> |
---|
213 |
</table> |
---|
214 |
</form> |
---|
215 |
</body> |
---|
216 |
</html> |
---|
217 |
EOT |
---|
218 |
); |
---|
219 |
|
---|
220 |
} |
---|
221 |
?> |
---|
222 |
|
---|
223 |
|
---|
224 |
<table border="0" cellpadding="1" cellspacing="10"> |
---|
225 |
<tr> |
---|
226 |
<td class="layoutTable"> |
---|
227 |
<table class="titleArea" width="100%" border="0" cellpadding="4" cellspacing="0"> |
---|
228 |
<tr> |
---|
229 |
<td><span class="title"><?php echo $oMLT->get("0", "Extract WFS Data") ?></span></td> |
---|
230 |
</tr> |
---|
231 |
</table> |
---|
232 |
<table class="contentArea" width="100%" border="0" cellpadding="4" cellspacing="0"> |
---|
233 |
<tr> |
---|
234 |
<td align="center"><p class="helpArea"><?php echo trim($oMLT->get("18", "Extracting a large amount of records may take some time. If this window is closed while extract request is being processed, the request will be lost.")).$szROIExists ?></p></td> |
---|
235 |
</tr> |
---|
236 |
</table> |
---|
237 |
<table class="contentArea" width="100%" border="0" cellpadding="4" cellspacing="0"> |
---|
238 |
<tr> |
---|
239 |
|
---|
240 |
<?php |
---|
241 |
if (isset($http_form_vars['szOutputFormat'])) |
---|
242 |
{ |
---|
243 |
echo "<tr>"; |
---|
244 |
echo " <td align=\"left\" nowrap>"; |
---|
245 |
$aszOutputFormat = explode("|", $http_form_vars['szOutputFormat']); |
---|
246 |
|
---|
247 |
if (count($aszOutputFormat) > 1) |
---|
248 |
{ |
---|
249 |
echo "<span class=\"label\">".trim($oMLT->get("2", "Select download format")).":</span>"; |
---|
250 |
echo "</td>"; |
---|
251 |
echo "<td>"; |
---|
252 |
echo "<select name=\"selOutputType\">\n"; |
---|
253 |
foreach ($aszOutputFormat as $szOutputFormat) |
---|
254 |
echo "<OPTION class=\"inputList\" value=\"$szOutputFormat\">$szOutputFormat</OPTION>\n"; |
---|
255 |
echo "</SELECT>\n"; |
---|
256 |
echo "</td>"; |
---|
257 |
} |
---|
258 |
else |
---|
259 |
echo "<INPUT TYPE=hidden name=selOutputType value=\"".$aszOutputFormat[0]."\">"; |
---|
260 |
} |
---|
261 |
echo " </td>"; |
---|
262 |
echo "</tr>"; |
---|
263 |
|
---|
264 |
if (isset($http_form_vars['szCompressionFormat'])) |
---|
265 |
{ |
---|
266 |
echo "<tr>"; |
---|
267 |
echo " <td align=\"left\" nowrap>"; |
---|
268 |
$aszCompressionFormat = explode("|", $http_form_vars['szCompressionFormat']); |
---|
269 |
|
---|
270 |
if (count($aszCompressionFormat) > 1) |
---|
271 |
{ |
---|
272 |
echo "<span class=\"label\">".trim($oMLT->get("20", "Select compress format")).":</span>"; |
---|
273 |
echo "</td>"; |
---|
274 |
echo "<td>"; |
---|
275 |
echo "<select name=\"selCompressType\">\n"; |
---|
276 |
foreach ($aszCompressionFormat as $szCompressionFormat) |
---|
277 |
echo "<OPTION class=\"inputList\" value=\"$szCompressionFormat\">$szCompressionFormat</OPTION>\n"; |
---|
278 |
echo "</SELECT>\n"; |
---|
279 |
echo "</td>"; |
---|
280 |
} |
---|
281 |
else |
---|
282 |
echo "<INPUT TYPE=hidden name=selCompressType value=\"".$aszCompressionFormat[0]."\">"; |
---|
283 |
} |
---|
284 |
echo " </td>"; |
---|
285 |
echo "</tr>"; |
---|
286 |
|
---|
287 |
?> |
---|
288 |
<tr> |
---|
289 |
<td align="left" nowrap><span class="label"><?php echo $oMLT->get("16", 'Output file name (i.e. "parks")') ?>:</span></td> |
---|
290 |
<td> |
---|
291 |
<input type="text" name="txtDLFilename" value="<?php echo $szDLFilename; ?>" size="15" onkeyup="javascript:checkFileName()"></td> |
---|
292 |
</td> |
---|
293 |
</tr> |
---|
294 |
<tr> |
---|
295 |
<td align="right" colspan="2" width="350"> |
---|
296 |
<input type="button" name="butExtract" value="<?php echo $oMLT->get("7", "Extract") ?>" onmouseup="javascript:execute()"></td> |
---|
297 |
</tr> |
---|
298 |
<?php |
---|
299 |
if ( isset( $szGMLError ) ) |
---|
300 |
{ |
---|
301 |
echo "<tr>\n"; |
---|
302 |
echo "<td colspan=\"2\" align=\"right\"><textarea name=\"txtStatus\" rows=\"5\" cols=\"40\" readonly>".$szGMLError."</textarea><span class=\"reset\"><a href=\"javascript:clearStatus()\"><br>clear</a></span></td>\n"; |
---|
303 |
echo "</tr>\n"; |
---|
304 |
} |
---|
305 |
?> |
---|
306 |
</table> |
---|
307 |
</td> |
---|
308 |
</tr> |
---|
309 |
<tr> |
---|
310 |
<td align="right"> |
---|
311 |
<?php echo $szCloseButton ?> |
---|
312 |
</td> |
---|
313 |
</tr> |
---|
314 |
</table> |
---|
315 |
<!-- HIDDEN VARIABLES --> |
---|
316 |
<input type="hidden" name="txtExtract" value=""> |
---|
317 |
<input type="hidden" name="sid" value="<?php echo session_id() ?>"> |
---|
318 |
<input type="hidden" name="selectedlayers" value="<?php if ( isset( $_FORM["selectedlayers"] ) ) echo $_FORM["selectedlayers"]; ?>"> |
---|
319 |
</form> |
---|
320 |
</body> |
---|
321 |
</html> |
---|