1 |
<?php |
---|
2 |
/** |
---|
3 |
* WMSBrowser Widget class |
---|
4 |
* |
---|
5 |
* @project CWC2 |
---|
6 |
* @revision $Id: WMSBrowser.php,v 1.4 2004/08/06 16:43:45 pspencer Exp $ |
---|
7 |
* @purpose WMSBrowser Application |
---|
8 |
* @author DM Solutions Group (sfournier@dmsolutions.ca) |
---|
9 |
* @copyright |
---|
10 |
* <b>Copyright (c) 2002, DM Solutions Group Inc.</b> |
---|
11 |
* Permission is hereby granted, free of charge, to any person obtaining a |
---|
12 |
* copy of this software and associated documentation files (the "Software"), |
---|
13 |
* to deal in the Software without restriction, including without limitation |
---|
14 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
---|
15 |
* and/or sell copies of the Software, and to permit persons to whom the |
---|
16 |
* Software is furnished to do so, subject to the following conditions: |
---|
17 |
* |
---|
18 |
* The above copyright notice and this permission notice shall be included |
---|
19 |
* in all copies or substantial portions of the Software. |
---|
20 |
* |
---|
21 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
22 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
23 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
---|
24 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
25 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
---|
26 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
---|
27 |
* DEALINGS IN THE SOFTWARE. |
---|
28 |
*/ |
---|
29 |
|
---|
30 |
// Include base class definition |
---|
31 |
include_once (dirname(__FILE__).'/../../chameleon.php'); |
---|
32 |
|
---|
33 |
/** |
---|
34 |
* This is our main chameleon class definition. |
---|
35 |
*/ |
---|
36 |
class WMSBrowserApp extends Chameleon |
---|
37 |
{ |
---|
38 |
/** |
---|
39 |
* Constructor |
---|
40 |
* |
---|
41 |
* In our example, we need a Writable mapsession object. |
---|
42 |
* chameleon, by default, create a ReadOnly mapsession |
---|
43 |
* object. So we will create it for the parent. |
---|
44 |
*/ |
---|
45 |
function WMSBrowserApp() |
---|
46 |
{ |
---|
47 |
parent::Chameleon(); |
---|
48 |
$this->moMapSession = new MapSession_RW(); |
---|
49 |
$this->moMapSession->setTempDir(getSessionSavePath()); |
---|
50 |
} |
---|
51 |
|
---|
52 |
} |
---|
53 |
|
---|
54 |
$oApp = new WMSBrowserApp(); |
---|
55 |
|
---|
56 |
// Check if template is the iframe or not |
---|
57 |
if (!isset($_GET['template']) || substr($_GET['template'], 11,1) == "t") |
---|
58 |
{ |
---|
59 |
$oApp->CWCAddRegionalTemplate( "en-CA", "mapbrowser_template_en.html"); |
---|
60 |
$oApp->CWCAddRegionalTemplate( "fr-CA", "mapbrowser_template_fr.html"); |
---|
61 |
} |
---|
62 |
else |
---|
63 |
{ |
---|
64 |
$oApp->CWCAddRegionalTemplate( "en-CA", "mapbrowser_iframe_en.html"); |
---|
65 |
$oApp->CWCAddRegionalTemplate( "fr-CA", "mapbrowser_iframe_fr.html"); |
---|
66 |
} |
---|
67 |
|
---|
68 |
if (isset($_SESSION['gszMapName']) && $_SESSION['gszMapName'] != "") |
---|
69 |
$szMapName = $_SESSION['gszMapName']; |
---|
70 |
else |
---|
71 |
if (isset($_GET['mapfile']) && $_GET['mapfile'] != "") |
---|
72 |
$szMapName = $_GET['mapfile']; |
---|
73 |
else |
---|
74 |
{ |
---|
75 |
echo "FATAL ERROR: Can't find any mapfile."; |
---|
76 |
exit; |
---|
77 |
} |
---|
78 |
|
---|
79 |
//this is to get the path to chameleon for use in the template |
---|
80 |
//access using [$gszCoreWebPath$] |
---|
81 |
$oApp->setVar( 'gszCoreWebPath', $_SESSION['gszCoreWebPath'] ); |
---|
82 |
//$oApp->setVar( 'PopupCSS', $_SESSION['gszCSSFile'] ); |
---|
83 |
|
---|
84 |
if (isset($_SESSION['WMSBROWSER_PREVIEWEXTENTS'])) |
---|
85 |
$oApp->setVar( 'PREVIEWEXTENTS', $_SESSION['WMSBROWSER_PREVIEWEXTENTS'] ); |
---|
86 |
|
---|
87 |
if (isset($_SESSION['WMSBROWSER_PREVIEWSRS'])) |
---|
88 |
$oApp->setVar( 'PREVIEWSRS', $_SESSION['WMSBROWSER_PREVIEWSRS'] ); |
---|
89 |
|
---|
90 |
$oApp->CWCInitialize("", $szMapName); |
---|
91 |
$oApp->CWCExecute(); |
---|
92 |
?> |
---|