-
Notifications
You must be signed in to change notification settings - Fork 4
/
settings.html
244 lines (223 loc) · 10.4 KB
/
settings.html
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta name="author" content="Daniele Baschieri,Nicola Corti" />
<meta name="description" content="Un semplice programma per la gestione della progressione personale in Reparto agesci.." />
<meta name ="copyright" content="2015" />
<meta name="keywords" content="Progressione Personale Unitaria" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>A-PPU</title>
<link rel="apple-touch-icon" sizes="57x57" href="css/favicon/apple-touch-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="css/favicon//apple-touch-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="css/favicon//apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="css/favicon//apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="css/favicon//apple-touch-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="css/favicon//apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="css/favicon//apple-touch-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="css/favicon//apple-touch-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="css/favicon//apple-touch-icon-180x180.png">
<link rel="icon" type="image/png" href="css/favicon//favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="css/favicon//android-chrome-192x192.png" sizes="192x192">
<link rel="icon" type="image/png" href="css/favicon//favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="css/favicon//favicon-16x16.png" sizes="16x16">
<link rel="manifest" href="css/favicon//manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="css/favicon//mstile-144x144.png">
<meta name="theme-color" content="#ffffff">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<link rel="stylesheet" type="text/css" href="css/datatables.min.css"/>
<link rel="stylesheet" type="text/css" href="css/default.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/datatables.min.js"></script>
<script type="text/javascript" src="js/sha1.js"></script>
<script type="text/javascript" src="js/default.js"></script>
<script type="text/javascript" >
$(document).ready(function(){
init();
$(".error-message").hide();
function addUser(utente,email,pswd){
$.post("php/addUser.php",{"utente":utente,"email":email,"pswd":hex_sha1(pswd)},function(data){
if(data==201){
alert("Utente creato con successo");
}
});
}
$.get("php/getUserInfo.php",function(data){
var js=JSON.parse(data);
$(".photo").attr("src","archive/photo/"+js[0].photo);
$("#user").val(js[0].utente);
$("#email").val(js[0].email);
});
$(".updatePswd").click(function(){
var pswd=hex_sha1($("#oldpswd").val());
var newpswd=hex_sha1($("#newpswd").val());
var confirmpswd=hex_sha1($("#confirmpswd").val());
if(newpswd!=confirmpswd){
$(this).parent().find(".error-message").html('<p><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> le password non combaciano!</p>');
$(this).parent().find(".error-message").show();
}else{
$.post('php/updatePswd.php',{'pswd':pswd,'newpswd':newpswd},function(data){
if(data!=202){
$(this).parent().find(".error-message").html('<p><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> impossibile completare l\'operazione!</p>');
$(this).parent().find(".error-message").show();
}else{
$(this).parent().find(".error-message").hide();
$("#oldpswd").val('');
$("#newpswd").val('');
$("#confirmpswd").val('');
location.reload();
}
});
}
});
$(".updateInfo").click(function(){
var utente=$("#user").val();
var email=$("#email").val();
if((utente=="")||(email=="")){
$(this).parent().find(".error-message").html('<p><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> La mail o la password non sono stati definiti!</p>');
$(this).parent().find(".error-message").show();
}else{
$.post('php/updateUserInfo.php',{'utente':utente,'email':email},function(data){
if(data!=202){
$(this).parent().find(".error-message").html('<p><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> impossibile completare l\'operazione!</p>');
$(this).parent().find(".error-message").show();
}else{
//location.reload();
}
});
}
});
$('#myModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget) // Button that triggered the modal
var recipient = button.data('whatever') // Extract info from data-* attributes
// If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
// Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
var modal = $(this);
//alert(recipient);
if(recipient=="@addUser"){
modal.find('.modal-title').html("Aggiungi un Utente");
modal.find('.modal-body').html('<p class="space"><label>Username: </label> <input id="form-utente" class="form-control" type="text" placeholder="Robert Baden-Powell" /></p>'+
'<p class="space"><label>Email: </label> <input id="form-email" class="form-control" type="text" placeholder="[email protected]" /></p>'+
'<p class="space"><label>Password: </label> <input id="form-pswd" class="form-control" type="text" placeholder="password" /></p>');
$("#send").click(function(){
var utente=$("#form-utente").val();
var email=$("#form-email").val();
var pswd=$("#form-pswd").val();
addUser(utente,email,pswd);
});
}
});
});
</script>
<style>
</style>
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">Advanced P.P.U.</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="index.html">Home</a></li>
<li><a href="panoramica.html">Panoramica</a></li>
<li><a href="specialita-tool.html">Specialità</a></li>
<li><a href="extra.html">Extra</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" >Utilità <span class="caret"></span></a>
<ul class="dropdown-menu">
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="container">
<div class="starter-template">
<div class="row">
<h1>Settings
</h1>
</div>
<div class="row">
<div class="panel panel-default">
<div class="panel-heading">User Info</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-4">
<img class="photo" src="" />
</div>
<div class="col-lg-8">
<div class="error-message alert alert-danger" role="alert"></div>
<label>Username</label>
<input id="user" type="text" value="" class="form-control"/>
<label>E-mail</label>
<input id="email" type="email" value="" class="form-control"/>
<button class="btn btn-info right space updateInfo" type="button">
<span class="glyphicon glyphicon-wrench" aria-hidden="true"></span>
Change
</button>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Password Manager</div>
<div class="panel-body">
<div class="error-message alert alert-danger" role="alert"></div>
<label>Old password</label>
<input id="oldpswd" type="password" value="" class="form-control"/>
<label>New password</label>
<input id="newpswd" type="password" value="" class="form-control"/>
<label>Confirm password</label>
<input id="confirmpswd" type="password" value="" class="form-control"/>
<button class="btn btn-info right space updatePswd" type="button">
<span class="glyphicon glyphicon-wrench" aria-hidden="true"></span>
Change
</button>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">User Manager</div>
<div class="panel-body">
<div class="error-message alert alert-danger" role="alert"></div>
<button class="btn btn-success right space addUser" type="button" data-toggle="modal" data-target="#myModal" data-whatever="@addUser">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
Add
</button>
</div>
</div>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button id="send" type="button" class="btn btn-primary">Send</button>
</div>
</div>
</div>
</div>
</body>
</html>