#*
 * Aipo is a groupware program developed by Aimluck,Inc.
 * Copyright (C) 2004-2011 Aimluck,Inc.
 * http://www.aipo.com
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *#

## ---------------------------------------------------------------------------
#set ($indicator_id = "indicator-dlg-")
#if($mode=="new_form")
#set ($action_str = "追加する")
#set ($event_submit = "eventSubmit_doWebmail_mailaccount_insert")
#set ($subtitle = 'メールアカウント追加')
#else
#set ($action_str = "更新する")
#set ($subtitle = 'メールアカウント編集')
#set ($event_submit = "eventSubmit_doWebmail_mailaccount_update")
#end
##----------------------------------------------------------------------------------
#ALdialogheaderCloseJS($subtitle "aipo.webmail.hideDialogAdmin()")
#ALerrmsg($errmsgs)
<div id="messageDiv"></div>
#ALajaxIndicator("$indicator_id" "$!portlet.ID" "")
#ALajaxscreenformheader("webmailForm" $jslink $portlet "WebMailAdminFormJSONScreen" "aimluck.io.submit(this,'$indicator_id','$!portlet.ID',aipo.webmail.onReceiveMessageAdmin)")
#if($mode=="new_form")
<input type="hidden" name="mode" value="insert" />
#else
<input type="hidden" name="mode" value="update" />
#end
#ALtableheaderWide()
#ALtdcaptionAtt("#ALrequired($!result.getFieldName('account_name'))" "style='width:210px;'")
#ALtditem("#ALtextfield('account_name' $!result.AccountName '60%' 20 'active')")
#ALtdcaptionAtt("#ALrequired($!result.getFieldName('smtpserver_name'))" "style='width:210px;'")
#ALtditem("#ALtextfield('smtpserver_name' $!result.SmtpserverName '60%' 50 'disabled')#ALcaution('（半角英数字）')")


#ALtdcaptionAtt("#ALrequired($!result.getFieldName('mail_user_name'))" "style='width:210px;'")
#ALtditem("#ALtextfield('mail_user_name' $!result.MailUserName '60%' 50 'active')")
#ALtdcaptionAtt("#ALrequired($!result.getFieldName('mail_address'))" "style='width:210px;'")
#ALtditem("#ALtextfield('mail_address' $!result.MailAddress '60%' 50 'disabled')#ALcaution('（半角英数字）')")
#ALtdcaptionAtt("#ALrequired($!result.getFieldName('smtp_port'))" "style='width:210px;'")
#ALtditem("#ALtextfield('smtp_port' $!result.SmtpPort '60%' 5 'disabled')#ALcaution('（半角数字）')")

#ALtdcaptionAtt("$!result.getFieldName('smtp_encryption_flag')" "style='width:210px;'")
#ALtditemheader()
<input name="smtp_encryption_flag" type="radio" value="0" id="$!{portlet.ID}smtp_encryption_id0" #if ($!result.SmtpEncryptionFlag.toString() == "0") checked="checked" #end>
<label for="$!{portlet.ID}smtp_encryption_id0">暗号化しない</label>
<input name="smtp_encryption_flag" type="radio" value="1" id="$!{portlet.ID}smtp_encryption_id1" #if ($!result.SmtpEncryptionFlag.toString() == "1") checked="checked" #end>
<label for="$!{portlet.ID}smtp_encryption_id1">SSL暗号化</label>
#ALtditemfooter()
#ALtdcaptionAtt("#ALrequired($!result.getFieldName('auth_send_flg'))" "style='width:210px;'")
#ALtditemheader()
<input name="auth_send_flg" type="radio" value="0" id="$!{portlet.ID}auth_send_id0" #if ($!result.AuthSendFlg.toString() == "0") checked="checked" #end onclick="aipo.webmail.switchAuthSendAdmin(this)" />
<label for="$!{portlet.ID}auth_send_id0">認証なし</label>
<input name="auth_send_flg" type="radio" value="1" id="$!{portlet.ID}auth_send_id1" #if ($!result.AuthSendFlg.toString() == "1") checked="checked" #end onclick="aipo.webmail.switchAuthSendAdmin(this)" />
<label for="$!{portlet.ID}auth_send_id1">POP before SMTP</label>
<input name="auth_send_flg" type="radio" value="2" id="$!{portlet.ID}auth_send_id2" #if ($!result.AuthSendFlg.toString() == "2") checked="checked" #end onclick="aipo.webmail.switchAuthSendAdmin(this)" />
<label for="$!{portlet.ID}auth_send_id2">SMTP認証</label>
#ALtditemfooter()
#ALtablefooter()

<div id="smtp_auth_field" style="display: #if ($!result.AuthSendFlg.toString() != "2") none #end ;">
<h4 class="spaceTop">SMTP認証情報</h4>
#ALtableheaderWide()
#ALtdcaptionAtt("#ALrequired('ユーザー')" "style='width:210px;'")
#ALtditem("#ALtextfield('auth_send_user_id' $!{result.AuthSendUserId} '60%' 50 'disabled')#ALcaution('（半角英数字）')")
#ALtdcaptionAtt("#ALrequired('パスワード')" "style='width:210px;'")
#ALtditem("#ALpasswdfield('auth_send_user_password' $!{result.AuthSendUserPasswd} '60%' 50 'disabled')#ALcaution('（半角英数字）')")
#ALtablefooter()
</div>

<div id="pop_auth_field" style="display: #if ($!result.AuthSendFlg.toString() != "1") none #end ;">
<h4 class="spaceTop">POP before SMTP情報</h4>
#ALtableheaderWide()
#ALtdcaptionAtt("#ALrequired($!result.getFieldName('pop3server_name'))" "style='width:210px;'")
#ALtditem("#ALtextfield('pop3server_name' $!result.Pop3serverName '60%' 50 'disabled')#ALcaution('（半角英数字）')")
#ALtdcaptionAtt("#ALrequired($!result.getFieldName('pop3user_name'))" "style='width:210px;'")
#ALtditem("#ALtextfield('pop3user_name' $!result.Pop3userName '60%' 50 'disabled')#ALcaution('（半角英数字）')")
#ALtdcaptionAtt("#ALrequired($!result.getFieldName('pop3_password'))" "style='width:210px;'")
#ALtditemheader()
<input class="text" name="pop3_password" value="$!result.Pop3Password" type="password" size="20" maxlength="50" >#ALcaution('（半角英数字）')
#ALtditemfooter()
#ALtdcaptionAtt("#ALrequired($!result.getFieldName('pop3_port'))" "style='width:210px;'")
#ALtditem("#ALtextfield('pop3_port' $!result.Pop3Port '60%' 5 'disabled')#ALcaution('（半角数字）')")
#ALtdcaptionAtt("$!result.getFieldName('pop3_encryption_flag')" "style='width:210px;'")
#ALtditemheader()
<input name="pop3_encryption_flag" type="radio" value="0" id="$!{portlet.ID}pop3_encryption_id0" #if ($!result.Pop3EncryptionFlag.toString() == "0") checked="checked" #end>
<label for="$!{portlet.ID}pop3_encryption_id0">暗号化しない</label>
<input name="pop3_encryption_flag" type="radio" value="1" id="$!{portlet.ID}pop3_encryption_id1" #if ($!result.Pop3EncryptionFlag.toString() == "1") checked="checked" #end>
<label for="$!{portlet.ID}pop3_encryption_id1">SSL暗号化</label>
#ALtditemfooter()
#ALtablefooter()
</div>
#ALbuttonheader()
#ALsubmit($event_submit $action_str)<input name="ajaxbuttonClose" class="button" type="button" value="　閉じる　" onclick="aipo.webmail.hideDialogAdmin();" />
#ALbuttonfooter()
#ALformfooter()
#ALdialogfooter()
