[xwiki-dev] xredirect on a confirm delete action

Arnaud Thimel thimel at codelutin.com
Mon Apr 2 21:58:09 CEST 2007


Hi all,

Nobody replied to my mail so I suppose I wasn't not clear enough.
I'll try to correct this.

When sending a request to
   
/xwiki/bin/delete/Plans/aaaa?confirm=1&xredirect=/xwiki/bin/view/Plans/bbbb
I would like the doc 'aaaa' to be deleted and my browser to be 
redirected to the document 'bbbb'.

Actually, it indeed deletes the doc but it keeps displaying the 
confirmation screen : "Your document has been deleted..."

In the DeleteAction, redirect was done only if the "confirm" parameter 
was absent :

[before patch]

        String confirm = request.getParameter("confirm");
        if ((confirm!=null)&&(confirm.equals("1"))) {
            // Deletion code....
            [...]
*        } else {
*            String redirect = Utils.getRedirect(request, null);
            if (redirect==null)
                return true;
            else {
                sendRedirect(response, redirect);
                return false;
            }
*        }
*

 For my personal need, I changed it to enable the redirect in any case :

[after patch]

        String confirm = request.getParameter("confirm");
        if ((confirm!=null)&&(confirm.equals("1"))) {
            // Deletion code....
            [...]
*        }
*        String redirect = Utils.getRedirect(request, null);
        if (redirect==null)
            return true;
        else {
            sendRedirect(response, redirect);
            return false;
        }


I can't see the reason to redirect only when there is no confirmation, 
can anyone help me ?

Thanks,
Arnaud.


Arnaud Thimel wrote:
> Hi all,
>
> I tried to use the xredirect functionnality on a confirm delete action
>
> I would like the URL :
>
> /xwiki/bin/delete/Plans/aaaa?confirm=1&xredirect=/xwiki/bin/view/Plans/bbbb 
>
> to delete the doc aaaa and then redirect to the doc bbbb
>
> If I remove the confirmation (confirm=1) my redirect is OK but, as I
> don't confirm deletion, my doc aaaa is still here.
>
> I patched my own version of XWiki because I need it, but I would like to
> know if this is volunteer (and so why ?) or if I should submit my patch.
>
> Thanks
>


-- 
Arnaud Thimel
Société Code Lutin - http://www.codelutin.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xwiki.org/pipermail/devs/attachments/20070402/c7dd4f0c/attachment.htm 


More information about the devs mailing list