<%@ page contentType="text/html; charset=GBK" session="false"%>

<%@ taglib uri="/cmsTag" prefix="cms"%>

<!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="X-UA-Compatible" content="IE=EmulateIE7" />
		<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
		<link href="../../style/blue/css/main.css" type="text/css" rel="stylesheet" />
		<link href="../../style/blue/css/reset-min.css" rel="stylesheet" type="text/css" />
		<!--加载 js -->
		<script type="text/javascript" src="../../common/js/jquery-1.7.gzjs"></script>
		<script type="text/javascript" src="../../javascript/commonUtil_src.js"></script>
		<script type="text/javascript" src="../../javascript/dialog/lhgdialog.min.js?skin=iblue"></script>
		<script type="text/javascript" src="../../javascript/page/pagination.js"></script>
		<script language="javascript" type="text/javascript" src="../../javascript/My97DatePicker/WdatePicker.js"></script>

		<script>
			basePath = '<cms:BasePath/>';
			
			var orderFlag = '${param.orderBy}';
		
			var orderBy = '';
			var orderWay = '';
			if(orderFlag != '')
			{
				var temp = orderFlag.split('-');
				orderBy = temp[0];
				orderWay = temp[1];
			}
      	</script>
	</head>
	<body>

		<div class="breadnav">
			<table width="99.9%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td align="left">
						&nbsp;
						<img src="../../style/blue/images/home.gif" width="16" height="16" class="home" />
						当前位置：
						<a href="#">文章管理</a> &raquo;
					</td>
					<td align="right">

					</td>
				</tr>
			</table>
		</div>
		<div style="height:25px;"></div>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td class="mainbody" align="left" valign="top">
					<!--main start-->
					<table class="listtable" width="100%" border="0" cellpadding="0" cellspacing="0">

						<tr>
							<td style="padding: 6px 10px;" class="">
								<div class="fl">
									<a href="javascript:gotoAddArticleContentPage();" class="btnwithico"> <img src="../../../core/style/default/images/doc_add.png" alt="" /><b>添加文章&nbsp;</b> </a>
									<a href="javascript:publishContent();" class="btnwithico"> <img src="../../../core/style/default/images/doc_pub.png" alt="" /><b>发布&nbsp;</b> </a>
									<a href="javascript:moveSomeContent('${param.classId}');" class="btnwithico" onclick=""> <img src="../../../core/style/default/images/doc_move.png" alt="" /><b>移动&nbsp;</b> </a>
									<a href="javascript:" class="btnwithico"> <img src="../../../core/style/default/images/doc_bro.png" alt="" /><b><span id="topActName">固顶</span>&nbsp;</b> </a>
									<a href="javascript:copySomeContent();" class="btnwithico"> <img src="../../../core/style/default/images/doc_copy.png" alt="" /><b>复制&nbsp;</b> </a>
									<a href="javascript:showCommendMutpiContentDialog('${param.classId}','${param.modelId}');" class="btnwithico"> <img src="../../../core/style/default/images/doc_line.png" alt="" /><b>推荐&nbsp;</b> </a>
									<a href="javascript:showCommendMutpiContentDialog('${param.classId}','${param.modelId}');" class="btnwithico"> <img src="../../../core/style/blue/icon/sitemap-application.png" alt="" /><b>共享&nbsp;</b> </a>
									<a href="javascript:;" class="btnwithico" onmousedown='javascript:sortContent();'> <img src="../../../core/style/default/images/sort-number.png" alt="" /><b>排序&nbsp;</b> </a>
									<a href="javascript:;" class="btnwithico" onclick=""> <img src="../../../core/style/default/images/doc_delete.png" alt="" /><b>删除&nbsp;</b> </a>



								</div>
								<div class="fr">
									
								</div>
							</td>
						</tr>
						<tr>
							<td style="padding: 2px 10px;">
								<div class="fl">
									<select id="typeBy" name="typeBy" onchange="javascript:filterAction(this.value);">
										<option value="" selected>
											所有人员
										</option>
										<option value="1">
											我创建的
										</option>
										<option value="1">
											外部投稿
										</option>
									</select>
									&nbsp;
									<select id="typeBy" name="typeBy" onchange="javascript:filterAction(this.value);">
										<option value="" selected>
											所有分类
										</option>
										<cms:SystemContentTypeList>
											<option value="${ContentType.typeFlag}">
												${ContentType.typeName}
											</option>
										</cms:SystemContentTypeList>

									</select>
									&nbsp;
									<select id="censorBy" name="censorBy" onchange="javascript:filterAction(this.value);">
										<option value="-9999" selected>
											所有状态
										</option>
										<option value="1">
											已发布
										</option>
										<option value="0">
											审核中
										</option>
										<option value="2">
											待发布
										</option>
										<option value="3">
											已下线
										</option>
										<option value="4">
											已归档
										</option>
									</select>
									&nbsp;
									<select id="orderBy" name="orderBy" onchange="javascript:filterAction(this.value);">
										<option value="default" selected>
											默认位置
										</option>
										<option value="addDate">
											创建时间
										</option>
										<!-- 以上包含top数据排序,排序位按照本身值 -->
										<option value="click">
											点击数
										</option>
										<option value="comm">
											评论数
										</option>
										<option value="su">
											顶人数
										</option>
										<option value="ag">
											踩人数
										</option>
										<!-- 以上各种评论数据不包含top数据排序,不包含一般数据,排序位按照本身值 -->
										<option value="contentImg">
											内容引图
										</option>
										<option value="homeImg">
											首页引图
										</option>
										<option value="channelImg">
											栏目引图
										</option>
										<option value="classImg">
											列表引图
										</option>
										<!-- 以上各引导图不包含top数据排序,不包含一般数据,排序位按照orderIdFlag -->
										<option value="myself">
											我的文档
										</option>
										<!-- 以上我添加的内容不包含top数据,排序位按照orderIdFlag-->

									</select>
									&nbsp;
									<select id="orderWay" name="orderWay" onchange="javascript:filterAction(this.value);">
										<option value="down" selected>
											降序排列
										</option>
										<option value="up">
											升序排列
										</option>
									</select>
									&nbsp;&nbsp;从
									<input id="appearStartDate" name="appearStartDate" size="14" maxlength="30" type="text" class="form-input-top-date" onmousedown="javascript:WdatePicker({dateFmt:'yyyy-MM-dd'});" value="${param.appearStartDate}" />
									至
									<input id="appearEndDate" name="appearEndDate" size="14" maxlength="30" type="text" class="form-input-top-date" onmousedown="javascript:WdatePicker({dateFmt:'yyyy-MM-dd'});" value="${param.appearEndDate}" />

								</div>

								<div class="fr">
									搜索:
									<select id="site" name="site">
										<option value="-1">
											关键词
										</option>
										<option value="1">
											ID
										</option>
									</select>
									&nbsp;
									<input id="query" name="query" size="20" maxlength="60" />
									<input onclick="" value="搜索" class="btn-1" type="button" />
								</div>

							</td>
						</tr>
						<tr>
							<td id="uid_td25" style="padding: 2px 6px;">
								<div class="DataGrid">
									<cms:SystemManageContentList type="${param.typeBy}" order="${param.orderBy}" censorBy="${param.censorBy}" page="true" pageSize="11" classId="${param.classId}" startDate="${param.appearStartDate}" endDate="${param.appearEndDate}">
										<table class="listdate" width="100%" cellpadding="0" cellspacing="0">

											<tr class="datahead">
												<td width="4%" height="30">
													<strong>ID</strong>
												</td>
												<td width="3%" height="30">
													<input type="checkbox" name="checkbox" value="checkbox" />
												</td>
												<td width="30%">
													<strong>标题</strong>
												</td>

												<td width="3%">
													<strong>状态</strong>
												</td>
												<td width="6%">
													<strong>创建者</strong>
												</td>
												<td width="4%">
													<cms:if test='${param.orderBy=="comm-down" || param.orderBy=="comm-up"}'>
														<strong>评论数</strong>
													</cms:if>
													<cms:elseif test='${param.orderBy=="su-down" || param.orderBy=="su-up"}'>
														<strong>支持数</strong>
													</cms:elseif>
													<cms:elseif test='${param.orderBy=="ag-down" || param.orderBy=="ag-up"}'>
														<strong>反对数</strong>
													</cms:elseif>
													<cms:else>
														<strong>点击</strong>
													</cms:else>
												</td>
												<td width="5%">
													<strong>发布时间</strong>
												</td>
												<td width="15%">
													<strong>操作</strong>
												</td>
											</tr>

											<cms:Content>

												<tr height="20">
													<td>
														${Info.contentId}
													</td>
													<td>
														<input type="checkbox" name="checkContent" value="${Info.contentId}" onclick="javascript:checkTop('${Info.topFlag}');" />
													</td>
													<td>
														<div align="left">
															<cms:if test="${Info.topFlag==1}">
																<input id="top-${Info.contentId}" type="hidden" value="true" />
																<img src="../../../core/style/default/images/top_flag.png" alt="固顶内容" />
															</cms:if>
															<cms:elseif test="${Info.hotFlag==1}">
																<img src="../../../core/style/default/images/hot.png" alt="热点内容" />
															</cms:elseif>
															<cms:elseif test="${Info.commendFlag==1}">
																<img src="../../../core/style/default/images/commend.png" alt="推荐内容" />
															</cms:elseif>
															<cms:else>
																<img src="../../../core/style/default/images/some.png" alt="普通内容" />
															</cms:else>
															<span class="STYLE1"> ${Info.title }</span></a>
															<font color="red"> <cms:if test="${Info.photoArticleType==1}">
																	<span class="STYLE1">&nbsp;[图文]</span>
																</cms:if> <cms:if test="${Info.videoType==1}">
																	<span class="STYLE1">[视频]</span>
																</cms:if> <cms:if test="${Info.attachType==1}">
																	<span class="STYLE1">[附件]</span>
																</cms:if> </font>
														</div>
													</td>


													<td>
														<cms:if test="${Info.censorState==0}">送审</cms:if>
														<cms:elseif test="${Info.censorState==1}">已发</cms:elseif>
														<cms:elseif test="${Info.censorState==-2}">重编</cms:elseif>
														<cms:elseif test="${Info.censorState==2}">待发</cms:elseif>
														<cms:elseif test="${Info.censorState==3}">下线</cms:elseif>

													</td>
													<td>
														${Info.creator}
													</td>
													<td>
														<cms:if test='${param.orderBy=="comm-down" || param.orderBy=="comm-up"}'>
														${Info.commCount}
													</cms:if>
														<cms:elseif test='${param.orderBy=="su-down" || param.orderBy=="su-up"}'>
														${Info.supportCount}
													</cms:elseif>
														<cms:elseif test='${param.orderBy=="ag-down" || param.orderBy=="ag-up"}'>
														${Info.againstCount}
													</cms:elseif>
														<cms:else>
														${Info.clickCount}
													</cms:else>

													</td>
													<td>
														<cms:if test="${Info.appearStartDateTime==''}">
															<br />
															<br />
														</cms:if>
														<cms:else>
															${Info.appearStartDateTime}													
														</cms:else>

													</td>
													<td>
														<div align="center">
															<a href="javascript:openManageCommentDialog('${Info.contentId}','<cms:JsEncode str='${Info.title}'/>');"><img src="../../../core/style/icon/balloon-ellipsis.png" width="16" height="16" />&nbsp;评论</a>&nbsp;
															<a href="EditArticle.jsp?contentId=${Info.contentId}&classId=${Info.classId}&modelId=1"><img src="../../../core/style/icon/document-pencil.png" width="16" height="16" />&nbsp;编辑</a>&nbsp;
															<a href="javascript:deleteContent('${Info.modelId}','${Info.contentId}');"><img src="../images/del.gif" width="16" height="16" />&nbsp;删除</a>
															</span>
														</div>
													</td>

												</tr>

											</cms:Content>

											<tr>
												<td colspan="8" class="PageBar" align="left">
													<div class="fr">
														<span class="text_m"> 共 ${page.totalCount} 条记录 第${page.currentPage}页 / ${page.pageCount}页 <input type="text" size="5" id="pageJumpPos" name="pageJumpPos">
															<input type="button" name="goto" value="GOTO" onclick="javascript:jump()">
														</span>
														<span class="page">[<a href="${page.headQuery}">首页</a>]</span>
														<span class="page">[<a href="${page.prevQuery}">上一页</a>]</span>
														<span class="page">[<a href="${page.nextQuery}">下一页</a>]</span>
														<span class="page">[<a href="${page.endQuery}">末页</a>]</span>&nbsp;
													</div>
													<script>
														function jump()
														{
															window.location="${page.jumpQuery}&currentPage="+document.getElementById('pageJumpPos').value;
														}
													</script>
													<div class="fl"></div>
												</td>
											</tr>

										</table>
									</cms:SystemManageContentList>
								</div>

							</td>
						</tr>

					</table>

				</td>
			</tr>


		</table>

		<from id="publishForm" name="publishForm"> <input type="hidden" id="someContentId" name="someContentId"></input> <input type="hidden" id="staticType" name="staticType" value="2"></input> </from>
		<!--[if lt IE 7]>
        <script type="text/javascript" src="js/unitpngfix.js"></script>
<![endif]-->
	</body>
</html>

<script type="text/javascript">
//alert('${param.orderWay}');


initSelect('typeBy','${param.typeBy}');
initSelect('censorBy','${param.censorBy}');
initSelect('orderBy',orderBy);
initSelect('orderWay',orderWay);

var currentClassId = "${param.classId}";
var currentModelId = 1;


var targetSortId = -1;

var checkedIdMap = new HashMapJs();

function regId(check)
{
   if(check.checked==true)
   {
      targetSortId=check.value;
      checkedIdMap.put(check.value,check.value);
  
   }
   else
   {
      targetSortId = -1;
      checkedIdMap.remove(check.value);
   }
} 

function gotoAddUserDefineContentPage(modelId)
{
	window.location.href="VideoGeneralAdd.jsp?classId=${param.classId}&modelId="+modelId;
}

function gotoAddArticleContentPage()
{
	window.location.href="../../content/article/ArticleGeneralAdd.jsp?classId=${param.classId}";

}


function testDialog()
{

$.dialog({ 
   title :'添加工作流',
    width: '900px', 
    height: '500px', 
     lock: true, 
    
    content: 'url:<cms:Domain/>/core/workflow/CreateWorkFlow.jsp'
	
	
});
}

function sortContent()
{
   if(targetSortId == -1)
   {
     // alert("请选择待排序内容！");
     
        var dialog = $.dialog({ 
   					title :'提示',
    				width: '160px', 
    				height: '60px', 
                    lock: true, 
    				icon: '32X32/i.png', 
    				
                    content: '请选择待排序内容！',
                    
                   
       cancel: true 
                    
	
	//../../../content/deleteUserDefineContent.cmd?contentId=${Info.contentId}&classId=${Info.classId}&&modelId=${Info.modelId}；
	});
      return;
   }
   

   
  
    //document.getElementById('targetId').value=targetSortId;
    //alert( document.getElementById('targetId').value);
   var returnValue = window.showModalDialog("SortContent.jsp"+window.location.search+"&targetId="+targetSortId,targetSortId,"dialogWidth=950px;dialogHeight=500px;status=yes");
   if("ok"==returnValue)
   {
      window.location=window.location.protocol+"//"+window.location.host+window.location.pathname+'?classId='+currentClassId+'&modelId='+currentModelId;
   }
}

//以下为排序筛选操作

function filterAction(filterValue)
{
    var appearStartDate = document.getElementById('appearStartDate').value;
    var appearEndDate = document.getElementById('appearEndDate').value;
    //alert(appearStartDate);
    
    
   
    var censorByVar = document.getElementById('censorBy').value;
    var typeByVar = document.getElementById('typeBy').value;
    var orderByVar = document.getElementById('orderBy').value+'-'+document.getElementById('orderWay').value;
    	
    //alert('ManageArticleContent.jsp?classId='+currentClassId+'&modelId='+currentModelId+'&appearStartDate='+appearStartDate+'&appearEndDate='+appearEndDate+'&censorBy='+censorByVar+'&typeBy='+typeByVar+'&orderBy='+orderByVar);
    window.location='ManageArticleContent.jsp?classId='+currentClassId+'&modelId='+currentModelId+'&appearStartDate='+appearStartDate+'&appearEndDate='+appearEndDate+'&censorBy='+censorByVar+'&typeBy='+typeByVar+'&orderBy='+orderByVar;
	

}



//dialog操作
function deleteContent(modelId,ids)
{
	var dialog = $.dialog({ 
   					title :'提示',
    				width: '160px', 
    				height: '60px', 
                    lock: true, 
    				icon: '32X32/i.png', 
    				
                    content: '您确认删除所选内容吗？',
                    
                    ok: function () { 
                    
                    var url = "../../../content/deleteContent.cmd?ids="+ids+"&modelId="+modelId;
 		
 					//$("#content").val(text);
					//var postData = encodeURI($("#replyText,#configFlag,#gbId").serialize());
 		
			 		$.ajax({
			      		type: "POST",
			       		url: url,
			       		data:'',
			   
			       		success: function(msg)
			            {     
			               if('success' == msg)
			               {
			               		//showMsg('回复留言成功!');
			               		//W.$.dialog.tips('删除内容成功...',1); 
			               		window.location.reload();
			               } 	
			               else
			               {
			               	    W.$.dialog.tips('删除操作失败!...',1);
			               }   
			              
			            }
			     	});	
       
     //window.location='../../../content/deleteUserDefineContent.cmd?contentId='+contentId+'&classId='+classId+'&&modelId='+modelId;
       
    }, 
    cancel: true 
                    
	
	//../../../content/deleteUserDefineContent.cmd?contentId=${Info.contentId}&classId=${Info.classId}&&modelId=${Info.modelId}；
	});
}

function showCommendContentDialog(contentId,classId,modelId,title)
{

	var ti = '';
	if(title != '')
	{
		ti = ''+title.substring(0,22)+'...';
	}
	
	ti = ti.replace('<','&lt;');
	ti = ti.replace('>','&gt;');
	
	$.dialog({ 
		    id : 'occtcd',
	    	title : '' + ti,
	    	width: '450px', 
	    	height: '480px', 
	    	lock: true, 
	        max: false, 
	        min: false,
	        resize: false,
	       
	        content: 'url:'+basePath+'/core/content/dialog/ShowCommendTypeDialog.jsp?uid='+Math.random()+'&classId='+classId+'&contentId='+contentId+'&modelId='+modelId
	
	});

}

function showCommendMutpiContentDialog(classId,modelId)
{
	var cidCheck = document.getElementsByName('checkContent');
	
	var ids='';
	for(var i=0; i<cidCheck.length;i++)
	{
		if(cidCheck[i].checked)
		{
			ids += cidCheck[i].value+',';
		}
	}
	
	if('' == ids)
	{
	   $.dialog({ 
   					title :'提示',
    				width: '160px', 
    				height: '60px', 
                    lock: true, 
    				icon: '32X32/i.png', 
    				
                    content: '请选择需要推荐的内容！', 
       cancel: true 
                    
	
	  });
	  return;
	}
		
	$.dialog({ 
		    id : 'ocmctcd',
	    	title : '推荐内容',
	    	width: '450px', 
	    	height: '480px', 
	    	lock: true, 
	        max: false, 
	        min: false,
	        resize: false,
	       
	        content: 'url:'+basePath+'/core/content/dialog/ShowCommendTypeDialog.jsp?uid='+Math.random()+'&classId='+classId+'&contentId='+ids+'&modelId='+modelId
	
	});

}




function copySomeContent()
{
	var cidCheck = document.getElementsByName('checkContent');
	
	var ids='';
	for(var i=0; i<cidCheck.length;i++)
	{
		if(cidCheck[i].checked)
		{
			ids += cidCheck[i].value+',';
		}
	}
	
	if('' == ids)
	{
	   $.dialog({ 
   					title :'提示',
    				width: '160px', 
    				height: '60px', 
                    lock: true, 
    				icon: '32X32/i.png', 
    				
                    content: '请选择需要复制的内容！', 
       cancel: true 
                    
	
	  });
	  return;
	}


	openCopyContentToSiteClassDialog('manage','1','');
}


function moveSomeContent(classId)
{
	var cidCheck = document.getElementsByName('checkContent');
	
	var ids='';
	for(var i=0; i<cidCheck.length;i++)
	{
		if(cidCheck[i].checked)
		{
			ids += cidCheck[i].value+',';
		}
	}
	
	if('' == ids)
	{
	   $.dialog({ 
   					title :'提示',
    				width: '160px', 
    				height: '60px', 
                    lock: true, 
    				icon: '32X32/i.png', 
    				
                    content: '请选择需要移动的内容！', 
       cancel: true 
                    
	  });
	  return;
	}

	openMoveContentToSiteClassDialog('1',classId);
}

function openManageCommentDialog(contentId, title)
{
	var ti = '';
	
	ti = title.replaceAll('<','&lt;');
	ti = ti.replaceAll('>','&gt;');

	$.dialog({ 
		    id : 'omcd',
	    	title : '评论管理 - '+ti,
	    	width: '750px', 
	    	height: '580px', 
	    	lock: true, 
	        max: false, 
	        min: false,
	        resize: false,
	       
	        content: 'url:'+basePath+'/core/comment/ManageSingleContentComment.jsp?uid='+Math.random()+'&contentId='+contentId
	
	});


}


function checkTop(topFlag)
{
	var cidCheck = document.getElementsByName('checkContent');
	
	var ids='';
	var topCheck;
	var haveTop = false;
	for(var i=0; i<cidCheck.length;i++)
	{
		if(cidCheck[i].checked)
		{
			topCheck = document.getElementById('top-'+cidCheck[i].value);
			if(topCheck != null && 'true' == topCheck.value)
			{
				haveTop = true;
			}
		}
	}
	
	if(haveTop)
	{
		document.getElementById('topActName').innerHTML = '解固';
	}
	else
	{
		document.getElementById('topActName').innerHTML = '固顶';
	}

}



</script>

