📄 news_page.aspx.cs
字号:
//======================================================
//== (c)2008 aspxcms inc by NeTCMS v1.0 ==
//== Forum:bbs.aspxcms.com ==
//== Website:www.aspxcms.com ==
//======================================================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NetCMS.Content;
using NetCMS.Content.Common;
using System.IO;
using System.Xml;
public partial class manage_news_news_page : NetCMS.Web.UI.ManagePage
{
ContentManage rd = new ContentManage();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Response.CacheControl = "no-cache";
Response.Expires = 0;
SiteCopyRight.InnerHtml = CopyRight;
string ClassID = Request.QueryString["Number"];
string Action = Request.QueryString["Action"];
if (Action != null && Action != string.Empty)
{
this.acc.Value = "Edit";
string sClassID = Request.QueryString["ClassID"];
if (ClassID == null && ClassID == string.Empty)
{
PageError("错误的参数!", "");
}
DataTable dt = rd.getClassContent(sClassID.ToString(),3);
if (dt != null && dt.Rows.Count > 0)
{
this.TCname.Text = dt.Rows[0]["ClassCName"].ToString();
if (dt.Rows[0]["NaviShowtf"].ToString() == "1")
{
this.NaviShowtf.Checked = true;
}
this.TParentId.Text = dt.Rows[0]["ParentID"].ToString();
this.TOrder.Text = dt.Rows[0]["OrderID"].ToString();
this.KeyMeata.Text = dt.Rows[0]["MetaKeywords"].ToString();
this.BeWrite.Text = dt.Rows[0]["MetaDescript"].ToString();
this.FProjTemplets.Text = dt.Rows[0]["ClassTemplet"].ToString();
this.TPath.Text = dt.Rows[0]["SavePath"].ToString();
this.Content.Value = dt.Rows[0]["PageContent"].ToString();
#region 浏览权限
if (dt.Rows[0]["isDelPoint"].ToString() != "0")
{
this.UserPop1.AuthorityType = int.Parse(dt.Rows[0]["isDelPoint"].ToString());
this.UserPop1.Gold = int.Parse(dt.Rows[0]["Gpoint"].ToString());
this.UserPop1.Point = int.Parse(dt.Rows[0]["iPoint"].ToString());
this.UserPop1.MemberGroup = dt.Rows[0]["GroupNumber"].ToString().Split(',');
}
this.gClassID.Value = sClassID;
#endregion 浏览权限
}
}
else
{
this.NaviShowtf.Checked = true;
if (ClassID != null && ClassID != string.Empty)
{
TParentId.Text = ClassID.ToString();
}
else
{
TParentId.Text = "0";
}
if (SiteID == "0")
{
FProjTemplets.Text = "/{@dirTemplet}/Content/page.html";
}
else
{
FProjTemplets.Text = "/{@dirTemplet}/siteTemplets/" + SiteID + "/Content/page.html";
}
TPath.Text = "/" + NetCMS.Config.UIConfig.dirHtml + "/" + NetCMS.Common.Rand.Str_char(5).ToLower() + ".html";
this.TOrder.Text = "0";
}
}
}
protected void Buttonsave_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
string Action = this.acc.Value;
string ClassID = "";
if (Action == "Edit")
{
ClassID = this.gClassID.Value;
rd.updateClassStat(0, ClassID,0);
}
else
{
ClassID = NetCMS.Common.Rand.Number(12);
}
string ClassCName = this.TCname.Text;
string ClassEName = NetCMS.Common.Rand.Str_char(10).ToLower();
string ParentId = this.TParentId.Text;
if (ParentId.Trim() != "0")
{
string s = rd.getClassContent(ParentId,3).Rows[0]["DataLib"].ToString();
if (s == null || s.Trim() == string.Empty)
{
PageError("找不到栏目数据!", "");
}
}
int OrderID = 0;
if (NetCMS.Common.Input.IsInteger(this.TOrder.Text))
{
OrderID = int.Parse(this.TOrder.Text);
}
else
{
PageError("权重必须为数字", "");
}
DateTime CreatTime = DateTime.Now;
string ClassTemplet = this.FProjTemplets.Text;
string SavePath = this.TPath.Text;
int NaviShowtf = 0;
if (this.NaviShowtf.Checked)
{
NaviShowtf = 1;
}
string MetaKeywords = this.KeyMeata.Text;
string MetaDescript = this.BeWrite.Text;
if (MetaKeywords.Length > 200 || MetaDescript.Length > 200)
{
PageError("关键字或者描述最多200个字符", "");
}
int isDelPoint = this.UserPop1.AuthorityType;
int Gpoint = this.UserPop1.Point;
int iPoint = this.UserPop1.Gold;
string[] _GroupNumber = this.UserPop1.MemberGroup;
string GroupNumber = "";
foreach (string gnum in _GroupNumber)
{
if (GroupNumber != "")
GroupNumber += ",";
GroupNumber += gnum;
}
int isPage = 1;
if (this.Content.Value.Trim() == "")
{
PageError("输入内容", "");
}
string Content = this.Content.Value;
NetCMS.Model.PageContent uc = new NetCMS.Model.PageContent();
uc.ClassID = ClassID;
uc.ClassCName = ClassCName;
uc.ClassEName = ClassEName;
uc.ParentID = ParentId;
uc.IsURL = 0;
uc.OrderID = OrderID;
uc.CreatTime = CreatTime;
uc.ClassTemplet = ClassTemplet;
uc.SavePath = SavePath;
uc.SiteID = SiteID;
uc.NaviShowtf = NaviShowtf;
uc.MetaKeywords = MetaKeywords;
uc.MetaDescript = MetaDescript;
uc.isDelPoint = isDelPoint;
uc.Gpoint = Gpoint;
uc.iPoint = iPoint;
uc.GroupNumber = GroupNumber;
uc.isPage = isPage;
uc.Content = Content;
if (Action == "Edit")
{
//开始生成静态
rd.addUpdate_Page(uc,1);
}
else
{
//开始生成静态
rd.addUpdate_Page(uc,0);
}
string ishtml = "";
if (NetCMS.Publish.General.publishPage(ClassID))
{
ishtml = "<li>同时生成了静态文件。</li>";
}
else
{
ishtml = "<li>生成静态文件发生了错误。请查看日志。</li>";
}
PageRight("保存数据成功" + ishtml + "", "class_list.aspx");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -