1 |
<?php |
---|
2 |
/** |
---|
3 |
_____________________________________________________________________________ |
---|
4 |
| |
---|
5 |
| MapNotes Widget |
---|
6 |
| |
---|
7 |
| @project Chameleon |
---|
8 |
| @revision $Id: MapNotes.widget.php,v 1.17 2005/05/26 14:28:10 jlacroix Exp $ |
---|
9 |
| @purpose Creates annotations on map. |
---|
10 |
| @author DM Solutions Group (wbronsema@dmsolutions.ca) |
---|
11 |
| @copyright |
---|
12 |
| <b>Copyright (c) 2004 DM Solutions Group Inc.</b> |
---|
13 |
| Permission is hereby granted, free of charge, to any person obtaining a |
---|
14 |
| copy of this software and associated documentation files (the "Software"), |
---|
15 |
| to deal in the Software without restriction, including without limitation |
---|
16 |
| the rights to use, copy, modify, merge, publish, distribute, sublicense, |
---|
17 |
| and/or sell copies of the Software, and to permit persons to whom the |
---|
18 |
| Software is furnished to do so, subject to the following conditions: |
---|
19 |
| |
---|
20 |
| The above copyright notice and this permission notice shall be included |
---|
21 |
| in all copies or substantial portions of the Software. |
---|
22 |
| |
---|
23 |
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
24 |
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
25 |
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
---|
26 |
| THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
27 |
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
---|
28 |
| FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
---|
29 |
| DEALINGS IN THE SOFTWARE. |
---|
30 |
|_____________________________________________________________________________ |
---|
31 |
|
---|
32 |
**/ |
---|
33 |
|
---|
34 |
// inherit from the NavTool |
---|
35 |
include_once(dirname(__FILE__)."/../NavTool.php"); |
---|
36 |
|
---|
37 |
/** |
---|
38 |
_____________________________________________________________________________ |
---|
39 |
| |
---|
40 |
| MapNotes Widget Class |
---|
41 |
|_____________________________________________________________________________ |
---|
42 |
|
---|
43 |
**/ |
---|
44 |
class MapNotes extends NavTool |
---|
45 |
{ |
---|
46 |
// define member vars |
---|
47 |
var $mszMode; |
---|
48 |
var $mszLayer; |
---|
49 |
var $mszFontColor; |
---|
50 |
var $mszFontOutlineColor; |
---|
51 |
var $mszSymbol; |
---|
52 |
var $mnSymbolSize; |
---|
53 |
var $mszSymbolColor; |
---|
54 |
var $mszSymbolOutlineColor; |
---|
55 |
var $mszFont; |
---|
56 |
var $mnFontSize; |
---|
57 |
var $mbMarquee; |
---|
58 |
var $mnOffsetX; |
---|
59 |
var $mnOffsetY; |
---|
60 |
var $mszLabelPosition; |
---|
61 |
|
---|
62 |
// property page location |
---|
63 |
var $mszPropertyPage; |
---|
64 |
var $mszProcessingPage; |
---|
65 |
|
---|
66 |
// property page default query string |
---|
67 |
var $mszPropertyPageDefaults; |
---|
68 |
|
---|
69 |
// property page layer name |
---|
70 |
var $mszPropertyLayerName = 'divMapNotes'; |
---|
71 |
|
---|
72 |
// property page iframe name |
---|
73 |
var $mszPropertyIframeName = 'ifMapNotes'; |
---|
74 |
|
---|
75 |
/** |
---|
76 |
_________________________________________________________________________ |
---|
77 |
| |
---|
78 |
| Constructor: MapNotes Widget Class |
---|
79 |
|_________________________________________________________________________ |
---|
80 |
|
---|
81 |
**/ |
---|
82 |
function MapNotes() |
---|
83 |
{ |
---|
84 |
// set the language file |
---|
85 |
$this->mszLanguageResource = dirname(__FILE__).'/MapNotes.dbf'; |
---|
86 |
|
---|
87 |
// invoke constructor of parent |
---|
88 |
parent::NavTool(); |
---|
89 |
|
---|
90 |
// set the popup property page location |
---|
91 |
$this->mszPropertyPage = $_SESSION['gszCoreWebPath']. |
---|
92 |
'widgets/MapNotes/properties.phtml'; |
---|
93 |
$this->mszProcessingPage = $_SESSION['gszCoreWebPath']. |
---|
94 |
'widgets/MapNotes/processing.phtml'; |
---|
95 |
|
---|
96 |
// define attributes |
---|
97 |
|
---|
98 |
// Layer - If set and not empty, all notes will be managed in |
---|
99 |
// this layer. If the layer does not exist, it will be created |
---|
100 |
// when the first note is added. If not set, MapNotes will generate |
---|
101 |
// a unique layer name. |
---|
102 |
$this->maAttributes['LAYER'] = new StringAttribute( 'LAYER', false ); |
---|
103 |
|
---|
104 |
// FontColor - default 0 0 0. The color of the label. |
---|
105 |
$this->maAttributes['FONTCOLOR'] = new RGBColorAttribute( |
---|
106 |
'FONTCOLOR', false ); |
---|
107 |
// FontOutlineColor - default 255 255 255. The outline color for |
---|
108 |
// the label. |
---|
109 |
$this->maAttributes['FONTOUTLINECOLOR'] = new RGBColorAttribute( |
---|
110 |
'FONTOUTLINECOLOR', false ); |
---|
111 |
// Symbol - default 'circle'. The symbol to use for this note. |
---|
112 |
// The symbol name can be either the name or symbol index from |
---|
113 |
// the symbolset referred to in the map file. List of available |
---|
114 |
// symbols needs to be generated from the symbol set or through |
---|
115 |
//mapscript if possible, or at least validated. |
---|
116 |
$this->maAttributes['SYMBOL'] = new StringAttribute( 'SYMBOL', false ); |
---|
117 |
|
---|
118 |
// SymbolSize - minimum 1, no maximum, default is 8. |
---|
119 |
// Size to draw the symbol. |
---|
120 |
$this->maAttributes["SYMBOLSIZE"] = new IntegerAttribute( |
---|
121 |
'SYMBOLSIZE', false, 1 ); |
---|
122 |
|
---|
123 |
// SymbolColor - default 0 0 0. Color to draw the symbol. |
---|
124 |
$this->maAttributes['SYMBOLCOLOR'] = new RGBColorAttribute( |
---|
125 |
'SYMBOLCOLOR', false ); |
---|
126 |
// SymbolOutlineColor - default 255 255 255. Outline color. |
---|
127 |
$this->maAttributes['SYMBOLOUTLINECOLOR'] = new RGBColorAttribute( |
---|
128 |
'SYMBOLOUTLINECOLOR', false ); |
---|
129 |
// Font - default 'sans'. This refers to the name of a font in the |
---|
130 |
// fontfile in the map. A list of valid fonts should be available |
---|
131 |
// through this widget, and the value must be validated before using |
---|
132 |
// it. |
---|
133 |
$this->maAttributes['FONT'] = new StringAttribute( 'FONT', false ); |
---|
134 |
|
---|
135 |
// FontSize - minimum 6, no maximum, default is 10. |
---|
136 |
$this->maAttributes["FONTSIZE"] = new IntegerAttribute( |
---|
137 |
'FONTSIZE', false, 6 ); |
---|
138 |
// Marquee - default is true. This controls the display of a solid |
---|
139 |
// box behind the label. |
---|
140 |
$this->maAttributes["MARQUEE"] = new BooleanAttribute( 'MARQUEE', false ); |
---|
141 |
|
---|
142 |
// OffsetX - minimum 0, no maximum, default is 6. Distance in pixels |
---|
143 |
// to horizontally offset the label from the point. |
---|
144 |
$this->maAttributes["OFFSETX"] = new IntegerAttribute( |
---|
145 |
'OFFSETX', false, 0 ); |
---|
146 |
// OffsetY - minimum 0, no maximum, default is 0. Distance in pixels |
---|
147 |
// to vertically offset the label from the point. |
---|
148 |
$this->maAttributes["OFFSETY"] = new IntegerAttribute( |
---|
149 |
'OFFSETY', false, 0 ); |
---|
150 |
// LabelPosition - restricted to (UL, LR, UR, LL, CR, CL, UC, LC, |
---|
151 |
// CC, AUTO) where first character is U = Upper, L = Lower, |
---|
152 |
// C = Center and second character is L=Left, R=Right, C=Center. |
---|
153 |
// These translate into the equivalent PHP/MapScript constants by |
---|
154 |
// prepending MS_ to the value. The default is CR (Center Right). |
---|
155 |
$this->maAttributes['LABELPOSITION'] = new StringAttribute( |
---|
156 |
'LABELPOSITION', false, array( 'UL', 'LR', 'UR', 'LL', 'CR', 'CL', |
---|
157 |
'UC', 'LC', 'CC', 'AUTO' ) ); |
---|
158 |
|
---|
159 |
// set the description for this widget |
---|
160 |
$this->szWidgetDescription = <<<EOT |
---|
161 |
The MapNotes widget is a widget that allows the user to add annotations to their |
---|
162 |
mapfile using text and a symbol. |
---|
163 |
EOT; |
---|
164 |
// set the maturity level |
---|
165 |
$this->mnMaturityLevel = MATURITY_BETA; |
---|
166 |
|
---|
167 |
// end MapNotes constructor |
---|
168 |
} |
---|
169 |
|
---|
170 |
/** |
---|
171 |
_________________________________________________________________________ |
---|
172 |
| |
---|
173 |
| InitDefaults() |
---|
174 |
| |
---|
175 |
| Postcondition: Initialize defaults. |
---|
176 |
| |
---|
177 |
| @return n/a |
---|
178 |
| @desc Initialize defaults. |
---|
179 |
|_________________________________________________________________________ |
---|
180 |
|
---|
181 |
**/ |
---|
182 |
function InitDefaults() |
---|
183 |
{ |
---|
184 |
// init defaults for parent |
---|
185 |
parent::InitDefaults(); |
---|
186 |
|
---|
187 |
// set defaults for parameters that are not supplied |
---|
188 |
// mode |
---|
189 |
$this->mszMode = 'ADD'; |
---|
190 |
// Layer |
---|
191 |
$this->mszLayer = isset( $this->maParams['LAYER'] )? |
---|
192 |
$this->maParams['LAYER'] : 'MapNotesAnnotation'; |
---|
193 |
// FontColor |
---|
194 |
$this->mszFontColor = isset( $this->maParams['FONTCOLOR'] )? |
---|
195 |
$this->maParams['FONTCOLOR'] : '0 0 0'; |
---|
196 |
// FontOutlineColor |
---|
197 |
$this->mszFontOutlineColor = isset( $this->maParams['FONTOUTLINECOLOR'] )? |
---|
198 |
$this->maParams['FONTOUTLINECOLOR'] : '255 255 255'; |
---|
199 |
// Symbol |
---|
200 |
$this->mszSymbol = isset( $this->maParams['SYMBOL'] )? |
---|
201 |
$this->maParams['SYMBOL'] : 'circle'; |
---|
202 |
// SymbolSize |
---|
203 |
$this->mnSymbolSize = isset( $this->maParams['SYMBOLSIZE'] )? |
---|
204 |
$this->maParams['SYMBOLSIZE'] : 8; |
---|
205 |
// SymbolColor |
---|
206 |
$this->mszSymbolColor = isset( $this->maParams['SYMBOLCOLOR'] )? |
---|
207 |
$this->maParams['SYMBOLCOLOR'] : '0 0 0'; |
---|
208 |
// SymbolOutlineColor |
---|
209 |
$this->mszSymbolOutlineColor = isset( $this->maParams['SYMBOLOUTLINECOLOR'] )? |
---|
210 |
$this->maParams['SYMBOLOUTLINECOLOR'] : '255 255 255'; |
---|
211 |
// Font |
---|
212 |
$this->mszFont = isset( $this->maParams['FONT'] )? |
---|
213 |
$this->maParams['FONT'] : 'sans'; |
---|
214 |
// FontSize |
---|
215 |
$this->mnFontSize = isset( $this->maParams['FONTSIZE'] )? |
---|
216 |
$this->maParams['FONTSIZE'] : 10; |
---|
217 |
// Marquee |
---|
218 |
$this->mbMarquee = isset( $this->maParams['MARQUEE'] )? |
---|
219 |
$this->maParams['MARQUEE'] : true; |
---|
220 |
// OffsetX |
---|
221 |
$this->mnOffsetX = isset( $this->maParams['OFFSETX'] )? |
---|
222 |
$this->maParams['OFFSETX'] : 6; |
---|
223 |
// OffsetY |
---|
224 |
$this->mnOffsetY = isset( $this->maParams['OFFSETY'] )? |
---|
225 |
$this->maParams['OFFSETY'] : 0; |
---|
226 |
// LabelPosition |
---|
227 |
$this->mszLabelPosition = isset( $this->maParams['LABELPOSITION'] )? |
---|
228 |
$this->maParams['LABELPOSITION'] : 'CR'; |
---|
229 |
|
---|
230 |
// combine all property defaults |
---|
231 |
$this->mszPropertyPageDefaults = |
---|
232 |
'layer='.$this->mszLayer.'&'. |
---|
233 |
'font='.$this->mszFont.'&'. |
---|
234 |
'fontsize='.$this->mnFontSize.'&'. |
---|
235 |
'fontcolor='.$this->mszFontColor.'&'. |
---|
236 |
'fontoutlinecolor='.$this->mszFontOutlineColor.'&'. |
---|
237 |
'symbol='.$this->mszSymbol.'&'. |
---|
238 |
'symbolsize='.$this->mnSymbolSize.'&'. |
---|
239 |
'symbolcolor='.$this->mszSymbolColor.'&'. |
---|
240 |
'symboloutlinecolor='.$this->mszSymbolOutlineColor.'&'. |
---|
241 |
'marquee='.$this->mbMarquee.'&'. |
---|
242 |
'offsetx='.$this->mnOffsetX.'&'. |
---|
243 |
'offsety='.$this->mnOffsetY.'&'. |
---|
244 |
'labelposition='.$this->mszLabelPosition; |
---|
245 |
|
---|
246 |
|
---|
247 |
// set default mode |
---|
248 |
$this->SetNavCommand( $this->mszMode.'_MAPNOTE'); |
---|
249 |
$this->mbNavSubmit = false; |
---|
250 |
|
---|
251 |
// end InitDefaults function. |
---|
252 |
} |
---|
253 |
|
---|
254 |
/** |
---|
255 |
_________________________________________________________________________ |
---|
256 |
| |
---|
257 |
| ParseURL() |
---|
258 |
| |
---|
259 |
| Postcondition: This function parses information passed on the URL and |
---|
260 |
| acts on it. |
---|
261 |
| |
---|
262 |
| @return boolean - True if successful, false if not. |
---|
263 |
| @desc Parses info passed on URL. |
---|
264 |
|_________________________________________________________________________ |
---|
265 |
|
---|
266 |
**/ |
---|
267 |
function ParseURL() |
---|
268 |
{ |
---|
269 |
// execute parent function |
---|
270 |
parent::ParseURL(); |
---|
271 |
|
---|
272 |
// return success |
---|
273 |
return true; |
---|
274 |
} |
---|
275 |
|
---|
276 |
/** |
---|
277 |
_________________________________________________________________________ |
---|
278 |
| |
---|
279 |
| DrawPublish() |
---|
280 |
| |
---|
281 |
| Postcondition: This function builds the html output for the physical |
---|
282 |
| appearance of the widget. |
---|
283 |
| |
---|
284 |
| @return string - Output |
---|
285 |
| @desc Generates HTML output for the widget. |
---|
286 |
|_________________________________________________________________________ |
---|
287 |
|
---|
288 |
**/ |
---|
289 |
function DrawPublish() |
---|
290 |
{ |
---|
291 |
// init vars |
---|
292 |
$szReturn = ''; |
---|
293 |
// execute parent |
---|
294 |
$szReturn .= parent::DrawPublish(); |
---|
295 |
|
---|
296 |
// return |
---|
297 |
return $szReturn; |
---|
298 |
|
---|
299 |
// end DrawPublish() function |
---|
300 |
} |
---|
301 |
|
---|
302 |
/** |
---|
303 |
_________________________________________________________________________ |
---|
304 |
| |
---|
305 |
| GetJavascriptIncludeFunctions() |
---|
306 |
| |
---|
307 |
| Postcondition: This function defines the javascript include statements. |
---|
308 |
| |
---|
309 |
| @return Array - Array of include statements. |
---|
310 |
| @desc Defines javascript include statements. |
---|
311 |
|_________________________________________________________________________ |
---|
312 |
|
---|
313 |
**/ |
---|
314 |
function GetJavascriptIncludeFunctions() |
---|
315 |
{ |
---|
316 |
// init vars |
---|
317 |
$aReturn = parent::GetJavascriptIncludeFunctions(); |
---|
318 |
|
---|
319 |
// include the base javascript functions for dhtml |
---|
320 |
$szVar = "cwc_dhtml.js"; |
---|
321 |
$aReturn[$szVar] = '<script src="'.$_SESSION['gszCoreWebPath']. |
---|
322 |
'/widgets/js/cwc_dhtml.js" type="text/javascript"></script>'; |
---|
323 |
// return |
---|
324 |
return $aReturn; |
---|
325 |
|
---|
326 |
// end GetJavascriptIncludeFunctions() function |
---|
327 |
} |
---|
328 |
|
---|
329 |
/** |
---|
330 |
_________________________________________________________________________ |
---|
331 |
| |
---|
332 |
| GetJavascriptFunctions() |
---|
333 |
| |
---|
334 |
| Postcondition: This function defines javascript functions and adds |
---|
335 |
| them to the array. |
---|
336 |
| |
---|
337 |
| @return Array - Array of javascript functions. |
---|
338 |
| @desc Defines javascript functions. |
---|
339 |
|_________________________________________________________________________ |
---|
340 |
|
---|
341 |
**/ |
---|
342 |
function GetJavascriptFunctions() |
---|
343 |
{ |
---|
344 |
// init vars |
---|
345 |
$aReturn = parent::GetJavascriptFunctions(); |
---|
346 |
$szSID = SID; |
---|
347 |
|
---|
348 |
//initialize dynamic layers |
---|
349 |
$szContent = '<iframe name="'.$this->mszPropertyIframeName.'" id="'.$this->mszPropertyIframeName.'" src="'.$this->mszProcessingPage.'?'.$szSID.'" frameborder="0" scrolling="auto" style="width:450px;height:250px;" allowtransparency="true"><\/iframe>'; |
---|
350 |
|
---|
351 |
$szJsFunctionName = "MapNotesInit"; |
---|
352 |
$szFunction = <<<EOT |
---|
353 |
/** |
---|
354 |
_____________________________________________________________________________ |
---|
355 |
| |
---|
356 |
| {$szJsFunctionName} |
---|
357 |
| Called during page load to create dynamic layers |
---|
358 |
|_____________________________________________________________________________ |
---|
359 |
|
---|
360 |
**/ |
---|
361 |
function {$szJsFunctionName}() |
---|
362 |
{ |
---|
363 |
var szContent = '{$szContent}'; |
---|
364 |
CWCDHTML_CreateLayer( '{$this->mszPropertyLayerName}', -1000, -1000, 450, 250, false, szContent ); |
---|
365 |
CWCDHTML_SetLayerZOrder( '{$this->mszPropertyLayerName}', 40 ); |
---|
366 |
return true; |
---|
367 |
} |
---|
368 |
EOT; |
---|
369 |
$aReturn[$szJsFunctionName] = $szFunction; |
---|
370 |
|
---|
371 |
|
---|
372 |
|
---|
373 |
// add mouse click function |
---|
374 |
$szJsFunctionName = "MapNotesWMouseClick"; |
---|
375 |
$szFunction = <<<EOT |
---|
376 |
/** |
---|
377 |
_____________________________________________________________________________ |
---|
378 |
| |
---|
379 |
| {$szJsFunctionName} |
---|
380 |
| Called on mouse click for the MapNotes Widget. |
---|
381 |
|_____________________________________________________________________________ |
---|
382 |
|
---|
383 |
**/ |
---|
384 |
function {$szJsFunctionName}(e) |
---|
385 |
{ |
---|
386 |
if (({$this->mszHTMLForm}.NAV_CMD.value != "ADD_MAPNOTE" && |
---|
387 |
{$this->mszHTMLForm}.NAV_CMD.value != "EDIT_MAPNOTE")) |
---|
388 |
return true; |
---|
389 |
|
---|
390 |
MapWgetMouse(e); |
---|
391 |
if ( !MapWinsideMap() ) |
---|
392 |
return true; |
---|
393 |
|
---|
394 |
var nX = {$this->mszHTMLForm}.MAP_CURSOR_POS_X.value; |
---|
395 |
var nY = {$this->mszHTMLForm}.MAP_CURSOR_POS_Y.value; |
---|
396 |
|
---|
397 |
var mapPos = CWCDHTML_FindObjectPos( CWCDHTML_GetImage( 'MapLayerDivImg' ) ); |
---|
398 |
|
---|
399 |
// set the iframe source |
---|
400 |
MapNotesPageSource( nX, nY ); |
---|
401 |
|
---|
402 |
// offset the page location |
---|
403 |
nX = mapPos[0] + parseInt(nX) + 10; |
---|
404 |
nY = mapPos[1] + parseInt(nY) + 10; |
---|
405 |
|
---|
406 |
// show the properties page |
---|
407 |
MapNotesShowProperties( nX, nY ); |
---|
408 |
|
---|
409 |
return true; |
---|
410 |
} |
---|
411 |
EOT; |
---|
412 |
$aReturn[$szJsFunctionName] = $szFunction; |
---|
413 |
|
---|
414 |
// add mouse move function |
---|
415 |
$szJsFunctionName = "MapNotesWMouseMove"; |
---|
416 |
$szFunction = <<<EOT |
---|
417 |
/** |
---|
418 |
_____________________________________________________________________________ |
---|
419 |
| |
---|
420 |
| {$szJsFunctionName} |
---|
421 |
| Called when the mouse moves for the MapNotes widget. |
---|
422 |
|_____________________________________________________________________________ |
---|
423 |
|
---|
424 |
**/ |
---|
425 |
function {$szJsFunctionName}(e) |
---|
426 |
{ |
---|
427 |
// Make sure that the forms variables are initialized. |
---|
428 |
// It seems like that in IE, the mouse move may be called before. |
---|
429 |
if({$this->mszHTMLForm} == null || |
---|
430 |
{$this->mszHTMLForm}.NAV_CMD == null || |
---|
431 |
({$this->mszHTMLForm}.NAV_CMD.value != "ADD_MAPNOTE" && |
---|
432 |
{$this->mszHTMLForm}.NAV_CMD.value != "EDIT_MAPNOTE")) |
---|
433 |
return true; |
---|
434 |
|
---|
435 |
document.onmouseup = MapNotesWMouseClick; |
---|
436 |
|
---|
437 |
return true; |
---|
438 |
|
---|
439 |
} |
---|
440 |
EOT; |
---|
441 |
$aReturn[$szJsFunctionName] = $szFunction; |
---|
442 |
|
---|
443 |
// add property page show function |
---|
444 |
$szJsFunctionName = "MapNotesShowProperties"; |
---|
445 |
$szFunction = <<<EOT |
---|
446 |
/** |
---|
447 |
_____________________________________________________________________________ |
---|
448 |
| |
---|
449 |
| {$szJsFunctionName} |
---|
450 |
| Displays properties window. |
---|
451 |
|_____________________________________________________________________________ |
---|
452 |
|
---|
453 |
**/ |
---|
454 |
function {$szJsFunctionName}( nX, nY ) |
---|
455 |
{ |
---|
456 |
CWCDHTML_ShowMaskLayer( 39 ); |
---|
457 |
|
---|
458 |
var browserWH = CWCDHTML_GetBrowserWH(); |
---|
459 |
|
---|
460 |
var oLayer = CWCDHTML_GetLayer('{$this->mszPropertyLayerName}'); |
---|
461 |
var width = parseInt( oLayer.width ); |
---|
462 |
var height = parseInt( oLayer.height ); |
---|
463 |
|
---|
464 |
var x, y; |
---|
465 |
|
---|
466 |
x = nX - width / 2; |
---|
467 |
y = nY + 10; |
---|
468 |
|
---|
469 |
if (x + width > browserWH[0]) |
---|
470 |
x = browserWH[0] - width; |
---|
471 |
if (x < 0) |
---|
472 |
x = 0; |
---|
473 |
|
---|
474 |
if (y + height > browserWH[1]) |
---|
475 |
y = browserWH[1] - height; |
---|
476 |
if (y < 0) |
---|
477 |
y = 0; |
---|
478 |
|
---|
479 |
// position the properties layer |
---|
480 |
CWCDHTML_SetLayerPos( '{$this->mszPropertyLayerName}', x, y); |
---|
481 |
|
---|
482 |
// show the prperties layer |
---|
483 |
CWCDHTML_ShowLayer( '{$this->mszPropertyLayerName}' ); |
---|
484 |
} |
---|
485 |
EOT; |
---|
486 |
$aReturn[$szJsFunctionName] = $szFunction; |
---|
487 |
|
---|
488 |
// add property page hide function |
---|
489 |
$szJsFunctionName = "MapNotesHideProperties"; |
---|
490 |
$szFunction = <<<EOT |
---|
491 |
/** |
---|
492 |
_____________________________________________________________________________ |
---|
493 |
| |
---|
494 |
| {$szJsFunctionName} |
---|
495 |
| Hides properties window. |
---|
496 |
|_____________________________________________________________________________ |
---|
497 |
|
---|
498 |
**/ |
---|
499 |
function {$szJsFunctionName}() |
---|
500 |
{ |
---|
501 |
// set source to the blank |
---|
502 |
document.getElementById('{$this->mszPropertyIframeName}').src = '{$this->mszProcessingPage}?{$szSID}' ; |
---|
503 |
|
---|
504 |
// show the prperties layer |
---|
505 |
CWCDHTML_HideMaskLayer(); |
---|
506 |
CWCDHTML_HideLayer( '{$this->mszPropertyLayerName}' ); |
---|
507 |
|
---|
508 |
// move out of the way |
---|
509 |
CWCDHTML_SetLayerPos( '{$this->mszPropertyLayerName}', -1000, -1000 ); |
---|
510 |
} |
---|
511 |
EOT; |
---|
512 |
$aReturn[$szJsFunctionName] = $szFunction; |
---|
513 |
|
---|
514 |
// add property page hide function |
---|
515 |
$szJsFunctionName = "MapNotesPageSource"; |
---|
516 |
$szFunction = <<<EOT |
---|
517 |
/** |
---|
518 |
_____________________________________________________________________________ |
---|
519 |
| |
---|
520 |
| {$szJsFunctionName} |
---|
521 |
| Sets the iframe source for the property page. |
---|
522 |
|_____________________________________________________________________________ |
---|
523 |
|
---|
524 |
**/ |
---|
525 |
function {$szJsFunctionName}(nX, nY) |
---|
526 |
{ |
---|
527 |
// set the property page iframe source according to mode |
---|
528 |
document.getElementById('{$this->mszPropertyIframeName}').src = '{$this->mszPropertyPage}?{$szSID}&{$this->mszPropertyPageDefaults}&mode=' + szMapNotesMode + '&mouse_x=' + nX + '&mouse_y=' + nY ; |
---|
529 |
} |
---|
530 |
EOT; |
---|
531 |
$aReturn[$szJsFunctionName] = $szFunction; |
---|
532 |
|
---|
533 |
// add function to draw point changes |
---|
534 |
$szJsFunctionName = 'MapNotesPointSubmit'; |
---|
535 |
$szFunction = <<<EOT |
---|
536 |
/** |
---|
537 |
_____________________________________________________________________________ |
---|
538 |
| |
---|
539 |
| {$szJsFunctionName} |
---|
540 |
| Submit the main page |
---|
541 |
|_____________________________________________________________________________ |
---|
542 |
|
---|
543 |
**/ |
---|
544 |
function {$szJsFunctionName}() |
---|
545 |
{ |
---|
546 |
// submit page |
---|
547 |
{$this->mszHTMLForm}.submit(); |
---|
548 |
} |
---|
549 |
EOT; |
---|
550 |
$aReturn[$szJsFunctionName] = $szFunction; |
---|
551 |
|
---|
552 |
|
---|
553 |
// return |
---|
554 |
return $aReturn; |
---|
555 |
|
---|
556 |
// end GetJavascriptFunctions() function |
---|
557 |
} |
---|
558 |
|
---|
559 |
/** |
---|
560 |
_________________________________________________________________________ |
---|
561 |
| |
---|
562 |
| GetJavascriptInitFunctions() |
---|
563 |
| |
---|
564 |
| Postcondition: This function defines javascript functions and adds |
---|
565 |
| them to the array. |
---|
566 |
| |
---|
567 |
| @return Array - Array of javascript functions. |
---|
568 |
| @desc Defines javascript functions. |
---|
569 |
|_________________________________________________________________________ |
---|
570 |
|
---|
571 |
**/ |
---|
572 |
function GetJavascriptInitFunctions() |
---|
573 |
{ |
---|
574 |
// init vars |
---|
575 |
$aReturn = parent::GetJavascriptInitFunctions(); |
---|
576 |
|
---|
577 |
$aReturn['MapNotesInit'] = "MapNotesInit();\n"; |
---|
578 |
|
---|
579 |
// return |
---|
580 |
return $aReturn; |
---|
581 |
|
---|
582 |
// end GetJavascriptInitFunctions() function |
---|
583 |
} |
---|
584 |
|
---|
585 |
/** |
---|
586 |
_________________________________________________________________________ |
---|
587 |
| |
---|
588 |
| GetJavascriptOnLoadFunctions() |
---|
589 |
| |
---|
590 |
| Postcondition: This function defines javascript functions and adds |
---|
591 |
| them to the array. |
---|
592 |
| |
---|
593 |
| @return Array - Array of javascript functions. |
---|
594 |
| @desc Defines javascript functions. |
---|
595 |
|_________________________________________________________________________ |
---|
596 |
|
---|
597 |
**/ |
---|
598 |
function GetJavascriptOnLoadFunctions() |
---|
599 |
{ |
---|
600 |
// init vars |
---|
601 |
$aReturn = parent::GetJavascriptOnLoadFunctions(); |
---|
602 |
|
---|
603 |
// return |
---|
604 |
return $aReturn; |
---|
605 |
|
---|
606 |
// end GetJavascriptOnLoadFunctions() function |
---|
607 |
} |
---|
608 |
|
---|
609 |
/** |
---|
610 |
_________________________________________________________________________ |
---|
611 |
| |
---|
612 |
| GetHTMLHiddenVariables() |
---|
613 |
| |
---|
614 |
| Postcondition: This function defines html form variables and adds |
---|
615 |
| them to the array. |
---|
616 |
| |
---|
617 |
| @return Array - Array of html form variables. |
---|
618 |
| @desc Defines html form variables. |
---|
619 |
|_________________________________________________________________________ |
---|
620 |
|
---|
621 |
**/ |
---|
622 |
function GetHTMLHiddenVariables() |
---|
623 |
{ |
---|
624 |
// init vars |
---|
625 |
$aReturn = parent::GetHTMLHiddenVariables(); |
---|
626 |
|
---|
627 |
// return |
---|
628 |
return $aReturn; |
---|
629 |
} |
---|
630 |
|
---|
631 |
/** |
---|
632 |
_________________________________________________________________________ |
---|
633 |
| |
---|
634 |
| GetJavascriptOnMouseMoveFunctions() |
---|
635 |
| |
---|
636 |
| Postcondition: This function defines mouse move functions and adds |
---|
637 |
| them to the array. |
---|
638 |
| |
---|
639 |
| @return Array - Array of mouse move functions. |
---|
640 |
| @desc Defines mouse move functions. |
---|
641 |
|_________________________________________________________________________ |
---|
642 |
|
---|
643 |
**/ |
---|
644 |
function GetJavascriptOnMouseMoveFunctions() |
---|
645 |
{ |
---|
646 |
// init vars |
---|
647 |
$aReturn = parent::GetJavascriptOnMouseMoveFunctions(); |
---|
648 |
|
---|
649 |
// define one for MapNotes |
---|
650 |
$szJsFunctionName = "MapNotesWMouseMove"; |
---|
651 |
$szFunction = "$szJsFunctionName(e);\n"; |
---|
652 |
$aReturn[$szJsFunctionName] = $szFunction; |
---|
653 |
|
---|
654 |
// return |
---|
655 |
return $aReturn; |
---|
656 |
} |
---|
657 |
|
---|
658 |
/** |
---|
659 |
_________________________________________________________________________ |
---|
660 |
| |
---|
661 |
| GetJavascriptVariables() |
---|
662 |
| |
---|
663 |
| Postcondition: This function defines javascript variables and adds |
---|
664 |
| them to the array. |
---|
665 |
| |
---|
666 |
| @return Array - Array of javascript variables. |
---|
667 |
| @desc Defines javascript variables. |
---|
668 |
|_________________________________________________________________________ |
---|
669 |
|
---|
670 |
**/ |
---|
671 |
function GetJavascriptVariables() |
---|
672 |
{ |
---|
673 |
// init vars |
---|
674 |
$aReturn = parent::GetJavascriptVariables(); |
---|
675 |
|
---|
676 |
// define variables |
---|
677 |
$aReturn['MapNotesMode'] = 'var szMapNotesMode = "ADD";'."\n"; |
---|
678 |
|
---|
679 |
// return |
---|
680 |
return $aReturn; |
---|
681 |
|
---|
682 |
// end GetJavascriptVariables() function |
---|
683 |
} |
---|
684 |
|
---|
685 |
// end MapNotes |
---|
686 |
} |
---|
687 |
?> |
---|