Location: PHPKode > projects > jjfmapper > jjfmapper/examples/webapp/index.php
<html>
<head>
        <title>A JJFMapper Web Application</title>
</head>
<body>
        
        
<?php
include ('webapp_config.php');
        $coords = isset($_POST['coords'])? $_POST['coords'] :'45 -85';
        $padding = isset($_POST['padding'])? $_POST['padding'] : 4;
        $bgcolor = isset($_POST['bgcolor'])? $_POST['bgcolor'] : 'aaf';
        $landcolor = isset($_POST['landcolor'])? $_POST['landcolor'] : '090';
        $grid = isset($_POST['grid'])? $_POST['grid'] : false;
        $interval = isset($_POST['interval'])? $_POST['interval'] : 5;
        //
        $world = isset($_POST['world'])? $_POST['world'] : false;
        $usa = isset($_POST['usa'])? $_POST['usa'] : false;
        $cda = isset($_POST['cda'])? $_POST['cda'] : false;
        $mex = isset($_POST['mex'])? $_POST['mex'] : false;
        
        //unchecked checkboxes are not submitted as POST variables,
        //so with this setup, I can't have any default checks.
        //the workaround is to turn on some checks whenever no boxes are checked.
        if ($world == false && $usa == false && $cda == false && $mex == false) { $usa=true; $cda=true; }
        
        include($jjfmapper_install_dir.'lib/coordial.php');
        $c=new coordial($coords);
        
        echo ('<img src="map.php?lat='. $c->latitude .'&lon='. $c->longitude .'&padding='. $padding .'&bgcolor='. $bgcolor
                .'&interval='. $interval .'&landcolor='. $landcolor .'&grid='. ($grid?1:0) 
                .'&usa='. ($usa?1:0) .'&cda='. ($cda?1:0) .'&mex='. ($mex?1:0) .'&world='. ($world?1:0) .'"/>'); ?>
        
        <table><tr>
        <td rowspan="2"><b>Presets:</b></td>
        <td><form action="index.php" method="post">
                <input type="hidden" name="coords" value="N 61° 45' W 153° 0'"/>
                <input type="hidden" name="padding" value="11"/>
                <input type="hidden" name="world" value="1"/>
                <input type="submit" value="Alaska"/>
        </form></td>
        <td><form action="index.php" method="post">
                <input type="hidden" name="coords" value="N 20° 45' W 157° 30'"/>
                <input type="hidden" name="padding" value="2.5"/>
                <input type="hidden" name="usa" value="1"/>
                <input type="submit" value="Hawaii"/>
        </form></td>
        <td><form action="index.php" method="post">
                <input type="hidden" name="grid" value="1"/>
                <input type="hidden" name="interval" value="5"/>
                <input type="hidden" name="coords" value="45 -85"/>
                <input type="hidden" name="padding" value="4"/>
                <input type="hidden" name="usa" value="1"/>
                <input type="hidden" name="cda" value="1"/>
                <input type="submit" value="Michigan"/>
        </form></td>
        </tr>
        <tr><td><form action="index.php" method="post">
                <input type="hidden" name="grid" value="1"/>
                <input type="hidden" name="interval" value="30"/>
                <input type="hidden" name="coords" value="0 0"/>
                <input type="hidden" name="padding" value="170"/>
                <input type="hidden" name="world" value="1"/>
                <input type="submit" value="World"/>
        </form></td>
        <td><form action="index.php" method="post">
                <input type="hidden" name="grid" value="1"/>
                <input type="hidden" name="interval" value="15"/>
                <input type="hidden" name="coords" value="N 53 E 21.5"/>
                <input type="hidden" name="padding" value="20"/>
                <input type="hidden" name="world" value="1"/>
                <input type="submit" value="Europe"/>
        </form></td>
        <td><form action="index.php" method="post">
                <input type="hidden" name="grid" value="1"/>
                <input type="hidden" name="interval" value="30"/>
                <input type="hidden" name="coords" value="N 2 E 18.5"/>
                <input type="hidden" name="padding" value="38"/>
                <input type="hidden" name="world" value="1"/>
                <input type="submit" value="Africa"/>
        </form></td>
        <td><form action="index.php" method="post">
                <input type="hidden" name="grid" value="1"/>
                <input type="hidden" name="interval" value="15"/>
                <input type="hidden" name="coords" value="S 10 E 135"/>
                <input type="hidden" name="padding" value="38"/>
                <input type="hidden" name="world" value="1"/>
                <input type="submit" value="Oceania"/>
        </form></td>
        <td><form action="index.php" method="post">
                <input type="hidden" name="grid" value="1"/>
                <input type="hidden" name="interval" value="15"/>
                <input type="hidden" name="coords" value="30 45"/>
                <input type="hidden" name="padding" value="20"/>
                <input type="hidden" name="world" value="1"/>
                <input type="submit" value="Middle East"/>
        </form></td>
                
        </tr>
        </table>
        
        <hr width="430"/>
        
        <form action="index.php" method="post">
                Center on: <input type="text" name="coords" value="<?php echo($c->latitude_tdmc() .' '. $c->longitude_tdmc()); ?>"/><br/>
                Degrees of padding: <input type="text" name="padding" value="<?php echo($padding); ?>"/><br/>
                <input type="checkbox" name="grid" <?php echo($grid?'checked="1"':''); ?>/>Show grid<br/>
                        Grid interval: <input type="text" name="interval" value="<?php echo($interval); ?>"/><br/>
                <b>Use shapefiles:</b> 
                <input type="checkbox" name="usa" <?php echo($usa?'checked="1"':''); ?>/>United States 
                <input type="checkbox" name="cda" <?php echo($cda?'checked="1"':''); ?>/>Canada 
                <input type="checkbox" name="mex" <?php echo($mex?'checked="1"':''); ?>/>Mexico 
                <input type="checkbox" name="world" <?php echo($world?'checked="1"':''); ?>/>World
                <br/><input type="submit" value="Draw"/>
        </form>
        


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