Locate latest revision ISO

svn path=/trunk/; revision=16973
This commit is contained in:
Casper Hornstrup 2005-08-02 16:13:02 +00:00
parent a7acccff70
commit db35c17756

View file

@ -109,9 +109,12 @@ function printMenu($revision)
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="7"> <td colspan="4">
<input type="submit" name="getnextiso" value="Next ISO" tabindex="4" style="border: 1px solid #000000"></input> <input type="submit" name="getnextiso" value="Next ISO" tabindex="4" style="border: 1px solid #000000"></input>
</td> </td>
<td colspan="3" align="right">
<input type="submit" name="getlatestiso" value="Latest ISO" tabindex="5" style="border: 1px solid #000000"></input>
</td>
</tr> </tr>
</table> </table>
@ -139,7 +142,7 @@ if (revision) revision.focus();
<?php <?php
} }
function getNextRevisionISO($branch, $revision) function locateRevisionISO($branch, $revision, $latest)
{ {
$revision = intval($revision); $revision = intval($revision);
$path = ISO_PATH . "\\" . $branch; $path = ISO_PATH . "\\" . $branch;
@ -153,13 +156,16 @@ function getNextRevisionISO($branch, $revision)
$d->close(); $d->close();
if (is_array($filelist)) { if (is_array($filelist)) {
usort($filelist, "dm_usort_cmp_desc"); $sortFunction = $latest ? "dm_usort_cmp" : "dm_usort_cmp_desc";
usort($filelist, $sortFunction);
reset($filelist); reset($filelist);
while (list($key, $filename) = each($filelist)) { while (list($key, $filename) = each($filelist)) {
if (ereg('ReactOS-' . $branch . '-r([0-9]*).iso', $filename, $regs)) if (ereg('ReactOS-' . $branch . '-r([0-9]*).iso', $filename, $regs))
{ {
$thisRevision = intval($regs[1]); $thisRevision = intval($regs[1]);
if ($thisRevision > $revision) if (($latest) && ($thisRevision < $revision))
return $regs[1];
else if ($thisRevision > $revision)
return $regs[1]; return $regs[1];
$lastRevision = $thisRevision; $lastRevision = $thisRevision;
} }
@ -169,6 +175,15 @@ function getNextRevisionISO($branch, $revision)
return ""; return "";
} }
function getNextRevisionISO($branch, $revision)
{
return locateRevisionISO($branch, $revision, false);
}
function getLatestRevisionISO($branch)
{
return locateRevisionISO($branch, 999999, true);
}
function main() function main()
{ {
@ -199,6 +214,12 @@ else if (!empty($_POST["getnextiso"]) && !empty($_POST["branch"]) && !empty($_PO
printMenu(getNextRevisionISO($_POST["branch"], $_POST["revision"])); printMenu(getNextRevisionISO($_POST["branch"], $_POST["revision"]));
printFooter(); printFooter();
} }
else if (!empty($_POST["getlatestiso"]) && !empty($_POST["branch"]))
{
printHeader();
printMenu(getLatestRevisionISO($_POST["branch"]));
printFooter();
}
else else
{ {
printHeader(); printHeader();