Newer
Older
Import / svn / viewvc-1.1-dev / tabbed-template / revision_simple.ezt
<?php

# -- Modifications by Alex Balashov -- #

$f_val = string_custom_field_value($t_def, $t_id, $f_bug_id);

if($t_def['name'] == 'SVN Revision' && !empty($f_val)) {

	$ch = curl_init('http://svn.invertedlogic.com/index.cgi/svn?view=rev&simple=1&revision='.$f_val);

	curl_setopt($ch, CURLOPT_HEADER, FALSE);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
	curl_setopt($ch, CURL_NOBODY, FALSE);

	$rev_response = curl_exec($ch);

	curl_close($ch);

	if(preg_match('/S+/', $rev_response))
		echo "\n<br><br>\n";

	foreach(preg_split('/s+/', $rev_response) as $f_ch) {
		if(preg_match('/^S+$/', $f_ch)) {
			$base_f_stem = 'http://svn.invertedlogic.com/index.cgi/' . $f_ch;

			$curr_file = $base_f_stem .  '?view=markup&root=svn&revision=' . $f_val;
			$curr_log = $base_f_stem .  '?view=log&root=svn&revision=' . $f_val;
			$curr_diff = $base_f_stem .  '?root=your_svpn_repository&r1='.$f_val.'&r2='.
							((int) $f_val - 1) .  '&pathrev=' .
							$f_val;
			$curr_patch = $base_f_stem .  '?view=patch&root=svn&r1='.$f_val.'&r2=' .
							((int) $f_val - 1) .  '&pathrev=' .
							$f_val;

			echo '<table border="0" width="80%%" align="left" cellspacing=0 cellpadding=0>';

			echo "  <tr>\n" .
			 "     <td width=\"55%\" valign=\"top\">" .
			 "       <strong>" .
			 "         <a href=\"$curr_file\">$f_ch</a>" .
			 "       </strong>\n" .
			 "     </td>\n" .
			 "     <td width=\"15%\" valign=\"top\">\n" .
			       "[ <a href=\"$curr_diff\">Diff</a> ]" .
			 "     </td>\n" .
			 "     <td width=\"15%\" valign=\"top\">\n" .
			       "[ <a href=\"$curr_log\">Log</a> ] " .
			 "     </td>n" .
			 "     <td width=\"15%\" valign=\"top\">\n" .
			       "[ <a href=\"$curr_patch\">Patch</a> ]" .
			 "     </td>\n" .
			 "  </tr>\n";

			echo "</table>\n";
		}

	}
}

# -- End modifications by Alex Balashov -- # 

?>