blob: 40fc7a1b86d0935935727a81877c8d1e14f42bed [file] [log] [blame]
<?php
/*******************************************************************************
* Copyright (c) 2010 Eclipse Foundation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wayne Beaton (Eclipse Foundation)- initial API and implementation
*******************************************************************************/
/*
* This script returns--in XML format--information about reviews.
*
* The following parameters can be used:
*
* date
* Include only information about reviews occurring on this date. This
* parameter is optional; if it is specified, it overrides the value of
* the 'start' parameter.
*
* start
* The start date; information for all reviews from this date forward are
* included in the results. The 'date' parameter overrides this value. If
* neither the 'date' nor the 'start' field are specified, the script
* will report on those reviews that occur from the future date forward.
*
* name
* Name of the review. The text provided is used to attempt a partial match
* on the name of the review. More specifically, the name is used in an SQL
* "like" statement.
*
* test
* Include this parameter if you want to include some test data in the output;
* handy if you're testing locally and just want to have some data to play with.
*
* Example:
* http://www.eclipse.org/projects/xml/review_status.php?name=Helios
*
* returns something along the lines of:
*
* <review-status start-date="2010-05-26" review-name="Helios">
* <review name="Helios Release" projectid="soa.jwt" iplog="" posted="" slides=""/>
* <review name="Helios Graduation/Release" projectid="dsdp.sequoyah" iplog="" posted="" slides=""/>
* </review-status>
*
* Note that only review entries that have a date explicitly set will be included in
* the response. This information is all set in the Foundation Portal.
*/
header("Content-type: text/xml");
header("Content-Disposition: inline; filename=reviews.xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php");
if (!isset($App)) $App = new App();
$reviewDate = $App->getHttpParameter('date');
if ($reviewDate) {
$reviewDate = strtotime($reviewDate);
$reviewDate = date('Y-m-d', $reviewDate);
}
$startDate = $App->getHttpParameter('start');
if (!$startDate) $startDate = strtotime('now');
$startDate = date('Y-m-d', $startDate);
$reviewName = $App->getHttpParameter('name');
$reviewName = $App->sqlSanitize($reviewName);
$testing = $App->getHttpParameter('test');
$sql = "SELECT distinct
r.ProjectName, r.ProjectId,
r.ReviewName, r.SlidesURL, r.IPLogURL,
iplog.value as IPLogDate,
docuware.value as DocuwareDate
FROM
ProjectReviews as r
left join ProjectReviewStatus as iplog on (r.id = iplog.id and iplog.Status = 'Legal Review Requested')
left join ProjectReviewStatus as docuware on (r.id = docuware.id and docuware.Status = 'Slides Posted')
WHERE 1=1";
$summary = '';
//if ($reviewDate) {
// $sql .= " and ReviewDate = '$reviewDate'";
// $summary .= " review-date=\"$reviewDate\"";
//} else {
// $sql .= " and ReviewDate > '$startDate'";
// $summary .= " start-date=\"$startDate\"";
//}
if ($reviewName) {
$sql .= " and reviewName like '%$reviewName%'";
$summary .= " review-name=\"$reviewName\"";
} else {
$sql .= " and reviewName is not null";
}
echo "<!-- \n$sql\n-->";
$result = $App->foundation_sql($sql);
echo "<review-status $summary>";
if ($test)
echo "<review name=\"Bogus\" projectid=\"technology.bogus\" iplog=\"http://www.place.com\" posted=\"2010-10-10\" slides=\"http://slides.url.com\"/>";
while ($row = mysql_fetch_assoc($result)) {
$id = $row['ProjectId'];
$iplog_url = $row['IPLogURL'];
$iplog_date = $row['IPLogDate'];
$docuware_url = $row['SlidesURL'];
$docuware_date = $row['DocuwareDate'];
$review_name = $row['ReviewName'];
echo "<review name=\"$review_name\" projectid=\"$id\" iplog=\"$iplog_url\" iplog-date=\"$iplog_date\" docuware=\"$docuware_url\" docuware-date=\"$docuware_date\"/>";
}
echo "</review-status>";
?>