Subversion Repositories portal2


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

/*  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
*  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


$form_token = md5(uniqid('auth', true));
$_SESSION['form_token'] = $form_token;

if(isset($_GET['device_key'], $_GET['sensor_key'], $_GET['variable_key']))
        $device_key   = $_GET['device_key'];
        $park         = $_SESSION['park'];
        $device       = $park->getDevice($device_key);
        $device_name  = $device->getName();

        $sensor_key   = $_GET['sensor_key'];
        $sensor       = $device->getSensor($sensor_key);
        $sensor_name  = $sensor->getName();

        $variable_key = $_GET['variable_key'];
        $variable     = $sensor->getVariable($variable_key);
        $variable_name= $variable->getName();

        $count        = $device->countTrackers();

<div id="page_trackers_add">
                <?php echo _('Add tracker'); ?>


        $id = link_get_id_from_filename("form_trackers_add_submit.php");
        echo "<form action=\"index.php?id_page=$id&device_key=$device_key&sensor_key=$sensor_key&variable_key=$variable_key\" method=\"post\">";
                        <?php echo "$device_name:$sensor_name:$variable_name" ?>

                <label for="form_tracker_name">
                        <?php echo _('Name'); ?>:
                <input type="text" id="form_tracker_name" name="form_tracker_name" value="Compteur Eau 1" placeholder="Compteur_eau_1" />

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

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

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

                <label for="form_tracker_index">
                        <?php echo _('Index'); ?>:
                <input type="text" id="form_tracker_index" name="form_tracker_index" value=<?php echo "$count" ?> readonly="readonly" />

                <div class="buttons">
                        <input type="hidden" name="form_token" value="<?php echo $form_token; ?>" />
                        <input type="hidden" name="form_device_key" value="<?php echo "$device_key" ?>" />
                        <input type="hidden" name="form_sensor_key" value="<?php echo "$sensor_key" ?>" />
                        <input type="hidden" name="form_variable_key" value="<?php echo "$variable_key" ?>" />
                        <input type="submit" name="form_add" value=<?php echo _('OK');?> id="form_add" alt="add" />
                        <input type="submit" name="form_cancel" value=<?php echo _('Cancel');?> id="form_cancel" alt="cancel" />