#*
 * Aipo is a groupware program developed by Aimluck,Inc.
 * Copyright (C) 2004-2008 Aimluck,Inc.
 * http://aipostyle.com/
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU 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 General Public License for more details.
 * 
 * You should have received a copy of the GNU 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_doMemo_insert")
#set ($subtitle = '社外アドレス追加')
#else
#set ($action_str = "更新する")
#set ($subtitle = '社外アドレス編集')
#set ($event_submit = "eventSubmit_doMemo_update")
#end
##-------------------------------------------------------------

##;aimluck.io.selectAllOptions(this.group_to);

#ALdialogheader($subtitle)
#ALerrmsg($errmsgs)
<div id="messageDiv"></div>
#ALajaxIndicator("$indicator_id" "$!portlet.ID" "")
#ALajaxscreenformheader("addressbookForm" $jslink $portlet "AddressBookFormJSONScreen" "aimluck.io.selectAllOptions(this.group_to);aimluck.io.submit(this,'$indicator_id','$!portlet.ID',aipo.addressbook.onReceiveMessage)")
<input name="is_new_company" type="hidden" value="$!result.isNewCompany()" />
#if($mode=="new_form")
<input type="hidden" name="mode" value="insert" />
#else
<input type="hidden" name="mode" value="update" />
#end
#ALtableheaderWide()
#ALtdcaption("#ALrequired('名前')")
#ALtditem("#ALtextfield('lastname' $!result.LastName '30%' 20 'active')#ALtextfield('firstname' $!result.FirstName '30%' 20 'active')")
#ALtdcaption("#ALrequired('名前（フリガナ）')")
#ALtditem("#ALtextfield('last_name_kana' $!result.LastNameKana '30%' 50 'active')#ALtextfield('first_name_kana' $!result.FirstNameKana '30%' 50 'active')")
#ALtdcaption($!result.getFieldName("email"))
#ALtditem("#ALtextfield('email' $!result.Email '70%' 50 'disabled')#ALcaution('（半角英数字）')")
#ALtdcaption($!result.getFieldName("telephone1"))
#ALtditemheader()
#ALtextfield('telephone1' $!result.Telephone1 '60px' 5 'disabled')-#ALtextfield('telephone2' $!result.Telephone2 '60px' 4 'disabled')-#ALtextfield('telephone3' $!result.Telephone3 '60px' 4 'disabled')#ALcaution('（半角数字）')
#ALtditemfooter()
#ALtdcaption($!result.getFieldName("cellular_phone1"))
#ALtditemheader()
#ALtextfield('cellular_phone1' $!result.CellularPhone1 '60px' 5 'disabled')-#ALtextfield('cellular_phone2' $!result.CellularPhone2 '60px' 4 'disabled')-#ALtextfield('cellular_phone3' $!result.CellularPhone3 '60px' 4 'disabled')#ALcaution('（半角数字）')
#ALtditemfooter()
#ALtdcaption($!result.getFieldName("cellular_mail"))
#ALtditem("#ALtextfield('cellular_mail' $!result.CellularMail '70%' 50 'disabled')#ALcaution('（半角英数字）')")
#ALtdcaption($!result.getFieldName("company_id"))
#ALtditemheader()
<div id="company_field">
<div id="AddressBookCompanyInputField" #if(!$!result.isNewCompany())style="display:none"#end>
#ALtableheaderSubWide()
#ALtdcaption("#ALrequired($!result.getFieldName('company_name'))")
#ALtditem("#ALtextfield('company_name' $!result.CompanyName '90%' 50 'active')")
#ALtdcaption("#ALrequired($!result.getFieldName('company_name_kana'))")
#ALtditem("#ALtextfield('company_name_kana' $!result.CompanyName '90%' 50 'active')")
#ALtdcaption("$!result.getFieldName('post_name')")
#ALtditemheader()
#ALtextfield('post_name' $!result.PostName '90%' 50 'active')
#ALtditemfooter()
#ALtdcaption("$!result.getFieldName('comp_address')")
#ALtditemheader()
〒#ALtextfield('comp_zipcode1' $!result.CompZipcode1 '20%' 3 'disabled')-#ALtextfield('comp_zipcode2' $!result.CompZipcode2 '20%' 4 'disabled')#ALcaution('（半角数字）')
#ALtextfield('comp_address' $!result.CompAddress '90%' 50 'active')
#ALtditemfooter()
#ALtdcaption($!result.getFieldName("comp_telephone1"))
#ALtditemheader()
#ALtextfield('comp_telephone1' $!result.CompTelephone1 '20%' 5 'disabled')-#ALtextfield('comp_telephone2' $!result.CompTelephone2 '20%' 4 'disabled')-#ALtextfield('comp_telephone3' $!result.CompTelephone3 '20%' 4 'disabled')#ALcaution('（半角数字）')
#ALtditemfooter()
#ALtdcaption($!result.getFieldName("comp_fax_number1"))
#ALtditemheader()
#ALtextfield('comp_fax_number1' $!result.CompFaxNumber1 '20%' 5 'disabled')-#ALtextfield('comp_fax_number2' $!result.CompFaxNumber2 '20%' 4 'disabled')-#ALtextfield('comp_fax_number3' $!result.CompFaxNumber3 '20%' 4 'disabled')#ALcaution('（半角数字）')
#ALtditemfooter()
#ALtdcaption($!result.getFieldName("comp_url"))
#ALtditem("#ALtextfield('comp_url' $!result.CompUrl '90%' 90 'disabled')")
#ALtablefooter()
</div>
<div id="AddressBookCompanySelectField" #if($!result.isNewCompany())style="display:none"#end>
#ALselectpdheader("company_id" "90%" "")
<option value="">（指定しない）</option>
#foreach( $record in $result.CompanyList )
<option value='$!record.CompanyId' #if ($!result.CompanyId.toString() == $!record.CompanyId.toString()) selected #end>$!record.CompanyName</option>
#end
#ALselectfooter()
</div>
<input name="category_input_button" type="button" class="button" value=" #if(!$!{result.isNewCompany()})新しく入力する#else一覧から選択する#end " onclick="aipo.addressbook.formSwitchCompanyInput(this)" />
</div>
#ALtditemfooter()
#ALtdcaption($!result.getFieldName("position_name"))
#ALtditem("#ALtextfield('position_name' $!result.PositionName '70%' 50 'active')")
#if($mode=="new_form" || ($!result.PublicFlag.toString() == "F") )
#ALtdcaption($!result.getFieldName("public_flag"))
#ALtditemheader()
<input name="public_flag" type="radio" value="T" id="$!{portlet.ID}public" #if ($!result.PublicFlag.toString() != "F") checked="checked" #end />
<label for="$!{portlet.ID}public">公開</label>
<input name="public_flag" type="radio" value="F" id="$!{portlet.ID}secret" #if ($!result.PublicFlag.toString() == "F") checked="checked" #end />
<label for="$!{portlet.ID}secret">非公開</label>
#ALtditemfooter()
#else
<input name="public_flag" type="hidden" value="T" />
#end
#ALtdcaption("所属社外グループ")
#ALtditemheader()
<div class="spaceTop spaceLeft small">左側に所属社外グループを追加してください。</div>
<div dojoType="aipo.widget.GroupNormalSelectList" 
    id="groupnormalselect" 
    widgetId="groupnormalselect" 
    buttonAddId="button_group_add" 
    buttonRemoveId="button_group_remove" 
    memberFromTitle="グループ一覧"
    memberFromId="tmp_group_from" 
    memberToTitle="所属グループ"
    memberToId="group_to" 
    memberFromUrl="$!jslink.getPortletById($!portlet.ID).addQueryData('template','AddressBookUserGroupLiteJSONScreen')"
    memberFromOptionKey="groupId"
    memberFromOptionValue="name">
</div>
<select size="5" multiple="multiple" style="display:none;" name="init_grouplist" id="init_grouplist">#foreach($record in $result.Groups)<option value="$!record.GroupId">$!record.GroupName</option>#end</select>
#ALtditemfooter()
#ALtablefooter()
#ALbuttonheader()
#ALsubmit($event_submit $action_str)#ALajaxbuttonClose()
#ALbuttonfooter()
#ALformfooter()
#ALdialogfooter()
