📄 news_add.aspx.cs
字号:
if (this.RemoteTF.Checked)//远程保存图片!
{
string _dimmdir = "";
if (dimmdir != null && dimmdir.Trim() != "") { _dimmdir = "/" + dimmdir; }
string _localSavedir = _dimmdir + "/" + localSavedir + "/content/" + getDateTime.Year + "-" + getDateTime.Month + "";
string _PhylocalSavedir = Server.MapPath(_localSavedir);
__Content = getRemoteContent(_Content, _localSavedir, _PhylocalSavedir, "", true);
}
else
{
//__Content = this.Content.Content;
__Content = this.FileContent.Value;
}
//此处开始内部连接替换!
string Content = __Content;
if (EditAction != "Edit")
{
if (NetCMS.Config.UIConfig.isLinkTF == "1")
{
DataTable gD = rd.sel_newsInfo(2);
if (gD != null && gD.Rows.Count > 0)
{
for (int gi = 0; gi < gD.Rows.Count; gi++)
{
Content = Content.Replace(gD.Rows[gi]["Cname"].ToString(), "<a href=\"" + gD.Rows[gi]["URL"].ToString() + "\" target=\"_blank\">" + gD.Rows[gi]["Cname"].ToString() + "</a>");
}
gD.Clear(); gD.Dispose();
}
}
}
#endregion 获取表单值
//===================================================================================================
#region 开始插入值
NetCMS.Model.NewsContent uc = new NetCMS.Model.NewsContent();
uc.NewsType = NewsType;
uc.OrderID = OrderID;
uc.NewsTitle = NewsTitle;
uc.sNewsTitle = sNewsTitle;
uc.TitleColor = TitleColor;
uc.TitleITF = TitleITF;
uc.TitleBTF = TitleBTF;
uc.CommLinkTF = CommLinkTF;
uc.SubNewsTF = SubNewsTF;
uc.URLaddress = URLaddress;
uc.PicURL = PicURL;
if (this.sPicFromContent.Checked)
{
if (!NetCMS.Common.Input.IsInteger(this.btngetContentNum.Text))
{
PageError("提取图片的第几张,请填写数字", "");
}
int intPicNum = int.Parse(this.btngetContentNum.Text);
string pattern = "\\<img\\ [\\s\\S]*?src=['\"]?(?<f>[^'\"\\>\\ ]+)['\"\\>\\ ]";
Regex reg = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
// Match match = reg.Match(this.Content.Content);
Match match = reg.Match(this.FileContent.Value);
string gPicURL = "";
int Picnumj = 1;
while (match.Success)
{
gPicURL = match.Groups["f"].Value;
if (Picnumj == intPicNum)
{
break;
}
Picnumj++;
match = match.NextMatch();
}
if (RemoteTF.Checked)
{
string _dimmdir = "";
if (dimmdir != null && dimmdir.Trim() != "") { _dimmdir = "/" + dimmdir; }
string _localSavedir = _dimmdir + "/" + localSavedir + "/content/" + getDateTime.Year + "-" + getDateTime.Month + "-" + getDateTime.Day;
string _PhylocalSavedir = Server.MapPath(_localSavedir);
gPicURL = getRemoteContent(gPicURL, _localSavedir, _PhylocalSavedir, "", false);
}
uc.PicURL = gPicURL;
uc.NewsType = 1;
}
uc.SPicURL = "";
#region 生成小图
if (SPicURLTF == 1)
{
string _dimmdirPic = "";
string fileEX = System.IO.Path.GetExtension(PicURL);
if (dimmdir != null && dimmdir.Trim() != "") { _dimmdirPic = "/" + dimmdir; }
string _tmpPic = "/" + localSavedir + "/shortPictures/" + getDateTime.Year + "-" + getDateTime.Month + "/" + getDateTime.Year + getDateTime.Month + getDateTime.Day + NetCMS.Common.Rand.Number(5) + fileEX;
string _localSavePicfile = _dimmdirPic + _tmpPic;
string _tmpPicURL = _dimmdirPic + PicURL;
int _sWidth = int.Parse(NetCMS.Config.UIConfig.sWidth);
int _sHeight = int.Parse(NetCMS.Config.UIConfig.sHeight);
if (this.stWidth.Text != null && this.stWidth.Text != "") { _sWidth = int.Parse(this.stWidth.Text); }
if (this.stHeight.Text != null && this.stHeight.Text != "") { _sHeight = int.Parse(this.stHeight.Text); }
string _PicURL = Server.MapPath(_tmpPicURL.Replace("{@dirfile}", localSavedir));
string __PicURL = Server.MapPath(_localSavePicfile.Replace("{@dirfile}", localSavedir));
string getActionPicUrl = "";
bool Have_Spic = false;
if (EditAction == "Edit")
{
getActionPicUrl = __PicURL;
if (this.SPicURL.Value != null)
{
if (this.SPicURL.Value != string.Empty)
{
Have_Spic = true;
getActionPicUrl = Server.MapPath((_dimmdirPic + this.SPicURL.Value).Replace("{@dirfile}", localSavedir));
}
}
}
else
{
getActionPicUrl = __PicURL;
}
FSImage FSI = new FSImage(_sWidth, _sHeight, _PicURL);
FSI.Thumbnail(getActionPicUrl);
if (EditAction == "Edit")
{
if (Have_Spic == true) { uc.SPicURL = this.SPicURL.Value; }
else { uc.SPicURL = _tmpPic.Replace(localSavedir, "{@dirfile}"); }
}
else
{
uc.SPicURL = _tmpPic.Replace(localSavedir, "{@dirfile}");
}
}
#endregion 生成小图
uc.ClassID = ClassID;
uc.SpecialID = SpecialID;
uc.Author = Author;
uc.Souce = Souce;
uc.Tags = Tags;
uc.NewsProperty = NewsProperty;
uc.Templet = Templet;
uc.Content = Content;
uc.vURL = vURL;
uc.naviContent = naviContent;
uc.Click = Click;
uc.Metakeywords = Metakeywords;
uc.Metadesc = Metadesc;
#region 得到当前新闻的上一条记录自动编号ID
int _IDStr = 0;
DataTable dts = rd.getClassContent(getDataLibStr,7);
if (dts != null && dts.Rows.Count > 0)
{
_IDStr = int.Parse(dts.Rows[0]["Id"].ToString());
dts.Clear(); dts.Dispose();
}
else
{
_IDStr = int.Parse(NetCMS.Common.Rand.Number(8));
}
#endregion 结束
uc.ContentPicTF = ContentPicTF;
uc.ContentPicURL = ContentPicURL;
uc.ContentPicSize = ContentPicSize;
uc.CommTF = CommTF;
uc.DiscussTF = DiscussTF;
uc.TopNum = 0;
uc.VoteTF = VoteTF;
uc.isDelPoint = isDelPoint;
uc.iPoint = iPoint;
uc.Gpoint = Gpoint;
uc.GroupNumber = GroupNumber;
if (VoteTF == 1)
{
//此处插入投票数据
int ismTF = 0;
if (this.ismTF.Checked) { ismTF = 1; }
int isMember = 0;
if (this.isMember.Checked) { isMember = 1; }
NetCMS.Model.VoteContent uc2 = new NetCMS.Model.VoteContent();
uc2.NewsID = NewsID;
uc2.voteTitle = NewsTitle;
uc2.creattime = getDateTime;
uc2.ismTF = ismTF;
uc2.isMember = isMember;
uc2.DataLib = getDataLibStr;
uc2.isTimeOutTime = DateTime.Parse(this.isTimeOutTime.Text);
uc2.voteContent = VoteContent;
if (VoteContent.IndexOf("|") == -1)
{
PageError("输入的投票参数错误,请仔细查看帮助说明!<li>可能原因:你输入的投票选项没有输入初始的投票数量。</li><li>格式:投票项|投票数</li>", "");
}
if (EditAction == "Edit")
{
//更新投票
rd.addUpdate_Vote(uc2,1);
}
else
{
//插入投票
string _VoteNum = getDateTime.Year + "" + getDateTime.Month + "" + getDateTime.Day + "" + getDateTime.Hour + "" + NetCMS.Common.Rand.Number(8);
uc2.voteNum = _VoteNum;
uc2.SiteID = site;
rd.addUpdate_Vote(uc2,0);
}
}
uc.isLock = isLock;
uc.Editor = pd.getUserName(UserNum);
uc.isVoteTF = 0;
#region 插入头条
if (NewsProperty_TTTF1 == "1")
{
if (this.PicTTTF.Checked)
{
uc.NewsPicTopline = 1;
NetCMS.Model.NewsContentTT uc1 = new NetCMS.Model.NewsContentTT();
uc1.NewsTF = 0;
uc1.NewsID = NewsID;
uc1.DataLib = getDataLibStr;
uc1.Creattime = DateTime.Parse((getDateTime).ToString());
uc1.tl_font = this.PageFontFamily.SelectedValue;
uc1.tl_style = int.Parse((this.PageFontStyle.SelectedValue).ToString());
uc1.tl_size = int.Parse((this.PagefontSize.Text).ToString());
uc1.tl_color = this.fontColor.Value;
uc1.tl_space = int.Parse((this.fontCellpadding.Text).ToString());
uc1.tl_PicColor = this.Imagesbgcolor.Value;
#region 动作
string _tl_Title = "";
if (this.topFontInfo.Text != null & this.topFontInfo.Text != "") { _tl_Title = this.topFontInfo.Text; }
else { _tl_Title = NewsTitle; }
uc1.tl_Title = _tl_Title;
uc1.tl_Width = int.Parse((this.PagePicwidth.Text).ToString());
uc1.SiteID = site;
string _tl_SavePath = "";
#region 更新头条
if (EditAction == "Edit")
{
if (_tl_SavePath != null && _tl_SavePath != "")
_tl_SavePath = this.tl_SavePath.Value;
else
_tl_SavePath = "/{@dirFile}/topline/" + getDateTime.Year + "-" + getDateTime.Month + "/" + NetCMS.Common.Rand.Number(15) + ".jpg";
uc1.tl_SavePath = this.tl_SavePath.Value;
rd.addUpdate_TT(uc1,1);
}
else
{
_tl_SavePath = "/{@dirFile}/topline/" + getDateTime.Year + "-" + getDateTime.Month + "/" + NetCMS.Common.Rand.Number(15) + ".jpg";
uc1.tl_SavePath = _tl_SavePath;
rd.addUpdate_TT(uc1,0);
}
#endregion 结束
#endregion 动作
#region 生成头条图片
string _dimmdirTT = "";
if (dimm
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -