From 873e3f333819bbc437718bfb88315f5925bd9041 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> Date: Thu, 1 Oct 2009 14:12:12 +0000 Subject: [PATCH] public sites page sortable/searcheable -- has a link to the KML/googlemaps stuff --- planetlab/pub/sites.php | 49 +++++++++++++++++++++++++------------- planetlab/sites/sites.php | 2 ++ planetlab/slices/slice.php | 4 ++-- plekit/php/table.php | 2 +- 4 files changed, 38 insertions(+), 19 deletions(-) diff --git a/planetlab/pub/sites.php b/planetlab/pub/sites.php index 87f4d40..caef04b 100644 --- a/planetlab/pub/sites.php +++ b/planetlab/pub/sites.php @@ -19,32 +19,49 @@ include 'plc_header.php'; ?> -<p>The following sites currently host or plan to host <?php echo PLC_NAME; ?> nodes:</p> -<ul> +<div id='public_sites'> +<p>The following sites currently host or plan to host <?php echo PLC_NAME; ?> nodes.</p> + +<p> Also available for download in <a href="/sites/sites.kml">KML format for Google Earth.</a> </p> +</div> <?php +require_once 'plc_functions.php'; +require_once 'plc_peers.php'; +require_once 'table.php'; + +$headers = array(); +$headers['Peer']='string'; +$headers['Name']='string'; +$headers['Lon']='float'; +$headers['Lat']='float'; + +$table=new PlekitTable ("sites",$headers,1,array('pagesize'=>10000,'pagesize_area'=>false)); +$table->start(); + +$peers=new Peers($adm); // All defined sites -$sites = $adm->GetSites(array('is_public' => TRUE, 'peer_id' => NULL), array('name', 'url')); +$sites = $adm->GetSites(array('is_public' => TRUE), + array('peer_id','name', 'url','latitude','longitude')); + foreach ($sites as $site) { $name = htmlspecialchars($site['name']); $url = $site['url']; - print "<li>"; - if ($url) { - print "<a href=\"$url\">$name</a>"; - } else { - print "$name"; - } - print "</li>"; -} -?> - -</ul> - -<?php + $table->row_start(); + $peers->cell($table,$site['peer_id']); + if ($url) + $table->cell(href($url,$name)); + else + $table->cell($name); + $table->cell($site['longitude']); + $table->cell($site['latitude']); + $table->row_end(); +} +$table->end(); include 'plc_footer.php'; diff --git a/planetlab/sites/sites.php b/planetlab/sites/sites.php index 9d12aeb..6b1c32d 100644 --- a/planetlab/sites/sites.php +++ b/planetlab/sites/sites.php @@ -113,6 +113,8 @@ $peers=new Peers($api); $nifty=new PlekitNifty ('','objects-list','big'); $nifty->start(); + +$headers=array(); if (plc_is_admin()) { $headers['I']='int'; } diff --git a/planetlab/slices/slice.php b/planetlab/slices/slice.php index eb826ee..45afc94 100644 --- a/planetlab/slices/slice.php +++ b/planetlab/slices/slice.php @@ -81,7 +81,7 @@ global $MAX_WEEKS; $MAX_WEEKS= 8; // weeks from today global $GRACE_DAYS; $GRACE_DAYS=10; // days for renewal promoted on top global $NOW; $NOW=mktime(); - +//////////////////////////////////////////////////////////// // make the renew area on top and open if the expiration time is less than 10 days from now function renew_needed ($slice) { global $DAY, $NOW, $GRACE_DAYS; @@ -173,7 +173,7 @@ EOF; $toggle->end(); } -////////// +//////////////////////////////////////////////////////////// $am_in_slice = in_array(plc_my_person_id(),$person_ids); diff --git a/plekit/php/table.php b/plekit/php/table.php index 63a9506..abe3073 100644 --- a/plekit/php/table.php +++ b/plekit/php/table.php @@ -65,7 +65,7 @@ class PlekitTable { $this->notes_area = true; $this->search_width = 40; $this->pagesize = 25; - $this->pagesize_def = 999; + $this->pagesize_def = 9999; $this->max_pages = 10; $this->notes = array(); $this->debug = false; -- 2.47.0