14.01.2013 Views

Developer's Guide - MapGuide Open Source - OSGeo

Developer's Guide - MapGuide Open Source - OSGeo

Developer's Guide - MapGuide Open Source - OSGeo

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Script command. See Example: Listing Selected Parcels (DWF Viewer) (page<br />

49).<br />

NOTE The parameters must include standard parameters like SESSION and<br />

MAPNAME, if they are needed.<br />

Passing Parameters From the Task Pane Frame<br />

Passing parameters from the task pane frame is similar to passing them from<br />

an Invoke Script command. Use the Viewer API to retrieve values and call the<br />

Submit method of the formFrame to pass the values to another page.<br />

For example, the following function passes the map view scale and the center<br />

point as parameters to a page that opens in a new window.<br />

function submitRequest(pageUrl)<br />

{<br />

xmlSel = parent.parent.mapFrame.GetSelectionXML();<br />

mapScale = parent.parent.mapFrame.GetScale();<br />

mapCenter = parent.parent.mapFrame.GetCenter();<br />

params = new Array(<br />

"SESSION", parent.parent.mapFrame.GetSessionId(),<br />

"MAPNAME", parent.parent.mapFrame.GetMapName(),<br />

"SELECTION", xmlSel,<br />

"SCALE", mapScale,<br />

"CENTERX", mapCenter.X,<br />

"CENTERY", mapCenter.Y<br />

);<br />

parent.parent.formFrame.Submit(pageUrl, params, "_blank");<br />

}<br />

To call the function, execute it as part of an onClick event or as the action in<br />

a form. For example, clicking the following link would execute the function:<br />

<br />

Click for report<br />

Passing Viewer Information to the Web Server | 45

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!