重庆大学网络教育学院毕业论文范本
}
}
var request=new Ajax.Request(\,option); return;
},
onFailure:function(transport){ }
alert(transport.responseText+\数据提交失败,请检查网络或重试。\); var rp=transport.responseText; if(rp==\){
window.location.href=\; } else if(rp==\) { alert(\用户名错误!\); } else if(rp==\) { alert(\密码错误!\); } else if(rp==\) { alert(\帐号被禁用!\); }
4.7 添加新闻内容
本新闻发布系统采用强大的HTML编辑器(这里引用第三方组件FCKeditor)输入新闻文章,不存在任何新闻内容不能分段,不出空格的问题,可以直接复制任何图文信息,输出和原来格式一模一样。输入新闻标题,选择新闻所属的大类新闻类别和小类新闻类别,后输入有效的系统管理员,即可实现新闻的添加。添加新闻内容的文件是: Article.aspx。添加新闻内容页面如图4.13所示:
38
重庆大学网络教育学院毕业论文范本
图4.13添加新闻内容页面
添加新闻内容的程序代码如下:
protected void btnSaveContent_Click(object sender, EventArgs e) {
int id = Convert.ToInt32(hfContentId.Value); int lastPostId = id;
string content = SafeRequest(FCKeditor1.Value); string title = txtContentTitle.Text.Replace(\, \); if (title == \ || title.Length == 0) Response.End(); string author = SafeRequest(txtContentAuthor.Text); author = author.Length == 0 ? \本站编辑\ : author; string img = SafeRequest(txtImg.Text);
string isTop = rbtnContentTop.SelectedItem == null ? \ : rbtnContentTop.SelectedValue; string isImg = img.Length == 0 ? \ : \; string outUrl = SafeRequest(txtContentUrl.Text); string isOut = outUrl.Length == 0 ? \ : \;
string source = SafeRequest(ddlSource.SelectedItem.Text); string sourceUrl = SafeRequest(ddlSource.SelectedItem.Value); string isEdit = chkIsEdit.Checked ? \ : \; string tColor = ddlContentColor.SelectedValue; string columnId = ddlContentColumn.SelectedValue; string columnName = \; string columnCode = \; string isDis = \;
DataTable dt = GetDataTable(\ + columnId);
if (dt.Rows.Count > 0) {
39
重庆大学网络教育学院毕业论文范本
columnName = dt.Rows[0][0].ToString(); columnCode = dt.Rows[0][1].ToString(); isDis = dt.Rows[0][2].ToString(); } else {
ErrMsg = \栏目信息有误,请检查!\; }
string p = id > 0 ? \ : \;
string keys = SafeRequest(txtContentKeys.Text); string summary = SafeRequest(txtSummary.Text);
if (id > 0) {
chkPower(Session[\].ToString(), \ + columnId + \); string oldColumnId = GetValueByKey(\, \, \ + id);
ExecuteSql(\ + title + \ + author + \ + content + \ + keys + \ + columnId + \ + columnName + \ + columnCode + \ + tColor + \ + isImg + \ + img + \ + isTop + \ + isDis + \ + outUrl + \ + isOut + \ + isEdit + \ + source + \ + sourceUrl + \ + summary + \ + content.Length.ToString() + \ + id.ToString());
if (oldColumnId != columnId) {
ExecuteSql(\ + columnId); ExecuteSql(\ + oldColumnId); }
} else {
chkPower(Session[\].ToString(), \ + columnId + \); ExecuteSql(\
(title,author,content,keyword,columnid,columnName,columnCode,tcolor,isimg,img,istop,isdis,outurl,isout,ispass,source,sourceurl,summary,[Byte]) values ('\ + title + \ + author + \ + content + \ + keys + \ + columnId + \ + columnName + \ + columnCode + \ + tColor + \ + isImg + \ + img + \ + isTop + \ + isDis + \ + outUrl + \ + isOut + \ + isEdit + \ + source + \ + sourceUrl + \ + summary + \ + content.Length.ToString() + \);
ExecuteSql(\);
ExecuteSql(\ + columnId);
lastPostId = Convert.ToInt32(GetValueByKey(\, \, \ + title +
40
重庆大学网络教育学院毕业论文范本
\ + content.Length.ToString())); }
if (SysInfo[18].ToString() == \) getListBox(); else {
plEdit.Visible = false; plList.Visible = false;
Response.Write(\align='center' class='TableBorder'>\);
Response.Write(\bgcolor='#efefef'>\);
Response.Write(\您已开启HTML版式,如需要立即生成HTML页面,请
href='MakeView.aspx?action=one&id=\ + lastPostId + \点击这里
选择要使用的模板,然后点击按id生即可。\);
Response.Write(\); } }
4.8 管理全部新闻
可以实现对所有新闻的管理,包括:修改新闻、删除新闻功能。系统发布的所有新闻通过分页显示,每页显示10条新闻。管理全部新闻的源程序文件是:admin_info.asp管理全部新闻页面如图4.14所示:
41
重庆大学网络教育学院毕业论文范本
图4.14 管理全部新闻页面
关于这部分的代码也请参考上段所描述的Article.aspx及Article.aspx.cs代码,这时不再赘述. 4.9 管理新闻类别
可以实现新闻一级类别的添加、修改、删除功能。同时可以实现对一级类别所属二级分类的添加、修改、删除功能。这样就可以实现网站新闻类别的灵活动态管理。管理新闻类别的文件是:Manager/Column.aspx管理新闻类别的页面如图4.15/16所示:
42