Overriding / Enrich arguments in defined actions
Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
-
- Posts: 240
- Joined: Wed Jun 17, 2015 12:46 pm
Overriding / Enrich arguments in defined actions
Hello,
We're using Author web 25.1.0.0 version.
From the javascript, we want to call an operation
https://www.oxygenxml.com/doc/versions/ ... soperation
Its purpose is to perform a sequence of operations defined in the framework via the list of actionIds passed as parameter.
This works well for fragment insertion actions with fixed arguments.
The complexity of our requirement is that the various operations to be performed depend on the input data carried by the javascript.
In fact, we need to enrich certain fragments to be inserted with javascript information.
Example of a called XML operation defined in the framework:
We want to take advantage of the framework's existing mechanism for defining actions and operations, but also be able to override certain arguments OR enrich certain arguments with information contained in the javascript.
Does this sound feasible?
Thanks for your help,
Johann
We're using Author web 25.1.0.0 version.
From the javascript, we want to call an operation
https://www.oxygenxml.com/doc/versions/ ... soperation
Its purpose is to perform a sequence of operations defined in the framework via the list of actionIds passed as parameter.
This works well for fragment insertion actions with fixed arguments.
The complexity of our requirement is that the various operations to be performed depend on the input data carried by the javascript.
In fact, we need to enrich certain fragments to be inserted with javascript information.
Example of a called XML operation defined in the framework:
Code: Select all
<a:operationid="InsertFragmentOperation">
<a:arguments>
<a:argumentname="fragment"><entry><para>${valueFromJavascript}</para></entry></a:argument>
<a:argumentname="insertLocation">ancestor-or-self::entry[1]</a:argument>
<a:argumentname="insertPosition">After</a:argument>
</a:arguments>
</a:operation>
Does this sound feasible?
Thanks for your help,
Johann
-
- Site Admin
- Posts: 172
- Joined: Tue Mar 20, 2018 5:28 pm
Re: Overriding / Enrich arguments in defined actions
Post by Bogdan Dumitru »
Hello,
One solution would be that instead of invoking ExecuteMultipleWebappCompatibleActionsOperation, define a custom AuthorOperation and from that operation manually call the other operations. You can pass to the custom operation your valueFromJavascript and then you can pass/dispatch it to another operation when invoking. To manually call another operation you have to simply instantiate it and call its "doOperation" method.
One solution would be that instead of invoking ExecuteMultipleWebappCompatibleActionsOperation, define a custom AuthorOperation and from that operation manually call the other operations. You can pass to the custom operation your valueFromJavascript and then you can pass/dispatch it to another operation when invoking. To manually call another operation you have to simply instantiate it and call its "doOperation" method.
Bogdan Dumitru
http://www.oxygenxml.com
http://www.oxygenxml.com
-
- Posts: 240
- Joined: Wed Jun 17, 2015 12:46 pm
Re: Overriding / Enrich arguments in defined actions
Hello Bogdan,
thank you for your response.
In the last part of your response, you say:
As I was saying, I'm trying to find a way of having my actions defined in the .framework file, but being able to inject information into the operation arguments of that action.
Thank you,
Johann
thank you for your response.
In the last part of your response, you say:
I agree but the invoked operation is not defined in the .framework file in that case, is it ?You can pass to the custom operation your valueFromJavascript and then you can pass/dispatch it to another operation when invoking. To manually call another operation you have to simply instantiate it and call its "doOperation" method.
As I was saying, I'm trying to find a way of having my actions defined in the .framework file, but being able to inject information into the operation arguments of that action.
Thank you,
Johann
-
- Site Admin
- Posts: 172
- Joined: Tue Mar 20, 2018 5:28 pm
Re: Overriding / Enrich arguments in defined actions
Post by Bogdan Dumitru »
Hi,
One correction: in the .framework you can only define actions, not operations. Operations are Java classes that implement the AuthorOperation interface.
The above solution doesn't work if you want to reuse actions defined in the framework because it works just with operations.
Another solution would be to use ask variables and let the user fill in the value for valueFromJavascript. Notice that ExecuteMultipleOperations is not annotated with @WebappCompatible, thus if you define actions and add them on the toolbar they won't be visible on Web Author, so you should use ExecuteMultipleWebappCompatibleActionsOperation instead.
One correction: in the .framework you can only define actions, not operations. Operations are Java classes that implement the AuthorOperation interface.
The above solution doesn't work if you want to reuse actions defined in the framework because it works just with operations.
Another solution would be to use ask variables and let the user fill in the value for valueFromJavascript. Notice that ExecuteMultipleOperations is not annotated with @WebappCompatible, thus if you define actions and add them on the toolbar they won't be visible on Web Author, so you should use ExecuteMultipleWebappCompatibleActionsOperation instead.
Bogdan Dumitru
http://www.oxygenxml.com
http://www.oxygenxml.com
-
- Posts: 240
- Joined: Wed Jun 17, 2015 12:46 pm
Re: Overriding / Enrich arguments in defined actions
Hello,
So, in my case, the valueFromJavascript corresponds to a response of a webservice and not a user choice.
Regards,
Johann
The only way to populate ask variables is through a user form, right? Or is there another way?Another solution would be to use ask variables and let the user fill in the value for valueFromJavascript
So, in my case, the valueFromJavascript corresponds to a response of a webservice and not a user choice.
Regards,
Johann
-
- Site Admin
- Posts: 172
- Joined: Tue Mar 20, 2018 5:28 pm
Re: Overriding / Enrich arguments in defined actions
Post by Bogdan Dumitru »
Hi,
The only solution is to invoke each action individually, and for the ones that need valueFromJavascript to invoke the actual operation with valueFromJavascript as an argument.
The only solution is to invoke each action individually, and for the ones that need valueFromJavascript to invoke the actual operation with valueFromJavascript as an argument.
Bogdan Dumitru
http://www.oxygenxml.com
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service