First bunch of changes for #5712

git-svn-id: file:///svn/phpbb/trunk@6947 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Dominik Dröscher 2007-01-28 16:46:26 +00:00
parent 46bf79ec78
commit f0cc122948
3 changed files with 80 additions and 16 deletions

View file

@ -11,6 +11,26 @@
<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" /> <link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
<!--
function resize_panel()
{
var block = document.getElementById('codepanel');
var height;
if (window.innerHeight)
{
height = window.innerHeight - 150;
block.style.height = height + 'px';
}
else
{
//whatever IE needs to do this
}
}
-->
</script>
<style type="text/css"> <style type="text/css">
<!-- <!--
@ -22,13 +42,23 @@
width: 99%; width: 99%;
} }
<!-- IF not S_DIFF_NEW_FILE --> <!-- IF DIFF_MODE neq 'side_by_side' -->
div#codepanel {
overflow: auto;
width: 100%;
height: 350px;
}
<!-- ELSE -->
div#codepanel {
background-color: #eee;
}
<!-- ENDIF -->
<!-- IF not IS_DIFF_NEW_FILE -->
/** /**
* Unified Diff * Unified Diff
*/ */
.file { .file {
border: 1px solid #eee;
line-height: .7em; line-height: .7em;
} }
@ -69,8 +99,11 @@
* Column Diff * Column Diff
*/ */
table.hrdiff { table.hrdiff {
width: 99%;
margin: 0 0 8px 5px; margin: 0 0 8px 5px;
width: 100%;
overflow: hidden;
border-bottom: 1px solid #999;
table-layout: fixed;
} }
table.hrdiff th { table.hrdiff th {
@ -89,9 +122,30 @@ table.hrdiff thead th {
padding: 2px; padding: 2px;
} }
table.hrdiff tr:first-child th {
border-top: none;
}
table.hrdiff tbody th { table.hrdiff tbody th {
padding: 2em 1px 1px 1px; padding: 2em 1px 1px 1px;
font-size: 80%; font-size: 80%;
border-top: 1px solid #999;
}
table.hrdiff tbody td.old {
border-left: 1px solid #999;
border-right: 1px solid #999;
}
table.hrdiff tbody td.new {
border-right: 1px solid #999;
}
table.hrdiff td pre {
overflow: auto;
display: block;
width: 100%;
overflow: auto;
display: block;
} }
table.hrdiff .unmodified { table.hrdiff .unmodified {
@ -144,11 +198,17 @@ table.hrdiff caption span {
</head> </head>
<!-- IF DIFF_MODE neq 'side_by_side' -->
<body onresize="resize_panel();" onload="resize_panel();">
<!-- ELSE -->
<body> <body>
<!-- ENDIF -->
<div id="wrap"> <div id="wrap">
<div id="page-header"> <div id="page-header">
<!-- IF S_DIFF_NEW_FILE --> <!-- IF S_DIFF_NEW_FILE -->
<h1>{L_VIEWING_FILE_CONTENTS}</h1> <h1>{L_VIEWING_FILE_CONTENTS}</h1>
<!-- ELSE --> <!-- ELSE -->
<h1>{L_VIEWING_FILE_DIFF}</h1> <h1>{L_VIEWING_FILE_DIFF}</h1>
@ -158,16 +218,18 @@ table.hrdiff caption span {
<form method="post"> <form method="post">
<label for="diff_mode">{L_SELECT_DIFF_MODE}:</label> <label for="diff_mode">{L_SELECT_DIFF_MODE}:</label>
<select name="diff_mode" id="diff_mode">{S_DIFF_MODE_OPTIONS}</select> <select name="diff_mode" id="diff_mode">{S_DIFF_MODE_OPTIONS}</select>
<input class="button1" type="submit" id="submit" name="submit" value="{L_CHANGE}" /> <input class="button1" type="submit" id="submit" name="submit" value="{L_CHANGE}" />
</form> </form>
<!-- ENDIF --> <!-- ENDIF -->
</div> </div>
<div id="page-body"> <div id="page-body">
<div class="panel"> <div class="panel" id="codepanel">
<span class="corners-top"><span></span></span> <span class="corners-top"><span></span></span>
<div id="content"> <div id="content">
<div id="main"> <div id="main">
<!-- IF S_DIFF_CONFLICT_FILE --> <!-- IF S_DIFF_CONFLICT_FILE -->
<div style="float: right;"><strong>{L_NUM_CONFLICTS}: {NUM_CONFLICTS}</strong></div> <div style="float: right;"><strong>{L_NUM_CONFLICTS}: {NUM_CONFLICTS}</strong></div>
<!-- ENDIF --> <!-- ENDIF -->
@ -178,4 +240,5 @@ table.hrdiff caption span {
</div> </div>
</div> </div>
<!-- INCLUDE simple_footer.html --> <!-- INCLUDE simple_footer.html -->

View file

@ -298,17 +298,17 @@ class diff_renderer_unified extends diff_renderer
function _context($lines) function _context($lines)
{ {
return '<pre class="diff context">' . htmlspecialchars($this->_lines($lines, ' ')) . '</pre>'; return '<pre class="diff context">' . htmlspecialchars($this->_lines($lines, ' ')) . '<br /></pre>';
} }
function _added($lines) function _added($lines)
{ {
return '<pre class="diff added">' . htmlspecialchars($this->_lines($lines, '+')) . '</pre>'; return '<pre class="diff added">' . htmlspecialchars($this->_lines($lines, '+')) . '<br /></pre>';
} }
function _deleted($lines) function _deleted($lines)
{ {
return '<pre class="diff removed">' . htmlspecialchars($this->_lines($lines, '-')) . '</pre>'; return '<pre class="diff removed">' . htmlspecialchars($this->_lines($lines, '-')) . '<br /></pre>';
} }
function _changed($orig, $final) function _changed($orig, $final)
@ -365,7 +365,7 @@ class diff_renderer_inline extends diff_renderer
*/ */
function get_diff_content($diff) function get_diff_content($diff)
{ {
return '<pre>' . nl2br($this->render($diff)) . '</pre>'; return '<pre>' . nl2br($this->render($diff)) . '<br /></pre>';
} }
function _start_diff() function _start_diff()
@ -614,8 +614,8 @@ class diff_renderer_side_by_side extends diff_renderer
$line = $current_context; $line = $current_context;
$current_context = ''; $current_context = '';
$output .= '<tr class="unmodified"><td><pre>' . ((strlen($line)) ? $line : '&nbsp;') . '</pre></td> $output .= '<tr class="unmodified"><td><pre>' . ((strlen($line)) ? $line : '&nbsp;') . '<br /></pre></td>
<td><pre>' . ((strlen($line)) ? $line : '&nbsp;') . '</pre></td></tr>'; <td><pre>' . ((strlen($line)) ? $line : '&nbsp;') . '<br /></pre></td></tr>';
} }
switch ($change['type']) switch ($change['type'])
@ -628,7 +628,7 @@ class diff_renderer_side_by_side extends diff_renderer
$line .= htmlspecialchars($_line) . '<br />'; $line .= htmlspecialchars($_line) . '<br />';
} }
$output .= '<tr><td class="added_empty">&nbsp;</td><td class="added"><pre>' . ((strlen($line)) ? $line : '&nbsp;') . '</pre></td></tr>'; $output .= '<tr><td class="added_empty">&nbsp;</td><td class="added"><pre>' . ((strlen($line)) ? $line : '&nbsp;') . '<br /></pre></td></tr>';
break; break;
case 'remove': case 'remove':
@ -639,7 +639,7 @@ class diff_renderer_side_by_side extends diff_renderer
$line .= htmlspecialchars($_line) . '<br />'; $line .= htmlspecialchars($_line) . '<br />';
} }
$output .= '<tr><td class="removed"><pre>' . ((strlen($line)) ? $line : '&nbsp;') . '</pre></td><td class="removed_empty">&nbsp;</td></tr>'; $output .= '<tr><td class="removed"><pre>' . ((strlen($line)) ? $line : '&nbsp;') . '<br /></pre></td><td class="removed_empty">&nbsp;</td></tr>';
break; break;
case 'empty': case 'empty':
@ -664,7 +664,7 @@ class diff_renderer_side_by_side extends diff_renderer
if (!empty($left)) if (!empty($left))
{ {
$output .= '<td class="modified"><pre>' . $left . '</pre></td>'; $output .= '<td class="modified"><pre>' . $left . '<br /></pre></td>';
} }
else if ($row < $oldsize) else if ($row < $oldsize)
{ {
@ -677,7 +677,7 @@ class diff_renderer_side_by_side extends diff_renderer
if (!empty($right)) if (!empty($right))
{ {
$output .= '<td class="modified"><pre>' . $right . '</pre></td>'; $output .= '<td class="modified"><pre>' . $right . '<br /></pre></td>';
} }
else if ($row < $newsize) else if ($row < $newsize)
{ {
@ -698,8 +698,8 @@ class diff_renderer_side_by_side extends diff_renderer
$line = $current_context; $line = $current_context;
$current_context = ''; $current_context = '';
$output .= '<tr class="unmodified"><td><pre>' . ((strlen($line)) ? $line : '&nbsp;') . '</pre></td>'; $output .= '<tr class="unmodified"><td><pre>' . ((strlen($line)) ? $line : '&nbsp;') . '<br /></pre></td>';
$output .= '<td><pre>' . ((strlen($line)) ? $line : '&nbsp;') . '</pre></td></tr>'; $output .= '<td><pre>' . ((strlen($line)) ? $line : '&nbsp;') . '<br /></pre></td></tr>';
} }
} }
} }

View file

@ -897,6 +897,7 @@ class install_update extends module
$template->assign_vars(array( $template->assign_vars(array(
'DIFF_CONTENT' => $renderer->get_diff_content($diff), 'DIFF_CONTENT' => $renderer->get_diff_content($diff),
'DIFF_MODE' => $diff_mode,
'S_DIFF_MODE_OPTIONS' => $diff_mode_options, 'S_DIFF_MODE_OPTIONS' => $diff_mode_options,
'S_SHOW_DIFF' => true, 'S_SHOW_DIFF' => true,
)); ));