<!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>

    <script src="{$config.root_uri}/js/jquery-ui.min.js"></script>
    <script src="{$config.root_uri}/js/jquery.ui.touch-punch.min.js"></script>

    <!--[if lt IE 9]>
      <script src="./bootstrap/html5shiv.js"></script>
      <script src="./bootstrap/respond.min.js"></script>
    <![endif]-->

{literal}
<script type="text/javascript">
var global_data = '';
$(function(){
$("#fm_sortable").sortable({
update: function(event, ui) {
    var data  = $("#fm_sortable").sortable("serialize");
    var data2 = $('#fm_sortable').sortable('toArray').toString();
global_data = data;
//alert(data);
//alert(data2);
}
})
.disableSelection();
});

function change_icon(){
	var v;
    if( $('#display_icon_flag').prop('checked')){
		v = $('#display_icon_flag').val();
	}
	if (v=='on'){ $("#fm_sortable p").show(); }
	else{ $("#fm_sortable p").hide(); }
}

function submit_junban(div_id){
    accessing(div_id); 
  setTimeout( function() {
    location.href=('memo_admin.php?cmd=category_turn_submit&'+global_data)
  }, 1 );
}
</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 mb30">
          <div class="col-xs-12">
          表示順番を確定する場合は【表示順番を確定】のボタンを押してください<br />
          <input type="button" class="btn btn-primary mb3" onclick="submit_junban('accessing_2');" value="表示順番を確定" />
          <input type="button" class="btn btn-primary mb3" onclick="location.href=('{$_program_uri}?cmd=category_edit_input')" value="キャンセルして戻る" />
          <p id="accessing_1" class="fm_accessing" style="display:none;"><i class="fa fa-refresh fa-spin"></i> now accessing...</p>
          </div>
          </div><!-- /.row -->


<label><input type="checkbox" name="display_icon_flag" id="display_icon_flag" value="on" onclick="change_icon();" checked > アイコンを表示する</label>



<ul id="fm_sortable">
{ foreach from=$category_loop key="k" item="v" name="loopname"}
<li id="list_{$v.category_id}">
                <div class="fm_icon2 pull-left">
                <a href="{$config.memo_uri}/category/{$v.category_id}" target="_blank"><p style="background-image: url({$config.icon_uri}/{if $v.icon_file_name}{$v.icon_file_name}{else}noicon.jpg{/if})"></p></a>
                </div>
      <p class="pull-left ml5 mt5">{$v.category_name|escape}</p>
<br class="clear" />
</li>
{ /foreach }
</ul>

<hr />
表示順番を確定する場合は【表示順番を確定】のボタンを押してください<br />
<input type="button" class="btn btn-primary mb3" onclick="submit_junban('accessing_2');" value="表示順番を確定" />
<input type="button" class="btn btn-primary mb3" onclick="location.href=('{$_program_uri}?cmd=category_edit_input')" value="キャンセルして戻る" />
<p id="accessing_2" class="fm_accessing" style="display:none;"><i class="fa fa-refresh fa-spin"></i> now accessing...</p>



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


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


  </body>
</html>
