Commit 2e1b7b48 authored by Reto Da Forno's avatar Reto Da Forno
Browse files

website updated (new design)

parent fecb5bc4
......@@ -117,18 +117,18 @@ ORDER BY time_start DESC";
echo '<option value="'.$idx.'">' . $group['name'] . '</option>';
}
echo '</select></td><td><span class="time" id="add_start_time">'.$now.'</span></td><td><span class="time" id="add_end_time">'.($now+3600).'</span></td>';
echo "<td><img src='pics/icons/add.png' height='16px' alt='Add' title='Add reservation' class='qtip_show' onClick='document.resadd.submit();'></td>";
echo "<td><span class='qtip_show texticon link' alt='Add' title='Add reservation' onClick='document.resadd.submit();'>+</span></td>";
echo '</tr>';
?>
</tbody>
</table>
</form>
<span id="pager" class="pager">
<img src="pics/icons/first.gif" alt="first" class="first">
<img src="pics/icons/prev.gif" alt="prev" class="prev">
<span class="texticonsm first link" alt="first" title="first"><<</span>
<span class="texticonsm prev link" alt="prev" title="prev"><</span>
<span class="pagedisplay"></span>
<img src="pics/icons/next.gif" alt="next" class="next">
<img src="pics/icons/last.gif" alt="last" class="last">
<span class="texticonsm next link" alt="next" title="next">></span>
<span class="texticonsm last link" alt="last" title="last">>></span>
<input class="pagesize" style="visibility: hidden;" id="pager_num_rows" value="15">
</span> <br >
<!-- Forms for processing actions -->
......
<?php
/*
* __author__ = "Christoph Walser <walser@tik.ee.ethz.ch>"
* __copyright__ = "Copyright 2010, ETH Zurich, Switzerland, Christoph Walser"
* __license__ = "GPL"
* __version__ = "$Revision: 2888 $"
* __date__ = "$Date: 2014-08-22 10:01:11 +0200 (Fri, 22 Aug 2014) $"
* __id__ = "$Id: index.php.normal 2888 2014-08-22 08:01:11Z rlim $"
* __source__ = "$URL: svn://svn.ee.ethz.ch/flocklab/trunk/server/webserver/user/index.php.normal $"
*/
?>
<?php require_once('include/layout.php');require_once('include/presets.php'); ?>
<?php
if (!isset($_SESSION['is_admin']) || !$_SESSION['is_admin'])
exit(1);
?>
<script type="text/javascript" src="scripts/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="scripts/protovis-d3.3.js"></script>
<?php
echo '<h1>Admin Statistics</h1><table>';
$testoverhead = 2*3*60; // time needed to setup and clean up a test in seconds
$db = db_connect();
$sql = "select count(*) as num from tbl_serv_users";
$rs = mysqli_query($db, $sql) or flocklab_die('Cannot get statistics from database because: ' . mysqli_error($db));
$row = mysqli_fetch_array($rs);
echo '<tr><td><b>Number of users</b></td><td>'.$row['num'].'</td></tr>';
echo '<tr><td><b>Users by institution</b></td><td></td></tr>';
$sql = 'select institution, count(institution) as num from tbl_serv_users group by institution';
$rs = mysqli_query($db, $sql) or flocklab_die('Cannot get statistics from database because: ' . mysqli_error($db));
while ($row = mysqli_fetch_array($rs)) {
echo '<tr><td>&nbsp;&nbsp;'.$row['institution'].'</td><td>'.$row['num'].'</td></tr>';
}
echo '<tr><td><b>Users by country</b></td><td></td></tr>';
$sql = 'select country, count(country) as num from tbl_serv_users group by country';
$rs = mysqli_query($db, $sql) or flocklab_die('Cannot get statistics from database because: ' . mysqli_error($db));
while ($row = mysqli_fetch_array($rs)) {
echo '<tr><td>&nbsp;&nbsp;'.$row['country'].'</td><td>'.$row['num'].'</td></tr>';
}
// Tests, by nodes, with setup and cleanup
$sql = 'select year(time_start_act) as y, count(*) as num from tbl_serv_tests where test_status_preserved in ("finished", "retention expiring", "synced") or test_status_preserved is null group by year(time_start_act) having y is not null';
$rs = mysqli_query($db, $sql) or flocklab_die('Cannot get statistics from database because: ' . mysqli_error($db));
$testcount=Array();
while ($row = mysqli_fetch_array($rs)) {
$year = $row['y'];
echo '<tr><td><b>Number of tests '.$year.' (avg [max] setup / cleanup time)</td><td>'.$row['num'].'</td></tr>';
$testcount[$year] = $row['num'];
$sql = 'select year(time_start_act), pname, count(*) as c, time_start_act, b.test_status_preserved, avg(setuptime) as tsetup, avg(cleanuptime) as tcleanup, max(setuptime) as tsetupmax, max(cleanuptime) as tcleanupmax from (select distinct test_fk, tbl_serv_platforms.name as pname from tbl_serv_map_test_observer_targetimages left join tbl_serv_targetimages on (targetimage_fk = serv_targetimages_key) left join tbl_serv_platforms on (platforms_fk = serv_platforms_key)) as a left join tbl_serv_tests as b on (a.test_fk = b.serv_tests_key) where year(time_start_act) = '.$year.' and (b.test_status_preserved in ("finished", "retention expiring", "synced") or b.test_status_preserved is null) and time_start_act is not null and pname is not null group by pname order by time_start_act, pname';
$rs2 = mysqli_query($db, $sql) or flocklab_die('Cannot get statistics from database because: ' . mysqli_error($db));
while ($row = mysqli_fetch_array($rs2)) {
echo '<tr><td>&nbsp;&nbsp;'.$row['pname'].'</td><td>'.$row['c'].' ('.round($row['tsetup']).' ['.round($row['tsetupmax']).'] / '.round($row['tcleanup']).' ['.round($row['tcleanupmax']).'] s)</td></tr>';
}
// Tests by service
$sql = 'select year(time_start_act) as y, sum(1) as num_all, sum(ExtractValue(testconfig_xml, "count(/testConf/serialConf|/testConf/serialReaderConf)") > 0) as num_serial, sum(ExtractValue(testconfig_xml, "count(/testConf/gpioTracingConf|/testConf/gpioMonitorConf)") > 0) as num_tracing, sum(ExtractValue(testconfig_xml, "count(/testConf/gpioActuationConf|/testConf/gpioSettingConf)") > 0) as num_actuation, sum(ExtractValue(testconfig_xml, "count(/testConf/powerProfilingConf|/testConf/powerprofConf)") > 0) as num_power from tbl_serv_tests where year(time_start_act) = '.$year.' and (test_status_preserved in ("finished", "retention expiring", "synced") or test_status_preserved is null)';
$rs3 = mysqli_query($db, $sql) or flocklab_die('Cannot get statistics from database because: ' . mysqli_error($db));
$row = mysqli_fetch_array($rs3);
foreach (array('Serial'=>'num_serial','GPIO tracing'=>'num_tracing','GPIO actuation'=>'num_actuation','Power profiling'=>'num_power') as $service=>$field) {
echo '<tr><td>&nbsp;&nbsp;'.$service.'</td><td>'.$row[$field].' ('.(round($row[$field] / $row['num_all'] * 100 )).'%)</td></tr>';
}
}
// Users by service and node type
$sql = 'select year(time_start_act) as y, count(distinct owner_fk) as num from tbl_serv_tests where test_status_preserved in ("finished", "retention expiring", "synced") or test_status_preserved is null group by year(time_start_act) having y is not null';
$rs = mysqli_query($db, $sql) or flocklab_die('Cannot get statistics from database because: ' . mysqli_error($db));
while ($row = mysqli_fetch_array($rs)) {
$year = $row['y'];
$num_users = $row['num'];
echo '<tr><td><b>Number of active users in '.$year.'</td><td>'.$row['num'].'</td></tr>';
$sql = 'select year(time_start_act), pname, count(distinct owner_fk) as c, time_start_act, b.test_status_preserved from (select distinct test_fk, tbl_serv_platforms.name as pname from tbl_serv_map_test_observer_targetimages left join tbl_serv_targetimages on (targetimage_fk = serv_targetimages_key) left join tbl_serv_platforms on (platforms_fk = serv_platforms_key)) as a left join tbl_serv_tests as b on (a.test_fk = b.serv_tests_key) where year(time_start_act) = '.$year.' and (b.test_status_preserved in ("finished", "retention expiring", "synced") or b.test_status_preserved is null) and time_start_act is not null and pname is not null group by pname order by time_start_act, pname';
$rs2 = mysqli_query($db, $sql) or flocklab_die('Cannot get statistics from database because: ' . mysqli_error($db));
while ($row = mysqli_fetch_array($rs2)) {
echo '<tr><td>&nbsp;&nbsp;'.$row['pname'].'</td><td>'.$row['c'].' ('.(round($row['c']/$num_users * 100)).'%)</td></tr>';
}
$sql = 'select sum(num_all > 0) as user_all, sum(num_serial > 0) as user_serial, sum(num_tracing > 0) as user_tracing, sum(num_actuation > 0) as user_actuation, sum(num_power > 0) as user_power from (select year(time_start_act) as y, sum(1) as num_all, sum(ExtractValue(testconfig_xml, "count(/testConf/serialConf|/testConf/serialReaderConf)") > 0) as num_serial, sum(ExtractValue(testconfig_xml, "count(/testConf/gpioTracingConf|/testConf/gpioMonitorConf)") > 0) as num_tracing, sum(ExtractValue(testconfig_xml, "count(/testConf/gpioActuationConf|/testConf/gpioSettingConf)") > 0) as num_actuation, sum(ExtractValue(testconfig_xml, "count(/testConf/powerProfilingConf|/testConf/powerprofConf)") > 0) as num_power from tbl_serv_tests where year(time_start_act) = '.$year.' and (test_status_preserved in ("finished", "retention expiring", "synced") or test_status_preserved is null) group by owner_fk) as stats;';
$rs3 = mysqli_query($db, $sql) or flocklab_die('Cannot get statistics from database because: ' . mysqli_error($db));
$row = mysqli_fetch_array($rs3);
foreach (array('Serial'=>'user_serial','GPIO tracing'=>'user_tracing','GPIO actuation'=>'user_actuation','Power profiling'=>'user_power') as $service=>$field) {
echo '<tr><td>&nbsp;&nbsp;'.$service.'</td><td>'.$row[$field].' ('.(round($row[$field] / $row['user_all'] * 100 )).'%)</td></tr>';
}
}
// Occupied per year
$sql = 'select year(time_start_act) as y, min(time_start_act) as minp, max(time_end_act) as maxp, max(time_end_act - time_start_act), sum(timestampdiff(SECOND,time_start_act,time_end_act)) as duration from tbl_serv_tests where (test_status_preserved in ("finished", "retention expiring", "synced") or test_status_preserved is null) and (time_end_act is not null and time_start_act is not null and time_start_act < time_end_act and timestampdiff(SECOND,time_start_act,time_end_act) < 72 * 3600) group by year(time_start_act)';
$rs = mysqli_query($db, $sql) or flocklab_die('Cannot get statistics from database because: ' . mysqli_error($db));
while ($row = mysqli_fetch_array($rs)) {
echo '<tr><td><b>Time occupied '.$row['y'].'</b></td><td>'.round((($row['duration'] + $testcount[$row['y']] * $testoverhead) / 3600)).' hours ('.round((($row['duration'] + $testcount[$row['y']] * $testoverhead) / (strtotime($row['maxp'])-strtotime($row['minp'])) * 100)).'%)</td></tr>';
}
// last year, weekly resolution
$sql = 'select year(time_start_act) as y, week(time_start_act) as w, count(*) as num from tbl_serv_tests where
datediff(DATE_SUB(DATE_SUB(CURDATE(),INTERVAL (DAY(CURDATE())-1) DAY),INTERVAL 12 MONTH),time_start_act) <=0 AND
(test_status_preserved in ("finished", "retention expiring", "synced") or test_status_preserved is null)
group by year(time_start_act), week(time_start_act) having y is not null';
$rs = mysqli_query($db, $sql) or flocklab_die('Cannot get statistics from database because: ' . mysqli_error($db));
$testcount = Array();
while ($row = mysqli_fetch_array($rs)) {
$testcount[$row['y'].'-'.$row['w']] = $row['num'];
}
$sql = 'select year(time_start_act) as y, week(time_start_act) as w, min(time_start_act) as minp, max(time_end_act) as maxp, max(timestampdiff(SECOND,time_start_act,time_end_act)), sum(timestampdiff(SECOND,time_start_act,time_end_act)) as duration from tbl_serv_tests
where
datediff(DATE_SUB(DATE_SUB(CURDATE(),INTERVAL (DAY(CURDATE())-1) DAY),INTERVAL 12 MONTH),time_start_act) <=0 AND
(test_status_preserved in ("finished", "retention expiring", "synced") or test_status_preserved is null) and
(time_end_act is not null and time_start_act is not null and time_start_act < time_end_act and timestampdiff(SECOND,time_start_act,time_end_act) < 72 * 3600)
group by year(time_start_act), week(time_start_act) having y is not null';
$rs = mysqli_query($db, $sql) or flocklab_die('Cannot get statistics from database because: ' . mysqli_error($db));
$uval=Array();$uweek=Array();
while ($row = mysqli_fetch_array($rs)) {
// echo '<tr><td>&nbsp;&nbsp;Time occupied '.$row['y'].' week '.$row['w'].'</td><td>'.round((($row['duration'] + $testcount[$row['y'].'-'.$row['w']] * $testoverhead) / 3600)).' hours ('.round((($row['duration'] + $testcount[$row['y'].'-'.$row['w']] * $testoverhead) / (7*24*3600) * 100)).'%)</td></tr>';
array_push($uval, round((($row['duration'] + $testcount[$row['y'].'-'.$row['w']] * $testoverhead) / (7*24*3600) * 100)));
array_push($uweek, $row['w']);
}
echo '
<script type="text/javascript">
var uval=['.implode(',',$uval).'];
var uweek=['.implode(',',$uweek).'];
$(document).ready(function() {
var vis = new pv.Panel()
.canvas("usagebars")
.width(860)
.height(125);
vis.add(pv.Rule)
.data(pv.range(0, 101, 50))
.bottom(function(d) { return d + 10.5;})
.left(26)
.width(794)
.add(pv.Label).textAlign("right");
vis.add(pv.Bar)
.data(pv.range(0, uval.length, 1))
.width(10)
.height(function(d){ return uval[d];})
.bottom(10)
.left(function() {return this.index * 14 + 26;})
.anchor("bottom").add(pv.Label)
.text(function(d) {return uweek[d];})
.textBaseline("top");
vis.add(pv.Label)
.left(10)
.top(50)
.textAlign("center")
.textAngle(-0.5 * Math.PI)
.text("Utilization (%)");
vis.render();
});
</script>
';
mysqli_close($db);
?>
<tr><td colspan="2"><b>Weekly utilization during the most recent 12 months</b><div id="usagebars"></div></td></tr>
</table>
<?php
do_layout('Statistics','Statistics');
?>
......@@ -80,14 +80,14 @@ echo '<h1>Admin User Management</h1>';
<table id="res_overview" class="tablesorter" style="display:none">
<thead>
<tr>
<th width="80px">Username</th>
<th width="70px">Username</th>
<th width="70px">First name</th>
<th width="80px">Last name</th>
<th width="140px">E-Mail</th>
<th width="50px">Create date</th>
<th width="50px">Quota</th>
<th width="30px">Role</th>
<th width="20px">active</th>
<th width="30px">Active</th>
</tr>
</thead>
<tbody>
......@@ -115,11 +115,11 @@ echo '<h1>Admin User Management</h1>';
</table>
</form>
<span id="pager" class="pager">
<img src="pics/icons/first.gif" alt="first" class="first">
<img src="pics/icons/prev.gif" alt="prev" class="prev">
<span class="texticonsm first link" alt="first" title="first"><<</span>
<span class="texticonsm prev link" alt="prev" title="prev"><</span>
<span class="pagedisplay"></span>
<img src="pics/icons/next.gif" alt="next" class="next">
<img src="pics/icons/last.gif" alt="last" class="last">
<span class="texticonsm next link" alt="next" title="next">></span>
<span class="texticonsm last link" alt="last" title="last">>></span>
<input class="pagesize" style="visibility: hidden;" id="pager_num_rows" value="15">
</span> <br >
<?php
......
......@@ -33,7 +33,7 @@
firstDay: 1,
weekends: true,
lazyFetching: true,
eventColor: '#98BF21',
eventColor: '#28549f',
defaultView: 'month',
slotMinutes: 30,
allDaySlot: false,
......
......@@ -11,433 +11,479 @@
*/
html {
overflow-y: scroll;
overflow-y: scroll;
}
body {
background-image: url(../pics/bg_body.png);
background-repeat: repeat-x;
margin:0;
/* background-image: url(../pics/bg_body.png);
background-repeat: repeat-x;
background-color: #f0f0f0;*/
margin:0;
}
a {
color: #657a28;
color: #28549f;
}
a img {
border: none;
border: none;
}
div.header img {
vertical-align: middle;
border: 0px none;
vertical-align: middle;
border: 0px none;
margin-top: 10px;
margin-bottom: 20px;
}
div.container {
width: 1150px;
padding: 15px;
margin: 5px 10px 10px 10px;
margin-left: auto ;
margin-right: auto ;
background-color: #DDD;
/* background-image: url(../pics/bg_container.png);*/
/* background-repeat: repeat-x; */
border-style: solid;
border-color: gray;
border-width: 2px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: small;
width: 1150px;
padding: 15px;
margin: 5px 10px 10px 10px;
margin-left: auto ;
margin-right: auto ;
background-color: #FFFFFF;
/* background-image: url(../pics/bg_container.png);*/
/* background-repeat: repeat-x; */
border-style: solid;
border-color: gray;
border-width: 0px;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: small;
}
div.login {
width: 50%;
margin: 150px auto;
width: 50%;
margin: 150px auto;
}
#logout {
float: right;
float: right;
}
/* table styling for content div */
div.content {
width: 905px;
height: 100%;
margin: 10px 0px;
float: left;
padding: 0px;
color: #666666;
width: 920px;
height: 100%;
margin: 10px 0px;
float: left;
padding: 0px;
color: #666666;
}
div.content h1 {
font-size: medium;
font-size: 14px;
padding: 5px;
}
div.content table {
table-layout: fixed;
/* min-width: 700px;*/
border-collapse: collapse;
table-layout: fixed;
/* min-width: 700px;*/
border-collapse: collapse;
}
div.content th, div.content td {
border: 1px solid #98bf21;
padding: 3px 10px 5px 7px;
/* white-space: nowrap;*/
text-overflow: ellipsis;
overflow: hidden;
padding: 5px 10px 5px 7px;
/* white-space: nowrap;*/
text-overflow: ellipsis;
overflow: hidden;
}
td:hover {
background-color: #F0F0F0;
}
div.content th {
text-align: left;
color: #ffffff;
padding-top: 2px;
padding-bottom: 2px;
background-color: #A7C942;
text-overflow: ellipsis;
text-align: left;
color: #ffffff;
padding-top: 10px;
padding-bottom: 10px;
background-color: #1F407A;
text-overflow: ellipsis;
}
/* Styling for tablesorter */
div.content table.tablesorter {
width: 912px;
border-collapse: collapse;
width: 912px;
border-collapse: collapse;
border: 0px solid #28549f;
}
div.content table.tablesorter th {
background-image: url(../pics/icons/sort_both.gif);
background-position: right center;
background-repeat: no-repeat;
background-image: url(../pics/icons/sort_both.gif);
background-position: right center;
background-repeat: no-repeat;
cursor: pointer;
}
div.content table.tablesorter th.headerSortUp {
background-color: #78961b;
background-image: url(../pics/icons/sort_asc.gif);
background-position: right center;
background-repeat: no-repeat;
background-color: #28549f;
background-image: url(../pics/icons/sort_asc.gif);
background-position: right center;
background-repeat: no-repeat;
cursor: pointer;
}
div.content table.tablesorter th.headerSortDown {
background-color: #78961b;
background-image: url(../pics/icons/sort_desc.gif);
background-position: right center;
background-repeat: no-repeat;
background-color: #28549f;
background-image: url(../pics/icons/sort_desc.gif);
background-position: right center;
background-repeat: no-repeat;
cursor: pointer;
}
div.content table.tablesorter tr.even {
background-color: #EAF2D3;
background-color: #f9f9f9;
}
div.content table.tablesorter tr.odd {
background-color: transparent;
background-color: transparent;
}
/* BEGIN styling for sidebar div */
div.sidebar {
width: 220px;
height: 100%;
margin: 10px 0px;
float: right;
padding: 0px;
color: #666666;
width: 200px;
height: 100%;
margin-left: 20px;
margin-top: 52px;
float: right;
padding: 0px;
color: #666666;
}
div.sidebar h1 {
font-size: small;
font-size: 14px;
}
div.sidebar h1 a {
color: #666666;
text-decoration: none;
color: #666666;
text-decoration: none;
}
div.sidebar a:hover {
color: #e08e00;
}
/* END styling for sidebar div */
/* BEGIN styling for sidenavigation div */
div.sidenavigation {
float: none;
float: none;
}
div.sidenavigation a {
color: #666666;
text-decoration: none;
color: #666666;
text-decoration: none;
}
/* END styling for sidenavigation div */
/* BEGIN styling of forms, input fields and buttons */
input {
border: 1px solid gray;
background-color: #A7C942;
height: 18px;
padding: 2px;
color: #666666;
border: 1px solid gray;
background-color: #f9f9f9;
height: 18px;
padding: 2px;
color: #666666;
}
input[type=submit], input[type=button], input[type=reset] {
height: 24px;
padding-left: 7px;
padding-right: 7px;
height: 24px;
padding-left: 7px;
padding-right: 7px;
}
input[type=file] {
height: 24px;
width: 350px;
margin-left: 4px;
height: 24px;
width: 350px;
margin-left: 4px;
}
input[disabled="disabled"], input.disabled {
background-color: #C0C0C0;
background-color: #C0C0C0;
}
input[type=radio], input[type=checkbox] {
width: auto;
background-color: transparent;
border: none;
width: auto;
background-color: transparent;
border: none;
}
label.error {
float: none;
color: red;
padding-left: 5px;
float: none;
color: red;
padding-left: 5px;
}
form span.formfield {
display: inline-block;
width: 150px;
overflow: hidden;
vertical-align: top;
display: inline-block;
width: 150px;
overflow: hidden;
vertical-align: top;
}
form span.formfield-wide {
display: inline-block;
width: 350px;
overflow: hidden;
vertical-align: top;
display: inline-block;
width: 350px;
overflow: hidden;
vertical-align: top;
}
form span.formfield-extrawide {
display: inline-block;
width: 450px;
overflow: hidden;
vertical-align: top;
display: inline-block;
width: 450px;
overflow: hidden;
vertical-align: top;
}
form textarea, form input[type="text"], form select {
border: 1px solid gray;
background-color: #A7C942;
height: auto;
min-height: 18px;
width: 350px;
padding: 2px;
color: #666666;
margin: 3px;
border: 1px solid gray;
background-color: #f9f9f9;
height: auto;
min-height: 18px;
width: 350px;
padding: 2px;
color: #666666;
margin: 3px;
}
form input[type="password"] {
border: 1px solid gray;
background-color: #A7C942;
height: auto;
min-height: 18px;
width: 350px;
padding: 2px;
color: #666666;
margin: 3px;
border: 1px solid gray;
background-color: #f9f9f9;
height: auto;
min-height: 18px;
width: 350px;
padding: 2px;
color: #666666;