5 // Mark Huang <mlhuang@cs.princeton.edu>
6 // Copyright (C) 2006 The Trustees of Princeton University
12 require_once 'plc_session.php';
15 // Get PlanetFlow stats
16 global $planetflow, $active_bytes;
17 include_once '_gen_planetflow.php';
20 require_once 'plc_drupal.php';
21 drupal_set_title('Projects');
22 include 'plc_header.php';
24 if (isset($_REQUEST['active'])) {
28 <p>A slice is essentially a login account on a set of nodes. The
29 following is a list of the most active slices; you may also view a
30 list of <a href="/db/pub/slices.php">all slices</a>.</p>
34 <p>A slice is essentially a login account on a set of nodes. The
35 following is a list of all slices; you may also view a list of <a
36 href="/db/pub/slices.php?active">just the most active slices</a>.</p>
40 <p>To provide feedback to the principals responsible for each slice,
41 check the <b>Feedback</b> box for each slice that you would like to
42 comment on, then click <b>Provide Feedback</b>.</p>
44 <form method="post" action="/db/pub/feedback.php">
46 <table cellspacing="0">
62 foreach ($adm->GetSites(NULL, array('abbreviated_name', 'site_id'))
64 $sites[$site['site_id']] = $site;
68 $slices = $adm->GetSlices(NULL, array('name', 'url', 'description', 'site_id'));
70 // List just the active slices
71 if (isset($_REQUEST['active'])) {
72 // Byte threshold to be considered "active"
73 if (!empty($_REQUEST['mbytes'])) {
74 $active_bytes = intval($_REQUEST['mbytes'])*1024*1024;
76 $active_bytes = 100*1024*1024;
79 // Filter just the active slices
80 function __active_slice($slice) {
81 global $planetflow, $active_bytes;
82 return isset($planetflow[$slice['name']]) &&
83 ($planetflow[$slice['name']]['bytes'] >= $active_bytes);
85 $slices = array_filter($slices, '__active_slice');
87 // Sort active slices by bytes in descending order
88 function __cmp_slices_by_bytes($slicea, $sliceb) {
90 return ($planetflow[$slicea['name']]['bytes'] > $planetflow[$sliceb['name']]['bytes']) ? -1 : 1;
92 usort($slices, '__cmp_slices_by_bytes');
94 // Alphabetically sort slices
99 foreach ($slices as $slice) {
100 print "<tr class=\"$class\">";
102 print '<td valign="top"><a name="' .
103 htmlspecialchars($slice['name']) .
105 htmlspecialchars($slice['name']) .
108 print '<td valign="top">';
109 print htmlspecialchars(trim($slice['description']));
110 if (!empty($slice['url'])) {
111 if (strncasecmp($slice['url'], "http", 4) != 0) {
112 $slice['url'] = "http://" . $slice['url'];
114 print '<br /><a href="' . htmlspecialchars($slice['url']) . '">More details...</a>';
118 print '<td valign="top">';
119 if (isset($sites[$slice['site_id']])) {
120 $site = $sites[$slice['site_id']];
121 print htmlspecialchars($site['abbreviated_name']);
125 print '<td valign="top">';
126 if (isset($planetflow[$slice['name']]) &&
127 isset($planetflow[$slice['name']]['bytes']) &&
128 $planetflow[$slice['name']]['bytes']/1024/1024 >= 1) {
129 print number_format($planetflow[$slice['name']]['bytes']/1024/1024, 0, '.', ',');
133 print '<td valign="top">';
134 print '<input type="checkbox" name="slices[]" value="' . htmlspecialchars($slice['name']) . '" />';
139 $class = $class == "oddrow" ? "" : "oddrow";
147 <input type="submit" value="Provide Feedback" />
153 include 'plc_footer.php';