Oxygen button modification

Post here questions and problems related to oXygen frameworks/document types.
patraadi
Posts: 3
Joined: Thu Feb 22, 2024 1:45 pm

Oxygen button modification

Post by patraadi »

issue.png
issue.png (36.93 KiB) Viewed 597 times
Hi,
I have created a button in Oxygen Tool.
On click it generates the tags like change-item, change-completed and change-summary tags. (in red box as shown in image)
On clicking the button again it generates the same. (in green box as shown in image)
But I want the latest change/last modified to be on top of the entry.
If you consider the image attached the text inside green block should be above the red box.
Can you please suggest me How to resolve this?

Thanks & regards
Aditya
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Oxygen button modification

Post by Radu »

Hi Aditya,
So this button is for the Oxygen desktop application, not for the WebAuthor in-browser editor, right?
Can you paste some code showing me how you implemented the button's functionality? How do you decide the offset in the document where to insert the XML fragment?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
patraadi
Posts: 3
Joined: Thu Feb 22, 2024 1:45 pm

Re: Oxygen button modification

Post by patraadi »

Hi Radu,
I have developed this button through framework "https://blog.oxygenxml.com/topics/custo ... etion.html".
Sure, here is snippet of the code:

This is the XML fragment -
<prolog><change-historylist><change-item><change-person>${system(user.name)}</change-person><change-completed>${date(yyyy-MM-dd h:mm)}</change-completed><change-summary ></change-summary></change-item></change-historylist></prolog>

The implementation of button's functionality -
ancestor-or-self::*[contains(@class, ' topic/prolog')] and not(ancestor-or-self::*[contains(@class, ' topic/topic ')]/*[contains(@class, ' topic/prolog')])

And regarding the button you can see it enclosed in red box.
activation.png
activation.png (228.08 KiB) Viewed 551 times
fragment.png
fragment.png (37.39 KiB) Viewed 551 times
button gen1.png
button gen1.png (131.09 KiB) Viewed 551 times
Thanks & regards
Aditya
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Oxygen button modification

Post by Radu »

Hi Aditya,

I do not understand this xpath expression you are using:

Code: Select all

ancestor-or-self::*[contains(@class, ' topic/prolog')] and not(ancestor-or-self::*[contains(@class, ' topic/topic ')]/*[contains(@class, ' topic/prolog')])
If I were to translate it to a human readable description it means "when the caret is inside a subelement of prolog but there is no prolog in the entire topic". In my opinion it always evaluates to "false".
I see in the screenshot you have a two operation tabs [1] and [2], how did you configure the [2] tab?

I would probably have the activation xpath expression for [1] like this:

Code: Select all

ancestor-or-self::topic[prolog[changehistory]]
as I want to enable the action no matter where the caret is, as long as there is a prolog already inserted in the topic with a changehistory element inside it.
, the fragment parameter I would pass directly as "<change-item>....." because the <changehistory> element is already there.
, the "insertLocation" I would pass as "ancestor-or-self::topic/prolog/changehistory"
, the "insertPosition" "Inside as first child" as it is now.

And you can create other activation modes as well using the "+" button, for example a context where there is a prolog but the changehistory list is missing from it so the operation also needs to insert a changehistory element.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
patraadi
Posts: 3
Joined: Thu Feb 22, 2024 1:45 pm

Re: Oxygen button modification

Post by patraadi »

Hi radu,

I have developed this button through framework "https://blog.oxygenxml.com/topics/custo ... etion.html".

Here is the attachment:
query1.png
query1.png (196.26 KiB) Viewed 473 times
(Here the tags enclosed in green box is the 1st generation and blue box is 2nd generation).
The Generate button is the button that i have generated.
The button that I have generated when clicked it generates the tags like change-item, change-completed and change-summary tags and when clicked again it displays the same, but my requirement is that it should keep the latest update generation on top. (Taking above image as reference it should have blue box with tags on top and green box with tags below it).

And coming onto the actions part, here is the attachment:
Action.png
Action.png (145.11 KiB) Viewed 473 times
(In the activation part I have updated the activation path code specified by you

Code: Select all

ancestor-or-self::topic[prolog[changehistory]]
).
And regarding the operation 1 I have kept the fargment as :

Code: Select all

<prolog><change-historylist><change-item><change-person>${system(user.name)}</change-person><change-completed>${date(yyyy-MM-dd h:mm)}</change-completed><change-summary ></change-summary></change-item></change-historylist></prolog>
(Which is the standard XML Format specified by client).

Insertocation:

Code: Select all

ancestor-or-self::*[contains(@class, ' topic/prolog ')]
(This basically checks for hierarchy of template and if found then inserts the tags in it).

Insert Position as: Insert as first child.

For operation 2, here is the attachment:
Action2.png
Action2.png (120.93 KiB) Viewed 473 times
(this basically includes the tags from change-item).
Here is the code:

Code: Select all

<change-item><change-person>${system(user.name)}</change-person><change-completed>${date(yyyy-MM-dd h:mm)}</change-completed><change-summary ></change-summary></change-item>
.

Insert position as: After

Thanks & regards,
Aditya
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Oxygen button modification

Post by Radu »

Hi Aditya,
If you still have problems with this maybe you can export the entire action to an XML file and either zip and attach it to this forum thread or send it to us (support@oxygenxml.com).
Screenshot 2024-02-26 at 08.06.52.png
Screenshot 2024-02-26 at 08.06.52.png (173.02 KiB) Viewed 470 times
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
sorin_carbunaru
Posts: 402
Joined: Mon May 09, 2016 9:37 am

Re: Oxygen button modification

Post by sorin_carbunaru »

Hi,

So, I took your action, edited the activation XPath expression to change "changehistory" to "change-historylist", and when I used it, the newer entries where at the top:
image.png
image.png (31.54 KiB) Viewed 445 times
Cheers,
Sorin Carbunaru
Oxygen XML Editor
Post Reply