<#-- 默认收藏夹列表 -->
<!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>
	<base href="${baseURL}">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>收藏夹 - ${title}</title>
	<meta name="keywords" content="${keywords}"/>
	<meta name="description" content="${description}"/>
	<#-- 获取令牌 -->
	<meta name="csrfToken" content="${token}"/>
	<link rel="shortcut icon" type="image/x-icon" href="${baseURL}${commonPath}images/favicon.ico" media="screen" />
	<link href="${commonPath}css/common.css" type="text/css" rel="stylesheet" charset="utf-8">
	<link href="${commonPath}css/themify-icons/style.css" type="text/css" rel="stylesheet">
	<script language="javascript" src="${commonPath}js/tool.js" type="text/javascript"></script>
	<script language="javascript" src="${commonPath}js/ajax.js" type="text/javascript"></script>
	<script language="javascript" src="${commonPath}js/json2.js" type="text/javascript"></script>
	<script language="javascript" src="${commonPath}js/jquery/jquery.min.js" type="text/javascript"></script>
	<link href="${commonPath}js/layer/skin/default/layer.css"  type="text/css" rel="stylesheet"/>
	<script type="text/javascript" src="${commonPath}js/layer/layer.js" language="javascript"></script>
</head>
<script type="text/javascript" language="javascript"> 

//删除收藏夹
function deleteFavorite(favoriteId){
	var parameter = "";//URI参数
	parameter += "&favoriteId="+favoriteId;
	//从meta标签获取令牌
	parameter += "&token="+getCsrf();
	
	if(parameter.indexOf("&") == 0){
		parameter = parameter.substring(1,parameter.length);
	}
	
	post_request(function(value){
		if(value != ""){
			var returnValue = JSON.parse(value);//JSON转为对象
			for(var key in returnValue){
				if(key == "success"){	
					var success = returnValue[key];	
					if(success == "true"){
						layer.msg('删除收藏的话题成功,3秒后刷新页面', 
							{
							  time: 3000 //3秒关闭（如果不配置，默认是3秒）
							},function(){
								//关闭后的操作
					        	document.location.reload();//刷新页面
							}
						);
					}
				}else if(key == "error"){
					var errorValue = returnValue[key];
					var htmlValue = "";
					var i = 0;
					for(var error in errorValue){
						if(error != ""){	
							i++;
							htmlValue += "&nbsp;&nbsp;"+i+"、"+errorValue[error]+"<br>";
						}
					}
					
					layer.open({
					  type: 1,
					  title: '错误', 
					  skin: 'layui-layer-rim', //加上边框
					  area: ['300px', '150px'], //宽高
					  content: htmlValue
					});
					
				}
			}
		}
	},
		getBasePath()+"user/control/deleteFavorite?timestamp=" + new Date().getTime(), true,parameter);	
}
</script>
<body>
<#-- 引入页头 -->
<@include action="${newPublic_2}"/>
<div class="skeleton">
	<div class="main wrap backgroundModule" >
		<#-- 引入服务导航 -->
		<@include action="${newPublic_4}"/>
	
		<div class="dataTable">
			<TABLE class="dataList" width="100%">
				<THEAD>
					<TR class="dataThead">
						<TH width="56%">标题</TH>	
						<TH width="10%">模块</TH>	
						<TH width="20%">收藏时间</TH>	
						<TH width="14%">操作</TH>
					</TR>
				</THEAD>
				<TBODY>
		    		<#if pageView.records?exists && pageView.records?size gt 0 >    
					<#list pageView.records as favorites>
					<TR>
						<TD class="dataTD">
							<#if favorites.module == 10>
								<a href="thread?topicId=${favorites.topicId}" target="_blank" class="link">${favorites.topicTitle}</a>
							<#elseif favorites.module == 20>
								<a href="question?questionId=${favorites.questionId}" target="_blank" class="link">${favorites.questionTitle}</a>
							</#if> 
							
						</TD>
						<TD class="dataTD">
							<#if favorites.module == 10>
								话题
							<#elseif favorites.module == 20>
								问题
							</#if> 
						</TD>
						<TD class="dataTD">
							${favorites.addtime}	
						</TD>
						<TD class="dataTD">
							<a class="operation-button" href="javascript:" onclick="deleteFavorite('${favorites.id}')">
								<span>删除</span>
							</a>
						</TD>
		    		</TR>
		    		</#list>
		    		</#if> 
		    		<#if !pageView.records?exists || pageView.totalrecord == 0 > 
		    			<TR>
							<TD colSpan="4"  class="empty">还没有收藏话题</TD>
		    			</TR>
		    		</#if> 
		    	</TBODY>
			</TABLE>
			<DIV class=pageList>
				<@include action="${newPublic_1}"/>
			</DIV>
		</div>
	
	</div>
</div>
<#--引入页脚-->
<@include action="${newPublic_3}"/>
</body>

</html>
