DITA and XMetaL Discussion

XMetaL Community Forum DITA and XMetaL Discussion On_Document_Open_View not fired for DITA maps?

  • jperkins

    On_Document_Open_View not fired for DITA maps?

    Participants 6
    Replies 7
    Last Activity 12 years, 6 months ago

    First 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 Consulting

    Reply

    Derek Read

    Reply to: On_Document_Open_View not fired for DITA maps?

    The 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.

    Reply

    mag3737

    Reply to: On_Document_Open_View not fired for DITA maps?

    As 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_Complete

    Both of these events fire in the XML view both for maps and topics.

    Reply

    ghkrause

    Reply to: On_Document_Open_View not fired for DITA maps?

    Qimonda 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.

    Reply

    mag3737

    Reply to: On_Document_Open_View not fired for DITA maps?

    PS: TOM is the nickname for our repository = TechDoc On MOSS.

    🙂

    Thanks for the posting Gunnar!

    Reply

    jperkins

    Reply to: On_Document_Open_View not fired for DITA maps?

    Thanks 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!

    Reply

    jperkins

    Reply to: On_Document_Open_View not fired for DITA maps?

    I 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!

    Reply

    Derek Read

    Reply to: On_Document_Open_View not fired for DITA maps?

    I 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.

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support