From 7216538165621816dc3f751adc0746bf66805421 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 31 Jan 2011 14:00:32 +0100 Subject: Make diff type selectable --- inc/html.php | 46 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index b962c6075..7abb05d2e 100644 --- a/inc/html.php +++ b/inc/html.php @@ -870,13 +870,18 @@ function html_backlinks(){ * show diff * * @author Andreas Gohr + * @param string $text - compare with this text with most current version + * @param bool $intr - display the intro text */ -function html_diff($text='',$intro=true){ +function html_diff($text='',$intro=true,$type=null){ global $ID; global $REV; global $lang; global $conf; + if(!$type) $type = $_REQUEST['difftype']; + if($type != 'inline') $type = 'sidebyside'; + // we're trying to be clever here, revisions to compare can be either // given as rev and rev2 parameters, with rev2 being optional. Or in an // array in rev2. @@ -993,17 +998,48 @@ function html_diff($text='',$intro=true){ $df = new Diff(explode("\n",htmlspecialchars($l_text)), explode("\n",htmlspecialchars($r_text))); - $tdf = new TableDiffFormatter(); + if($type == 'inline'){ + $tdf = new InlineDiffFormatter(); + } else { + $tdf = new TableDiffFormatter(); + } + + + if($intro) print p_locale_xhtml('diff'); if (!$text) { - $diffurl = wl($ID, array('do'=>'diff', 'rev2[0]'=>$l_rev, 'rev2[1]'=>$r_rev)); ptln(''); } ?> - +
> -- cgit v1.2.3