<?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>
<script src="{WEB_ROOT}public/scroll/jquery.slimscroll.js"></script>
<base target="iframe_body">
</head>

<body>

    <div class="ui-north">
        <div class="logo"><img src="data:image/gif;base64, "></div>
        <div class="user_base">{get_admin_info('penname')}<span class="ui-icon-down"></span>
            <ul>
                <li><a href="javascript:;" class="editpass" data-url="{U('pass')}">修改密码</a></li>
                <li><a href="{U('out')}" target="_parent">退出登录</a></li>
            </ul>
        </div>
        <div class="other_left"><a href="javascript:;" class="ui-icon-Import"></a></div>
        <div class="other_menu"><a class="ui-icon-list offside-show" href="javascript:;" data-target="#offside-left"></a></div>
        <div class="other_link">
            <ul>
                <li><a href="{WEB_ROOT}" target="_blank">预览网站</a></li>
                <li><a href="https://www.sdcms.cn" target="_blank">官方网站</a></li>
                <li><a href="javascript:;" class="bizcode">录入授权码</a></li>
            </ul>
        </div>
    </div>
    
    <div class="ui-body">
        <div class="ui-west">
        	<!---->
            <div class="leftwarp">
                <ul class="accordion">
                    <li class="active">
                        <div class="title"><a href="{THIS_LOCAL}" target="_parent"> 管理首页</a></div>
                    </li>
                    {sdcms:rp top="0" table="sd_admin_menu" where="islock=1 and followid=0 $where" order="ordnum,id" auto="j"}
                    {php $classid=$rp[id]}
                    <li>
                        <div class="title"><a href="javascript:;"> {$rp[title]}<span class="ui-icon-right"></span></a></div>
                        <ul class="sub_nav">
                            {sdcms:rs top="0" table="sd_admin_menu" where="islock=1 and followid=$classid $where" order="ordnum,id"}
                            <li><a href="{get_admin_menu_url($rs[cname],$rs[aname],$rs[dname])}"> {$rs[title]}</a></li>
                            {/sdcms:rs}
                        </ul>
                    </li>
                    {/sdcms:rp}
                </ul>
            </div>
            <!---->
        </div>
        
        <div class="ui-center{if isipad()} ipad{/if}"></div>
        
    </div>
	<div class="offside offside-left" id="offside-left">
        
    </div>
    <script>
	function editbiz()
	{
		$.dialogbox({
			'title':"录入授权码",
			'text':'<div class="mb-15">当前域名：<span style="color:#f30;">{$domain}</span></div>',
			'inputval':'{C("BIZ_ID")}',
			'type':2,
			'width':'450px',
			'align':'',
			'mask':true,
			'okval':'保存授权码',
			'oktheme':'btn-info',
			'ok':function(e)
			{
				var code=e.inputval();
				$.ajax(
				{
					type:'post',
					cache:false,
					dataType:'json',
					url:'{THIS_LOCAL}',
					data:'code='+code,
					error:function(e){alert(e.responseText);},
					success:function(d)
					{
						sdcms.success(d.msg);
						if(d.state=='success')
						{
							setTimeout(function(){location.href='{THIS_LOCAL}';},1500);
						}
					}
				})
			},
			'cancelval':'购买授权码',
			'cancel':function(e)
			{
				location.href='https://www.sdcms.cn';
			}
		})
	}
    $(function()
	{
		{if APP_DEMO}
		$.dialog(
		{
			'title':"友情提示",
			'text':"您的账户权限为：只读。<div class='text-red'>您所做的任何修改均不会生效！！！</div>",
			'ok':function(e)
			{
				e.close();
			},
			'cancelshow':false
		});
		{/if}
		{if $isbiz==0}
		$.dialog(
		{
			'title':"授权提示",
			'text':'<div style="padding:0 5px;font-size:14px;line-height:30px;">域名：<span style="color:#f30;">{$domain}</span><br>暂未授权，部分功能将无法正常使用。</div><div style="text-align:center;padding:15px;"><button class="btn btn-info btn-block bizcode">录入授权码</button></div>',
			'align':'bottom-right',
			'okval':'录入授权码',
			'mask':false,
			'footer':false,
			'oktheme':'btn-info',
			'ok':function(e)
			{
				e.close();
				$(".bizcode").click();
			}
		});
		{/if}
		$(".bizcode").click(function()
		{
			//关闭所有窗口
			$.dialogclose();
			editbiz();
		});

        $(".user_base").hover(function(){
            $("ul",this).css("display","block");},
            function(){$("ul",this).css("display","none");
        });
		$("#offside-left").html($(".ui-west").html());
		var Accordion=function(el,multiple)
        {
            this.el=el||{};
            this.multiple=multiple||false;
            var links=this.el.find('.title');
            links.on('click',{el:this.el,multiple:this.multiple},this.dropdown)
        }
        Accordion.prototype.dropdown = function(e)
        {
            var $el=e.data.el;
			$this=$(this),
			$next=$this.next();
			$next.slideToggle();
			$this.parent().toggleClass('active');
			$this.parent().siblings(".active").removeClass("active");
			if (!e.data.multiple)
			{
				$el.find('.sub_nav').not($next).slideUp();
			};
        }
        var accordion = new Accordion($('.accordion'), false);
		 $('.sub_nav li').bind('click', function(){
            $('.sub_nav li').removeClass('hover');
            $(this).addClass('hover');
        });
		//模拟滚动条
		$(".leftwarp").slimscroll({height:"auto",size:"5px",color:"#9CABC3",opacity:0.6,wheelStep:5,touchScrollStep:50})
        $(".ui-center").html('<iframe name="iframe_body" src="{U('right')}" width="100%" height="100%" frameborder="0"></iframe>');
		$(".other_left a").click(function()
		{
			if($(".ui-body").hasClass("ui-mobile"))
			{
				$(".ui-body").removeClass("ui-mobile");
			}
			else
			{
				$(".ui-body").addClass("ui-mobile");
			}
		})
		
		
		$(".editpass").click(function()
		{
			var url=$(this).attr("data-url");
			$.dialogbox(
			{
				'title':"修改密码",
				'text':url,
				'width':'450px',
				'height':'230px',
				'type':3,
				'oktheme':'btn-info',
				'ok':function(e)
				{
					e.iframe().contents().find("#sdcms-submit").click();
				}
			});
		});
    })
    </script>
</body>
</html>