-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathradl_list.php
246 lines (220 loc) · 7.76 KB
/
radl_list.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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<?php
/*
IM - Infrastructure Manager
Copyright (C) 2011 - GRyCAP - Universitat Politecnica de Valencia
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, see <http://www.gnu.org/licenses/>.
*/
if (!isset($_SESSION)) {
session_start();
}
require_once 'user.php';
if (!check_session_user()) {
invalid_user_error();
} else {
$user = $_SESSION['user'];
include_once 'radl.php';
$radls = get_radls($user);
$radl_params = null;
if (isset($_GET['parameters'])) {
$parameters = $_GET['parameters'];
} else {
$parameters = null;
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE10" >
<title>Infrastructure Manager | GRyCAP | UPV</title>
<link rel="shortcut icon" href="images/favicon.ico">
<link href="css/style.css" rel="stylesheet" type="text/css" media="all"/>
<link href="css/datatable.css" rel="stylesheet" type="text/css" media="all"/>
<link rel="stylesheet" href="css/jquery-ui.css">
<link rel="stylesheet" href="css/style_login2.css">
<link rel="stylesheet" href="css/style_intro2.css">
<link rel="stylesheet" href="css/style_menu2.css">
<link rel="stylesheet" href="css/style_menutab.css">
<script type="text/javascript" language="javascript" src="js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery-ui.js"></script>
<script type="text/javascript" language="javascript" src="js/jquery.dataTables.min.js"></script>
</head>
<body>
<div id="caja_total_blanca">
<?php include 'header.php'?>
<?php $menu="RADL";include 'menu.php';?>
<div id="caja_titulo">
<div id="texto_titulo">
Infrastructure Manager > Topologies   <img class="imagentitulo" src="images/icon_radl_gran.png">
</div>
</div>
<div id="caja_contenido_menutab">
<div id='cssmenutab'>
<ul>
<li class='active'><a href='radl_list.php'><span>List</span></a></li>
<li><a href='radlform.php'><span>Add +</span></a></li>
</ul>
</div>
</div>
<div id="caja_contenido_tab">
<div id="main">
<?php
if (count($radls) > 0) {
?>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#example').dataTable( {
//"oLanguage": {
// "sUrl": "dataTables.spanish.txt"
//},
"aoColumns": [
{ "bSortable": true },
{ "bSortable": true },
{ "bSortable": false },
{ "bSortable": false },
{ "bSortable": false }
]
} );
} );
function confirm_delete(url, name) {
var r=confirm("Sure that you want to delete the Topology named: " + name + "?");
if (r==true) {
window.location.href = url;
}
}
</script>
<table>
<tr>
<td>
<table class="list" id="example">
<thead>
<tr>
<th>
Name
</th>
<th>
Description
</th>
<th style="font-style:italic;">    Launch</th>
<th style="font-style:italic;">    Edit</th>
<th style="font-style:italic;">    Delete</th>
</tr>
</thead>
<tbody>
<?php
foreach ($radls as $radl) {
if ($parameters != null && $radl['rowid'] == $parameters) {
// find the params in the RADL
$radl_params = array();
$pos = -1;
while ($pos = strpos($radl['radl'], "@input.", $pos+1)) {
$pos = $pos + 7;
$pos_fin = strpos($radl['radl'], "@", $pos);
$param_name = substr($radl['radl'], $pos, $pos_fin-$pos);
if (array_search($param_name, $radl_params) === false) {
$radl_params[] = $param_name;
}
}
}
?>
<tr>
<td>
<?php echo htmlspecialchars($radl['name'])?>
</td>
<td>
<?php echo htmlspecialchars($radl['description'])?>
</td>
<td>
<?php
if (radl_user_can($radl['rowid'], $user, "x")) {
?>
<a href="radlinfo.php?op=launch&id=<?php echo $radl['rowid'];?>"><img src="images/lanzar.gif" border="0" alt="Launch" title="Launch"></a>
<?php
}
?>
</td>
<td>
<a href="radlform.php?id=<?php echo $radl['rowid'];?>"><img src="images/modificar.gif" border="0" alt="Edit" title="Edit"></a>
</td>
<td>
<?php
if (radl_user_can($radl['rowid'], $user, "w")) {
?>
<a onclick="javascript:confirm_delete('radlinfo.php?op=delete&id=<?php echo $radl['rowid'];?>', '<?php echo htmlspecialchars($radl['name'])?>')" href="#"><img src="images/borrar.gif" border="0" alt="Delete" title="Delete"></a>
<?php
}
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</td>
</tr>
</table>
<?php
}
if ($radl_params != null) {
?>
<script type="text/javascript" charset="utf-8">
$(function() {
// this initializes the dialog
$( "#dialog" ).dialog({
autoOpen: true,
width: 350,
modal: true,
buttons: {
Launch: function() {
var url = 'radlinfo.php?op=launch&id=<?php echo htmlspecialchars($parameters);?>¶meters=1';
<?php
foreach ($radl_params as $param_name) {
echo " var " . htmlspecialchars($param_name) . " = $( '#" . htmlspecialchars($param_name) . "' );\n";
echo " url = url + '&" . htmlspecialchars($param_name) . "=' + String(" . htmlspecialchars($param_name) . ".val());\n";
}
?>
$( this ).dialog( "close" );
window.location.href = url;
},
Cancel: function() {
$( this ).dialog( "close" );
}
},
});
});
</script>
<div id="dialog" title="Parameters">
<fieldset>
<?php
foreach ($radl_params as $param_name) {
?>
<label for="<?php echo htmlspecialchars($param_name);?>"><?php echo htmlspecialchars($param_name);?></label>
<input type="text" name="<?php echo htmlspecialchars($param_name);?>" id="<?php echo htmlspecialchars($param_name);?>" style="border: 1px solid #000;"><br>
<?php
}
?>
</fieldset>
</form>
</div>
<?php
}
?>
<br>
</div>
</div>
<?php include 'footer.php'?>
</div>
</body>
</html>
<?php
}
?>