Custom Date Format in CMS dialogs

29 views
Skip to first unread message

Kenan Salic

unread,
Feb 5, 2016, 9:20:36 AM2/5/16
to hippo-c...@googlegroups.com
Hi Guys,

I got a customer which finds it problematic to see the dates, well especially times in the CMS because of "privacy" reasons.

I have the following dialog:

Inline image 1

So I looked up the class:

org.hippoecm.frontend.editor.workflow.dialog.DocumentMetadataDialog

private static final String DATE_STYLE = "MS";
publicationMetadata.add(new DocumentMetadataEntry(getString("creationdate"),
private String formattedCalendarByStyle(Calendar calendar, String patternStyle) {
if (calendar != null) {
DateTimeFormatter dtf = DateTimeFormat.forStyle(patternStyle).withLocale(getLocale());
return dtf.print(new DateTime(calendar));
}
return StringUtils.EMPTY;
}
Well this looks pretty hardcoded.

What would the most efficient way be to hide the time? 

It can be a JS solution as well, but it has been problematic injecting the right code at the right time (at initialization of this dialog) without some kind of timer functionality.

Cheers,

K
--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 745 Atlantic Avenue, Boston, MA 02111

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

Bert Leunis

unread,
Feb 8, 2016, 3:22:14 AM2/8/16
to Hippo Community
On Fri, Feb 5, 2016 at 3:20 PM, Kenan Salic <k.s...@onehippo.com> wrote:
Hi Guys,

I got a customer which finds it problematic to see the dates, well especially times in the CMS because of "privacy" reasons.

I have the following dialog:

Inline image 1

So I looked up the class:

org.hippoecm.frontend.editor.workflow.dialog.DocumentMetadataDialog

private static final String DATE_STYLE = "MS";
publicationMetadata.add(new DocumentMetadataEntry(getString("creationdate"),
private String formattedCalendarByStyle(Calendar calendar, String patternStyle) {
if (calendar != null) {
DateTimeFormatter dtf = DateTimeFormat.forStyle(patternStyle).withLocale(getLocale());
return dtf.print(new DateTime(calendar));
}
return StringUtils.EMPTY;
}
Well this looks pretty hardcoded.

What would the most efficient way be to hide the time? 
In this project, override the DocumentMetadataDialog and use your own date format will be the easiest way. You can also update the code so it can also read the dateformat from configuration. Please notice that columns in the document overviews also show the last modified date and publication date. You will see those in the Advanced search overview also and might want to change them there too.
 

It can be a JS solution as well, but it has been problematic injecting the right code at the right time (at initialization of this dialog) without some kind of timer functionality.

Cheers,

K
--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 745 Atlantic Avenue, Boston, MA 02111

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.

Kenan Salic

unread,
Feb 8, 2016, 4:07:25 AM2/8/16
to hippo-c...@googlegroups.com
Thank you Bert! I'll try to see what I can do in my time. Making it configurable would be a cool addition. 

Cheers
Reply all
Reply to author
Forward
0 new messages