<metal:block use-macro="python:here.getFormsTool().getForm('site_admin_users').macros['page']">
<metal:block fill-slot="second-title" i18n:translate="">Assign roles</metal:block>

<metal:block fill-slot="section-title">
    <h3 i18n:translate="">
        Assign roles to local users
    </h3>
</metal:block>

<metal:block fill-slot="description-text">
</metal:block>

<metal:block fill-slot="buttons"><metal:block define-macro="buttons">
    <div class="floated-buttons">
        &nbsp;
    </div>
</metal:block></metal:block>

<metal:block fill-slot="second-tabs">
	<metal:block use-macro="python: here.getFormsTool().getForm('site_admin_local_users').macros['second-tabs']"></metal:block>
</metal:block>

<metal:block fill-slot="content"><metal:block define-macro="content">
<tal:block define="users user_tool/get_local_usernames;
                   redirect redirect|nothing;
                   selected_users python: request.get('names', []);
                   action action|string:${site_url}/admin_addroles">
    <form method="post" name="frmUsersRoles" tal:attributes="action action" class="assign-form" tal:condition="users">
        <input type="hidden" name="redirect" tal:attributes="value redirect" />
        <metal:block define-slot="usernames">
            <div class="field">
                <label for="select-usernames" i18n:translate="">Username:</label>
                <select name="names" size="10" multiple="multiple" id="select-usernames">
                  <tal:block repeat="user users">
                    <option tal:define="is_new user/is_new_user;
                                        marker_for_new python:test(is_new and not here.get_zope_env('NETWORK_NAME').lower() == 'eionet', '*', '')"
                        tal:attributes="value user/uid; selected python: user['uid'] in selected_users"
                        tal:content="string:${user/name} (${user/uid}) ${marker_for_new}" />
                  </tal:block>
                </select>
            </div>
        </metal:block>

        <metal:block define-slot="roles">
            <div class="field" tal:define="roles user_tool/list_valid_roles">
                <label for="select-roles" i18n:translate="">Roles:</label>
                <select name="roles" size="5" multiple="multiple" id="select-roles">
                    <tal:block repeat="role roles">
                    <option tal:condition="python:role=='Manager' and request.AUTHENTICATED_USER.has_role('Manager')" tal:attributes="value role" tal:content="role" />
                    <option tal:condition="python:role!='Manager'" tal:attributes="value role" tal:content="role" />
                    </tal:block>
                </select>
            </div>
        </metal:block>

        <metal:block define-slot="location">
            <div class="field">
                <label for="location">
                    <span tal:omit-tag="" i18n:translate="">Location (folder):</span>
                    <br />
                    <noscript>
                        <small i18n:translate="">e.g. folderUrl</small>
                    </noscript>
                </label>
                <input name="location" class="sitemap_tree_target" id="location" type="text" size="50" value="" />
                <small i18n:translate="">(choose a location from the tree below)</small>

                <div id="sitemap_tree" class="sitemap_tree"></div>
                <div class="cleaner"></div>
                <tal:block define="tree_get_url string:${here/absolute_url}/getNavigationSiteMap/?only_folders=1&subportals=1">
                    <metal:block use-macro="here/macro_utils/macros/ajaxtree" />
                </tal:block>
            </div>
        </metal:block>

        <metal:block define-slot="notification">
            <div class="field-inline">
                <input type="checkbox" id="send_mail" name="send_mail" checked="checked" />
                <label class="form-label" for="send_mail" i18n:translate="">Send notification email to selected user(s)</label>
            </div>
        </metal:block>

        <br />
        <metal:block define-slot="submit">
            <div>
                <input type="submit" value="Assign role" i18n:attributes="value"/>
            </div>
        </metal:block>
    </form>

    <p tal:condition="python: len(users) == 0" i18n:translate="" class="message-empty">
        No local users defined yet.
		You can <a tal:attributes="href string:${site_url}/admin_adduser_html" title="Add local user" i18n:attributes="title" i18n:name="add-user-link">add a local user</a>.
    </p>

</tal:block>
</metal:block>
</metal:block>
</metal:block>
