diff options
author | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2024-03-24 07:04:21 +0000 |
---|---|---|
committer | petko <petko@524c5546-5005-0410-9a3e-e25e191bd360> | 2024-03-24 07:04:21 +0000 |
commit | f795952190894d9ddef82d54837b23318d7dc86c (patch) | |
tree | e19b8503aa29c7e52151e1daa6dab25dc1661a22 /scripts | |
parent | f8ac6c7a4c5adc4c167cb9db8483dca49ae8bc9f (diff) | |
download | pmwiki.svn-f795952190894d9ddef82d54837b23318d7dc86c.tar.bz2 |
$EnablePreviewChanges to show "No changes" if there are no changes.
git-svn-id: svn://pmwiki.org/pmwiki/trunk@4679 524c5546-5005-0410-9a3e-e25e191bd360
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/pagerev.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/pagerev.php b/scripts/pagerev.php index b2e00909..767628b1 100644 --- a/scripts/pagerev.php +++ b/scripts/pagerev.php @@ -298,17 +298,22 @@ if (IsEnabled($EnableDiffInline, 1) && $DiffShow['source'] == 'y' ## Show diff before the preview Cookbook:PreviewChanges function PreviewDiff($pagename,&$page,&$new) { global $FmtV, $DiffFunction, $DiffHTMLFunction, $EnableDiffInline, $DiffShow; - if (@$_REQUEST['preview']>'' && @$page['text']>'' && $page['text']!=$new['text']) { + if (!@$_REQUEST['preview'] || !isset($page['text'])) return; + if ($page['text'] == $new['text']) { + $diff = '<div class="diffadd">' . XL('No changes') . '</div>'; + } + else { $d = IsEnabled($DiffShow['source'], 'y'); $e = IsEnabled($EnableDiffInline, 1); $DiffShow['source'] = 'y'; $EnableDiffInline = 1; SDV($DiffHTMLFunction, 'DiffHTML'); $diff = $DiffFunction($new['text'], $page['text']);# reverse the diff - $FmtV['$PreviewText'] = $DiffHTMLFunction($pagename, $diff).'<hr/>'.@$FmtV['$PreviewText']; + $diff = $DiffHTMLFunction($pagename, $diff); $DiffShow['source'] = $d; $EnableDiffInline = $e; } + $FmtV['$PreviewText'] = $diff .'<hr/>' . @$FmtV['$PreviewText']; } if (IsEnabled($EnablePreviewChanges, 0) && @$_REQUEST['preview']>'') { $EditFunctions[] = 'PreviewDiff'; |