<style>
    .s_click h5 {
        margin:0px  0px 15px 0px !important;
        padding:5px 0px;
        border:none !important;
        border-bottom:1px solid #eee !important;

    }
</style>
    <form name="listform" id="listform"  action="<?php echo uri();?>" method="post" onsubmit="return returnform(this);">
        <div class="main-right-box">
        <h5>
            {lang_admin('sidebar')}
            <!--工具栏-->
            <div class="content-eidt-nav pull-right">
                <a id="fullscreen-btn" class="btn btn-default" style="display:none;">
                    <i class="icon-frame"></i>
                    <?php echo lang_admin('container_fluid');?>
                </a>
                <span class="pull-right">


                        <input  name="submit" value="1" type="hidden">

                            <button class="btn btn-success" type="submit" name="save"
                                    onclick="this.form.action='<?php echo modify('act/add',true);?>';  returnform(this.form);">
                            <span class="glyphicon glyphicon-floppy-disk"></span> <?php echo lang_admin('preservation');?>
                        </button>



                       <a href="#" onclick="gotourl(this)" data-dataurl="<?php echo url('config/index');?>" data-dataurlname="<?php echo lang_admin('set_up');?>" class="pull-right btn btn-default">
            <i class="icon-action-redo"></i>
        </a>

                    <a id="content-eidt-nav-btn" class="btn btn-default" style="display:none;">
                    <i class="icon-close"></i>
                </a>
                </span>
            </div>
        </h5>
<div class="box">
        <div class="user-rights-list">
        {loop $data $d}
            <div class="s_click">
                <input type="hidden" class="hiddenfromdata" id="<?php echo $d['key'];?>"  data-prante="<?php echo $d['prante'];?>"
                       name="fromdata[<?php echo $d['key'];?>][status]" value="<?php if ($d['status']){echo 1;}else{echo 0;};?>">

                <h5><input <?php if ($d['status']){ ?> checked <?php } ?>
                            onclick="c_chang(this);checkfromdata(this,'<?php echo $d['key'];?>');checkfromprante(this,'<?php echo $d['key'];?>')"
                            data-prante="<?php echo $d['prante'];?>"   type="checkbox"    class="checkbox checkbox_prante" />
                    <strong>{$d['name']}</strong>
                </h5>


                    <?php if(isset($d['son']) && is_array($d['son'])){ ?>
                <dl>
                        {loop $d['son'] $dl}

                            <input type="hidden" class="hiddenfromdata" id="<?php echo $dl['key'];?>"  data-prante="<?php echo $dl['prante'];?>"
                                   name="fromdata[<?php echo $dl['key'];?>][status]" value="<?php if ($dl['status']){echo 1;}else{echo 0;};?>">
                            <dd class="col-xs-6 col-sm-4 col-md-3 col-lg-2">
                                <input <?php if ($dl['status']){ ?> checked <?php } ?>
                                        onclick="c_chang(this);checkfromdata(this,'<?php echo $dl['key'];?>');checkfromprante(this,'<?php echo $dl['key'];?>')"
                                        data-prante="<?php echo $dl['prante'];?>"   type="checkbox"    class="checkbox checkbox_prante" />
                                {$dl['name']}</dd>
                               </dd>

                        {/loop}
                </dl>
                    <?php };?>


                <div class="clearfix blank5"></div>
            </div>
            <div class="clearfix blank20"></div>
        {/loop}
        </div>

        <div class="blank30"></div>
        <div class="line"></div>
        <div class="blank30"></div>
        <input type="hidden" name="submit" value="1"/>
        <input class="btn btn-primary btn-lg" type="button" value="{lang_admin('preservation')} " name="save"
               onclick="this.form.action='<?php echo modify('act/add',true);?>';  returnform(this.form);"/>

        <div class="blank30"></div>
        <div class="line"></div>

        <div class="clear page">
            <?php $record_count=isset($record_count)?$record_count:0; if(get('table')!='type' && front::get('case')!='field') echo pagination::adminhtml($record_count); ?>
        </div>
        <div class="blank30"></div>
</div>
    </form>
    <script>
        $(function () { $("[data-toggle='tooltip']").tooltip(); });
    </script>

</div>
<script>
    function checkfromdata(obj,name){
        if (name =="all"){
            if($(obj).is(':checked')) {
                $(".hiddenfromdata").val(1);
            }else{
                $(".hiddenfromdata").val(0);
            }
        }else{
            if($(obj).is(':checked')) {
                $("#"+name).val(1);
            }else{
                $("#"+name).val(0);
            }
        }
    }

    //选中下属栏目
    function checkfromprante(obj,name){
        if($(obj).is(':checked')) {
            $(".hiddenfromdata").each(function () {
                if ($(this).data("prante")==name) {
                    $(this).val(1);
                }
            });
            $(".checkbox_prante").each(function () {
                if ($(this).data("prante")==name) {
                    $(this).prop("checked",true);
                }
            });
        }else{
            $(".hiddenfromdata").each(function (sonboj) {
                if ($(this).data("prante")==name) {
                    $(this).val(0);
                }
            });
            $(".checkbox_prante").each(function () {
                if ($(this).data("prante")==name) {
                    $(this).prop("checked",false);
                }
            });
        }

    }
</script>

<script type="text/javascript">
    <!--
    $(document).ready(function(){
        $(window).scroll(function() {
            var top = $("#index_connent").offset().top; //获取指定位置
            var scrollTop = $(window).scrollTop();  //获取当前滑动位置
            if(scrollTop > top){                 //滑动到该位置时执行代码

                $(".content-eidt-nav").addClass("sabit");

                $(".sabit #fullscreen-btn").css("display","inline-block");
                $(".sabit #content-eidt-nav-btn").css("display","inline-block");

            }else{
                $(".content-eidt-nav").removeClass("sabit");
                $("#fullscreen-btn").css("display","none");
                $(".fixed #fullscreen-btn").css("display","inline-block");
                $("#content-eidt-nav-btn").css("display","none");
            }
        });
    });


    $(document).ready(function(){
        $("#content-eidt-nav-btn").click(function(){

            $(".content-eidt-nav").removeClass("sabit");
        });
    });
    //-->
</script>
<script type="text/javascript">
    <!--
    var fullscreen = false;
    let btn = document.getElementById('fullscreen-btn');
    let fullarea = document.getElementById('box')
    btn.addEventListener('click',function(){
        if (fullscreen) {
            // 退出全屏
            $(".content-eidt-nav").removeClass("fixed");
            $(".content-eidt-nav").css({
                "background-color":"#ffffff"
            });
            $(".content-eidt-nav.sabit").css({
                "padding-right":"15px",
            });
            $(".fixed #fullscreen-btn").css("display","none");
            if (document.exitFullscreen) {
                document.exitFullscreen();
            } else if (document.webkitCancelFullScreen) {
                document.webkitCancelFullScreen();
            } else if (document.mozCancelFullScreen) {
                document.mozCancelFullScreen();
            } else if (document.msExitFullscreen) {
                document.msExitFullscreen();
            }
        } else {
            // 进入全屏
            $("#box").css({
                "overflow":"hidden",
                "overflow-y":"auto"
            });
            $(".content-eidt-nav").addClass("fixed");

            $(".fixed #fullscreen-btn").css("display","inline-block");

            if (fullarea.requestFullscreen) {
                fullarea.requestFullscreen();
            } else if (fullarea.webkitRequestFullScreen) {
                fullarea.webkitRequestFullScreen();
            } else if (fullarea.mozRequestFullScreen) {
                fullarea.mozRequestFullScreen();
            } else if (fullarea.msRequestFullscreen) {
                // IE11
                fullarea.msRequestFullscreen();
            }
        }
        fullscreen = !fullscreen;
    });
    //-->
</script>