<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1">
    <xsl:import href="../user/share_user_search.xsl"/>
    <xsl:variable name="php_version">php4</xsl:variable>
    <xsl:variable name="jlex_path"><xsl:value-of select="concat('../',$php_version)"/></xsl:variable>
    <xsl:template match="user">
        <xsl:variable name="username">
            <xsl:value-of select="username"/>
        </xsl:variable>
        <xsl:variable name="email">
            <xsl:value-of select="email"/>
        </xsl:variable>
        <tr>
            <td>
                <input type="checkbox" name="usernames[]">
                    <xsl:attribute name="value">
                        <xsl:value-of select="$username"/>
                    </xsl:attribute>
                </input>
            </td>
            <td>
                <xsl:value-of select="lname"/>
            </td>
            <td>
                <xsl:value-of select="fname"/>
            </td>
            <td><xsl:value-of select="category"/></td>
            <td>
                <a target="my_dictionary">
                    <xsl:attribute name="href">
                        <xsl:value-of select="concat($jlex_path,'/mydictionary.',$php_version,'?function=admin_view&amp;view_user=',$username)"/>
                    </xsl:attribute>
                    <xsl:value-of select="username"/>
                </a>
            </td>
            <td>
                <a>
                    <xsl:attribute name="href">
                        <xsl:value-of select="concat('mailto:',$email)"/>
                    </xsl:attribute>
                    <xsl:value-of select="email"/>
                </a>
            </td>
            <td>
                <xsl:value-of select="password"/>
            </td>
            <td>
                <xsl:value-of select="date"/>
            </td>
            <td align="center">
                <xsl:value-of select="login_count"/>
            </td>
            <td>
                <xsl:value-of select="last_login"/>
            </td>     
        </tr>
    </xsl:template>
    
    <xsl:template match="defaults">
        <xsl:apply-imports/>
    </xsl:template>
        
    <xsl:template match="/">
        <html>
            <head>
                <title>Account Manager</title>                
                <script language="javascript" type="text/javascript">
                    var checkflag = "false";
                    function check(field_name) {
                        var field = document.forms[0].elements[field_name];
                        if(checkflag == "false") {
                            for(i=0;i&lt;field.length;i++) {
                                field[i].checked = true; 
                            }
                            checkflag="true";
                        }
                        else {
                            for(i=0;i&lt;field.length;i++) {
                                field[i].checked = false; 
                            }
                            checkflag="false";
                        }
                    }
                </script>
            </head>
            <body>
                <center>                    
                <form name="user_accounts" method="post">
                    <xsl:attribute name="action"><xsl:value-of select="concat('../',$php_version,'/mydictionary.',$php_version)"/></xsl:attribute> 
                    <input type="hidden" name="function" value="admin_add_refs"/>
                    <table border="1">
                        <tr>
                            <th>Share Refs?<input type="button" onclick="check('usernames[]')" value="all"/></th>
                            <th>Last Name</th>
                            <th>First Name</th>
                            <th>Category</th>
                            <th>Username</th>
                            <th>Email</th>
                            <th>Password</th>
                            <th>Date Created</th>
                            <th>Login Count</th>
                            <th>Last Login</th>
                        </tr>
                        <xsl:apply-templates select="//resultset/user"/>
                        <tr>
                            <td colspan="8" align="center">
                                <input type="submit" value="Share Words"/>
                            </td>
                        </tr>
                    </table>
                </form>
                    <xsl:apply-templates select="document('../user/defaults.xml')//defaults"/>
                    <p><a>
                        <xsl:attribute name="href"><xsl:value-of select="concat('../nahuatl/html_',$php_version,'/mydictionary_search.html')"/></xsl:attribute>
                        <img src="../nahuatl/images/Back2.gif" width="60" height="60" border="0"/></a></p>
                    <b><font size="3" face="Arial" color="#D46702">Click to return to search page!</font></b>
                </center>
                
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>
