Possible to customize the warning messages in Oxygen?

csun
Posts: 22

Possible to customize the warning messages in Oxygen?

Fri Jul 27, 2018 5:53 am

We have a use case where we would like to customize the warning messages displayed in Oxygen, when a user clicks on a link that cannot open.

Currently the message is:

Description: :Cannot open the link. The URL is not specified.
Severity: Warning

To change the text in the "Description" field, would it require an simple change in the framework, or something more complicated? Thanks.
sorin_carbunaru
Site Admin
Posts: 157

Re: Possible to customize the warning messages in Oxygen?

Mon Jul 30, 2018 2:40 pm

Hello,

Unfortunately there is no way to customize that message... How exactly would you want to customize it? I would like to understand your use case :).

All the best wishes,
Sorin Carbunaru
oXygen XML
csun
Posts: 22

Re: Possible to customize the warning messages in Oxygen?

Fri Aug 03, 2018 12:18 am

Hi Sorin,
Thanks for your reply.

My use case is, when the XIncluded doc content is in XMLs under certain file directories, I'd like to prevent the Oxygen users from following the xi:include links to open and edit them. One option would be to customize the CSS like this:
xi|include[href^="urn:mydomain:specialDir"]:before {
link: "" !important;
}

Now if a user click on the link from Oxygen's Author view, it displays the warning message aforementioned. It would be nice if we can let the warning message say something like:
Description: :Do not edit the file under /mydomain/specialDir. Your changes there will not be saved in the version control system.
Severity: Warning
sorin_carbunaru
Site Admin
Posts: 157

Re: Possible to customize the warning messages in Oxygen?

Fri Aug 03, 2018 1:09 pm

Hi Charles,

If writing some Java code is an option, you could create a plugin that makes the files from the special domain read-only, and also set a reason why the document is like that.

For detecting if the current file is "special" and making it read-only, you can do something like this:

Code: Select all

    PluginWorkspace pluginWorkspace = PluginWorkspaceProvider.getPluginWorkspace();
    // Get the current editor
    WSEditor editor = pluginWorkspace.getCurrentEditorAccess(StandalonePluginWorkspace.MAIN_EDITING_AREA);
    // Resolve the URN prefix to a URL
    URL resolvedURN = pluginWorkspace.getXMLUtilAccess().resolvePathThroughCatalogs(null, "urn:mydomain:specialDir", true , true);
    // Check if the current editor contains one of the interesting files
    if (editor.getEditorLocation().toExternalForm().startsWith(resolvedURN.toExternalForm())) {
      // Make read-only and give a reason. This reason should be rendered when trying to edit the document.
      editor.getCurrentPage().setReadOnly("Do not edit!");
    }


Best wishes,
Sorin C.
csun
Posts: 22

Re: Possible to customize the warning messages in Oxygen?

Fri Aug 03, 2018 4:34 pm

Hi Sorin,

Yes, this looks to be a great option! :-) Thanks for the help.

Charles

Return to “DocBook”

Who is online

Users browsing this forum: No registered users and 0 guests