Repeat ourselves less when listing OpenSRF changelogs opensrf_2_1_2
authorDan Scott <dscott@laurentian.ca>
Sun, 18 Nov 2012 13:32:36 +0000 (08:32 -0500)
committerDan Scott <dscott@laurentian.ca>
Sun, 18 Nov 2012 13:32:36 +0000 (08:32 -0500)
Signed-off-by: Dan Scott <dscott@laurentian.ca>
opensrf_changelog.php

index 61b3413..a86bd7b 100644 (file)
 <!--end side-->
 <div id="pagebody">
 <h1>OpenSRF ChangeLogs</h1>
-<a name="200"></a>
-<h2>2.0</h2>
+<?php 
+$releases = array(
+    '2.1' => '210',
+    '2.0' => '200',
+    '1.6' => '160',
+);
 
-<?php
-$fdir = "downloads/";
-$globarray = glob($fdir . "OpenSRF-ChangeLog-2.0*");
-usort($globarray, create_function('$a,$b', 'return filemtime($b) - filemtime($a);'));
-echo "<ul class='bullet'>";
-foreach($globarray as $filename) {
-   $info = pathinfo($filename);
-      $target = htmlspecialchars($info['basename']);
-   printf(
-      "<li><a href='%s'>%s</a></li>\n",
-      htmlspecialchars($filename),
-      $target
-   );
+foreach ($releases as $release_name => $release_id) {
+    echo("<a name='$release_id'></a>\n<h2>$release_name</h2>");
+    $fdir = "downloads/";
+    $globarray = glob($fdir . "OpenSRF-ChangeLog-$release_name*");
+    usort($globarray, create_function('$a,$b', 'return filemtime($b) - filemtime($a);'));
+    echo "<ul class='bullet'>";
+    foreach($globarray as $filename) {
+       $info = pathinfo($filename);
+          $target = htmlspecialchars($info['basename']);
+       printf(
+          "<li><a href='%s'>%s</a></li>\n",
+          htmlspecialchars($filename),
+          $target
+       );
+    }
+    echo "</ul>";
 }
-echo "</ul>";
 ?>
-
-<a name="161"></a>
-<h2>1.6.3</h2>
-
-<?php
-$fdir = "downloads/";
-$globarray = glob($fdir . "OpenSRF-ChangeLog-1.6*");
-usort($globarray, create_function('$a,$b', 'return filemtime($b) - filemtime($a);'));
-echo "<ul class='bullet'>";
-foreach($globarray as $filename) {
-   $info = pathinfo($filename);
-      $target = htmlspecialchars($info['basename']);
-   printf(
-      "<li><a href='%s'>%s</a></li>\n",
-      htmlspecialchars($filename),
-      $target
-   );
-}
-echo "</ul>";
-?>
-
 </div>
 <!--end pagebody-->
 <?php include "/var/www/open-ils.org/incl/footer.php"; ?>