On 21 Sep 2015 at 10:16:00, PATEL, ABDULKADAR
(abdulkadar.patel@capgemini.com(mailto:abdulkadar.patel@capgemini.com)) wrote:
Hi Vincent,
Thanks for your response.
I know it might be very trivial issue but as I am working on xwiki first time,
I don’t know basic things and that’s why bugging all of you with my silly doubts.
To achieve this use case, I have followed below steps :
1. Modified xwiki-min.js file to bind a javascript code which will display a popup dialog
on click of ctrl+shift+N
You shouldn’t do that. You should use a Javascript Extension instead,
see
http://platform.xwiki.org/xwiki/bin/view/DevGuide/SkinExtensionsTutorial
2. This dialog fetches projects and issue types from
jira server and displays as dropdown
ok
3. Once user clicks on submit, a jira issue is created
ok
4. Now I need to display a link near text selected by
user in step 1 but don’t know how to do it.
This is not really related to XWiki (unless you wish to reuse the Annotation code but then
I don’t now this code enough to know if you can do this or not).
In any case you could check the Annotation code to understand how it’s done there,
basically how to find the location of some text in the content.
I guess there are at least 2 ways:
* Do that using JS and thus insert your link using JS
* Do it on the server side using the Rendering engine (this is what Annotation is doing I
think) and add some specific HTML marker so that by using JS you can easily insert the
link.
In any case what you wish to do is something complex and requires good knowledge of JS
(and possibly of XWiki’s Rendering if you choose this solution).
Thanks
-Vincent
I have attached code I have added in xwiki-min.js
You can also suggest if this is a right approach and if I can follow some other
approach.
Thanks & Regards,
Abdulkadar Patel
P.S. I have not kept xwiki developers mail list since this mail becomes huge and will
need approval from list moderator.
From: Vincent Massol [mailto:vmassol@gmail.com] On Behalf Of vincent(a)massol.net
Sent: Monday, September 21, 2015 12:52 PM
To: XWiki Developers
Cc: PATEL, ABDULKADAR
Subject: Re: [xwiki-devs] Display link on xwiki page
Hi there,
On 18 Sep 2015 at 15:25:44, PATEL, ABDULKADAR
(abdulkadar.patel@capgemini.com(mailto:abdulkadar.patel@capgemini.com))(mailto:abdulkadar.patel@capgemini.com(mailto:abdulkadar.patel@capgemini.com)))
wrote:
Hi all,
Sorry to bug all of you again and again with the same requirement.
But I am also helpless till I get it done.
I have ebelow use case :
1. User selects some text on an xwiki page and hits some keyboard shortcut say
Alt+ctrl+N
2. This opens a popup dialog like shown below :
[file:///Users/vmassol/Library/Containers/it.bloop.airmail.beta11/Data/Library/Application
Support/Airmail/General/Local/1442819908355112192/Attachments/image004.jpg@01D0F242.DD794520(mailto:Support/Airmail/General/Local/1442819908355112192/Attachments/image004.jpg@01D0F242.DD794520)]
3. As you can see in the screenshot, it displays list of projects, issue types from JIRA
server.
Issue summary field is pre-populated with the selected text from xwiki page.
4. Once user submits this dialog, an issue is created in JIRA and a link will be created
on xwiki page besides selected
text.
So far I have achieved 1,2 and 3 but not able to achieve 4
One option I thought of is to create an annotation for the selected text with text as a
link to JIRA issue
But I don't understand how to achive this from javascript code.
I have written javascript code in webapps/xwiki/resources/js/xwiki/xwiki-min.js file
Please suggest me an approach to achive point no 4.
Also suggest me if there is a better and cleaner approach.
I’m not sure I understand the problem. Step 4 seems easy. You just need a form action
which calls a wiki page (possibly the current page passing some parameter) and then using
Velocity for example to create the JIRA issue using the JIRA REST API.
Thanks
-Vincent
Thanks & Regards,
____________________________________________________________________
[file:///Users/vmassol/Library/Containers/it.bloop.airmail.beta11/Data/Library/Application
Support/Airmail/General/Local/1442819908355112192/Attachments/image001.gif@01D0F241.1B349010]Abdulkadar(mailto:Support/Airmail/General/Local/1442819908355112192/Attachments/image001.gif@01D0F241.1B349010%5dAbdulkadar)
Patel
Consultant | GESBU