#*
 * 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/>.
 *#
## ---------------------------------------------------------------------------
#if  ("$!mode"=="new_form")
#set ($action_str = $l10n.WIKI_ADD)
#set ($subtitle = $l10n.WIKI_ADDITION)
#set ($event_submit = "eventSubmit_doWiki_insert")
#else
#set ($action_str = $l10n.WIKI_UPDATE)
#set ($subtitle = $l10n.WIKI_EDITION)
#set ($event_submit = "eventSubmit_doWiki_update")
#end
#set ($indicator_id = "indicator-dlg-")
## ---------------------------------------------------------------------------
## IE�?��化け対�?
<span id="wiki_val_switch1" style="display:none">$l10n.WIKI_TYPE_NEW_WORD</span>
<span id="wiki_val_switch2" style="display:none">$l10n.WIKI_SELECT_DATE_FROM_LIST</span>
## ---------------------------------------------------------------------------

#ALdialogheader($subtitle)
#ALajaxIndicator("$indicator_id" "$!portlet.ID" "")
	<div id="messageDiv"></div>
	<div id="messageDiv_$!portlet.ID"></div>
	#ALajaxscreenformheader("wikiForm" $jslink $portlet "WikiFormJSONScreen" "aimluck.io.createSelectFromFileList(this, '$!portlet.ID');aimluck.io.submit(this,'$indicator_id','$!portlet.ID',aipo.wiki.onReceiveMessage)")
		<input name="is_child" type="hidden" value="$!result.Child"/>
        #if("$!mode"=="new_form")
        	<input type="hidden" name="mode" value="insert" />
        #else
        	<input type="hidden" name="mode" value="update" />
		#end

		#ALtableheaderWide()
		<tr>
        	#ALtdcaption("#ALrequired($!result.getFieldName('parentId'))")
        	#ALtditemheader()
        	<div id="wikiCategorySelectField">
        		#ALselectpdheaderw100("parentId" "")
				<option value='0'#if ($!result.getParentWikiIdString() == '0') selected="selected" #end>$l10n.WIKI_NOT_SET</option>
        		#foreach( $record in $result.TopWikiList )
        			<option value='$!record.Id' #if ($!result.getParentWikiIdString() == $!record.Id.toString()) selected="selected" #end>$!record.Name</option>
        		#end
        		#ALselectfooter()
        	</div>
        	#ALtditemfooter()
        </tr>
        <tr>
            #ALtdcaption("#ALrequired($!result.getFieldName('name'))")
			#if(!$result.isChildForm() || "$!mode" != "new_form")
				<td>
				<input class="text w100" type="text" name="name" id="wiki_name" value="$!result.Name" maxlength="50" style="ime-mode:active" />
				</td>
			#else
				<td>
				<input class="text w100" type="text" name="name" id="wiki_name" value="$!result.getDestWikiName()" maxlength="50" style="ime-mode:active" />
				</td>
			#end
        </tr>
        <tr>
            #ALtdcaption("#ALrequired($!result.getFieldName('note'))")
            #ALtditemheader()
            <div class="mb5">
                <a onclick="aipo.wiki.bold()" href="javascript:void(0);" title="$l10n.WIKI_BOLD"><span class="auiButtonIcon"><span><i class="icon-bold" ></i></span></span></a>
                <a onclick="aipo.wiki.italic()" href="javascript:void(0);" title="$l10n.WIKI_ITALIC"><span class="auiButtonIcon"><span><i class="icon-italic"　></i></span></span></a>
                <a onclick="aipo.wiki.underline()" href="javascript:void(0);" title="$l10n.WIKI_UNDERLINE"><span class="auiButtonIcon"><span><i class="icon-underline"　></i></span></span></a>
                <a onclick="aipo.wiki.strikethrough()" href="javascript:void(0);" title="$l10n.WIKI_STRIKETHROUGH"><span class="auiButtonIcon"><span><i class="icon-strikethrough"　></i></span></span></a>
                <a onclick="aipo.wiki.header()" href="javascript:void(0);" title="$l10n.WIKI_H1"><span class="auiButtonIcon"><span>h1</span></span></a>
                <a onclick="aipo.wiki.headerTwo()" href="javascript:void(0);" title="$l10n.WIKI_H2"><span class="auiButtonIcon"><span>h2</span></span></a>
                <a onclick="aipo.wiki.headerThree()" href="javascript:void(0);" title="$l10n.WIKI_H3"><span class="auiButtonIcon"><span>h3</span></span></a>
                <a onclick="aipo.wiki.ulist()" href="javascript:void(0);" title="$l10n.WIKI_ULIST"><span class="auiButtonIcon"><span><i class="icon-list-ul"></i></span></span></a>
                <a onclick="aipo.wiki.olist()" href="javascript:void(0);" title="$l10n.WIKI_OLIST"><span class="auiButtonIcon"><span><i class="icon-list-ol"></i></span></span></a>
                <a onclick="aipo.wiki.externallink()" href="javascript:void(0);" title="$l10n.WIKI_EXTERNALLINK"><span class="auiButtonIcon"><span><i class="icon-link"></i></span></span></a>
    			<a onclick="aipo.wiki.quote()" href="javascript:void(0);" title="$l10n.WIKI_QUOTE"><span class="auiButtonIcon"><span><i class="icon-quote-right"></i></span></span></a>
    			<a onclick="aipo.wiki.pre()" href="javascript:void(0);" title="$l10n.WIKI_PRE"><span class="auiButtonIcon"><span><i class="icon-code"></i></span></span></a>
    			<a onclick="aipo.wiki.hr()" href="javascript:void(0);" title="$l10n.WIKI_HR"><span class="auiButtonIcon"><span><i class="icon-minus"></i></span></span></a>
    			<a onclick="aipo.wiki.table()" href="javascript:void(0);" title="$l10n.WIKI_TABLE"><span class="auiButtonIcon"><span><i class="icon-table"></i></span></span></a>
    			<a onclick="aipo.wiki.image()" href="javascript:void(0);" title="$l10n.WIKI_IMAGE"><span class="auiButtonIcon"><span><i class="icon-camera"></i></span></span></a>
			</div>

			<textarea id="wiki_note"class="text wide" name="note" rows="20" cols="40">$!result.Note</textarea>

			<p>
				#set($preview_dialog_link = $!utils.escapeXML($!jslink.getPortletById($!portlet.ID).addQueryData("template","WikiPreviewScreen")))
				<a title="$l10n.WIKI_CONTENT_PREVIEW" href="javascript:void(0);" onclick="aipo.wiki.showPreviewDialog('$preview_dialog_link');" >$l10n.WIKI_CONTENT_PREVIEW</a>
			</p>
			<div class="wikiPreview auiWikiContent" id="wikiPreview" style="display: none;"></div>
        </tr>
		<tr #if(!$result.isFileUploadable())class="mb_hide"#end>
        <td class="caption">$l10n.WIKI_FILE_ATTACH</td>
            <td>
              <div class="clearfix">
              <div>
              #IFFileUpload()
              </div>
              <ul id="attachments_$!{portlet.ID}" class="attachments">
                #foreach($record in $!result.AttachmentFileNameList )
                  <li data-fileid="s${record.FileId}" data-filename="$!{record.FileName}"><span>$!record.FileName</span><span class="deletebutton" onclick="aimluck.io.removeFileFromList(this.parentNode.parentNode,this.parentNode);">$l10n.DELETE</span></li>
                #end
              </ul>
              <input type="hidden" id="folderName_$!{portlet.ID}" name="folderName" value="$!result.FolderName" />
              </div>
            </td>
        </tr>
		#ALtablefooter()
		#ALbuttonheader()
			#ALsubmit($event_submit $action_str)
			#ALajaxbuttonClose()
        #ALbuttonfooter()
	#ALformfooter()
    </div>
    </div>
#ALdialogfooter()
