示例#1
0
        private string GetCurrent_Pos(string paramStr, string pos, int currId, string tableName)
        {
            ArrayList list;
            string[] strArray2;
            int num;
            DataRow info;
            string paramValue = string.Empty;
            string str2 = ">>";
            string str3 = "false";
            this.GetParamValue(paramStr, "hrefcss", ref paramValue);
            this.GetParamValue(paramStr, "compart", ref str2);
            this.GetParamValue(paramStr, "showchannel", ref str3);
            if (paramValue != string.Empty)
            {
                paramValue = "class='" + paramValue + "'";
            }
            M_Channel channel = null;
            M_Column column = null;
            string indexUrl = string.Empty;
            string channelUrl = string.Empty;
            StringBuilder builder = new StringBuilder();
            switch (pos.ToLower())
            {
                case "index":
                    builder.Append(this.SiteModel.SiteName);
                    goto Label_0B9C;

                case "singlepage":
                    {
                        indexUrl = this.GetIndexUrl();
                        builder.Append("<a " + paramValue + " href='" + indexUrl + "'>");
                        builder.Append(this.SiteModel.SiteName);
                        builder.Append("</a>");
                        builder.Append(str2);
                        M_SinglePage model = new B_SinglePage().GetModel(currId);
                        if (model != null)
                        {
                            builder.Append(model.Name);
                            goto Label_0B9C;
                        }
                        return string.Empty;
                    }
                case "channel":
                    channel = this.ChannelBll.GetChannel(currId);
                    if (channel != null)
                    {
                        indexUrl = this.GetIndexUrl();
                        builder.Append("<a " + paramValue + " href='" + indexUrl + "'>");
                        builder.Append(this.SiteModel.SiteName);
                        builder.Append("</a>");
                        builder.Append(str2);
                        builder.Append(channel.ChName);
                        goto Label_0B9C;
                    }
                    return string.Empty;

                case "column":
                    column = this.ColumnBll.GetColumn(currId);
                    if (column != null)
                    {
                        channel = this.ChannelBll.GetChannel(column.ChId);
                        if (channel == null)
                        {
                            return string.Empty;
                        }
                        indexUrl = this.GetIndexUrl();
                        channelUrl = this.GetChannelUrl(channel.ChId);
                        builder.Append("<a " + paramValue + " href='" + indexUrl + "'>");
                        builder.Append(this.SiteModel.SiteName);
                        builder.Append("</a>");
                        builder.Append(str2);
                        if (str3 == "true")
                        {
                            builder.Append("<a " + paramValue + " href='" + channelUrl + "'>");
                            builder.Append(channel.ChName);
                            builder.Append("</a>");
                            builder.Append(str2);
                        }
                        column = this.ColumnBll.GetColumn(currId);
                        list = new ArrayList();
                        string[] strArray = new string[] { this.GetColumnUrl(column.ColId, 1), column.ColName };
                        list.Add(strArray);
                        if (column.ColParentId > 0)
                        {
                            while (column.ColParentId >= 0)
                            {
                                if (column.ColParentId > 0)
                                {
                                    column = this.ColumnBll.GetColumn(column.ColParentId);
                                }
                                else
                                {
                                    column = this.ColumnBll.GetColumn(column.ColId);
                                }
                                if (column == null)
                                {
                                    return string.Empty;
                                }
                                strArray2 = new string[] { this.GetColumnUrl(column.ColId, 1), column.ColName };
                                list.Add(strArray2);
                                if (column.ColParentId == 0)
                                {
                                    break;
                                }
                            }
                        }
                        break;
                    }
                    return string.Empty;

                case "info":
                    info = this.InfoOperBll.GetInfo(tableName, currId);
                    if (info != null)
                    {
                        int columnId = (int)info["colid"];
                        column = this.ColumnBll.GetColumn(columnId);
                        if (column == null)
                        {
                            return string.Empty;
                        }
                        channel = this.ChannelBll.GetChannel(column.ChId);
                        if (channel == null)
                        {
                            return string.Empty;
                        }
                        channelUrl = this.GetChannelUrl(channel.ChId);
                        indexUrl = this.GetIndexUrl();
                        builder.Append("<a " + paramValue + " href='" + indexUrl + "'>");
                        builder.Append(this.SiteModel.SiteName);
                        builder.Append("</a>");
                        builder.Append(str2);
                        if (str3 == "true")
                        {
                            builder.Append("<a " + paramValue + " href='" + channelUrl + "'>");
                            builder.Append(channel.ChName);
                            builder.Append("</a>");
                            builder.Append(str2);
                        }
                        list = new ArrayList();
                        string[] strArray3 = new string[] { this.GetColumnUrl(column.ColId, 1), column.ColName };
                        list.Add(strArray3);
                        if (column.ColParentId > 0)
                        {
                            while (column.ColParentId >= 0)
                            {
                                if (column.ColParentId > 0)
                                {
                                    column = this.ColumnBll.GetColumn(column.ColParentId);
                                }
                                else
                                {
                                    column = this.ColumnBll.GetColumn(column.ColId);
                                }
                                if (column == null)
                                {
                                    return string.Empty;
                                }
                                strArray2 = new string[] { this.GetColumnUrl(column.ColId, 1), column.ColName };
                                list.Add(strArray2);
                                if (column.ColParentId == 0)
                                {
                                    break;
                                }
                            }
                        }
                        num = list.Count - 1;
                        while (num >= 0)
                        {
                            strArray2 = new string[2];
                            strArray2 = (string[])list[num];
                            builder.Append("<a " + paramValue + " href='" + strArray2[0] + "'>");
                            builder.Append(strArray2[1]);
                            builder.Append("</a>");
                            builder.Append(str2);
                            num--;
                        }
                        builder.Append("内容阅读");
                        goto Label_0B9C;
                    }
                    return string.Empty;

                case "comment":
                    indexUrl = this.GetIndexUrl();
                    builder.Append("<a " + paramValue + " href='" + indexUrl + "'>");
                    builder.Append(this.SiteModel.SiteName);
                    builder.Append("</a>");
                    builder.Append(str2);
                    info = this.dal.GetInfoById(tableName, currId);
                    if (info != null)
                    {
                        string infoUrl = this.GetInfoUrl(info, 1);
                        string str8 = Ky.Common.Function.HtmlEncode(info["title"].ToString());
                        builder.Append("<a " + paramValue + " href='" + infoUrl + "'>");
                        builder.Append(str8);
                        builder.Append("</a>");
                        builder.Append(str2);
                        builder.Append("评论列表");
                        goto Label_0B9C;
                    }
                    return string.Empty;

                case "special":
                    {
                        M_Special special = this.SpecialBll.GetSpecial(currId);
                        if (special != null)
                        {
                            indexUrl = this.GetIndexUrl();
                            builder.Append("<a " + paramValue + " href='" + indexUrl + "'>");
                            builder.Append(this.SiteModel.SiteName);
                            builder.Append("</a>");
                            builder.Append(str2);
                            string specialCName = special.SpecialCName;
                            if (special.ParentID != 0)
                            {
                                special = this.SpecialBll.GetSpecial(special.ParentID);
                                if (special == null)
                                {
                                    return string.Empty;
                                }
                                string specialUrl = this.GetSpecialUrl(special.ID, 1);
                                builder.Append("<a " + paramValue + " href='" + specialUrl + "'>");
                                builder.Append(special.SpecialCName);
                                builder.Append("</a>");
                                builder.Append(str2);
                            }
                            builder.Append(specialCName);
                            goto Label_0B9C;
                        }
                        return string.Empty;
                    }
                default:
                    goto Label_0B9C;
            }
            for (num = list.Count - 1; num >= 0; num--)
            {
                strArray2 = new string[2];
                strArray2 = (string[])list[num];
                if (num > 0)
                {
                    builder.Append("<a " + paramValue + " href='" + strArray2[0] + "'>");
                    builder.Append(strArray2[1]);
                    builder.Append("</a>");
                    builder.Append(str2);
                }
                else
                {
                    builder.Append(strArray2[1]);
                }
            }
            Label_0B9C:
            return builder.ToString();
        }
示例#2
0
 public bool CreateSinglePage(int singleId)
 {
     M_SinglePage model = new B_SinglePage().GetModel(singleId);
     string path = Param.SiteRootPath + model.FolderPath;
     this.CreateDir(path);
     string templatePath = (path + model.FileName + model.FileExtend).Replace("/", @"\");
     return this.WriterTemplate(templatePath, this.GetSinglePage(singleId));
 }
示例#3
0
        public string GetSinglePage(int singleId)
        {
            M_SinglePage model = new B_SinglePage().GetModel(singleId);
            string templatePath = Param.SiteRootPath + model.TemplatePath.Replace("/", @"\");
            StringBuilder fileContent = new StringBuilder(this.GetContentByReplaceSysJS(this.ReadTemplate(templatePath)));
            this.ReplaceLabelNameToContent(fileContent);
            MatchCollection paramId = this.GetParamId(fileContent.ToString());
            foreach (Match match in paramId)
            {
                string newValue = string.Empty;
                if (match.Groups.Count > 1)
                {
                    switch (match.Groups[1].Value.Trim().ToLower())
                    {
                        case "my_pos":
                            newValue = this.GetCurrent_Pos(match.Value, "singlepage", singleId, "");
                            goto Label_0422;

                        case "ch_infolist":
                            newValue = this.Ch_GetInfoList(match.Value, 0);
                            goto Label_0422;

                        case "col_infolist":
                            newValue = this.Col_GetInfoList(match.Value, 0);
                            goto Label_0422;

                        case "ch_col_infolist":
                            newValue = this.Ch_Col_GetInfoList(match.Value, 0);
                            goto Label_0422;

                        case "col_childcol_infolist":
                            newValue = this.Col_ChildCol_GetInfoList(match.Value, 0);
                            goto Label_0422;

                        case "index_ch_nav":
                            newValue = this.Index_Ch_GetNav(match.Value);
                            goto Label_0422;

                        case "col_flashinfolist":
                            newValue = this.Col_GetFlashInfoList(match.Value, 0);
                            goto Label_0422;

                        case "page_info":
                            newValue = this.Index_GetPageInfo(match.Value);
                            goto Label_0422;

                        case "addfav":
                            newValue = this.GetAddFav(match.Value);
                            goto Label_0422;

                        case "report":
                            newValue = this.GetReport(match.Value);
                            goto Label_0422;

                        case "login":
                            newValue = this.GetLogin(match.Value);
                            goto Label_0422;

                        case "pvtotal":
                            newValue = this.GetPvTotal();
                            goto Label_0422;

                        case "article_txt_headerlist":
                            newValue = this.Article_Text_GetHeaderList(match.Value);
                            goto Label_0422;

                        case "article_img_headerlist":
                            newValue = this.Article_Img_GetHeaderList(match.Value);
                            goto Label_0422;

                        case "searchform":
                            newValue = this.GetSearchForm();
                            goto Label_0422;

                        case "sitename":
                            newValue = this.GetSiteName();
                            goto Label_0422;

                        case "domain":
                            newValue = this.GetDomainName();
                            goto Label_0422;

                        case "copyright":
                            newValue = this.GetCopyright();
                            goto Label_0422;

                        case "logo":
                            newValue = this.GetLogoAddress();
                            goto Label_0422;

                        case "banner":
                            newValue = this.GetBannerAddress();
                            goto Label_0422;

                        case "applicationpath":
                            newValue = this.GetApplicationPath();
                            goto Label_0422;

                        case "vote":
                            newValue = this.GetVote(match.Value);
                            goto Label_0422;

                        case "kylink":
                            newValue = this.GetLink(match.Value);
                            goto Label_0422;

                        case "infototal":
                            newValue = this.GetTotal();
                            goto Label_0422;
                    }
                    newValue = string.Empty;
                }
            Label_0422:
                fileContent.Replace(match.Value, newValue);
            }
            return fileContent.ToString();
        }