forked from nconf/nconf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
show_class.php
189 lines (139 loc) · 6.18 KB
/
show_class.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?php
require_once 'include/head.php';
// Form action and url handling
$request_url = set_page();
?>
<script type="text/javascript">
$(document).ready(function() {
});
</script>
<?php
// Page output begin
// set width of following divs
echo '<div style="width: 535px">';
echo NConf_HTML::title('Show classes');
echo "<br>";
$content = 'This mask allows administrators to modify the data schema of the NConf application.
There is no need to make any changes to the schema for ordinary operation.
Users are strictly discouraged from changing any attribute names, datatypes, from modifying classes in any way,
and from any other changes to the schema.
Disregarding this may result in unexpected behavour of the application, failure to generate the Nagios configuration properly
and may under certain circumstances <b>result in data corruption or loss!</b>';
echo NConf_HTML::show_error('WARNING', $content);
// Attr manipulation
if ( isset($_GET["do"]) ){
if ($_GET["do"] == "up"){
class_order($_GET["id"], "up");
}elseif($_GET["do"] == "down"){
class_order($_GET["id"], "down");
}
}
echo "<br>";
// for user and admin navigation
$nav_tree = array("user", "admin");
foreach ($nav_tree as $nav_priv) {
echo '<h2 class="content_header">'.ucfirst($nav_priv).' classes:</h2>';
$query = 'SELECT * FROM ConfigClasses WHERE nav_privs = "'.$nav_priv.'" ORDER BY grouping, ordering ASC, config_class';
$result = db_handler($query, "result", "ConfigClasses");
if ($result) {
$header_content = '<div style="width: 150px;">Class Name</div>';
$header_content .= '<div style="width: 160px;">Friendly Name</div>';
$header_content .= '<div class="center" style="width: 70px;">Visible</div>';
$header_content .= '<div class="center" style="width: 60px;" colspan=2>Ordering</div>';
$header_content .= '<div class="center" style="width: 40px;">Edit</div>';
$header_content .= '<div class="center" style="width: 40px;">Delete</div>';
echo NConf_HTML::ui_box_header($header_content);
$box_content = '<colgroup>
<col width=150>
<col width=160>
<col width=70>
<col width=30>
<col width=30>
<col width=40>
<col width=40>
</colgroup>';
// Define here , how much td's there are (for colspans needed later)
// Attention, also check tds with colspans !
$colspan = 7;
$count = 1;
$naming_attr_count = 0;
$group_bevore = '';
while($entry = mysql_fetch_assoc($result)){
$row_warn = 0;
$naming_attr_cell = " ";
// Show visible icons
switch ($entry["nav_visible"]){
case "yes":
$ICON_mandatory = ICON_TRUE;
break;
case "no":
$ICON_mandatory = ICON_FALSE_SMALL;
break;
}
// Make a space between groups
if ($count == 1){
# User or Admin group begins
if (empty($entry["grouping"]) AND $nav_priv == "user" ){
$Group = TXT_MENU_BASIC;
}elseif (empty($entry["grouping"]) AND $nav_priv == "admin" ){
$Group = TXT_MENU_ADDITIONAL;
}
}elseif ( $entry["grouping"] != $group_bevore){
# New sub-group
$Group = $entry["grouping"];
$count = 1;
# Close old group
$box_content .= '<tr>
<td colspan='.$colspan.'>';
$box_content .= '
</td>
</tr>
';
}
if ($count == 1){
# Make titlebox
$box_content .= '<tr>';
$box_content .= '<td class="ui-widget-header" colspan='.$colspan.'>'.$Group.'</td>';
$box_content .= '</tr>';
}
$group_bevore = $entry["grouping"];
// highlight moved row
$additional_class = "";
if ( !empty($_GET["do"]) AND !empty($_GET["id"]) ){
if ( $entry["id_class"] == $_GET["id"]){
$additional_class = " ui-state-highlight";
}
}
// set list color
if ($row_warn == 1){
$box_content .= '<tr class="color_warning highlight">';
}elseif((1 & $count) == 1){
$box_content .= '<tr class="odd highlight '.$additional_class.'">';
}else{
$box_content .= '<tr class="even highlight '.$additional_class.'">';
}
$detail_link = '<a href="detail_admin_items.php?type=class&id='.$entry["id_class"].'">'.$entry["config_class"].'</a>';
$detail_link_friendly_name = '<a href="detail_admin_items.php?type=class&id='.$entry["id_class"].'">'.$entry["friendly_name"].'</a>';
$box_content .= '<td class="">';
$box_content .= $detail_link;
$box_content .= '</td>';
$box_content .= '<td>'.$detail_link_friendly_name.'</td>';
$box_content .= '<td class="center">'.$ICON_mandatory.'</td>';
$box_content .= '<td class="center">'.'<a href="show_class.php?id='.$entry["id_class"].'&do=up">'.ICON_UP_BOX_BLUE.'</a></td>';
$box_content .= '<td class="center">'
.'<a href="show_class.php?id='.$entry["id_class"].'&do=down">'.ICON_DOWN_BOX_BLUE.'</a>'.
'</td>';
$box_content .= '<td class="center"><a href="modify_class.php?id='.$entry["id_class"].'">'.ICON_EDIT.'</a></td>';
$box_content .= '<td class="center"><a href="delete_class.php?id='.$entry["id_class"].'">'.ICON_DELETE.'</a></td>';
$box_content .= "</tr>\n";
$count++;
}
// show content box
echo NConf_HTML::ui_box_content( NConf_HTML::ui_table($box_content) );
}
echo '<br>';
} // End of nav_tree
echo '</div>';
mysql_close($dbh);
require_once 'include/foot.php';
?>