#*
 * 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 ($newUrl1 = $!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData('template','BlogEntryFormScreen').addQueryData('entityid','new')))
#set ($newUrl2 = $!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","BlogThemaFormScreen").addQueryData("entityid","new")))
#set ($submenulist = [["記事を書く","javascript:aipo.common.showDialog('$newUrl1','$!portlet.ID',aipo.blog.onLoadBlogDialog);","images/icon/icon_add.gif"], ["テーマを追加する","javascript:aipo.common.showDialog('$newUrl2','$!portlet.ID',aipo.blog.onLoadBlogThemaDialog);","images/icon/icon_add.gif"]])
## ---------------------------------------------------------------------------
#ALsubmenubar($submenulist "")

#macro(user_photo $photolink $username $photo_edit_link)
<table width="185" border="0" cellpadding="3" cellspacing="1" class="outer">
<tbody>
<tr>
<td style="padding:0px"><img src="images/common/dot.gif" height="1" width="1" alt="" /></td>
</tr>
<tr class="item">
<td style="padding:1px 2px 1px 2px;">$username</td>
</tr>
<tr class="item">
<td style="padding:10px" align="center">
#if($photolink != "")
<img src="$photolink" alt="$username" border="0" />
#else
<img src="images/common/nophoto.gif" alt="$username" width="76" height="76" border="0" />
#end
#if($photo_edit_link != "")
<div align="center"><a href="$!utils.escapeXML($photo_edit_link)">画像編集</a></div>
#end
</td>
</tr>
<tr>
<td style="padding:0px"><img src="images/common/dot.gif" height="1" width="1" alt="" /></td>
</tr>
</tbody>
</table>
#end

#macro(blogfootmark $footmarks $link)
<table width="185" border="0" cellpadding="3" cellspacing="1" class="outer">
<tbody>
<tr>
<td style="padding:0px"><img src="images/common/dot.gif" height="1" width="1" alt="" /></td>
</tr>
<tr>
<td align="center" class="item">あしあと</td>
</tr>
#foreach( $footmark in $footmarks )
<tr>
<td align="left" class="item">${footmark.UpdateDate}&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","BlogEntryListScreen").addQueryData('view_uid',${footmark.UserId}))', '$!portlet.ID');" >$footmark.UserName</a></td>
##<a href="$!utils.escapeXML("${link}&view_uid=${footmark.UserId}")">$footmark.UserName</a></td>
</tr>
#end
<tr>
<td style="padding:0px"><img src="images/common/dot.gif" height="1" width="1" alt="" /></td>
</tr>
</tbody>
</table>
#end

#macro(blogcalendar $month $link $prevlink $nextlink)
<table width="185" border="0" cellpadding="3" cellspacing="1" class="outer">
<tbody>
<tr>
<td colspan="7" style="padding:0px"><img src="images/common/dot.gif" height="1" width="1" alt="" /></td>
</tr>
<tr align="center">
<td colspan="7" class="item">
<table cellspacing="0" cellpadding="0"><tbody>
<tr>
<td align="center" width="20">
<a href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML("$prevlink")','$!portlet.ID');">&lt; </a>
</td>
<td align="center" width="111">${month.Year}年${month.Month}月</td>
<td align="right" width="20">
<a href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML("$nextlink")','$!portlet.ID');">&gt; </a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr align="center" class="caption">
<td class="f08" style="background-color:#FFEFE5">日</td>
<td class="f08">月</td>
<td class="f08">火</td>
<td class="f08">水</td>
<td class="f08">木</td>
<td class="f08">金</td>
<td class="f08" style="background-color:#EBF0F6">土</td>
</tr>
<tr class="item" align="right">
#set($daysize = $month.DayList.size())
#set($daycount = 0)
#foreach($record in $result.Month.DayList)
#set($daycount = $daycount + 1)
#if($record.isHolyday())
<td class="item" style="background-color:#FFEFE5">
#elseif($record.isSaturday())
<td class="item" style="background-color:#EBF0F6">
#elseif($record.isSunday())
<td class="item" style="background-color:#FFEFE5">
#else
<td class="item">
#end
#if($record.hasBlogEntry())
<a href="javascript:void(0);" onclick="aipo.viewPage('$!utils.escapeXML("${link}&template=BlogEntryListScreen&view_uid=$!{result.ViewUid}&view_day=${record.Label}&filter=null&filtertype=thema")','$!portlet.ID');">$record.Label</a>
#else
$record.Label
#end
</td>
#if($record.isSaturday() && $daycount != $daysize)
</tr>
<tr class="item" align="right">
#end
#end
</tr>
<tr>
<td colspan="7" style="padding:0px"><img src="images/common/dot.gif" height="1" width="1" alt="" /></td>
</tr>
</tbody>
</table>
#end

#set($link = "$!jslink.getPortletById($!portlet.ID).addQueryData('eventSubmit_doBlog_entry_list_user','1')")
#set($prevlink = "$!jslink.addQueryData('js_peid',$!portlet.ID).addQueryData('template','BlogEntryListScreen').addQueryData('eventSubmit_doBlog_entry_list_user','1').addQueryData('view_month',$!{result.PrevMonth.toString()}).addQueryData('view_uid', $!{result.ViewUid})")
#set($nextlink = "$!jslink.addQueryData('js_peid',$!portlet.ID).addQueryData('template','BlogEntryListScreen').addQueryData('eventSubmit_doBlog_entry_list_user','1').addQueryData('view_month',$!{result.NextMonth.toString()}).addQueryData('view_uid', $!{result.ViewUid})")
#set($footmarklink = "$!jslink.addQueryData('js_peid',$!portlet.ID).addQueryData('eventSubmit_doBlog_entry_list_user','1')")
#if($!{result.hasPhoto()})
#set($userphoto_link = "$jslink.getTemplate('FileuploadFacePhotoScreen').addQueryData('uid', $!{result.ViewUid})")
#else
#set($userphoto_link = "")
#end

#if($result.LoginUid == $result.ViewUid)
#set($tabs = [["${result.Month.Month}月 記事一覧", "",""]])
#set ($leftcontents = ["#user_photo($userphoto_link ${result.ViewUname} ${result.UserAccountURI})", "#blogcalendar($result.Month $link $prevlink $nextlink)", "#blogfootmark($result.FootmarkList $footmarklink)"])
#else
#set($tabs = [["${result.Month.Month}月 記事一覧（$result.ViewUname）", "",""]])
#set ($leftcontents = ["#user_photo($userphoto_link ${result.ViewUname} '')", "#blogcalendar($result.Month $link $prevlink $nextlink)"])
#end

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="200" valign="top" rowspan="3">
<table width="200"  border="0" cellspacing="5" cellpadding="0">
<tbody>
#foreach($content in $leftcontents)
<tr>
<td align="center">
$content
</td>
</tr>
#end
</tbody>
</table>
</td>
<td colspan="3" valign="top">
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td colspan="3" height="6"><img src="images/common/dot.gif" width="2" height="6" alt="" /></td>
</tr>
<tr>
<td width="8"><img src="images/common/dot.gif" width="8" height="2" alt="" /></td>
<td valign="top" width="100%">
							
#ALtabheader($tabs "")
#ALspacebothheader()
<div class="p">
#ALformheader('Blog' $jslink $portlet)
#ALtableheaderSimpleWide()
#ALtdcaption('テーマ')
#ALtditemheader()
<select name="thema" onchange="aipo.viewPage(this.options[this.selectedIndex].value, '$!portlet.ID')">
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","BlogEntryListScreen").addQueryData("eventSubmit_doBlog_entry_list_user","1").addQueryData("filter","").addQueryData("filtertype","thema").addQueryData("view_uid", $!{result.ViewUid}))">（全体）</option>
#foreach( $record in $result.ThemaList )
<option value="$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","BlogEntryListScreen").addQueryData("eventSubmit_doBlog_entry_list_user","1").addQueryData("filter",$!record.ThemaId).addQueryData("filtertype","thema").addQueryData("view_uid", $!{result.ViewUid}))" #if ($!result.CurrentFilter && $!result.CurrentFilter == $!record.ThemaId.toString()) selected #end>$!record.ThemaName</option>
#end
</select>
#ALtditemfooter()
#ALtablefooter()
#ALformfooter()
</div>
#if($result.List.size() == 0)
<div class="message">指定された条件に該当する記事はありません。</div>
#else
<div class="p">
#ALajaxpageview('BlogEntryListScreen' $result)
</div>
#foreach ($record in $result.List)
#if($record)
<div class="p">
<h3>$record.TitleDate &nbsp;  <a href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","BlogDetailScreen").addQueryData('entityid',$record.EntryId))','$!portlet.ID',aipo.blog.onLoadBlogCommentDialog);">${record.Title}</a></h3>
$record.Note
<table width="100%"  border="0" cellspacing="0" cellpadding="0"><tbody>
<tr>
<td align="right"> #if(${record.CommentsNum} == 0) コメント(0) #else <a href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","BlogDetailScreen").addQueryData('entityid',$record.EntryId))','$!portlet.ID',aipo.blog.onLoadBlogCommentDialog);">コメント(${record.CommentsNum}) </a> #end | <a href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","BlogDetailScreen").addQueryData('entityid',$record.EntryId))','$!portlet.ID',aipo.blog.onLoadBlogCommentDialog);">続きはこちら </a>
#if($result.LoginUid == $result.ViewUid)
| <a href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","BlogEntryFormScreen").addQueryData('eventSubmit_doBlog_entry_form','1').addQueryData('entityid',$record.EntryId))','$!portlet.ID',aipo.blog.onLoadBlogDialog);">編集 </a>
#end
</td>
</tr>
</tbody>
</table>
</div>
#end
#end
#ALajaxpageviewFooter('BlogEntryListScreen' $result)
#end
#ALspacebothfooter()
#ALajaxtabfooter()
</td>
<td width="6"><img src="images/common/dot.gif" width="6" height="2" alt="" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
