Details
-
Bug
-
Resolution: Fixed
-
Minor
-
3.1
-
None
-
patch
-
Integration
-
Trivial
-
Description
The display title should be set to the title parameter from the query string for about to be created documents:
--- titlevars.vm.old 2011-09-21 16:56:16.000000000 +0200 +++ titlevars.vm 2011-09-21 16:59:09.000000000 +0200 @@ -20,18 +20,22 @@ ## ---------------------------------------------------------------------------------- #set ($titleToDisplay = $tdoc.displayTitle) #if ($tdoc.title.length() == 0 || $xwiki.isTitleInCompatibilityMode()) - ## Look for first H1-H6 either in lowercase or uppercase - #set ($regexResult = $regextool.find($renderedContent, "<([hH][1-6]).*?>(?:<span>)?(.*?)(?:</span>)?</[hH][1-6]>")) - #if (!$regexResult.isEmpty() && $regexResult.get(2).group.equals($titleToDisplay)) - ## We are extracting the title but putting it back but hidden since there are javascript code such as the - ## javascript used to display section edition which needs the header to be there to work properly. - #set ($hiddenTitle = "<${regexResult.get(1).group} class='hidden'>${regexResult.get(2).group}</${regexResult.get(1).group}>") - #if ($regexResult.get(0).end < $mathtool.sub($renderedContent.length(), 1)) - #set ($renderedContent = "${renderedContent.substring(0, $regexResult.get(0).start)}${hiddenTitle}${renderedContent.substring($regexResult.get(0 ).end)}") - #else - #set ($renderedContent = "${hiddenTitle}$renderedContent.substring(0, $regexResult.get(0).start)") + #if ($tdoc.isNew() && $request.get('title')) + #set ($titleToDisplay = $request.get('title')) + #else + ## Look for first H1-H6 either in lowercase or uppercase + #set ($regexResult = $regextool.find($renderedContent, "<([hH][1-6]).*?>(?:<span>)?(.*?)(?:</span>)?</[hH][1-6]>")) + #if (!$regexResult.isEmpty() && $regexResult.get(2).group.equals($titleToDisplay)) + ## We are extracting the title but putting it back but hidden since there are javascript code such as the + ## javascript used to display section edition which needs the header to be there to work properly. + #set ($hiddenTitle = "<${regexResult.get(1).group} class='hidden'>${regexResult.get(2).group}</${regexResult.get(1).group}>") + #if ($regexResult.get(0).end < $mathtool.sub($renderedContent.length(), 1)) + #set ($renderedContent = "${renderedContent.substring(0, $regexResult.get(0).start)}${hiddenTitle}${renderedContent.substring($regexResult.get (0).end)}") + #else + #set ($renderedContent = "${hiddenTitle}$renderedContent.substring(0, $regexResult.get(0).start)") + #end + #set ($titleToDisplay = $regexResult.get(2).group) #end - #set ($titleToDisplay = $regexResult.get(2).group) #end #end ## If the title comes from a heading in the content, special XML characters are already escaped.
Attachments
Issue Links
- relates to
-
XWIKI-7026 Title passed in parameter not displayed in inline form for new documents
- Closed