<%@ 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.min.js"></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 language="javascript" type="text/javascript" src="../javascript/My97DatePicker/WdatePicker.js"></script>

		<style>
		/**增加title类型a，改变文字颜色**/
		.title-a {
			text-decoration:none;
			color:#454545;
		}
		
		.title-a:hover {
			text-decoration:none; color:#999;
		}
		
		</style>
		<script>
			basePath = '<cms:BasePath/>';
			
			var orderFlag = '${param.orderBy}';
		
			var orderBy = '';
			var orderWay = '';
			if(orderFlag != '')
			{
				var temp = orderFlag.split('-');
				orderBy = temp[0];
				orderWay = temp[1];
			}
			
			//表格变色
			$(function()
			{ 
		   		$("#showlist tr[id!='pageBarTr']").hover(function() 
		   		{ 
					$(this).addClass("tdbgyew"); 
				}, 
				function() 
				{ 
					$(this).removeClass("tdbgyew"); 
				}); 
			});  
			
      	</script>
	</head>
	<body>
		<cms:SysClass id="${param.classId}">
			<cms:SystemDataModel id='${Class.contentType}'>

				<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;
								<a href="#">栏目内容管理</a> &raquo;
								<a href="#">${Class.className}</a>
							</td>
							<td align="right">

							</td>
						</tr>
					</table>
				</div>
				<div style="height:25px;"></div>
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="mainbody-x">
					<tr>
						<td class="mainbody" align="left" valign="top">
							<!--main start-->
							<table class="listtable" width="99.8%" border="0" cellpadding="0" cellspacing="0">
								<tr>
									<td style="padding: 6px 10px;" class="">
										<div class="fl">
											<a href="javascript:gotoAddUserDefineContentPage();" class="btnwithico"> <img src="../../core/style/default/images/doc_add.png" alt="" /><b>添加${DataModel.modelName}内容&nbsp;</b> </a>
											<a href="javascript:publishContent('${Class.contentProduceType}');" class="btnwithico"> <img src="../../core/style/default/images/doc_pub.png" alt="" /><b>发布&nbsp;</b> </a>
											
											<%--<cms:SystemUiRole flag="copy_content_cmd" accId="${param.classId}">
												<a href="javascript:copySomeContent();" class="btnwithico"> <img src="../../core/style/default/images/doc_copy.png" alt="" /><b>复制&nbsp;</b> </a>
											</cms:SystemUiRole>
											--%><a href="javascript:copySomeContent();" class="btnwithico"> <img src="../../core/style/default/images/doc_copy.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:showCommendMutpiContentDialog('${param.classId}','${Class.contentType}');" class="btnwithico"> <img src="../../core/style/default/images/flag-blue.png" alt="" /><b>推荐&nbsp;</b> </a>
											<a href="javascript:shareContent();" class="btnwithico"> <img src="../../core/style/blue/icon/sitemap-application.png" alt="" /><b>共享&nbsp;</b> </a>
											<a href="javascript:setTopFlag();" class="btnwithico"> <img src="../../core/style/default/images/doc_bro.png" alt="" /><b><span id="topActName">固顶</span>&nbsp;</b> </a>
											<a href="javascript:addTagForSomeContent();" class="btnwithico"> <img src="../../core/style/icons/tags-label.png" alt="" /><b><span id="topActName">标签</span>&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:deleteAllContent();" class="btnwithico"> <img src="../../core/style/default/images/doc_delete.png" alt="" /><b>全删&nbsp;</b> </a>
											<a href="javascript:deleteSelectContent();" class="btnwithico"> <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>
												<cms:SystemContentTypeList>
													<option value="${ContentType.typeFlag}">
														${ContentType.typeName}
													</option>
												</cms:SystemContentTypeList>
											</select>
											&nbsp;
											<select id="createBy" name="createBy" onchange="javascript:filterAction(this.value);">
												<option value="0" selected>
													所有人员
												</option>
												<option value="1">
													我创建的
												</option>
												<option value="2">
													外部投稿
												</option>
										
											</select>
											&nbsp;
											<select id="censorBy" name="censorBy" onchange="javascript:filterAction(this.value);">
												<option value="-9999" selected>
													所有状态
												</option>												
												<option value="-1">
													新稿件
												</option>
												<option value="-4">
													已采集
												</option>
												<option value="-2">
													预发布
												</option>
												<option value="0">
													审核中
												</option>
												<option value="2">
													待发布
												</option>
												<option value="1">
													已发布
												</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>
												<option value="pubDate">
													发布时间
												</option>
												<!-- 以上包含top数据排序,排序位按照本身值 -->
												<option value="click">
													总点击
												</option>
												<option value="dayClick">
													日点击
												</option>
												<option value="weekClick">
													周点击
												</option>
												<option value="monthClick">
													月点击
												</option>

												<option value="comm">
													总评论
												</option>
												<option value="dayComm">
													日评论
												</option>
												<option value="weekComm">
													周评论
												</option>
												<option value="monthComm">
													月评论
												</option>

												<option value="su">
													顶人数
												</option>
												<option value="ag">
													踩人数
												</option>
												<!-- 以上各种 评论 数据不包含top数据排序,不包含一般数据,排序位按照本身值 -->

												<%--<option value="myself">
													我的文档
												</option>
												--%>
												<!-- 以上 我添加的 内容不包含top数据,排序位按照orderIdFlag-->

											</select>

											&nbsp;
											<select id="filterBy" name="filterBy" onchange="javascript:filterAction(this.value);">
												<option value="default" selected>
													所有内容
												</option>
												<option value="contentImg">
													含内容图
												</option>
												<option value="classImg">
													含列表图
												</option>
												<option value="channelImg">
													含栏目图
												</option>
												<option value="homeImg">
													含首页图
												</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;
											<input id="filterStartDate" size="14" maxlength="30" type="text" class="form-input-top-date" onclick="javascript:WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd'});" value="${param.filterStartDate}" />
											至
											<input id="filterEndDate" size="14" maxlength="30" type="text" class="form-input-top-date" onclick="javascript:WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd'});" value="${param.filterEndDate}" />
										</div>
										
										<input id="ofilterStartDate" type="hidden" />
										
										<div class="fr">
											<input id="searchKey" name="searchKey" size="22" maxlength="60" class="form-input" style="vertical-align:top;" />
											<input onclick="javascript:search();" value="查询" class="btn-1" type="button" style="vertical-align:top;" />
										</div>

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

													<tr class="datahead">
														<td width="4%" height="30">
															<strong>ID</strong>
														</td>
														<td width="2%" height="30">
															<input type="checkbox" name="checkbox" value="checkbox" onclick="javascript:selectAll('checkContent',this);" />
														</td>
														<td width="28%">
															<strong>标题</strong>
														</td>

														<td width="4%">
															<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=="dayComm-down" || param.orderBy=="dayComm-up"}'>
																<strong>日评论</strong>
															</cms:elseif>
															<cms:elseif test='${param.orderBy=="weekComm-down" || param.orderBy=="weekComm-up"}'>
																<strong>周评论</strong>
															</cms:elseif>
															<cms:elseif test='${param.orderBy=="monthComm-down" || param.orderBy=="monthComm-up"}'>
																<strong>月评论</strong>
															</cms:elseif>
															<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:elseif test='${param.orderBy=="dayClick-down" || param.orderBy=="dayClick-up"}'>
																<strong>日点击</strong>
															</cms:elseif>
															<cms:elseif test='${param.orderBy=="weekClick-down" || param.orderBy=="weekClick-up"}'>
																<strong>周点击</strong>
															</cms:elseif>
															<cms:elseif test='${param.orderBy=="monthClick-down" || param.orderBy=="monthClick-up"}'>
																<strong>月点击</strong>
															</cms:elseif>
															<cms:else>
																<strong>总点击</strong>
															</cms:else>
														</td>
														
														<td width="5%">
															<cms:if test='${param.orderBy=="addDate-down" || param.orderBy=="addDate-up"}'>
																<strong>添加时间</strong>
															</cms:if>
															<cms:else>
																<strong>发布时间</strong>
															</cms:else>
														</td>
														<td width="14%">
															<center><strong>操作</strong></center>
														</td>
													</tr>

													<cms:SystemContent>

														<tr id="tr-${status.index}">
															<td>
																${Info.contentId}
															</td>
															<td>
																<input type="checkbox" name="checkContent" value="${Info.contentId}" onclick="javascript:regId('${Info.topFlag}', this, '${status.index}');" />
															</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/fire-small.png" alt="热点内容" />
																	</cms:elseif>
																	<cms:elseif test="${Info.commendFlag==1}">
																		<img src="../../core/style/default/images/hot.png" alt="推荐内容" />
																	</cms:elseif>
																	<cms:else>
																		<img src="../../core/style/default/images/some.png" alt="普通内容" />
																	</cms:else>
																	<span class="STYLE1"> <a class="title-a" target="_blank" href="<cms:SystemPreview mode="content" />">${Info.title}</a> </span></a>
																</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>
																<cms:elseif test="${Info.censorState==-1}">稿件</cms:elseif>
																<cms:elseif test="${Info.censorState==-4}">采集</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=="dayComm-down" || param.orderBy=="dayComm-up"}'>
																${Info.commDayCount}
															</cms:elseif>
																<cms:elseif test='${param.orderBy=="weekComm-down" || param.orderBy=="weekComm-up"}'>
																${Info.commWeekCount}
															</cms:elseif>
																<cms:elseif test='${param.orderBy=="monthComm-down" || param.orderBy=="monthComm-up"}'>
																${Info.commMonthCount}
														</cms:elseif>
																<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:elseif test='${param.orderBy=="dayClick-down" || param.orderBy=="dayClick-up"}'>
																${Info.clickDayCount}
															</cms:elseif>
																<cms:elseif test='${param.orderBy=="weekClick-down" || param.orderBy=="weekClick-up"}'>
																${Info.clickWeekCount}
															</cms:elseif>
																<cms:elseif test='${param.orderBy=="monthClick-down" || param.orderBy=="monthClick-up"}'>
																	${Info.clickMonthCount}
																</cms:elseif>
																<cms:else>
														${Info.clickCount}
													</cms:else>

															</td>
															
															<td>
																<cms:if test='${param.orderBy=="addDate-down" || param.orderBy=="addDate-up"}'>
																${Info.addTime}
															</cms:if>
																<cms:else>
																	<cms:if test="${Info.appearStartDateTime==''}">
																		<br />
																		<br />
																	</cms:if>
																	<cms:else>
															    ${Info.appearStartDateTime}
															</cms:else>

																</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="javascript:gotoEditUserDefineContentPage('${Info.contentId}','${Info.creator}','${Info.censorState}');"><img src="../../core/style/icon/document-pencil.png" width="16" height="16" />&nbsp;编辑</a>&nbsp;
																	<a href="javascript:deleteContent('${Info.modelId}','${Info.contentId}','${Info.creator}','${Info.censorState}');"><img src="../../core/style/icon/del.gif" width="16" height="16" />&nbsp;删除</a>
																	</span>
																</div>
															</td>

														</tr>

													</cms:SystemContent>

													<cms:Empty flag="Info">
														<tr>
															<td class="tdbgyew" colspan="9">
																<center>
																	当前没有数据!
																</center>
															</td>
														</tr>
													</cms:Empty>

													<cms:if test="${empty param.key}">
														<tr id="pageBarTr">
															<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>
													</cms:if>
													<cms:else>
														<cms:PageInfo>
															<tr id="pageBarTr">
																<td colspan="8" class="PageBar" align="left">
																	<div class="fr">
																		<span class="text_m"> 共 ${Page.totalCount} 条记录 第${Page.currentPage}页 / ${Page.pageCount}页 <input type="text" size="4" id="pageJumpPos" name="pageJumpPos" /> <input type="button" name="goto" value="GOTO" onclick="javascript:jump()" /> </span>
																		<span class="page">[<a href="javascript:query('h');">首页</a>]</span>
																		<span class="page">[<a href="javascript:query('p');">上一页</a>]</span>
																		<span class="page">[<a href="javascript:query('n');">下一页</a>]</span>
																		<span class="page">[<a href="javascript:query('l');">末页</a>]</span>&nbsp;
																	</div>
																	<script>
																function query(flag)
																{
																	var cp = 0;
																	
																	if('p' == flag)
																	{
			                                                             cp = parseInt('${Page.currentPage-1}');
																	}
		
																	if('n' == flag)
																	{
			                                                             cp = parseInt('${Page.currentPage+1}');
																	}
		
																	if('h' == flag)
																	{
			                                                             cp = 1;
																	}
		
																	if('l' == flag)
																	{
			                                                             cp = parseInt('${Page.pageCount}');
																	}
		
																	if(cp < 1)
																	{
			                                                           cp=1;
																	}
																	
																	if(cp > parseInt('${Page.pageCount}'))
																	{
			                                                           cp=parseInt('${Page.pageCount}');
																	}
																
																	
																	replaceUrlParam(window.location,'currentPage='+cp);		
																}
													
													
																function jump()
																{
																    var cp = parseInt(document.getElementById('pageJumpPos').value);
																    
																    if(cp > parseInt('${Page.pageCount}'))
																	{
			                                                           cp=parseInt('${Page.pageCount}');
																	}
																
																	replaceUrlParam(window.location,'currentPage='+cp);
																}
															</script>
																	<div class="fl"></div>
																</td>
															</tr>
														</cms:PageInfo>
													</cms:else>

												</table>

											</cms:SystemManageContentList>
										</div>

									</td>
								</tr>

							</table>
						<div class="mainbody-right"></div>
						</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('createBy','${param.createBy}');
initSelect('typeBy','${param.typeBy}');
initSelect('censorBy','${param.censorBy}');
initSelect('filterBy','${param.filterBy}');
initSelect('orderBy',orderBy);
initSelect('orderWay',orderWay);

document.getElementById('searchKey').value=decodeURI('${param.key}');

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

var top = '';



var targetSortId = -1;

var checkedIdMap = new HashMapJs();



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

function gotoEditUserDefineContentPage(contentId, creator, censor)
{
	<cms:LoginUser>
		var currentManager = '${Auth.apellation}';
	</cms:LoginUser>
	
	if(censor == '-1' && creator != currentManager)
	{
		var dialog = $.dialog({ 
   					title :'提示',
    				width: '160px', 
    				height: '60px', 
                    lock: true, 
    				icon: '32X32/i.png', 
    				
                    content: '只能处理自己的稿件！',
                                      
       cancel: true 
                    
	   });
       return;
	}


	window.location.href="EditUserDefineModelContent.jsp?contentId="+contentId+"&classId=${param.classId}&modelId=${Class.contentType}&uid="+Math.random();
}





function sortContent()
{
   if(targetSortId == -1)
   {
 
     
        var dialog = $.dialog({ 
   					title :'提示',
    				width: '160px', 
    				height: '60px', 
                    lock: true, 
    				icon: '32X32/i.png', 
    				
                    content: '请选择待排序内容！',
                    
                   
        cancel: true 
                    
	
		});
        return;
   }
   
   
   $.dialog({ 
		    id : 'ocsd',
	    	title : '内容排序',
	    	width: '850px', 
	    	height: '540px', 
	    	lock: true, 
	        max: false, 
	        min: false,
	        resize: false,
	       
	        content: 'url:<cms:BasePath/>core/content/dialog/SortContent.jsp?uid='+Math.random()+'&classId=${param.classId}&targetId='+targetSortId
	
	});
   
  
   
}

//以下为排序筛选操作

function filterAction(filterValue)
{
    var filterStartDate = document.getElementById('filterStartDate').value;
    var filterEndDate = document.getElementById('filterEndDate').value;
    
    var createByVar = document.getElementById('createBy').value;
    var censorByVar = document.getElementById('censorBy').value;
    var typeByVar = document.getElementById('typeBy').value;
    var orderByVar = document.getElementById('orderBy').value+'-'+document.getElementById('orderWay').value;
    var filterByVar = document.getElementById('filterBy').value;
    
    
    if(filterStartDate != '' || filterEndDate != '')
    {
    	//若时间范围不为空,强制为按照添加时间排序
    	orderByVar = 'addDate-'+document.getElementById('orderWay').value;
    }
    else if('pubDate' == document.getElementById('orderBy').value)
    {
    	//若为发布时间,则强制状态为已发布内容筛选
    	censorByVar = '1';
    }
    
    //alert('ManageArticleContent.jsp?classId='+currentClassId+'&modelId='+currentModelId+'&appearStartDate='+appearStartDate+'&appearEndDate='+appearEndDate+'&censorBy='+censorByVar+'&typeBy='+typeByVar+'&orderBy='+orderByVar);
    window.location='ManageGeneralContent.jsp?classId='+currentClassId+'&modelId='+currentModelId+'&filterStartDate='+filterStartDate+'&filterEndDate='+filterEndDate+'&createBy='+createByVar+'&censorBy='+censorByVar+'&typeBy='+typeByVar+'&orderBy='+orderByVar+'&filterBy='+filterByVar;
	

}

function deleteSelectContent()
{
	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;
	}
	
	deleteContent('${Class.contentType}',ids);
}

function deleteAllContent()
{
	$.dialog({ 
   					title :'提示',
    				width: '200px', 
    				height: '60px', 
                    lock: true, 
    				icon: '32X32/i.png', 
    				
                    content: '您确认删除栏目所有内容吗？',
                    
                    ok: function () 
                    { 
                    var tip = $.dialog.tips('正在删除全栏目内容到回收站,请耐心等待...',3600000000,'loading.gif'); 
                   
                    //var url = "<cms:BasePath/>content/deleteContent.cmd?flag=allContent&modelId="+modelId;
                    var url = "<cms:BasePath/>content/deleteContentToTrash.cmd?flag=allContent&modelId=${param.modelId}&classId=${param.classId}";
                    
 		
 					//$("#content").val(text);
					//var postData = encodeURI($("#replyText,#configFlag,#gbId").serialize());
 		
			 		$.ajax({
			      		type: "POST",
			       		url: url,
			       		data:'',
			   
			       		success: function(msg)
			            {     
			               if('success' == msg || '' == msg)
			               {
			               		 
			               		window.location.reload();
			               } 	
			               else
			               {
			               		tip.close();
			               	    $.dialog(
							   { 
								   					title :'提示',
								    				width: '200px', 
								    				height: '60px', 
								                    lock: true, 
								                     
								    				icon: '32X32/fail.png', 
								    				
								                    content: "执行失败，无权限请联系管理员！",
						
								    				cancel: true
								});
			               }   
			              
			            }
			     	});	
       
       
    				}, 
    				cancel: true
    				
   	});


}

//dialog操作
function deleteContent(modelId,ids, creator, censor)
{ 
	 


	var dialog = $.dialog({ 
   					title :'提示',
    				width: '160px', 
    				height: '60px', 
                    lock: true, 
    				icon: '32X32/i.png', 
    				
                    content: '您确认删除所选内容吗？(不包含审核中内容)',
                    
                    ok: function () 
                    { 
                   	 $.dialog.tips('正在执行删除...',3600000000,'loading.gif');
                    //var url = "<cms:BasePath/>content/deleteContent.cmd?ids="+ids+"&modelId="+modelId;
                    var url = "<cms:BasePath/>content/deleteContentToTrash.cmd?classId=${param.classId}&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 || '' == msg)
			               {
			               		 
			               		window.location.reload();
			               } 	
			               else
			               {
			               	    $.dialog(
							   { 
								   					title :'提示',
								    				width: '200px', 
								    				height: '60px', 
								                    lock: true, 
								                     
								    				icon: '32X32/fail.png', 
								    				
								                    content: "执行失败，无权限请联系管理员！",
						
								    				cancel: true
								});
			               }   
			              
			            }
			     	});	
       
       
    				}, 
    				cancel: true
    				
   	});
}

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: '650px', 
	    	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 top = false;
	
	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: '700px', 
	    	height: '485px', 
	    	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','${Class.contentType}','');
}

function shareContent()
{
	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;
	}


    openSelectSiteGroupDialog(ids,'manage');
}


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('${Class.contentType}',classId);
}

function setTopFlag()
{
	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;
	}
	
	 var url = "<cms:BasePath/>content/setTopFlag.cmd?classId=${param.classId}&ids="+ids+'&top='+top;
                    

 		
	$.ajax({
			   type: "POST",
			   url: url,
			   data:'',
			   
			   success: function(msg)
			   {     
			               if('success' == msg)
			               {

			               		window.location.reload();
			               } 	
			               else
			               {
			               	    $.dialog(
							   { 
								   					title :'提示',
								    				width: '200px', 
								    				height: '60px', 
								                    lock: true, 
								                     
								    				icon: '32X32/fail.png', 
								    				
								                    content: "执行失败，无权限请联系管理员！",
						
								    				cancel: true
								});
			               }   
			              
			            }
			     	});	

}

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

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

}


function regId(topFlag, obj, index)
{
	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)
	{
		top = 'down';
		document.getElementById('topActName').innerHTML = '解固';
	}
	else
	{
		top = 'up';
		document.getElementById('topActName').innerHTML = '固顶';
	}
	
	//背景色

	if(obj.checked == true)
	{
		$('#tr-'+index).addClass("tdbgyewck"); 
	}
	else
	{
		$('#tr-'+index).removeClass("tdbgyewck"); 
	}
	
	//排序
	if(obj.checked==true)
    {
      targetSortId=obj.value;
      checkedIdMap.put(obj.value,obj.value);
  
    }
    else
    {
      targetSortId = -1;
      checkedIdMap.remove(obj.value);
    }

}

function search()
{
	var key = encodeURI(encodeURI(document.getElementById('searchKey').value));
	
	window.location='ManageGeneralContent.jsp?classId=${param.classId}&key='+key;
}

function addTagForSomeContent()
{
	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: '200px', 
    				height: '60px', 
                    lock: true, 
    				icon: '32X32/i.png', 
    				
                    content: '请选择需要添加Tag的内容！', 
       cancel: true 
                    
	  });
	  return;
	}

	$.dialog({ 
		    id : 'ostd',
	    	title : '选取Tag标签',
	    	width: '510px', 
	        height: '555px', 
	    	lock: true, 
	        max: false, 
	        min: false,
	        resize: false,
	       
	        content: 'url:'+basePath+'/core/content/dialog/ShowSiteTagForMoreContent.jsp?cIds='+ids+'&uid='+Math.random()
	
	});
}


</script>

</cms:SystemDataModel>
</cms:SysClass>
