#*
 * Aipo is a groupware program developed by Aimluck,Inc.
 * Copyright (C) 2004-2010 Aimluck,Inc.
 * http://aipostyle.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_doAccount_insert")
#set ($subtitle = 'ユーザー追加')
#else
#set ($action_str = "更新する")
#set ($subtitle = 'ユーザー編集')
#set ($event_submit = "eventSubmit_doAccount_update")
#end
## ---------------------------------------------------------------------------
#ALdialogheader($subtitle)
##ALerrmsg($errmsgs)
<div id="messageDiv"></div>
#ALajaxIndicator("$indicator_id" "$!portlet.ID" "")
#ALajaxscreenformheader("accountuserForm" $jslink $portlet "AccountUserFormJSONScreen" "aimluck.io.selectAllOptions(this.attachments);aimluck.io.selectAllOptions(this.group_to);aimluck.io.submit(this,'$indicator_id','$!portlet.ID', aipo.account_user.onReceiveMessage)")
<input name="is_new_post" type="hidden" value="$!result.NewPost"/>
<input name="is_new_position" type="hidden" value="$!result.NewPosition"/>
#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('username'))" "style='width:180px;'")
#ALtditemheader()
#if($mode=="new_form")
#ALtextfield('username' $!result.UserName '70%' 30 'disabled')#ALcaution('（半角英数字）')
#else
<input name="username" value="$!result.UserName" type="hidden">$!result.UserName
#end
#ALtditemfooter()
#ALtdcaptionAtt("#ALrequired('パスワード')" "style='width:180px;'")
#ALtditemheader()
#ALpasswdfield('password' "$!result.Password" '70%' 16 'disabled')#ALcaution('（半角英数字）')
#ALtditemfooter()
#ALtdcaptionAtt("#ALrequired('パスワード<br />（確認用）')" "style='width:180px;'")
#ALtditemheader()
#ALpasswdfield('password2' "$!result.Password2" '70%' 16 'disabled')#ALcaution('（半角英数字）')
#ALtditemfooter()
#ALtdcaptionAtt("#ALrequired('名前')" "style='width:180px;'")
#ALtditem("#ALtextfield('lastname' $!result.LastName '30%' 20 'active')#ALtextfield('firstname' $!result.FirstName '30%' 20 'active')")
#ALtdcaptionAtt("#ALrequired('名前（フリガナ）')" "style='width:180px;'")
#ALtditem("#ALtextfield('last_name_kana' $!result.LastNameKana '30%' 20 'active')#ALtextfield('first_name_kana' $!result.FirstNameKana '30%' 20 'active')")
#ALtdcaption($!result.getFieldName("email"))
#ALtditem("#ALtextfield('email' $!result.Email '60%' 50 'disabled')#ALcaution('（半角英数字）')")
#ALtdcaption($!result.getFieldName("out_telephone1"))
#ALtditemheader()
#ALtextfield('out_telephone1' $!result.OutTelephone1 '20%' 5 'disabled')-#ALtextfield('out_telephone2' $!result.OutTelephone2 '20%' 4 'disabled')-#ALtextfield('out_telephone3' $!result.OutTelephone3 '20%' 4 'disabled')#ALcaution('（半角数字）')
#ALtditemfooter()
#ALtdcaption($!result.getFieldName("in_telephone"))
#ALtditem("#ALtextfield('in_telephone' $!result.InTelephone '30%' 13 'disabled')#ALcaution('（ハイフン（-）または半角数字）')")
#ALtdcaption($!result.getFieldName("cellular_phone1"))
#ALtditemheader()
#ALtextfield('cellular_phone1' $!result.CellularPhone1 '20%' 5 'disabled')-#ALtextfield('cellular_phone2' $!result.CellularPhone2 '20%' 4 'disabled')-#ALtextfield('cellular_phone3' $!result.CellularPhone3 '20%' 4 'disabled')#ALcaution('（半角数字）')
#ALtditemfooter()
#ALtdcaption($!result.getFieldName("cellular_mail"))
#ALtditem("#ALtextfield('cellular_mail' $!result.CellularMail '75%' 50 'disabled')#ALcaution('（半角英数字）')")
#ALtdcaption($!result.getFieldName("photo"))
#ALtditemheader()
<select id="attachments" name="attachments" type="select" size="1" multiple="multiple" style="width: 325px">
#foreach( $record in $!result.AttachmentFileNameList )
<option value="$record.FileId">$record.FileName</option>
#end
</select>
#set($att_url = $!jslink.getPortletById($!portlet.ID).addQueryData("template","FileuploadFormScreen").addQueryData("mode","form").addQueryData("msize","1"))
<input type="button" onclick="aipo.fileupload.openAttachment('$!utils.escapeXML($att_url)');" value="ファイルの選択" class="button" name="add_attachment"/>
選択したファイルを<input type="button" onclick="aimluck.io.removeAllOptions(this.form.attachments);" value="削除する" class="button" name="add_attachment"/>
<input type="hidden" id="folderName" name="folderName" value="">
#ALtditemfooter()

#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','UserGroupLiteJSONScreen').addQueryData('mode','post')"
    memberFromOptionKey="groupId"
    memberFromOptionValue="name">
</div>
<select size="5" multiple="multiple" style="display:none;" name="init_grouplist" id="init_grouplist">#foreach($record in $!result.PostList)<option value="$!record.GroupId">$!record.Name</option>#end</select>
#ALtditemfooter()

#ALtdcaption($!result.getFieldName("position_id"))
#ALtditemheader()
<div id="positionInputField" #if(!$!{result.NewPosition})style="display:none"#end>
#ALtextfield('position_name' $!result.Position.PositionName '90%' 50 'active')
</div>
<div id="positionSelectField" #if($!{result.NewPosition})style="display:none"#end>	
<select name="position_id">
<option value="">（指定しない）</option>
#foreach( $record in $result.PositionMap )
<option value="$!record.PositionId" #if ($!result.PositionId.toString() == $!record.PositionId.toString()) selected #end>$!record.PositionName</option>
#end
</select>	
</div>
<input name="position_input_button" type="button" class="button" value=" #if(!$!{result.NewPosition})新しく入力する#else一覧から選択する#end " onclick="aipo.account_user.formSwitchPositionInput(this)" />
#ALtditemfooter()
#ALtablefooter()
#ALbuttonheader()
#ALsubmit($event_submit $action_str)#ALajaxbuttonClose()
#ALbuttonfooter()
#ALformfooter()
#ALdialogfooter()
