#*
 * 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/>.
 *#
## ---------------------------------------------------------------------------
#ALtableheaderSimpleWide()
#ALtdcaption('ユーザー')
#ALtditemheader()
<select onchange="aipo.viewPage(this.options[this.selectedIndex].value, '$!portlet.ID')">
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("target_group_name","all").addQueryData("target_user_id","none"))">（グループ全体）</option>
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("target_group_name","Facility"))" #if ($!result.TargetGroupName && $!result.TargetGroupName == "Facility") selected="selected" #end>施設一覧</option>
#foreach( $record in $result.MyGroupList )
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("target_group_name",$!{record.Name.toString()}).addQueryData("target_user_id","none"))" #if($!result.TargetGroupName == $!record.Name.toString()) selected="selected" #end>$!record.AliasName</option>
#end
#if($!{result.GroupList} && ($result.GroupList.size() > 0) && ${result.PostMap} && ($result.PostMap.size() > 0))
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("target_group_name","all").addQueryData("target_user_id", "none"))" #if ($!result.CurrentFilter == $!record.Name.toString()) selected="selected" #end>----------</option>
#end
#foreach( $record in $result.PostMap )
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("target_group_name",$!{record.GroupName.toString()}).addQueryData("target_user_id", "none"))" #if($!result.TargetGroupName == $!record.GroupName.toString()) selected="selected" #end>$!record.PostName</option>
#end
</select>
<select name="target_user_id" onchange="aipo.viewPage(this.options[this.selectedIndex].value, '$!portlet.ID')">
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("target_group_name",$!{result.TargetGroupName}).addQueryData("target_user_id","none"))">（ユーザー／施設の選択）</option>
#foreach($record in $!result.Users)
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("target_group_name",$!{result.TargetGroupName}).addQueryData("target_user_id",$!{record.UserId.toString()}))" #if($!result.TargetUserId != "all") #if($!result.TargetUserId == $!record.UserId.toString()) selected="selected" #end #end>$!record.AliasName</option>
#end
#if(($result.Users.size() > 0) && ($result.FacilityList.size() > 0))
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("target_group_name","all").addQueryData("target_user_id", "none"))" #if ($result.CurrentFilter && $!result.CurrentFilter == $!record.Name.toString()) selected="selected" #end>----------</option>
#end
#foreach($record in $!result.FacilityList)
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("target_group_name",$!{result.TargetGroupName}).addQueryData("target_user_id","f$!{record.FacilityId.toString()}"))" #if($!result.TargetUserId != "all") #if($!result.TargetUserId == "f$!record.FacilityId.toString()") selected="selected" #end #end>$!record.FacilityName</option>
#end
</select>
#ALtditemfooter()
#ALtablefooter()

<table border="0" cellspacing="0" cellpadding="2">
<tr valign="middle"><td>
<a href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("view_month",$!{result.PrevMonth.toString()}))', '$!portlet.ID');" title="前月へ">
<img src="images/schedule/arrow_left.gif" border="0" alt="前月へ" /></a>&nbsp;
</td><td nowrap="nowrap"><span style="font-weight:bold">
$!{result.ViewMonth.Year} 年 $!{result.ViewMonth.Month} 月
</span></td><td>
<a href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("view_month",$!{result.NextMonth.toString()}))', '$!portlet.ID');" title="翌月へ">
<img src="images/schedule/arrow_right.gif" border="0" alt="翌月へ" /></a>&nbsp;
</td><td>
<a href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("view_month",$!{result.CurrentMonth.toString()}))', '$!portlet.ID');" title="今月へ">
<img src="images/schedule/schedule_currentmonth.gif" border="0" alt="今月へ" /></a>&nbsp;
</td></tr></table>
#if($!result.Users.size() <= 0 && $!result.FacilityList.size() <= 0)
<div class="message">選択したグループには、ユーザーおよび施設が登録されていません。</div>
#else
#ALtableheaderCalendar("100%")
<tr> 
<td class="calendarHeader"><img src="images/common/dot.gif" width="50" height="1" alt="" /></td> 
<td class="calendarHeader"><img src="images/common/dot.gif" width="50" height="1" alt="" /></td> 
<td class="calendarHeader"><img src="images/common/dot.gif" width="50" height="1" alt="" /></td> 
<td class="calendarHeader"><img src="images/common/dot.gif" width="50" height="1" alt="" /></td> 
<td class="calendarHeader"><img src="images/common/dot.gif" width="50" height="1" alt="" /></td> 
<td class="calendarHeader"><img src="images/common/dot.gif" width="50" height="1" alt="" /></td> 
<td class="calendarHeader"><img src="images/common/dot.gif" width="50" height="1" alt="" /></td> 
</tr>   
<tr>
#ALtdheadAtt("日" "class='sunday'")
#ALtdhead("月")
#ALtdhead("火")
#ALtdhead("水")
#ALtdhead("木")
#ALtdhead("金")
#ALtdheadAtt("土" "class='saturday'")
</tr>
#set($weekListSize = $result.Container.WeekList.size())
#set($weekcount = 0)
#foreach($record4 in $result.Container.WeekList)
#set($termConListSize = ${result.TermContainer.getWeekList($weekcount).size()})
#if($!{result.ToDoContainer.getWeekList($weekcount)})
#set($todoConList = $!{result.ToDoContainer.getWeekList($weekcount)})
#if($!todoConList) #set($todoConListSize = $!{todoConList.size()}) #else #set($todoConListSize = 0) #end
#else #set($todoConListSize = 0)
#end
<tr>
#foreach($record in $record4.DayList)
#set ($color_style = "")
#set ($color_style_holiday = "")
#set ($color_style_othermonth = "")
#set ($holiday_name = "")
#if($!{record.Date.Value.Day} == 0)
#set ($color_style = " sunday2")
#elseif($!{record.Date.Value.Day} == 6)
#set ($color_style = " saturday2")
#end
#if($!{record.isHoliday()})
#set ($color_style_holiday = " holiday2")
#set ($holiday_name = "${record.Holiday.Name}")
#end
#if(! ($!{result.ViewMonth.Month.toString()} == ${record.Date.Month.toString()}))
#set ($color_style_othermonth = " off2")
#end

<td class="day${color_style}${color_style_holiday}${color_style_othermonth}"> 
<div class="calendarDay clearfix">#if($!{record.isHoliday()})<span class="alignleft small">${holiday_name}</span>#end<span class="alignright small">$!{record.Date.Day}</span></div> 
</td> 
#end
</tr>
### 期間スケジュール（ここから） ###
#if($termConListSize > 0)
#foreach($termcontainer in ${result.TermContainer.getWeekList($weekcount)})
<tr>
#set($nottermcount = 0)
#foreach($record in $termcontainer.DayList)
#set ($color_style = "")
#set ($color_style_holiday = "")
#set ($color_style_othermonth = "")
#if($!{result.Today.Value} == $!{record.Date.Value})
#set ($color_style = " today")
#elseif($!{record.Date.Value.Day} == 0)
#set ($color_style = " sunday")
#elseif($!{record.Date.Value.Day} == 6)
#set ($color_style = " saturday")
#end
#if($!{record.isHoliday()})
#set ($color_style_holiday = " holiday")
#end
#if(! ($!{result.ViewMonth.Month.toString()} == ${record.Date.Month.toString()}))
#set ($color_style_othermonth = " off")
#end
#if( ! $record.isTermNull() )
##if($record.TermResultData.isShowDetail())
#set ($col_span = $!{record.TermResultData.Rowspan})
#set($addScheduleLink = "$!jslink.getPortletById($!portlet.ID).addQueryData('template','ScheduleDetailScreen').addQueryData('entityid',$!{record.TermResultData.ScheduleId}).addQueryData('userid', $!{result.TargetUserId}).addQueryData('view_date', $!{record.Date.toString()})")
<td colspan="$col_span" class="term${color_style}${color_style_holiday}${color_style_othermonth}">
<div class="calerndarTermScheduleDiv small">
#if(${record.TermResultData.isShowDetail()})
<a href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($addScheduleLink)', '$!portlet.ID', aipo.schedule.onLoadScheduleDetail);" class="small">$!{record.TermResultData.Name}
#if(!${record.TermResultData.isPublic()})&nbsp;<img class="icon_schedule" src="images/schedule/schedule_secret.gif" alt="非公開" title="非公開" />#else<img class="dot_schedule" src="images/common/dot.gif" alt="" />#end
#if(${record.TermResultData.isTmpreserve()})<img class="icon_schedule" src="images/schedule/schedule_tmpreserve.gif" alt="仮スケジュール" title="仮スケジュール" />#end
</a>
#else
$!{record.TermResultData.Name}
#if(!${record.TermResultData.isPublic()})
<img class="icon_schedule" src="images/schedule/schedule_secret.gif" alt="非公開" title="非公開" />
#end
#if(${record.TermResultData.isTmpreserve()})
<img class="icon_schedule" src="images/schedule/schedule_tmpreserve.gif" alt="仮スケジュール" title="仮スケジュール" />
#end
#end
</div>
</td>
#set ($col_span = $col_span - 1)
##end
#else
<td class="term${color_style}${color_style_holiday}${color_style_othermonth}" #if($col_span > 0 ) style="display:none" #else style="display:" #end></td> 
#set ($col_span = $col_span - 1)
#end
#end
</tr>
#end
#end
### 期間スケジュール（ここまで） ###
<tr>
#foreach($record in $record4.DayList)
#set ($color_style = "")
#set ($color_style_holiday = "")
#set ($color_style_othermonth = "")
#set ($holiday_name = "")
#if($!{result.Today.Value} == $!{record.Date.Value})
#set ($color_style = " today")
#elseif($!{record.Date.Value.Day} == 0)
#set ($color_style = " sunday")
#elseif($!{record.Date.Value.Day} == 6)
#set ($color_style = " saturday")
#end
#if($!{record.isHoliday()})
#set ($color_style_holiday = " holiday")
#set ($holiday_name = "${record.Holiday.Name}")
#end
#if(! ($!{result.ViewMonth.Month.toString()} == ${record.Date.Month.toString()}))
#set ($color_style_othermonth = " off")
#end

<td class="topNone${color_style}${color_style_holiday}${color_style_othermonth}"> 
#if($record.ScheduleList.size() <= 0)
<div class="calendarBody">
<div class="calendarScheduleDiv">
#if($!{result.hasAuthoritySelfInsert()} && (!$result.TargetUserId.startsWith('f') || $!{result.hasAuthorityFacilityInsert()}))
#if($result.TargetUserId.startsWith('f'))
#set($addScheduleLink = "$!jslink.getPortletById($!portlet.ID).addQueryData('template','ScheduleFormScreen').addQueryData('entityid','new').addQueryData('form_start', $!{record.Date.toString()}).addQueryData('form_end', $!{record.Date.toString()}).addQueryData('facility_to', $result.TargetUserId.substring(1))")
#elseif(($result.UserId != $result.TargetUserId) && $result.TargetUserName)
#set($addScheduleLink = "$!jslink.getPortletById($!portlet.ID).addQueryData('template','ScheduleFormScreen').addQueryData('entityid','new').addQueryData('form_start', $!{record.Date.toString()}).addQueryData('form_end', $!{record.Date.toString()}).addQueryData('member_to', $result.TargetUserName)") 
#else
#set($addScheduleLink = "$!jslink.getPortletById($!portlet.ID).addQueryData('template','ScheduleFormScreen').addQueryData('entityid','new').addQueryData('form_start', $!{record.Date.toString()}).addQueryData('form_end', $!{record.Date.toString()})")
#end
<a href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($addScheduleLink)', '$!portlet.ID', aipo.schedule.onLoadScheduleDialog)" title="予定追加"><img class="icon_schedule" src="images/icon/icon_edit.gif" alt="予定追加" /></a>
#end
</div>
</div>
#else
#foreach($record2 in $record.ScheduleList)
#if(! ${record2.isDummy()})
<div> 
#if($record2.isShowDetail())
#set($addScheduleLink = "$!jslink.getPortletById($!portlet.ID).addQueryData('template','ScheduleDetailScreen').addQueryData('entityid', $!{record2.ScheduleId}).addQueryData('userid', $!{result.TargetUserId}).addQueryData('view_date', $!{record.Date.toString()})")
<div class="calendarScheduleDiv"> 
<div class="small time">$!{record2.Date}</div> 
<div class="small"><a href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($addScheduleLink)', '$!portlet.ID', aipo.schedule.onLoadScheduleDetail)" class="small">$!{record2.Name}</a></div> 
</div> 
#else
<div class="calendarScheduleDiv"> 
<div class="small time">$!{record2.Date}</div> 
<div class="small">$!{record2.Name}</div> 
</div> 
#end
#if(! ${record2.isPublic()})
<img class="icon_schedule" src="images/schedule/schedule_secret.gif" alt="非公開" title="非公開" />
#end
#if($record2.isDuplicate())
<img class="icon_schedule" src="images/schedule/schedule_duplicate.gif" alt="重複スケジュール" title="重複スケジュール" />
#end
#if(${record2.isRepeat()})
<img class="icon_schedule" src="images/schedule/schedule_repeat.gif" alt="繰り返し" title="繰り返し" />
#end
#if($record2.isTmpreserve())
<img class="icon_schedule" src="images/schedule/schedule_tmpreserve.gif" alt="仮スケジュール" title="仮スケジュール" />
#end
</div> 
#end
#end
<div class="calendarScheduleDiv">
#if($!{result.hasAuthoritySelfInsert()} && (!$result.TargetUserId.startsWith('f') || $!{result.hasAuthorityFacilityInsert()}))
#if($result.TargetUserId.startsWith('f'))
#set($addScheduleLink = "$!jslink.getPortletById($!portlet.ID).addQueryData('template','ScheduleFormScreen').addQueryData('entityid','new').addQueryData('form_start', $!{record.Date.toString()}).addQueryData('form_end', $!{record.Date.toString()}).addQueryData('facility_to', $result.TargetUserId.substring(1))")
#elseif(($result.UserId != $result.TargetUserId) && $result.TargetUserName)
#set($addScheduleLink = "$!jslink.getPortletById($!portlet.ID).addQueryData('template','ScheduleFormScreen').addQueryData('entityid','new').addQueryData('form_start', $!{record.Date.toString()}).addQueryData('form_end', $!{record.Date.toString()}).addQueryData('member_to', $result.TargetUserName)") 
#else
#set($addScheduleLink = "$!jslink.getPortletById($!portlet.ID).addQueryData('template','ScheduleFormScreen').addQueryData('entityid','new').addQueryData('form_start', $!{record.Date.toString()}).addQueryData('form_end', $!{record.Date.toString()})")
#end
<a href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($addScheduleLink)', '$!portlet.ID', aipo.schedule.onLoadScheduleDialog)" title="予定追加"><img class="icon_schedule" src="images/icon/icon_edit.gif" alt="予定追加" /></a>
#end
</div>
#end
<div class="calendarFooter"></div> 
</td> 
#end
</tr>

#if($todoConListSize > 0)
#foreach($todocontainer in ${result.ToDoContainer.getWeekList($weekcount)})
<tr>
#set($nottodocount = 0)
#foreach($record in $todocontainer.DayList)
#if( ! $record.isTodoNull() )
#if($nottodocount > 0)
#ALtdcellAtt("" "colspan='$nottodocount'")
#end
#ALtdcellheaderAtt("colspan='$!{record.ToDoResultData.Rowspan}' align='center'")
<div class="calerndarTodoDiv small">
#if($result.TargetUserId == $result.UserId) 
<a class="small" href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoDetailScreen").addQueryData("entityid",$!{record.ToDoResultData.TodoId}))');"> 
#else 
<a class="small" href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoPublicDetailScreen").addQueryData("entityid",$!{record.ToDoResultData.TodoId}))');"> 
#end     
##<a class="small" href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ToDoDetailScreen").addQueryData("entityid",$!{record.ToDoResultData.TodoId}))');">  
$!{record.ToDoResultData.TodoName}
#if(! ${record.ToDoResultData.isPublic()})
<img class="icon_schedule" src="images/schedule/schedule_secret.gif" alt="非公開" title="非公開" />
#end
</a>
</div>
</td>
#set($nottodocount = 0)
#elseif (! $record.isHasTodo() )
#set($nottodocount = $nottodocount + 1)
#end
#end
#if($nottodocount > 0)
#ALtdcellAtt("" "colspan='$nottodocount'")
#end
</tr>
#end
#end

#set($weekcount = $weekcount + 1)
#end
#ALtablefooter()
#end
