<?php if (!defined('PmWiki')) exit();
/*  Copyright 2004 Patrick R. Michaud (pmichaud@pobox.com)
 
    You can redistribute this file and/or modify
    it under the terms of the GNU General Public License as published
    by the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.  

    This file enables the "Change Summary" feature for PmWiki, which
    allows authors to add a one-line summary of any editing changes.
    Simply copy this file into the 'cookbook/' subdirectory or some other
    suitable place and then do

        include_once('cookbook/changesum.php');
        
    This script works only with pmwiki2!
    Version: changesum 2.2
    Contributor: Laurent Meister (kt007) (meister at apfelwiki dot de)
		 Java Junky  ciaranj at gmail.com

*/
## Set the ChangeSummary variable if it exists.
$ChangeSummary = @$_REQUEST['csum'];
$_POST["csum:$Now"] = $ChangeSummary;
$EditFields[] = "csum:$Now";

## Change the edit form to include the change summary field
$PageEditFmt=array("
  <div id='wikiedit'>
  <a id='top' name='top'></a><h1 class='wikiaction'>$[Editing \$FullName]</h1>
  <form id='editform' name='editform' action='\$PageUrl' method='post'>
  <input type='hidden' name='pagename' value='\$FullName' />
  <input type='hidden' name='action' value='edit' />
  <input type='hidden' name='basetime' value='\$EditBaseTime' />
  \$EditMessageFmt
  <textarea id='text' name='text' rows='25' cols='90'
    onkeydown='if (event.keyCode == 27) event.returnValue=false;'
    >\$EditText</textarea><br />
  $[Summary]: <input type='text' name='csum' value='\$ChangeSummary' size='60' /><br />
  $[Author]: <input type='text' name='author' value='\$Author' />
  <input type='checkbox' name='diffclass' value='minor' \$DiffClassMinor />
    $[This is a minor edit]<br />
  <input type='submit' name='post' value=' $[Save] ' />
  <input type='submit' name='preview' value=' $[Preview] ' />
  <input type='reset' value=' $[Reset] ' />
  </form></div>");

## Add the change summary text to the RecentChanges entry
$RecentChangesFmt = array(
  'Main.AllRecentChanges' => 
    '* [[$Group.$Name]]  . . . $CurrentTime by $AuthorLink - \'\' $ChangeSummary \'\'',
  '$Group.RecentChanges' =>
    '* [[$Group/$Name]]  . . . $CurrentTime by $AuthorLink - [=$ChangeSummary=] ' );

 ## Change the diff output to include the change summary line
  SDV($DiffStartFmt,"
      <div class='diffbox'><div class='difftime'>\$DiffTime 
        \$[by] <span class='diffauthor'>\$DiffAuthor</span> --<span> \$DiffChangeSum </span></div>"); 


?>