[mapserver-users] Rosa and javascript

Hankley, Chip Chip.Hankley at GASAI.Com
Thu Jun 13 11:40:08 EDT 2002


Here's an example. I have a "print" icon that calls another PHP page,
passing some parameters, to create a "print friendly" version of the map.
All the button does is launch the JS function.

I imagine you *could* pass variable to the function as well.

To see this in action, go to the URL below.

NOTE!
The default configuration of the app does NOT use Java, so you'll need to
click the little Java button on the right side of the page to get the ROSA
applet to load. Then click the print icon to see the functionality. Also, it
probably won't work in anything less than NS 6 or IE 5.

http://www.gasai.com/gisapps/arsenic/Default.php

The pertinent part of the APPLET code:

<APPLET NAME="RosaApplet" ARCHIVE="/java/rosa/rosa.jar" CODE="Rosa2000"
  WIDTH="450" HEIGHT="450" MAYSCRIPT style="border-style: inset;
border-width: 4">

    <!-- a bunch of other buttons... -->

    <PARAM NAME="TB_BUT_print_IMG" VALUE="/MapSymbols/PrintOff.gif">
    <PARAM NAME="TB_BUT_print_IMG_PR" VALUE="/MapSymbols/PrintOff.gif">
    <PARAM NAME="TB_BUT_print_HINT" VALUE="Print this Image">
    <PARAM NAME="TB_BUT_print_INPUT" VALUE="submit">
    <PARAM NAME="TB_BUT_print_NAME" VALUE="CMD">
    <PARAM NAME="TB_BUT_print_JSACTION" VALUE="fnxPrint()">
    <PARAM NAME="TB_BUT_print_VALUE" VALUE="PRINT">
  </APPLET>

The JavaScript function:

function fnxPrint() {
  //Gather some variables
  var map;
  var xmin;
  var xmax;
  var ymin;
  var ymax;

  xmin = document.frmMapInfo.C_XMIN.value;
  xmax = document.frmMapInfo.C_XMAX.value;
  ymin = document.frmMapInfo.C_YMIN.value;
  ymax = document.frmMapInfo.C_YMAX.value;
  map = 'arsenic.map';

 
window.open('print.php?&Mapfile='+map+'&XMIN='+xmin+'&XMAX='+xmax+'&YMIN='+y
min+'&YMAX='+ymax,'')
}

Cheers!

Chip

-----Original Message-----
From: Guillaume Sueur [mailto:guillaume.sueur at khi2.fr]
Sent: Thursday, June 13, 2002 7:09 AM
To: Liste MapServer
Subject: [mapserver-users] Rosa and javascript


Hi there,
Reading rosa applet documentation, I saw that it was possible to call a
javascript function from a rosa applet button using the JSACTION parameter.
But I haven't able to use it properly yet. Could someone give me a hint ?
Thanks

--------------------------------------------------------
Guillaume SUEUR
Ingénieur développement SIG
Géosignal
25bis av Marcel Dassault
BP 5836
31505 TOULOUSE CEDEX 5
Tél : 05 61 17 47 17
--------------------------------------------------------



More information about the mapserver-users mailing list