Pages: 1
Print
Author Topic: Trap links in Page Preview?  (Read 3295 times)
paorear
Member

Posts: 29


« on: May 15, 2014, 07:35:00 PM »

When viewing a topic in Page Preview, is it possible programmatically to capture a navigation request prior to navigating, so that redirection or other processing could be accomplished and possibly handing back a different URI to the Page Preview browser?

Thanks!

Paul O'Rear
Logged
paorear
Member

Posts: 29


« Reply #1 on: May 15, 2014, 08:01:38 PM »

To clarify, I don't mean On_Before_Document_Preview, I'm thinking in the context of an already previewed page - e.g. capturing the Navigate() event of the underlying browser control.

P.
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #2 on: May 16, 2014, 03:14:47 PM »

Perhaps if you could describe what the user would be doing to initiate the action and then exactly what the action would trigger I might be able to tell you if that would be possible.
Logged
paorear
Member

Posts: 29


« Reply #3 on: May 16, 2014, 03:47:28 PM »

The user would be clicking on a link to another topic in our CMS that is not transformed into HTML on the local machine. The idea would be to intercept the link request, pull the topic from the CMS and transform on the fly and then pass back the URI to the newly transformed and linked topic to the Page Preview.

P.
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #4 on: May 16, 2014, 04:32:29 PM »

Hmmm. Still not exactly clear to me.

Does this mean the user would be clicking on an element inside an XML document in Tags On or Normal view to trigger this action?

If so, you'd probably just use the On_Click event for that. It should be easy enough to include code in On_Click that calls an external application (whatever is doing your transform) and when that app returns the rest of the code in On_Click could open the resulting file in an external copy of IE (or whatever external application you want to display it in).

If you need to have the resulting file render in Page Preview you could switch to that view when On_Click fires (ActiveDocument.ViewType = 3), but I'm not sure how easy it will be to change what is displayed in there. By default XMetaL creates a temp file which is then transformed using auto-generated XSLT (based on your CSS and the DTD itself) and the resulting file is rendered in the copy of IE embedded in Page Preview. I think you would probably need to rewrite the macro file multipleOutput.mcr in the Startup folder to do that. A lot of it may need to be rewritten.

If your users work with DITA files then this becomes more complex because switching to Page Preview in this case includes running the DITA Open Toolkit to perform the transformation.

Are you the creator of the CMS integration that connects XMetaL Author Enterprise to the CMS? If not, you may wish to request that they investigate this functionality.
Logged
paorear
Member

Posts: 29


« Reply #5 on: May 20, 2014, 04:15:34 PM »

No - what I'm describing is that a user is looking at a page in Page Preview. This is XML rendered to HTML. That page in preview has a link to another XML "topic" that is in our CMS, that will ultimately be transformed to HTML as well.

So the user previews the page - clicks on a link to another page that is not local, or transformed yet. I'd like to catch that request, pull down the xml topic from our CMS and transform it on the fly.

This is using our own custom CMS, and we own all the other logic for transforming XML to HTML otherwise for the standard page preview scenario. We currently do something what you describe when we preview now - where we do the transforming process and then pass our own temp .html file back to the preview view.

We are working with our own schema as well.

I've also been interested in getting more information about the CMS integration toolkit, but have not been successful in finding the route to get that information yet.

Thanks Derek!
Paul
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #6 on: May 26, 2014, 03:05:08 PM »

At that point XMetaL has no events you could hook into. For this to work I think your initial transformation would need to put code into the (first) HTML page, hooking an event inside of IE that would do this secondary stuff.

However, perhaps, given that the first page contains a link to another page, you could build some kind of "generate output by following links" feature into your output generator. It would look for your links, find those pages and generate output for them when the initial page is generated just in case the user wants to visit them as well.
Logged
Pages: 1
Print
Jump to: