<%@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">
.list-info{margin-top:5px;}
.ul_sub{display:none; margin:2px;}
.ul_sub li{float:left; min-width:150px;}
</style>
</head>
<body>
<div id="wrapper">
  <div class="push">
    <form name="search" id="search" method="POST" action="?">
      &nbsp;关键字：
      <input type="text" name="keyword" class="text small" title="关键字" value="${gen:text(param.keyword,true,true)}" size="20"/>
      <input name="find" type="hidden" value="title,tags" />
      <input name="modelId" type="hidden" value="${param.modelId}" />
      <input name="notids" type="hidden" value="${param.notids}" />
      <input name="submit" class="button blue small" type="submit" value="查询" />
      <span class="orange">友情提示：</span>仅显示符合关键字的最后${pager.pageSize}条数据
    </form>
  </div>
  <div class="push">
    <ul class="list-info">
      <gen:if test="${not empty pager.results}">
      <gen:if test="${param.modelId == 'special'}">
      	<c:forEach items="${pager.results}" var="map">
          <li>&nbsp;<a href="javascript:void(0);" class="choose"><span>${gen:dateTime(map.time, 'yyyy-MM-dd', config.timezoneid)}</span>${map.title}</a>
          <ul class="ul_sub">
          <c:forEach items="${map.columnList}" var="column">
            <li name="${column.name}" title="${map.title}" thumb="${map.thumb}" url="${map.url}" time="${map.time}" sort="${map.sort}">&nbsp;
            <label>
              <input type="radio" name="${column.specialId}" value="${column.id}">
              ${column.name}
            </label></li>
          </c:forEach>
          </ul></li>
          <li class="clear"></li>
      	</c:forEach>
      <gen:else />
      	<c:forEach items="${pager.results}" var="map">
        <li name="" title="${map.title}" thumb="${map.thumb}" url="${map.url}" time="${map.time}" sort="${map.sort}">&nbsp;
            <label>
              <gen:if test="${param.type == 'radio'}"><input type="radio" name="id" value="${map.id}"><gen:else /><input type="checkbox" name="id" value="${map.id}"></gen:if>
              &nbsp;<span>${gen:dateTime(map.time, 'yyyy-MM-dd', config.timezoneid)}</span>[${map.model.name}]&nbsp;${map.title}
            </label>
          </li>
      	</c:forEach>
      </gen:if>
      <gen:else />
      <li>&nbsp;暂无数据</li>
      </gen:if>
    </ul>
  </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/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">
// document.domain = "jspgen.com";// 调用
$(document).ready(function(){
	// 变量
	var $checkItem = $('input');
	
	<gen:if test="${param.modelId == 'special'}">
	// 专栏
	var $choose = $('a.choose');
	$choose.bind('click', function () {
		var $temp = $(this).parent().find('ul');
		$temp.toggle();
	});
	</gen:if>
	
	// 确定按钮(批量)
	$dialogApi.button({id:'valueOk', name:'确定', callback:ok});
	function ok() {
		var arr = [];
		$checkItem.filter(':checked').each(function(){
			var obj = {}, $li = $(this).closest('li');
			obj.id = $(this).attr('value');
			obj.name = $li.attr('name');
			obj.title = $li.attr('title');
			obj.thumb = $li.attr('thumb');
			obj.url = $li.attr('url');
			obj.time = $li.attr('time');
			obj.sort = $li.attr('sort');
			arr.push(obj);
		});
		$dialogApi.callback(arr);
		//$dialogApi.close();
	}
});
</script>
</body>
</html>
