-
Notifications
You must be signed in to change notification settings - Fork 1
/
recipe_list.php
198 lines (177 loc) · 5.97 KB
/
recipe_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
<?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 {
include_once 'recipe.php';
$recipes = get_recipes();
$rand = sha1(rand());
$_SESSION['rand'] = $rand;
?>
<!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/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.dataTables.min.js"></script>
</head>
<body>
<div id="caja_total_blanca">
<?php include 'header.php'?>
<?php $menu="Recipes";include 'menu.php';?>
<div id="caja_titulo">
<div id="texto_titulo">
Infrastructure Manager > Recipes   <img class="imagentitulo" src="images/icon_recipes_gran.png">
</div>
</div>
<div id="caja_contenido_menutab">
<div id='cssmenutab'>
<ul>
<li class='active'><a href='recipe_list.php'><span>List</span></a></li>
<li><a href='recipeform.php'><span>Add +</span></a></li>
</ul>
</div>
</div>
<div id="caja_contenido_tab">
<div id="main">
<?php
if (count($recipes) > 0) {
?>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#example').dataTable( {
//"oLanguage": {
// "sUrl": "dataTables.spanish.txt"
//},
"aoColumns": [
{ "bSortable": true },
{ "bSortable": true },
<?php
if (check_admin_user()) {
?>
{ "bSortable": false },
<?php
}
?>
{ "bSortable": false }
]
} );
} );
function confirm_delete(id, name) {
var r=confirm("Sure that you want to delete the Recipe with name: " + name + "?");
if (r==true) {
document.getElementById('recipedel_' + id).submit();
}
}
</script>
<table>
<tr>
<td>
<table class="list" id="example">
<thead>
<tr>
<th>
Application
</th>
<th>
Version
</th>
<?php
if (check_admin_user()) {
?>
<th style="font-style:italic;">    Edit</th>
<th style="font-style:italic;">    Delete</th>
<?php
} else {
?>
<th style="font-style:italic;">    View</th>
<?php
}
?>
</tr>
</thead>
<tbody>
<?php
foreach ($recipes as $recipe) {
?>
<tr>
<td>
<?php echo htmlspecialchars($recipe['name'])?>
</td>
<td>
<?php echo htmlspecialchars($recipe['version'])?>
</td>
<td>
<?php
if (check_admin_user()) {
?>
<a href="recipeform.php?id=<?php echo $recipe['rowid'];?>"><img src="images/modificar.gif" border="0" alt="Edit" title="Edit"></a>
<?php
} else {
?>
<a href="recipeform.php?id=<?php echo $recipe['rowid'];?>"><img src="images/ver.gif" border="0" alt="Ver" title="Ver"></a>
<?php
}
?>
</td>
<?php
if (check_admin_user()) {
?>
<td>
<form action="recipeinfo.php" id="recipedel_<?php echo $recipe['rowid'];?>" method="post">
<input type="hidden" name="op" value="delete"/>
<input type="hidden" name="id" value="<?php echo $recipe['rowid'];?>"/>
<input type="hidden" name="rand" value="<?php echo $rand;?>"/>
</form>
<a onclick="javascript:confirm_delete('<?php echo $recipe['rowid'];?>', '<?php echo $recipe['name']?>')" href="#"><img src="images/borrar.gif" border="0" alt="Delete" title="Delete"></a>
</td>
<?php
}
?>
</tr>
<?php
}
?>
</tbody>
</table>
</td>
</tr>
</table>
<?php
}
?>
<br>
</div>
</div>
<?php include 'footer.php'?>
</div>
</body>
</html>
<?php
}
?>