Location: PHPKode > projects > jjfmapper > jjfmapper/examples/gauntlet/index.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
          "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<?php
include_once ('tidy.php');
?>
    <title>JJFMapper - The Gauntlet</title>
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <link rel="stylesheet" type="text/css" href="gauntlet.css">
    <script type="text/javascript" src="gauntlet.js"></script>
</head>
<body>

<div class="warning">
Warning.  Do not publish this file on a public web server. 
It is intended for local testing only.
</div>

<?php

if (file_exists ('lockfile'))
{
    $lockmsg = <<<EOS
<div class="warning">
This application will not function until the file called "lockfile" is deleted
from its directory.  This is to prevent the inadvertant publishing of this
application on the public internet.  This application is intended for use on
a closed network.
</div>
EOS;
    echo ($lockmsg);
    define ('LOCKED',1);
}

?>


<?php

if (! defined ('LOCKED'))
{
    include_once (dirname (__FILE__).'/config.php');
    if (! file_exists ($jjfmapper_main))
    {
        define ('JJFMAPPER_NOT_FOUND',1);
        echo ('<div class="warning">'.
              'JJFMapper was not found.  You need to change the value of '.
              '$jjfmapper_main in '.dirname (__FILE__).'/config.php to '.
              'the correct location of the JJFMapper web invocation script.'.
            '</div>');
    }
    if (isset ($_REQUEST['c']) &&
        ! defined ('JJFMAPPER_NOT_FOUND'))
    {
        if (isset ($_REQUEST['rawout']))
        {
            echo ('<textarea rows="25" cols="80">');
            ob_start ();
            include ('map.php');
            $rawtext = ob_get_contents ();
            $rawtext = htmlentities ($rawtext);
            ob_end_clean ();
            echo ($rawtext);
            echo ('</textarea>');
        } else {
            if (isset ($_REQUEST['postp'])) $postp = '&postp=1';
            else $postp = '';
            if (isset ($_REQUEST['icoords']))
            {
                echo ('<img id="map" alt="JJFMapper Output Image" '.
                      'src="map.php?c='.
                      urlencode(tidy($_REQUEST['c'])).$postp.'" '.
                      'onMouseOver="reportCoordinates()" '.
                      'onMouseOut="document.forms.cform.coords.value=\'\'">');
                include_once ($jjfmapper_main);
                $map = new jjfmapper (tidy ($_REQUEST['c']));
                echo ('<script lang="text/javascript">'.LF);
                echo ('<!--'.LF);
                echo (TAB.'var map_latmin='. $map->projection->ymin .';'.LF);
                echo (TAB.'var map_latmax='. $map->projection->ymax .';'.LF);
                echo (TAB.'var map_lonmin='. $map->projection->xmin .';'.LF);
                echo (TAB.'var map_lonmax='. $map->projection->xmax .';'.LF);
                echo ('// -->'.LF);
                echo ('</script>'.LF);
                echo ('<br>'.LF);
                echo ('<table rows="2" cols="2" border="0">');
                echo ('<tr><td>Range of latitude:</td><td>');
                echo ($map->projection->ymin .' to '.
                      $map->projection->ymax);
                echo ('</td></tr>'.LF);
                echo ('<tr><td>Range of longitude:</td><td>');
                echo ($map->projection->xmin .' to '.
                      $map->projection->xmax);
                echo ('</td></tr></table>'.LF);
                echo ('<br>'.LF);
                echo ('<form id="cform">'.LF);
                echo ('<input type="text" name="coords" size="80">'.LF);
                echo ('</form>');
            } else {
                echo ('<img id="map" alt="JJFMapper Output Image" '.
                      'src="map.php?c='.
                      urlencode(tidy($_REQUEST['c'])).$postp.'">');
            }
        }
    } elseif (! defined ('JJFMAPPER_NOT_FOUND')) {
        echo ('<img id="map" alt="JJFMapper Output Image" src="map.php">');
    }
//NOTE: this condition block ends near the end of this document.
?>

<p>
Type a jjfmapper configuration file into the text area below, or click one of
the preset buttons.  Then click the submit button to generate a map.
</p>

<noscript>
<p>
Enable Javascript, or use a browser that supports Javascript, to have 
additional functionality available to this application.
</p>
</noscript>

<form action="index.php" method="post" id="gform">
    <input type="submit">
<?php
    if (isset ($_REQUEST['rawout']))
    {
        echo ('<input type="checkbox" name="rawout" checked> Output as text');
    } else {
        echo ('<input type="checkbox" name="rawout"> Output as text');
    }
    if (isset ($_REQUEST['icoords']))
    {
        echo ('<input type="checkbox" name="icoords" checked> Interactive');
    } else {
        echo ('<input type="checkbox" name="icoords"> Interactive');
    }
    if (isset ($_REQUEST['postp']))
    {
        echo ('<input type="checkbox" name="postp" checked> Post-process');
    } else {
        echo ('<input type="checkbox" name="postp"> Post-process');
    }
?>
    <br>
    <textarea name="c" rows="25" cols="80" accesskey="I"><?php

        if (isset ($_REQUEST['c'])) echo (tidy ($_REQUEST['c']));

?></textarea>
<br>
<script lang="text/javascript">
<!--
    writePresetButtons();
// -->
</script>
</form>

<?php
}//NOTE: This is the end of the lockfile condition block.
?>

</body>
</html>
Return current item: jjfmapper