{include file="$admintemplatepath/header.template"}
{include file="$admintemplatepath/navigation.template" showOpt=newBlogUser title=$locale->tr("newBlogUser")}

 <form name="addBlogUser" id="addBlogUser" action="admin.php" method="post">
   <fieldset class="inputField">
  
     <legend>{$locale->tr("newBlogUser")}</legend>
     {include file="$admintemplatepath/formvalidate.template"}

     <div class="field">
      <label for="userName">{$locale->tr("username")}</label>
      <span class="required">*</span>
      <div class="formHelp">{$locale->tr("new_blog_username_help")}</div>
      <input type="text" id="userName" name="newBlogUserName" value="{$newBlogUserName|escape:"html"}" style="width:50%" />
	  {check_perms adminperm=view_users}
	   <a href="#" onclick="window.open('?op=siteUsersChooser','UserChooser','scrollbars=yes,resizable=yes,toolbar=no,height=450,width=600');">
		{$locale->tr("select")}
	   </a>
	   <input type="hidden" id="userId" name="userId" value="" />		
	  {/check_perms}
      {include file="$admintemplatepath/validate.template" field=newBlogUserName message=$locale->tr("error_invalid_user")}
     </div>

     <div class="field">
       <label for="sendNotification">{$locale->tr("send_notification")}</label>      
       <div class="formHelp">
	    <input class="checkbox" type="checkbox" id="sendNotification" name="sendNotification" value="1" {if isset($sendNotification)}checked="checked"{/if} />	   
	    {$locale->tr("send_user_notification_help")}
	  </div>
     </div>
     
     <div class="field">
      <label for="perm">{$locale->tr("permissions")}</label>
      <div class="formHelp">{$locale->tr("blog_user_permissions_help")}</div>     
        {$locale->tr("quick_permission_selection")}
        </br>
        <select name="preselection" onChange="togglePermissionSets('addBlogUser', this.value);">
          <option value=""/>{$locale->tr("select")}</option>
          <option value="basic_blog_permission"/>{$locale->tr("basic_blog_permission")}</option>
          <option value="full_blog_permission"/>{$locale->tr("full_blog_permission")}</option>
        </select><br/>
     	{foreach from=$perms item=permission}
     	 {if !$permission->isAdminOnlyPermission()}
  		   {assign var=permId value=$permission->getId()}
           {if $permission->getName() == "blog_access"}
             {** the blog_access permission will always be checked by default for new users, in order not to cause confusion as
	             this permissions is now needed for even accessing the blog **}
		     <input type="hidden" name="perm[{$permission->getId()}]" value="{$permission->getId()}" />
           {else}
     	     <input type="checkbox" class="checkbox" name="perm[{$permission->getId()}]" value="{$permission->getId()}" {if $perm[$permId]==$permission->getId()}checked="checked"{/if} />
     	     {$locale->tr($permission->getDescription())}<br/>
           {/if}
     	 {/if}
     	{/foreach}		
     </div>

    <div class="field">
      <label for="newBlogUserText">{$locale->tr("notification_text")}</label>
      <span class="required">*</span>
      <div class="formHelp">{$locale->tr("notification_text_help")}</div>
      <textarea rows="10" cols="70" id="newBlogUserText" name="newBlogUserText">{$newBlogUserText}</textarea>
      {include file="$admintemplatepath/validate.template" field=newBlogUserText message=$locale->tr("error_empty_text")}
    </div>
  </fieldset>
  <div class="buttons">  
    <input type="reset" value="{$locale->tr("reset")}" name="reset" />
    <input type="submit" name="Add this user" value="{$locale->tr("add")}"/>
    <input type="hidden" name="op" value="addBlogUser"/>
  </div> 
 </form>

{include file="$admintemplatepath/footernavigation.template"}
{include file="$admintemplatepath/footer.template"}
