DITA and XMetaL Discussion
XMetaL Community Forum › DITA and XMetaL Discussion › On_Document_Open_View not fired for DITA maps?
-
jperkins December 9, 2008 at 4:20 pm
On_Document_Open_View not fired for DITA maps?
December 9, 2008 at 4:20 pmParticipants 6Replies 7Last Activity 14 years, 3 months agoFirst off, THANK YOU to JustSystems for setting up these forums!
I am trying to fire a script whenever any document is opened. The On_Document_Open_View event fires when I create a new DITA topic, but not when I create a new map. Is there another event, or any other method, that I can use to detect the creation of a new DITA map?
FYI, we're doing to to force new documents to be saved before any content is written. This ensures that any links to external content will be stored as relative URIs, which helps some of our downstream systems. If there is another way to achieve this without catching an event, that would be great too.
Thanks!
Jason Perkins
Jacquette ConsultingDerek Read December 9, 2008 at 9:13 pm
Reply to: On_Document_Open_View not fired for DITA maps?
December 9, 2008 at 9:13 pmThe map editor currently has no APIs (no events, no methods or properties) that you can tie into. It is a closed system and not open for customization at this time.
It sounds like your real issue is that links are not being made relative because users might not save a document before adding links to it (which you are trying to work around by forcing a save). We hope to correct this in the future so that saving a file (map or topic) before inserting a link should not be necessary.
I'm thinking some sort of url adjustment at save time would be the least intrusive but the solution hasn't been decided on yet so I cannot say exactly how it would function. One alternative would be to prompt the user to save before inserting anything containing an href or conref into an unsaved document, or do you think that would be too intrusive? Yet another option would be to force a save right after creating any new document (which is what you are proposing).
Note that whatever is decided on will likely have to take CMS integrations into account, and that might throw a wrench into solutions that might otherwise work when documents are stored only on a local file system.
mag3737 December 9, 2008 at 9:54 pm
Reply to: On_Document_Open_View not fired for DITA maps?
December 9, 2008 at 9:54 pmAs Derek mentions, the problem here really is that the map editor is kind of a closed system embedded within XMetaL, and so doesn't trigger any of the ordinary XMetaL events.
A workaround: If you don't mind opening maps initially in “XML view”, all the usual events will fire normally.
Even there, though, On_Document_Open_View, doesn't seem to fire for maps. I'll ask about that.
Meanwhile, there are two other (undocumented) event macros that may be useful:
On_Application_Document_Open_View
On_Application_Document_Open_CompleteBoth of these events fire in the XML view both for maps and topics.
ghkrause December 10, 2008 at 1:26 am
Reply to: On_Document_Open_View not fired for DITA maps?
December 10, 2008 at 1:26 amQimonda developed its own XMetaL Author to Sharepoint integration prior to Justsystems. We prefer drag'n'drop to link images and topicrefs. (conref is in pilot use only as of today). Our macro waits for “On_Application_Document_Before_DropText” and checks if the URL is part of our repository. We drag from our CMS tab in resource manager or directly from IE window with Sharepoint file list.
In case the drop text is a filepath of concern it is made relative and inserted as @href together with image or topicref. Other attributes are set as well. We can drop topics and maps in maps. So this code might fit perfect for your maps while you do topics as you already started ?!
I enclose the code but it is without warranty as usual. Some CRCL functions might no longer be supported officially by Justsystems …
PS: TOM is the nickname for our repository = TechDoc On MOSS.mag3737 December 10, 2008 at 1:52 am
Reply to: On_Document_Open_View not fired for DITA maps?
December 10, 2008 at 1:52 amPS: TOM is the nickname for our repository = TechDoc On MOSS.
🙂
Thanks for the posting Gunnar!
jperkins December 10, 2008 at 12:54 pm
Reply to: On_Document_Open_View not fired for DITA maps?
December 10, 2008 at 12:54 pmThanks for the responses, everyone! It sounds like there is no simple answer, at least not currently. The drag-and-drop approach sounds interesting, I will take a look at that. And I'll poke around the scripts and see if I can find a place to throw a hook. Thanks again!
jperkins December 16, 2008 at 3:43 pm
Reply to: On_Document_Open_View not fired for DITA maps?
December 16, 2008 at 3:43 pmI managed to display the Save As… dialog automatically for new maps by editing DITAMAPMANAGERjsDitaMapHandler.js:
[pre]DITAMapHandler.prototype.initFromString = function (filePath, mapAsString, resourceLocator) {
// …body of function is unchanged
this.SaveMap();
}[/pre]
Not ideal, but it works. If anyone has any advice on a cleaner way to implement this, especially if it can be put in a customization macro, it would be much appreciated.Thanks!
Derek Read December 18, 2008 at 6:24 pm
Reply to: On_Document_Open_View not fired for DITA maps?
December 18, 2008 at 6:24 pmI managed to display the Save As… dialog automatically for new maps by editing DITAMAPMANAGERjsDitaMapHandler.js
Hacking the code like this is likely the only way to do this until we implement a supported method for clients to officially change the DITA functionality.
-
AuthorPosts
- You must be logged in to reply to this topic.