updateReaderTable.php 2.84 KB
Newer Older
remy's avatar
remy committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php

require_once "../config/Plugin.php";
define("PAGE","updateReaderTable");


if(!JSONREADER2_STANDALONE) {
    session_start ();
    if(!isset($_SESSION['username'])) {
        header("Location: ".JSR_PATH."/index.php");
    }
    if($_SESSION['usercode'] != 1) {
        $_SESSION['lastpage'] = PAGE;
        header("Location: ".JSR_PATH."/services/login.php");
    }
}

include(JSR_PATH."/include/buildHeader.php");
require_once JSR_PATH."/include/tools.php";
require_once JSR_PATH."/dao/DBquery.php";
require_once "../dao/ReaderTableDBQuery.php";

$db = new DBquery();

$ReaderTableid = $_GET['ReaderTableid'];

if(!isset($ReaderTableid) || empty($ReaderTableid)) {
    $ReaderTableid = -1;
}

$rt = ReaderTableDBQuery::getReaderTableById($db, $ReaderTableid);
//$rt->reclean();

echo '<!-- Page Content -->
        <div class="container">
            <div class="row">
                <div class="col-lg-12 text-center">
                    <h1> Update ReaderTable </h1>
                </div>
                <div class="col-lg-12">
                    <form action="../action/actionReaderTable.php" method="post">';

                    drawActionInputField("update");
                    echo '<input type="text" class="form-control" id="ReaderTableID" placeholder="ReaderTableID" name="ReaderTableID" value="'.$rt->ID.'">';
                    drawInputFormField("name", "Filename suffix [1]", $rt->name, true, false);
                    drawInputFormField("title", "Title", $rt->title, true, false);
47
                    drawTextareaFormField("head", "Header for table (&lt;th&gt;)", $rt->head, false, false);
remy's avatar
remy committed
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
                    drawInputNumberFormField("pos", "Position", $rt->pos, false, false);
                    drawTextareaFormField("jssort", "JS Sort", $rt->jssort, false, false);
    
                    echo '<p>[1] For example <b>_hosts_status</b> is the filename suffix for file <i>/var/www/html/exports/202109/01/20210901_0730<b>_hosts_status</b>.json</i></p>';                    
                    
                        ?>
                        <button type="submit" class="btn btn-primary">Save</button>
                    </form>
                    <br/><br/><br/><br/>
                </div>
            </div>
        </div>



<!-- jQuery Version 1.11.1 -->
<script src="https://code.jquery.com/jquery-latest.min.js"
        type="text/javascript"></script>
        <!-- Latest compiled and minified JavaScript -->
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
        <script >
            window.onload = function() {
               document.getElementById("ReaderTableID").style.display = "none";
               document.getElementById("action").style.display = "none";
           }
        </script>