Custom mail template Easyforms

40 views
Skip to first unread message

jj.f...@tfe.nl

unread,
Sep 3, 2014, 8:19:17 AM9/3/14
to hippo-c...@googlegroups.com
For a project I'm using Easyforms 2.12.14 with hippo 7.8 and I want to implement a custom freemarker template for emailing form data.

To accomplish this I used the console to add a parametername 'ef-body-html' to my page component with a parametervalue that contains the entire freemarker template.

This works, but it feels clunky to put a complete freemarker template inside a parametervalue in a jcr node. 
Ideally, i'd like to use a seperate resource file containing the template and let easyforms parse that file, and only define the path to that resource in the page component.


Is this possible in the current version of easyforms? I can see that the method populateHtmlTemplate in class FreemarkerParser has an optional templatePath vararg that is used parse a file so the parser seems capable to do this, but populateHtmlTemplate is never called in that way in the plugins code.


Kind regards,
Jaap-Jan

Woonsan Ko

unread,
Sep 3, 2014, 9:50:25 AM9/3/14
to hippo-c...@googlegroups.com
Hi Jaap-Jan,

I've just browsed the source code. It seems possible to use an external
.ftl file like the following:
- Don't set ef-body-html parameter
- Instead add
classpath:org/onehippo/forge/easyforms/util/easyforms_html.ftl (for html
email template) or
classpath:org/onehippo/forge/easyforms/util/easyforms_text.ftl (for text
email template).

Then, it seems to parse the .ftl file instead.

Regards,

Woonsan
> --
> 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
> <mailto:hippo-communi...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/hippo-community.
> For more options, visit https://groups.google.com/d/optout.


--
w....@onehippo.com www.onehippo.com
Boston - 101 Main Street, Cambridge, MA 02142
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466

jj.f...@tfe.nl

unread,
Sep 3, 2014, 10:02:26 AM9/3/14
to hippo-c...@googlegroups.com
Hi Woonsan,

Those are the default ftl templates that are packaged with the easyforms plugin jar.

Does it also work with ftl files outside that org/onehippo/forge/easyforms/util package?

And where exactly do you add that classpath, also on the page component?

thanks!

Jaap-Jan

Woonsan Ko

unread,
Sep 3, 2014, 10:06:01 AM9/3/14
to hippo-c...@googlegroups.com
Hi Jaap-Jan,

I think you can add those .ftl files under
/site/WEB-INF/classes/org/onehippo/forge/easyforms/util/ folder. (In
Maven project, it could be located in
site/src/main/resources/org/onehippo/forge/easyforms/util/ folder.)
Then, it will override the default files by shadowing.

Regards,

Woonsan

On 9/3/14 10:02 AM, jj.f...@tfe.nl wrote:
> Hi Woonsan,
>
> Those are the default ftl templates that are packaged with the easyforms
> plugin jar.
>
> Does it also work with ftl files outside that
> org/onehippo/forge/easyforms/util package?
>
> And where exactly do you add that classpath, also on the page component?
>
> thanks!
>
> Jaap-Jan
>
> On Wednesday, September 3, 2014 3:50:25 PM UTC+2, w.ko wrote:
>
> Hi Jaap-Jan,
>
> I've just browsed the source code. It seems possible to use an external
> .ftl file like the following:
> - Don't set ef-body-html parameter
> - Instead add
> classpath:org/onehippo/forge/easyforms/util/easyforms_html.ftl (for
> html
> email template) or
> classpath:org/onehippo/forge/easyforms/util/easyforms_text.ftl (for
> text
> email template).
>
> Then, it seems to parse the .ftl file instead.
>
> Regards,
>
> Woonsan
>
> <javascript:>
> > RSS:
> >
> https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
> <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 <javascript:>
> > <mailto:hippo-communi...@googlegroups.com <javascript:>>.
> <http://groups.google.com/group/hippo-community>.
> > For more options, visit https://groups.google.com/d/optout
> <https://groups.google.com/d/optout>.
>
>
> --
> w....@onehippo.com <javascript:> www.onehippo.com
> <http://www.onehippo.com>
> Boston - 101 Main Street, Cambridge, MA 02142
> Amsterdam - Oosteinde 11, 1017 WT Amsterdam
> US +1 877 414 4776 (toll free)
> Europe +31(0)20 522 4466
>
> --
> 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
> <mailto:hippo-communi...@googlegroups.com>.

Jaap-Jan Frans

unread,
Sep 5, 2014, 2:29:35 AM9/5/14
to hippo-c...@googlegroups.com
Hi Woonsan,


That may be a possibility, but it would still limit the number of ftl files you could use to just.. one. I'd like to be able to select different ftl template files for different forms.
And I'm a bit cautious to do this as things would break if the plugin would change the name of it's internal ftl template file or if the package structure in the plugin jar would change in a future update.

thanks for the suggestion though!


kind regards,
Jaap-Jan


You received this message because you are subscribed to a topic in the Google Groups "Hippo Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hippo-community/IIBAom9DzdQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hippo-communi...@googlegroups.com.



--
Met vriendelijke groet,
JAAP-JAN FRANS
JAVA DEVELOPER 
-
LinkedIn
Ga naar http://tfe.nl/Locatie Groningen:
Friesestraatweg 215 a
Postbus 2010
9704 CA Groningen
Nederland
Locatie Amsterdam:
A Lab
Overhoeksplein 2
1031 KS Amsterdam
Lab 105
www.tfe.nl
T     +31 (0)50 57 57 888
E     in...@tfe.nl
tfe on Facebook
tfe on Twitter

Woonsan Ko

unread,
Sep 5, 2014, 7:04:18 AM9/5/14
to hippo-c...@googlegroups.com

I see.
Anyway, it sounds like a good idea if we can set an external resource path. Maybe the plugin can add an additional param for external ftl resource path.

Cheers,

Woonsan
(Sent via my mobile device. Apologies for any typos.)
   

To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.

jj.f...@tfe.nl

unread,
Sep 5, 2014, 7:21:10 AM9/5/14
to hippo-c...@googlegroups.com
I agree!

I filed a feature request at https://issues.onehippo.com/browse/HIPPLUG-920 


Cheers,
Jaap-Jan
>     > <mailto:hippo-community+unsub...@googlegroups.com <javascript:>>.

>     > Visit this group at http://groups.google.com/group/hippo-community
>     <http://groups.google.com/group/hippo-community>.
>     > For more options, visit https://groups.google.com/d/optout
>     <https://groups.google.com/d/optout>.
>
>
>     --
>     w....@onehippo.com <javascript:>     www.onehippo.com
>     <http://www.onehippo.com>
>     Boston - 101 Main Street, Cambridge, MA 02142
>     Amsterdam - Oosteinde 11, 1017 WT Amsterdam
>     US +1 877 414 4776 (toll free)
>     Europe +31(0)20 522 4466
>
> --
> 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
Reply all
Reply to author
Forward
0 new messages