📄 ultipublish.cs
字号:
Pagestr += "<a " + postResult_css + " href=\"" + getPageresult(ID, ReadType, ContentType, ((i + 1) + 10), getFileName, getFileEXName, isPop) + "\" title=\"下十页\">" + getPageStyle("<font face=webdings>7</font>", postResult_color) + "</a> ";
}
}
if (i == (n - 1))
{
Pagestr += getPageStyle("<font face=webdings title=\"下一页\">4</font>", postResult_color) + " ";
Pagestr += getPageStyle("<font face=webdings title=\"尾页\">:</font>", postResult_color) + "</div>";
}
else
{
Pagestr += "<a " + postResult_css + " href=\"" + getPageresult(ID, ReadType, ContentType, (i + 2), getFileName, getFileEXName, isPop) + "\" title=\"下一页\">" + getPageStyle("<font face=webdings>4</font>", postResult_color) + "</a> ";
Pagestr += "<a " + postResult_css + " href=\"" + getPageresult(ID, ReadType, ContentType, n, getFileName, getFileEXName, isPop) + "\" title=\"尾页\">" + getPageStyle("<font face=webdings>:</font>", postResult_color) + "</a></div>";
}
break;
}
return Pagestr;
}
/// <summary>
/// 处理模板
/// </summary>
/// <param name="tempRe">模板实例</param>
/// <param name="existFlag">该模板是否存在于模板列表</param>
protected void makeHtmlFile(Template tempRe, bool existFlag, string classID, string NewsID)
{
tempRe.ReplaceLabels();
tempRe.ReplaceIMLabels();
if (tempRe.MyTempType == TempType.News)
{
string FinlContent = tempRe.FinallyContent;
int pos1 = FinlContent.IndexOf("<!-NT:STAR=");
int pos2 = FinlContent.IndexOf("NT:END->");
if (pos1 > -1)
{
int getFiledot = saveNewsPath.LastIndexOf(".");
int getFileg = saveNewsPath.LastIndexOf("\\");
string getFileName = saveNewsPath.Substring((getFileg + 1), ((getFiledot - getFileg) - 1));
string getFileEXName = saveNewsPath.Substring(getFiledot);
string PageHead = FinlContent.Substring(0, pos1);
string PageEnd = FinlContent.Substring(pos2 + 8);
string PageMid = FinlContent.Substring(pos1 + 11, pos2 - pos1 - 11);
string[] ArrayCon = PageMid.Split(new string[] { "[NT:PAGE]" }, StringSplitOptions.RemoveEmptyEntries);
int n = ArrayCon.Length;
//if (ArrayCon[n - 1] == null || ArrayCon[n - 1].Trim() == string.Empty)
// n--;
for (int i = 0; i < n; i++)
{
string filepath = SiteRootPath + saveNewsPath;
if (i > 0)
{
int laspot = filepath.LastIndexOf('.');
filepath = filepath.Substring(0, laspot) + "_" + (i + 1) + filepath.Substring(laspot);
}
string PageContent = PageHead + ArrayCon[i] + PageEnd;
string getFileContent = General.ReplaceResultPage(NewsID, PageContent.Replace("[NT:PAGE]", "").Replace("NT:END->", "").Replace("<!-NT:STAR=", ""), getFileName, getFileEXName, n, (i + 1), 0);
General.WriteHtml(getFileContent, filepath);
}
if (n > 0)
{
if (!existFlag)
{
templateList.Add(tempRe);
}
return;
}
}
}
General.WriteHtml(tempRe.FinallyContent.Replace("NT:END->", "").Replace("<!-NT:STAR=", ""), SiteRootPath + saveNewsPath);
if (!existFlag)
{
templateList.Add(tempRe);
}
}
/// <summary>
/// 得到要发布的所有新闻
/// </summary>
/// <param name="newsFlag">页面发布种类标志位</param>
/// <param name="strParams">页面信息字符串</param>
/// <returns>取得所有新闻的查询结果</returns>
protected IDataReader getAllNews()
{
switch (_newsFlag)
{
case 0: return getNewsAll();
case 1: return getNewsLast();
case 2: return getNewsUnhtml();
case 3: return getNewsClasses();
case 4: return getNewsDate();
case 5: return getNewsId();
default: return null;
}
}
/// <summary>
/// 选择发布所有新闻时,取得所有新闻
/// </summary>
/// <param name="strParams">页面信息字符串</param>
/// <returns>取得符合条件的所有新闻的查询结果</returns>
protected IDataReader getNewsAll()
{
return CommonData.DalPublish.GetPublishNewsAll(out nNewsCount);
}
/// <summary>
/// 选择发布最新时,取得所有新闻
/// </summary>
/// <param name="strParams">页面信息字符串</param>
/// <returns>取得符合条件的所有新闻的查询结果</returns>
protected IDataReader getNewsLast()
{
int ncount;
IDataReader rd = CommonData.DalPublish.GetPublishNewsLast(Convert.ToInt32(_strNewsParams), false, out ncount);
nNewsCount = Convert.ToInt32(_strNewsParams);
if (ncount < nNewsCount)
{
nNewsCount = ncount;
}
return rd;
}
/// <summary>
/// 选择只发布未生成时,取得所有新闻
/// </summary>
/// <param name="strParams">页面信息字符串</param>
/// <returns>取得符合条件的所有新闻的查询结果</returns>
protected IDataReader getNewsUnhtml()
{
int ncount;
IDataReader rd = CommonData.DalPublish.GetPublishNewsLast(Convert.ToInt32(_strNewsParams), true, out ncount);
nNewsCount = Convert.ToInt32(_strNewsParams);
if (ncount < nNewsCount)
{
nNewsCount = ncount;
}
return rd;
}
/// <summary>
/// 选择选择栏目时,取得所有新闻
/// </summary>
/// <param name="strParams">页面信息字符串</param>
/// <returns>取得符合条件的所有新闻的查询结果</returns>
protected IDataReader getNewsClasses()
{
bool IsHtml = false;//还没有起作用
bool IsDesc = false;//还没有起作用
if (_strNewsParams.IndexOf("#") >= 0)
{
//只发布未发布的
IsHtml = true;
_strNewsParams = _strNewsParams.Replace("#", "");
}
if (_strNewsParams.IndexOf("&") >= 0)
{
//倒序
IsDesc = true;
_strNewsParams = _strNewsParams.Replace("&", "");
}
string classid = "";
string[] PublishParam = _strNewsParams.Split('$');
int n = PublishParam.Length;
for (int i = 0; i < n - 1; i++)
{
if (i > 0)
classid += ",";
classid += "'" + PublishParam[i] + "'";
}
return CommonData.DalPublish.GetPublishNewsByClass(classid, IsHtml, IsDesc, PublishParam[n - 1], out nNewsCount);
}
/// <summary>
/// 选择按照日期发布时,取得所有新闻
/// </summary>
/// <param name="strParams">页面信息字符串</param>
/// <returns>取得符合条件的所有新闻的查询结果</returns>
protected IDataReader getNewsDate()
{
DateTime StartTm = Convert.ToDateTime(_strNewsParams.Split('$')[0]);
DateTime EndTm = Convert.ToDateTime(_strNewsParams.Split('$')[1]);
return CommonData.DalPublish.GetPublishNewsByTime(StartTm, EndTm, out nNewsCount);
}
/// <summary>
/// 选择按照ID发布时,取得所有新闻
/// </summary>
/// <param name="strParams">页面信息字符串</param>
/// <returns>取得符合条件的所有新闻的查询结果</returns>
protected IDataReader getNewsId()
{
int MinID = Convert.ToInt32(_strNewsParams.Split('$')[0]);
int MaxID = Convert.ToInt32(_strNewsParams.Split('$')[1]);
return CommonData.DalPublish.GetPublishNewsByID(MinID, MaxID, out nNewsCount);
}
/// <summary>
/// 得到要发布的所有栏目
/// </summary>
/// <param name="ClassFlag">页面发布种类标志位</param>
/// <returns>取得所有栏目的查询结果</returns>
protected IDataReader getAllClass()
{
switch (_ClassFlag)
{
case 0: return getClassesAll();
case 1: return getClassesSelect();
default: return null;
}
}
/// <summary>
/// 选择发布所有栏目时,取得所有栏目
/// </summary>
/// <param name="strClassParams">页面信息字符串</param>
/// <returns>取得符合条件的所有栏目的查询结果</returns>
protected IDataReader getClassesAll()
{
if (_strClassParams.IndexOf("#") >= 0)
{
return CommonData.DalPublish.GetPublishClass(NetCMS.Global.Current.SiteID, "", true, out nClassCount);
}
else
{
return CommonData.DalPublish.GetPublishClass(NetCMS.Global.Current.SiteID, "", false, out nClassCount);
}
}
/// <summary>
/// 选择发选择栏目时,取得所有栏目
/// </summary>
/// <returns>取得符合条件的所有栏目的查询结果</returns>
protected IDataReader getClassesSelect()
{
if (_strClassParams != null)
{
string classid = "";
string[] classparm = _strClassParams.Split('$');
for (int i = 0; i < classparm.Length; i++)
{
if (i > 0)
{
classid += ",";
}
classid += "'" + classparm[i] + "'";
}
return CommonData.DalPublish.GetPublishClass("", classid, true, out nClassCount);
}
else
{
HProgressBar.Roll("请选择栏目", 0);
return null;
}
}
/// <summary>
/// 得到要发布的所有专题
/// </summary>
/// <param name="specialFlag">页面发布种类标志位</param>
/// <returns>取得所有专题的查询结果</returns>
protected IDataReader getAllSpecials()
{
string spid = string.Empty;
switch (_specialFlag)
{
case 0:
break;
case 1:
spid = getSpecialsSelect();
break;
default:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -