<commit_before><%inherit file="ui.home:templates/template.mako"/>
<%inherit file="ui.management:templates/tree_scripts.mako"/>
<%namespace name="tree" file="ui.management:templates/tree_scripts.mako"/>

<%def name="render_item(key, value, level)">
    <input type="hidden" value="" name="edit_permissions">
    %for perm in permissions:
        % if perm in value['permission_names']:
            <div class="perm_checkbox">
                <input type="checkbox" value="${perm}" name="permission"
                       onchange="document.getElementById('resource_${value['id']}_${value.get('remote_id', '')}').submit()" checked
                %if inherit_groups_permissions:
                    disabled
                %endif
                >
           </div>
        % else:
            <div class="perm_checkbox">
                <input type="checkbox" value="${perm}" name="permission"
                       onchange="document.getElementById('resource_${value['id']}_${value.get('remote_id', '')}').submit()"
                %if inherit_groups_permissions:
                    disabled
                %endif
                >
            </div>
        % endif
    %endfor
    % if not value.get('matches_remote', True):
        <div class="tree_button">
            <input type="submit" class="button warning" value="Clean" name="clean_resource">
        </div>
        <p class="tree_item_message">
            <img title="This resource is absent from the remote server."
                 src="${request.static_url('magpie.ui.home:static/warning_exclamation_orange.png')}" />
        </p>
    % endif
    % if level == 0:
        <div class="tree_button">
            <input type="submit" class="tree_button goto_service" value="Edit Service" name="goto_service">
        </div>
    % endif
</%def>


<%block name="breadcrumb">
<li><a href="${request.route_url('home')}">Home</a></li>
<li><a href="${request.route_url('view_users')}">Users</a></li>
<li><a href="${request.route_url('edit_user', user_name=user_name, cur_svc_type=cur_svc_type)}">User ${user_name}</a></li>
</%block>

<h1>Edit User: ${user_name}</h1>

<h3>User Information</h3>


<div class="panel_box">
    <form id="edit_info" action="${request.path}" method="post">
        <div class="panel_heading">
            <span class="panel_title">User: </span>
            <span class="panel_value">${user_name}</span>
            <span class="panel_heading_button">
                <input type="submit" value="Delete" name="delete" class="button delete">
            </span>
        </div>
        <div class="panel_body">
            <div class="panel_box">
                <div class="panel_heading">
                    <div class="panel_title">Details</div>
                </div>
                <div>
                    <p class="panel_line">
                        <span class="panel_entry">Username: </span>
                        %if edit_mode == 'edit_username':
                            <input type="text" value="${user_name}" name="new_user_name"
                                   id="input_username" onkeyup="adjustWidth('input_name')">
                            <input type="submit" value="Save" name="save_username">
                            <input type="submit" value="Cancel" name="no_edit">
                        %else:
                            <span class="panel_value">${user_name}</span>
                            <input type="submit" value="Edit" name="edit_username">
                        %endif
                    </p>
                    <p class="panel_line">
                        <span class="panel_entry">Password: </span>
                        %if edit_mode == 'edit_password':
                            <input type="text" value="" name="new_user_password"
                                   id="input_password" onkeyup="adjustWidth('input_name')">
                            <input type="submit" value="Save" name="save_password">
                            <input type="submit" value="Cancel" name="no_edit">
                        %else:
                            <span class="panel_value">***</span>
                            <input type="submit" value="Edit" name="edit_password">
                        %endif
                    </p>
                    <p class="panel_line">
                        <span class="panel_entry">Email: </span>
                        %if edit_mode == 'edit_email':
                            <input type="text" value="${email}" name="new_user_email"
                                   id="input_email" onkeyup="adjustWidth('input_url')">
                            <input type="submit" value="Save" name="save_email">
                            <input type="submit" value="Cancel" name="no_edit">
                        %else:
                            <span class="panel_value">${email}</span>
                            <input type="submit" value="Edit" name="edit_email">
                        %endif
                    </p>
                </div>
            </div>
        </div>
    </form>
</div>


<h3>Groups Membership</h3>

<form id="edit_membership" action="${request.path}" method="post">
    <input type="hidden" value="True" name="edit_group_membership"/>
    <table>
    %for group in groups:
    <tr>
        % if group in own_groups:
            <td>
                <input type="checkbox" value="${group}" name="member" checked
                       onchange="document.getElementById('edit_membership').submit()">
                ${group}
            </td>
        % else:
            <td>
                <input type="checkbox" value="${group}" name="member"
                       onchange="document.getElementById('edit_membership').submit()">
                ${group}
            </td>
        % endif
    </tr>
    %endfor
    </table>
</form>

<h3>Permissions</h3><commit_msg>fix issue #209<commit_after><%inherit file="ui.home:templates/template.mako"/>
<%inherit file="ui.management:templates/tree_scripts.mako"/>
<%namespace name="tree" file="ui.management:templates/tree_scripts.mako"/>

<%def name="render_item(key, value, level)">
    <input type="hidden" value="" name="edit_permissions">
    %for perm in permissions:
        % if perm in value['permission_names']:
            <div class="perm_checkbox">
                <input type="checkbox" value="${perm}" name="permission"
                       onchange="document.getElementById('resource_${value['id']}_${value.get('remote_id', '')}').submit()" checked
                %if inherit_groups_permissions:
                    disabled
                %endif
                >
           </div>
        % else:
            <div class="perm_checkbox">
                <input type="checkbox" value="${perm}" name="permission"
                       onchange="document.getElementById('resource_${value['id']}_${value.get('remote_id', '')}').submit()"
                %if inherit_groups_permissions:
                    disabled
                %endif
                >
            </div>
        % endif
    %endfor
    % if not value.get('matches_remote', True):
        <div class="tree_button">
            <input type="submit" class="button warning" value="Clean" name="clean_resource">
        </div>
        <p class="tree_item_message">
            <img title="This resource is absent from the remote server."
                 src="${request.static_url('magpie.ui.home:static/warning_exclamation_orange.png')}" />
        </p>
    % endif
    % if level == 0:
        <div class="tree_button">
            <input type="submit" class="tree_button goto_service" value="Edit Service" name="goto_service">
        </div>
    % endif
</%def>


<%block name="breadcrumb">
<li><a href="${request.route_url('home')}">Home</a></li>
<li><a href="${request.route_url('view_users')}">Users</a></li>
<li><a href="${request.route_url('edit_user', user_name=user_name, cur_svc_type=cur_svc_type)}">User ${user_name}</a></li>
</%block>

<h1>Edit User: ${user_name}</h1>

<h3>User Information</h3>


<div class="panel_box">
    <form id="delete_user" action="${request.path}" method="post">
        <div class="panel_heading">
            <span class="panel_title">User: </span>
            <span class="panel_value">${user_name}</span>
            <span class="panel_heading_button">
                <input type="submit" value="Delete" name="delete" class="button delete">
            </span>
        </div>
    </form>
    <div class="panel_body">
        <div class="panel_box">
            <div class="panel_heading">
                <div class="panel_title">Details</div>
            </div>
            <div>
                <form id="edit_username" action="${request.path}" method="post">
                    <p class="panel_line">
                        <span class="panel_entry">Username: </span>
                        %if edit_mode == 'edit_username':
                            <input type="text" value="${user_name}" name="new_user_name"
                                   id="input_username" onkeyup="adjustWidth('input_name')">
                            <input type="submit" value="Save" name="save_username">
                            <input type="submit" value="Cancel" name="no_edit">
                        %else:
                            <span class="panel_value">${user_name}</span>
                            <input type="submit" value="Edit" name="edit_username">
                        %endif
                    </p>
                </form>
                <form id="edit_password" action="${request.path}" method="post">
                    <p class="panel_line">
                        <span class="panel_entry">Password: </span>
                        %if edit_mode == 'edit_password':
                            <input type="text" value="" name="new_user_password"
                                   id="input_password" onkeyup="adjustWidth('input_name')">
                            <input type="submit" value="Save" name="save_password">
                            <input type="submit" value="Cancel" name="no_edit">
                        %else:
                            <span class="panel_value">***</span>
                            <input type="submit" value="Edit" name="edit_password">
                        %endif
                    </p>
                </form>
                <form id="edit_email" action="${request.path}" method="post">
                    <p class="panel_line">
                        <span class="panel_entry">Email: </span>
                        %if edit_mode == 'edit_email':
                            <input type="text" value="${email}" name="new_user_email"
                                   id="input_email" onkeyup="adjustWidth('input_url')">
                            <input type="submit" value="Save" name="save_email">
                            <input type="submit" value="Cancel" name="no_edit">
                        %else:
                            <span class="panel_value">${email}</span>
                            <input type="submit" value="Edit" name="edit_email">
                        %endif
                    </p>
                </form>
            </div>
        </div>
    </div>
</div>


<h3>Groups Membership</h3>

<form id="edit_membership" action="${request.path}" method="post">
    <input type="hidden" value="True" name="edit_group_membership"/>
    <table>
    %for group in groups:
    <tr>
        % if group in own_groups:
            <td>
                <input type="checkbox" value="${group}" name="member" checked
                       onchange="document.getElementById('edit_membership').submit()">
                ${group}
            </td>
        % else:
            <td>
                <input type="checkbox" value="${group}" name="member"
                       onchange="document.getElementById('edit_membership').submit()">
                ${group}
            </td>
        % endif
    </tr>
    %endfor
    </table>
</form>

<h3>Permissions</h3>
{'fraction_non_alphanumeric': 0.15095747326535688, 'fraction_numerical': 0.001740860482467048, 'mean_word_length': 1.7380844303222878, 'pattern_counts': {'":': 0, '<': 227, '<?xml version=': 0, '>': 227, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1206320', 'n_tokens_mistral': 3272, 'n_tokens_neox': 3143, 'n_words': 590}