This repository has been archived by the owner on Dec 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
136 lines (134 loc) · 5.16 KB
/
index.php
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
47
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php // index.php
include 'index.inc';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>DHCP Leases</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link
rel="stylesheet"
type="text/css"
href="<?php echo $config['bootstrap_base']; ?>/css/bootstrap.min.css">
<?php if ($config['datatables_enable']): ?>
<link
rel="stylesheet"
type="text/css"
href="<?php echo $config['datatables_base']; ?>/css/dataTables.bootstrap4.min.css">
<link
rel="stylesheet"
type="text/css"
href="<?php echo $config['datatables_responsive_base']; ?>/css/responsive.dataTables.min.css">
<?php endif; ?>
<style>
<?php echo file_get_contents('css/style.css'); ?>
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-xs-12">
<h1 class="text-center">DHCP Management for Foreman Proxy</h1>
<hr>
</div>
<?php if (!isset($notify_error)): ?>
<?php $first_title= true; ?>
<div class="col-xs-12 records records-titles">
<?php foreach ([RESERVE => "Reserved IPs", LEASE => "Dynamic Leases"] as $record_type => $title): ?>
<div <?php if ($first_title) $first_title = false; else echo 'hidden'; ?>
class="record <?php echo $record_type; ?>-record">
<h3 class="text-center"><?php echo $title; ?></h3>
</div>
<?php endforeach; ?>
</div>
<div class="col-xs-12" id="records-nav">
<ul class="nav nav-tabs">
<li class="active first"><a class="show-records" href="javascript:void(0)" data-target="reserve">Reserved</a></li>
<li><a class="show-records" href="javascript:void(0)" data-target="lease">Leased</a></li>
<li class="pull-right last"><a class="add-new" data-toggle="modal" data-target="#<?php echo get_add_modal_id(); ?>" href="javascript:void(0)">Add New</a></li>
</ul>
</div>
<?php endif; ?>
<?php if (isset($notify_error)): ?>
<div class="col-xs-12">
<h2>Error</h2>
<pre style="border-color:rgb(192,32,32)"><?php echo htmlspecialchars($notify_error); ?></pre>
</div>
<?php endif; ?>
<?php if (!isset($notify_error)): ?>
<div class="col-xs-12 records records-tables">
<?php $first_table = true; ?>
<?php foreach ([RESERVE => $reserve_records, LEASE => $lease_records] as $record_type => $records): ?>
<div <?php if ($first_table) $first_table = false; else echo 'hidden'; ?>
class="record <?php echo $record_type; ?>-record">
<table class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<?php format_header($record_type); ?>
</tr>
</thead>
<tbody>
<?php for ($i = 0; count($records) > $i; ++$i): ?>
<?php $record = $records[$i]; ?>
<?php $first_record = 0 == $i; ?>
<?php $last_record = count($records) - 1 == $i; ?>
<?php $row_classes = $first_record ? 'first' : ''; ?>
<?php $row_classes .= $first_record && $last_record ? ' ' : ''; ?>
<?php $row_classes .= $last_record ? 'last' : ''; ?>
<tr <?php if (!empty($row_classes)) echo "class=\"$row_classes\""; ?>>
<?php format_row($record_type, $i, $record); ?>
</tr>
<?php endfor; ?>
</tbody>
</table>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</div>
<?php format_add_modal(); ?>
<?php if (!isset($notify_error)): ?>
<?php foreach ([
RESERVE => $reserve_records,
LEASE => $lease_records
] as $record_type => $records): ?>
<?php for ($i = 0; count($records) > $i; ++$i): ?>
<?php $record = $records[$i]; ?>
<?php format_info_modal( $record_type, $i, $record); ?>
<?php format_edit_modal( $record_type, $i, $record); ?>
<?php format_delete_modal($record_type, $i, $record); ?>
<?php endfor; ?>
<?php endforeach; ?>
<?php endif; ?>
<script src="<?php echo $config['jquery_src']; ?>"
<?php if (isset($config['jquery_integ'])): ?>
integrity="<?php echo $config['jquery_integ']; ?>"
<?php endif; ?>
<?php if (isset($config['jquery_crossorigin'])): ?>
crossorigin="<?php echo $config['jquery_crossorigin']; ?>"
<?php endif; ?>
><?php // > is not a typo ?>
</script>
<script src="<?php echo $config['bootstrap_base']; ?>/js/bootstrap.min.js">
</script>
<script>
<?php echo file_get_contents('js/validate.js'); ?>
</script>
<script>
<?php echo file_get_contents('js/dhcp.js'); ?>
</script>
<?php if ($config['datatables_enable']): ?>
<script src="<?php echo $config['datatables_base']; ?>/js/jquery.dataTables.min.js">
</script>
<script src="<?php echo $config['datatables_base']; ?>/js/dataTables.bootstrap4.min.js">
</script>
<script src="<?php echo $config['datatables_responsive_base']; ?>/js/dataTables.responsive.min.js">
</script>
<script>
<?php echo file_get_contents('js/pick_datatables.js'); ?>
</script>
<?php endif; ?>
</body>
</html>
<?php // vim: set ts=2 sw=2 et syn=php: ?>