Changeset 25721

Show
Ignore:
Timestamp:
31.05.2012 12:58:12 (7 years ago)
Author:
kjdon
Message:

the delete user javascript is repeated several times in the page, and each redefinition of the variables seemd to be overriding the previous ones. So for each click on delete, you would get the same message about deleting the last user. The click would actually delete the right one, but the message was wrong. So I have added position info to the var names, eg username1, username2 etc so they don't affect each other

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/web/interfaces/default/transform/pages/authen.xsl

    r25697 r25721  
    7878                        </tr> 
    7979                        <xsl:for-each select="/page/pageResponse/authenticationNode/service/userNodeList/userNode"> 
     80           
    8081                            <tr class="ui-widget-content"> 
    8182                                <td><xsl:value-of select="@username"/></td> 
     
    9596                                <td><a href="{$library_name}/admin/EditUser?s1.username={@username}"><button><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.edit')"/></button></a></td> 
    9697                                <td> 
    97                                     <form method="GET" action="{$library_name}/admin/PerformDeleteUser"> 
     98                                <xsl:variable name="user-pos">username<xsl:number value="position()"/></xsl:variable> 
     99                                                        <xsl:variable name="message-pos">confirmMessage<xsl:number value="position()"/></xsl:variable>  
     100          <form method="GET" action="{$library_name}/admin/PerformDeleteUser"> 
    98101                                        <input type="hidden" name="s1.username" value="{@username}"/> 
    99102                                        <input id="delUser{@username}" type="submit" value="{util:getInterfaceText($interface_name, /page/@lang, 'authen.delete')}"/> 
     
    101104                                            <xsl:text disable-output-escaping="yes"> 
    102105                                            { 
    103                                                 var username = "</xsl:text><xsl:value-of select="@username"/><xsl:text disable-output-escaping="yes">"; 
    104                                                 var confirmMessage = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.delete_warning')"/><xsl:text disable-output-escaping="yes">"; 
    105                                                 var button = $("#delUser" + username); 
     106                                                var </xsl:text><xsl:value-of select="$user-pos"/><xsl:text disable-output-escaping="yes"> = "</xsl:text><xsl:value-of select="@username"/><xsl:text disable-output-escaping="yes">"; 
     107                                                var </xsl:text><xsl:value-of select="$message-pos"/><xsl:text disable-output-escaping="yes"> = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'authen.delete_warning')"/><xsl:text disable-output-escaping="yes">" + </xsl:text><xsl:value-of select="$user-pos"/><xsl:text disable-output-escaping="yes"> + "?"; 
     108                                                var button = $("#delUser" + </xsl:text><xsl:value-of select="$user-pos"/><xsl:text disable-output-escaping="yes">); 
    106109                                                button.click(function() 
    107110                                                { 
    108                                                     if(confirm(confirmMessage + username + "?")) 
     111                                                    if(confirm(</xsl:text><xsl:value-of select="$message-pos"/><xsl:text disable-output-escaping="yes">)) 
    109112                                                    { 
    110113                                                        return true;