<%@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">
<style type="text/css">
.span-text {padding:0 2px; color:#FFFFFF; background:#9AC621; border-radius:3px; max-width:120px;}
</style>
</head>
<body>
<div id="wrapper">
  <div class="area">
    <h2>
      <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="40%" class="border-left">标题</th>
          <th width="10%" class="border-left">浏览数</th>
          <th width="5%" class="border-left">状态</th>
          <th width="10%" class="border-left">录入者</th>
          <th width="15%" class="border-left">录入时间</th>
          <th width="15%" 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}" nodeId="${map.nodeId}">
          <td align="center"><input type="checkbox" name="ids" value="${map.id}"></td>
          <td class="border-left model"><i class="${map.modelId}"></i>&nbsp;[<gen:if test='${not empty map.node}'>${map.node.name}</gen:if>]&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">${statusMap[map.status]}</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">${gen:dateTime(map.publishTime, 'yyyy-MM-dd HH:mm:ss', config.timezoneid)}</td>
        </tr>
        </c:forEach>
        <gen:else />
        <tr class="border-top">
        	<td colspan="7" 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}">
          <a href="javascript:void(0);" class="button gray tiny blue-hover move"><i></i>转移</a>
          <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>
          </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><a href="javascript:void(0);" class="nodesChoose" to="nodeIds">选择</a>
              <input name="nodeIds" type="hidden" value="${param.nodeIds}" /><input name="nodeNames" type="hidden" value="${param.nodeNames}" />&nbsp;&nbsp;
              <span id="nodesText" class="span-text hide">${param.nodeNames}</span></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="${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="${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">
            <td align="right">状态：</td>
            <td><label><input name="status" type="radio" value="6" ${empty param.status || param.status==6 ? 'checked' : ''}/>
            已发布</label>&nbsp;&nbsp;
            <gen:if test="${platAdmin || (not empty nodeAllow && nodeAllow.showReview==1)}">
            <label><input name="status" type="radio" value="3" ${param.status==3 ? 'checked' : ''}/>
            待审</label>&nbsp;&nbsp;
            </gen:if>
            <label><input name="status" type="radio" value="2" ${param.status==2 ? 'checked' : ''}/>
            退稿</label>&nbsp;&nbsp;
            <label><input name="status" type="radio" value="1" ${param.status==1 ? 'checked' : ''}/>
            草稿</label>
            <gen:if test="${platAdmin}">
            <label><input name="status" type="radio" value="0" ${param.status==0 ? 'checked' : ''}/>
            回收站</label>&nbsp;&nbsp;
            </gen:if></td>
          </tr>
          <tr class="border-top">
            <td align="right">排序：</td>
            <td><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">
            <th colspan="2" class="push txt-c"><input name="find" type="hidden" value="title,tags" />
              <input name="submit" class="button blue small" type="submit" value="确 定" />
              &nbsp;&nbsp;&nbsp;&nbsp;
              <input name="reset" class="button gray small" type="reset" value="取 消" />
              </th>
          </tr>
        </table>
      </form>
    </div>
  </div>
</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/admin/js/content.js"></script>
<script type="text/javascript">
// document.domain = "baidu.com";

// 调用
$(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 $nodesChoose = $('.nodesChoose'), $nodesText = $('#nodesText');
	var $nodeIds = $('input[name="nodeIds"]'), $nodeNames = $('input[name="nodeNames"]');
	$nodesText.toggle(grapes.isNotEmpty($nodeNames.val()));
	$nodesChoose.bind('click',function(){
		var dialog = $dialog.iframe(jspgen.dynamie + jspgencms.id + '/admin/node!choose.gen?ids='+$nodeIds.prop('value')+'&names='+$nodesText.text(),
			{title: '节点', width:'230px', height:'300px', resize: false});
		dialog.callback = function(obj) {
			$nodeIds.prop('value', obj.ids);
			$nodeNames.prop('value', obj.names);
			$nodesText.text(obj.names).toggle(grapes.isNotEmpty(obj.names));
		}
	});
	
	// 变量
	var $view = $('.table a.view');
	var $move = $('.table a.move');
	var $remove = $('.table a.remove');
	var $pages = $('.table .pages');
	
	// 查看
	$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;
	});
	// 转移
	$move.bind('click', function () {
		var id = $(this).closest('tr').attr('id');
		content.move(id); return true;
	});
	// 移除(卸载)
	$remove.bind('click', function () {
		var id = $(this).closest('tr').attr('id');
		content.common(id, 'remove', '撤稿'); return true;
	});
});
</script>
</body>
</html>
