mirror of https://github.com/BOINC/boinc.git
- include platforms in project_list.php
svn path=/trunk/boinc/; revision=16847
This commit is contained in:
parent
bc03a77df5
commit
149e7fdebe
|
@ -24,13 +24,14 @@ function friendly_name($p) {
|
||||||
switch ($p) {
|
switch ($p) {
|
||||||
case 'i686-pc-linux-gnu': return 'Linux/x86';
|
case 'i686-pc-linux-gnu': return 'Linux/x86';
|
||||||
case 'windows_intelx86': return 'Windows';
|
case 'windows_intelx86': return 'Windows';
|
||||||
case 'x86_64-pc-linux-gnu': return 'Linux/x86_64';
|
case 'x86_64-pc-linux-gnu': return 'Linux/x64';
|
||||||
case 'i686-apple-darwin': return 'Mac OS X';
|
case 'i686-apple-darwin': return 'Mac OS X';
|
||||||
|
case 'x86_64-apple-darwin': return 'Mac OS X 64-bit';
|
||||||
case 'powerpc-apple-darwin': return 'Mac OS X (PowerPC)';
|
case 'powerpc-apple-darwin': return 'Mac OS X (PowerPC)';
|
||||||
case 'sparc-sun-solaris2.7': return 'SPARC Solaris 2.7';
|
case 'sparc-sun-solaris2.7': return 'SPARC Solaris 2.7';
|
||||||
case 'sparc-sun-solaris': return 'SPARC Solaris';
|
case 'sparc-sun-solaris': return 'SPARC Solaris';
|
||||||
case 'powerpc64-unknown-linux-gnu': return 'Linux/PowerPC64';
|
case 'powerpc64-unknown-linux-gnu': return 'Linux/PowerPC64';
|
||||||
case 'windows_x86_64': return 'Windows/x86_64';
|
case 'windows_x86_64': return 'Windows/x64';
|
||||||
case 'powerpc64-ps3-linux-gnu': return 'Playstation3/Linux';
|
case 'powerpc64-ps3-linux-gnu': return 'Playstation3/Linux';
|
||||||
case 'x86_64-unknown-linux-gnu': return null;
|
case 'x86_64-unknown-linux-gnu': return null;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +39,7 @@ function friendly_name($p) {
|
||||||
return $p;
|
return $p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
function get_platforms($url) {
|
function get_platforms($url) {
|
||||||
$url .= '/get_project_config.php';
|
$url .= '/get_project_config.php';
|
||||||
$x = file_get_contents($url);
|
$x = file_get_contents($url);
|
||||||
|
@ -49,15 +51,21 @@ function get_platforms($url) {
|
||||||
while (1) {
|
while (1) {
|
||||||
$p = parse_next_element($x, $tag, $cursor);
|
$p = parse_next_element($x, $tag, $cursor);
|
||||||
if (!$p) break;
|
if (!$p) break;
|
||||||
$list[] = friendly_name($p);
|
$list[] = $p;
|
||||||
}
|
}
|
||||||
return array_unique($list);
|
return array_unique($list);
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_list($l) {
|
// convert an array of platform names into a comma-separated
|
||||||
|
// list of human-readable names
|
||||||
|
//
|
||||||
|
function make_friendly_string($l) {
|
||||||
|
if (!count($l)) return "Unknown";
|
||||||
$x = "";
|
$x = "";
|
||||||
$first = true;
|
$first = true;
|
||||||
foreach($l as $p) {
|
foreach($l as $p) {
|
||||||
|
$p = friendly_name($p);
|
||||||
|
if (!$p) continue;
|
||||||
if ($first) {
|
if ($first) {
|
||||||
$x .= "$p";
|
$x .= "$p";
|
||||||
$first = false;
|
$first = false;
|
||||||
|
@ -68,6 +76,8 @@ function show_list($l) {
|
||||||
return $x;
|
return $x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return platforms as an array of platform names
|
||||||
|
//
|
||||||
function get_platforms_cached($url) {
|
function get_platforms_cached($url) {
|
||||||
$u = urlencode($url);
|
$u = urlencode($url);
|
||||||
$fname = "/home/boincadm/boinc/doc/platforms/$u";
|
$fname = "/home/boincadm/boinc/doc/platforms/$u";
|
||||||
|
@ -87,13 +97,21 @@ function get_platforms_cached($url) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return show_list($l);
|
return $l;
|
||||||
}
|
}
|
||||||
//echo get_platforms_cached("http://www.malariacontrol.net/");
|
|
||||||
|
// return platforms as a human-readable string
|
||||||
|
//
|
||||||
|
function get_platforms_string($url) {
|
||||||
|
$l = get_platforms_cached($url);
|
||||||
|
return make_friendly_string($l);
|
||||||
|
}
|
||||||
|
|
||||||
|
//echo get_platforms_string("http://www.malariacontrol.net/");
|
||||||
|
|
||||||
function wfPlatforms() {
|
function wfPlatforms() {
|
||||||
global $wgParser;
|
global $wgParser;
|
||||||
$wgParser->setHook( "platforms", "get_platforms_cached" );
|
$wgParser->setHook( "platforms", "get_platforms_string" );
|
||||||
}
|
}
|
||||||
|
|
||||||
$wgExtensionFunctions[] = "wfPlatforms";
|
$wgExtensionFunctions[] = "wfPlatforms";
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
require_once("projects.inc");
|
require_once("projects.inc");
|
||||||
|
require_once("get_platforms.inc");
|
||||||
|
|
||||||
header('Content-type: text/xml');
|
header('Content-type: text/xml');
|
||||||
echo '<?xml version="1.0" encoding="ISO-8859-1" ?>
|
echo '<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||||
|
@ -38,6 +39,15 @@ foreach($proj_list as $p) {
|
||||||
<description>$p->description</description>
|
<description>$p->description</description>
|
||||||
<home>$p->home</home>
|
<home>$p->home</home>
|
||||||
";
|
";
|
||||||
|
$platforms = get_platforms_cached($p->url);
|
||||||
|
if ($platforms) {
|
||||||
|
echo " <platforms>\n";
|
||||||
|
foreach ($platforms as $p) {
|
||||||
|
if ($p == 'Unknown') continue;
|
||||||
|
echo " <name>$p</name>\n";
|
||||||
|
}
|
||||||
|
echo " </platforms>\n";
|
||||||
|
}
|
||||||
if ($p->image) {
|
if ($p->image) {
|
||||||
echo " <image>http://boinc.berkeley.edu/images/$p->image</image>
|
echo " <image>http://boinc.berkeley.edu/images/$p->image</image>
|
||||||
";
|
";
|
||||||
|
|
|
@ -56,7 +56,7 @@ foreach ($areas as $area) {
|
||||||
$desc = addslashes($p[4]);
|
$desc = addslashes($p[4]);
|
||||||
$x = "<a href=$p[1] onmouseover=\"return escape('$img <b>Home:</b> $p[2]<hr><b>Area:</b> $p[3]<hr><b>Goal:</b> $desc')\">$p[0]</a>";
|
$x = "<a href=$p[1] onmouseover=\"return escape('$img <b>Home:</b> $p[2]<hr><b>Area:</b> $p[3]<hr><b>Goal:</b> $desc')\">$p[0]</a>";
|
||||||
$y = $p[1];
|
$y = $p[1];
|
||||||
$p = get_platforms_cached($y);
|
$p = get_platforms_string($y);
|
||||||
echo "<tr class=row$n>
|
echo "<tr class=row$n>
|
||||||
<td valign=top>$x</td>
|
<td valign=top>$x</td>
|
||||||
<td valign=top>$y</td>
|
<td valign=top>$y</td>
|
||||||
|
|
Loading…
Reference in New Issue