<!DOCTYPE html>
<html lang="ja">
  <head>
    <meta charset="utf-8">
    <title>{$config.page_title|escape}</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <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.10.2.min.js"></script>
    <script src="{$config.root_uri}/bootstrap/bootstrap.min.js"></script>
    <script src="{$config.root_uri}/bootstrap/bootswatch.js"></script>

    <script src="{$config.root_uri}/js/flatmemo.js"></script>
    <!--[if lt IE 9]>
      <script src="./bootstrap/html5shiv.js"></script>
      <script src="./bootstrap/respond.min.js"></script>
    <![endif]-->

{literal}
<script>
sent=0;
function kakunin() {
if (sent ==0){
if ( document.FM.category_name.value == '' ){  alert('タグ名を入力して下さい'); return false;}
if (confirm('タグ【'+document.FM.category_name.value+'】を作成します。よろしいですか？')) {sent=1;return true;} else {return false;}
}
if (sent==1){return false;}
}

/* リネーム確認*/
renamesent=0;
function rename_kakunin(obj) {
if (renamesent ==0){
obj.new_tag_name.style.backgroundColor='#ffd1d1';
if ( obj.new_tag_name.value == '' ){  alert('変更するタグ名を入力して下さい'); return false;}
if (confirm('タグ名称を【'+obj.new_tag_name.value+'】に変更します。よろしいですか？')) {
	//OFF make_hidden( 'cmd', 'tag_edit_submit','FM2' );
	renamesent=1;
	return true;
}
else {
obj.new_tag_name.style.backgroundColor='#ffffff';
return false;
}
}
if (renamesent==1){return false;}
}

/* 削除確認 */
var deletesent=0;
function delete_kakunin(tag_name,tag_id) {
	if (deletesent==0){
		if (confirm('タグ【'+tag_name+'】を削除します。\nよろしいですか？')) {
          deletesent=1;
          accessing('accessing_'+tag_id);
          location.href=('memo_admin.php?cmd=tag_delete_submit&tag_id=' + tag_id );
        }
	else { return false;}
	}
	else if (deletesent==1){return false;}
}

function make_hidden( name, value, formname ){
    var q = document.createElement('input');
    q.type = 'hidden';
    q.name = name;
    q.value = value;
    if (formname){ document.forms[formname].appendChild(q); }
    else{ document.forms[0].appendChild(q); }
}

</script>
{/literal}
  </head>
  <body>

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



    <div class="container">

<div class="page-header">
  <h1>タグの編集 <small>タグの名称変更と削除を行います</small></h1>
</div>


        <div class="row mb30">
        <div class="col-xs-12">
        <div class="pull-left"><a href="{$config.memo_uri}"><i class="fa fa-arrow-left"></i> トップに戻る</a>　　</div>
        <div class="pull-right"><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">

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

{ foreach from=$tag_loop key="k" item="v" name="loopname"}
{assign var="i" value=$v.tag_id }
<div class="row mb10 ml5">
  <div class="pull-left">
  <form method="get" name="FM2" action="{$_program_uri}" onsubmit="return rename_kakunin(this)" style="display:inline;">
  <input type="hidden" name="cmd" value="tag_edit_submit" />
  <input type="hidden" name="tag_id" value="{$v.tag_id}" />
  <input type="text" class="form-control" name="new_tag_name" value="{$v.tag_name|escape}" size="28" />
  </div>

  <div class="pull-left ml10 mt6" style="width:50px;">
  {if $tag_count_loop.$i}<span class="badge">{$tag_count_loop.$i}</span>
  {else}<span class="badge badge-warning">0</span>
  {/if}

  </div>

  <div class="pull-left ml10">
  <button type="submit" class="btn btn-primary">変更</button>
  </div>

  <div class="pull-left ml10">
  <button type="button" class="btn btn-danger" onclick="return delete_kakunin('{$v.tag_name|escape}',{$v.tag_id});">削除</button>
  </div>
  <p id="accessing_{$v.tag_id}" class="pull-left ml10 fm_accessing" style="display:none;"><i class="fa fa-refresh fa-spin"></i> now accessing...</p>
  
</form>
</div><!-- /.row -->
{ /foreach }


          </div><!-- /.col-sm-12 -->
        </div><!-- /.row -->

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


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


  </body>
</html>
