#*
 * Aipo is a groupware program developed by TOWN, Inc.
 * Copyright (C) 2004-2015 TOWN, 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 ($indicator_id = "indicator-list-")

#set ($categoryEtc = false)
#set ($newUrl = $!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","WikiFormScreen").addQueryData("entityid","new")))
## ---------------------------------------------------------------------------
#AUIcontentsAreaHeader()

#if(!$!result.Detail)
<h2>$l10n.WIKI_MANAGEMENT</h2>
#AUISummaryDiv()
	#AUIbuttonAction($l10n.WIKI_CREATE "javascript:aipo.common.showDialog('$newUrl','$!portlet.ID',aipo.wiki.onLoadWikiDialog);")
#AUISummaryDivfooter()
#AUIEmptyMessage("icon-edit-sign" "$l10n.WIKI_EMPTY_MESSAGE")
#else

<div class="auiSummaryMeta auiFilter clearfix">

#ALajaxIndicator("${indicator_id}" "$!{portlet.ID}" "")
<div id="viewmessageDiv"></div>
<form name="form$!portlet.ID" id="form$!portlet.ID" action="#" method="post" onsubmit="return false;">
	<input type="hidden" name="_name" value="Wiki" />
	<input type="hidden" name="secid" value="$secid" />
	<input type="hidden" name="template" value="WikiViewScreen"/>
	<input type="hidden" id="baseuri_$!{portlet.ID}" value='$!jslink.getPortletById($!portlet.ID).addQueryData("template","WikiViewScreen")' />

#ALajaxbuttonEditCallbackWithoutButtonDisabled("$!jslink.getPortletById($!portlet.ID).addQueryData('template','WikiFormScreen').addQueryData('entityid',$!result.Detail.Id)" "$!portlet.ID" "aipo.wiki.onLoadWikiDialog")

#ALajaxbuttonDelete("$!jslink.getPortletById($!portlet.ID).addQueryData('template','WikiFormJSONScreen').addQueryData('entityid',$!result.Detail.Id).addQueryData('mode', 'delete')" "$indicator_id" "$!portlet.ID" "aipo.wiki.onViewReceiveMessage")

</form>

</div>

<div class="auiWikiContent">
	$!result.Detail.getNote()
	#if($!result.Detail.AttachmentFileList.size() > 0)
    <div style="padding-top:15px;">
    	<ul>
    	#foreach( $attachmentFile in $!result.Detail.AttachmentFileList )
    		<li>&nbsp;<a #if("$!{client}"=="IPHONE" || $!attachmentFile.AcceptInline)target="_blank"#end href="$jslink.getTemplate("WikiFileRawScreen").addPathInfo("entityid", $!result.Detail.Id).addPathInfo("attachmentIndex", $attachmentFile.FileId).addPathInfo("f", ${attachmentFile.getURLEncodedValue()})">$result.getStringCR($attachmentFile.FileNameField)</a><br />
    		#if($attachmentFile.isImage())
    			<div id='popc' style='position:absolute'></div>
    			<div class="thumbBlock">
    				<a href="javascript:void(0);" onclick="aipo.fileupload.showImageDialog('$jslink.getTemplate('FileuploadViewScreen').addPathInfo('screen','WikiFileRawScreen').addPathInfo("ownerid", $!result.Detail.OwnerId).addPathInfo("entityid", $!result.Detail.Id).addPathInfo("attachmentIndex", $attachmentFile.FileId).addPathInfo("f", ${attachmentFile.getURLEncodedValue()})');">
    				<img class="width_thumbs" border="0" alt="$attachmentFile.FileName" title="$attachmentFile.FileName" src="$jslink.getTemplate("WikiFileThumbnailScreen").addQueryData("entityid", $!result.Detail.Id).addQueryData("attachmentIndex", $attachmentFile.FileId)"></a><br />
    			</div>
    		#end
    		</li>
    	#end
        </ul>
    </div>
    #end
</div>

#end
#AUIcontentsAreaFooter()
#parse("/portlets/html/wiki-widgets.vm")
