Watch changes on Pagetemplates (commit 18781)

Topics: Troubleshooting
Jul 5, 2012 at 4:25 PM

Hi,

I used to watch changes on pagetemplates through:

DataEvents<IPageTemplate>.OnDeleted += new DataEventHandler(OnManifestChanged);

But in the 4.0 beta this is not possible anymore:

The type 'Composite.Core.PageTemplates.IPageTemplate' cannot be used as type parameter 'TData' in the generic type or method 'Composite.Data.DataEvents<TData>'.

What's the new way to accomplish this?

thnx,

JamBo

Jul 5, 2012 at 5:06 PM

The interface has been renamed to IXmlPageTemplate

Jul 5, 2012 at 5:11 PM

@burningice,

thnx, that was fast & easy...;)

Jul 5, 2012 at 5:16 PM

:) yeah... well, i knew so i could answer just out of memory!

If you look closer at the source for the 4.0 source check-in, you'll see that C1 now will start support different kinds of templates in the Core (Masterpages, Razor) and it therefor made most sense to rename the ITemplate interface to IXmlTemplate, to give it a more descriptive name.

Coordinator
Jul 5, 2012 at 7:59 PM

@nuFaqtz we actually haven't thought about events when templates gets changed - the IXmlPageTemplate will only hold data for one of the three kinds of page templates we will be supporting, so relying on IXmlPageTemplate data events will be incomplete (no events are fired for Razor or .master based page templates).

We could add general page template events like add, edit, delete. Could you shortly describe your use case for hooking on to page template events, so we can take this into account?

Jul 5, 2012 at 10:10 PM

@mawtext

For an optimize package that I developed I create a dynamic manifest file (for mobile/web apps). This manifest file should be updated when an editor makes changes to files that are in the manifest file (like scripts, stylesheets, images and pages).

However when a template changes, the underlying content pages should be updated also, i.e require the content to be refreshed from the server.

So generic template events would be great. For now i'm safe as I mostly develop/use XSLT based sites.

Thank you very much for considering this.

mzZzl,
JamBo

Jul 5, 2012 at 10:36 PM

@nuFaqtz but how do you handle when the actual template (the .xml file) is being edited? It sounds more to me that you need to have some kind of FileSystemWatcher to look out for new, edited or deleted template files?

Jul 5, 2012 at 11:20 PM
Edited Jul 5, 2012 at 11:29 PM

@burningice

I do use filesystemwatchers on the files in the manifest. I am under the impression that the events on the templates would be enough a trigger to update the manifest (which is nothing more than a comment change on the manifest file) so web app/mobile files stored on the client know something is changed and need to get the updated files from the server.