<%@page trimDirectiveWhitespaces="true"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="gen" uri="http://help.jspgen.com/taglib/jstl"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1" />
<title>内容</title>
<!-- 当前页面 -->
<link type="text/css" href="${config.statie}ui/admin/images/admin.css" rel="stylesheet">
<link type="text/css" href="${config.statie}ui/cms/admin/images/ico.css" rel="stylesheet">
<style type="text/css">
/*菜单定义*/
.menu{width:auto; min-width:60px; display:none; position:absolute;top:0;left:0; z-index:10;}
.menu ul{padding:5px;background:#FFF;border-radius:3px;border:1px solid #DEDEDE;}
.menu li{border-radius:3px;line-height:24px;text-align:center;cursor:pointer;}
.menu li.line{border-bottom:1px solid #F2F2F2;}
.menu li:hover{background:#F7FCFE;color:#278BF2;}
.menu li:hover i{color:#F7FCFE;}

/*添加操作*/
.add span,.operate span{display:inline-block; margin-left:5px; width:7px; height:7px; background:url(${config.statie}ui/cms/admin/images/down-ico.png) no-repeat;}
.add{text-align:center; position:relative; cursor:pointer;}
.add .hover-up{transition-duration:.5s; transform:rotate(180deg); -webkit-transform:rotate(180deg); filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);}
.add .hover-down{transition-duration:.5s; transform:rotate(0deg); -webkit-transform:rotate(0deg); filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=4);}

/*添加操作菜单*/
.add-menu{min-width:80px;/*position:absolute;top:34px;left:5px;*/}
.add-menu ul{background:#FBFBFB;}
.add-menu li{padding:0 4px; font-size:14px; text-align:left;}
.add-menu li i{padding-right:5px;}
.add-menu li:hover{background:#278BF2; color:#FFF;}

/*内容操作*/
.operate{width:60px; text-align:center; display:block; position:relative; cursor:pointer;}
.operate span{background-position:0 -8px;}
.operate .hover-up{transition-duration:.5s; transform:rotate(180deg); -webkit-transform:rotate(180deg); filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);}
.operate .hover-down{transition-duration:.5s; transform:rotate(0deg); -webkit-transform:rotate(0deg); filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=4);}
</style>
</head>
<body>
<div id="wrapper">
  <div class="push">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="left"><a href="javascript:void(0);" class="button orange tiny add"><i></i>添加<span></span></a></td>
        <td align="right"><a href="javascript:void(0);" class="button green tiny" onclick="reflesh();"><i></i>刷新</a></td>
      </tr>
    </table>
  </div>
  <div class="area">
    <h2><ul id="statusItem" class="area-genre">
        <li val="6" <gen:if test="${empty param.status || param.status==6}"> class="hover"</gen:if>>已发布</li>
        <gen:if test="${platAdmin || (not empty nodeAllow && nodeAllow.showReview==1)}">
        <li val="3" <gen:if test="${param.status==3}"> class="hover"</gen:if>>待审</li>
        </gen:if>
        <li val="2" <gen:if test="${param.status==2}"> class="hover"</gen:if>>退稿</li>
        <li val="1" <gen:if test="${param.status==1}"> class="hover"</gen:if>>草稿</li>
        <gen:if test="${platAdmin}">
        <li val="0" <gen:if test="${param.status==0}"> class="hover"</gen:if>>回收站</li>
        </gen:if>
      </ul>
      <i>内容管理</i>
    </h2>
    <div class="area-content">
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table">
        <tr>
          <th width="5%" title="全选/取消"><input type="checkbox" name="check" for="ids" value="0"></th>
          <th width="55%" class="border-left">标题</th>
          <th width="10%" class="border-left">浏览数</th>
          <th width="10%" class="border-left">录入者</th>
          <th width="15%" class="border-left">录入时间</th>
          <th width="5%" class="border-left">操作</th>
        </tr>
        <gen:if test="${not empty pager.results}">
        <c:forEach items="${pager.results}" var="map">
        <tr class="border-top" id="${map.id}" modelId="${map.modelId}" contentmenu="${map.contentmenu}">
          <td align="center"><input type="checkbox" name="ids" value="${map.id}"></td>
          <td class="border-left model content"><i class="${map.modelId}"></i>&nbsp;<a href="javascript:void(0);" class="view" title="${map.title}">${map.title}</a>&nbsp;
          <gen:if test='${map.isLock == 1}'><span class="lock" title="锁定"></span></gen:if>
          <gen:if test='${map.commend > 0}'><span class="commend" title="推荐"></span></gen:if>
          <gen:if test='${not empty map.thumb}'><span class="thumb" title="缩略图"></span></gen:if>
          <gen:if test='${map.isNote == 1}'><span class="note" title="批注"></span></gen:if>
          <gen:if test='${not empty map.reference}'><span class="reference" title="引用"></span></gen:if>
          </td>
          <td align="center" class="border-left">${map.pv}</td>
          <td align="center" class="border-left">${map.user.username}</td>
          <td align="center" class="border-left">${gen:dateTime(map.time, 'yyyy-MM-dd HH:mm:ss', config.timezoneid)}</td>
          <td align="center" class="border-left"><a href="javascript:void(0);" class="operate">查看<span></span></a></td>
        </tr>
        </c:forEach>
        <gen:else />
        <tr class="border-top">
        	<td colspan="6" align="center" class="ignore">暂无数据</td>
        </tr>
        </gen:if>
        <tr class="border-top">
          <th colspan="7"><div class="th-left">
          <gen:if test="${empty param.status || param.status==6}">
          <gen:if test='${isSpecial}'><a href="javascript:void(0);" class="button gray tiny blue-hover special"><i></i>专题</a></gen:if>
          <gen:if test='${platAdmin}'><a href="javascript:void(0);" class="button gray tiny blue-hover commend"><i></i>推荐</a></gen:if>
          <gen:if test="${platAdmin || (not empty nodeAllow && nodeAllow.showReview==1)}">
          <a href="javascript:void(0);" class="button gray tiny blue-hover remove"><i></i>撤稿</a>
          </gen:if>
          </gen:if>
          <gen:if test="${param.status == 3}">
          <gen:if test="${platAdmin || (not empty nodeAllow && nodeAllow.showReview==1)}">
          <a href="javascript:void(0);" class="button gray tiny blue-hover pass"><i></i>发布</a>
          <a href="javascript:void(0);" class="button gray tiny blue-hover reject"><i></i>退稿</a>
          </gen:if>
          </gen:if>
          <gen:if test="${param.status == 1 || param.status == 2}">
          <a href="javascript:void(0);" class="button gray tiny blue-hover audit"><i></i>送审</a>
          <a href="javascript:void(0);" class="button gray tiny blue-hover delete"><i></i>删除</a>
          </gen:if>
          <gen:if test="${param.status == 0}">
          <gen:if test="${platAdmin}">
          <a href="javascript:void(0);" class="button gray tiny blue-hover restore"><i></i>还原</a>
          <a href="javascript:void(0);" class="button gray tiny blue-hover delete"><i></i>删除</a>
          <a href="javascript:void(0);" class="button gray tiny blue-hover clear"><i></i>清空</a>
          </gen:if>
          </gen:if>
          </div>
          <div class="pages th-right">${pager.pageBar}</div></th>
        </tr>
      </table>
    </div>
  </div>
  <div class="area">
    <h2><i>查询</i></h2>
    <div class="area-content">
      <form name="search" id="search" method="POST" action="?">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table">
          <tr>
            <td width="30%" align="right">模型：</td>
            <td><select name="modelId">
                <option value="" <gen:if test="${empty param.modelId || param.modelId==''}">selected</gen:if>>不限</option>
                <c:forEach items="${modelList}" var="model">
                <option value="${model.id}" <gen:if test="${param.modelId==model.id}">selected</gen:if>>${model.name}</option>
                </c:forEach>
              </select>
              &nbsp;&nbsp;
              <select name="orderBy">
                <option value="time" <gen:if test="${empty param.orderBy || param.orderBy=='time'}">selected</gen:if>>按录入时间</option>
                <option value="publishTime" <gen:if test="${param.orderBy=='publishTime'}">selected</gen:if>>按上线时间</option>
                <option value="pv" <gen:if test="${param.orderBy=='pv'}">selected</gen:if>>按浏览数</option>
                <option value="comments" <gen:if test="${param.orderBy=='comments'}">selected</gen:if>>按评论数</option>
              </select>&nbsp;
              <select name="order">
              	<option value="desc" <gen:if test="${param.order=='desc'}">selected</gen:if>>降序排列</option>
              	<option value="asc" <gen:if test="${param.order=='asc'}">selected</gen:if>>升序排列</option>
              </select></td>
          </tr>
          <tr class="border-top">
            <td align="right">关键字： </td>
            <td><input type="text" name="keyword" class="text small" title="关键字" value="${param.keyword}" size="65"/></td>
          </tr>
          <tr class="border-top">
            <td align="right">录入时间： </td>
            <td><input id="startDate" name="startDate" type="text" class="text small" size="20" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'endDate\')||\'%y-%M-%d\'}'});" value="${param.startDate}" />
              <label for="startDate" generated="true" class="ico-tips date-picker"></label>
              &nbsp;~&nbsp;
              <input id="endDate" name="endDate" type="text" class="text small" size="20" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'startDate\')}',maxDate:'%y-%M-%d'});" value="${param.endDate}" />
              <label for="endDate" generated="true" class="ico-tips date-picker"></label>
              &nbsp;
              <input to="startDate,endDate" class="button green tiny resetDate" type="button" value="清空" /></td>
          </tr>
          <tr class="border-top">
            <td align="right">发布时间： </td>
            <td><input id="startTime" name="startTime" type="text" class="text small" size="20" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'endTime\')||\'%y-%M-%d\'}'});" value="${param.startTime}" />
              <label for="startTime" generated="true" class="ico-tips date-picker"></label>
              &nbsp;~&nbsp;
              <input id="endTime" name="endTime" type="text" class="text small" size="20" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'startTime\')}',maxDate:'%y-%M-%d'});" value="${param.endTime}" />
              <label for="endTime" generated="true" class="ico-tips date-picker"></label>
              &nbsp;
              <input to="startTime,endTime" class="button green tiny resetDate" type="button" value="清空" /></td>
          </tr>
          <tr class="border-top">
            <th colspan="2" class="push txt-c"><input name="find" type="hidden" value="title,tags" />
              <input name="status" type="hidden" id="status" value="${param.status}" />
              <input name="nodeId" type="hidden" id="nodeId" value="${param.nodeId}" />
              <input name="childids" type="hidden" id="childids" value="${param.childids}" />
              <input name="submit" class="button blue small" type="submit" value="确 定" />
              &nbsp;&nbsp;&nbsp;&nbsp;
              <input name="reset" class="button gray small" type="reset" value="取 消" />
              </td>
          </tr>
        </table>
      </form>
    </div>
  </div>
</div>
<div class="menu add-menu">
  <ul class="model">
  <c:forEach items="${modelList}" var="model">
    <li modelId="${model.id}" modelName="${model.name}" nodeId="${param.nodeId}"><i class="${model.id}"></i>${model.name}</li>
  </c:forEach>
  </ul>
</div>
<div class="menu content-menu">
  <ul>
    <li class="menu-view">查看</li>
    <li class="menu-edit">修改</li>
    <li class="menu-reference">引用</li>
    <li class="menu-move">移动</li>
    <li class="menu-copy line">复制</li>
    <li class="menu-lock">锁定</li>
    <li class="menu-unlock">解锁</li>
    <li class="menu-keyword">关键词</li>
    <li class="menu-logger">日志</li>
  </ul>
</div>
<!-- 必备插件 -->
<script type="text/javascript" src="${config.statie}js/jquery.js"></script>
<script type="text/javascript" src="${config.statie}js/jquery.form.js"></script>
<script type="text/javascript" src="${config.statie}js/jquery.grapes.js"></script>
<script type="text/javascript" src="${config.statie}js/jquery.timers.js"></script>
<script type="text/javascript" src="${config.statie}js/jquery.mousewheel.js"></script>
<script type="text/javascript" src="${config.statie}js/jquery.tablecolor.js"></script>
<!-- 日期插件 -->
<script type="text/javascript" src="${config.statie}js/datePicker/WdatePicker.js"></script>
<!-- 弹窗插件 -->
<script type="text/javascript" src="${config.statie}js/dialog/jquery.dialog.js?self=true"></script>
<script type="text/javascript" src="${config.statie}js/dialog/jquery.dialog.plugins.js"></script>
<!-- UI界面必备 -->
<script type="text/javascript" src="${config.statie}ui/js/jspgen.js"></script>
<script type="text/javascript" src="${config.statie}ui/js/jspgen.ajax.js"></script>
<script type="text/javascript" src="${config.statie}ui/js/jspgen.ready.js"></script>
<!-- 当前页面 -->
<script type="text/javascript" src="${config.statie}ui/cms/js/jspgencms.js"></script>
<script type="text/javascript" src="${config.statie}ui/cms/js/jspgencms.ajax.js"></script>
<script type="text/javascript" src="${config.statie}ui/cms/admin/js/content.js"></script>
<script type="text/javascript" src="${config.statie}ui/cms/admin/js/content-menu.js"></script>

<script type="text/javascript">
// document.domain = "jspgen.com";
// 添加Tab
function addTab(title, url, id){
	$parent.addTab(title, url, id);
}

// 调用
$(document).ready(function(){
	// 日期清空
	var $resetDate = $('.resetDate');
	$resetDate.bind('click', function () {
		var $parent = $(this).parent();
		var toArr = ($(this).attr('to')).split(',');
		if(toArr!=null && toArr.length>0) {
			for(i in toArr) $parent.find('input[name="'+toArr[i]+'"]').prop('value', '');
		}
	});
	
	// 变量
	var $statusItem = $('#statusItem > li');
	var $addMenuli = $('.add-menu li');
	var $view = $('.table a.view');
	var $pages = $('.table .pages');
	var $search = $('#search');
	
	var $html = $('.table a.html');
	var $special = $('.table a.special');
	var $commend = $('.table a.commend');
	var $remove = $('.table a.remove');
	
	var $publish = $('.table a.publish');
	var $pass = $('.table a.pass');
	var $reject = $('.table a.reject');
	
	var $audit = $('.table a.audit');
	var $delete = $('.table a.delete');
	
	var $restore = $('.table a.restore');
	var $clear = $('.table a.clear');
	var $clearTd = $('.table td:not(.ignore)');
	
	// statusItem
	$statusItem.bind('click', function () {
		var status = $(this).attr('val');
		$("#status").attr('value', status);
		$search.find(':submit').click(); // $search.submit();
	});
	
	/*
	// 添加列表
	$add.bind('click', function () {
		$addMenu.slideToggle();
	});
	$add.bind('mouseleave', function () {
    	$addMenu.slideToggle();
	});
	*/
	
	// 添加
	$addMenuli.bind('click', function () {
		var modelId = $(this).attr('modelId'), modelName = $(this).attr('modelName'), nodeId = $(this).attr('nodeId');
		// $parent.addTab('添加内容', 'model/'+modelId+'!add.gen?nodeId='+nodeId);
		content.add(modelId, modelName, nodeId); return true;
	});
	
	// 查看
	$view.bind('click', function () {
		var id = $(this).closest('tr').attr('id'), modelId = $(this).closest('tr').attr('modelId');
		content.view(id, modelId, $(this).attr('title')); return true;
	});
	
	
	// html
	$html.bind('click', function () {
		var ids = $(this).closest('tr').attr('id');
		content.html(ids); return true;
	});
	// 专题
	$special.bind('click',function(){
		var ids = $(this).closest('tr').attr('id');
		content.special(ids); return true;
	});
	// 推荐
	$commend.bind('click',function(){
		var ids = $(this).closest('tr').attr('id');
		content.commend(ids); return true;
	});
	// 撤稿(移除、卸载)
	$remove.bind('click', function () {
		var ids = $(this).closest('tr').attr('id');
		content.common(ids, 'remove', '撤稿'); return true;
	});
	
	// 发布
	$publish.bind('click', function () {
		var ids = $(this).closest('tr').attr('id');
		content.common(ids, 'publish', '发布'); return true;
	});
	// 通过
	$pass.bind('click', function () {
		var ids = $(this).closest('tr').attr('id');
		content.common(ids, 'pass', '通过'); return true;
	});
	// 退稿
	$reject.bind('click', function () {
		var ids = $(this).closest('tr').attr('id');
		content.common(ids, 'reject', '退稿'); return true;
	});
	
	// 送审
	$audit.bind('click', function () {
		var ids = $(this).closest('tr').attr('id');
		content.common(ids, 'audit', '送审'); return true;
	});
	// 删除
	$delete.bind('click', function () {
		var id = $(this).closest('tr').attr('id');
		content.deletes(id); return true;
	});
	
	// 还原
	$restore.bind('click', function () {
		var ids = $(this).closest('tr').attr('id');
		content.common(ids, 'restore', '还原'); return true;
	});
	// 清空
	$clear.bind('click', function () {
		var id = $(this).closest('tr').attr('id');
		content.deletes(id); return true;
	});
	
	
});
</script>
</body>
</html>