Display setting for read-only files?

Post here questions and problems related to editing and publishing DITA content.
wmaclean
Posts: 48
Joined: Sat Jan 04, 2020 1:17 am

Display setting for read-only files?

Post by wmaclean »

Hello,
We have multiple versions of Oxygen (17, 21, 22, 23, and 24).
In Oxygen 17, when it opens a file that is read-only, the file is displayed as grayed-out:
image.png
image.png (186.99 KiB) Viewed 366 times
And when it is not read-only, it is displayed as white:
image.png
image.png (176.11 KiB) Viewed 366 times
For Oxygen 21, 22, 23, and 24, we don't have that same behavior.
Is there a setting in Oxygen we can use to get read-only to display in gray?
Thank you,
Will
Radu
Posts: 8408
Joined: Fri Jul 09, 2004 5:18 pm

Re: Display setting for read-only files?

Post by Radu »

Hi Will,

As far as I remember and from what I tested, Oxygen 17 has no feature of showing a file grayed out when it is marked as read-only on disk or in the CMS.
You seem to be using the SDL connector plugin with Oxygen, I suspect this is a feature of that connector plugin and if it does not work in more recent Oxygen versions it's either because they removed that feature or the feature stopped working. Maybe you can ask SDL about this as we do not control their connector's functionality.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
wmaclean
Posts: 48
Joined: Sat Jan 04, 2020 1:17 am

Re: Display setting for read-only files?

Post by wmaclean »

Hi Radu,
Thanks for your response.
Is there an API in Oxygen to control the background color of the Author tab like that? We might be able to make something of our own for later versions.
We appreciate the help.
Will
wmaclean
Posts: 48
Joined: Sat Jan 04, 2020 1:17 am

Re: Display setting for read-only files?

Post by wmaclean »

To clarify - only one team uses SDL, and they are on Oxygen 17.
Other teams using later versions of Oxygen do not use SDL, so we are trying to figure out a solution for them to have the same functionality.
If there is an API to control background color in the Author tab, we can do a custom plugin for them. But, I've not yet found anything in the Javadoc that sounds like it controls the background color on the Author tab:
https://www.oxygenxml.com/InstData/Editor/SDK/javadoc/
Thanks again.
Radu
Posts: 8408
Joined: Fri Jul 09, 2004 5:18 pm

Re: Display setting for read-only files?

Post by Radu »

Hi,

To change the background color of the Author page depending on a certain read-only flag I would probably attempt something like this:

1) A DITA framework configuration extension which adds a custom CSS stylesheet:
https://blog.oxygenxml.com/topics/customizeDITACSS.html
The CSS could have a selector like:

Code: Select all

:root:read-only{
    background-color:red;
}
The SDL integration has a DITA framework extension.

2) An Oxygen Workspace Access plugin which adds a listener and when an XML document opens in the Author mode, it sets a certain pseudo class property on the root element. Something like:

Code: Select all

    @Override
    public void applicationStarted(StandalonePluginWorkspace pluginWorkspaceAccess) {
     pluginWorkspaceAccess.addEditorChangeListener(new WSEditorChangeListener() {
       public void editorOpened(URL editorLocation) {
         WSEditor editorAccess = pluginWorkspaceAccess.getEditorAccess(editorLocation, PluginWorkspace.MAIN_EDITING_AREA);
         WSEditorPage currentPage = editorAccess.getCurrentPage();
         if(currentPage instanceof WSAuthorEditorPage) {
           WSAuthorEditorPage authorPage = ((WSAuthorEditorPage)currentPage);
           if(!authorPage.isEditable()) {
             authorPage.getDocumentController().setPseudoClass("read-only", authorPage.getDocumentController().getAuthorDocumentNode().getRootElement());
           }
         }
       };
     }, PluginWorkspace.MAIN_EDITING_AREA);
    }
    
https://www.oxygenxml.com/doc/versions/ ... lugin.html

If you do not want to create a DITA framework extension, an alternative to (1) would be to provide a CSS directly as a plugin extension:

https://www.oxygenxml.com/doc/versions/ ... nsion.html

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
wmaclean
Posts: 48
Joined: Sat Jan 04, 2020 1:17 am

Re: Display setting for read-only files?

Post by wmaclean »

Hi Radu,
Looks like a great idea.
Thanks a ton!
Will
vishwavaranasi
Posts: 112
Joined: Fri Feb 28, 2020 4:02 pm

Re: Display setting for read-only files?

Post by vishwavaranasi »

Thanks Radu ,
We have implemented this by adding a new style class file with the the style below which is there in the DITA framework of our custom frameworks extension.
custom.css

Code: Select all

:root:read-only{
    background-color:#C0C0C0;
}
this works fine for the topics/concepts/..

but the same css file custom.css copied to DITAMAP framework extension , this looks applying the BG color but it is breaking the other CSS Styles of a MAP (bookmap) , i mean when the bookmap file is not read-only OR read-only the other styles are missing.

here is attached for read-only file got applied with BG color
image.png
image.png (91.18 KiB) Viewed 173 times
here is attached for a not read-only and the original styples of DITAMAP before we added the custom syle for BG color
image.png
image.png (97.19 KiB) Viewed 172 times
Thanks,
vishwa
Radu
Posts: 8408
Joined: Fri Jul 09, 2004 5:18 pm

Re: Display setting for read-only files?

Post by Radu »

Hi,

Does your custom CSS contain more content than what you pasted above?
So you have this problem for the DITA Map rendering even if you comment out the Java code which sets the pseudo class on the root element "authorPage.getDocumentController().setPseudoClass" in the plugin, right?
In the Oxygen Preferences->"Document Type Associations" page you created an extension of the "DITA Map" framework, right? And in that framework extension in the "Author->CSS" tab you added a reference to your custom CSS, right?
So you did something probably similar to this article:
https://blog.oxygenxml.com/topics/customizeDITACSS.html
When you added a reference to your custom CSS you also have the option to specify a title (and you should leave that empty) and there is also an "Alternate" checkbox, you need to leave that unchecked.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply