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.

Additional Parameters to an Invoke URL<br />

Command<br />

With this release of Map<strong>Guide</strong>, the current selection is the only variable that<br />

can be passed as part of an Invoke URL command.<br />

To pass the current selection, edit the web layout. Define a new Invoke URL<br />

command. On the Additional Parameters tab, enter a key and value. The key<br />

must be a valid HTTP POST key. For the value, enter $CurrentSelection. Add<br />

the command to the toolbar, context menu, or task bar menu.<br />

When the command is executed, the current selection is passed to the page,<br />

along with the standard variables like SESSION and MAPNAME.<br />

For example, if you define the key SEL to have the value $CurrentSelection,<br />

then when the URL is invoked<br />

$selection = $_POST['SEL'];<br />

gets the current selection, in XML format.<br />

See Working With the Active Selection (page 46) for details about using the<br />

XML data.<br />

Passing Parameters From an Invoke Script<br />

command<br />

An Invoke Script command in a web layout can be used to pass custom<br />

parameters to a page. The parameters can be any values that are available via<br />

the Viewer API.<br />

To pass parameters, edit the web layout. Define a new Invoke Script command.<br />

On the Additional Parameters tab, enter the JavaScript code to retrieve the<br />

values to be passed. Add the command to the toolbar, context menu, or task<br />

bar menu.<br />

The JavaScript code can call Viewer API functions or other functions to retrieve<br />

values. To pass the parameters to a page, call the Submit method of the<br />

formFrame with the parameters, the page URL, and the name of the target<br />

frame.<br />

For example, if you wrap custom HTML around the Viewer, you could define<br />

JavaScript functions in the wrapper, then call these functions from an Invoke<br />

44 | Chapter 3 Working With Feature Data

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

Saved successfully!

Ooh no, something went wrong!