<%inherit file="/template.html" />
<%namespace name="forms" file="/forms.html"/>
<%namespace name="components" file="/components.html"/>
<%def name="title()">${_("Admin: Import Users")}</%def>

<%block name="headline">
    <h1>${_("Import Users")}</h1>
</%block>

<%block name="main_content">
${self.form()}
</%block>

<%def name="form(came_from='')">

<form name="import_users" class="well" method="POST">

    ${h.field_token()|n}

    <div class="input_wrapper">
        <%forms:textarea
            label="${_('Users CSV')}"
            name="users_csv"
            value=""
            autofocus="autofocus"
            placeholder="testuser, &quot;Test User&quot;, test@example.com, &quot;badge1, badge2&quot;"
            help="${_('Paste the content of a CSV file, e.g. exported from Excel, with the 4 columns username, display name, email and badges (badges are optional, comma separated and with quotes around the list)')}">

        </%forms:textarea>


        ${forms.input(_("Email Subject"), "email_subject")}

        <%forms:textarea label="${_('Email Template')}"
                         name="email_template"
                         value="">
           <%def name="before()">
           <%
           required = [
               {'name': '{user_name}',
                'description': _('The name with which the user can log in.')},
               {'name': '{password}',
                'description': _('The initial password for the user.')},
               {'name': '{url}',
                'description': _('An URL for the user to activate his account.')}]
           optional = [
               {'name': '{display_name}',
                'description': _('The name that will be displayed to other users.')},
               {'name': '{email}',
                'description': _(u'The email address of the user.')},
               {'name': '{0}, {1}, {2}, &hellip;',
                'description': _(u'for additional columns.')}]
           %>

           <div class="help-block">
               <p>${_('The template for the mail to the users. You need to insert some placeholders into the email text.')}</p>
               <h6>${_('Required')}</h6>
               <ul class="nobullet">
                   %for item in required:
                   <li><em>${item['name']}</em>: ${item['description']}</li>
                   %endfor
               </ul>
               <h6>${_('Optional')}</h6>
               <ul class="nobullet">
                   %for item in optional:
                   <li><em>${item['name']|n}</em>: ${item['description']}</li>
                   %endfor
               </ul>
           </div>
           </%def>
        </%forms:textarea>
    </div>
    ${components.savebox(came_from)}
</form>
</%def>
