From 90658f383dc174c5e6c715c3bf676dda5ee70ce7 Mon Sep 17 00:00:00 2001
From: Michael Hamann <michael@content-space.de>
Date: Sat, 28 Jul 2012 14:21:45 +0200
Subject: [PATCH] Respect useheading setting on revisions page FS#2139

---
 inc/html.php | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/inc/html.php b/inc/html.php
index 708461c6a..af047a107 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -466,6 +466,8 @@ function html_revisions($first=0, $media_id = false){
     if (!$media_id) $exists = $INFO['exists'];
     else $exists = @file_exists(mediaFN($id));
 
+    $display_name = (!$media_id && useHeading('navigation')) ? hsc(p_get_first_heading($id)) : $id;
+
     if($exists && $first==0){
         if (!$media_id && isset($INFO['meta']) && isset($INFO['meta']['last_change']) && $INFO['meta']['last_change']['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
             $form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
@@ -488,7 +490,7 @@ function html_revisions($first=0, $media_id = false){
         $form->addElement(form_makeOpenTag('a', array(
                         'class' => 'wikilink1',
                         'href'  => $href)));
-        $form->addElement($id);
+        $form->addElement($display_name);
         $form->addElement(form_makeCloseTag('a'));
 
         if ($media_id) $form->addElement(form_makeOpenTag('div'));
@@ -563,11 +565,11 @@ function html_revisions($first=0, $media_id = false){
             if (!$media_id) $href = wl($id,"rev=$rev",false,'&');
             else $href = media_managerURL(array('image' => $id, 'tab_details' => 'view', 'rev' => $rev), '&');
             $form->addElement(form_makeOpenTag('a', array('href' => $href, 'class' => 'wikilink1')));
-            $form->addElement($id);
+            $form->addElement($display_name);
             $form->addElement(form_makeCloseTag('a'));
         }else{
             $form->addElement('<img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" />');
-            $form->addElement($id);
+            $form->addElement($display_name);
         }
 
         if ($media_id) $form->addElement(form_makeOpenTag('div'));
-- 
GitLab