Page 1 of 1

[JSOperation] Open a read-only file

Posted: Mon Feb 17, 2020 6:31 pm
by odurand47
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.

Re: [JSOperation] Open a read-only file

Posted: Tue Feb 18, 2020 9:33 am
by Radu
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