?? article_add.jsp
字號:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@include file ="../DT_inc/ChkPwd.jsp"%>
<%@include file="../ConnDB.jsp"%>
<!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 name="robots" content="noindex,nofollow" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>文章添加</title>
<link href="Style.css" rel="stylesheet" type="text/css" />
<script language="javascript">
function doChange(objText, objDrop){
if (!objDrop) return;
var str = objText.value;
var arr = str.split("|");
var nIndex = objDrop.selectedIndex;
objDrop.length=1;
for (var i=0; i<arr.length; i++){
objDrop.options[objDrop.length] = new Option(arr[i], arr[i]);
}
objDrop.selectedIndex = nIndex;
}
function form1_onsubmit()
{
if (document.form1.Title.value=="")
{
alert("文章標題不能為空!");
return false;
}
if (document.form1.ClassID.value=="")
{
alert("文章所屬欄目不能指定為含有子欄目的欄目!");
return false;
}
if (document.form1.Key.value=="")
{
alert("關鍵字不能為空!");
return false;
}
// getHTML()為eWebEditor自帶的接口函數,功能為取編輯區的內容
if (Editor1.getHTML()==""){
alert("文章內容不能為空!");
return false;
}
if (document.form1.Content.value.length>65536)
{
alert("文章內容太長,超出了ACCESS數據庫的限制(64K)!建議將文章分成幾部分錄入。");
return false;
}
return true;
}
</script>
</head>
<body>
<br />
<a href="Article_Manage.jsp">文章管理</a> | <a href="Article_Add.jsp">文章添加</a>
<hr color="#0099FF" size="1" />
<%
if (request.getParameter("Title") !=null)
{
String Title=new String(request.getParameter("Title").getBytes("iso-8859-1"));
int ClassID=Integer.parseInt(request.getParameter("ClassID"));
String Author=new String(request.getParameter("Author").getBytes("iso-8859-1"));
String CopyFrom=new String(request.getParameter("CopyFrom").getBytes("iso-8859-1"));
String Key=new String(request.getParameter("Key").getBytes("iso-8859-1"));
String Content=new String(request.getParameter("Content").getBytes("iso-8859-1"));
String DefaultPicUrl=new String(request.getParameter("DefaultPicUrl").getBytes("iso-8859-1"));
String SavePicPathFileName=new String(request.getParameter("SavePicPathFileName").getBytes("iso-8859-1"));
//String IncludePic1=request.getParameter("IncludePic");
boolean IncludePic=true;
//if (IncludePic1.equals("yes")){
// IncludePic=true;
//}else{
// IncludePic=false;
//}
Statement stmt_ADD=conn.createStatement();
String Sql="insert into tArticle (fTitle,fClassID,fAuthor,fCopyFrom,fKey,fContent,fIncludePic,fDefaultPicUrl,fSavePicPathFileName) values ('"+Title+"',"+ClassID+",'"+Author+"','"+ CopyFrom+"','"+Key+"','"+Content+"',"+ IncludePic+",'"+DefaultPicUrl+"','"+ SavePicPathFileName +"')";
int add1=stmt_ADD.executeUpdate(Sql);
if (add1>0){
out.print("<p align='center'>文章:["+ Title +"] 添加成功</p>");
}
stmt_ADD.close();
}
%>
<form id="form1" name="form1" method="post" action="" onsubmit="return form1_onsubmit()">
<table width="750" border="0" align="center">
<tr>
<td>文章標題:</td>
<td><input name="Title" type="text" id="Title" size="40" /></td>
</tr>
<tr>
<td>所屬欄目:</td>
<td>
<%Statement stmt_ArticleClass=conn.createStatement();
//String SqlArticleClass="Select * from tArticleClass where fParentID=0";
String SqlArticleClass="Select * from tArticleClass order by fParentID=0";
ResultSet RsArticleClass=stmt_ArticleClass.executeQuery(SqlArticleClass);
%>
<select name="ClassID" id="ClassID">
<%
while (RsArticleClass.next())
{
int ArticleClass_ClassID=RsArticleClass.getInt("fClassID");
%>
<option value="<%=ArticleClass_ClassID%>">
<%if(RsArticleClass.getInt("fParentID")!=0) out.print(" ");%>
<%=RsArticleClass.getString("fClassName")%></option>
<%
//int SuoGe=0 ; //下級欄目縮格
//out.print( GetArticleClass(ArticleClass_ClassID,SuoGe)); //此處遞歸未作
}
%>
</select>
<%
RsArticleClass.close();
stmt_ArticleClass.close();
%> </td>
</tr>
<tr>
<td>作者:</td>
<td><input name="Author" type="text" id="Author" /></td>
</tr>
<tr>
<td>轉貼自:</td>
<td><input name="CopyFrom" type="text" id="CopyFrom" /></td>
</tr>
<tr>
<td>關鍵字</td>
<td><input name="Key" type="text" id="Key" /></td>
</tr>
<tr>
<td valign="top"><p>文章內容:</p>
<p>· 如果是從其它網站上復制內容,并且內容中包含有圖片,本系統將會把圖片復制到本站服務器上,系統會因復制圖片的大小而影響速度,請稍候(此功能需要服務器安裝了IE5.5以上版本才有效)。</p>
<p>· 換行請按Shift+Enter· 另起一段請按Enter</p></td>
<td>
<%
//ewebeditor.jsp文件調用的參數:
//id:下面表單項textarea的名稱,在此表單中是Content,注意大小寫
//style:編輯器的樣式名稱,DT_coolblue
//originalfilename:用于獲取源文件名的表單項名,在此表單中是d_originalfilename
//savefilename:用于獲取保存文件名的表單項名,在此表單中是d_savefilename
//SavePathFileName:用于獲取保存帶路徑文件名的表單項名在此表單中是SavePicPathFileName
%>
<textarea name="Content" style="display:none"></textarea>
<IFRAME ID="Editor1" src="../DT_inc/Editor/eWebEditor.jsp?id=Content&style=standard&originalfilename=d_originalfilename&savefilename=d_savefilename&SavePathFileName=SavePicPathFileName" frameborder="0" scrolling="no" width="650" height="350"></IFRAME>
</td>
</tr>
<tr>
<td width="100" align="right"><strong>包含圖片:</strong></td>
<td colspan="2">
<input name="IncludePic" type="checkbox" id="IncludePic" value="yes" />
是<font color="#0000FF">(如果選中的話會在標題前面顯示[圖文])</font> </td>
</tr>
<tr>
<td width="100" align="right"><strong>首頁圖片:</strong></td>
<td colspan="2"><input name="DefaultPicUrl" type="text" id="DefaultPicUrl" size="56" maxlength="200" />
用于首頁圖片新聞顯示 <br>
直接從上傳圖片中選擇:
<select name="DefaultPicList" id="DefaultPicList" onChange="DefaultPicUrl.value=this.value;">
<option selected>不指定首頁圖片</option>
</select>
<% //取源文件名%>
<input type=hidden name=d_originalfilename>
<%//取保存的方件名,如果不要帶路徑的填充下拉框,可以在下面的表單項加入onchange事件%>
<input type=hidden name="d_savefilename">
<% //取保存的文件名(帶路徑),使用帶路徑的填充下拉框 %>
<input type="hidden" name="SavePicPathFileName" onchange="doChange(this,document.form1.DefaultPicList)">
</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="添加" />
<input type="reset" name="Reset" value="重置" /></td>
</tr>
</table>
</form>
<p> </p>
</body>
</html>
<%
conn.close(); //關閉連接對象
%>
<%/*! private String GetArticleClass(int ID,int SuoGe)
//┌──────────────────── 深度空間 深度學習 ──┐
//│函數名:GetArticleClass
//│作 用:讀取分類和對應標題函數
//│參 數:ID:父ID號
//│返回值:
//│日 期:2006/4/21
//└──────────────────── www.DeepTeach.com ──┘
{
//out.print(ID+"<br />")
//return "beyond_xiruo";
Statement stmt_ArticleClassRoot=conn.createStatement();
String SqlArticleClassRoot= "Select * from tArticleClass where fParentID =" + ID +" order by fOrderID";
ResultSet RsArticleClassRoot=executeQuery(SqlArticleClassRoot);
String FanHuiZhi="";
while (RsArticleClassRoot.next())
{
int NextID=RsArticleClassRoot.getInt("fClassID");
FanHuiZhi=FanHuiZhi+ ("<option value="+ RsArticleClassRoot.getInt("fClassID")+">"+ tmpDepth(SuoGe)+ RsArticleClassRoot.getString("fClassName")+"</option> ");
GetArticleClass(NextID,SuoGe+1); // 遞歸調用
return;
}
RsArticleClassRoot.close();
stmt_ArticleClassRoot.close();
return FanHuiZhi;
}
*/
%>
<%/*! private void tmpDepth(int n)
{
String tmpDepth="";
for (int i=0;i<n;i++)
{
tmpDepth = tmpDepth + " ";
}
tmpDepth = tmpDepth + "├" ;
}
*/
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -