utilitees

- Addons for ExpressionEngine 1.6.x

Redline Documentation

Download Download

Prerequisites

In order to view entry-comparisons you need to enable Entry Versioning for the respective weblogs.

In order to view template-comparisons you need to enable Template Revisions in the Global Template Preferences.

Back to top

 

Installation

  1. Unzip the file.
  2. Upload the file ext.redline.php to the extensions-folder inside your EE system directory.
  3. Upload the folder redline and the contained files to the modules-folder inside your EE system directory.
  4. Upload the file lang.redline.php to the language/english-folder inside your EE system directory.
  5. In your Control Panel navigate to CP Home ›  Modules, find the Redline module and click Install. De-/Installing the module will also de-/activate the extension.
Back to top

 

Control Panel Display Settings

You can adjust several display options in the extension settings found under CP Home ›  Admin ›  Utilities ›  Extensions Manager ›  Redline ›  Settings.

Hide fields that have not changed
This affects version comparisons for weblog entries.
If this is set to “Yes” only fields are shown that actually have changed. If set to “No” all fields are shown.
Text-only comparison (ignore HTML)
This affects version comparisons for weblog entries.
If you are not interested in changes of the markup you may set this to “Yes”. That means any HTML in the current entry and the revision will be ignored when comparing them.
Width of popup window
This affects version comparisons for weblog entries.
You can set the width for the popup-window in which the comparison is shown.
Height of popup window
This affects version comparisons for weblog entries.
You can set the height for the popup-window in which the comparison is shown.
CSS style declarations for comparisons
This affects both version comparisons for weblog entries and templates.
Any output will be enclosed by <p class=“redline”></p>. Deletions inside will be marked with <del></del>, insertions with <ins></ins>.  You may change the CSS styles for the redline-class with this setting.
Check for Redline updates?
If you have installed the LG Addon Updater extension, you may set Redline to periodically check for new versions.

Back to top

 

View entry-comparisons in the Control Panel

If you open an entry and click the “Revisions” Tab you’ll find a new column added to the list of revisions.

When you click one of its links a new window will open in which the selected revision is compared to the current version of the entry.

By default additions are underlined, deletions are crossed out. There are several Display Settings to adjust the appearance to your needs.

Back to top

 

View template-comparisons in the Control Panel

If you open a template in the template editor and there are items in the Revision History you’ll find a new button next to the ‘View’-button.

When you select a revision and click the new button you will get a comparison of the selected revision with the template currently active.
Note: The topmost revision is always identical with the currently active template, so there are no differences to be expected if you compare them.

By default additions are underlined, deletions are crossed out. There are several Display Settings to adjust the appearance to your needs.

Back to top

 

Show entry-comparisons on the front-end

You can also display the comparison to the latest entry revision with a defined status on your website by using the Redline Entry Tag in your templates. Usually it will be nested inside a weblog:entries-tagpair to pass the entry ID of the corresponding entry.

Redline Entry Tag

{exp:weblog:entries}
  {exp
:redline:entry entry_id="{entry_id}"}
    {diff_title}
    {diff_body}
  {
/exp:redline:entry}
{
/exp:weblog:entries} 


Parameters

entry_id="93" 

Mandatory.
The ID of the entry for which the comparison should be shown. This will usually be passed using the {entry_id} variable from a surrounding {exp:weblog:entries}-tag.

status="open" 

Optional. Defaults to “open”.
You can specify a status to prevent pulling up non-published revisions.

class="foo" 

Optional.
The comparison-blocks (fields) will be surrounded by <p>-tags. You may assign a CSS-class to that by setting this parameter.
Then you can easily style the insertions / deletions to your heart’s content, e.g.

<style>
.foo ins { color: blue; }
.foo del { color: red; }
</style>

text_only="yes" 

Optional. Defaults to “no”.
If you set this parameter to “yes” any HTML in entries will be ignored when comapring with the revision. Use this if you are not interested in changes to the markup of an entry but only the content.



Single Variables

Essentially, you can use the {title}, {url_title} and any custom-field variables from your weblog entry each prefixed by “diff_”.

{diff_title} 

Will display the comparison result for the entry title.

{diff_url_title} 

Will display the comparison result for the entry url_title.

{diff_body} 

Will display the comparison result for a custom field named “body”.



Variable Pairs

These two variable pairs are in fact conditionals. One is triggered if a revision with a proper status exists for the entry. The other if there is no revision or none with the correct status.

{diff_results_true}{/diff_results_true} 

The text surrounded by these tags will be displayed if there is a revision that can be compared with the current entry.
This could for example contain a link to the template used to display the comparison or some javascript toggle-code if you hide/show the comparison on the same page as the normal entry.

{diff_results_false}{/diff_results_false} 

The text surrounded by these tags will be displayed if there is no revision that can be compared with the current entry.
You could use it to display a related message.


Usage Example:

Template: site/article

{exp:weblog:entries weblog="changelog" limit="1"}
  
<h1>{title}</h1>
  
{body}
  {extra}
    {exp
:redline:entry entry_id="{entry_id}" status="public"}
    {diff_results_true}
    
<p><a href="{title_permalink="site/diffs"}">Show changes since last revision</a></p>
    
{/diff_results_true}
    {diff_results_false}
    
<p>This article has not yet been revised.</p>
    
{/diff_results_false}
{
/exp:redline:entry}
{
/exp:weblog:entries} 


Template: site/diffs

{exp:weblog:entries}
  {exp
:redline:entry entry_id="{entry_id}" status="public" text-only="yes"}
    {diff_title}
    {diff_body}
    {diff_extra}
    
<p><a href="{title_permalink="site/article"}">Show current version</a></p>
  
{/exp:redline:entry}
{
/exp:weblog:entries} 
Back to top


Changelog

1.0.2

  • Proforma CP backend added to Redline Module so that Module Access Privileges can be granted to member groups

1.0.1

  • Bugfix: typo in a language-file reference
  • Bugfix: FieldFrame Matrix-fields caused a PHP-warning

1.0

  • Initial release
Back to top

Questions / bug reports

For general comments, brickbats & bouquets please use the form over here.
Name:

Email:

URL:


Remember my personal information
Notify me of follow-up comments?


Page 1 of 1 pages

User Talk

Ian Pitts:
2009-06-15 15:46

This looks great! I’d love to give this a try on my work’s site.