#*
 * Aipo is a groupware program developed by Aimluck,Inc.
 * Copyright (C) 2004-2011 Aimluck,Inc.
 * http://www.aipo.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 ($action_str = "返信する")
#set ($subtitle = 'トピック詳細')
#set ($event_submit = "eventSubmit_doMsgboard_update")
#set ($indicator_id = "indicator-dlg-")
## ---------------------------------------------------------------------------
#ALdialogheader($subtitle)
#ALajaxIndicator("$indicator_id" "$!portlet.ID" "")
#ALajaxdetailformheader("書き込み")
#ALtableheaderWide()
<tr>
#ALtdheadheaderAtt("style='text-align:left; white-space: normal'")
#if ($!result.ParentTopic.CategoryId && $!result.ParentTopic.CategoryId.toString() != "1")
<a href="javascript:void(0);" onclick="aipo.common.showDialog('$!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","MsgboardCategoryDetailScreen").addQueryData("entityid",$!result.ParentTopic.CategoryId))');">$!result.ParentTopic.CategoryName</a>
#if(! $!{result.ParentTopic.isPublic()})
<img src="images/msgboard/msgboard_secret.gif" border="0" width="16" height="16" align="absmiddle" alt="非公開" title="非公開">
#end
#else
$!result.ParentTopic.CategoryName
#end
##&gt;&nbsp;$!{result.ParentTopic.TopicName}
#ALtdheadfooter()
</tr>
<tr>
#ALtditemheader()
<div class="clearfix">
<h3>$!{result.ParentTopic.TopicName}</h3>
<div class="alignleft">
投稿者：$!{result.ParentTopic.OwnerName}&nbsp;&nbsp;&nbsp;投稿日：$!{result.ParentTopic.CreateDate.Year}年$!{result.ParentTopic.CreateDate.Month}月$!{result.ParentTopic.CreateDate.Day}日$!{result.ParentTopic.CreateDate.Hour}時$!{result.ParentTopic.CreateDate.Minute}分
</div>
<div class="alignright">
#if($!result.isMatch($!{result.UserId} , $!{result.ParentTopic.OwnerId.Value}) || $!result.hasAclUpdateTopicOthers())
#ALajaxbuttonEditCallback("$!jslink.getPortletById($!portlet.ID).addQueryData('template','MsgboardTopicFormScreen').addQueryData('entityid',$entityid)" "$!portlet.ID" "aipo.msgboard.onLoadMsgboardDialog")
#end
#if($!result.isMatch($!{result.UserId} , $!{result.ParentTopic.OwnerId.Value}) || $!result.hasAclDeleteTopicOthers())
#ALajaxbuttonDelete("$!jslink.getPortletById($!portlet.ID).addQueryData('template','MsgboardTopicFormJSONScreen').addQueryData('entityid',$entityid).addQueryData('mode', 'delete')" "$indicator_id" "$!portlet.ID" "aipo.msgboard.onReceiveMessage")
#end
</div>
</div>
<div>
$!{result.ParentTopic.Note}
#if($!result.ParentTopic.AttachmentFileList && $!result.ParentTopic.AttachmentFileList.size() > 0)
<div style="padding-top:15px;">
#foreach( $attachmentFile in $!result.ParentTopic.AttachmentFileList )
<div style="padding-top:5px;">
<img src="images/msgboard/msgboard_item.gif">&nbsp;<a href="$jslink.getTemplate("MsgboardTopicFileRawScreen").addQueryData("ownerid", $!{result.ParentTopic.OwnerId}).addQueryData("entityid", $!result.ParentTopic.TopicId).addQueryData("attachmentIndex", $attachmentFile.FileId)">$result.getStringCR($attachmentFile.FileNameField)</a><br>
#if($attachmentFile.isImage())
<div style="padding-top:3px;padding-left:12px;">
<div id='popc' style='position:absolute'></div>
<a href="javascript:aipo.msgboard.popupCenter('$jslink.getTemplate("MsgboardTopicFileRawScreen").addQueryData("ownerid", $!{result.ParentTopic.OwnerId}).addQueryData("entityid", $!result.ParentTopic.TopicId).addQueryData("attachmentIndex", $attachmentFile.FileId)');"><img class="width_thumbs" border="0" alt="$attachmentFile.FileName" title="$attachmentFile.FileName" src="$jslink.getTemplate("MsgboardTopicFileThumbnailScreen").addQueryData("ownerid", $!{result.ParentTopic.OwnerId}).addQueryData("entityid", $!result.ParentTopic.TopicId).addQueryData("attachmentIndex", $attachmentFile.FileId)"></a><br>
&nbsp;（マウスのクリックで画像を拡大縮小できます）
</div>
#end
</div>
#end
</div>
#end
</div>
#ALtditemfooter()
</tr>
#ALtablefooter()

#if($!result.CoTopicList && $!result.CoTopicList.size() > 0)
##pageview($link $result)
#ALtableheaderWide()
<tr>
#ALtdheadAtt("書き込み" "style='text-align:left;'")
</tr>
#set($firstCoTopic = true)
#foreach ($record in $result.CoTopicList)
#set($firstCoTopic = false)
<tr>
#ALtditemheader()
<div class="clearfix">
<div class="alignleft">
$!{record.TopicName}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;投稿者：$!{record.OwnerName}&nbsp;&nbsp;&nbsp;投稿日：$!{record.CreateDate.Year}年$!{record.CreateDate.Month}月$!{record.CreateDate.Day}日$!{record.CreateDate.Hour}時$!{record.CreateDate.Minute}分
</div>
<div class="alignright">
#if($!result.isMatch($!{result.UserId} , $!{record.OwnerId.Value}) || $!result.hasAclDeleteTopicOthers())
#ALajaxbuttonDelete("$!jslink.getPortletById($!portlet.ID).addQueryData('template','MsgboardTopicFormJSONScreen').addQueryData('topic_reply_id',${record.TopicId}).addQueryData('mode', 'delete_reply')" "$indicator_id" "$!portlet.ID" "aipo.msgboard.onReceiveMessage")
#end
</div>
</div>
<div>
${record.Note}
#if($!record.AttachmentFileList && $!record.AttachmentFileList.size() > 0)
<div style="padding-top:15px;">
#foreach( $attachmentFile in $!record.AttachmentFileList )
<div style="padding-top:5px;">
<img src="images/msgboard/msgboard_item.gif">&nbsp;<a href="$jslink.getTemplate("MsgboardTopicFileRawScreen").addQueryData("ownerid", ${record.OwnerId}).addQueryData("entityid", $record.TopicId).addQueryData("attachmentIndex", $attachmentFile.FileId)">$result.getStringCR($attachmentFile.FileNameField)</a><br>
#if($attachmentFile.isImage())
<div style="padding-top:3px;padding-left:12px;">
<div id='popc' style='position:absolute'></div>
<a href="javascript:aipo.msgboard.popupCenter('$jslink.getTemplate("MsgboardTopicFileRawScreen").addQueryData("ownerid", $!{record.OwnerId}).addQueryData("entityid", $record.TopicId).addQueryData("attachmentIndex", $attachmentFile.FileId)');"><img class="width_thumbs" border="0" alt="$attachmentFile.FileName" title="$attachmentFile.FileName" src="$jslink.getTemplate("MsgboardTopicFileThumbnailScreen").addQueryData("ownerid", ${record.OwnerId}).addQueryData("entityid", $record.TopicId).addQueryData("attachmentIndex", $attachmentFile.FileId)"></a><br>
&nbsp;（マウスのクリックで画像を拡大縮小できます）
</div>
#end
</div>
#end
</div>
#end
</div>
#ALtditemfooter()
</tr>
#end
#ALtablefooter()
##pageview($link $result)
#end
#ALformfooter()

#if($!resultOnTopicDetail)
#ALerrmsg($errmsgs)
<div id="messageDiv"></div>
##<form name="msgboardForm$!portlet.ID" id="msgboardForm$!portlet.ID" action="$!jslink.getPortletById($!portlet.ID).addQueryData('template','MsgboardTopicFormJSONScreen').addQueryData('mode','topic_reply').addQueryData('entityid', ${result.ParentTopic.TopicId})" method="post" onsubmit="aimluck.io.selectAllOptions(this.attachments);aimluck.io.submit(this,'$indicator_id','$!portlet.ID',aipo.msgboard.onReceiveMessage);return false;">
#ALajaxscreenformheader("msgboardForm" $jslink $portlet "MsgboardTopicFormJSONScreen" "aimluck.io.selectAllOptions(this.attachments);aimluck.io.submit(this,'$indicator_id','$!portlet.ID',aipo.msgboard.onReceiveMessage)")
<input name="is_new_category" type="hidden" value="$!result.NewCategory"/>
<input type="hidden" name="mode" value="topic_reply" />
<input type="hidden" name="entityid" value="${result.ParentTopic.TopicId}" />
#if($mode=="new_form")
<input type="hidden" name="mode" value="insert" />
#else
<input type="hidden" name="mode" value="update" />
#end
#ALtableheaderWide()

#if($mode=="new_form")
#ALtdcaption($!resultOnTopicDetail.getFieldName("category_id"))
#ALtditemheader()
<div id="msgboardCategoryInputField" #if(!$!{resultOnTopicDetail.NewCategory})style="display:none"#end>
#ALtableheaderSubWide()
#ALtdcaption("#ALrequired($!result.getFieldName('category_name'))")
#ALtditem("#ALtextfield('category_name' $!result.CategoryName '90%' 50 'active')")
#ALtablefooter()
</div>
<div id="msgboardCategorySelectField" #if($!{resultOnTopicDetail.NewCategory})style="display:none"#end>
#ALselectpdheader("category_id" "90%" "")
#foreach( $record in $result.CategoryList )
<option value='$!record.CategoryId' #if ($!resultOnTopicDetail.CategoryId.toString() == $!resultOnTopicDetail.CategoryId.toString()) selected="selected" #end>$!record.CategoryName</option>
#end
#ALselectfooter()
</div>
<input name="category_input_button" type="button" class="button" value=" #if(!$!{resultOnTopicDetail.NewCategory})新しく入力する#else一覧から選択する#end " onclick="aipo.msgboard.formSwitchCategoryInput(this)" />
#ALtditemfooter()
#end

#ALtdcaption("#ALrequired($!resultOnTopicDetail.getFieldName('topic_name'))")
#ALtditem("#ALtextfield('topic_name' $!resultOnTopicDetail.TopicName '60%' 50 'active')")
#ALtdcaption("#ALrequired($!resultOnTopicDetail.getFieldName('note'))")
#ALtditemheader()
#ALtextarea('note' $!resultOnTopicDetail.Note 10 40)
#ALtditemfooter()
#ALtdcaption("添付ファイル")
#ALtditemheader()
<select id="attachments" name="attachments" type="select" size="3" multiple="multiple" style="width: 325px">
#foreach( $record in $!resultOnTopicDetail.AttachmentFileNameList )
<option value="$record.FileId">$resultOnTopicDetail.FileName</option>
#end
</select>
#set($att_url = $!jslink.getPortletById($!portlet.ID).addQueryData("template","FileuploadFormScreen").addQueryData("mode","form"))
<input type="button" onclick="aipo.fileupload.openAttachment('$!utils.escapeXML($att_url)');" value="ファイルの選択" class="button" name="add_attachment"/>
選択したファイルを<input type="button" onclick="aimluck.io.removeOptions(this.form.attachments);" value="削除する" class="button" name="add_attachment"/>
<input type="hidden" id="folderName" name="folderName" value="">
#ALtditemfooter()
#ALtablefooter()
#end
#ALbuttonheader()
#if($!resultOnTopicDetail) #ALsubmit($event_submit $action_str) #end #ALajaxbuttonClose()
#ALbuttonfooter()
#ALformfooter()
#ALdialogfooter()
