<!-- BEGIN {$smarty.template} -->
{literal}
<script type="text/javascript">
$(document).ready(function() {
    $("#tab_container").tabs();
    $('#checkall').click(function() {
        var clk = $(this).attr('checked');
        $("#userperm input[type='checkbox']:not([disabled='disabled'])").each(function() { $(this).attr('checked', clk); }); 
    });
});
</script>
{/literal}

<form action="{$SELF}" method="post" id="userform">
<input type="hidden" name="id" value="{$user.usr_id}">
<input type="hidden" name="action" value="{$smarty.const.ACTION_UPDATE}">

<div id="tab_container">
    <ul class="tab_items">
        <li><a href="#user-details" rel="user-details">{t}Settings{/t}</a></li>   
        {if $privmanage}<li><a href="#user-permissions" rel="user-permissions">{t}Permissions{/t}</a></li>{/if}
    </ul>

    <div id="user-details" class="tab_content">

        <table class="detail" cellspacing="0">
            <caption><em>{$user.usr_login}</em></caption>
            <tr>
                <th> {t}Login{/t}: </th>
                <td> {$user.usr_login|wash} </td>
            </tr>
            <tr>
                <th> {t}Name{/t}: </th>
                <td> <a href="person.php?id={$user.pe_id}">{$user.usr_name|wash}</a> </td>
            </tr>
            <tr>
                <th> {t}Language{/t}: </th>
                <td>
                    <select name="lng_id">
                        {html_options options=$languages selected=$user.lng_id}
                    </select>
                </td>
            </tr>
            <tr>
                <th> {t}Theme{/t}: </th>
                <td>
                    <select name="usr_skin">
                        {html_options options=$skins selected=$user.skin}
                    </select>
                </td>
            </tr>
            <tr><th> {t}Password{/t} </th><th>&nbsp;</th></tr>
            <tr>
                <th> {t}Old{/t}: </th>
                <td> <input type="password" class="tinput" name="usr_pwd_old" value="" size="10" maxlength="15"> * </td>
            </tr>
            <tr>
                <th> {t}New{/t}: </th>
                <td> <input type="password" class="tinput" name="usr_pwd_new" value="" size="10" maxlength="15"> * </td>
            </tr>
            <tr>
                <th> {t}Confirm{/t}: </th>
                <td> <input type="password" class="tinput" name="usr_pwd_confirm" value="" size="10" maxlength="15"> * </td>
            </tr>
            <tr><th colspan="2">* {t}Leave these empty to keep the current password.{/t}</th></tr>

        </table>

        <table class="detail" cellspacing="0">
            <caption><em>{t}Settings{/t}</em></caption>
            <tr>
                <th>{t}Number of records shown per page{/t}</th>
                <td>
                    <input maxlength="4" size="4" value="{$smarty.const.PHPAGA_RECORDS_PERPAGE|wash}" name="userconfig[RECORDS_PERPAGE]" type="text" class="tinput r">
                </td>
            </tr>
        </table>

        <div>
            <input type="submit" value="{t}Save{/t}">
            <input type="button" name="cancel" value="{t}Cancel{/t}" onclick="location.href='main.php';">
        </div>
    </div>



    {if $privmanage}
    <div id="user-permissions" class="tab_content">
        <table id="userperm" class="detail" cellspacing="0">
            <caption>
                <em>{t}Permissions{/t}</em>
                <input name="checkall" id="checkall" type="checkbox">
            </caption>
            <tbody>
                <tr>
                    <th><label for="perm{$smarty.const.PHPAGA_PERM_VIEW_FINANCE}">{$perm[$smarty.const.PHPAGA_PERM_VIEW_FINANCE]}</label></th>
                    <td><input type="checkbox" class="cbox" name="perm[]" value="{$smarty.const.PHPAGA_PERM_VIEW_FINANCE}" id="perm{$smarty.const.PHPAGA_PERM_VIEW_FINANCE}" {$permchecked[$smarty.const.PHPAGA_PERM_VIEW_FINANCE]}> </td>
                    <th><label for="perm{$smarty.const.PHPAGA_PERM_VIEW_INVOICES}">{$perm[$smarty.const.PHPAGA_PERM_VIEW_INVOICES]}</label></th>
                    <td><input type="checkbox" class="cbox" name="perm[]" value="{$smarty.const.PHPAGA_PERM_VIEW_INVOICES}" id="perm{$smarty.const.PHPAGA_PERM_VIEW_INVOICES}" {$permchecked[$smarty.const.PHPAGA_PERM_VIEW_INVOICES]}> </td>
                </tr>
                <tr>
                    <th><label for="perm{$smarty.const.PHPAGA_PERM_VIEW_QUOTATIONS}">{$perm[$smarty.const.PHPAGA_PERM_VIEW_QUOTATIONS]}</label></th>
                    <td><input type="checkbox" class="cbox" name="perm[]" value="{$smarty.const.PHPAGA_PERM_VIEW_QUOTATIONS}" id="perm{$smarty.const.PHPAGA_PERM_VIEW_QUOTATIONS}" {$permchecked[$smarty.const.PHPAGA_PERM_VIEW_QUOTATIONS]}> </td>
                    <th><label for="perm{$smarty.const.PHPAGA_PERM_MANAGE_INVOICES}">{$perm[$smarty.const.PHPAGA_PERM_MANAGE_INVOICES]}</label></th>
                    <td><input type="checkbox" class="cbox" name="perm[]" value="{$smarty.const.PHPAGA_PERM_MANAGE_INVOICES}" id="perm{$smarty.const.PHPAGA_PERM_MANAGE_INVOICES}" {$permchecked[$smarty.const.PHPAGA_PERM_MANAGE_INVOICES]}> </td>
                </tr>
                <tr>
                    <th><label for="perm{$smarty.const.PHPAGA_PERM_MANAGE_QUOTATIONS}">{$perm[$smarty.const.PHPAGA_PERM_MANAGE_QUOTATIONS]}</label></th>
                    <td><input type="checkbox" class="cbox" name="perm[]" value="{$smarty.const.PHPAGA_PERM_MANAGE_QUOTATIONS}" id="perm{$smarty.const.PHPAGA_PERM_MANAGE_QUOTATIONS}" {$permchecked[$smarty.const.PHPAGA_PERM_MANAGE_QUOTATIONS]}> </td>
                    <th><label for="perm{$smarty.const.PHPAGA_PERM_VIEW_OTHERPROJECTS}">{$perm[$smarty.const.PHPAGA_PERM_VIEW_OTHERPROJECTS]}</label></th>
                    <td><input type="checkbox" class="cbox" name="perm[]" value="{$smarty.const.PHPAGA_PERM_VIEW_OTHERPROJECTS}" id="perm{$smarty.const.PHPAGA_PERM_VIEW_OTHERPROJECTS}" {$permchecked[$smarty.const.PHPAGA_PERM_VIEW_OTHERPROJECTS]}> </td>
                </tr>
                <tr>
                    <th><label for="perm{$smarty.const.PHPAGA_PERM_MANAGE_PROJECTS}">{$perm[$smarty.const.PHPAGA_PERM_MANAGE_PROJECTS]}</label></th>
                    <td><input type="checkbox" class="cbox" name="perm[]" value="{$smarty.const.PHPAGA_PERM_MANAGE_PROJECTS}" id="perm{$smarty.const.PHPAGA_PERM_MANAGE_PROJECTS}" {$permchecked[$smarty.const.PHPAGA_PERM_MANAGE_PROJECTS]}> </td>
                    <th><label for="perm{$smarty.const.PHPAGA_PERM_MANAGE_OTHERPROJECTS}">{$perm[$smarty.const.PHPAGA_PERM_MANAGE_OTHERPROJECTS]}</label></th>
                    <td><input type="checkbox" class="cbox" name="perm[]" value="{$smarty.const.PHPAGA_PERM_MANAGE_OTHERPROJECTS}" id="perm{$smarty.const.PHPAGA_PERM_MANAGE_OTHERPROJECTS}" {$permchecked[$smarty.const.PHPAGA_PERM_MANAGE_OTHERPROJECTS]}> </td>
                </tr>
                <tr>
                    <th><label for="perm{$smarty.const.PHPAGA_PERM_MANAGE_ALLTASKS}">{$perm[$smarty.const.PHPAGA_PERM_MANAGE_ALLTASKS]}</label></th>
                    <td><input type="checkbox" class="cbox" name="perm[]" value="{$smarty.const.PHPAGA_PERM_MANAGE_ALLTASKS}" id="perm{$smarty.const.PHPAGA_PERM_MANAGE_ALLTASKS}" {$permchecked[$smarty.const.PHPAGA_PERM_MANAGE_ALLTASKS]}> </td>
                    <th><label for="perm{$smarty.const.PHPAGA_PERM_MANAGE_OTHERPERSONS}">{$perm[$smarty.const.PHPAGA_PERM_MANAGE_OTHERPERSONS]}</label></th>
                    <td><input type="checkbox" class="cbox" name="perm[]" value="{$smarty.const.PHPAGA_PERM_MANAGE_OTHERPERSONS}" id="perm{$smarty.const.PHPAGA_PERM_MANAGE_OTHERPERSONS}" {$permchecked[$smarty.const.PHPAGA_PERM_MANAGE_OTHERPERSONS]}> </td>
                </tr>
                <tr>
                    <th><label for="perm{$smarty.const.PHPAGA_PERM_VIEW_ALLTASKS}">{$perm[$smarty.const.PHPAGA_PERM_VIEW_ALLTASKS]}</label></th>
                    <td><input type="checkbox" class="cbox" name="perm[]" value="{$smarty.const.PHPAGA_PERM_VIEW_ALLTASKS}" id="perm{$smarty.const.PHPAGA_PERM_VIEW_ALLTASKS}" {$permchecked[$smarty.const.PHPAGA_PERM_VIEW_ALLTASKS]}> </td>
                    <th><label for="perm{$smarty.const.PHPAGA_PERM_MANAGE_OTHERCOMPANIES}">{$perm[$smarty.const.PHPAGA_PERM_MANAGE_OTHERCOMPANIES]}</label></th>
                    <td><input type="checkbox" class="cbox" name="perm[]" value="{$smarty.const.PHPAGA_PERM_MANAGE_OTHERCOMPANIES}" id="perm{$smarty.const.PHPAGA_PERM_MANAGE_OTHERCOMPANIES}" {$permchecked[$smarty.const.PHPAGA_PERM_MANAGE_OTHERCOMPANIES]}> </td>
                </tr>
                <tr>
                    <th><label for="perm{$smarty.const.PHPAGA_PERM_VIEW_OTHERMEMTASKS}">{$perm[$smarty.const.PHPAGA_PERM_VIEW_OTHERMEMTASKS]}</label></th>
                    <td><input type="checkbox" class="cbox" name="perm[]" value="{$smarty.const.PHPAGA_PERM_VIEW_OTHERMEMTASKS}" id="perm{$smarty.const.PHPAGA_PERM_VIEW_OTHERMEMTASKS}" {$permchecked[$smarty.const.PHPAGA_PERM_VIEW_OTHERMEMTASKS]}> </td>
                    <th><label for="perm{$smarty.const.PHPAGA_PERM_MANAGE_SYSSETTINGS}">{$perm[$smarty.const.PHPAGA_PERM_MANAGE_SYSSETTINGS]}</label></th>
                    <td><input type="checkbox" class="cbox" name="perm[]" value="{$smarty.const.PHPAGA_PERM_MANAGE_SYSSETTINGS}" id="perm{$smarty.const.PHPAGA_PERM_MANAGE_SYSSETTINGS}" {$permchecked[$smarty.const.PHPAGA_PERM_MANAGE_SYSSETTINGS]}> </td>
                </tr>
            </tbody>
        </table>
        <div>
            <input type="submit" value="{t}Save{/t}">
            <input type="button" name="cancel" value="{t}Cancel{/t}" onclick="location.href='main.php';">
        </div>
    </div>
    {/if}

</div>

</form>

<!-- END {$smarty.template} -->
