[JSOperation] Open a read-only file

Post here questions and problems related to oXygen frameworks/document types.
odurand47
Posts: 3
Joined: Tue Feb 04, 2020 10:16 am

[JSOperation] Open a read-only file

Post by odurand47 » Mon Feb 17, 2020 6:31 pm

Hi,

I have this Custom JSOperation script that opens a file from a ditamap to do operations on all topics. But I'd like to be able to open files in read-only mode from the beginning, the setEditable() function works but my content manager requires a check-in/discard (not the case for file with read only permission). Is this possible?

Code: Select all

authorAccess.getWorkspaceAccess().open(hRef, "Author");	
controller = authorAccess.getWorkspaceAccess().getEditorAccess(hRef);
//controller.setEditable(false);	
controllerPage = controller.getCurrentPage();
results = controllerPage.authorAccess.getDocumentController().findNodesByXPath("(//*/row)[last()]", true, true, true);
comp = results[0].getTextContent();
controller.close(false);
Thanks,
Olivier Durand.

Radu
Posts: 7032
Joined: Fri Jul 09, 2004 5:18 pm

Re: [JSOperation] Open a read-only file

Post by Radu » Tue Feb 18, 2020 9:33 am

Hi Olivier,

We do not have APIs for check in and discard. These are probably actions implemented by the CMS integration plugin installed in Oxygen. So they would probably somehow need to offer you the API to call for these actions.
Maybe you could also try this alternate API we have:

ro.sync.exml.workspace.api.standalone.S ... ], String)

The method:

ro.sync.ecss.extensions.api.component.C ... L, Reader)

would load content from the URL (or from the alternative reader) in a component which would have about the same API as an opened editor.
But the component would not show on screen.
I'm not sure though, Oxygen at some point will attempt to retrieve content from that URL, the way in which this retrieval is implemented in the CMS plugin is not controlled by us.

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

Post Reply