[xwiki-users] Invalid URL after a $xwiki.getURL() + deconnection
Hi list, I have a really weird bug which is quite annoying and I don't find any solution to it : I want to edit a page in inline mode. I have a form to select the page to edit with a button. I use the $xwiki.getURL() method to get the right URL. When i select my page and click on the edit button, I have an invalid URL error and i am deconnected. What is weird is that if I reconnect and actualize the page I can access it. The second weird thing is that I use exactly the same method to edit other pages form other forms in the same first page and I do not have the problem. I am quite lost with this issue. I tried to recreate the URL as a string but I have the same problem. I am thinking maybe this is a known bug in xwiki. If not maybe i am missing something somewhere. Please open my eyes on the obvious i am missing in my code : <FORM method=POST action=""> <input type="hidden" name="backlog" value="${backlogId}" /> <input type="hidden" name="webname" value="Project" /> <input type="hidden" name="name" value="backlog" /> <input type="hidden" name="domain" value="${domainId}" /> <input type="hidden" name="cut" value="${cut}" /> Select topic : <SELECT name="topic"> #foreach ($item in $topiclist) #set ($topic=$xwiki.getDocument(${item}).getObject("XWiki.TopicClass")) <OPTION VALUE="${topic.id}">$topic.get("name")</OPTION> #end </SELECT> <input type="button" value="Select" onclick='{this.form.action="../../view/" + this.form.webname.value + "/" + this.form.name.value + "?backlog=" + this.form.backlog.value + "&domain=" + this.form.domain.value + "&topic=" + this.form.topic.value.substring(this.form.topic.value.lastIndexOf("${separator}")+1) + "&cut=" + this.form.cut.value; this.form.submit(); }'/> <input type="button" value="Edit" onclick='{url="Project."+this.form.topic.value; this.form.action="${xwiki.getURL(url, "inline")}"; this.form.submit(); }' /> </FORM> Note that the problem is only with the Edit button, the other is working fine. Thanks in advance for your help. Jean. -- ---- Jean Couteau Code Lutin - http://www.codelutin.com 44 Bd des Pas Enchantés - 44230 St-Sébastien/Loire Tél : 02 40 50 29 28 - Fax : 09 59 92 29 28
Hi Jean, I don't have the answer to your question but seen the questions you've been asking I can deduce that you're doing some advanced usage of XWiki :) That's great. I'm curious to know what you're using it for. Thanks -Vincent On Feb 24, 2009, at 10:48 AM, Jean Couteau wrote:
Hi list,
I have a really weird bug which is quite annoying and I don't find any solution to it :
I want to edit a page in inline mode. I have a form to select the page to edit with a button. I use the $xwiki.getURL() method to get the right URL. When i select my page and click on the edit button, I have an invalid URL error and i am deconnected. What is weird is that if I reconnect and actualize the page I can access it. The second weird thing is that I use exactly the same method to edit other pages form other forms in the same first page and I do not have the problem. I am quite lost with this issue. I tried to recreate the URL as a string but I have the same problem.
I am thinking maybe this is a known bug in xwiki. If not maybe i am missing something somewhere. Please open my eyes on the obvious i am missing in my code :
<FORM method=POST action=""> <input type="hidden" name="backlog" value="${backlogId}" /> <input type="hidden" name="webname" value="Project" /> <input type="hidden" name="name" value="backlog" /> <input type="hidden" name="domain" value="${domainId}" /> <input type="hidden" name="cut" value="${cut}" /> Select topic : <SELECT name="topic"> #foreach ($item in $topiclist) #set ($topic=$xwiki.getDocument(${item}).getObject("XWiki.TopicClass")) <OPTION VALUE="${topic.id}">$topic.get("name")</OPTION> #end </SELECT> <input type="button" value="Select" onclick='{this.form.action="../../view/" + this.form.webname.value + "/" + this.form.name.value + "?backlog=" + this.form.backlog.value + "&domain=" + this.form.domain.value + "&topic=" + this.form.topic.value.substring(this.form.topic.value.lastIndexOf("$ {separator}")+1) + "&cut=" + this.form.cut.value; this.form.submit(); }'/> <input type="button" value="Edit" onclick='{url="Project."+this.form.topic.value; this.form.action="${xwiki.getURL(url, "inline")}"; this.form.submit(); }' /> </FORM>
Note that the problem is only with the Edit button, the other is working fine.
Thanks in advance for your help.
Jean.
Vincent Massol a écrit :
Hi Jean,
I don't have the answer to your question but seen the questions you've been asking I can deduce that you're doing some advanced usage of XWiki :)
That's great. I'm curious to know what you're using it for.
I don't know if advanced is the word, but indeed I use if for an application aimed to manage backlog for a scrum team. It is used for two weeks now (in a not complete and bugged version), and when I will have removed the annoying bugs, I think I will make it available on xwiki.org. For now, it features backlog creation (with arborescence on the user stories), backlog planning, effort vote (for poker planning) and sprint/release assignment. I plan to make it manage the dashboard, the task assignations, an automatic velocity and burndown chart calculation, an automatic roadmap building, and maybe other ideas that will come with the time ;). Anyway this bug is the last that makes the application unstable. After solving it, I think I'll be able to make the application available for other users.
Thanks -Vincent
On Feb 24, 2009, at 10:48 AM, Jean Couteau wrote:
Hi list,
I have a really weird bug which is quite annoying and I don't find any solution to it :
I want to edit a page in inline mode. I have a form to select the page to edit with a button. I use the $xwiki.getURL() method to get the right URL. When i select my page and click on the edit button, I have an invalid URL error and i am deconnected. What is weird is that if I reconnect and actualize the page I can access it. The second weird thing is that I use exactly the same method to edit other pages form other forms in the same first page and I do not have the problem. I am quite lost with this issue. I tried to recreate the URL as a string but I have the same problem.
I am thinking maybe this is a known bug in xwiki. If not maybe i am missing something somewhere. Please open my eyes on the obvious i am missing in my code :
<FORM method=POST action=""> <input type="hidden" name="backlog" value="${backlogId}" /> <input type="hidden" name="webname" value="Project" /> <input type="hidden" name="name" value="backlog" /> <input type="hidden" name="domain" value="${domainId}" /> <input type="hidden" name="cut" value="${cut}" /> Select topic : <SELECT name="topic"> #foreach ($item in $topiclist) #set ($topic=$xwiki.getDocument(${item}).getObject("XWiki.TopicClass")) <OPTION VALUE="${topic.id}">$topic.get("name")</OPTION> #end </SELECT> <input type="button" value="Select" onclick='{this.form.action="../../view/" + this.form.webname.value + "/" + this.form.name.value + "?backlog=" + this.form.backlog.value + "&domain=" + this.form.domain.value + "&topic=" + this.form.topic.value.substring(this.form.topic.value.lastIndexOf("$ {separator}")+1) + "&cut=" + this.form.cut.value; this.form.submit(); }'/> <input type="button" value="Edit" onclick='{url="Project."+this.form.topic.value; this.form.action="${xwiki.getURL(url, "inline")}"; this.form.submit(); }' /> </FORM>
Note that the problem is only with the Edit button, the other is working fine.
Thanks in advance for your help.
Jean.
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- ---- Jean Couteau Code Lutin - http://www.codelutin.com 44 Bd des Pas Enchantés - 44230 St-Sébastien/Loire Tél : 02 40 50 29 28 - Fax : 09 59 92 29 28
On Feb 24, 2009, at 2:19 PM, Jean Couteau wrote:
Vincent Massol a écrit :
Hi Jean,
I don't have the answer to your question but seen the questions you've been asking I can deduce that you're doing some advanced usage of XWiki :)
That's great. I'm curious to know what you're using it for.
I don't know if advanced is the word, but indeed I use if for an application aimed to manage backlog for a scrum team. It is used for two weeks now (in a not complete and bugged version), and when I will have removed the annoying bugs, I think I will make it available on xwiki.org.
For now, it features backlog creation (with arborescence on the user stories), backlog planning, effort vote (for poker planning) and sprint/release assignment.
I plan to make it manage the dashboard, the task assignations, an automatic velocity and burndown chart calculation, an automatic roadmap building, and maybe other ideas that will come with the time ;).
Anyway this bug is the last that makes the application unstable. After solving it, I think I'll be able to make the application available for other users.
Sounds great! I'm eager to try it out. Thanks for explaining -Vincent
Thanks -Vincent
On Feb 24, 2009, at 10:48 AM, Jean Couteau wrote:
Hi list,
I have a really weird bug which is quite annoying and I don't find any solution to it :
I want to edit a page in inline mode. I have a form to select the page to edit with a button. I use the $xwiki.getURL() method to get the right URL. When i select my page and click on the edit button, I have an invalid URL error and i am deconnected. What is weird is that if I reconnect and actualize the page I can access it. The second weird thing is that I use exactly the same method to edit other pages form other forms in the same first page and I do not have the problem. I am quite lost with this issue. I tried to recreate the URL as a string but I have the same problem.
I am thinking maybe this is a known bug in xwiki. If not maybe i am missing something somewhere. Please open my eyes on the obvious i am missing in my code :
<FORM method=POST action=""> <input type="hidden" name="backlog" value="${backlogId}" /> <input type="hidden" name="webname" value="Project" /> <input type="hidden" name="name" value="backlog" /> <input type="hidden" name="domain" value="${domainId}" /> <input type="hidden" name="cut" value="${cut}" /> Select topic : <SELECT name="topic"> #foreach ($item in $topiclist) #set ($topic=$xwiki.getDocument(${item}).getObject("XWiki.TopicClass")) <OPTION VALUE="${topic.id}">$topic.get("name")</OPTION> #end </SELECT> <input type="button" value="Select" onclick='{this.form.action="../../view/" + this.form.webname.value + "/" + this.form.name.value + "?backlog=" + this.form.backlog.value + "&domain=" + this.form.domain.value + "&topic=" + this.form.topic.value.substring(this.form.topic.value.lastIndexOf("$ {separator}")+1) + "&cut=" + this.form.cut.value; this.form.submit(); }'/> <input type="button" value="Edit" onclick='{url="Project."+this.form.topic.value; this.form.action="${xwiki.getURL(url, "inline")}"; this.form.submit(); }' /> </FORM>
Note that the problem is only with the Edit button, the other is working fine.
Thanks in advance for your help.
Jean.
Jean Couteau wrote:
Hi list,
I have a really weird bug which is quite annoying and I don't find any solution to it :
I want to edit a page in inline mode. I have a form to select the page to edit with a button. I use the $xwiki.getURL() method to get the right URL. When i select my page and click on the edit button, I have an invalid URL error and i am deconnected. What is weird is that if I reconnect and actualize the page I can access it. The second weird thing is that I use exactly the same method to edit other pages form other forms in the same first page and I do not have the problem. I am quite lost with this issue. I tried to recreate the URL as a string but I have the same problem.
I am thinking maybe this is a known bug in xwiki. If not maybe i am missing something somewhere. Please open my eyes on the obvious i am missing in my code :
<FORM method=POST action=""> <input type="hidden" name="backlog" value="${backlogId}" /> <input type="hidden" name="webname" value="Project" /> <input type="hidden" name="name" value="backlog" /> <input type="hidden" name="domain" value="${domainId}" /> <input type="hidden" name="cut" value="${cut}" /> Select topic : <SELECT name="topic"> #foreach ($item in $topiclist) #set ($topic=$xwiki.getDocument(${item}).getObject("XWiki.TopicClass")) <OPTION VALUE="${topic.id}">$topic.get("name")</OPTION> #end </SELECT> <input type="button" value="Select" onclick='{this.form.action="../../view/" + this.form.webname.value + "/" + this.form.name.value + "?backlog=" + this.form.backlog.value + "&domain=" + this.form.domain.value + "&topic=" + this.form.topic.value.substring(this.form.topic.value.lastIndexOf("${separator}")+1) + "&cut=" + this.form.cut.value; this.form.submit(); }'/> <input type="button" value="Edit" onclick='{url="Project."+this.form.topic.value; this.form.action="${xwiki.getURL(url, "inline")}"; this.form.submit(); }' />
Classic mix between serverside and clientside scripting. ${xwiki.getURL...} is executed on the server, before the page is displayed in the browser. url is a javascript variable, created long after the velocity engine tried to generate the URL. I'm surprised you didn't get a stack trace instead of the panel. Still, this doesn't explain why you get disconnected, this should not happen. Try this: <input type="button" value="Edit" onclick='this.form.action="${xwiki.getURL("Project.__topic__", "inline")}".replace("__topic__", this.form.topic.value); this.form.submit();' /> This uses $xwiki.getURL to obtain a valid URL template, which uses a placeholder (__topic__) instead of the real topic name, which in the generated HTML appears as a string like "/xwiki/bin/inline/Project/__topic__", and javascript replaces this placeholder with the real value taken from the form.
</FORM>
Note that the problem is only with the Edit button, the other is working fine.
Thanks in advance for your help.
Jean.
-- Sergiu Dumitriu http://purl.org/net/sergiu/
Sergiu Dumitriu a écrit :
Jean Couteau wrote:
Hi list,
I have a really weird bug which is quite annoying and I don't find any solution to it :
I want to edit a page in inline mode. I have a form to select the page to edit with a button. I use the $xwiki.getURL() method to get the right URL. When i select my page and click on the edit button, I have an invalid URL error and i am deconnected. What is weird is that if I reconnect and actualize the page I can access it. The second weird thing is that I use exactly the same method to edit other pages form other forms in the same first page and I do not have the problem. I am quite lost with this issue. I tried to recreate the URL as a string but I have the same problem.
I am thinking maybe this is a known bug in xwiki. If not maybe i am missing something somewhere. Please open my eyes on the obvious i am missing in my code :
<FORM method=POST action=""> <input type="hidden" name="backlog" value="${backlogId}" /> <input type="hidden" name="webname" value="Project" /> <input type="hidden" name="name" value="backlog" /> <input type="hidden" name="domain" value="${domainId}" /> <input type="hidden" name="cut" value="${cut}" /> Select topic : <SELECT name="topic"> #foreach ($item in $topiclist) #set ($topic=$xwiki.getDocument(${item}).getObject("XWiki.TopicClass")) <OPTION VALUE="${topic.id}">$topic.get("name")</OPTION> #end </SELECT> <input type="button" value="Select" onclick='{this.form.action="../../view/" + this.form.webname.value + "/" + this.form.name.value + "?backlog=" + this.form.backlog.value + "&domain=" + this.form.domain.value + "&topic=" + this.form.topic.value.substring(this.form.topic.value.lastIndexOf("${separator}")+1) + "&cut=" + this.form.cut.value; this.form.submit(); }'/> <input type="button" value="Edit" onclick='{url="Project."+this.form.topic.value; this.form.action="${xwiki.getURL(url, "inline")}"; this.form.submit(); }' />
Classic mix between serverside and clientside scripting.
That was the obvious ;)
${xwiki.getURL...} is executed on the server, before the page is displayed in the browser. url is a javascript variable, created long after the velocity engine tried to generate the URL. I'm surprised you didn't get a stack trace instead of the panel.
Still, this doesn't explain why you get disconnected, this should not happen.
A lot of strange things are happening with this issue. I used this method because the previous one was not working.
Try this:
<input type="button" value="Edit" onclick='this.form.action="${xwiki.getURL("Project.__topic__", "inline")}".replace("__topic__", this.form.topic.value); this.form.submit();' />
This does not work, nothing happens, I stay on the same page and i am still connected. Strange. I tried also with : <input type="button" value="Edit" onclick='{this.form.action="../../inline/" + this.form.webname.value + "/" + this.form.topic.value; this.form.submit(); }' /> and <input type="button" value="Edit" onclick='{this.form.action="../../inline/Project/" + this.form.topic.value; this.form.submit(); }' /> I am then disconnected and still have my invalid url (Strange though because this method gave me a good url in almost the same form on the same page (instead of topic, it is domain ;)). (Note that if i validate the invalid url (that is in my browser address bar), i go to the page i wanted to reach and i am connected, refreshing does not work).
This uses $xwiki.getURL to obtain a valid URL template, which uses a placeholder (__topic__) instead of the real topic name, which in the generated HTML appears as a string like "/xwiki/bin/inline/Project/__topic__", and javascript replaces this placeholder with the real value taken from the form Thanks for this explanation, clearer for me now ;).
Thanks for your time. Jean -- ---- Jean Couteau Code Lutin - http://www.codelutin.com 44 Bd des Pas Enchantés - 44230 St-Sébastien/Loire Tél : 02 40 50 29 28 - Fax : 09 59 92 29 28
I finally found what was the problem... Ludovic, after seeing you at Solutions Linux, I had a look with firebug... In fact, i was not disconnected, it was just that the invalid url page is displayed as if I was logged out (not any trace of delete cookie as you thought). Regarding the invalid url, it came from the select named topic, renaming it blabla, everything works fine. Maybe XWiki uses topic string for another matter, I don't know but anyway, it works fine now. Jean Couteau a écrit :
Sergiu Dumitriu a écrit :
Jean Couteau wrote:
Hi list,
I have a really weird bug which is quite annoying and I don't find any solution to it :
I want to edit a page in inline mode. I have a form to select the page to edit with a button. I use the $xwiki.getURL() method to get the right URL. When i select my page and click on the edit button, I have an invalid URL error and i am deconnected. What is weird is that if I reconnect and actualize the page I can access it. The second weird thing is that I use exactly the same method to edit other pages form other forms in the same first page and I do not have the problem. I am quite lost with this issue. I tried to recreate the URL as a string but I have the same problem.
I am thinking maybe this is a known bug in xwiki. If not maybe i am missing something somewhere. Please open my eyes on the obvious i am missing in my code :
<FORM method=POST action=""> <input type="hidden" name="backlog" value="${backlogId}" /> <input type="hidden" name="webname" value="Project" /> <input type="hidden" name="name" value="backlog" /> <input type="hidden" name="domain" value="${domainId}" /> <input type="hidden" name="cut" value="${cut}" /> Select topic : <SELECT name="topic"> #foreach ($item in $topiclist) #set ($topic=$xwiki.getDocument(${item}).getObject("XWiki.TopicClass")) <OPTION VALUE="${topic.id}">$topic.get("name")</OPTION> #end </SELECT> <input type="button" value="Select" onclick='{this.form.action="../../view/" + this.form.webname.value + "/" + this.form.name.value + "?backlog=" + this.form.backlog.value + "&domain=" + this.form.domain.value + "&topic=" + this.form.topic.value.substring(this.form.topic.value.lastIndexOf("${separator}")+1) + "&cut=" + this.form.cut.value; this.form.submit(); }'/> <input type="button" value="Edit" onclick='{url="Project."+this.form.topic.value; this.form.action="${xwiki.getURL(url, "inline")}"; this.form.submit(); }' />
Classic mix between serverside and clientside scripting.
That was the obvious ;)
${xwiki.getURL...} is executed on the server, before the page is displayed in the browser. url is a javascript variable, created long after the velocity engine tried to generate the URL. I'm surprised you didn't get a stack trace instead of the panel.
Still, this doesn't explain why you get disconnected, this should not happen.
A lot of strange things are happening with this issue. I used this method because the previous one was not working.
Try this:
<input type="button" value="Edit" onclick='this.form.action="${xwiki.getURL("Project.__topic__", "inline")}".replace("__topic__", this.form.topic.value); this.form.submit();' />
This does not work, nothing happens, I stay on the same page and i am still connected. Strange.
I tried also with :
<input type="button" value="Edit" onclick='{this.form.action="../../inline/" + this.form.webname.value + "/" + this.form.topic.value; this.form.submit(); }' />
and
<input type="button" value="Edit" onclick='{this.form.action="../../inline/Project/" + this.form.topic.value; this.form.submit(); }' />
I am then disconnected and still have my invalid url (Strange though because this method gave me a good url in almost the same form on the same page (instead of topic, it is domain ;)). (Note that if i validate the invalid url (that is in my browser address bar), i go to the page i wanted to reach and i am connected, refreshing does not work).
This uses $xwiki.getURL to obtain a valid URL template, which uses a placeholder (__topic__) instead of the real topic name, which in the generated HTML appears as a string like "/xwiki/bin/inline/Project/__topic__", and javascript replaces this placeholder with the real value taken from the form
Thanks for this explanation, clearer for me now ;).
Thanks for your time. Jean
-- ---- Jean Couteau Code Lutin - http://www.codelutin.com 44 Bd des Pas Enchantés - 44230 St-Sébastien/Loire Tél : 02 40 50 29 28 - Fax : 09 59 92 29 28
participants (3)
-
Jean Couteau -
Sergiu Dumitriu -
Vincent Massol