tazwok rev 369

web/index.php: enhance summary
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Feb 26 13:06:36 2011 +0100 (2011-02-26)
parents ccd7162c0ed1
children e9a7c6b82fe6
files web/index.php
line diff
     1.1 --- a/web/index.php	Fri Feb 25 18:29:49 2011 +0100
     1.2 +++ b/web/index.php	Sat Feb 26 13:06:36 2011 +0100
     1.3 @@ -114,6 +114,7 @@
     1.4  <!-- Block end -->
     1.5  </div>
     1.6  
     1.7 +<a name="Cooklog"></a>
     1.8  <h2>Cooklog</h2>
     1.9  
    1.10  <p>
    1.11 @@ -128,7 +129,9 @@
    1.12  	</form>
    1.13  </p>
    1.14  
    1.15 +<a name="Summary"></a>
    1.16  <h2>Summary</h2>
    1.17 +<img src="http://tank.slitaz.org/pics/rrd/cpu-day.png" title="cpu daily" alt="cpu daily" />
    1.18  <ul>
    1.19  <?php
    1.20  	// Check curent status (update in real time) and display summary.
    1.21 @@ -137,7 +140,14 @@
    1.22  		$status = "Chroot is mounted";
    1.23  	}
    1.24  	if (file_exists("$log_dir/step")) {
    1.25 -		$status .= ", ".file_get_contents("$log_dir/step");
    1.26 +		$duration = time() - filemtime("$log_dir/step");
    1.27 +		if ($duration < 60)
    1.28 +			$duration .= "s";
    1.29 +		else if ($duration < 3600)
    1.30 +			$duration = floor($duration / 60). " min";
    1.31 +		else	$duration = sprintf("%dH%02d",floor($duration / 3600),
    1.32 +				($duration / 60) % 60);
    1.33 +		$status .= ", ".file_get_contents("$log_dir/step")." ($duration ago)";
    1.34  		if (file_exists("$log_dir/package")) {
    1.35  			$pkg = file_get_contents("$log_dir/package");
    1.36  			$pkg = chop($pkg);
    1.37 @@ -168,6 +178,7 @@
    1.38  <?php
    1.39  if (!isset($_GET["summary"])) {
    1.40  ?>
    1.41 +<a name="Commit"></a>
    1.42  <h3>Commit</h3>
    1.43  <pre class="package">
    1.44  <?php
    1.45 @@ -175,6 +186,7 @@
    1.46  ?>
    1.47  </pre>
    1.48  
    1.49 +<a name="Cooklist"></a>
    1.50  <h3>Cooklist</h3>
    1.51  <pre class="package">
    1.52  <?php
    1.53 @@ -182,6 +194,7 @@
    1.54  ?>
    1.55  </pre>
    1.56  
    1.57 +<a name="Broken"></a>
    1.58  <h3>Broken</h3>
    1.59  <pre class="package">
    1.60  <?php
    1.61 @@ -189,6 +202,7 @@
    1.62  ?>
    1.63  </pre>
    1.64  
    1.65 +<a name="Blocked"></a>
    1.66  <h3>Blocked</h3>
    1.67  <pre class="package">
    1.68  <?php
    1.69 @@ -196,6 +210,7 @@
    1.70  ?>
    1.71  </pre>
    1.72  
    1.73 +<a name="cooked"></a>
    1.74  <h3>Last cooked packages</h3>
    1.75  <pre class="package">
    1.76  <?php
    1.77 @@ -203,6 +218,7 @@
    1.78  ?>
    1.79  </pre>
    1.80  
    1.81 +<a name="removed"></a>
    1.82  <h3>Last removed packages</h3>
    1.83  <pre class="package">
    1.84  <?php
    1.85 @@ -210,6 +226,7 @@
    1.86  ?>
    1.87  </pre>
    1.88  
    1.89 +<a name="flavors"></a>
    1.90  <h3>Last cooked flavors</h3>
    1.91  <pre class="package">
    1.92  <?php