November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Please try this:
var contentEvents = ServiceLocator.Current.GetInstance<IContentEvents>();
contentEvents.PublishedContent += contentEvents_PublishedContent;
Hope that help!
Ha Bui
Hi, habu,
I don't think this helps me, I don't have a problem with C# code, I am not sure how to execute the code after a page is published. I wanted to avoid using javascript polling.
I imagined there should be some way to subscribe to some dojo event that is raised after a page is published.
Hi Marija!
We don't have a really nice way to do this at the moment. Since our widgets bind to the data on the client and this is updated we really don't have this need ourselves. I found that we do publish an event when publishing to handle potentially changes in sort order and it should be possible to listen to this event using the pub/sub system. I consider this somewhat a hack/temporary solution that can be used until we have a more proper way to do this:
//(topic = "dojo/topic")
topic.subscribe("/epi/cms/contentdata/childrenchanged", function (contentReference) {
});
Hey, Linus, thx a bunch for the answer, it seems like I am on the right track.
There is just one tiny glitch - this even is called when page is saved, not when it's published. My stuff get executed after a page is published, so I guess I need another event. I can't find it, however. Is there one?
Hi Marija,
As Linus said, that's a temporary way! Because Publish command will publish this event when content is published. So you can listen and get content right back by version agnostic id and check its status!
I found another way (at the server side):
1. After content published the context will be changed!
2. After context changed IFrameContextComponent.js will be reload (because you set ReloadOnContextChange = true)
3. It will query back to server with url like: http://yoursite/<url to your modules>/<your control>?uri=epi.cms.contentdata:///6&id=6
I don't think we can not handle by this way!
Hope that help!
// Ha Bui
Hi, habu,
Thx for the answer, however, this still doesn't work.
I already have ReloadOnContextChange = true, however, IFrameContextComponent.js does not refresh my plugin.
Ah, I know why, when IFrameComponent.js call to IFrame.js > load method, the method will be resolved immediately because the url is not dfference with current and we don't force reload! :(
The final way you can try is customize wiget type inherited from IFrameComponent.js and override method below:
_constructQuery: function (context)
You can override like this:
_constructQuery: function (context) {
return {
uri: context.uri,
id: context.id || "",
clientTicks: new Date().getMilliseconds()
};
}
Just a trivival way! I'll try find out a better way!
// Ha Bui
I do not having a direct solution (other than listening to the event mentioned previosly) but have noted this for future improvements.
I have an iframecomponent whose values depend on the values of URLSegment/PageName, so when a page is published, I have to refresh the values inside the component.
This is the definition of the component:
Earlier (until 7.5 version, this code worked):
Now, EditPanel doesn't seem to exist and I am not sure how to do this differently.