[Building Sakai] Using the EmailTemplateService

Aaron Zeckoski aaronz at vt.edu
Mon Jan 4 01:30:16 PST 2010


Last modified date is in there already.

It is possible to store the templates in any form you like (including
putting them into a properties file) and while having a convenience
method might be nice I am not sure it adds all that much since the
main use case was editing the templates via the web interface. The
initial load is from a file (like properties or XML or whatever) but I
was expecting people would prefer to edit them via a UI after that
rather than trying to modify the source files.

-AZ


On Mon, Jan 4, 2010 at 8:35 AM, Steve Swinsburg
<steve.swinsburg at gmail.com> wrote:
> Thanks gents,
>
> I did notice the parts in site-manage but wasn't sure if that was the current state of how it was to be implemented so thought best to check.
>
> For elegance, what about some wrapper methods that load/update the template for you, given the path of the XML file and some property which says what version it is/last modified date? This is something that would need to be implemented for each tool that uses the ETS so would be a good candidate for an API method in ETS itself.
>
> Also, is it possible to have multiple localised XML files for the one template
> ie
> myTemplate.xml
> myTemplate_en_GB.xml
> myTemplate_nl.xml
>
> rather than having all of the various localised versions in the one file?
>
> cheers,
> Steve
>
>
> On 04/01/2010, at 6:42 PM, David Horwitz wrote:
>
>> You Might have a look at the Notification manager in site-manage:
>>
>> https://source.sakaiproject.org/svn/site-manage/trunk/site-manage-impl/impl/src/java/org/sakaiproject/sitemanage/impl/ETSUserNotificationProviderImpl.java
>>
>> This loads them from an xml file and saves them. Suggestions to make
>> this more elegant welcomed :-)
>>
>> D
>>
>> On 01/04/2010 09:37 AM, Aaron Zeckoski wrote:
>>> Mostly just the javadocs really. :-)
>>>
>>> The simplest way to do this would be to create a spring bean (or use
>>> an existing one) with an init method and then call
>>> EmailTemplateService.saveTemplate(EmailTemplate emailTemplate) with
>>> the content of your template. This will store the template which you
>>> can then use from then on. You could check the date on the template
>>> file(s) to see if it had been updated and then update the template(s)
>>> in the database. There isn't anything to do this for you in the
>>> service though so you will have to write some code to handle it.
>>>
>>> Hope that helps.
>>> -AZ
>>>
>>>
>>>
>>> On Mon, Jan 4, 2010 at 3:55 AM, Steve Swinsburg
>>> <steve.swinsburg at gmail.com> wrote:
>>>
>>>> Hi all,
>>>>
>>>> Are there any docs on how to use the EmailTemplateService?
>>>>
>>>> For example, I want to be able to define a template and replacement variables for an email that my tool is to send, and then abstract that out into a file somewhere that can be internationalised. Is there some way to register the new templates that I create with the ETS via Spring?
>>>>
>>>> thanks,
>>>> Steve
>>>> _______________________________________________
>>>> sakai-dev mailing list
>>>> sakai-dev at collab.sakaiproject.org
>>>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>>>
>>>> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
>>>>
>>>>
>>>
>>>
>>>
>> _______________________________________________
>> sakai-dev mailing list
>> sakai-dev at collab.sakaiproject.org
>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>
>> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
>
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of "unsubscribe"
>



-- 
Aaron Zeckoski (azeckoski (at) vt.edu)
Senior Research Engineer - CARET - University of Cambridge
https://twitter.com/azeckoski - http://www.linkedin.com/in/azeckoski
http://aaronz-sakai.blogspot.com/ - http://tinyurl.com/azprofile


More information about the sakai-dev mailing list