<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
	<head>
		<title></title>
		<meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link rel="stylesheet" type="text/css" href="<?php echo (THEME_PATH_ABS); ?>/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="<?php echo (THEME_PATH_ABS); ?>/css/bootstrap-responsive.min.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo (THEME_PATH_ABS); ?>/css/colorpicker.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo (THEME_PATH_ABS); ?>/css/datepicker.css" />
		<link rel="stylesheet" type="text/css" href="<?php echo (THEME_PATH_ABS); ?>/css/uniform.css" />
		<link rel="stylesheet" type="text/css" href="<?php echo (THEME_PATH_ABS); ?>/css/select2.css" />		
		<link rel="stylesheet" type="text/css" href="<?php echo (THEME_PATH_ABS); ?>/css/unicorn.main.css" />
		<link rel="stylesheet" href="<?php echo (THEME_PATH_ABS); ?>/css/unicorn.grey.css" class="skin-color" />	
		<script type="text/javascript" src="<?php echo (THEME_PATH_ABS); ?>/js/jquery.min.js"></script>
		<script type="text/javascript" src="<?php echo (THEME_PATH_ABS); ?>/js/jquery.cookie.js"></script>
		<script type="text/javascript" src="<?php echo (THEME_PATH_ABS); ?>/js/jquery.ui.custom.js"></script>
		<script type="text/javascript" src="<?php echo (THEME_PATH_ABS); ?>/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="<?php echo (THEME_PATH_ABS); ?>/js/bootstrap-colorpicker.js"></script>
		<script type="text/javascript" src="<?php echo (THEME_PATH_ABS); ?>/js/bootstrap-datepicker.js"></script>
		<script type="text/javascript" src="<?php echo (THEME_PATH_ABS); ?>/js/jquery.uniform.js"></script>
		<script type="text/javascript" src="<?php echo (THEME_PATH_ABS); ?>/js/select2.min.js"></script>
		<script type="text/javascript" src="<?php echo (THEME_PATH_ABS); ?>/js/unicorn.js"></script>
		<script type="text/javascript" src="<?php echo (THEME_PATH_ABS); ?>/js/unicorn.form_common.js"></script>
		<script type="text/javascript" src="<?php echo (THEME_PATH_ABS); ?>/js/jquery.dataTables.min.js"></script>
		<script type="text/javascript" src="<?php echo (THEME_PATH_ABS); ?>/js/unicorn.tables.js"></script>
		<script type="text/javascript" src="/wublog/Public/ueditor/ueditor.config.js"></script>
		<script type="text/javascript" src="/wublog/Public/ueditor/lang/zh-cn/zh-cn.js"></script>
		<script type="text/javascript" src="/wublog/Public/ueditor/ueditor.all.min.js"></script>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
	<body>
		
		
		<div id="header">

			<h1><a href="./dashboard.html">Unicorn Admin</a></h1>	
		</div>
		<!--
		<div id="search">
			<input type="text" placeholder="Search here..." /><button type="submit" class="tip-right" title="Search"><i class="icon-search icon-white"></i></button>
		</div>-->
		<div id="user-nav" class="navbar navbar-inverse">
            <ul class="nav btn-group">

                <!--<li class="btn btn-inverse"><a title="" href="#"><i class="icon icon-user"></i> <span class="text">Profile</span></a></li>
                <!--
                <li class="btn btn-inverse dropdown" id="menu-messages"><a href="#" data-toggle="dropdown" data-target="#menu-messages" class="dropdown-toggle"><i class="icon icon-envelope"></i> <span class="text">Messages</span> <span class="label label-important">5</span> <b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a class="sAdd" title="" href="#">new message</a></li>
                        <li><a class="sInbox" title="" href="#">inbox</a></li>
                        <li><a class="sOutbox" title="" href="#">outbox</a></li>
                        <li><a class="sTrash" title="" href="#">trash</a></li>
                    </ul>-->
                </li>
                <li class="btn btn-inverse"><a title="" href="/wublog/index.php/index.php/Admin/Index/profile"><i class="icon icon-cog"></i> <span class="text"><?php echo ($_SESSION['username']); ?>设置</span></a></li>

                <li class="btn btn-inverse"><a title="" href="/wublog/index.php/Admin/Login/do_logout/"><i class="icon icon-share-alt"></i> <span class="text">注销</span></a></li>
            </ul>
        </div>
		<div id="sidebar">
			<a href="#" class="visible-phone"> <i class="icon icon-home"></i>
				Dashboard
			</a>
			<ul>
				<?php if(($data["PageFun"]) == "index"): ?><li class="active">
						<?php else: ?>		
						<li><?php endif; ?>
						<a href="/wublog/index.php/Admin/Index"> <i class="icon icon-home"></i>
							<span>首页</span>
						</a>
					</li>
					<?php if(in_array(($data["PageFun"]), explode(',',"archive,items,archivelists,archivelists"))): ?><li class="submenu open active">
							<?php else: ?>		
							<li class="submenu"><?php endif; ?>
							<a href="#">
								<i class="icon icon-th-list"></i>
								<span>内容管理</span>
								<span class="label"></span>
							</a>
							<ul>
								<?php if(($data["PageFun"]) == "items"): ?><li class="active">
										<?php else: ?>		
										<li><?php endif; ?>
										<a href="/wublog/index.php/Admin/Index/items">我的栏目</a>
									</li>
									<?php if(($data["PageFun"]) == "archivelists"): ?><li class="active">
											<?php else: ?>		
											<li><?php endif; ?>
											<a href="/wublog/index.php/Admin/Index/archivelists">所有文章</a>
										</li>
										<?php if(($data["PageFun"]) == "archive"): ?><li class="active">
												<?php else: ?>		
												<li><?php endif; ?>
												<a href="/wublog/index.php/Admin/Index/archive">内容发布</a>
											</li>

										</ul>
									</li>
									<?php if(($data["PageFun"]) == "mycomment"): ?><li class="active">
											<?php else: ?>		
											<li><?php endif; ?>
											<a href="/wublog/index.php/Admin/Index/mycomment">
												<i class="icon icon-pencil"></i>
												我的评论
											</a>
										</li>

										<?php if(in_array(($data["PageFun"]), explode(',',"myfiles,myimages"))): ?><li class="submenu open active">
												<?php else: ?>		
												<li class="submenu"><?php endif; ?>
												<a href="#">
													<i class="icon icon-th-list"></i>
													<span>上传管理</span>
													<span class="label"></span>
												</a>
												<ul>
													<?php if(($data["PageFun"]) == "myfiles"): ?><li class="active">
															<?php else: ?>		
															<li><?php endif; ?>
															<a href="/wublog/index.php/Admin/Index/myfiles/filter/all">我的文档</a>
														</li>
														<?php if(($data["PageFun"]) == "myimages"): ?><li class="active">
																<?php else: ?>		
																<li><?php endif; ?>
																<a href="/wublog/index.php/Admin/Index/myimages/filter/all">我的图片</a>
															</li>
														</ul>
													</li>

													<?php if(in_array(($data["PageFun"]), explode(',',"profile,link"))): ?><li class="submenu open active">
															<?php else: ?>		
															<li class="submenu"><?php endif; ?>
															<a href="#">
																<i class="icon icon-th-list"></i>
																<span>设置</span>
																<span class="label"></span>
															</a>
															<ul>
																<?php if(($data["PageFun"]) == "profile"): ?><li class="active">
																		<?php else: ?>		
																		<li><?php endif; ?>
																		<a href="/wublog/index.php/Admin/Index/profile">
																			<i class="icon icon-pencil"></i>
																			<span>常规选项</span>
																		</a>
																	</li>
																	<?php if(($data["PageFun"]) == "link"): ?><li class="active">
																			<?php else: ?>		
																			<li><?php endif; ?>
																			<a href="/wublog/index.php/Admin/Index/mylink">
																				<i class="icon icon-pencil"></i>
																				<span>友情链接</span>
																			</a>
																		</li>
																	</ul>

																</ul>

															</div>

															<div id="content">
																<div id="content-header">
																	<h1><?php echo ($data["PageName"]); ?></h1>
																</div>

																<div id="breadcrumb">
																	<a href="#" title="Go to Home" class="tip-bottom">
																		<i class="icon-home"></i>
																		Home
																	</a>
																	<a href="#" class="current"><?php echo ($data["PageName"]); ?></a>
																</div>
																<div id="style-switcher">
																	<i class="icon-arrow-left icon-white"></i>
																	<span>Style:</span>
																	<a href="#grey" style="background-color: #555555;border-color: #aaaaaa;"></a>
																	<a href="#blue" style="background-color: #2D2F57;"></a>
																	<a href="#red" style="background-color: #673232;"></a>
																</div>

<div class="container-fluid">
<div class="row-fluid">
						
							
				<div id='alert'></div>
				<div class="widget-box">
							<div class="widget-title">
								<span class="icon">
									<i class="icon-th-list"></i>								
								</span>
							
								<h5>文章列表</h5>
							</div>
							<div class="widget-content nopadding">
								<table class="table table-bordered data-table">
									<thead>
									<tr>
									<th><input type="checkbox" name="allchk" id="allchk"  /></th>
									<th>标题</th>
									<th>分类</th>
									<th>是否发布</th>
									<th>浏览级别</th>
									<th>更新时间</th>
									<th>更新ip</th>
									<th>操作</th>
									</tr>
									</thead>
									<tbody>

									<?php if(is_array($data["list"])): $i = 0; $__LIST__ = $data["list"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr class="gradeX" id="tr-<?php echo ($vo["id"]); ?>">
									<td>
									<label><input name="idchk" type="checkbox"  id="idchk" value="<?php echo ($vo["id"]); ?>" /></label></td>

									<td id="p<?php echo ($vo["id"]); ?>-t"><?php echo ($vo["title"]); ?></td>
									<td><?php echo ($vo["catename"]); ?></td>
									<td>
									<?php if(($vo["ispublish"]) == "1"): ?>草稿
									<?php else: ?>
									发布<?php endif; ?>
									</td>
									<td>
									<?php switch($vo["showid"]): case "-1": ?>全部可见<?php break;?>
										<?php case "0": ?>好友可见<?php break;?>
										<?php default: ?>自己可见<?php endswitch;?>
									</td>
									<td><?php echo ($vo["writetime"]); ?></td>
									<td><?php echo ($vo["writeip"]); ?></td>
									<td>

									<div class="btn-group">
									  <button data-toggle="dropdown" class="btn btn-primary dropdown-toggle">操作 <span class="caret"></span></button>
									  <ul class="dropdown-menu">
										<li><a href="/wublog/index.php/Admin/Index/archive/id/<?php echo ($vo["id"]); ?>"><i class="icon-pencil icon-black"></i>编辑</a></li>
										<li><a href="#" onclick="quickEdit(<?php echo ($vo["id"]); ?>)"><i class="icon-file icon-black"></i>快速编辑</a></li>
										<li class="divider"></li>
										<li><a href="#" onclick="del_ajax(<?php echo ($vo["id"]); ?>)"><i class="icon-remove icon-black"></i>删除</a></li>
									  </ul>
									</div>
									</td>

									</tr><?php endforeach; endif; else: echo "" ;endif; ?>

									</tbody>
									</table>  
							</div>
						</div>
								<div class="control-group">
										<div class="controls">
										
											<select id="operate">
												<option />批量操作
												<option value="del" />删除
												<option value="edit" />编辑
											</select>
											<button type="button" id="doOperate" class="btn btn-warning btn">执行</button>

											<select id='selectCate' name="category"> 
												<option value='1'  />未分类
												<?php if(is_array($data["category"])): $i = 0; $__LIST__ = $data["category"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value='<?php echo ($vo["id"]); ?>' /><?php echo ($vo["catename"]); endforeach; endif; else: echo "" ;endif; ?>
											</select>
											<button type="buttion" id='byCategory' class="btn btn-primary" ><i class="icon-search icon-white"></i>筛  选</button>
											<button type="buttion" id='byAll' class="btn btn-primary"><i class="icon-th-list icon-white"></i>全部文章</button>

										</div>
									</div>

<div id="myAlert" class="modal hide">
<div class="modal-header">
<button data-dismiss="modal" class="close" type="button">×</button>
<h3>删除警告</h3>
</div>
<div class="modal-body">
<p>将删除如下文章以及评论</p>
<p id="delpost"></p>
</div>

<div class="modal-footer">
<a data-dismiss="modal" id="mutildel" class="btn  btn-danger" href="#">删除</a>
<a data-dismiss="modal" class="btn" href="#">取消</a>
</div>
</div>






</div></div>
</div>
<script type="text/javascript">
//不同提交路径
function del_ajax(id)
{
	$.ajax({
		type:'get',
		url:'/wublog/index.php/Admin/Archive/delArchive/id/'+id,
		datatype:'json',
		data:{},
		success:function(data){
			var obj = eval('(' + data + ')'); 
			var html="<div class='alert'><button class='close' data-dismiss='alert'>×</button><strong>成功删除了</strong> 《"+obj.title+"》以及所属的 "+obj.comments+"条评论！</div>";
			$("#tr-"+id).remove();
			$("#alert").html($("#alert").html()+html).delay(5000).slideUp(500);
		}
	});
}
function submit_ajax(id)
{
	$.ajax({
		type:'post',
		url:'/wublog/index.php/Admin/Archive/editArchive/type/json/id/'+id,
		datatype:'json',
		data:{
			title:$("#title"+id).val(),
			category:$("#category"+id).find("option:selected").val(),
			showid:$("#showid"+id).find("option:selected").val(),
			ispublish:$("ispublish"+id).find("option:selected").val(),
			editorValue:UE.getEditor('myEditor'+id).getContent()
		},
		success:function(data)
		{
			var obj = eval('(' + data + ')'); 
			var td="<td><label><input name='idchk' type='checkbox'  id='idchk' value='"+id+"' /></label></td><td>"+obj.title+"</td><td>"+obj.category+"</td><td>"+obj.ispublish+"</td><td>"+obj.showid+"</td><td>"+obj.writetime+"</td><td>"+obj.writeip+"</td><td><div class='btn-group'><button data-toggle='dropdown' class='btn btn-primary dropdown-toggle'>操作 <span class='caret'></span></button><ul class='dropdown-menu'><li><a href='/wublog/index.php/Admin/Index/archive/id/'"+id+"><i class='icon-pencil icon-black'></i>编辑</a></li><li><a href='#' onclick='quickEdit("+id+")'><i class='icon-file icon-black'></i>快速编辑</a></li><li class='divider'></li><li><a href='#' onclick='del_ajax("+id+")'><i class='icon-remove icon-black' ></i>删除</a></li></ul></div></td>"
			var html="<div class='alert alert-success'><button class='close' data-dismiss='alert'>×</button><strong>成功的编辑了!</strong> 《"+obj.title+"》</div>";
			$("#tr-"+id).html(td);
			delete myhash[id];
			$("#alert").html($("#alert").html()+html).delay(5000).slideUp(500);
			
		},
	});
}
/*
function submit_btn(id)
{
		var path='/wublog/index.php/Admin/Archive/editArchive/id/'+id;
		$("#form"+id).attr("action",path);
		$("#form"+id).submit();

}*/
myhash = new Array();
 function quickEdit(id)
 {
myhash[id]=$("#tr-"+id).html();
$("#tr-"+id).load("/wublog/index.php/Admin/Index/quickEditor/id/"+id);
}
 function cancelQuickEdit(id)
 {
 	$("#tr-"+id).html(myhash[id]);
 	delete myhash[id];
 }
$("#byAll").click(function(){
location.href = "/wublog/index.php/Admin/Index/archivelists/";
});
$("#byCategory").click(function(){
location.href = "/wublog/index.php/Admin/Index/archivelists/type/cate/id/"+$("#selectCate").find("option:selected").val();
});
dellist = new Array();
$("#mutildel").click(function(){
	for(var i=0;i<dellist.length;i++)
		{
			del_ajax(dellist[i]);
		}
	del_ajax=[];
});
$("#doOperate").click(function(){
		var list='';
		var str='';
		var val=$("#operate").find("option:selected").val();
		if(val=='del')
		{
			$(":checkbox[name='idchk'][checked]").each(function () {
				str+=("《"+$("#p"+$(this).val()+"-t").html()+"》</br>");
				dellist.push($(this).val());
				list+=(','+$(this).val());
				//chk_value.push($(this).val());
			});

			str+=("<input type='hidden' name='idlist' value='"+list+"'/>");
			$("#delpost").html(str);
			$("#myAlert").modal();  

		}
		if(val=='edit')
		{

			$(":checkbox[name='idchk'][checked]").each(function () {
				quickEdit($(this).val());
			});
		}

  });

</script>

            <script type="text/javascript">
$('#style-switcher a').click(function()
      {
            var pub="/wublog/Public";
            var style = $(this).attr('href').replace('#','');
            $('.skin-color').attr('href',pub+'/css/unicorn.'+style+'.css');
            $(this).siblings('a').css({'border-color':'transparent'});
            $(this).css({'border-color':'#aaaaaa'});
      });
            </script>
	</body>
</html>