Subversion Repositories portal2

Rev

Rev 699 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
/*  emg - Energy Monitoring & Graphing
*  Copyright (C) 2006-2012 Romain Lievin
*
*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 3 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software Foundation,
*  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

?>

<?php
include_once('auth_check.php');
?>

<?php
$form_token = md5(uniqid('auth', true));
$_SESSION['form_token_2'] = $form_token;

if(isset($_POST['form_datum_key']))
{
        $form_datum_key = $_POST['form_datum_key'];
}
else
{
        $data           = $_SESSION['data'];
        $data_keys      = $data->getKeys();
        $form_datum_key = $data_keys[0];
}
?>

<div id="page_form_data_mod">
        <h1>
                <?php echo _('Modify data'); ?>
        </h1>

        <?php

        $id = link_get_id_from_filename("form_data_modify_submit.php");
        echo "<form action=\"index.php?id_page=$id\" method=\"post\">";

        $data            = $_SESSION['data'];
        $datum           = $data->getDatum($form_datum_key);

        $form_datum_name = $datum->getName();
        $form_datum_unit = $datum->getUnit();
        $form_datum_a    = $datum->getSlope();
        $form_datum_b    = $datum->getIntercept();
        ?>
        <fieldset>
                <legend>
                        <?php echo _('Information'); ?>
                </legend>

                <label for="form_datum_name">
                        <?php echo _('Name'); ?>:
                </label>
                <input type="text" id="form_datum_name" name="form_datum_name" value=<?php echo "\"$form_datum_name\""; ?> placeholder="Ma sonde" />
                <br/>

                <label for="form_datum_unit">
                        <?php echo _('Unit'); ?>:
                </label>
                <input type="text" id="form_datum_unit" name="form_datum_unit" value=<?php echo "$form_datum_unit"; ?> />
                <br/>

                <label for="form_datum_a">
                        <?php echo _('Step'); ?>:
                </label>
                <input type="text" id="form_datum_a" name="form_datum_a" value=<?php echo "$form_datum_a"; ?> />
                <br/>

                <label for="form_datum_b">
                        <?php echo _('Offset'); ?>:
                </label>
                <input type="text" id="form_datum_b" name="form_datum_b" value=<?php echo "$form_datum_b"; ?> />
                <br/>

                <hr/>
                <div class="buttons">
                        <input type="hidden" name="form_token_2" value="<?php echo $form_token; ?>" />
                        <input type="hidden" name="form_datum_key" value="<?php echo $form_datum_key ?>" />
                        <input type="hidden" name="form_data" value="none" />
                        <input type="submit" value=<?php echo _('OK');?> id="form_mod" alt="modify" />
                        <input type="submit" value=<?php echo _("Cancel");?> id="data_cancel" name="form_cancel" alt="cancel" />
                </div>

        </fieldset>

        <?php
        if(isset($_SESSION['message']))
        echo $_SESSION['message'];
        ?>

        </form>
</div>