#*
 * 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/>.
 *#
## ---------------------------------------------------------------------------
#if($mode=="new_form")
#set ($indicator_str = "データを送信")
#set ($action_str = "追加する")
#set ($event_submit = "eventSubmit_doSchedule_insert")
#set ($subtitle = "スケジュール追加")
#else
#set ($indicator_str = "データを送信")
#set ($action_str = "更新する")
#set ($event_submit = "eventSubmit_doSchedule_update")
#set ($subtitle = "スケジュール編集")
#end
#set($tabs = [[$subtitle , "",""]])
#set ($indicator_id = "indicator-dlg-")
## ---------------------------------------------------------------------------
#ALdialogheaderCloseJS($subtitle "aipo.schedule.hideDialog()")
#ALajaxIndicator("$indicator_id" "$!portlet.ID" "")
<div id="messageDiv"></div>
#if($result.SelectData.Max)
#if($!result.SelectData.isDuplicate())
#set($colspanmax = $!{result.SelectData.Max} + 2)
#else
#set($colspanmax = $!{result.SelectData.Max} + 1)
#end
#end
#if($!result.SelectData.isHasspan())
#set($colspanmax = $colspanmax + 1)
#end
#if($result.SelectData.EndHour)#set($endHour = $!{result.SelectData.EndHour} - 1)#end
##ALajaxscreenformheader("_scheduleForm" $jslink $portlet "ScheduleFormJSONScreen" "aimluck.io.selectAllOptions(this.member_to);aimluck.io.selectAllOptions(this.facility_to);aipo.schedule.onSubmit(this); aimluck.io.submit(this,'$indicator_id','$!portlet.ID',aipo.schedule.onReceiveMessage)")
<form id = "_scheduleForm" name="scheduleForm" action="$!jslink.getPortletById($!portlet.ID).addQueryData('template','ScheduleFormJSONScreen')" method="post" onsubmit="aimluck.io.selectAllOptions(this.member_to);aimluck.io.selectAllOptions(this.facility_to);aipo.schedule.onSubmit(this); aimluck.io.submit(this,'$indicator_id','$!portlet.ID',aipo.schedule.onReceiveMessage);return false;">
<input type="hidden" name="ignore_duplicate_facility" value="false" />
<input type="hidden" name="secid" value="$secid" />
#if($mode=="new_form")
<input type="hidden" name="mode" value="insert" />
#else
<input type="hidden" name="mode" value="update" />
#end
<input type="hidden" name="is_repeat" value="$!{result.Repeat}" />
<input type="hidden" name="is_span" value="$!{result.Span}" />
<input type="hidden" name="is_member" value="TRUE" />
<input name="is_facility" type="hidden" #if (! $!{result.isSpan()} || ($!{result.PublicFlag.toString()} == "O")) value="TRUE" #else value="FALSE" #end />
<input type="hidden" name="view_date" value="$!{result.ViewDate.toString()}">
#if($afterbehavior)
<input type="hidden" name="afterbehavior" value="1">
#end
#ALerrmsg($errmsgs)
##mustmessage()
##ALtableheader("100%")
#ALtableheaderWide()
#if($mode!="new_form" && ($!{result.EditRepeatFlag.toString()} != "-1"))
#ALtdcaption("編集範囲")
#ALtditemheader()
<input name="edit_repeat_flag" type="radio" value="0"  id="edit_repeat_flag0_$!{portlet.ID}" #if ($!{result.getInt($!{result.EditRepeatFlag.getValue()})} == 0) checked="checked" #end onclick="aipo.schedule.formEditRepeatAll(this.form)"/>
<label onclick="aipo.schedule.formEditRepeatAll(this.form)" for="edit_repeat_flag0_$!{portlet.ID}">すべての予定</label>
<input name="edit_repeat_flag" type="radio" value="1" id="edit_repeat_flag1_$!{portlet.ID}" #if ($!{result.getInt($!{result.EditRepeatFlag.getValue()})} == 1) checked="checked" #end onclick="aipo.schedule.formEditRepeatOne(this.form)"/>
<label onclick="aipo.schedule.formEditRepeatOne(this.form)" for="edit_repeat_flag1_$!{portlet.ID}">$!{result.ViewDate.Year}年$!{result.ViewDate.Month}月$!{result.ViewDate.Day}日の予定のみ</label><br/>
#ALtditemfooter()
#end
#ALtdcaption("日時")
#ALtditemheader()
  <div id="normalField" style="display:#if($!{result.Repeat} && ($!{result.getInt($!{result.EditRepeatFlag.getValue()})} != 1))none#end">
    <div class="p">
        <span dojoType="aipo.widget.DropdownDatepicker" id="startDateSpan" widgetId="startDateSpan"  iconURL="images/icon/icon_date.gif" iconAlt="開始日" hiddenId="start_date" #if ($!result.StartDateCheck.toString() && ($!result.StartDateCheck.toString() == "TRUE")) initValue="" #else initValue="$!{result.StartDateSub}"checked="checked" #end inputId="start_date_input" dateId="start_date" displayCheck="none"></span>
        <span id="spanField" style="display:#if(!$!{result.Span})none#end">～
        <span dojoType="aipo.widget.DropdownDatepicker" id="endDateSpan" widgetId="endDateSpan"  iconURL="images/icon/icon_date.gif" iconAlt="終了日" hiddenId="end_date" #if ($!result.EndDateCheck.toString()  && ($!result.EndDateCheck.toString() == "TRUE")) initValue="" #else initValue="$!{result.EndDateSub}"checked="checked" #end inputId="end_date_input" dateId="end_date" displayCheck="none"></span>
        </span>
    </div>
  </div>
  <div id="repeatField" style="display:#if(!$!{result.Repeat} || ($!{result.getInt($!{result.EditRepeatFlag.getValue()})} == 1))none#end">
    <div class="p">毎月の定例会や毎週の打ち合わせなど、ある一定期間で繰り返すスケジュールを設定します。
      <h3>繰り返しパターン</h3>
      <input id="repeat_typeD" type="radio" value="D" #if ($!{result.RepeatType.toString()} == "D") checked="checked" #end name="repeat_type"/>
      <label for="repeat_typeD">毎日</label>
      <br/>
      <input id="repeat_typeW" type="radio" value="W" #if ($!{result.RepeatType.toString()} == "W") checked="checked" #end name="repeat_type"/>
      <label for="repeat_typeW">毎週</label>
      <input id="week_0_id" type="checkbox" onclick="aipo.schedule.enablePerWeek(this.form)" #if ($!{result.Week0.toString()} == "TRUE") checked="checked" #end value="TRUE" name="week_0"/>
      <label onclick="aipo.schedule.enablePerWeek(this.form)" for="week_0_id">日</label>
      <input id="week_1_id" type="checkbox" onclick="aipo.schedule.enablePerWeek(this.form)" #if ($!{result.Week1.toString()} == "TRUE") checked="checked" #end value="TRUE" name="week_1"/>
      <label onclick="aipo.schedule.enablePerWeek(this.form)" for="week_1_id">月</label>
      <input id="week_2_id" type="checkbox" onclick="aipo.schedule.enablePerWeek(this.form)" #if ($!{result.Week2.toString()} == "TRUE") checked="checked" #end value="TRUE" name="week_2"/>
      <label onclick="aipo.schedule.enablePerWeek(this.form)" for="week_2_id">火</label>
      <input id="week_3_id" type="checkbox" onclick="aipo.schedule.enablePerWeek(this.form)" #if ($!{result.Week3.toString()} == "TRUE") checked="checked" #end value="TRUE" name="week_3"/>
      <label onclick="aipo.schedule.enablePerWeek(this.form)" for="week_3_id">水</label>
      <input id="week_4_id" type="checkbox" onclick="aipo.schedule.enablePerWeek(this.form)" #if ($!{result.Week4.toString()} == "TRUE") checked="checked" #end value="TRUE" name="week_4"/>
      <label onclick="aipo.schedule.enablePerWeek(this.form)" for="week_4_id">木</label>
      <input id="week_5_id" type="checkbox" onclick="aipo.schedule.enablePerWeek(this.form)" #if ($!{result.Week5.toString()} == "TRUE") checked="checked" #end value="TRUE" name="week_5"/>
      <label onclick="aipo.schedule.enablePerWeek(this.form)" for="week_5_id">金</label>
      <input id="week_6_id" type="checkbox" onclick="aipo.schedule.enablePerWeek(this.form)" #if ($!{result.Week6.toString()} == "TRUE") checked="checked" #end value="TRUE" name="week_6"/>
      <label onclick="aipo.schedule.enablePerWeek(this.form)" for="week_6_id">土</label>
      <br/>
      <input id="repeat_typeM" type="radio" value="M" #if ($!{result.RepeatType.toString()} == "M") checked="checked" #end name="repeat_type"/>
      <label for="repeat_typeM">毎月</label>
      <select onchange="aipo.schedule.enableMonth(this.form)" name="month_day">
        <option value="1">1日</option>
        <option value="2">2日</option>
        <option value="3">3日</option>
        <option value="4">4日</option>
        <option value="5">5日</option>
        <option value="6">6日</option>
        <option value="7">7日</option>
        <option value="8">8日</option>
        <option value="9">9日</option>
        <option value="10">10日</option>
        <option value="11">11日</option>
        <option value="12">12日</option>
        <option value="13">13日</option>
        <option value="14">14日</option>
        <option value="15">15日</option>
        <option value="16">16日</option>
        <option value="17">17日</option>
        <option value="18">18日</option>
        <option value="19">19日</option>
        <option value="20">20日</option>
        <option value="21">21日</option>
        <option value="22">22日</option>
        <option value="23">23日</option>
        <option value="24">24日</option>
        <option value="25">25日</option>
        <option value="26">26日</option>
        <option value="27">27日</option>
        <option value="28">28日</option>
        <option value="29">29日</option>
        <option value="30">30日</option>
        <option value="31">31日</option>
      </select>
    </div>
    <div class="p">
      <h3>繰り返し期間</h3>
      <input id="limit_flagOFF" type="radio" #if ($!{result.LimitFlag.toString()} == "OFF") checked="checked" #end value="OFF" name="limit_flag"/>
      <label for="limit_flagOFF">繰り返し期間を指定しない</label>
      <br />
      <input id="limit_flagON" type="radio"  #if ($!{result.LimitFlag.toString()} == "ON") checked="checked" #end value="ON" name="limit_flag"/>
      <label for="limit_flagON">繰り返し期間を指定する</label>
      <br />
      <span dojoType="aipo.widget.DropdownDatepicker" id="limitStartDateSpan" widgetId="limitStartDateSpan"  iconURL="images/icon/icon_date.gif" iconAlt="開始日" hiddenId="limit_start_date" #if ($!result.StartDateCheck.toString() && ($!result.StartDateCheck.toString() == "TRUE")) initValue="" #else initValue="$!{result.LimitStartDateSub}"checked="checked" #end inputId="limit_start_date_input" dateId="limit_start_date" displayCheck="none"></span>
            ～<span dojoType="aipo.widget.DropdownDatepicker" id="limitEndDateSpan" widgetId="limitEndDateSpan"  iconURL="images/icon/icon_date.gif" iconAlt="終了日" hiddenId="limit_end_date" #if ($!result.StartDateCheck.toString() && ($!result.StartDateCheck.toString() == "TRUE")) initValue="" #else initValue="$!{result.LimitEndDateSub}"checked="checked" #end inputId="limit_end_date_input" dateId="limit_end_date" displayCheck="none"></span>
    </div>
  </div>
  <div class="p">
    <h3 id="timeLabelField" style="display:#if(!$!{result.Repeat} || ($!{result.getInt($!{result.EditRepeatFlag.getValue()})} == 1))none#end">時間</h3>
    <div id="timeField"  style="display:#if($!{result.Span})none#end">
        <span id="startTimeSpan">
        <select name="start_date_hour" size="1">
            #foreach ( $num in [0..23] )
            <option value="$num" #if ($!result.StartDate.Hour == "$num") selected="selected" #end>$num時</option>
            #end
            </select>
            <select name="start_date_minute" size="1">
            <option value="0" #if ($!result.StartDate.Minute == "0") selected="selected" #end>00分</option>
            <option value="5" #if ($!result.StartDate.Minute == "5") selected="selected" #end>05分</option>
            <option value="10" #if ($!result.StartDate.Minute == "10") selected="selected" #end>10分</option>
            <option value="15" #if ($!result.StartDate.Minute == "15") selected="selected" #end>15分</option>
            <option value="20" #if ($!result.StartDate.Minute == "20") selected="selected" #end>20分</option>
            <option value="25" #if ($!result.StartDate.Minute == "25") selected="selected" #end>25分</option>
            <option value="30" #if ($!result.StartDate.Minute == "30") selected="selected" #end>30分</option>
            <option value="35" #if ($!result.StartDate.Minute == "35") selected="selected" #end>35分</option>
            <option value="40" #if ($!result.StartDate.Minute == "40") selected="selected" #end>40分</option>
            <option value="45" #if ($!result.StartDate.Minute == "45") selected="selected" #end>45分</option>
            <option value="50" #if ($!result.StartDate.Minute == "55") selected="selected" #end>50分</option>
            <option value="55" #if ($!result.StartDate.Minute == "60") selected="selected" #end>55分</option>
            </select>
        </span>～
        <span id="endTimeSpan">
            <select name="end_date_hour" size="1" onchange="aipo.schedule.changeEnd(this.form)">
            #foreach ( $num in [0..23] )
            <option value="$num" #if ($!result.EndDate.Hour == "$num") selected="selected" #end >$num時</option>
            #end
            </select>
            <select name="end_date_minute" size="1" onchange="aipo.schedule.changeEnd(this.form)">
            <option value="0" #if ($!result.EndDate.Minute == "0") selected="selected" #end>00分</option>
            <option value="5" #if ($!result.EndDate.Minute == "5") selected="selected" #end>05分</option>
            <option value="10" #if ($!result.EndDate.Minute == "10") selected="selected" #end>10分</option>
            <option value="15" #if ($!result.EndDate.Minute == "15") selected="selected" #end>15分</option>
            <option value="20" #if ($!result.EndDate.Minute == "20") selected="selected" #end>20分</option>
            <option value="25" #if ($!result.EndDate.Minute == "25") selected="selected" #end>25分</option>
            <option value="30" #if ($!result.EndDate.Minute == "30") selected="selected" #end>30分</option>
            <option value="35" #if ($!result.EndDate.Minute == "35") selected="selected" #end>35分</option>
            <option value="40" #if ($!result.EndDate.Minute == "40") selected="selected" #end>40分</option>
            <option value="45" #if ($!result.EndDate.Minute == "45") selected="selected" #end>45分</option>
            <option value="50" #if ($!result.EndDate.Minute == "55") selected="selected" #end>50分</option>
            <option value="55" #if ($!result.EndDate.Minute == "60") selected="selected" #end>55分</option>
            </select>
        </span></div>
  </div>
  <span id="repeatButtonField" style="display:#if($!{result.Span})none#end"><input name="repeat_button" type="button" class="button" value=" #if(!$!{result.Repeat} || ($!{result.getInt($!{result.EditRepeatFlag.getValue()})} == 1))繰り返す#else繰り返さない#end " onclick="aipo.schedule.formSwitchRepeat(this)" /></span>
  <span id="spanButtonField" style="display:#if($!{result.Repeat})none#end"><input name="span_button" type="button" class="button" value="#if($!{result.Span})時間で指定する#else期間で指定する#end" onclick="aipo.schedule.formSwitchSpan(this)" /></span>
#ALtditemfooter()
#ALtdcaption("#ALrequired($!result.getFieldName('name'))")
#ALtditem("#ALtextfield('name' $!result.Name '95%' 50 'active')")

#* 共有カテゴリ連携（ここから） *#
#ALtdcaption("共有カテゴリ")
#ALtditemheader()
#ALselectpdheader("common_category_id" '90%' "");
#ALselectfooter()
#ALtditemfooter()
#* 共有カテゴリ連携（ここまで） *#

#ALtdcaption("$!result.getFieldName('place')")
#ALtditem("#ALtextfield('place' $!result.Place '95%' 50 'active')")
#ALtdcaption("$!result.getFieldName('note')")
#ALtditemheader()
#ALtextarea('note' $!result.Note 5 50)
#ALtditemfooter()
#ALtdcaption($!result.getFieldName("public_flag"))
#ALtditemheader()
<input name="public_flag" type="radio" value="O" id="public_flagO_$!{portlet.ID}" #if ($!result.PublicFlag.toString() == "O") checked="checked" #end onclick="aipo.schedule.formPublicOn(this.form)"/><label for="public_flagO_$!{portlet.ID}" onclick="aipo.schedule.formPublicOn(this.form)">公開（スケジュールを全員に公開します）</label><br/>
<input name="public_flag" type="radio" value="C" id="public_flagC_$!{portlet.ID}" #if ($!result.PublicFlag.toString() == "C") checked="checked" #end onclick="aipo.schedule.formPublicOff(this.form)"/><label for="public_flagC_$!{portlet.ID}" onclick="aipo.schedule.formPublicOff(this.form)">非公開（スケジュールの日時のみを全員に公開します）</label><br/>
<input name="public_flag" type="radio" value="P" id="public_flagP_$!{portlet.ID}" #if ($!result.PublicFlag.toString() == "P") checked="checked" #end onclick="aipo.schedule.formPublicOff(this.form)"/><label for="public_flagP_$!{portlet.ID}" onclick="aipo.schedule.formPublicOff(this.form)">完全に隠す（スケジュールをすべて非公開とします）</label>
#ALtditemfooter()
#ALtdcaption("参加メンバー")
#ALtditemheader()
<div id="memberFieldButton"></div>
<div id="memberField" style="display:none;">
<table class="none">
  <tr><td>
    <div class="spaceTop spaceLeft small">左側に参加メンバーを追加してください。</div>
    <div dojoType="aipo.widget.MemberNormalSelectList" 
        id="membernormalselect" 
        widgetId="membernormalselect"  
        buttonAddId="button_member_add" 
        buttonRemoveId="button_member_remove" 
        memberFromId="tmp_member_from" 
        memberToTitle="参加メンバー一覧"
        memberToId="member_to" 
        memberFromUrl="$!jslink.getPortletById($!portlet.ID).addQueryData('template','UserLiteJSONScreen').addQueryData('mode','group').addQueryData('groupname','LoginUser')" 
        memberFromOptionKey="name" 
        memberFromOptionValue="aliasName" 
        groupSelectId="tmp_group" 
        groupSelectPreOptionKey="LoginUser"
        groupSelectPreOptionValue="（グループ全体）"
        groupSelectOptionKey="groupId" 
        groupSelectOptionValue="name" 
        memberGroupUrl="$!jslink.getPortletById($!portlet.ID).addQueryData('template','UserGroupLiteJSONScreen')" 
        changeGroupUrl="$!jslink.getPortletById($!portlet.ID).addQueryData('template','UserLiteJSONScreen').addQueryData('mode','group')">
    </div>
    <select size="5" multiple="multiple" style="display:none;" name="init_memberlist" id="init_memberlist">#foreach($record in $!result.MemberList)<option value="$!record.Name">$!record.AliasName</option>#end</select>
  </td></tr>
  <tr><td>
#if($!{result.Owner} || $!{result.EditFlag.toString()} == "T")
    <div class="p"><h3>参加メンバーによるこのスケジュールの 『編集／削除』 の可否を設定します。</h3>
    <input name="edit_flag" type="radio" value="T" id="edit_control_flagT_$!{portlet.ID}" #if ($!{result.EditFlag.toString()} == "T") checked="checked" #end><label for="edit_control_flagT_$!{portlet.ID}">可（参加メンバーは、このスケジュールを編集／削除できます）</label><br/>
    <input name="edit_flag" type="radio" value="F" id="edit_control_flagF_$!{portlet.ID}" #if ($!{result.EditFlag.toString()} == "F") checked="checked" #end><label for="edit_control_flagF_$!{portlet.ID}">不可（参加メンバーは、このスケジュールを編集／削除できません）</label></div>
#end
#if($mode!="new_form" && $!result.Member)
    <div class="p"><h3>確定したスケジュールを仮スケジュールに戻すかを設定します。</h3>
    <input name="change_tmpreserve_flag" type="radio" value="T" id="change_tmpreserve_flagT_$!{portlet.ID}" #if ($!{result.ChangeTmpreserveFlag.toString()} == "T")  checked="checked" #end><label for="change_tmpreserve_flagT_$!{portlet.ID}">戻す（確定したスケジュールを仮スケジュールに戻します）</label><br/>
    <input name="change_tmpreserve_flag" type="radio" value="F" id="change_tmpreserve_flagF_$!{portlet.ID}" #if ($!{result.ChangeTmpreserveFlag.toString()} == "F") checked="checked" #end><label for="change_tmpreserve_flagF_$!{portlet.ID}">戻さない（確定したスケジュールを仮スケジュールに戻しません）</label></div>
#end
  </td></tr>
</table>
</div>
#ALtditemfooter()
#ALtdcaption('施設')
#ALtditemheader()
<div id="facilityFieldButton" style="display:#if($!{result.Span})none#end"></div>
<div id="facilityField" style="none">
    <div class="spaceTop spaceLeft small">左側に施設を追加してください。</div>
    <div dojoType="aipo.widget.GroupNormalSelectList" 
        id="facilityselect" 
        widgetId="facilityselect" 
        buttonAddId="button_facility_add" 
        buttonRemoveId="button_facility_remove" 
        memberFromTitle="選択施設一覧"
        memberFromId="tmp_facility_from" 
        memberToTitle="施設一覧"
        memberToId="facility_to" 
        memberFromUrl="$!jslink.getPortletById($!portlet.ID).addQueryData('template','FacilityLiteJSONScreen')" 
        memberFromOptionKey="facilityId" 
        memberFromOptionValue="facilityName">
    </div>
    <select size="5" multiple="multiple" style="display:none;" name="init_facilitylist" id="init_facilitylist">#foreach($record in $!result.FacilityList)<option value="$!record.FacilityId">$!record.FacilityName</option>#end</select>
</div>
#ALtditemfooter()
#ALtablefooter()
#ALbuttonheader()
#ALsubmit($event_submit $action_str)#ALajaxbuttonClose()
#ALbuttonfooter()
<input type="hidden" id="commonUrl$!portlet.ID" name="commonUrl$!portlet.ID" value="$!jslink.getPortletById($!portlet.ID).addPathInfo('template','CommonCategoryLiteJSONScreen')" />
<input type="hidden" id="commonCategoryid$!portlet.ID" name="commonCategoryid$!portlet.ID" value="$result.CommonCategoryId.Value" />
#ALformfooter()
#ALdialogfooter()
