Changeset 878


Ignore:
Timestamp:
12/26/07 17:44:08 (4 years ago)
Author:
bogdanpasoi@…
Message:

Inline diff functionality.

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/controllers/textblock.php

    r877 r878  
    9191    log_assert_valid(textblock_validate($revto)); 
    9292 
    93     $diff_title = string_diff(array($revfrom['title'], $revto['title'])); 
    94     $diff_content = string_diff(array($revfrom['text'], $revto['text'])); 
     93    $diff_title = diff_inline(array($revfrom['title'], $revto['title'])); 
     94    $diff_content = diff_inline(array($revfrom['text'], $revto['text'])); 
    9595 
    9696    $view = array(); 
  • trunk/www/static/css/screen.css

    r877 r878  
    703703} 
    704704 
     705.diff del { 
     706    background-color: #EE9999; 
     707    text-decoration: none; 
     708} 
     709 
     710.diff ins { 
     711    background-color: #99EE99; 
     712    text-decoration: none; 
     713} 
     714 
    705715 
    706716/* Wiki text block */ 
  • trunk/www/views/textblock_diff.php

    r877 r878  
    1818            echo '<span class="'.$op['type'].'">'; 
    1919            foreach ($op['lines'] as $line) { 
    20                 echo str_replace('  ', '&nbsp;&nbsp;', htmlentities($line)); 
    21                 echo '<br/>'; 
     20                $output = ""; 
     21                if (!is_array($line)) { 
     22                    $output = htmlentities($line); 
     23                } else { 
     24                    // line contains inline diff 
     25                    foreach ($line as $chunk) { 
     26                        if ($chunk['type'] != 'normal') { 
     27                            $output .= '<'.$chunk['type'].'>'; 
     28                        } 
     29                        $output .= htmlentities($chunk['string']);  
     30                        if ($chunk['type'] != 'normal') { 
     31                            $output .= '</'.$chunk['type'].'>'; 
     32                        } 
     33                    } 
     34                } 
     35 
     36                // make sure we display whitespace correctly 
     37                $output = str_replace('  ', '&nbsp;&nbsp;', $output); 
     38                echo $output.'<br/>'; 
    2239            } 
    2340            echo '</span>'; 
Note: See TracChangeset for help on using the changeset viewer.