Hi there,
I try to create a usermacro for tagging pages with published version and timestamp from publishing. I have found the needed data in "Page History":
so my macro is look like that:
## @noparams
#set( $version = $content.version )
#set( $dateFormatter = $action.getDateFormatter() )
#set( $date = $content.getLastModificationDate() )
<strong>Version: </strong>$version, <strong>Veröffentlicht: </strong>$dateFormatter.formatGivenString("dd-MMM-yyyy hh:mm", $date)
problem is that the $date is always show that what the name says: the last mod date
In that example timestamp 08:04 instead of 07:48 ... version is matching so if there are unpublished changes I see the correct version but not the correct timestamp:
Anybody out there with a nice hint for get the correct published date?
I tried your user macro, because I was sceptical, that you get "12" for the version. What you do ist, get the version from the $content. And this will always return the latest version, So I do not understand, why this is "12" for you.
When I use this macro, it's always my last version.
The other thing I'm asking myself: What do you want to achieve?
The last version published is always the last version in the page history. An unpublished page isn't listed in the page history and will not be displayed.
Can you try to explain your need again?
Wenn es für dich einfacher ist, kannst du auch in Deutsch deinen Wunsch erklären :)
Thanks and regards, Dominic
Hi Dominic,
we (our management) use "comala document control" to get confirmations of readed pages. Now they get the condition to make the reader visible which version of the page he is reading and acknowledging.
So we have the case that one page (published) is requestet for readacknowledge at a range of days and in that range the pagecontent will be changed by management (unpublished hanging in comala plugin workflow). That changes the lastmodificationdate.
The published state is not equal publish in confluence. I think it is a layer of histroy pages managed by comala plugin.
The macro should show the reader the published version and timestamp. So what I need is something like $content.getHistoryVersion($version).getLastModificationDate().
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, okay, I see. So I will not be able to reproduce this without this plugin :)
What I can offer you is a method, where you can get all versions:
On a $page, you can call getVersionHistorySummaries().
Then you can loop over the histories like this:
#set( $childVersions = $pageManager.getVersionHistorySummaries($page.getEntity()) )
#foreach( $childVersion in $childVersions)
#set( $modDate = $childVersion.getLastModificationDate() )
#end
#end
Perhaps, this will help you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes sir ! Great work ! That was what I am looking for:
## @noparams
#set( $version = $content.version )
#set( $dateFormatter = $action.getDateFormatter() )
#set( $i = ($pageManager.getVersionHistorySummaries($content.getEntity()).size() - $version) )
#set( $childVersion = $pageManager.getVersionHistorySummaries($content.getEntity()).get($i) )
#set( $date = $dateFormatter.formatGivenString("dd-MMM-yyyy hh:mm", $childVersion.getLastModificationDate()) )
<strong>Version: </strong>$version, <strong>Veröffentlicht: </strong>$date
I dont know why he needed the content entity instead of page entity but try and error was get the correct result.
Thanks a lot @Dominic Lagger :-)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.