#*
 * 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("filter","").addQueryData("filtertype","group"))">（選択してください）</option>
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("filter","").addQueryData("filtertype","group"))" #if ($!result.CurrentFilter && $!record.Name.toString() && $!result.CurrentFilter == $!record.Name.toString()) selected="selected" #end>----------</option>
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("filter","Facility").addQueryData("filtertype","group"))" #if ($!result.CurrentFilter && $!record.Name.toString() && $!result.CurrentFilter == "Facility") selected="selected" #end>施設一覧</option>
#foreach( $record in $result.GroupList )
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("filter",$!record.Name).addQueryData("filtertype","group"))" #if ($!result.CurrentFilter && $!record.Name.toString() && $!result.CurrentFilter == $!record.Name.toString()) selected="selected" #end>$!record.AliasName</option>
#end
#if(($result.GroupList.size() > 0) && ($result.PostMap.size() > 0))
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("filter","").addQueryData("filtertype","group"))" #if ($!result.CurrentFilter && $!record.Name.toString() && $!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("filter",$!record.GroupName).addQueryData("filtertype","group"))" #if ($!result.CurrentFilter && $!record.Name.toString() && $!result.CurrentFilter == $!record.GroupName.toString()) selected="selected" #end>$!record.PostName</option>
#end
</select>
#ALtditemfooter()
#ALtablefooter()
<table border="0" cellspacing="0" cellpadding="2">
<tbody>
<tr valign="middle"><td>
<a href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("view_start",$!{result.PrevWeek.toString()}))', '$!portlet.ID');" title="前の週へ">
<img src="images/schedule/arrow_left_w.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_start",$!{result.PrevDate.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.ViewStart.Year} 年 $!{result.ViewStart.Month} 月 $!{result.ViewStart.Day} 日 $!{result.ViewStart.DayOfWeek} ～ $!{result.ViewEnd.Month} 月 $!{result.ViewEnd.Day} 日 $!{result.ViewEnd.DayOfWeek}
</span></td><td>
<a href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","$!{schedulescreen}").addQueryData("view_start",$!{result.NextDate.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_start",$!{result.NextWeek.toString()}))', '$!portlet.ID');" title="次の週へ">
<img src="images/schedule/arrow_right_w.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_start",$!{result.Today.toString()}))', '$!portlet.ID');" title="今日へ">
<img src="images/schedule/schedule_today.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_start",$!{result.PrevMonth.toString()}))', '$!portlet.ID');" title="前月へ">
<img src="images/schedule/schedule_prevmonth.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_start",$!{result.NextMonth.toString()}))', '$!portlet.ID');" title="翌月へ">
<img src="images/schedule/schedule_nextmonth.gif" border="0"  alt="翌月へ" /></a>&nbsp;
</td></tr></tbody></table>
#if(($result.GroupList.size() <= 0) && ($result.PostMap.size() <= 0))
&nbsp;&nbsp;<a href="$!result.MyGroupURI">こちらでグループを追加してください。</a>
#end
#if($result.MemberList.size() == 0 && $result.FacilityList.size() == 0)
<div class="message">選択したグループには、ユーザーおよび施設が登録されていません。</div>
#else
#ALtableheaderCalendar("100%")
<tr>
#foreach ( $num in [1..8] )
<td class="calendarHeader"><img src="images/common/dot.gif" height="1" alt="" /></td> 
#end
</tr> 																				
<tr>
#ALtdheadAtt("" "nowrap='nowrap'")
#if($result.MemberList.size() > 0)
#set($daylist = ${result.getContainer($result.MemberList.get(0).UserId.Value).DayList})
#else
#set($daylist = ${result.getFacilityContainer($result.FacilityList.get(0).FacilityId.Value).DayList})
#end
#foreach($record in $daylist)
#if($!{record.isHoliday()})
#set ($stday = $velocityCount )
#ALtdheadheaderAtt("class='holiday' nowrap='nowrap'")
$!{record.Date.Day} $!{record.Date.DayOfWeek}
<div class="holiday small">${record.Holiday.Name}</div>
#elseif($!{record.Date.Value.Day} == 0)
#set ($stday = $velocityCount )
#ALtdheadheaderAtt("class='sunday' nowrap='nowrap'")
$!{record.Date.Day} $!{record.Date.DayOfWeek}
#elseif($!{record.Date.Value.Day} == 6)
#set ($sunday = $velocityCount )
#ALtdheadheaderAtt("class='saturday' nowrap='nowrap'")
$!{record.Date.Day} $!{record.Date.DayOfWeek}
#else
#ALtdheadheaderAtt("nowrap='nowrap'")
$!{record.Date.Day} $!{record.Date.DayOfWeek}
#end
#ALtdheadfooter()
#end
</tr>

#foreach($record3 in $result.MemberList)
<tr>
#set($record3rowcount = $result.getTermContainer($record3.UserId.Value).size() + 1 + $result.getToDoContainer($record3.UserId.Value).size())
#set($rowspanstr = "rowspan=$record3rowcount")
#set($show_tr = 0)
#ALtdheadAtt("$record3.AliasName" "$rowspanstr")
### 期間スケジュール（ここから） ###
#foreach($termcontainer in ${result.getTermContainer($record3.UserId.Value)})
#if($show_tr > 0)
<tr>
#end
#set($nottermcount = 0)
#foreach($record4 in $termcontainer.DayList)
#if( ! $record4.isTermNull() )
##if($record4.TermResultData.isShowDetail())
#if($nottermcount > 0)
#ALtdcellAtt("" "colspan='$nottermcount'")
#end
#set($addScheduleLink = "")
#ALtdcellheaderAtt("colspan='$!{record4.TermResultData.Rowspan}'")
<div class="calerndarTermScheduleDiv small">
#if(${record4.TermResultData.isShowDetail()})
<a href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","ScheduleDetailScreen").addQueryData("entityid",$!{record4.TermResultData.ScheduleId}).addQueryData('userid', $!{record3.UserId}).addQueryData('view_date', $!{record4.Date.toString()}))', '$!portlet.ID', aipo.schedule.onLoadScheduleDetail);" class="small">$!{record4.TermResultData.Name}
#if(!${record4.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(${record4.TermResultData.isTmpreserve()})<img class="icon_schedule" src="images/schedule/schedule_tmpreserve.gif" alt="仮スケジュール" title="仮スケジュール" />#end
</a>
#else
$!{record4.TermResultData.Name}
#if(!${record4.TermResultData.isPublic()})
<img class="icon_schedule" src="images/schedule/schedule_secret.gif" alt="非公開" title="非公開" />
#end
#if(${record4.TermResultData.isTmpreserve()})
<img class="icon_schedule" src="images/schedule/schedule_tmpreserve.gif" alt="仮スケジュール" title="仮スケジュール" />
#end
#end
</div>
#ALtdcellfooter()
#set($nottermcount = 0)
##end
#elseif (! $record4.isHasTerm() )
#set($nottermcount = $nottermcount + 1)
#end
#end
#if($nottermcount > 0)
#ALtdcellAtt("" "colspan='$nottermcount'")
#end
</tr>
#set($show_tr = $show_tr + 1 )
#end
### 期間スケジュール（ここまで） ###
### １日もしくは繰り返しスケジュール（ここから） ###
#if($show_tr > 0)
<tr>
#end
#foreach($record in ${result.getContainer($record3.UserId.Value).DayList})
#set ($color_style = "")
#set ($color_style_holiday = "")
#set ($color_style_othermonth = "")
#set ($holiday_name = "")
#if($!{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
<td class="topNone${color_style}${color_style_holiday}"> 
#if($record.ScheduleList.size() <= 0)
<div class="calendarBody">
<div class="calendarScheduleDiv">
#if($!{result.hasAuthoritySelfInsert()})
#if($record3.UserId.Value == $result.UserId)
#set($addScheduleLink = "$!jslink.getPortletById($!portlet.ID).addQueryData('template','ScheduleFormScreen').addQueryData('entityid','new').addQueryData('form_start', $!{record.Date.toString()}).addQueryData('form_end', $!{record.Date.toString()})")
#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()}).addQueryData('member_to', $!{record3.getName().getValue()})")
#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', $!{record3.UserId}).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()})
#if($record3.UserId.Value == $result.UserId)
#set($addScheduleLink = "$!jslink.getPortletById($!portlet.ID).addQueryData('template','ScheduleFormScreen').addQueryData('entityid','new').addQueryData('form_start', $!{record.Date.toString()}).addQueryData('form_end', $!{record.Date.toString()})")
#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()}).addQueryData('member_to', $!{record3.getName().getValue()})")
#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
#if($show_tr == 0)
</tr>
#end
#set($show_tr = $show_tr + 1 )
### １日もしくは繰り返しスケジュール（ここまで） ###
### ToDoリスト（ここから） ###
#foreach($todocontainer in ${result.getToDoContainer($record3.UserId.Value)})
<tr>
#set($nottodocount = 0)
#foreach($record in $todocontainer.DayList)
#if( ! $record.isTodoNull() )
#if($nottodocount > 0)
#ALtdcellAtt("" "colspan='$nottodocount' style='vertical-align:top;background-color:#FFFFFF;line-height: 8pt;'")
#end
#ALtdcellheaderAtt("colspan='$!{record.ToDoResultData.Rowspan}' align='center' style='vertical-align:top;background-color:#FFE5E5;line-height: 8pt;'")
<div class="calerndarTodoDiv small">
#if($record3.UserId.Value == $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
$!{record.ToDoResultData.TodoName}
#if(! ${record.ToDoResultData.isPublic()})
<img class="icon_schedule" src="images/todo/todo_secret.gif" alt="非公開" title="非公開" />
#end
</a>
</div>
#ALtdcellfooter()
#set($nottodocount = 0)
#elseif (! $record.isHasTodo() )
#set($nottodocount = $nottodocount + 1)
#end
#end
#if($nottodocount > 0)
#ALtdcellAtt("" "colspan='$nottodocount' style='vertical-align:top;background-color:#FFFFFF;line-height:8pt;'")
#end
</tr>
#end
### ToDoリスト（ここまで） ###
#end
### 施設スケジュール（ここから） ###
#foreach($record3 in $result.FacilityList)
<tr></tr>
#set($record3rowcount = 1)
#set($rowspanstr = "rowspan=$record3rowcount")
#ALtdheadAtt("$record3.FacilityName" "$rowspanstr")
#foreach($record in ${result.getFacilityContainer($record3.FacilityId.Value).DayList})
#if($!{record.Date.Value.equals($result.Today.Value)})
#if($!{record.isHoliday()})
#ALtdcellheaderAtt("class='holiday' style='vertical-align:top;' height='100%'")
#else
#ALtdcellheaderAtt("style='vertical-align:top;' height='100%'")
#end
##<table class="outer" cellspacing="1" cellpadding="2" width="100%" height="100%"><tbody><tr ><td class="item" style="vertical-align:top;background-color:#FFFFE5" height="100%">
#elseif($!{record.isHoliday()})
#ALtdcellheaderAtt("class='holiday' style='vertical-align:top;'")
#elseif($!{record.Date.Value.Day} == 0)
#ALtdcellheaderAtt("class='sunday' style='vertical-align:top;'")
#elseif($!{record.Date.Value.Day} == 6)
#ALtdcellheaderAtt("class='saturday' style='vertical-align:top;'")
#else
#ALtdcellheaderAtt("style='vertical-align:top;'")
#end

#if($record.ScheduleList.size() <= 0)
<div class="calendarBody">
<div class="calendarScheduleDiv">
#if($!{result.hasAuthorityFacilityInsert()})
#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', $!{record3.FacilityId.Value})")
<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()})
#if($record2.isShowDetail())
#set($addScheduleLink = "$!jslink.getPortletById($!portlet.ID).addQueryData('template','ScheduleDetailScreen').addQueryData('entityid', $!{record2.ScheduleId}).addQueryData('view_date', $!{record.Date.toString()}).addQueryData('facilityid', $record3.FacilityId.Value)")
<div class="calendarScheduleDiv">
	
<div class="small time">${record2.Date}</div>
<div class="small"><a class="small" href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($addScheduleLink)', '$!portlet.ID', aipo.schedule.onLoadScheduleDetail)">$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
#end
#end
<div class="calendarScheduleDiv">
#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', $!{record3.FacilityId.Value})")
<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>
</div>
#end
#if($!{record.Date.Value.equals($result.Today.Value)})
##</td></tr></tbody></table>
#end
#ALtdcellfooter()
#end
</tr>
#end
### 施設スケジュール（ここまで） ###
#ALtablefooter()
#end
