<{strip}>

<{if $preview.title}>
<table class="outer">
  <tbody>
  <tr><td class="head"><{$preview.title}></td></tr>
  <tr><td><{$preview.hometext}></td></tr>
  </tbody>
</table>
<br />
<{/if}>

<script type="text/javascript" src="<{$xoops_url}>/editors/ckeditor/ckeditor.js"></script>



<form name="storyform" id="storyform"  class="form-container" action="?page=submit" method="post" enctype="multipart/form-data">
  <{$gticket}>
  <{if $storyid}><input type="hidden" name="storyid" value="<{$storyid}>"/><{/if}>
  <{if $return}><input type="hidden" name="return" value="<{$return}>"/><{/if}>

<h2><{$smarty.const._MD_SUBMITNEWS}></h2>

<div class="row">
	<div class="one sixth ipad padded"><div class="info block box"><{$smarty.const._MD_TOPIC}></div></div>
	<div class="five sixth ipad padded"><{$topic_selbox}></div>
</div>
<div class="row">
	<div class="one sixth ipad padded"><div class="info block box"><{$smarty.const._MD_TITLE}></div></div>
	<div class="five sixth ipad padded"><input class="form-field" type="text" name="title" id="mytitle" value="<{$title}>" size="50" maxlength="80" /></div>
</div>
<div class="row">
	<div class="one sixth ipad padded"><div class="info block box"><{$smarty.const._MD_FILE}></div></div>
	<div class="five sixth ipad padded">
		<{if $topimg != ''}>
		<label>
			<input type="checkbox" name="checked" value="1" checked="checked" />
			<small>現在の画像を使用</small><br />
		</label>
		<{/if}>

		<input type="file" name="upfile" id="upfile" accept="image/*" /><br />
		<{$topimg}>
		<input type='hidden' name='topicimg' value='0'>
	</div>
</div>
<div class="row">
	<div class="one sixth ipad padded"><div class="info block box"><{$smarty.const._MD_THESCOOP}></div></div>
	<div class="five sixth ipad padded">
		<div id="area_ckxoops">
			<textarea class="ckeditor" cols="80" rows="10" id="text" name="text"><{$text}></textarea>
		</div>
	</div>
</div>
<div class="row">
	<div class="one sixth ipad padded"><div class="info block box"><{$smarty.const._MD_WEIGHT}></div></div>
	<div class="five sixth ipad padded"><input type="text" name="weight" value="<{$weight}>"></div>
</div>

<{if $can_use_date}>
<div class="row">
	<div class="one sixth ipad padded"><div class="info block box"><{$smarty.const._MD_PUBLISHED}></div></div>
	<div class="five sixth ipad padded">
		<label><input type="checkbox" value="1" name="autodate" <{if $autodate}>checked="checked"<{/if}> /><{$smarty.const._MD_SETDATETIME}></label>
		&nbsp;
		<span style="font-size:0.8em;"><{$smarty.const._MD_SETDATETIME_DESC}></span><br />
		<{$post_date_selector}><br />
	</div>
</div>
<div class="row">
	<div class="one sixth ipad padded"><div class="info block box"><{$smarty.const._MD_EXPIRED}></div></div>
	<div class="five sixth ipad padded">
		<label><input type="checkbox" value="1" name="autoexpdate" <{if $autoexpdate}>checked="checked"<{/if}> /><{$smarty.const._MD_SETEXPDATETIME}></label>
		&nbsp;
		<span style="font-size:0.8em;"><{$smarty.const._MD_SETEXPDATETIME_DESC}></span><br />
		<{$expire_date_selector}><br />
	</div>
</div>
<{/if}>

<{if $use_relation}>
<div class="row">
	<div class="one sixth ipad padded"><div class="info block box"><{$smarty.const._MD_RELATION}></div></div>
	<div class="five sixth ipad padded">
    <div id="relation">
		<{foreach item=i from=$relations}>
            <input type="checkbox" name="storyidR[]" value="<{$i.linkedid}>" />
            <input type="hidden" name="titleR[]" value="<{$i.title}>" />
            <input type="hidden" name="dirnameR[]" value="<{$i.dirname}>" />
            <input type="hidden" name="storyidRH[]" value="<{$i.linkedid}>" />
            <{$i.title}><br />
    <{/foreach}>
    </div>
      <input type="button" value="<{$smarty.const._MD_ADD_RELATION}>" name="opensub" onclick="window.open('index.php?page=search','sub','width=400,height=500');">
      <input type="button" value="<{$smarty.const._DELETE}>" name="updatevar" onclick="updateRelations('storyform', false)">
	</div>
</div>
<{/if}>

<div class="row">
	<div class="one sixth ipad padded"><div class="info block box"><{$smarty.const._OPTIONS}></div></div>
	<div class="five sixth ipad padded">
		<input type='hidden' name='html' value='1'>
	    <label><input type="checkbox" value="1" name="block" <{if $block}>checked="checked"<{/if}> /><{$smarty.const._MD_DISP_BLOCK}></label><br />
	    <label><input type="checkbox" value="1" name="ihome" <{if $ihome}>checked="checked"<{/if}> /><{$smarty.const._MD_PUBINHOME}></label><br />
	    <{if $use_approve}>
	      <label><input type="checkbox" value="1" name="approve" <{if $approve}>checked="checked"<{/if}> /><{$smarty.const._MD_APPROVE}></label><br />
	    <{/if}>
	</div>
</div>

<div class="row padded">
	<input class="submit-button" class="block error" name="post" id="post" value="<{$smarty.const._MD_POST}>" type="submit" />
</div>

</form>

<!-- Start Form Vaidation JavaScript //-->
<script type="text/javascript">
	$(function(){

		$('#topicid').addClass('form-field');

	    $('form input:file').uploadThumbs({
	        position : 1,
	        imgbreak : false,
	    });

/*
     // 0:before, 1:after, 2:parent.prepend, 3:parent.append,
     // any: arbitrarily jquery selector
     // append <br> after thumbnail images
*/

		$('#post').on('click',function(){
			if($('#mytitle').val() == ''){
				alert("<{'{0}'|str_replace:$smarty.const._MD_TITLE:$smarty.const._MD_ERROR_REQUIRED}>");
				return false;
			}
		});

	});
</script>

<style>
form img.thumb {
    margin:0 5px 5px 0;
    max-width:160px;
    vertical-align:bottom;
}
</style>
<!-- End Form Vaidation JavaScript //-->
<{/strip}>
