<?xml version="1.0"?>
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp" xmlns:sdx="http://www.culture.gouv.fr/ns/sdx/sdx">
    <sdx:page langSession="lang" langParam="lang">
        <xsp:logic>
    if (!sdx_frame.isSuperUserSet() 
    &amp;&amp; request.getParameter("new-id") != null)
    {
        sdx_frame.setSuperUser(
            request.getParameter("old-id"),
            request.getParameter("old-pass"), 
            request.getParameter("new-id"), 
            request.getParameter("new-pass"), 
            request.getParameter("firstname"), 
            request.getParameter("lastname"), 
            request.getParameter("email"), 
            request.getParameter("userlang")
        );
            <!-- login just after to show modifs -->
            <sdx:loginSu idParam="new-id" passParam="new-pass"/>
    }
    
    
    <!-- show modify page if no superuser -->
    if (!sdx_frame.isSuperUserSet())
    {
        <superuser-not-set/>
            <modify/>
            <bar/>
    }

        </xsp:logic>
        <!-- choices if logged as a superuser, or show login form -->
        <sdx:userIsSu>
            <!-- modify superuser infos -->
            <modify>
                <old/>
            </modify>
            <xsp:logic>
                if (
                request.getParameter("old-id") != null
                ) <!-- trying to modify -->
                {
                    <setSuperUser/>
                    sdx_frame.setSuperUser(
                        request.getParameter("old-id"),
                        request.getParameter("old-pass"), 
                        request.getParameter("new-id"), 
                        request.getParameter("new-pass"), 
                        request.getParameter("firstname"), 
                        request.getParameter("lastname"), 
                        request.getParameter("email"), 
                        request.getParameter("userlang")
                    );
                    <!-- login just after to show modifs -->
                <sdx:loginSu idParam="new-id" passParam="new-pass"/>

                }
    
                </xsp:logic>
            <sdx:fallback>
                <isnot-superuser/>
            </sdx:fallback>
        </sdx:userIsSu>
        <sdx:userIsSu>
            <bar>
                <button id="welcome" href="index.xsp"/>
                <button id="login" href="loginsu.xsp"/>
                <button id="apps" href="apps.xsp"/>
                <button id="su" href="superuser.xsp" self="true"/>
                <button id="reconfigure" href="reconfigure.xsp"/>
            </bar>
            <sdx:fallback>
                <bar>
                    <button id="welcome" href="index.xsp"/>
                    <button id="login" href="loginsu.xsp" self="true"/>
                </bar>
            </sdx:fallback>
        </sdx:userIsSu>
    </sdx:page>
</xsp:page>
