blob: 34ce384297ac6986b2db6cb8126d006c62c992d8 [file] [log] [blame]
<?php require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php"); require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menu.class.php"); $App = new App(); $Nav = new Nav(); $Menu = new Menu(); include($App->getProjectCommon()); # All on the same line to unclutter the user's desktop'
/* 221934 - this page to remain on eclipse.org */
header("Cache-control: no-cache");
require_once("common/shared_functions.php");
$theme = '';
$pageTitle = "IP Log for ";
$pageKeywords = '';
$pageAuthor = '';
# Initiate session
$Session = $App->useSession("optional");
$Friend = $Session->getFriend();
$Nav->setLinkList(array()); // empty Nav
if( $Session->getBugzillaID() == 0 ) {
$Nav->addCustomNav("login", "http://dev.eclipse.org/site_login/", "", 1);
} else {
$Nav->addCustomNav("welcome<br>" . $Friend->getFirstName() . ' ' . $Friend->getLastName(),
"http://dev.eclipse.org/site_login/", "", 1);
}
preg_match('/^([a-z.0-9\-_,]+)$/', $_REQUEST['projectid'], $matches);
if(!isset($matches[1])) {
nice_die('You must specify a projectid parameter. This is not a standalone script.');
}
$pageTitle .= $matches[1];
$projectids = explode( ',', $matches[1] );
require_once("common/ip_log_common.php");
$fresult = get_ip_log_data_structures( $projectids );
$errors = $fresult[0];
$activecqs = $fresult[1];
$unusedcqs = $fresult[2];
$pendingcqs = $fresult[3];
$prereqcqs = $fresult[4];
$committers_at_least_once = $fresult[5];
$committers_never = $fresult[6];
$committers_excluded = $fresult[7];
$contributors = $fresult[8];
$contributors_excluded = $fresult[9];
/*
* Determine if an edit form should be shown:
* only one project is selected
* and person is logged in
* and person is a committer on that project
*/
check_if_show_edit_form( $projectids, $Session, $Friend, true,
$show_edit_form, $reason_no_edit_form, $logged_in_email_address );
/*MOREMORE temporarily given Bjorn write access to all IP logs
if( $Friend->getFriendID() == 66 ) {
$show_edit_form = 1;
$logged_in_email_address = 'bjorn.freeman-benson@eclipse.org';
}
MOREMORE*/
$generate_final = 0;
if( isset($_GET['generatefinal']) && $_GET['generatefinal'] ) {
$show_edit_form = 0;
$generate_final = 1;
$reason_no_edit_form = '';
}
ob_start();
/*=================================================
* S A V E A N D U P D A T E D B
*/
if( $show_edit_form && isset($_POST['submit']) ) {
$removes = array();
$inserts = array();
/*----------- COMMITTERS --------------*/
$all = array_merge(
array_keys($committers_at_least_once),
array_keys($committers_never),
array_keys($committers_excluded) );
$removes[] = "ItemType = 'COMMITTR' AND Action = 'COMENT' AND ProjectID = '" . $projectids[0] . "'";
foreach( $all as $key ) {
if( isset($_POST['CM_' . $key . '_REMOVE']) ) {
$removes[] = "ItemType = 'COMMITTR' AND ItemID = '$key' AND ProjectID = '" . $projectids[0] . "'";
$inserts[] = "'COMMITTR', '$key', 'REMOVE', NULL, NULL, '" . $projectids[0] . "'";
} else if( isset($_POST['CM_' . $key . '_ACTIVE']) ) {
$removes[] = "ItemType = 'COMMITTR' AND ItemID = '$key' AND ProjectID = '" . $projectids[0] . "'";
$inserts[] = "'COMMITTR', '$key', 'ACTIVE', NULL, NULL, '" . $projectids[0] . "'";
} else if( isset($_POST['CM_' . $key . '_DELIST']) ) {
$removes[] = "ItemType = 'COMMITTR' AND ItemID = '$key' AND ProjectID = '" . $projectids[0] . "'";
} else if( isset($_POST['CM_' . $key . '_COMENT']) ) {
if( $_POST['CM_' . $key . '_COMENT'] ) {
$inserts[] = "'COMMITTR', '$key', 'COMENT', NULL, '" .
addslashes($_POST['CM_' . $key . '_COMENT'])
. "', '" . $projectids[0] . "'";
}
}
}
/*----------- CONTRIBUTIONS --------------*/
foreach( $contributors as $email => $each ) {
$x = strtr( $email, '.@', '__' );
if( isset($_POST['CN_' . $x . '_RMPERS']) ) {
/* removing a person removes all their contributions */
foreach( $each['bugs'] as $bug ) {
$inserts[] = "'CONTRIB', '" . $bug['attach_id'] . "', 'RM" . $bug['type'] . "', NULL, NULL, '" . $projectids[0] . "'";
}
} else {
foreach( $each['bugs'] as $bug ) {
if( isset($_POST['CN_' . $bug['attach_id'] . '_' . $bug['type'] . '_RM']) ) {
$inserts[] = "'CONTRIB', '" . $bug['attach_id'] . "', 'RM" . $bug['type'] . "', NULL, NULL, '" . $projectids[0] . "'";
}
}
}
}
foreach( $contributors_excluded as $email => $each ) {
foreach( $each['bugs'] as $bug ) {
if( isset($_POST['CN_' . $bug['attach_id'] . '_' . $bug['type'] . '_DL']) ) {
$removes[] = "ItemType = 'CONTRIB'
AND ItemID = '" . $bug['attach_id'] . "'
AND Action = 'RM" . $bug['type'] . "'
AND ProjectID = '" . $projectids[0] . "'";
}
}
}
/*----------- S Q L --------------*/
if( count($removes) > 0 ) {
$sql = "DELETE FROM `IPLogCorrections` WHERE ("
. implode( ")
OR (", $removes )
. ")";
/* echo "<pre>$sql</pre>"; */
foundation_sql( $sql );
}
if( count($inserts) > 0 ) {
$sql = "INSERT INTO `IPLogCorrections` ( ItemType, ItemID, Action, Value, Comment, ProjectID )
VALUES (" . implode( "),
(", $inserts ) . ")";
/* echo "<pre>$sql</pre>"; */
foundation_sql( $sql );
}
// header( "Location: http://www.eclipse.org/projects/ip_log_alt.php?projectid=" . implode(',',$projectids) );
// exit();
$fresult = get_ip_log_data_structures( $projectids );
$errors = $fresult[0];
$activecqs = $fresult[1];
$unusedcqs = $fresult[2];
$pendingcqs = $fresult[3];
$prereqcqs = $fresult[4];
$committers_at_least_once = $fresult[5];
$committers_never = $fresult[6];
$committers_excluded = $fresult[7];
$contributors = $fresult[8];
$contributors_excluded = $fresult[9];
}
/*=================================================
* H E A D E R
*/
?>
<?php if( $show_edit_form ) {
?><form method="POST">
<?php
}
?>
<div id="maincontent">
<div id="midcolumn">
<h1><?= $generate_final ? '' : 'Tentative ' ?>IP Log for <?php
$x = array_merge( $projectids, array() );
if( count($x) > 1 ) {
$y = array_pop($x);
$z = array_pop($x);
$x[] = "$z and $y";
}
echo implode( ', ', $x )
?></h1>
<?php if( !$generate_final ) { ?>
<div style="color: gray">
This tentative IP Log is generated dynamically from automatically collected project information.
This information has not been vetted for accuracy by the Eclipse Foundation and may not represent
the true state of the IP of this project(s). Please refer to the official approved IP Log(s) associated with
the official release(s) of this project(s) for more information.
</div>
<?php
}
if( count($errors) > 0 ) {
foreach( $errors as $errormsg ) {
?><span style="color: red; font-weight: bold"><em><?= $errormsg ?></em></span><br>
<?php
}
}
/*=================================================
* C Q S
*/
function html_for_keywords( $row ) {
return ($row['keyword_modified'] ? 'modified ' : '') .
($row['keyword_unmodified'] ? 'unmodified ' : '') .
($row['keyword_source'] ? 'source ' : '') .
($row['keyword_binary'] ? 'binary ' : '') .
($row['keyword_sourceandbinary'] ? 'source&nbsp;&amp;&nbsp;binary' : '');
}
?><h2>Third-Party Code</h2>
<?php
if( $show_edit_form ) {
?><div style="margin-bottom: 10px">
Corrections to the third-party code tables are made by adding or removing keywords
to the CQs themselves. See <a href="http://wiki.eclipse.org/Development_Resources/Automatic_IP_Log#Third-Party_Code">the
how to instructions</a> for more information
about which keywords correspond to which tables. Send email to
<a href="mailto:emo-ip-team@eclipse.org">the Eclipse Legal team</a> to request changes
to the keywords.
</div>
<?php
}
?>
<table border="1" cellpadding="3" cellspacing="0">
<tr>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">CQ</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Third-Party Code</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">License</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Use</th>
</tr>
<?php
foreach( $activecqs as $row ) {
?><tr>
<td><a href="https://dev.eclipse.org/ipzilla/show_bug.cgi?id=<?= $row['bug_id'] ?>"><?= $row['bug_id'] ?></a></td>
<td><?= $row['short_desc'] ?></td>
<td><?= $row['cf_license'] ?></td>
<td><?= html_for_keywords($row) ?></td>
</tr>
<?php
}
if( count($activecqs) == 0 ) {
?><tr><td colspan="3" align="center""><em>(no third-party dependencies)</em></td></tr>
<?php } ?>
</table>
<p>
<?php
if( count($prereqcqs) > 0 ) {
?>
<h2>Pre-Req Dependencies</h2>
<table border="1" cellpadding="3" cellspacing="0">
<tr>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">CQ</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Third-Party Code</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">License</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Dependencies</th>
</tr>
<?php
foreach( $prereqcqs as $row ) {
?><tr>
<td><a href="https://dev.eclipse.org/ipzilla/show_bug.cgi?id=<?= $row['bug_id'] ?>"><?= $row['bug_id'] ?></a></td>
<td><?= $row['short_desc'] ?></td>
<td><?= $row['cf_license'] ?></td>
<td><?php
switch( $row['bug_severity'] ) {
case 'exempt_prereq': echo "exempt pre-req"; break;
case 'workswith': echo "works with"; break;
case 'prereq': echo "pre-req"; break;
}
?></td>
</tr>
<?php
}
?>
</table>
<p>
<?php
} else {
?><p><em>No pre-req dependencies</em></p>
<?php
}
if( count($unusedcqs) > 0 ) {
?>
<h2>Unused Approved Contributions</h2>
<table border="1" cellpadding="3" cellspacing="0">
<tr>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">CQ</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Third-Party Code</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">License</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Status</th>
</tr>
<?php
foreach( $unusedcqs as $row ) {
?><tr>
<td><a href="https://dev.eclipse.org/ipzilla/show_bug.cgi?id=<?= $row['bug_id'] ?>"><?= $row['bug_id'] ?></a></td>
<td><?= $row['short_desc'] ?></td>
<td><?= $row['cf_license'] ?></td>
<td><?php
if( $row['keyword_obsolete'] )
echo "obsolete: was used in the past but is not longer used";
if( $row['keyword_unused'] )
echo "unused: not currently in use, but may be used in a future release";
if( $row['keyword_withdrawn'] )
echo "withdrawn: never used and never will be used";
?></td>
</tr>
<?php
}
?>
</table>
<p>
<?php
}
if( count($pendingcqs) > 0 ) {
?>
<h2>Pending Contribution Questionnaires</h2>
<table border="1" cellpadding="3" cellspacing="0">
<tr>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">CQ</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Third-Party Code</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">License</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Use</th>
</tr>
<?php
foreach( $pendingcqs as $row ) {
?><tr>
<td><a href="https://dev.eclipse.org/ipzilla/show_bug.cgi?id=<?= $row['bug_id'] ?>"><?= $row['bug_id'] ?></a></td>
<td><?= $row['short_desc'] ?></td>
<td><?= $row['cf_license'] ?></td>
<td><?= html_for_keywords($row) ?></td>
</tr>
<?php
}
?>
</table>
<?php
}
/*=================================================
* C O M M I T T E R S
*/
function output_committer_table_start( $title, $explanation ) {
global $show_edit_form;
if( $show_edit_form && $explanation ) {
?><div style="margin-bottom: 10px"><?php echo $explanation ?></div>
<?php
}
?>
<table border="1" cellpadding="3" cellspacing="0">
<tr><th colspan="<?= $show_edit_form ? 4 : 3 ?>" bordercolor="#7A79A7" bgcolor="#7A79A7"><?= $title ?></th></tr>
<tr><th bordercolor="#7A79A7" bgcolor="#7A79A7">Name</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Organization</th>
<?php if( $show_edit_form ) { ?>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Correction</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Comment</th>
<?php } else { ?>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">&nbsp;</th>
<?php } ?>
</tr>
<?php
}
?><h2>Committers</h2>
<?php output_committer_table_start( "Past and Present Active",
"This table lists everyone who is, or ever has been, a committer.
The only reasons to remove someone from this list are (i) if they never
were a committer, (ii) it is a bogus listing such as 'root', or (iii) all
the code that person wrote is now obsolete and no longer being shipped.
This list must include everyone who committed any code or other files are
being distributed in the current release." ); ?>
<?php
foreach( $committers_at_least_once as $key => $row ) {
?><tr>
<td><?= $row['FName'] . ' ' . $row['LName'] ?></td>
<td><?= $row['Name1'] . ' ' . $row['Name2'] ?></td>
<?php if( $show_edit_form ) { ?>
<td><input type="checkbox" name="CM_<?= $key ?>_REMOVE" value="R"> exclude</td>
<td><input type="text" name="CM_<?= $key ?>_COMENT" value="<?= $row['Comment'] ?>"></td>
<?php } else { ?>
<td><?= $row['Comment'] ?></td>
<?php } ?>
</tr>
<?php
}
if( count($committers_at_least_once) == 0 ) {
?><tr><td colspan="2" align="center" style="color: red; font-weight: bold"><em>(Error: no committers)</em></td></tr>
<?php } ?>
</table>
<p>
<?php if( count($committers_never) > 0 ) {
output_committer_table_start( "Never Active",
"This table lists committers who do not appear to have committed any code or
files to the project. This is a 'best-guess' table based on the commits explorer
data. If someone listed here actually has committed code, please correct the
table by making them active." );
foreach( $committers_never as $key => $row ) {
?><tr>
<td><?= $row['FName'] . ' ' . $row['LName'] ?></td>
<td><?= $row['Name1'] . ' ' . $row['Name2'] ?></td>
<?php if( $show_edit_form ) { ?>
<td><input type="checkbox" name="CM_<?= $key ?>_ACTIVE" value="A"> make active<br>
<input type="checkbox" name="CM_<?= $key ?>_REMOVE" value="R"> exclude</td>
<td><input type="text" name="CM_<?= $key ?>_COMENT" value="<?= $row['Comment'] ?>"></td>
<?php } else { ?>
<td><?= $row['Comment'] ?></td>
<?php } ?>
</tr>
<?php
}
?>
</table>
<p>
<?php
}
if( $show_edit_form && count($committers_excluded) > 0 ) {
output_committer_table_start( "Corrections (Excluded)",
"This table lists all the corrections. This table is not
included in the final frozen ip log." );
foreach( $committers_excluded as $key => $row ) {
?><tr>
<td><?= $row['FName'] . ' ' . $row['LName'] ?></td>
<td><?= $row['Name1'] . ' ' . $row['Name2'] ?></td>
<?php if( $show_edit_form ) { ?>
<td><input type="checkbox" name="CM_<?= $key ?>_DELIST" value="D"> incorrectly excluded</td>
<td><input type="text" name="CM_<?= $key ?>_COMENT" value="<?= $row['Comment'] ?>"></td>
<?php } else { ?>
<td><?= $row['Comment'] ?></td>
<?php } ?>
</tr>
<?php
}
?>
</table>
<p>
<?php
}
/*=================================================
* C O N T R I B U T O R S
*/
?><h2>Contributors and Their Contributions</h2>
<?php
if( $show_edit_form ) {
?><div style="margin-bottom: 10px">
This table lists, by contributor and then by bug #, all the non-committer contributions.
This section is probably the weakest of the automated data gathering because there are
so many bugs and so many different ways that people have noted contributions over time.<p>
To note a contribution:
<ul>
<li>Include the contribution as a patch on a bug and add the "iplog+" flag to that attachment.
<li>Include the contribution as a comment on a bug and add the "iplog+" flag to the bug. (Note that this
will add all the commenters of the bug as contributors and then you'll have to 'exclude' all those
who did not contribute. Better to use patch attachments if possible.)
</ul>
<p>
Note that this table includes all contributions that are being distributed in the code.
The reasons to correct/remove entries from this table are:<ul>
<li>The algorithm incorrectly classified something as a contribution when it really wasn't
a contribution.
<li>The contribution isn't/wasn't used at all. Note that if just one line of a file is used,
then the contribution is considered as having been used. If possible, mark the
attachment as obsolete in bugzilla; otherwise, use the corrections to make the change.
</ul>
Please note that if person X was a contributor and later became a committer, he or she will
be listed both above in the committer table (for his/her work as a committer)
and here in the contributor table (for his/her work prior to becoming a committer).
</div>
<?php
}
?>
<table border="1" cellpadding="3" cellspacing="0">
<tr>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Bug</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Size</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Description</th>
<?php if( $show_edit_form ) { ?>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Correction</th>
<?php } ?>
</tr>
<?php
foreach( $contributors as $email => $each ) {
$name = preg_replace( "/\s+/", "&nbsp;", $each['realname'] );
if( strlen(trim($name)) == 0 ) {
$name = $email;
} else {
$name .= " (" . substr( strstr( $email, '@' ), 1 ) . ")";
}
?><tr><td colspan="3" style="background-color: #DDDDDD"><?= $name ?></td>
<? if( $show_edit_form ) { ?>
<td style="background-color: #DDDDDD"><input type="checkbox" name="CN_<?=
strtr( $email, '.@', '__' )
?>_RMPERS" value="1">&nbsp;exclude&nbsp;all</td>
<? } ?>
</tr>
<?php
foreach( $each['bugs'] as $bug ) {
?><tr>
<td><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=<?= $bug['bug_id'] ?>"><?= $bug['bug_id'] ?></a></td>
<td><?= pretty_size($bug['size']) ?></td>
<td><?= $bug['bug_desc'] ?><br><?= $bug['attach_desc'] ?></td>
<? if( $show_edit_form ) { ?>
<td><input type="checkbox" name="CN_<?= $bug['attach_id'] ?>_<?= $bug['type'] ?>_RM" value="1"> exclude</td>
<? } ?>
</tr>
<?php
}
}
if( count($contributors) == 0 ) {
?><tr><td colspan="3" align="center""><em>(no contributors)</em></td></tr>
<?php } ?>
</table>
<?php
if( $show_edit_form && count($contributors_excluded) > 0 ) {
?><p>
<div style="margin-bottom: 10px">
This table lists all the corrections. This table is not
included in the final frozen ip log.</div>
<table border="1" cellpadding="3" cellspacing="0">
<tr>
<th bordercolor="#7A79A7" bgcolor="#7A79A7" colspan="4">Corrections (Excluded)</th>
</tr>
<tr>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Bug</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Size</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Description</th>
<th bordercolor="#7A79A7" bgcolor="#7A79A7">Correction</th>
</tr>
<?php
foreach( $contributors_excluded as $email => $each ) {
$name = preg_replace( "/\s+/", "&nbsp;", $each['realname'] );
if( strlen(trim($name)) == 0 ) {
$name = $email;
} else {
$name .= " (" . substr( strstr( $email, '@' ), 1 ) . ")";
}
?><tr><td colspan="4" style="background-color: #DDDDDD"><?= $name ?></td></tr>
<?php
foreach( $each['bugs'] as $bug ) {
?><tr>
<td><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=<?= $bug['bug_id'] ?>"><?= $bug['bug_id'] ?></a></td>
<td><?= pretty_size($bug['size']) ?></td>
<td><?= $bug['bug_desc'] ?><br><?= $bug['attach_desc'] ?></td>
<td><input type="checkbox" name="CN_<?= $bug['attach_id'] ?>_<?= $bug['type'] ?>_DL" value="1">incorrectly excluded</td>
</tr>
<?php
}
}
?></table>
<?php
}
/*=================================================
* F O O T E R
*/
?>
<p>
</div><!-- midcolumn -->
</div><!-- maincontent -->
<?php if( !$generate_final ) { ?>
<div style="clear: both; margin-left: -150px;" id="actionfooter">
<table width="100%" align="center" valign="top" >
<tr><td align="left" width="22%" style="border-right: thin solid gray; padding-right: 5px">
<input type="button" name="submitlog"
style="background-color: #EEEEFF"
value="Adjust"
onclick="document.location='ip_log_selector.php?projectid=<?= implode( ',', $projectids ) ?>'"
>
the set of projects to
match the upcoming release
</td>
<td align="center" valign="top" width="22%" style="border-right: thin solid gray; padding-right: 5px; padding-left: 5px">
<?php
if( !$show_edit_form ) {
echo $reason_no_edit_form;
} else {
?><input type="submit" name="submit" value="Make These Corrections">
and return to this page for further review
<?php
}
?>
</td>
<td align="center" valign="top" width="22%" style="border-right: thin solid gray; padding-right: 5px; padding-left: 5px">
<?php
if( !$show_edit_form ) {
?>&nbsp;<?php
} else {
?>after
verifying (and correcting) this ip log,
<input type="button" name="submitlog"
style="background-color: #FFFFCC"
value="Submit The Log"
onclick="document.location='ip_log_submit_to_legal.php?projectid=<?= implode(',', $projectids) ?>'"
>
to Eclipse Legal for approval. <font color="gray">(Do so at least three weeks
in advance of your review date or be at risk
of postponing the review.)</font>
<?php
}
?>
</td>
<td align="right" valign="top" width="22%" style="padding-left: 5px">
<a href="http://wiki.eclipse.org/Development_Resources/Automatic_IP_Log"
>help &amp; documentation: learn how this IP log is generated
and how to correct errors</a>
</td>
</tr></table></div><!-- actionfooter -->
<?php if( $show_edit_form ) {
?></form>
<?php
}
}
?>
<?php
# Paste your HTML content between the EOHTML markers!
$html = ob_get_contents();
ob_end_clean();
# Generate the web page
$App->generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html);
?>