5 // Mark Huang <mlhuang@cs.princeton.edu>
6 // Copyright (C) 2006 The Trustees of Princeton University
12 require_once 'plc_session.php';
15 // Get sorting functions
16 require_once 'plc_sorts.php';
18 // Get PlanetFlow stats
19 global $planetflow, $active_bytes;
20 include_once '_gen_planetflow.php';
23 require_once 'plc_drupal.php';
24 drupal_set_title('Projects');
25 include 'plc_header.php';
27 if (isset($_REQUEST['active'])) {
31 <p>A slice is essentially a login account on a set of nodes. The
32 following is a list of the most active slices; you may also view a
33 list of <a href="/db/pub/slices.php">all slices</a>.</p>
37 <p>A slice is essentially a login account on a set of nodes. The
38 following is a list of all slices; you may also view a list of <a
39 href="/db/pub/slices.php?active">just the most active slices</a>.</p>
43 <p>To provide feedback to the principals responsible for each slice,
44 check the <b>Feedback</b> box for each slice that you would like to
45 comment on, then click <b>Provide Feedback</b>.</p>
47 <form method="post" action="/db/pub/feedback.php">
49 <table cellspacing="0">
65 foreach ($adm->GetSites(NULL, array('abbreviated_name', 'site_id'))
67 $sites[$site['site_id']] = $site;
71 $slices = $adm->GetSlices(NULL, array('name', 'url', 'description', 'site_id'));
73 // List just the active slices
74 if (isset($_REQUEST['active'])) {
75 // Byte threshold to be considered "active"
76 if (!empty($_REQUEST['mbytes'])) {
77 $active_bytes = intval($_REQUEST['mbytes'])*1024*1024;
79 $active_bytes = 100*1024*1024;
82 // Filter just the active slices
83 function __active_slice($slice) {
84 global $planetflow, $active_bytes;
85 return isset($planetflow[$slice['name']]) &&
86 ($planetflow[$slice['name']]['bytes'] >= $active_bytes);
88 $slices = array_filter($slices, '__active_slice');
90 // Sort active slices by bytes in descending order
91 function __cmp_slices_by_bytes($slicea, $sliceb) {
93 return ($planetflow[$slicea['name']]['bytes'] > $planetflow[$sliceb['name']]['bytes']) ? -1 : 1;
95 usort($slices, '__cmp_slices_by_bytes');
97 // Alphabetically sort slices
102 foreach ($slices as $slice) {
103 print "<tr class=\"$class\">";
105 print '<td valign="top"><a name="' .
106 htmlspecialchars($slice['name']) .
108 htmlspecialchars($slice['name']) .
111 print '<td valign="top">';
112 print htmlspecialchars(trim($slice['description']));
113 if (!empty($slice['url'])) {
114 if (strncasecmp($slice['url'], "http", 4) != 0) {
115 $slice['url'] = "http://" . $slice['url'];
117 print '<br /><a href="' . htmlspecialchars($slice['url']) . '">More details...</a>';
121 print '<td valign="top">';
122 if (isset($sites[$slice['site_id']])) {
123 $site = $sites[$slice['site_id']];
124 print htmlspecialchars($site['abbreviated_name']);
128 print '<td valign="top">';
129 if (isset($planetflow[$slice['name']]) &&
130 isset($planetflow[$slice['name']]['bytes']) &&
131 $planetflow[$slice['name']]['bytes']/1024/1024 >= 1) {
132 print number_format($planetflow[$slice['name']]['bytes']/1024/1024, 0, '.', ',');
136 print '<td valign="top">';
137 print '<input type="checkbox" name="slices[]" value="' . htmlspecialchars($slice['name']) . '" />';
142 $class = $class == "oddrow" ? "" : "oddrow";
150 <input type="submit" value="Provide Feedback" />
156 include 'plc_footer.php';