<% Option Explicit %>
<!--#include file="../../Inc/Const.asp" -->
<!--#include file="../../Inc/Cls_DB.asp" -->
<!--#include file="../../Inc/Function.asp" -->
<%
'==============================================================================
'软件名称：风讯网站信息管理系统
'当前版本：Foosun Content Manager System 2.0 
'最新更新：2004.12
'==============================================================================
'商业注册联系：028-85098980-601,602 技术支持：028-85098980-606、607,客户支持：608
'产品咨询QQ：159410,655071,66252421
'技术支持:所有程序使用问题，请提问到bbs.foosun.net我们将及时回答您
'程序开发：风讯开发组 & 风讯插件开发组
'论坛支持：风讯在线论坛(http://bbs.foosun.net)
'官方网站：www.Foosun.net  演示站点：test.cooin.com    
'网站建设专区：www.cooin.com
'==============================================================================
'免费版本请在新闻首页保留版权信息，并做上本站LOGO友情连接
'==============================================================================
Dim DBC,Conn
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
%>
<!--#include file="../../Inc/Session.asp" -->
<!--#include file="../../Inc/CheckPopedom.asp" -->
<%
if Not JudgePopedomTF(Session("Name"),"P0105") then Call ReturnError1()
Dim NewsSql,RsNewsObj,RsClassObj,ClassID,ClassCName,RsChildClassObj
ClassID = Request("ClassID")
if ClassID = "0" or ClassID = "" then
	NewsSql = "Select * from Contribution order by AddTime desc"
else
	NewsSql = "Select * from Contribution where ClassID='" & ClassID & "' order by AddTime desc"
end if
Set RsNewsObj = Conn.Execute(NewsSql)
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新闻列表</title>
</head>
<link href="../../CSS/css.css" rel="stylesheet">
<script src="../JS/PublicJS.js" language="JavaScript"></script>
<body topmargin="0" leftmargin="0" ondragstart="return false;" onselectstart="return false;" oncontextmenu="SelectContr(true);showMenu(MouseRightMenu);return false;">
<table id="MainTable" onclick="SelectContr(false);" width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="37%" height="20" class="ButtonList"><div align="center">稿件名称</div></td>
          <td width="15%" height="20" class="ButtonList"><div align="center">添加时间</div></td>
          <td width="19%" height="20" class="ButtonList"><div align="center">作者</div></td>
          <td width="18%" height="20" class="ButtonList"><div align="center">大小</div></td>
        </tr>
<%
do while Not RsNewsObj.Eof
%>
        <tr> 
          <td height="20">
		  <table border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td><img src="../Images/Contribution.gif" width="18" height="18"></td>
                <td><span class="TempletItem" NewsID="<% = RsNewsObj("ContID") %>" align="center"> 
                  <% = GotTopic(RsNewsObj("Title"),30) %>
                  </span> </td>
              </tr>
          </table>
		  </td>
          <td height="20"><div align="center" class="TempletItem"><% = RsNewsObj("AddTime") %></div></td>
          <td height="20"><div align="center" class="TempletItem"><% = RsNewsObj("Author") %></div></td>
          <td height="20"><div align="center" class="TempletItem"><% = Len(RsNewsObj("Content")) %>字符</div></td>
        </tr>
        <%
	RsNewsObj.MoveNext
loop
%>
      </table></td>
  </tr>
</table>
<!-- 鼠标右键菜单 -->
<div id=MouseRightMenu onclick="ClickMenu(this);" onmouseover="MouseOverRightMenu();" onmouseout="MouseOverRightMenu();" class="menu"> 
  <div class="MouseRightItem" id="Add" ExeFunction="CreateNews();">新建</div>
  <div class="MouseRightItem" id="Edit" ExeFunction="OpenWindow('ContTip.asp?FileName=ContributionModify.asp&Titles=稿件修改&NewsID='+NewsID,620,400,window);">修改</div>
  <div class="MouseRightItem" id="Del" ExeFunction="OpenWindow('ContTip.asp?FileName=ContributionDell.asp&Titles=稿件删除&NewsID='+NewsID,220,110,window);">删除</div>
  <hr id="HR1">
  <div class="MouseRightItem" id="CheckNews" ExeFunction="OpenWindow('ContTip.asp?FileName=ContributionCheck.asp&Titles=审核稿件&NewsID='+NewsID,620,555,window);" >审核</div>
  <hr id="HR3">
  <div class="MouseRightItem" id="Cut" ExeFunction="CutOperation();">剪切</div>
  <div class="MouseRightItem" id="Copy" ExeFunction="CopyOperation();">复制</div>
  <div class="MouseRightItem" id="Paste" ExeFunction="PasteOperation();">粘帖</div>
  <hr id="HR5">
  <div class="MouseRightItem" id="Refresh" ExeFunction="window.location.reload();">刷新</div>
   <hr id="HR6">
  <div class="MouseRightItem" id="Pros" ExeFunction="javascript:window.prompt('本页面路径属性' , '<%=Request.ServerVariables("SCRIPT_NAME")%>');">路径属性</div>
</div>
</body>
</html>
<%
Set RsChildClassObj = Nothing
Set RsNewsObj = Nothing
Set RsClassObj = Nothing
Set Conn = Nothing
%>
<script language="javascript"> 
var  ClassID = '';
var  NewsID = '';
var  BigClassID = '<% = ClassID %>';
var ListObjArray=new Array();
parent.MoveOrCopyObjectClass=BigClassID; 
Edit.className='MenuItemDisable';
Del.className='MenuItemDisable'; 
Cut.className='MenuItemDisable';
Copy.className='MenuItemDisable';
CheckNews.className='MenuItemDisable';
if (parent.MoveOrCopySourceNews!='')
{
	Paste.className='MouseRightItem';
}
else  Paste.className='MenuItemDisable';
var ListObjArray=new Array();
IntialListObjArray();
function IntialListObjArray()
{
	var CurrObj=null,j=1;
	for (var i=0;i<document.all.length;i++)
	{
		CurrObj=document.all(i);
		if (CurrObj.NewsID!=null)
		{
			ListObjArray[ListObjArray.length]=new ListObj(CurrObj,0,j,false);
			j++;
		}
	}
}
function ListObj(Obj,Type,Index,Selected)
{
	this.Obj=Obj;
	this.Index=Index;
	this.Type=Type;
	this.Selected=Selected;
}
function SelectContr(MouseRight)
{
	var el=event.srcElement;
	var i=0;
	if (!MouseRight)
	{
		if ((event.ctrlKey==true)||(event.shiftKey==true))
		{
			if (event.ctrlKey==true)
			{
				for (i=0;i<ListObjArray.length;i++)
				{
					if (el==ListObjArray[i].Obj)
					{
						if (ListObjArray[i].Selected==false)
						{
							ListObjArray[i].Obj.className='TempletSelectItem';
							ListObjArray[i].Selected=true;
						}
						else
						{
							ListObjArray[i].Obj.className='TempletItem';
							ListObjArray[i].Selected=false;
						}
					}
				}
			}
			if (event.shiftKey==true)
			{
				var MaxIndex=0,ObjInArray=false,EndIndex=0,ElIndex=-1;
				for (i=0;i<ListObjArray.length;i++)
				{
					if (ListObjArray[i].Selected==true)
					{
						if (ListObjArray[i].Index>=MaxIndex) MaxIndex=ListObjArray[i].Index;
					}
					if (el==ListObjArray[i].Obj)
					{
						ObjInArray=true;
						ElIndex=i;
						EndIndex=ListObjArray[i].Index;
					}
				}
				if (MaxIndex!=0)
				{
					for (i=MaxIndex-1;i<EndIndex;i++)
					{
						ListObjArray[i].Obj.className='TempletSelectItem';
						ListObjArray[i].Selected=true;
					}
				}
				else
				{
					if (ElIndex!=-1)
					{
						ListObjArray[ElIndex].Obj.className='TempletSelectItem';
						ListObjArray[ElIndex].Selected=true;
					}
				}
			}
		}
		else
		{
			for (i=0;i<ListObjArray.length;i++)
			{
				if (el==ListObjArray[i].Obj)
				{
					ListObjArray[i].Obj.className='TempletSelectItem';
					ListObjArray[i].Selected=true;
				}
				else
				{
					ListObjArray[i].Obj.className='TempletItem';
					ListObjArray[i].Selected=false;
				}
			}
		}
	}
	else
	{
		var elInSelectArray=false;
		for (i=0;i<ListObjArray.length;i++)
		{
			if (el==ListObjArray[i].Obj)
			{
				if (ListObjArray[i].Selected==true)
				{
					elInSelectArray=true;
				}
			}
		}
		if (!elInSelectArray)
		{
			for (i=0;i<ListObjArray.length;i++)
			{
				if (el==ListObjArray[i].Obj)
				{
					ListObjArray[i].Obj.className='TempletSelectItem';
					ListObjArray[i].Selected=true;
				}
				else
				{
					ListObjArray[i].Obj.className='TempletItem';
					ListObjArray[i].Selected=false;
				}
			}
		}
		GetID();
		var NewsFlag;
		NewsFlag=(NewsID!='')?1:0;   //选择了新闻----1  没有选择新闻----0
		if (NewsFlag==1) NewsFlag=(NewsID.indexOf(',')==-1)?2:NewsFlag;  //只选择了一个新闻----2
		switch (NewsFlag)
		{
			case 0:
				Edit.className='MenuItemDisable';
				Del.className='MenuItemDisable'; 
				Cut.className='MenuItemDisable';
				Copy.className='MenuItemDisable';
				CheckNews.className='MenuItemDisable';
				if ((parent.MoveOrCopySourceNews!='')&&(BigClassID!='0'))
				{
					Paste.className='MouseRightItem';
				}
				else  Paste.className='MenuItemDisable';
				break;
			case 1:
				Edit.className='MenuItemDisable';
				Del.className='MouseRightItem'; 
				if (BigClassID!='0')
				{
					Cut.className='MouseRightItem';
					Copy.className='MouseRightItem';
				}
				CheckNews.className='MenuItemDisable';
				Paste.className='MenuItemDisable';
				break;
			case 2:
				Edit.className='MouseRightItem';
				Del.className='MouseRightItem'; 
				if (BigClassID!='0')
				{
					Cut.className='MouseRightItem';
					Copy.className='MouseRightItem';
				}
				CheckNews.className='MouseRightItem';
				Paste.className='MenuItemDisable';
				break;
			default:
		}
		if (BigClassID=='0') Add.className='MenuItemDisable';
	}
}
function GetID()
{
	NewsID='';
	for (i=0;i<ListObjArray.length;i++)
	{
		if (ListObjArray[i].Selected==true)
		{
			if (NewsID=='') NewsID=ListObjArray[i].Obj.NewsID;
			else NewsID=NewsID+','+ListObjArray[i].Obj.NewsID;
		}
	}
}

function CutOperation()
{
	parent.MoveTF=true;
	if (NewsID!='')
	{  
	     parent.MoveOrCopySourceClass=BigClassID;
		 parent.MoveOrCopySourceNews=NewsID;
	}
}

function CopyOperation()
{
	parent.MoveTF=false;
	if (NewsID!='')
	{
	     parent.MoveOrCopySourceClass=BigClassID;
		 parent.MoveOrCopySourceNews=NewsID;
	}
}

function PasteOperation()
{
	var MoveOrCopyClassPara='MoveTF:'+parent.MoveTF+';SourceClass:'+parent.MoveOrCopySourceClass+';SourceNews:'+parent.MoveOrCopySourceNews+';ObjectClass:'+parent.MoveOrCopyObjectClass+';';
	OpenWindow('ContTip.asp?FileName=MoveOrCopyCont.asp&Titles=稿件移动或复制&MoveOrCopyClassPara='+MoveOrCopyClassPara,310,95,window);
}

function CreateNews()
{
  if (ClassID!='') OpenWindow('ContTip.asp?FileName=ContributionAdd.asp&Titles=稿件添加&ClassID='+ClassID,620,400,window);
  else OpenWindow('ContTip.asp?FileName=ContributionAdd.asp&Titles=稿件添加&ClassID='+BigClassID,620,400,window);
 }

</script>