<div id="section_parent"
    tal:define="source_title python:here.getAuthenticationTool().getSourceObj(request.get('id', '')).title_or_id();">
	
	<div class="cleaner">&nbsp;</div>

    <h3 i18n:translate="">
        Assign roles to <tal:block i18n:name="source_title" replace="source_title"></tal:block> groups
    </h3>

    <div class="description-text">
		<p i18n:translate="">
        Type a <tal:block replace="source_title" /> group or select one from the list generated
        when pressing the <em i18n:name="pick" i18n:translate="">pick</em> button, then select what
        role you wish to grant to that group.
        </p>
    </div>
	
    <form id="group_roles_form" name="group-roles" method="post" tal:attributes="action string:${here/absolute_url}/map_group_to_role" id="gr_roles" class="assign-form">
        <div class="field">
        <label for="ldap_group" i18n:translate="">
			<tal:block replace="source_title" />
			group
		</label>
        <input type="text" id="ldap_group" name="group" size="50" />
        <input type="button" name="pickroles2" value="Pick"
				i18n:attributes="value"
               tal:define="
                    url string:${here/getPluginPath}/pickroles_html;
                    js_code string:fPickRoles('${url}', 'ldap_group');"
               tal:attributes="onclick string:javascript:${js_code}" />
        </div>
        <div id="ldap_group_empty" class="message-error" style="display:none">
            <p i18n:translate="">
                No group selected.
            </p>
        </div>

        <div class="field">
        <label for="portal_roles" i18n:translate="">Role to grant</label>
        <select multiple="multiple" id="portal_roles" name="roles:list">
                <tal:block repeat="item here/list_valid_roles">
                <option tal:condition="python:item=='Manager' and request.AUTHENTICATED_USER.has_role('Manager')"
                        tal:attributes="value item" tal:content="item" />
                <option tal:condition="python:item!='Manager'" tal:attributes="value item" tal:content="item" />
                </tal:block>
        </select>
        </div>
        <div id="portal_roles_empty" class="message-error" style="display:none">
            <p i18n:translate="">
                No role selected.
            </p>
        </div>

        <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">
                <metal:block use-macro="here/macro_utils/macros/ajaxtree" />
            </tal:block>
        </div>

        <div class="field-inline">
            <input type="checkbox" id="send_mail" name="send_mail" />
			
            <label for="send_mail" i18n:translate="">
                Send a notification email to each user in the group
            </label>
        </div>
		
		<br />
		
        <div>
            <input type="submit" value="Grant roles" i18n:attributes="value"/>
        </div>
    </form>
	
	<div class="tip">
		<strong i18n:translate="">
			Sending notification emails can take a long time for large user groups
		</strong>
	</div>
	
    <div id="assign_groups_waiting_response" style="display:none">
        <img src="misc_/Naaya/ajax-loader.gif" align="left"/>
        <p i18n:translate="">
            Waiting
        </p>
    </div>

    <div id="assign_groups_error_response" class="message-error"
        style="display:none">
        <p i18n:translate="">
            Error assigning group roles.
        </p>
    </div>
</div>
