Author: cfinck
Date: Wed Jun 20 02:15:03 2007
New Revision: 27242
URL:
http://svn.reactos.org/svn/reactos?rev=27242&view=rev
Log:
- Add support for revision ranges (e.g. 27300-27306)
- Sort the files alphabetically
- Improved the revision number check
- Removed the MAX_FILES_PER_REV option
The new "info.png" was also taken from the Tango Icon Theme 0.8.0
Demonstration at
http://reactos.colinfinck.de/getbuilds has also been updated.
Added:
trunk/web/reactos.org/htdocs/getbuilds/images/info.png (with props)
Modified:
trunk/web/reactos.org/htdocs/getbuilds/ajax-getfiles-provider.php
trunk/web/reactos.org/htdocs/getbuilds/getbuilds.css
trunk/web/reactos.org/htdocs/getbuilds/getbuilds.js.php
trunk/web/reactos.org/htdocs/getbuilds/index.php
trunk/web/reactos.org/htdocs/getbuilds/lang/de.inc.php
trunk/web/reactos.org/htdocs/getbuilds/lang/en.inc.php
Modified:
trunk/web/reactos.org/htdocs/getbuilds/ajax-getfiles-provider.php
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/getbuilds/a…
==============================================================================
---
trunk/web/reactos.org/htdocs/getbuilds/ajax-getfiles-provider.php (original)
+++
trunk/web/reactos.org/htdocs/getbuilds/ajax-getfiles-provider.php Wed Jun 20 02:15:03
2007
@@ -12,7 +12,6 @@
// Configuration
$ISO_DIR = ".";
- $MAX_FILES_PER_REV = 4;
// Functions
@@ -34,36 +33,60 @@
return number_format( $size, 2, ".", ",") . $unit;
}
+ function ArraySort(&$array, $elem)
+ {
+ global $sort_elem;
+
+ $sort_elem = $elem;
+ usort( $array, "ArraySort_callback" );
+ }
+
+ function ArraySort_callback($a, $b)
+ {
+ global $sort_elem;
+
+ return strnatcasecmp( $a[$sort_elem], $b[$sort_elem] );
+ }
+
+
// Entry point
- if( !isset( $_GET["rev"] ) )
- die("No revision specified!");
+ if( !isset( $_GET["from"] ) || !isset( $_GET["to"] ) )
+ die("No revision range specified!");
- $revfiles = 0;
+ $files = array();
+ $i = 0;
$dir = opendir( $ISO_DIR ) or die("opendir failed!");
- header("Content-type: text/xml; charset=utf-8");
?>
<files>
<?php
while( $fname = readdir($dir) )
{
- if( strpos( $fname, "-" . $_GET["rev"] . "-" ) !== false
)
+ for( $j = $_GET["from"]; $j <= $_GET["to"]; $j++ )
{
- $fsize = fsize_str( filesize( "$ISO_DIR/$fname" ) );
- $fdate = date( "Y-m-d H:i", filemtime( "$ISO_DIR/$fname" ) );
-?>
-<file>
- <name><?php echo $fname; ?></name>
- <size><?php echo $fsize; ?></size>
- <date><?php echo $fdate; ?></date>
-</file>
-<?php
- $revfiles++;
-
- if( $revfiles == $MAX_FILES_PER_REV )
+ if( strpos( $fname, "-$j-" ) !== false )
+ {
+ $files[$i]["name"] = $fname;
+ $files[$i]["size"] = fsize_str( filesize( "$ISO_DIR/$fname" ) );
+ $files[$i]["date"] = date( "Y-m-d H:i", filemtime(
"$ISO_DIR/$fname" ) );
+
+ $i++;
break;
+ }
}
}
closedir($dir);
+ ArraySort( $files, "name" );
+
+ for( $j = 0; $j < $i; $j++ )
+ {
+?>
+<file>
+ <name><?php echo $files[$j]["name"]; ?></name>
+ <size><?php echo $files[$j]["size"]; ?></size>
+ <date><?php echo $files[$j]["date"]; ?></date>
+</file>
+<?php
+ }
?>
</files>
Modified:
trunk/web/reactos.org/htdocs/getbuilds/getbuilds.css
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/getbuilds/g…
==============================================================================
---
trunk/web/reactos.org/htdocs/getbuilds/getbuilds.css (original)
+++
trunk/web/reactos.org/htdocs/getbuilds/getbuilds.css Wed Jun 20 02:15:03 2007
@@ -58,10 +58,6 @@
vertical-align: top;
}
-#showrev {
- margin-bottom: 2em;
-}
-
#showrev img {
vertical-align: middle;
cursor: pointer;
@@ -74,6 +70,10 @@
#ajaxloadinginfo {
margin-left: 10px;
+}
+
+#infobox {
+ margin-bottom: 2em;
}
.datatable {
Modified:
trunk/web/reactos.org/htdocs/getbuilds/getbuilds.js.php
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/getbuilds/g…
==============================================================================
---
trunk/web/reactos.org/htdocs/getbuilds/getbuilds.js.php (original)
+++
trunk/web/reactos.org/htdocs/getbuilds/getbuilds.js.php Wed Jun 20 02:15:03 2007
@@ -74,7 +74,7 @@
}
}
-function getfilesCallback(http_request, rev)
+function getfilesCallback(http_request, revs)
{
if( http_request.responseXML == null )
{
@@ -91,7 +91,7 @@
var files = http_request.responseXML.getElementsByTagName("file");
if( files.length == 0 )
- datatable += '<tr class="odd"><td><?php echo
$getbuilds_langres["nofiles1"]; ?>' + rev + '<?php echo
$getbuilds_langres["nofiles2"];
?></td><td> </td><td> </td></tr>';
+ datatable += '<tr class="odd"><td><?php echo
$getbuilds_langres["nofiles1"]; ?>' + revs + '<?php echo
$getbuilds_langres["nofiles2"];
?></td><td> </td><td> </td></tr>';
else
{
var oddeven = false;
@@ -139,56 +139,70 @@
setrowcolor( elem, "#EEEEEE" );
}
-function getrevnum()
+var from;
+var to;
+
+function getrevnums()
{
var rev = document.getElementById("revnum").value;
- if( isNaN(rev) )
- {
- alert("<?php echo $getbuilds_langres["invalidrev"]; ?>");
- return false;
- }
- else
- return rev;
+ if( isNaN(rev) || rev < 1 )
+ {
+ // Maybe the user entered a revision range
+ var hyphen = rev.indexOf("-");
+
+ if( hyphen > 0 )
+ {
+ from = rev.substr( 0, hyphen );
+ to = rev.substr( hyphen + 1 );
+ }
+
+ if( hyphen <= 0 || isNaN(from) || isNaN(to) )
+ {
+ alert("Invalid revision number!");
+ return false;
+ }
+ }
+ else
+ {
+ from = rev;
+ to = rev;
+ }
+
+ return true;
}
function prevrev()
{
- var rev = getrevnum();
-
- if( rev )
- {
- rev--;
+ if( getrevnums() )
+ {
+ from--;
// 25700 is the lowest rev on the server at the time, when this script has been
written
// There is no harm if this rev does not exist anymore on the FTP server, it's just
a min value
- if(rev < 25700)
+ if(from < 25700)
return;
- document.getElementById("revnum").value = rev;
+ document.getElementById("revnum").value = from;
}
}
function nextrev()
{
- var rev = getrevnum();
-
- if( rev )
- {
- rev++;
- document.getElementById("revnum").value = rev;
+ if( getrevnums() )
+ {
+ from++;
+ document.getElementById("revnum").value = from;
}
}
function showrev()
{
- var rev = getrevnum();
-
- if( rev )
- ajaxGet( "getfiles", "rev=" + rev, rev );
+ if( getrevnums() )
+ ajaxGet( 'getfiles', 'from=' + from + '&to=' + to,
document.getElementById("revnum").value );
}
function checkrevnum(elem)
{
- elem.value = elem.value.replace( /[^[0-9]/g, "");
-}
+ elem.value = elem.value.replace( /[^[0-9-]/g, "");
+}
Added:
trunk/web/reactos.org/htdocs/getbuilds/images/info.png
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/getbuilds/i…
==============================================================================
Binary file - no diff available.
Propchange:
trunk/web/reactos.org/htdocs/getbuilds/images/info.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified:
trunk/web/reactos.org/htdocs/getbuilds/index.php
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/getbuilds/i…
==============================================================================
---
trunk/web/reactos.org/htdocs/getbuilds/index.php (original)
+++
trunk/web/reactos.org/htdocs/getbuilds/index.php Wed Jun 20 02:15:03 2007
@@ -39,7 +39,7 @@
<?php require_once("getbuilds.js.php"); ?>
</script>
</head>
-<body onload="ajaxGet('getfiles', 'rev=<?php echo $rev;
?>', <?php echo $rev; ?>);">
+<body onload="ajaxGet('getfiles', 'from=<?php echo $rev;
?>&to=<?php echo $rev; ?>', <?php echo $rev; ?>);">
<h2><?php echo $getbuilds_langres["title"]; ?></h2>
@@ -89,7 +89,7 @@
'<div id="showrev">' +
'<?php echo $getbuilds_langres["showrevfiles"]; ?>: ' +
'<img src="images/leftarrow.gif" alt="<"
title="<?php echo $getbuilds_langres["prevrev"]; ?>"
onclick="prevrev();"> ' +
- '<input type="text" id="revnum" value="<?php echo
$rev; ?>" size="6" onkeyup="checkrevnum(this);"> ' +
+ '<input type="text" id="revnum" value="<?php echo
$rev; ?>" size="12" onkeyup="checkrevnum(this);"> ' +
'<img src="images/rightarrow.gif" alt=">"
title="<?php echo $getbuilds_langres["nextrev"]; ?>"
onclick="nextrev();"> ' +
'<button type="submit"
onclick="showrev();"><strong><?php echo
$getbuilds_langres["showrev"]; ?></strong></button>' +
@@ -97,6 +97,10 @@
'<span id="ajaxloadinginfo">' +
'<img src="images/ajax_loading.gif"> <strong><?php
echo $getbuilds_langres["gettinglist"]; ?>...</strong>' +
'</span>' +
+ '</div>' +
+
+ '<div id="infobox">' +
+ '<img src="images/info.png" alt="INFO:"> <?php echo
$getbuilds_langres["rangeinfo"]; ?>' +
'</div>' +
'<div id="filetable">' +
Modified:
trunk/web/reactos.org/htdocs/getbuilds/lang/de.inc.php
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/getbuilds/l…
==============================================================================
---
trunk/web/reactos.org/htdocs/getbuilds/lang/de.inc.php (original)
+++
trunk/web/reactos.org/htdocs/getbuilds/lang/de.inc.php Wed Jun 20 02:15:03 2007
@@ -25,6 +25,7 @@
$getbuilds_langres["nextrev"] = "Nächste Revision";
$getbuilds_langres["showrev"] = "Anzeigen";
$getbuilds_langres["gettinglist"] = "Dateiliste wird geladen";
+ $getbuilds_langres["rangeinfo"] = "Sie können eine Revisionsnummer (z.B.
<i>27154</i>) oder einen Revisionsbereich (z.B.
<i>27000-27154</i>) eingeben.";
$getbuilds_langres["filename"] = "Dateiname";
$getbuilds_langres["filesize"] = "GröÃe";
$getbuilds_langres["filedate"] = "Zuletzt geändert";
Modified:
trunk/web/reactos.org/htdocs/getbuilds/lang/en.inc.php
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/getbuilds/l…
==============================================================================
---
trunk/web/reactos.org/htdocs/getbuilds/lang/en.inc.php (original)
+++
trunk/web/reactos.org/htdocs/getbuilds/lang/en.inc.php Wed Jun 20 02:15:03 2007
@@ -25,6 +25,7 @@
$getbuilds_langres["nextrev"] = "Next revision";
$getbuilds_langres["showrev"] = "Show";
$getbuilds_langres["gettinglist"] = "Getting file list";
+ $getbuilds_langres["rangeinfo"] = "You can enter a revision number (e.g.
<i>27154</i>) or a revision range (e.g.
<i>27000-27154</i>).";
$getbuilds_langres["filename"] = "File name";
$getbuilds_langres["filesize"] = "Size";
$getbuilds_langres["filedate"] = "Last changed";