<% userPageRights="{tour}" %>
<!--#include file="check.asp"-->
<!--#include file="../Include/Char.asp" -->
<!--#include file="../include/md5.asp"-->
<%
'Define Variable 
dim i
dim rs
dim mGrade,m_SQL,mFlag,mBgColor
'initialization 
mFlag=true'add

'Display
if request("action")="edit" then 
 m_SQL="Select * From Tour_TravelSight Where F_ID="&Request.QueryString("ModifyID")
 Set rs = conn.Execute(m_SQL)
 if Not rs.Eof then
   m_CityName = rs("F_CityName")
   m_Place = rs("F_Place")
   m_Intro = rs("F_Intro")
   m_Image = rs("F_Image")
   m_SightName = rs("F_SightName")
   m_Traffic = rs("F_Traffic")
   m_Putup = rs("F_Putup")
   m_Entertainment = rs("F_Entertainment")
   m_Eat = rs("F_Eat")
   m_Speciality = rs("F_Speciality")
  End if
  mFlag=false
  rs.Close
end if

if Request.ServerVariables("REQUEST_METHOD")="POST" then
   m_CityName = Trim(Request.form("selCityName"))
   m_SightName = checkStr(Trim(Request.Form("txtSightName")))
   m_Place = checkStr(Trim(Request.Form("txtPlace")))
   m_Traffic = checkStr(Trim(Request.Form("txtTraffic")))
   m_Entertainment = checkStr(Trim(Request.Form("txtEntertainment")))
   m_Eat = checkStr(Trim(Request.Form("txtEat")))
   m_Putup = checkStr(Trim(Request.Form("txtPutup")))
   m_Speciality = checkStr(Trim(Request.Form("txtSpeciality")))
   m_NearSightFlag = checkStr(Trim(Request.Form("txtNearSightFlag")))
   m_Image = Request.Form("txtImage")
   m_Intro = Request.Form("txtIntro")

 if Request.Querystring("action")="Insert" then
    m_SQL = "Select * From Tour_TravelSight Where F_SightName='"&m_SightName&"'"
	Set rs = conn.Execute(m_SQL)
	if not rs.Eof then
	   rs.Close
	   call msgbox("对不起，该景点输入!",1)
	else
	  rs.Close
	  m_Sql = "Insert Into Tour_TravelSight(F_SightName,F_Place,F_CityName,F_Traffic,F_Entertainment,F_Eat,F_Putup,F_Speciality,F_Image,F_Intro)"
	  m_Sql = m_Sql + "Values('"&m_SightName&"','"&m_Place&"','"&m_CityName&"','"&m_Traffic&"','"&m_Entertainment&"','"&m_Eat&"','"&m_Putup&"','"&m_Speciality&"','"&m_Image&"','"&M_Intro&"')"
	  conn.Execute(m_Sql)
      response.redirect "Tour_TravelSightManage.asp?action=IsInsert&pageno="&Request("pageno")
     end if '//rs.eof
  else 
      m_SQL = "UPDATE Tour_TravelSight SET"
      m_SQL = m_SQL+" F_SightName='"&m_SightName&"',"
      m_SQL = m_SQL+" F_Place='"&m_Place&"',"
      m_SQL = m_SQL+" F_Traffic='"&m_Traffic&"',"
      m_SQL = m_SQL+" F_Entertainment='"&m_Entertainment&"',"
      m_SQL = m_SQL+" F_Speciality='"&m_Speciality&"',"
      m_SQL = m_SQL+" F_CityName='"&m_CityName&"',"
      m_SQL = m_SQL+" F_Eat='"&m_Eat&"',"
      m_SQL = m_SQL+" F_Putup='"&m_Putup&"',"
      m_SQL = m_SQL+" F_Intro='"&m_Intro&"',"
      m_SQL = m_SQL+" F_Image='"&m_Image&"'"
      m_SQL = m_SQL +" WHERE F_ID=" & Request("ModifyID") 
      conn.Execute(m_SQL)
      Response.redirect "Tour_TravelSightManage.asp?action=IsModify&pageno="&Request("pageno")
   End if
 End if

'Delect Records
if request("action")="Delete" then
  m_SQL = "DELETE FROM Tour_Hotel WHERE F_ID=" &Request.QueryString("DeleteID")
  conn.execute m_SQL
  '---delete sub
  m_SQL = "DELETE FROM Tour_TravelSight WHERE F_ID=" &Request.QueryString("DeleteID")
  conn.execute m_SQL
  Response.write "<script>location.replace('Tour_TravelSightManage.asp?action=IsDelete&pageno="&Request.Querystring("pageno")&"')</script>"
end if
lm2="jd"
%>

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../Files/Style.css" rel="stylesheet" type="text/css">
<SCRIPT language="JavaScript">
function jDelete(url)
{
  if((confirm(" 警告:请确定是否删除,删除后不能恢复! "))==true) 
	self.location=url+'&action=Delete';
}
</SCRIPT>
<script language="javascript">
function CheckData(){
  if (document.form1.txtSightName.value=="")
   {
    alert("对不起,请输入景点！");
	document.form1.txtSightName.focus();
	return false;
   }
}
</script>
<script language="javascript">
<!--
function insertPic(obj){
	var file = showModalDialog("../include/filesr.asp?lm=<%=lm2%>-&path="+obj.name+"/",null,"dialogHeight:600px;dialogWidth:730px;scroll:yes;help:no;status:no;")
		if(typeof(file) != "undefined"){
		obj.value = file;
	}
}
-->
</script>
</head>
<body text="#000000" >
<table width="100%" height="1"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td></td>
  </tr>
</table>
<TABLE width=100% height=22 border=1 align="center" cellPadding=0 
cellSpacing=0 borderColor=#7c96b8 borderColorDark=#ffffff>
  <TBODY>
    <TR align="center" > 
      <TD width="100%" height=20 align="left" background="Images/mmTo.gif" > <span style="CURSOR: hand; FILTER: dropshadow(color=#FFFFFF, offx=1, offy=1, positive=1);  WIDTH: 100%"> 
        <FONT color=#336699>※当前路径：网站后台管理 → 旅游预订 → 景点管理</FONT></span></TD>
    </TR>
  </TBODY>
</TABLE>
<TABLE width=100% height=95% border=1 align="center" cellPadding=0 
cellSpacing=0 borderColor=#7c96b8 borderColorDark=#ffffff>
  <TBODY>
    <TR> 
      <TD width="100%" align=center valign="top">
<table width="100%" border="0" cellspacing="1" cellpadding="0" align="center">
          <tr style="cursor:hand" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#EBEEF6'"  bgcolor="#dde1ec" align="center"> 
            <td width="8%"><font color="#666666"><b>ID</b></font></td>
            <td width="21%"><font color="#666666"><b>景点</b></font></td>
            <td><font color="#666666"><b>景点位置</b></font></td>
            <td width="14%"><font color="#666666"><b>城市</b></font></td>
            <td width="15%"><font color="#666666"><b>管理<a title="添加记录" href='Tour_TravelSightManage.asp?pageno=<%=mPage%>#anInsert'><font color="#FF0000">[添加]</font></a></b></font></td>
          </tr>
        </table>
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#ebeef6">
          <%  
	Set rs=Server.createobject("Adodb.RecordSet")
    pageno=request.querystring("pageno")
    pmcount=16  
    m_SQL="select * from Tour_TravelSight order by F_ID desc"
	rs.open m_SQL,conn,1,1
	if rs.eof then
	  'response.write "<br><p  align='center'><font color=red><B> 对不起，数据已清空！</B></font></p>"
    else
    rs.pagesize=pmcount
    mpage=rs.pagecount
    if pageno="" then pageno=1
    if  cint(pageno)<1 or cint(pageno)>mpage then  pageno=1
    rs.absolutepage=pageno

 Dim rc,re
 rc=rs.pagesize
 re=1
 do while not rs.eof and rc>0
 mBgColor=Request.Querystring("BgColor")
 if Trim(rs("F_ID"))=Trim(mBgColor) then mColor= "D6DFFF" else mColor= "ffffff"
%>
          <tr bgcolor="<%=mColor%>"   onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#EBEEF6'" > 
            <td  width="8%" align="center"><%=rs("F_ID")%></td>
            <td width="21%" align="center" >
			   <a target="_blank" href="../Tour/Travel_SightShow.asp?ID=<%=rs("F_ID")%>"> 
               <%=rs("F_SightName")%></a></td>
            <td ><%=rs("F_Place")%></td>
            <td width="14%" align="center" > 
			<%=rs("F_CityName")%> </td>
            <td width="15%" align="center" ><a title="修改记录" href='Tour_TravelSightManage.asp?action=edit&ModifyID=<%=rs("F_ID")%>&BgColor=<%=rs("F_ID")%>&pageno=<%=cstr(pageno)%>#anModify'><font color="#666666">[修改]</font></a><a title="请确定是否删除,删除后不能恢复!" href="javascript:jDelete('Tour_TravelSightManage.asp?DeleteID=<%=rs("F_ID")%>&pageno=<%=cstr(pageno)%>')"><font color="#666666">[删除]</font></a></td>
          </tr>
 <%
 rs.movenext
 re=re+1
 rc=rc-1
 loop
 end if
%>
        </table> 
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="FFFFFF">
          <tr> 
            <td width="35%" height="22">
			  &nbsp;共
			  <font color=red><strong><% = rs.recordcount%></strong></font>
			  条记录 当前第
			  <font color=red><strong><% = Trim(pageno)%></strong></font>页/共
			  <font color=red><strong><% = Trim(mpage)%></strong></font>页
			  </td>
            <td width="65%" align="right"> 
<%
if pageno="" then pageno=1
if pageno>1 then
   response.write "<a href='Tour_TravelSightManage.asp'> <img alt='首页' src='Images/boqb02.gif' border=0 width='15' height='14'></a>"
else
   response.write "<img alt='首页' src='Images/boqb02.gif' border=0 width='15' height='14'>"
end if

if pageno>1 then
   response.write "<a href='Tour_TravelSightManage.asp?pageno="&pageno-1&"'><img alt='上一页' src='Images/bob02.gif' border=0 width='15' height='14'></a>"
else
   response.write "<img alt='上一页' src='Images/bob02.gif' border=0 width='15' height='14'>"
end if

add=5'数字分页个数+1
if pageno-int(add/2)<=1 then m=1 else m=pageno-int(add/2)
if m+add>mpage then 
   n=mpage
   if mpage-add<=1 then m=1 else m=mpage-add
else
   n=m+add
end if

for pno=m to n
 if pno=cint(pageno) then
   response.write "&nbsp;<font color=red>"&pno&"</font>"
 else
   response.write "<b>&nbsp;<a href='Tour_TravelSightManage.asp?pageno="&pno&"'>"&pno&"</a></b>"
 end if
next
response.write "&nbsp"

if int(pageno) < int(rs.pagecount) then
  response.write "<a href='Tour_TravelSightManage.asp?pageno="&pageno+1&"'><img alt='下一页' src='Images/fbob02.gif' border=0 width='15' height='14'></a>"
else 
  response.write "<img alt='下一页' src='Images/fbob02.gif' border=0 width='15' height='14'>"
end if

if int(pageno) < int(rs.pagecount) then
   response.write "<a href='Tour_TravelSightManage.asp?pageno="&mpage&"'><img alt='末页' src='Images/fboqb02.gif' border=0 width='15' height='14'></a>"
else
   response.write "<img alt='末页' src='Images/fboqb02.gif' border=0 width='15' height='14'>"
end if
Response.write "&nbsp;&nbsp;"
%>
            </td>
          </tr>
        </table>
        <%if mFlag=true then'add%>
        <strong><font color=red><a name="anInsert"></a></font></strong> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td height="32" align="center" bgcolor="FFFFFF"><strong><font color=red> 
              <%
		  if Request.QueryString("action")="IsInsert" then response.write "提示：记录添加成功！" 
		  if Request.QueryString("action")="IsDelete" then response.write "提示：记录删除成功！" 
		  if Request.QueryString("action")="IsModify" then response.write "提示：记录修改成功！" 
  		  if Trim(Request.QueryString("action"))="" then response.write "提示：当前为添加状态！" 
		%>
              </font></strong></td>
          </tr>
        </table> 
        <strong><font color=red> </font></strong> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
          <tr> 
            <form name="form1" method="post" action="Tour_TravelSightManage.asp?action=Insert" onSubmit="return CheckData()">
              <td> <table width="100%" border="0" cellpadding="2" cellspacing="0">
                  <tr background="Images/mmTo.gif"> 
                    <td height="6" background="Images/mmTo.gif"> <span style="CURSOR: hand; FILTER: dropshadow(color=#FFFFFF, offx=1, offy=1, positive=1);  WIDTH: 100%">功能：添加记录</span></td>
                  </tr>
                  <tr> 
                    <td valign="top" bgcolor="fcfcfc"> 
                      <table width="100%" border="0" cellspacing="2" cellpadding="0">
                        <tr> 
                          <td width="12%" height="19">景点名称：</td>
                          <td width="88%"><input name="txtSightName" type="text"  class="text" value="" size="28" maxlength="20"></td>
                        </tr>
                        <tr> 
                          <td width="12%" height="19">景点位置：</td>
                          <td width="88%"><input name="txtPlace" type="text"  class="text" value="" size="36" maxlength="20"></td>
                        </tr>
                        <tr> 
                          <td width="12%" height="19">旅游城市：</td>
                          <td width="88%"> <select class="text" name="selCityName">
                              <%
							  m_SQL = "SELECT * FROM Tour_TravelCity"
							  Set rst = conn.Execute(m_SQL)
							  Do While Not rst.Eof
							    Response.Write "<option value='"&rst("F_CityName")&"'>"&rst("F_CityName")&"</option>"
								rst.MoveNext
						      Loop
							  rst.Close
							 %>
                            </select> </td>
                        </tr>
                        <tr> 
                          <td width="12%" height="2">交通指南：</td>
                          <td width="88%"><input name="txtTraffic" type="text"  class="text" value="" size="36" maxlength="20"></td>
                        </tr>
                        <tr> 
                          <td width="12%" height="9">娱乐指南：</td>
                          <td><input name="txtEntertainment" type="text"  class="text" size="36" maxlength="20"></td>
                        </tr>
                        <tr> 
                          <td width="12%" height="19">住宿指南：</td>
                          <td width="88%"><input name="txtPutup" type="text"  class="text" value="" size="36" maxlength="20"> 
                          </td>
                        </tr>
						<tr> 
                          <td width="12%" height="19">特色餐饮：</td>
                          <td width="88%"><input name="txtEat" type="text"  class="text" value="" size="36" maxlength="20"> 
                          </td>
                        </tr>
                        <tr> 
                          <td width="12%" height="8">当地特产：</td>
                          <td width="88%"><input name="txtSpeciality" type="text"  class="text" value="" size="36" maxlength="20"> 
                          </td>
                        </tr>
                        <tr> 
                          <td width="12%" height="-2">图片上传：</td>
                          <td><input name="txtImage" type="text" id="txtImage" value="<%
	if txtImage = "none" then
	  	response.Write("")
		else
		response.Write txtImage
	end if
	  %>" size="45" maxlength="255">
                <input type="button" name="Submit" value="选择&gt;" onClick="javascript:insertPic(this.form.txtImage);"></td>
                        </tr>
                        <tr> 
                          <td>介　　绍： </td>
                          <td><textarea name="txtIntro" style="display:none" cols="1" rows="1"><%if txtIntro<>"" then response.write txtIntro%></textarea>
					<IFRAME ID="txtIntro" SRC="eEditor/ewebeditor.asp?id=txtIntro&style=news" FRAMEBORDER="0" SCROLLING="no" WIDTH="100%" HEIGHT="300" marginwidth="1" marginheight="1" name="wfasdg"></IFRAME></td>
                        </tr>
                        <tr> 
                          <td height="37" colspan="2"><input  type="submit" value="提交信息" name="B32"  class="button"> 
                            &nbsp; <input type="reset" value="从新来过" name="B32" class="button"></td>
                        </tr>
                      </table>
                      
                    </td>
                  </tr>
                </table></td>
            </form>
          </tr>
        </table>
        <%else%>
        <strong><font color=red><a name="anModify"></a></font></strong> 
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td height="32" align="center" bgcolor="ffffff"><strong><font color=red> 
              <%
		  if Request.QueryString("action")="IsInsert" then response.write "提示：记录添加成功！" 
		  if Request.QueryString("action")="IsDelete" then response.write "提示：记录删除成功！" 
		  if Request.QueryString("action")="IsModify" then response.write "提示：记录修改成功！" 
		  if Trim(Request.QueryString("action"))="edit" then response.write "提示：当前为修改状态！" 
	   %>
              </font></strong></td>
          </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" height="54">
          <tr> 
            <form name="form1" method="post" action="Tour_TravelSightManage.asp?pageno=<%=request("pageno")%>&ModifyID=<%=request("ModifyID")%>" onSubmit="return CheckData()">
              <td> <table width="100%" border="0" cellpadding="2" cellspacing="0">
                  <tr background="Images/mmTo.gif"> 
                    <td height="6" background="Images/mmTo.gif"> <span style="CURSOR: hand; FILTER: dropshadow(color=#FFFFFF, offx=1, offy=1, positive=1);  WIDTH: 100%">功能：修改记录</span></td>
                  </tr>
                  <tr> 
                    <td valign="top" bgcolor="fcfcfc">
					<table width="100%" border="0" cellspacing="2" cellpadding="0">
                        <tr> 
                          <td width="12%" height="19">景点名称：</td>
                          <td width="88%"><input name="txtSightName" type="text"  class="text" value="<%=m_SightName%>" size="28" maxlength="20"></td>
                        </tr>
                        <tr> 
                          <td width="12%" height="19">景点位置：</td>
                          <td width="88%"><input name="txtPlace" type="text"  class="text" value="<%=m_Place%>" size="36" maxlength="20"></td>
                        </tr>
                        <tr> 
                          <td width="12%" height="19">旅游城市：</td>
                          <td width="88%"> <select class="text" name="selCityName">
                              <%
							  Response.Write "<option value='"&m_CityName&"'>"&m_CityName&"</option>"
							  m_SQL = "SELECT F_CityName FROM Tour_TravelCity"
							  Set rst = conn.Execute(m_SQL)
							  Do While Not rst.Eof
							    Response.Write "<option value='"&rst("F_CityName")&"'>"&rst("F_CityName")&"</option>"
								rst.MoveNext
						      Loop
							  rst.Close
							 %>
                            </select></td>
                        </tr>
                        <tr> 
                          <td width="12%" height="2">交通指南：</td>
                          <td width="88%"><input name="txtTraffic" type="text"  class="text" value="<%=m_Traffic%>" size="36" maxlength="20"></td>
                        </tr>
                        <tr> 
                          <td width="12%" height="9">娱乐指南：</td>
                          <td><input name="txtEntertainment" type="text"  class="text" value="<%=m_Entertainment%>" size="36" maxlength="20"></td>
                        </tr>
                        <tr> 
                          <td width="12%" height="19">住宿指南：</td>
                          <td width="88%"><input name="txtPutup" type="text"  class="text" value="<%=m_Putup%>" size="36" maxlength="20"> 
                          </td>
                        </tr>

                        <tr> 
                          <td width="12%" height="19">特色餐饮：</td>
                          <td width="88%"><input name="txtEat" type="text"  class="text" value="<%=m_Eat%>" size="36" maxlength="20"> 
                          </td>
                        </tr>
                        <tr> 
                          <td width="12%" height="8">当地特产：</td>
                          <td width="88%"><input name="txtSpeciality" type="text"  class="text" value="<%=m_Speciality%>" size="36" maxlength="20"> 
                          </td>
                        </tr>
                        <tr> 
                          <td width="12%" height="-2">图片上传：</td>
                          <td><input name="txtImage" type="text" id="txtImage" value="<%
	if m_Image = "none" then
	  	response.Write("")
		else
		response.Write m_Image
	end if
	  %>" size="45" maxlength="255">
                <input type="button" name="Submit" value="选择&gt;" onClick="javascript:insertPic(this.form.txtImage);"></td>
                        </tr>
                        <tr> 
                          <td>介　　绍： </td>
                          <td><textarea name="txtIntro" style="display:none" cols="1" rows="1"><%if m_Intro<>"" then response.write m_Intro%></textarea>
					<IFRAME ID="txtIntro" SRC="eEditor/ewebeditor.asp?id=txtIntro&style=news" FRAMEBORDER="0" SCROLLING="no" WIDTH="100%" HEIGHT="300" marginwidth="1" marginheight="1" name="wfasdg"></IFRAME></td>
                        </tr>
                        <tr> 
                          <td height="37" colspan="2"><input  type="submit" value="提交信息" name="B32"  class="button"> 
                            &nbsp; <input type="reset" value="从新来过" name="B32" class="button"></td>
                        </tr>
                      </table>
					</td>
                  </tr>
                </table></td>
            </form>
          </tr>
        </table>
        <%end if%>
      </TD>
    </TR>
  </TBODY>
</TABLE>
</body>
</html>
<%
 set rs=nothing
 CloseDatabase
%>