1 |
<?php |
---|
2 |
/** |
---|
3 |
* UpdateMap Widget class |
---|
4 |
* |
---|
5 |
* @project CWC2 |
---|
6 |
* @revision $Id: UpdateMap.widget.php,v 1.10 2005/05/05 14:01:32 wbronsema Exp $ |
---|
7 |
* @purpose UpdateMap Widget class |
---|
8 |
* @author DM Solutions Group (assefa@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 |
include_once(dirname(__FILE__)."/../Widget.php"); |
---|
30 |
include_once(dirname(__FILE__)."/../Button.php"); |
---|
31 |
|
---|
32 |
/** |
---|
33 |
* UpdateMap |
---|
34 |
* |
---|
35 |
* @desc Display a clickable image that will navigate the map to one |
---|
36 |
* of the points on the edge of the image |
---|
37 |
*/ |
---|
38 |
class UpdateMap extends CWCWidget |
---|
39 |
{ |
---|
40 |
var $moButton; |
---|
41 |
|
---|
42 |
/** |
---|
43 |
* UpdateMap |
---|
44 |
* |
---|
45 |
* Constructor for the UpdateMap |
---|
46 |
*/ |
---|
47 |
function UpdateMap() |
---|
48 |
{ |
---|
49 |
// invoke constructor of parent |
---|
50 |
parent::CWCWidget(); |
---|
51 |
|
---|
52 |
// set the description for this widget |
---|
53 |
$this->szWidgetDescription = <<<EOT |
---|
54 |
The UpdateMap widget allows the user to refresh the current page without |
---|
55 |
performing any other navigation. This is useful for sending values in |
---|
56 |
other widgets to be processed that do not have some more direct form of |
---|
57 |
navigation, such as the Scale widget. |
---|
58 |
EOT; |
---|
59 |
|
---|
60 |
$this->moButton = new CWCButton($this); |
---|
61 |
$this->mnMaturityLevel = MATURITY_TECHNICALRELEASE; |
---|
62 |
} |
---|
63 |
|
---|
64 |
function InitDefaults() |
---|
65 |
{ |
---|
66 |
parent::InitDefaults(); |
---|
67 |
//this widget should never belong to a toolset |
---|
68 |
$this->maParams["TOOLSET"] = ""; |
---|
69 |
$this->moButton->InitDefaults(); |
---|
70 |
$this->moButton->SetOnClick( "clickUpdateMap" ); |
---|
71 |
} |
---|
72 |
|
---|
73 |
/** |
---|
74 |
* GetHTMLHiddenVariables |
---|
75 |
* |
---|
76 |
* Return HTML hidden variables. |
---|
77 |
*/ |
---|
78 |
function GetHTMLHiddenVariables() |
---|
79 |
{ |
---|
80 |
$aReturn = $this->moButton->GetHTMLHiddenVariables(); |
---|
81 |
|
---|
82 |
$szVariable = "UPDATE_MAP"; |
---|
83 |
$szValue = " <INPUT TYPE=HIDDEN NAME=$szVariable VALUE=\"0\">"; |
---|
84 |
$aReturn[$szVariable] = $szValue; |
---|
85 |
return $aReturn; |
---|
86 |
} |
---|
87 |
|
---|
88 |
function GetJavascriptVariables() |
---|
89 |
{ |
---|
90 |
if ($this->mbVisible) |
---|
91 |
return $this->moButton->GetJavascriptVariables(); |
---|
92 |
else return array(); |
---|
93 |
} |
---|
94 |
|
---|
95 |
function GetJavascriptInitFunctions() |
---|
96 |
{ |
---|
97 |
if ($this->mbVisible) |
---|
98 |
return $this->moButton->GetJavascriptInitFunctions(); |
---|
99 |
else return array(); |
---|
100 |
} |
---|
101 |
|
---|
102 |
function GetJavascriptOnLoadFunctions() |
---|
103 |
{ |
---|
104 |
if ($this->mbVisible) |
---|
105 |
$aReturn = $this->moButton->GetJavascriptOnLoadFunctions(); |
---|
106 |
else |
---|
107 |
$aReturn = array(); |
---|
108 |
return $aReturn; |
---|
109 |
} |
---|
110 |
|
---|
111 |
function GetJavascriptIncludeFunctions() |
---|
112 |
{ |
---|
113 |
if ($this->mbVisible) |
---|
114 |
$aReturn = $this->moButton->GetJavascriptIncludeFunctions(); |
---|
115 |
else |
---|
116 |
$aReturn = array(); |
---|
117 |
return $aReturn; |
---|
118 |
} |
---|
119 |
|
---|
120 |
/** |
---|
121 |
* GetJavascriptFunctions |
---|
122 |
* |
---|
123 |
* Return the Javacriptfunctions needed by the widget. |
---|
124 |
*/ |
---|
125 |
function GetJavascriptFunctions() |
---|
126 |
{ |
---|
127 |
$aReturn = array(); |
---|
128 |
|
---|
129 |
$bCWCJSAPI = (isset($this->maSharedResourceWidgets["CWCJSAPI"])) ? 1 : 0; |
---|
130 |
//$bCWCJSAPI = 0; |
---|
131 |
|
---|
132 |
$szJsFunctionName = "clickUpdateMap"; |
---|
133 |
$szFunction = <<<EOT |
---|
134 |
/** |
---|
135 |
* {$szJsFunctionName} |
---|
136 |
* called when the user clicks the UpdateMap icon |
---|
137 |
*/ |
---|
138 |
function {$szJsFunctionName}() |
---|
139 |
{ |
---|
140 |
// clear the nav command |
---|
141 |
{$this->mszHTMLForm}.NAV_CMD.value = ''; |
---|
142 |
|
---|
143 |
{$this->mszHTMLForm}.UPDATE_MAP.value = "1"; |
---|
144 |
|
---|
145 |
if ({$bCWCJSAPI}) |
---|
146 |
{ |
---|
147 |
{$this->mszHTMLForm}.MAP_EXTENTS_MINX.value = goCWCJSAPI.oMap.minx; |
---|
148 |
{$this->mszHTMLForm}.MAP_EXTENTS_MAXX.value = goCWCJSAPI.oMap.maxx; |
---|
149 |
{$this->mszHTMLForm}.MAP_EXTENTS_MINY.value = goCWCJSAPI.oMap.miny; |
---|
150 |
{$this->mszHTMLForm}.MAP_EXTENTS_MAXY.value = goCWCJSAPI.oMap.maxy; |
---|
151 |
{$this->mszHTMLForm}.NAV_CMD.value = ""; |
---|
152 |
} |
---|
153 |
|
---|
154 |
{$this->mszHTMLForm}.submit(); |
---|
155 |
return; |
---|
156 |
} |
---|
157 |
EOT; |
---|
158 |
$aReturn[$szJsFunctionName] = $szFunction; |
---|
159 |
|
---|
160 |
return $aReturn; |
---|
161 |
} |
---|
162 |
|
---|
163 |
/** |
---|
164 |
* DrawPublish |
---|
165 |
* |
---|
166 |
* Return the HTML code using the name in the map file and the |
---|
167 |
* parameters of the CWC tag. |
---|
168 |
*/ |
---|
169 |
function DrawPublish() |
---|
170 |
{ |
---|
171 |
if (!$this->mbVisible) |
---|
172 |
return "<!-- UpdateMap widget hidden -->"; |
---|
173 |
return $this->moButton->DrawPublish(); |
---|
174 |
} |
---|
175 |
} |
---|
176 |
?> |
---|