How to create a new button in oxygen and on click that button need to insert the tags and current date?
Post here questions and problems related to oXygen frameworks/document types.
How to create a new button in oxygen and on click that button need to insert the tags and current date?
Hi,
I want to create new button in oxygen and if user click that button insert the tags and current date and scenarios as mentoined below
Scenarios :
Case 1 :
User clicks button in Oxygen, prolog , change history list and change item elements appears change completed with current date and time and change summary appears , user adds modification
Case 2:
If prolog element already exists:
user clicks the button and change -history list added with change item and change completed with curretn date and time and change summary and user adds modifications
Case 3:
If prolog element and change history list already exist:
user clicks the button and change item is added with change completed with current date and time and change summary and user adds modifications
Thanks
Venkatesh
I want to create new button in oxygen and if user click that button insert the tags and current date and scenarios as mentoined below
Scenarios :
Case 1 :
User clicks button in Oxygen, prolog , change history list and change item elements appears change completed with current date and time and change summary appears , user adds modification
Case 2:
If prolog element already exists:
user clicks the button and change -history list added with change item and change completed with curretn date and time and change summary and user adds modifications
Case 3:
If prolog element and change history list already exist:
user clicks the button and change item is added with change completed with current date and time and change summary and user adds modifications
Thanks
Venkatesh
Re: How to create a new button in oxygen and on click that button need to insert the tags and current date?
Hi Venkatesh,
What type of XML vocabulary are you editing? Is it DITA XML or something else?
What you want looks similar to what our free Prolog Updater add-on for DITA XML content does:
https://www.oxygenxml.com/doc/versions/ ... dater.html
Only that our prolog updater updates the prolog automatically when the content is saved.
Our prolog updater add-on is implemented as an open source Oxygen Java plugin:
https://github.com/oxygenxml/oxygen-dit ... ater-addon
Coming back to what you requested, if the end user is edited the XML content in the Author visual editing mode and you want this for DITA XML topics, you can extend the DITA framework customization and add your own custom Author actions to the toolbar, menus:
https://blog.oxygenxml.com/topics/custo ... etion.html
Each custom Author action can have multiple activation xpath expression, each expression with a custom operation which can be invoked when that Xpath expression is evaluated to true:
https://www.oxygenxml.com/doc/versions/ ... ialog.html
Regards,
Radu
What type of XML vocabulary are you editing? Is it DITA XML or something else?
What you want looks similar to what our free Prolog Updater add-on for DITA XML content does:
https://www.oxygenxml.com/doc/versions/ ... dater.html
Only that our prolog updater updates the prolog automatically when the content is saved.
Our prolog updater add-on is implemented as an open source Oxygen Java plugin:
https://github.com/oxygenxml/oxygen-dit ... ater-addon
Coming back to what you requested, if the end user is edited the XML content in the Author visual editing mode and you want this for DITA XML topics, you can extend the DITA framework customization and add your own custom Author actions to the toolbar, menus:
https://blog.oxygenxml.com/topics/custo ... etion.html
Each custom Author action can have multiple activation xpath expression, each expression with a custom operation which can be invoked when that Xpath expression is evaluated to true:
https://www.oxygenxml.com/doc/versions/ ... ialog.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: How to create a new button in oxygen and on click that button need to insert the tags and current date?
Hi Radu,
Prolog Updater: https://www.oxygenxml.com/doc/versions/ ... dater.html ,
https://github.com/oxygenxml/oxygen-dit ... ater-addon
I have tried with prolog updater addon this method not satisfying the current requirement.
Adding a Custom Author Action to the Content Completion Window :
https://blog.oxygenxml.com/topics/custo ... etion.html
I have tried with Adding a Custom Author Action, from this I am able to create three separate buttons for each scenario.
Now I want to merge or create one specific button that button should include all three scenarios.
or Is there any way to include if else conditions in InsertFragmentOperation?
Thanks,
Venkatesh
Prolog Updater: https://www.oxygenxml.com/doc/versions/ ... dater.html ,
https://github.com/oxygenxml/oxygen-dit ... ater-addon
I have tried with prolog updater addon this method not satisfying the current requirement.
Adding a Custom Author Action to the Content Completion Window :
https://blog.oxygenxml.com/topics/custo ... etion.html
I have tried with Adding a Custom Author Action, from this I am able to create three separate buttons for each scenario.
Now I want to merge or create one specific button that button should include all three scenarios.
or Is there any way to include if else conditions in InsertFragmentOperation?
Thanks,
Venkatesh
Re: How to create a new button in oxygen and on click that button need to insert the tags and current date?
Hi Venkatesh,
As I previously told you each custom Author action can have multiple activation xpath expression, each expression with a custom operation which can be invoked when that Xpath expression is evaluated to true:
https://www.oxygenxml.com/doc/versions/ ... ialog.html
So an Author action when customized can have multiple XPath activation contexts, in each of these contexts calling a different Author operation.
I'm attaching two screenshots showing how I recently configured for our needs an action which has 4 activation contexts and inserts content in the prolog or if the prolog is missing inserts the prolog with the content inside it:
Regards,
Radu
Ok.I have tried with prolog updater addon this method not satisfying the current requirement.
Great, now we need to reduce the three actions you created to one action which does three things, depending on the context.I have tried with Adding a Custom Author Action, from this I am able to create three separate buttons for each scenario.
Now I want to merge or create one specific button that button should include all three scenarios.
As I previously told you each custom Author action can have multiple activation xpath expression, each expression with a custom operation which can be invoked when that Xpath expression is evaluated to true:
https://www.oxygenxml.com/doc/versions/ ... ialog.html
So an Author action when customized can have multiple XPath activation contexts, in each of these contexts calling a different Author operation.
I'm attaching two screenshots showing how I recently configured for our needs an action which has 4 activation contexts and inserts content in the prolog or if the prolog is missing inserts the prolog with the content inside it:
- Screenshot 2023-10-03 at 13.36.17.png (226.75 KiB) Viewed 3603 times
- Screenshot 2023-10-03 at 13.36.25.png (245.81 KiB) Viewed 3603 times
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: How to create a new button in oxygen and on click that button need to insert the tags and current date?
Hi Radu,
I am able to write the xpaths expression for three scenarios, but when i am trying to execute the three scenarios it's working fine for up to only two scenarios and third scenario not working.
I'm attaching two screenshots for three scenarios and please review and suggest me where i am wrong?
1.Case
2.Case
3.Case
Case 3:
In Case 3 Need to get only below code
Thanks
Venkatesh
I am able to write the xpaths expression for three scenarios, but when i am trying to execute the three scenarios it's working fine for up to only two scenarios and third scenario not working.
I'm attaching two screenshots for three scenarios and please review and suggest me where i am wrong?
1.Case
- Screenshot 1.png (67.36 KiB) Viewed 3573 times
- Screenshot 2.png (67.66 KiB) Viewed 3573 times
- Screenshot 3.png (67.15 KiB) Viewed 3573 times
Code: Select all
<topic id="topic_kr1_gmr_zyb">
<title>Topic Added</title>
<prolog>
<change-historylist id="topic_obt_j4r_zyb">
<change-item>
<change-completed>2023-10-04 3:35</change-completed>
<change-summary/>
</change-item>
</change-historylist>
</prolog>
</topic>
In Case 3 Need to get only below code
Code: Select all
<change-item>
<change-completed>2023-10-04 3:35</change-completed>
<change-summary/>
</change-item>
Venkatesh
Re: How to create a new button in oxygen and on click that button need to insert the tags and current date?
Hi Venkatesh,
So focusing on the third XPath activator, it is something like this:
This means that the action will have the xpath context enabled and call the operation only when the caret position is inside the "change-historylist" element or a descendant of it. Is this what you want?
Regards,
Radu
So focusing on the third XPath activator, it is something like this:
Code: Select all
ancestor-or-self:: *[contains @class, ' topic/change-historylist"')]
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: How to create a new button in oxygen and on click that button need to insert the tags and current date?
Hi Radu,
Yes this action will have the xpath context enabled and inside this "change-historylist" is already present in this scenario.
i want to add only below part
this xpath expression i have tried but it's not working.
Venkatesh
Yes this action will have the xpath context enabled and inside this "change-historylist" is already present in this scenario.
i want to add only below part
Code: Select all
<change-item>
<change-completed>2023-10-04 3:35</change-completed>
<change-summary/>
</change-item>
ancestor-or-self::*[contains(@class, ' topic/topic ')][*[contains(@class, ' topic/prolog')]][*[contains(@class, ' topic/change-historylist')]][*[contains(@class, ' topic/change-item')]]
Thanksancestor-or-self:: *[contains(@class, ' topic/change-historylist')]
Venkatesh
Last edited by venkatesh on Thu Oct 05, 2023 8:22 am, edited 1 time in total.
Re: How to create a new button in oxygen and on click that button need to insert the tags and current date?
Hi Venkatesh,
The activation XPath in this case should look like this (I will write it on multiple lines just to show its structure more clearly:
Here is some advice:
1) When you place the caret inside a DITA XML element in Oxygen, you can look in the "Attributes" view to see the default value for the "class" attribute. For example the "change-historylist" has the default class value "+ topic/metadata relmgmt-d/change-historylist " so I'm matching in the XPath expression the last token "relmgmt-d/change-historylist" from the list of values.
2) If you open a DITA topic in Oxygen containing some content like this:
and place the caret in that paragraph, you can use Oxygen "XPath" toolbar or "XPath/XQuery Builder" view to run an XPath expression and test it against the opened topic. In this way you can refine your XPath expressions until they start working and then you can use them in the framework customization.
Regards,
Radu
The activation XPath in this case should look like this (I will write it on multiple lines just to show its structure more clearly:
Code: Select all
ancestor-or-self::*[contains(@class, ' topic/topic ')][
*[contains(@class, ' topic/prolog')][
*[contains(@class, ' relmgmt-d/change-historylist ')][
*[contains(@class, ' relmgmt-d/change-item ')]
]
]
]
1) When you place the caret inside a DITA XML element in Oxygen, you can look in the "Attributes" view to see the default value for the "class" attribute. For example the "change-historylist" has the default class value "+ topic/metadata relmgmt-d/change-historylist " so I'm matching in the XPath expression the last token "relmgmt-d/change-historylist" from the list of values.
2) If you open a DITA topic in Oxygen containing some content like this:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="getting_started">
<title>Getting Started</title>
<prolog>
<change-historylist>
<change-item>
<change-completed />
</change-item>
</change-historylist>
</prolog>
<body>
<p>CARET_HERE</p>
</body>
</topic>
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: How to create a new button in oxygen and on click that button need to insert the tags and current date?
Hi Radu,
I am able develope the history button based on sceanrios as mentoined above, but in change-person i need to get the full-name of logged person?
As of now I am able to get the user.name using this code <change-person>${system(user.name)}</change-person>.
Is there any system-properties to get the fullname of user?
I am able develope the history button based on sceanrios as mentoined above, but in change-person i need to get the full-name of logged person?
As of now I am able to get the user.name using this code <change-person>${system(user.name)}</change-person>.
Is there any system-properties to get the fullname of user?
- Attachments
-
- Screenshot (389).png (253.82 KiB) Viewed 2808 times
Re: How to create a new button in oxygen and on click that button need to insert the tags and current date?
Hi,
There is this specific editor variable:
Regards,
Radu
There is this specific editor variable:
https://www.oxygenxml.com/doc/ug-editor ... ables.html${author.name} - Expands to the current author name that is set in the Review preferences page.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
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