<#-- 默认用户动态列表 -->
<!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" >
	<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 type="text/javascript" src="${commonPath}js/jquery/jquery.min.js" language="javascript"></script>
	<script type="text/javascript" src="${commonPath}js/jquery/jquery.letterAvatar.js" language="javascript"></script>
	<script type="text/javascript" src="${commonPath}js/jquery/readmore.min.js" language="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>
	
	<script type="text/javascript" src="${commonPath}js/DPlayer/hls.min.js" language="javascript"></script>
	<script type="text/javascript" src="${commonPath}js/DPlayer/DPlayer.min.js" language="javascript"></script>
	
	<link href="${commonPath}js/prism/default-block/prism.css"  type="text/css" rel="stylesheet"/>
	<script type="text/javascript" src="${commonPath}js/prism/default-block/prism.js" language="javascript"></script>
	<script type="text/javascript" src="${commonPath}js/prism/default-block/clipboard.min.js" language="javascript"></script>
</head>
<script type="text/javascript" language="javascript"> 
	
	
</script>
<body>
<#-- 引入页头 -->
<@include action="${newPublic_2}"/>
<div class="skeleton ">
	<div class="main wrap backgroundModule" >

		<#-- 引入服务导航 -->
		<@include action="${newPublic_4}"/>
		
		
		
		
		<#if pageView.records?exists && pageView.records?size gt 0 > 
		
		<div class="userDynamicModule" >
			<ol class="userDynamicList">
				<#list pageView.records as userDynamic>
					<div class="userDynamic">
						<div class="userDynamic-author">
							<a href="user/control/home?userName=${userDynamic.userName}">
							<#if userDynamic.avatarName != null>
								<img src="${userDynamic.avatarPath}100x100/${userDynamic.avatarName}" >
							<#else>
								<!--[if (IE)]><img src="${commonPath}images/min_avata.png"><![endif]-->
								<!--[if !(IE)]><!--><img avatar="${(userDynamic.nickname != null && userDynamic.nickname??) ?string(userDynamic.nickname , userDynamic.account)}" ><!--<![endif]-->
							</#if> 
							<cite>
								<a class="userName" href="user/control/home?userName=${userDynamic.userName}">
									${(userDynamic.nickname != null && userDynamic.nickname??) ?string(userDynamic.nickname , userDynamic.account)}
								</a>
							</cite> 
						</div>
						<div class="userDynamicTime">${userDynamic.postTime}</div> 
						
						<div class="topicTitle">
							<#if userDynamic.module == 100>
								<span class="info">发表了话题</span>
								<a href="thread?topicId=${userDynamic.topicId}">${userDynamic.topicTitle}</a>
							<#elseif userDynamic.module == 200>
								<span class="info">评论了话题</span>
								<a href="thread?topicId=${userDynamic.topicId}">${userDynamic.topicTitle}</a>
							<#elseif userDynamic.module == 300>
								<span class="info">引用了话题</span>
								<a href="thread?topicId=${userDynamic.topicId}">${userDynamic.topicTitle}</a>
							<#elseif userDynamic.module == 400>
								<span class="info">回复了话题</span>
								<a href="thread?topicId=${userDynamic.topicId}">${userDynamic.topicTitle}</a>
							<#elseif userDynamic.module == 500>
								<span class="info">提交了问题</span>
								<a href="question?questionId=${userDynamic.questionId}">${userDynamic.questionTitle}</a>
							<#elseif userDynamic.module == 600>
								<span class="info">回答了问题</span>
								<a href="question?questionId=${userDynamic.questionId}">${userDynamic.questionTitle}</a>
							<#elseif userDynamic.module == 700>
								<span class="info">回复了问题</span>
								<a href="question?questionId=${userDynamic.questionId}">${userDynamic.questionTitle}</a>
							</#if> 
							
							<#list userDynamic.allowRoleViewList as roleName>
								<i class="topicRoleName">${roleName}</i>
								
							</#list>
						</div>
						
						<#if userDynamic.module == 100>
							<!-- topicId属性用来支持JS获取隐藏内容 -->
							<div class="topicContent" topicId="${userDynamic.topicId}" ><#noescape>${userDynamic.topicContent}</#noescape></div>
						</#if> 
						<#if userDynamic.module == 200>
							<div class="topicContent" ><#noescape>${userDynamic.commentContent}</#noescape></div>
						</#if> 
						<#if userDynamic.module == 300>
							<div id="quoteModuleContent" >
								<div class="commentContent" ><#noescape>${userDynamic.commentContent}</#noescape></div>
	                        	<div class="quoteContent">
	                                <div class="text" >
	                                    ${userDynamic.quoteCommentContent}
	                                </div>
	                            </div>
							</div>
						</#if> 
						<#if userDynamic.module == 400>
							<div class="replyContent" >${userDynamic.replyContent}</div>
						</#if> 
						<#if userDynamic.module == 500>
							<div class="topicContent" ><#noescape>${userDynamic.questionContent}</#noescape></div>
						</#if> 
						<#if userDynamic.module == 600>
							<div class="topicContent" ><#noescape>${userDynamic.answerContent}</#noescape></div>
						</#if> 
						<#if userDynamic.module == 700>
							<div class="replyContent" >${userDynamic.answerReplyContent}</div>
						</#if> 
						
						<div class="clearfix"></div>
						<div class="tipBottom">
							<span class="a-toolbar">
								<#if userDynamic.module == 100>
									<a href="thread?topicId=${userDynamic.topicId}" target="_blank" >查看原文</a>
									<a href="user/editTopic?topicId=${userDynamic.topicId}" target="_blank" >编辑</a>
									<span >${userDynamic.topicViewTotal}次阅读</span>
									<span >${userDynamic.topicCommentTotal}个评论</span>
									<span id="favoriteCount_${userDynamic.topicId}">0人收藏</span>
									<span id="likeCount_${userDynamic.topicId}">0人赞</span>
									<script type="text/javascript">
										//查询话题用户收藏总数
										function queryFavoriteCount(){	
											//获取话题Id
											var topicId = ${userDynamic.topicId};
											get_request(function(value){
												if(value != ""){
													var data = JSON.parse(value);
										        	document.getElementById("favoriteCount_"+topicId).innerHTML = data+"人收藏";
										        }
											},
												"queryFavoriteCount?topicId="+topicId+"&timestamp=" + new Date().getTime(), true);
															           
										}
										queryFavoriteCount();
										
										//查询话题用户点赞总数
										function queryLikeCount(){	
											//获取话题Id
											var topicId = ${userDynamic.topicId};
											get_request(function(value){
												if(value != ""){
													var data = JSON.parse(value);
										        	document.getElementById("likeCount_"+topicId).innerHTML = data+"人赞";
										        }
											},
												"queryLikeCount?topicId="+topicId+"&timestamp=" + new Date().getTime(), true);
															           
										}
										queryLikeCount();
									</script>
								<#elseif userDynamic.module == 200>
									<a href="thread?topicId=${userDynamic.topicId}&commentId=${userDynamic.commentId}"  target="_blank" >查看原文</a>
								<#elseif userDynamic.module == 300>
									<a href="thread?topicId=${userDynamic.topicId}&commentId=${userDynamic.commentId}"  target="_blank" >查看原文</a>
								<#elseif userDynamic.module == 400>
									<a href="thread?topicId=${userDynamic.topicId}&commentId=${userDynamic.commentId}"  target="_blank" >查看原文</a>
								<#elseif userDynamic.module == 500>
									<a href="question?questionId=${userDynamic.questionId}"" target="_blank" >查看原文</a>
									<span >${userDynamic.questionViewTotal}次阅读</span>
									<span >${userDynamic.questionAnswerTotal}个回答</span>
									<span id="questionFavoriteCount_${userDynamic.questionId}">0人收藏</span>
									
									<script type="text/javascript">				
										//查询问题用户收藏总数
										function queryQuestionFavoriteCount(){	
											//从URL获取问题Id
											var questionId = ${userDynamic.questionId};
											get_request(function(value){
												if(value != ""){
													var data = JSON.parse(value);
													document.getElementById("questionFavoriteCount_"+questionId).innerHTML = data+"人收藏";
										        }
											},
												"queryQuestionFavoriteCount?questionId="+questionId+"&timestamp=" + new Date().getTime(), true);
															           
										}
										queryQuestionFavoriteCount();	
									</script>	
								<#elseif userDynamic.module == 600>
									<a href="question?questionId=${userDynamic.questionId}&answerId=${userDynamic.answerId}" target="_blank" >查看原文</a>
								<#elseif userDynamic.module == 700>
									<a href="question?questionId=${userDynamic.questionId}&answerId=${userDynamic.answerId}" target="_blank" >查看原文</a>
								</#if> 
								
							
								
							</span>
						</div>
					</div>
				</#list>
			</ol>
		</div>
		<div style="background: red;"></div>
		</#if>	
		<div class="userDynamicPage">
		   	<#-- 分页 公共页(生成新引用页)-->
			<@include action="${newPublic_1}"/>
		</div>
	
	
		<#-- 引入话题取消隐藏 -->
		<@include action="${topicRelated_topicUnhide_2}"/>
	
	
		<script type="text/javascript">
		$(document).ready(function () {
			//隐藏高度超过100px的内容
			$('.topicContent,#quoteModuleContent').readmore({
				speed: 100,//速度
				collapsedHeight: 200,//默认高度
				moreLink: '<a href="" class="readMore">展开阅读</a>',
				lessLink: '<a href="" class="readMore">收起</a>',
				afterToggle: function(trigger, element, expanded) {
					if(expanded){//收缩
						element.next().addClass('shrinkMore');
						element.next().removeClass('readMore');
					}else{//展开
						element.next().addClass('readMore');
						element.next().removeClass('shrinkMore');
					}
				}
			});
			
			
		});
		</script>
		
		
		
		<script type="text/javascript">
			// 获取随机数
			function getRandom(m) {
				//生成的随机数截取m位，生成的随机数最大不超过13位，能保证首位不为0
			    m = m > 13 ? 13 : m;
			   	var num = Math.random().toString();
			   	if(num.substr(num.length - m, 1) === '0') {           
			   		return getRandom(m);
			   	}
				return num.substring(num.length - m);
			}
			
			//设置播放器标签
			function setPlayerTag(){
				//获取<player>标签属性
				$(".topicContent").find("player").each(function(){
					var random = getRandom(13);
					var id = "player_"+random;
					var url = $(this).attr("url");
					var cover = $(this).attr("cover");//封面
					var thumbnail = $(this).attr("thumbnail");//缩略图
					//设置Id
					$(this).attr("id",id);
					
					if(cover != undefined && cover != ""){
						var node = '<img class="cover" src="'+cover+'"/><span class="buttonCircle"><span class="iconBox"><i class="cms-control-play playIcon"></i></span></span>';
					
						$(this).append(node);
					}else{
						var node = '<span class="buttonCircle"><span class="iconBox"><i class="cms-control-play playIcon"></i></span></span>';
					
						$(this).append(node);
					}			
					
					
					
					
					$(this).click(function(){
						$(this).unbind('click');//解绑事件
						
						if(url == ""){//如果视频处理中
							var dp = new DPlayer({
				         		container: document.getElementById(id),//播放器容器元素
				         		screenshot: false,//开启截图，如果开启，视频和视频封面需要开启跨域
				         		video: {
				         			    
				         		}
				         	});
							insertProcess(id);
						}else{
							if(cover != undefined && cover != "" && thumbnail != undefined && thumbnail != ""){//切片视频
								var dp = new DPlayer({
									container: document.getElementById(id),//播放器容器元素
									screenshot: false,//开启截图，如果开启，视频和视频封面需要开启跨域
									hotkey: true,
									preload: 'none', //禁止视频预加载
									video: {
									    url: url,
									    type: 'hls',
									    pic: cover,//视频封面
									    thumbnails: thumbnail//视频预览图
									}
								});
								dp.play();//播放视频
							
							}else{
								var dp = new DPlayer({
			            			container: document.getElementById(id),//播放器容器元素
			            			screenshot: false,//开启截图，如果开启，视频和视频封面需要开启跨域
			            			
			            			video: {
			            			    url: url
			            			}
			            		});
			            		dp.play();//播放视频
							}
						}
					});
				})
			}
			//插入处理提示层
			function insertProcess(id){
				$("#"+id).prepend("<div class='dplayer-process'><div class='box'><div class='prompt'>视频处理中，请稍后再刷新</div></div></div>");
			}
			$(document).ready(function(){
				setPlayerTag();
			});
		</script>
		
		<!-- 代码高亮显示 -->
		<script type="text/javascript">
			//代码语言类
			function languageClassName(originalClass, newClass) {
				var o = new Object()
				o.originalClass = originalClass;//原始样式标签名称
				o.newClass = newClass;//新样式标签名称
				return o;
			}
		
			$(document).ready(function(){
			    //代码语言映射集合
			    var languageMapping_arr = new Array();
				var languageClassName_xml = languageClassName("lang-xml","language-xml");
			    languageMapping_arr.push(languageClassName_xml);
			    var languageClassName_css = languageClassName("lang-css","language-css");
			    languageMapping_arr.push(languageClassName_css);
			    var languageClassName_html = languageClassName("lang-html","language-html");
			    languageMapping_arr.push(languageClassName_html);
			    var languageClassName_js = languageClassName("lang-js","language-JavaScript");
			    languageMapping_arr.push(languageClassName_js);
			    var languageClassName_java = languageClassName("lang-java","language-java");
			    languageMapping_arr.push(languageClassName_java);
			    var languageClassName_pl = languageClassName("lang-pl","language-perl");
			    languageMapping_arr.push(languageClassName_pl);
			    var languageClassName_py = languageClassName("lang-py","language-python");
			    languageMapping_arr.push(languageClassName_py);
			    var languageClassName_rb = languageClassName("lang-rb","language-ruby");
			    languageMapping_arr.push(languageClassName_rb);
			    var languageClassName_go = languageClassName("lang-go","language-Go");
			    languageMapping_arr.push(languageClassName_go);  
			    var languageClassName_cpp = languageClassName("lang-cpp","language-C++");
			    languageMapping_arr.push(languageClassName_cpp);  
			    var languageClassName_cs = languageClassName("lang-cs","language-C#");
			    languageMapping_arr.push(languageClassName_cs);  
			    var languageClassName_bsh = languageClassName("lang-bsh","language-Bash + Shell");
			    languageMapping_arr.push(languageClassName_bsh);  
			      
			    
			    var doc_pre = $(".topicContent").find('pre[class^="prettyprint"]');
			    doc_pre.each(function(){
			        var class_val = $(this).attr('class');
			      	var lan_class = "";
			        var class_arr = new Array();
			        class_arr = class_val.split(' ');
			        for(var i=0; i<class_arr.length; i++){
			        	var className = $.trim(class_arr[i]);
			        	
			        	if(className != null && className != ""){
			        		if (className.lastIndexOf('lang-', 0) === 0) {
			        			lan_class = className;
					            break;
					        }
			        	}	
			        }
			        
			        for(var i=0; i<languageMapping_arr.length; i++){
				    	var languageMapping = languageMapping_arr[i];
				    	if(languageMapping.originalClass == lan_class){
					    //	var pre_content = '<code>'+$(this).html()+'</code>';
					        $(this).html($(this).html());
					        $(this).attr("class",'line-numbers '+languageMapping.newClass);
				    	}
				    }
				    if(lan_class == ""){
				    //	var pre_content = '<code>'+$(this).html()+'</code>';
					    $(this).html($(this).html());
					    $(this).attr("class",'line-numbers language-markup');
				    }
			    });
			});
		</script>
	</div>
</div>
<#--引入页脚-->
<@include action="${newPublic_3}"/>
</body>

</html>
