<?php if(!defined('IN_SDCMS')) exit;?><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
<title>编辑分类</title>
<link rel="stylesheet" href="{WEB_ROOT}public/css/ui.css">
<link rel="stylesheet" href="{WEB_ROOT}public/admin/css/layout.css">
<script src="{WEB_ROOT}public/js/jquery.js"></script>
<script src="{WEB_ROOT}public/js/ui.js"></script>
</head>

<body>
    <div class="position">当前位置：社区管理 > <a href="{U('index')}">社区分类</a> > <a href="{THIS_LOCAL}">编辑分类</a></div>
    <div class="borders">
        <!---->
        
        <div class="tabs tabs-white" data-href="1">
            <ul class="tabs-nav">
              <li class="active"><a href="{THIS_LOCAL}">编辑分类</a></li>
            </ul>
            <div class="tabs-content">
                <div class="tabs-pane active">
                    <!--loop-->
                    <form class="ui-form" method="post">
                        <div class="form-group row">
                            <label class="col-left col-form-label">分类名称：</label>
                            <div class="col-right">
                                <input type="text" name="t0" class="form-ip" value="{$catename}" placeholder="请输入分类名称" data-rule="分类名称:required;">
                            </div>
                        </div>
						<div class="form-group row">
                            <label class="col-left col-form-label">分类图标：</label>
                            <div class="col-right">
                                <input type="text" name="t9" class="form-ip" value="{$cate_icon}" placeholder="请输入分类图标">
								<span class="input-tips"><a href="https://www.sdcms.cn/ui/icon.html" target="_blank">查看图标</a></span>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-left col-form-label">优化标题：</label>
                            <div class="col-right">
                                <input type="text" name="t1" class="form-ip" value="{$seotitle}">
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-left col-form-label">关键字：</label>
                            <div class="col-right">
                                <input type="text" name="t2" class="form-ip" value="{$seokey}">
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-left col-form-label">描述：</label>
                            <div class="col-right">
                                <textarea name="t3" class="form-ip" rows="3" cols="50">{$seodesc}</textarea>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-left">查看权限：</label>
                            <div class="col-right">
                                {if strlen($view_group)}
                                    {php $view_data=jsdecode($view_group)}
                                {else}
                                    {php $view_data=[]}
                                {/if}
                                {sdcms:rs top="0" table="sd_user_group" order="ordnum,gid"}
                                <label class="checkbox"><input type="checkbox" name="t6[]" value="{$rs[gid]}" {if in_array($rs[gid],$view_data)} checked{/if}><i></i>{$rs[gname]}</label>
                                {/sdcms:rs}
                                <span class="input-tips">如果未勾选，则所有人都可以查看帖子</span>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-left">发帖权限：</label>
                            <div class="col-right">
                                {if strlen($post_group)}
                                    {php $post_data=jsdecode($post_group)}
                                {else}
                                    {php $post_data=[]}
                                {/if}
                                {sdcms:rs top="0" table="sd_user_group" order="ordnum,gid"}
                                <label class="checkbox"><input type="checkbox" name="t7[]" value="{$rs[gid]}" {if in_array($rs[gid],$post_data)} checked{/if}><i></i>{$rs[gname]}</label>
                                {/sdcms:rs}
                                <span class="input-tips">如果未勾选，则所有用户均可发帖</span>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-left">回帖权限：</label>
                            <div class="col-right">
                                {if strlen($reply_group)}
                                    {php $reply_data=jsdecode($reply_group)}
                                {else}
                                    {php $reply_data=[]}
                                {/if}
                                {sdcms:rs top="0" table="sd_user_group" order="ordnum,gid"}
                                <label class="checkbox"><input type="checkbox" name="t8[]" value="{$rs[gid]}"  {if in_array($rs[gid],$reply_data)} checked{/if}><i></i>{$rs[gname]}</label>
                                {/sdcms:rs}
                                <span class="input-tips">如果未勾选，则所有用户均可回帖</span>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-left col-form-label">排序：</label>
                            <div class="col-right">
                                <input type="text" name="t4" class="form-ip" value="{$ordnum}">
                                <span class="input-tips">数字越小越靠前</span>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-left col-form-label">状态：</label>
                            <div class="col-right col-form-label">
                                <label class="radio"><input type="radio" name="t5" id="t5_1" value="1"{if $isshow==1} checked{/if}><i></i>启用</label>
                                <label class="radio"><input type="radio" name="t5" id="t5_2" value="0"{if $isshow==0} checked{/if}><i></i>锁定</label>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label class="col-left col-form-label"></label>
                            <div class="col-right">
                                <button type="submit" class="btn btn-info mr">保存</button>
                                <button type="button" class="btn ui-back">返回</button>
                            </div>
                        </div>
                    </form>
                    <!--loop-->
                </div>
            </div>
        </div>
        
        <!---->
    </div>


<script>
$(function()
{
	$(".ui-form").form(
	{
		type:2,
		result:function(form)
		{
			$.ajax(
			{
                type:'post',
                cache:false,
                dataType:'json',
                url:'{THIS_LOCAL}',
                data:$(form).serialize(),
                error:function(e){alert(e.responseText);},
                success:function(d)
                {
                    if(d.state=='success')
                    {
                        sdcms.success(d.msg);
                        setTimeout(function(){location.href='{U("index")}';},1500);
                    }
                    else
                    {
                        sdcms.error(d.msg);
                    }
                }
            });
		}
	});
})
</script>
</body>
</html>