<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>{if $cmd=='data_add_input'}データ新規投稿{elseif $cmd=='data_edit_input'}データ編集{/if}｜{$config.page_title|escape}</title>
{if $config.meta_robots}<meta name="robots" content="{$config.meta_robots}">
{/if}
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<link rel="stylesheet" href="{$config.root_uri}/bootstrap/bootswatch/{$appearance.bootswatch_name}/bootstrap.min.css" media="screen">
<link rel="stylesheet" href="{$config.root_uri}/css/parts.css">
<link rel="stylesheet" href="{$config.root_uri}/css/flatmemo.css">
<link rel="stylesheet" href="{$config.root_uri}/font-awesome/css/font-awesome.min.css">

<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="{$config.root_uri}/bootstrap/bootstrap.min.js" defer></script>
<script src="{$config.root_uri}/js/flatmemo.js" defer></script>
<script src="{$config.root_uri}/js/jquery_kill_referrer.js" defer></script>

<script src="{$config.root_uri}/js/dropzone.js"></script>
<script src="{$config.root_uri}/js/dropzone_config.js"></script>
<link rel="stylesheet" href="{$config.root_uri}/js/dropzone.css">

<script type="text/javascript" src="{$config.root_uri}/js/autoresize.jquery.js" defer></script>

<!-- jquery-emoji-picker -->
{ if $config.emoji == 1 }
<link rel="stylesheet" type="text/css" href="{$config.root_uri}/emoji/jquery-emoji-picker/css/jquery.emojipicker.css">
<link rel="stylesheet" type="text/css" href="{$config.root_uri}/emoji/jquery-emoji-picker/css/jquery.emojipicker.a.css">
<style type="text/css">
	.emojiPickerIcon{ldelim}
		border-radius: 3px;
		width        : 35px !important;
		height       : 35px !important;
		top          : 2px !important;
		right        : 2px !important;
	{rdelim}
</style>
<script type="text/javascript" src="{$config.root_uri}/emoji/jquery-emoji-picker/js/jquery.emojipicker.js"></script>
<script type="text/javascript" src="{$config.root_uri}/emoji/jquery-emoji-picker/js/jquery.emojis.js"></script>
<script>
{literal}
$(document).ready(function(){
	$('.emoji').emojiPicker({
	height: '300px',
	width:  '450px'
	});
});
{/literal}
</script>
{ /if }
<!-- jquery-emoji-picker -->

{literal}
<script type="text/javascript">
$(document).ready(function(){
$('textarea#text_name').autoResize();
change_tag_list();
document.FM.title_name.focus();
});

function change_tag_list(){
$('#this_category_tag').hide();
$('#all_tag').hide();
if( $('#tagselector').val()==1 ){ $('#this_category_tag').show(); }
else{ $('#all_tag').show(); }
}

function ct(tag_name){
//alert(tag_name);
v = $('#tag_name').val();
if (v.indexOf(tag_name,0) != -1){
v2 = v.replace(tag_name+'　','');
v2 = v2.replace('　　','　');
$('#tag_name').val(v2);
}
else{ $('#tag_name').val(v+tag_name+'　'); }

}

function add_file_upload_attach_link( file_path, file_name ){
if ( file_name.match(/\.(gif|jpg|jpeg|png|bmp)$/) ){
//OFF	$('#file_upload_attach_link').append('<input type="text" value="<img src=\'' + file_path + '\' width=\'450\' />" style="width:450px;"/>');
}
}
var bt_name;

$(document).ready(function() {






});
</script>
{/literal}

</head>
<body>

{include file="inc/header.html"}


<div class="container">

<div class="pull-left mr10">
<div class="fm_icon2">
<a href="{$config.memo_uri}/category/{$category_id}"><p style="background-image: url({$config.icon_uri}/{if $icon_file_name}{$icon_file_name}{else}noicon.jpg{/if})"></p></a>
</div>
</div>

<div class="page-header">
<h1>{if $cmd=='data_add_input'}データ新規投稿{elseif $cmd=='data_edit_input'}データ編集{/if} <small>{if $cmd=='data_add_input'}データの新規投稿{elseif $cmd=='data_edit_input'}データの編集{/if}を行います</small></h1>
</div>

<div class="row mb30">
<div class="col-xs-12">
<div class="pull-left"><a href="#" onclick="history.back(); return false;"><i class="fa fa-arrow-left"></i> 戻る</a>　　</div>
<div class="pull-right">
<i class="fa fa-file-text"></i> データ編集
{*
<a href="{$config.admin_uri}?cmd=category_edit_input" ><i class="fa fa-file-text"></i> カテゴリの編集</a>　　
<a href="{$_program_name}?cmd=category_turn_input"><i class="fa fa-list"></i> カテゴリの順番変更</a>　　
<a href="{$_program_uri}?cmd=tag_edit_input" ><i class="fa fa-file-text"></i> タグの編集</a>
*}
</div>
</div> <!-- /.col-xs-12 -->
</div>
<hr />


<div class="row">






<form name="FM" method="post" enctype="multipart/form-data" action="{$_program_uri}" onsubmit="accessing(); return notrepeat();" >
{$hidden}

<div class="col-xs-12 mb25">


<p>
{$hidden_attach}
</p>

<div class="row">
<div class="col-sm-2">タイトル</div>
<div class="col-sm-10"><input name="title_name" type="text" id="title_name"  class="form-control emoji"></div>
</div>

<div class="row mt5">
<div class="col-sm-2">テキスト</div>
<div class="col-sm-10"><textarea name="text_name" cols="70" rows="12"  class="form-control emoji" id="text_name"></textarea></div>
</div>

<div class="row">
<div class="col-sm-2">オプション</div>
<div class="col-sm-10">

記法<br>
<input type="radio" name="kihou_flag" value="autolink" id="autolink_flag" {if $autolink_flag=='on'}checked{/if} /> <label for="autolink_flag">標準記法を使う ( <span style="color:#999999;font-size:smaller;">URLやメールアドレスに自動でリンクを付加します</span> )</label><br />
<input type="radio" name="kihou_flag" value="hatena" id="hatena_flag" {if $hatena_flag=='on'}checked{/if}  /> <label for="hatena_flag">はてな記法を使う</label> ( <a href="http://goo.gl/XSRb" target="_blank">はてな記法一覧</a> )<br />
<input type="radio" name="kihou_flag" value="markdown" id="markdown_flag" {if $markdown_flag=='on'}checked{/if} /> <label for="markdown_flag">Markdown記法を使う</label> ( <a href="http://jbt.github.io/markdown-editor/" target="_blank">GitHub-Flavored-Markdown記法+記法テスト</a> )<br />
<hr class="mt1 mb5">
<label><input type="checkbox" name="movetop_flag" value="on" id="movetop_flag" {$movetop_flag_check} /> この記事をカテゴリの先頭に移動させる</label><br />
<label><input type="checkbox" name="draft_flag" value="on" id="draft_flag" {$draft_flag_check} /> ドラフト（下書き）として一般公開しない</label>
</div>
</div>

<div class="row mt5 mb5">
<div class="col-sm-2">カテゴリ</div>
<div class="col-sm-10">
<select name="category_id" class="form-control">
{ foreach from=$category_master_loop key="k" item="v" name="loopname"}
<option value="{$v.category_id}">{$v.category_name|escape}</option>
{ /foreach }
</select>
</div>
</div>

<div class="row mt10">
<div class="col-sm-2">タグ</div>
<div class="col-sm-10">
<input name="tag_name" class="form-control" type="text" id="tag_name" value="{ foreach from=$tag_id_loop key="tk" item="tv" }{$tv|tag_name:$tag_master_loop}　{/foreach}" />
<small>（タグは全角または半角スペースで区切って下さい）</small>

<div class="taglist1">
<select id="tagselector" class="form-control" onchange="change_tag_list()" name="" ><!-- changetag(); -->
<option value="1" selected>このカテゴリ内</option>
<option value="2">全てのタグ</option>
</select>
</div>
<div class="taglist2" id="taglistinsert">
<p id="all_tag">
{ foreach from=$tag_master_loop key="k" item="v" name="loopname"}
<a href="javascript:ct('{$v.tag_name|escape}');">{$v.tag_name|escape}</a> |
{ /foreach }
</p>
<p id="this_category_tag">
{ foreach from=$this_category_tag_loop key="k" item="v" name="loopname"}
<a href="javascript:ct('{$v.tag_name|escape}');">{$v.tag_name|escape}</a> |
{ /foreach }
</p>
</div>


</div>
<br style="clear:both;" />
</div>



<div class="row mt10">
  <div class="col-sm-2">添付file</div>
  <div class="col-sm-10">
    <div id="image_drop_area" >ここにアップロードファイルをドロップ</div>
    <div id="preview_area" class="dropzone-custom" style="width:100%;"></div>
  </div>
</div><!-- .row -->




<div class="row">
<div class="col-sm-2"></div>
<div class="col-sm-10">

<!-- file upload -->
<!-- <input class="form-control" id="file_upload" name="file_upload" type="file" /> -->
<label><input name="auto_submit_flag" id="auto_submit_flag" type="checkbox" value="1" /> 添付fileアップロード完了後にこの記事を自動送信する</label>

<div id="file_upload_attach_link">
</div>
<!-- /file upload -->



<br>
{ foreach from=$attach_en_loop key="ak" item="av" name="loopname"}
{ math equation=a-1 a=$smarty.foreach.loopname.iteration assign=i }
<div class="row mt10">
<div class="col-sm-12">
<div class="class="fm_edit_attach_left">
<i class="fa fa-file"></i> 添付ファイル{$smarty.foreach.loopname.iteration}
</div>
<div class="fm_edit_attach_right">
<a href="{$config.data_file_uri}/{$av}" target="_blank">{$attach_jp_loop.$i}</a>( {$attach_en_loop.$i} / {"`$config.data_file_dir`/`$av`"|fsize} )　
<label ><input name="attach_edit_flag{$smarty.foreach.loopname.iteration}" type="radio" value="notedit" checked /> 変更しない</label>　
<label style="color:red;"><input name="attach_edit_flag{$smarty.foreach.loopname.iteration}" type="radio" value="delete" /> 削除する</label>
<input type="hidden" name="attach_en{$smarty.foreach.loopname.iteration}" value="{$attach_en_loop.$i}" />
<input type="hidden" name="attach_jp{$smarty.foreach.loopname.iteration}" value="{$attach_jp_loop.$i}" />
<div>貼りつけリンク
{ if $av|ext_preg:'/.mp4$/i' }<input type="text" class="form-control"  value='<video preload="none" controls src="{$config.data_file_apath}/{$av}" >'"/>
{ elseif $av|ext_preg:'/(gif|jpg|jpeg|png|bmp)/i' }<input type="text" class="form-control"  value='<a href="{$config.data_file_apath}/{$av}"><img src="{$config.data_file_apath}/{$av}" /></a>'"/>
{ /if }
</div>
</div>
</div>
</div>
{ /foreach }

</div>

</div>

<div class="row mt10">
<div class="col-sm-2"></div>
<div class="col-sm-10">
<input id="form_submit" class="btn btn-primary" type="submit" value="送信" accesskey="s" />　<input type="reset" class="btn btn-default" />
<div class="mt15"><input type="button" class="btn btn-default" value="戻る" onclick="history.back()"></div>
<p id="accessing" class="fm_accessing" style="display:none;"><i class="fa fa-refresh fa-spin"></i> now accessing...</p>
</div>
</div>


</div> <!-- /.col-xs-12 -->
</form>






</div><!-- /.row -->

</div><!-- /.container -->



{include file="inc/footer.html"}







</body>
</html>
