📄 site.aspx.cs
字号:
{
PageError("请正确填写开始时间和结束时间", "site.aspx");
}
strNewsParams = (startTime.Text).ToString() + "$" + (endTime.Text).ToString();
newsBoolFlag = true;
}
else
{
if (newsid.Checked)
{
newsFlag = 5;
if ((NetCMS.Common.Input.IsInteger(startID.Text) == false) || (NetCMS.Common.Input.IsInteger(EndID.Text) == false))
{
PageError("请正确ID开始及ID结束", "site.aspx");
}
strNewsParams = startID.Text + "$" + EndID.Text;
newsBoolFlag = true;
}
}
}
}
}
}
int newsClassFlag = 1;//取发布栏目的参数
string strNewsClassParams = string.Empty;
bool classBoolFlag = false;
bool isIndex = false;
if (classall.Checked)
{
newsClassFlag = 0;
if (unHTMLclass.Checked)
{
strNewsClassParams = "#";
}
classBoolFlag = true;
isIndex = pIndex.Checked;
}
else
{
strNewsClassParams=getClassParams();
if (strNewsClassParams != null)
{
isIndex = pIndex.Checked;
classBoolFlag = true;
}
}
int specialFlag = 1;
string strSpecialParams = string.Empty;
bool specialBoolFlag = false;//取发布专题的参数
if (specialall.Checked)
{
specialFlag = 0;
specialBoolFlag = true;
}
else
{
strSpecialParams = getSpecialParams();
if (strSpecialParams!=null)
{
specialBoolFlag = true;
}
}
UltiPublish publishAll = new UltiPublish(true);
publishAll.IsPublishIndex = indexBoolFlag;
publishAll.IsPubNews = newsBoolFlag;
publishAll.IsPubClass = classBoolFlag;
publishAll.IsPubSpecial = specialBoolFlag;
publishAll.newsFlag = newsFlag;
publishAll.strNewsParams = strNewsParams;
publishAll.ClassFlag = newsClassFlag;
publishAll.strClassParams = strNewsClassParams;
publishAll.isClassIndex = isIndex;
publishAll.specialFlag = specialFlag;
publishAll.strSpecialParams = strSpecialParams;
//加入发布权限检测
if (indexBoolFlag)
{
this.Authority_Code = "P001";
this.CheckAdminAuthority();
}
if (newsBoolFlag)
{
this.Authority_Code = "P002";
this.CheckAdminAuthority();
}
if (classBoolFlag)
{
this.Authority_Code = "P003";
this.CheckAdminAuthority();
}
if (specialBoolFlag)
{
this.Authority_Code = "P004";
this.CheckAdminAuthority();
}
try
{
#region 备份首页文件
if (getbak)
{
string sourceFile = "~/" + NetCMS.Common.Public.readparamConfig("IndexFileName");
string str_dirPige = NetCMS.Config.UIConfig.dirPige;
if (File.Exists(Server.MapPath(sourceFile)))
{
string TagetFile = "~/" + str_dirPige + "/index/" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + ".shtml";
string hfile = "~/" + str_dirPige;
string TagetDir = "~/" + str_dirPige + "/index";
sourceFile = sourceFile.Replace("//", "/").Replace(@"\\", @"\");
TagetFile = TagetFile.Replace("//", "/").Replace(@"\\", @"\");
TagetDir = TagetDir.Replace("//", "/").Replace(@"\\", @"\");
hfile = hfile.Replace("//", "/").Replace(@"\\", @"\");
if (!Directory.Exists(Server.MapPath(hfile))) { Directory.CreateDirectory(Server.MapPath(hfile)); }
if (!Directory.Exists(Server.MapPath(TagetDir))) { Directory.CreateDirectory(Server.MapPath(TagetDir)); }
if (File.Exists(Server.MapPath(TagetFile))) { File.Delete(Server.MapPath(TagetFile)); }
File.Move(Server.MapPath(sourceFile), Server.MapPath(TagetFile));
}
}
#endregion 备份首页文件
publishAll.StartPublish();
}
finally
{
publishAll.CloseAllConnection();
}
Response.End();
}
}
/// <summary>
/// 获取选中newsClass时的参数字符串
/// </summary>
/// <returns>选中newsClass时的参数字符串</returns>
public string getNewsClassParams()
{
string classIds = null;
for (int i = 0; i < divClassNews.Items.Count; i++)
{
if (divClassNews.Items[i].Selected)
{
if (classIds != null)
{
classIds += "$" + divClassNews.Items[i].Value;
}
else
{
classIds = divClassNews.Items[i].Value;
}
}
}
return classIds;
}
/// <summary>
/// 获取发布栏目时的参数字符串
/// </summary>
/// <returns>发布栏目时的参数字符串</returns>
public string getClassParams()
{
string classIds = null;
for (int i = 0; i < divClassClass.Items.Count; i++)
{
if (divClassClass.Items[i].Selected)
{
if (classIds != null)
{
classIds += "$" + divClassClass.Items[i].Value;
}
else
{
classIds = divClassClass.Items[i].Value;
}
}
}
return classIds;
}
/// <summary>
/// 获取发布专题时的参数字符串
/// </summary>
/// <returns>发布专题时的参数字符串</returns>
public string getSpecialParams()
{
string classIds = null;
for (int i = 0; i < DivSpecial.Items.Count; i++)
{
if (DivSpecial.Items[i].Selected)
{
if (classIds != null)
{
classIds += "$" + DivSpecial.Items[i].Value;
}
else
{
classIds = DivSpecial.Items[i].Value;
}
}
}
return classIds;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -