Esempio n. 1
0
        public override string GetContent(string _ChannelId, string _ContentId, int _CurrentPage)
        {
            using (DbOperHandler _doh = new Common().Doh())
            {
                JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_ChannelId);
                if (_Channel.Enabled == false)
                {
                    return "频道错误";
                }
                _doh.Reset();
                _doh.SqlCmd = "SELECT [ClassId] FROM [jcms_module_photo] WHERE [ChannelId]=" + _ChannelId + " and [Id]=" + _ContentId;
                DataTable dtSearch = _doh.GetDataTable();
                if (dtSearch.Rows.Count == 0)
                {
                    dtSearch.Clear();
                    dtSearch.Dispose();
                    return "内容错误";
                }
                string ClassId = dtSearch.Rows[0]["ClassId"].ToString();
                dtSearch.Clear();
                dtSearch.Dispose();
                TemplateEngineDAL te = new TemplateEngineDAL(_ChannelId);
                _doh.Reset();
                _doh.SqlCmd = "SELECT Id FROM [jcms_normal_class] WHERE [IsOut]=0 AND [ChannelId]=" + _ChannelId + " and [Id]=" + ClassId;
                if (_doh.GetDataTable().Rows.Count == 0)
                {
                    return "栏目错误";
                }
                string PageStr = string.Empty;
                _doh.Reset();
                _doh.SqlCmd = "SELECT * FROM [jcms_module_photo] WHERE [ChannelId]=" + _ChannelId + " and [Id]=" + _ContentId;
                DataTable dtContent = _doh.GetDataTable();
                string _FirstPage = dtContent.Rows[0]["FirstPage"].ToString();
                System.Collections.ArrayList ContentList = new System.Collections.ArrayList();
                p__GetChannel_Photo(te, dtContent, ref PageStr, ref ContentList, 0);
                te.ReplaceContentTag(ref PageStr, _ContentId);
                te.ReplaceContentLoopTag(ref PageStr);//主要解决通过tags关联
                te.ExcuteLastHTML(ref PageStr);
                ContentList.Add(PageStr);
                p__replaceSinglePhoto(dtContent, ref _CurrentPage, ref PageStr, ref ContentList);
                int _TotalPage = Convert.ToInt16(ContentList[1].ToString());//总页数
                dtContent.Clear();
                dtContent.Dispose();

                string _PrevLink = _CurrentPage == 1 ? "#" : Go2View(_CurrentPage - 1, (_Channel.IsHtml), _ChannelId, _ContentId, false);
                string _NextLink = _CurrentPage == _TotalPage ? "#" : Go2View(_CurrentPage + 1, (_Channel.IsHtml), _ChannelId, _ContentId, false);
                string _html = ContentList[0].ToString();
                string[] ThisPhotoUrl = ContentList[2].ToString().Split(new string[] { "|||" }, StringSplitOptions.RemoveEmptyEntries);
                string CurrentPhotoUrl = ThisPhotoUrl[ThisPhotoUrl.Length - 1];
                string CurrentPhotoTitle = ThisPhotoUrl.Length == 1 ? "" : ThisPhotoUrl[0];
                return _html
                    .Replace("{$CurrentPage}", _CurrentPage.ToString())
                    .Replace("{$TotalPage}", ContentList[1].ToString())
                    .Replace("{$CurrentPhotoUrl}", CurrentPhotoUrl)
                    .Replace("{$CurrentPhotoTitle}", CurrentPhotoTitle)
                    .Replace("{$SlideJSON}", ContentList[3].ToString())
                    .Replace("{$PrevLink}", _PrevLink)
                    .Replace("{$NextLink}", _NextLink);
            }
        }
Esempio n. 2
0
        public override string GetContent(string _ChannelId, string _ContentId, int _CurrentPage)
        {
            using (DbOperHandler _doh = new Common().Doh())
            {
                JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_ChannelId);
                if (_Channel.Enabled == false)
                {
                    return "频道错误";
                }
                _doh.Reset();
                _doh.SqlCmd = "SELECT [ClassId] FROM [jcms_module_soft] WHERE [ChannelId]=" + _ChannelId + " and [Id]=" + _ContentId;
                DataTable dtSearch = _doh.GetDataTable();
                if (dtSearch.Rows.Count == 0)
                {
                    dtSearch.Clear();
                    dtSearch.Dispose();
                    return "内容错误";
                }
                string ClassId = dtSearch.Rows[0]["ClassId"].ToString();
                dtSearch.Clear();
                dtSearch.Dispose();
                TemplateEngineDAL te = new TemplateEngineDAL(_ChannelId);
                _doh.Reset();
                _doh.SqlCmd = "SELECT Id FROM [jcms_normal_class] WHERE [IsOut]=0 AND [ChannelId]=" + _ChannelId + " and [Id]=" + ClassId;
                if (_doh.GetDataTable().Rows.Count == 0)
                {
                    return "栏目错误";
                }
                string PageStr = string.Empty;
                _doh.Reset();
                _doh.SqlCmd = "SELECT * FROM [jcms_module_soft] WHERE [ChannelId]=" + _ChannelId + " and [Id]=" + _ContentId;
                DataTable dtContent = _doh.GetDataTable();
                System.Collections.ArrayList ContentList = new System.Collections.ArrayList();
                p__GetChannel_Soft(te, dtContent, ref PageStr, ref ContentList, 0);
                te.ReplaceContentTag(ref PageStr, _ContentId);
                te.ReplaceContentLoopTag(ref PageStr);//主要解决通过tags关联
                te.ExcuteLastHTML(ref PageStr);
                ContentList.Add(PageStr);
                p__replaceSingleSoft(dtContent, ref PageStr, ref ContentList);

                dtContent.Clear();
                dtContent.Dispose();
                return ContentList[0].ToString().Replace("{$DownUrl}", ContentList[1].ToString());
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 删除内容页
        /// </summary>
        /// <param name="_ChannelId"></param>
        /// <param name="_ContentId"></param>
        public void DeleteContent(string _ChannelId, string _ContentId)
        {
            JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_ChannelId);

            using (DbOperHandler _doh = new Common().Doh())
            {
                _doh.Reset();
                _doh.ConditionExpress = "[ChannelId]=" + _ChannelId + " AND [Id]=" + _ContentId;
                object[] _value = _doh.GetFields("jcms_module_" + _Channel.Type, "AddDate,FirstPage");
                string _date = _value[0].ToString();
                string _firstpage = _value[1].ToString();
                if (_firstpage.Length > 0 && _Channel.IsHtml)
                {
                    string _folderName = String.Format("/{0}{1}/{2}",
                        DateTime.Parse(_date).ToString("yyyy"),
                        DateTime.Parse(_date).ToString("MM"),
                        DateTime.Parse(_date).ToString("dd")
                        );
                    if (System.IO.Directory.Exists(HttpContext.Current.Server.MapPath(site.Dir + _Channel.Dir + _folderName)))
                    {
                        string htmFile = HttpContext.Current.Server.MapPath(Go2View(1, true, _ChannelId, _ContentId, true));
                        if (System.IO.File.Exists(htmFile))
                            System.IO.File.Delete(htmFile);
                        string[] htmFiles = System.IO.Directory.GetFiles(HttpContext.Current.Server.MapPath(site.Dir + _Channel.Dir + _folderName), _ContentId + "_*" + site.StaticExt);
                        foreach (string fileName in htmFiles)
                        {
                            if (System.IO.File.Exists(fileName))
                                System.IO.File.Delete(fileName);
                        }
                    }
                    _doh.Reset();
                    _doh.SqlCmd = "UPDATE [jcms_module_" + _Channel.Type + "] SET [FirstPage]='' WHERE [ChannelId]=" + _ChannelId + " AND [Id]=" + _ContentId;
                    _doh.ExecuteSqlNonQuery();
                }
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 获得栏目导航html
 /// </summary>
 /// <param name="ishtml"></param>
 /// <param name="_channelID"></param>
 /// <param name="_classId"></param>
 /// <returns></returns>
 protected string NavigateHtml(bool ishtml, string _ccID, string _classId)
 {
     JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_ccID);
     doh.Reset();
     doh.SqlCmd = "SELECT ID,Title,ParentId,[Code],[IsTop] FROM [jcms_normal_class] WHERE [ChannelId]=" + _ccID + " AND [Id]=" + _classId;
     DataTable dtClass = doh.GetDataTable();
     string ParentId = dtClass.Rows[0]["ParentId"].ToString();
     string ClassName = dtClass.Rows[0]["Title"].ToString();
     string ClassIsTop = dtClass.Rows[0]["IsTop"].ToString();
     dtClass.Clear();
     dtClass.Dispose();
     string MyClassPath = "";
     if (ClassIsTop == "0")
         MyClassPath = "";
     else
         MyClassPath = "&nbsp;&raquo;&nbsp;<a href=\"" + Go2Class(1, _Channel.IsHtml, _ccID, _classId, false) + "\">" + ClassName + "</a>";
     if (ParentId == "0")
         return MyClassPath;
     else
         return NavigateHtml(ishtml, _ccID, ParentId) + MyClassPath;
 }
Esempio n. 5
0
 protected void CreateClassNavigate(string _ccID, string _classId)
 {
     JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_ccID);
     System.Text.StringBuilder sb_js = new System.Text.StringBuilder();
     sb_js.Append("document.write('<a href=\"" + Go2Site(site.IsHtml) + "\" class=\"home\"></a>");
     if (_Channel.IsTop)
         sb_js.Append("&nbsp;&raquo;&nbsp;<a href=\"" + Go2Channel(site.IsHtml, _ccID, false) + "\">" + _Channel.Title + "</a>");
     sb_js.Append(NavigateHtml(site.IsHtml, _ccID, _classId));
     sb_js.Append("');");
     string js = "";
     doh.Reset();
     doh.SqlCmd = "SELECT ID,Title,[dir] FROM [jcms_normal_channel] WHERE [Enabled]=1 AND [Id]=" + _ccID;
     DataTable dtChannel = doh.GetDataTable();
     js = Server.MapPath(site.Dir + dtChannel.Rows[0]["dir"].ToString() + "/js/classnav_" + _classId + ".js");
     SaveJsFile(sb_js.ToString(), js);
     dtChannel.Clear();
     dtChannel.Dispose();
 }
Esempio n. 6
0
 /// <summary>
 /// 管理中心初始,并获得频道的各项参数值
 /// </summary>
 /// <param name="powerNum">权限</param>
 /// <param name="isChannel">如果为false就表示ChannelId可以为0</param>
 protected void Admin_Load(string powerNum, string pageType, bool isChannel)
 {
     chkPower(powerNum, pageType);
     if (isChannel && ChannelId == "0")
     {
         showErrMsg("参数错误,请不要在外部提交数据", pageType);
         return;
     }
     if (ChannelId != "0")
     {
         JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(ChannelId);
         ChannelName = _Channel.Title;
         ChannelDir = _Channel.Dir;
         ChannelType = _Channel.Type;
         ChannelItemName = _Channel.ItemName;
         ChannelItemUnit = _Channel.ItemUnit;
         ChannelClassDepth = _Channel.ClassDepth;
         ChannelIsHtml = _Channel.IsHtml;
         //去掉标签后的实际路径
         ChannelUploadPath = _Channel.UploadPath;
         ChannelUploadType = _Channel.UploadType;
         ChannelUploadSize = _Channel.UploadSize;
         MainChannel = _Channel;
     }
 }
Esempio n. 7
0
 /// <summary>
 /// 链接到内容页
 /// </summary>
 /// <param name="_page">页码</param>
 /// <param name="_ishtml">是否静态</param>
 /// <param name="_channelid">频道ID</param>
 /// <param name="_contentid">内容ID</param>
 /// <param name="_initialize">是否初始化</param>
 /// <returns></returns>
 public string Go2View(int _page, bool _ishtml, string _channelid, string _contentid, bool _truefile)
 {
     JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_channelid);
     return ModuleCommand.GetContentLink(_Channel.Type.ToLower(), _page, _ishtml, _channelid, _contentid, _truefile);
 }
Esempio n. 8
0
 /// <summary>
 /// 链接到RSS页
 /// </summary>
 /// <param name="_page"></param>
 /// <param name="_ishtml"></param>
 /// <param name="_channelid"></param>
 /// <param name="_classid"></param>
 /// <returns></returns>
 public string Go2Rss(int _page, bool _ishtml, string _channelid, string _classid)
 {
     JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_channelid);
     string TempUrl = PageFormat.Rss(_ishtml, site.Dir, site.UrlReWriter, _page);
     TempUrl = TempUrl.Replace("<#SiteDir#>", site.Dir);
     TempUrl = TempUrl.Replace("<#SiteStaticExt#>", site.StaticExt);
     TempUrl = TempUrl.Replace("<#ChannelId#>", _channelid);
     TempUrl = TempUrl.Replace("<#ChannelDir#>", _Channel.Dir.ToLower());
     TempUrl = TempUrl.Replace("<#ChannelType#>", _Channel.Type.ToLower());
     TempUrl = TempUrl.Replace("<#id#>", _classid);
     if (_page > 0) TempUrl = TempUrl.Replace("<#page#>", _page.ToString());
     return TempUrl;
 }
Esempio n. 9
0
        /// <summary>
        /// 提取列表供列表标签使用
        /// </summary>
        /// <param name="Parameter"></param>
        /// <returns></returns>
        private string getContentList_RL(string _tagcontent, string _tempstr)
        {
            using (DbOperHandler _doh = new Common().Doh())
            {
                string _viewstr = string.Empty;
                string _tagrepeatnum = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent, "repeatnum");
                if (_tagrepeatnum == "") _tagrepeatnum = "10";
                string _tagchannelid = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent, "channelid");
                if (_tagchannelid == "") _tagchannelid = "0";
                string _tagchanneltype = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent, "channeltype");
                if (_tagchanneltype == "") _tagchanneltype = "article";
                string _tagclassid = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent, "classid");
                if (_tagclassid == "") _tagclassid = "0";
                string _tagfields = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent, "fields");
                string _tagorderfield = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent, "orderfield");
                if (_tagorderfield == "") _tagorderfield = "adddate";
                string _tagordertype = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent, "ordertype");
                if (_tagordertype == "") _tagordertype = "desc";
                string _tagistop = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent, "istop");
                if (_tagistop == "") _tagistop = "0";
                string _tagisfocus = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent, "isfocus");
                if (_tagisfocus == "") _tagisfocus = "0";
                string _tagisimg = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent, "isimg");
                if (_tagisimg == "") _tagisimg = "0";
                string _tagtimerange = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent, "timerange");
                string _tagexceptids = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent, "exceptids");
                string _tagwherestr = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent, "wherestr");
                string _tagislike = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent, "islike");
                string _tagkeywords = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent, "keywords");
                string _ccType = string.Empty;
                if (_tagchannelid != "0")
                {
                    _doh.Reset();
                    _doh.SqlCmd = "SELECT [Id],[Type] FROM [jcms_normal_channel] WHERE [Id]=" + _tagchannelid + " AND [Enabled]=1";
                    DataTable dtChannel = _doh.GetDataTable();
                    if (dtChannel.Rows.Count > 0)
                    {
                        _ccType = dtChannel.Rows[0]["Type"].ToString();
                    }
                    else
                    {
                        return "&nbsp;频道参数错误";
                    }
                    dtChannel.Clear();
                    dtChannel.Dispose();
                }
                else
                {
                    _ccType = _tagchanneltype;
                }
                JumboTCMS.DAL.Normal_ChannelDAL dal = new JumboTCMS.DAL.Normal_ChannelDAL();
                dal.ExecuteTags(ref _tempstr, _tagchannelid);
                if (_tagclassid != "0")
                    executeTag_Class(ref _tempstr, _tagclassid);

                string sql = "SELECT TOP " + _tagrepeatnum + " [Id],[ChannelId],(select ishtml from [jcms_normal_channel] where id=[jcms_module_" + _ccType + "].channelid) as channelishtml,[ClassId],[FirstPage]," + _tagfields + " FROM [jcms_module_" + _ccType + "] WHERE ([IsPass]=1";
                if (_tagchannelid != "0")
                {
                    string isChannel = " AND [ChannelId]=" + _tagchannelid;
                    sql += isChannel;
                    if (_tagclassid != "0")
                        sql += " And [ClassId] in (SELECT ID FROM [jcms_normal_class] WHERE [IsOut]=0 AND [Code] Like (SELECT Code FROM [jcms_normal_class] WHERE [IsOut]=0 AND [Id]=" + _tagclassid + isChannel + ")+'%')" + isChannel;
                }
                else
                {
                    if (_tagclassid != "0")
                        sql += " And [ClassId] in (SELECT ID FROM [jcms_normal_class] WHERE [IsOut]=0 AND [Code] Like (SELECT Code FROM [jcms_normal_class] WHERE [IsOut]=0 AND [Id]=" + _tagclassid + ")+'%')";
                    else
                        sql += " And [ChannelId] in (SELECT ID FROM [jcms_normal_channel] WHERE [Type]='" + _ccType + "' AND [Enabled]=1)";

                }
                if (_tagistop == "1")
                    sql += " And [IsTop]=1";
                else if (_tagistop == "-1")
                    sql += " And [IsTop]=0";
                if (_tagisfocus == "1")
                    sql += " And [IsFocus]=1";
                if (DBType == "0")
                {
                    switch (_tagtimerange)
                    {
                        case "1d":
                            sql += " AND datediff('d',AddDate,'" + DateTime.Now.ToShortDateString() + "')=0";
                            break;
                        case "1w":
                            sql += " AND datediff('ww',AddDate,'" + DateTime.Now.ToShortDateString() + "')=0";
                            break;
                        case "1m":
                            sql += " AND datediff('m',AddDate,'" + DateTime.Now.ToShortDateString() + "')=0";
                            break;
                        case "1y":
                            sql += " AND AddDate>=#" + (DateTime.Now.Year + "-1-1") + "#";
                            break;
                    }
                }
                else
                {
                    switch (_tagtimerange)
                    {
                        case "1d":
                            sql += " AND datediff(d,AddDate,'" + DateTime.Now.ToShortDateString() + "')=0";
                            break;
                        case "1w":
                            sql += " AND datediff(ww,AddDate,'" + DateTime.Now.ToShortDateString() + "')=0";
                            break;
                        case "1m":
                            sql += " AND datediff(m,AddDate,'" + DateTime.Now.ToShortDateString() + "')=0";
                            break;
                        case "1y":
                            sql += " AND AddDate>='" + (DateTime.Now.Year + "-1-1") + "'";
                            break;
                    }
                }
                if (_tagisimg == "1")
                    sql += " And [IsImg]=1 And (right(Img,4)='.jpg' Or right(Img,4)='.gif')";
                if (_tagwherestr != "")
                    sql += " AND " + _tagwherestr.Replace("小于", "<").Replace("大于", ">").Replace("不等于", "<>");
                if (_tagexceptids != "")
                    sql += " AND id not in(" + _tagexceptids + ")";
                if (_tagislike == "1")
                {
                    if (_tagkeywords == "") _tagkeywords = "将博";
                    _tagkeywords = _tagkeywords.Replace(",", " ").Replace("、", " ");
                    string[] key = _tagkeywords.Split(new string[] { " " }, StringSplitOptions.None);
                    string _joinstr = " AND (";
                    for (int i = 0; i < key.Length; i++)
                    {
                        if (key[i].Length > 1)
                        {
                            if (i == 0)
                                _joinstr += "[Tags] LIKE '%" + key[i].Trim() + "%'";
                            else
                                _joinstr += " OR [Tags] LIKE '%" + key[i].Trim() + "%'";
                        }
                    }
                    _joinstr += ")";
                    sql += _joinstr;
                }
                if (_tagorderfield.ToLower() != "rnd")
                {
                    if (_tagorderfield.ToLower() != "adddate")
                        sql += ") ORDER BY " + _tagorderfield + " " + _tagordertype + ",adddate Desc,id Desc";
                    else
                        sql += ") ORDER BY " + _tagorderfield + " " + _tagordertype + ",id Desc"; ;
                }
                else
                {
                    sql += ")" + ORDER_BY_RND();
                }
                _doh.Reset();
                _doh.SqlCmd = sql;
                DataTable dt = _doh.GetDataTable();
                string ReplaceStr = operateContentTag(_ccType, dt, _tempstr);
                ReplaceStr = ReplaceStr.Replace("{$ContentCount}", dt.Rows.Count.ToString());
                dt.Clear();
                dt.Dispose();
                return ReplaceStr;

            }
        }
Esempio n. 10
0
 /// <summary>
 /// 替换循环频道标签(将频道信息赋值给循环体)(解析次序:5)
 /// </summary>
 /// <param name="_pagestr"></param>
 private void replaceTag_ChannelLoop(ref string _pagestr)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         string RegexString = "<jcms:channelloop (?<tagcontent>.*?)>(?<tempstr>.*?)</jcms:channelloop>";
         string[] _tagcontent = JumboTCMS.Utils.Strings.GetRegValue(_pagestr, RegexString, "tagcontent", false);
         string[] _tempstr = JumboTCMS.Utils.Strings.GetRegValue(_pagestr, RegexString, "tempstr", false);
         if (_tagcontent.Length > 0)//标签存在
         {
             string _loopbody = string.Empty;
             string _replacestr = string.Empty;
             string _viewstr = string.Empty;
             string _tagrepeatnum, _tagisnav, _tagselectids, _tagorderfield, _tagordertype, _tagwherestr = string.Empty;
             for (int i = 0; i < _tagcontent.Length; i++)
             {
                 _loopbody = "<jcms:channelloop " + _tagcontent[i] + ">" + _tempstr[i] + "</jcms:channelloop>";
                 _tagisnav = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent[i], "isnav");
                 if (_tagisnav == "") _tagisnav = "0";
                 _tagrepeatnum = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent[i], "repeatnum");
                 _tagselectids = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent[i], "selectids");
                 _tagorderfield = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent[i], "orderfield");
                 if (_tagorderfield == "") _tagorderfield = "pid";
                 _tagordertype = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent[i], "ordertype");
                 if (_tagordertype == "") _tagordertype = "asc";
                 _tagwherestr = JumboTCMS.Utils.Strings.AttributeValue(_tagcontent[i], "wherestr");
                 _doh.Reset();
                 string _sql = "select top " + _tagrepeatnum + " * FROM [jcms_normal_channel] WHERE [Enabled]=1";
                 if (_tagisnav == "1")
                     _sql += " AND [IsNav]=1";
                 if (_tagselectids != "")
                     _sql += " AND id in (" + _tagselectids.Replace("|", ",") + ")";
                 if (_tagwherestr != "")
                     _sql += " and " + _tagwherestr;
                 _sql += " ORDER BY " + _tagorderfield + " " + _tagordertype;
                 _doh.SqlCmd = _sql;
                 DataTable _dt = _doh.GetDataTable();
                 StringBuilder sb = new StringBuilder();
                 for (int j = 0; j < _dt.Rows.Count; j++)
                 {
                     _viewstr = _tempstr[i];
                     DataRow dr = _dt.Rows[j];
                     JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(dr);
                     new JumboTCMS.DAL.Normal_ChannelDAL().ExecuteTags(ref _viewstr, _Channel);
                     //_viewstr = _viewstr.Replace("{$ChannelId}", _dt.Rows[j]["Id"].ToString());
                     //_viewstr = _viewstr.Replace("{$ChannelName}", _dt.Rows[j]["Title"].ToString());
                     sb.Append(_viewstr);
                 }
                 _pagestr = _pagestr.Replace(_loopbody, sb.ToString());
                 _dt.Clear();
                 _dt.Dispose();
             }
         }
     }
 }
Esempio n. 11
0
 private JumboTCMS.Entity.Normal_ClassTree getTree(DbOperHandler _doh, string _channelid, string _classid, bool _includechild)
 {
     JumboTCMS.Entity.Normal_ClassTree _tree = new JumboTCMS.Entity.Normal_ClassTree();
     JumboTCMS.Entity.Normal_Channel _channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_channelid);
     bool _channelishtml = site.IsHtml && _channel.IsHtml;
     if (_classid == "0")//表示从根节点开始
     {
         _tree.Id = _channel.Id;
         _tree.Name = _channel.Title;
         _tree.Link = Go2Channel(site.IsHtml, _channelid, false);
         _tree.RssUrl = "";
     }
     else
     {
         JumboTCMS.Entity.Normal_Class _class = new JumboTCMS.DAL.Normal_ClassDAL().GetEntity(_classid);
         _tree.Id = _classid;
         _tree.Name = _class.Title;
         _tree.Link = Go2Class(1, _channelishtml, _channelid, _classid, false);
         _tree.RssUrl = Go2Rss(1, false, _channelid, _classid);
     }
     _tree.HasChild = HasChild(_channelid, _classid);
     List<JumboTCMS.Entity.Normal_ClassTree> subtree = new List<JumboTCMS.Entity.Normal_ClassTree>();
     if (_includechild)
     {
         _doh.Reset();
         _doh.SqlCmd = "SELECT Id FROM [jcms_normal_class] WHERE [ChannelId]=" + _channelid + " AND [ParentId]=" + _classid + " order by code";
         DataTable dtClass = _doh.GetDataTable();
         for (int i = 0; i < dtClass.Rows.Count; i++)
         {
             string _subclassid = dtClass.Rows[i]["Id"].ToString();
             subtree.Add(getTree(_doh, _channelid, _subclassid, _includechild));
         }
         dtClass.Clear();
         dtClass.Dispose();
     }
     _tree.SubChild = subtree;
     return _tree;
 }
Esempio n. 12
0
 /// <summary>
 /// 链接到栏目页
 /// </summary>
 /// <param name="_page"></param>
 /// <param name="_ishtml"></param>
 /// <param name="_channelid"></param>
 /// <param name="_classid"></param>
 /// <returns></returns>
 public string GetClassLink(int _page, bool _ishtml, string _channelid, string _classid, bool _truefile)
 {
     JumboTCMS.Entity.Normal_Class _Class = new JumboTCMS.DAL.Normal_ClassDAL().GetEntity(_classid);
     if (!_Class.IsOut)
     {
         JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_channelid);
         string TempUrl = JumboTCMS.Common.PageFormat.Class(_ishtml, site.Dir, site.UrlReWriter, _page);
         if ((_Channel.SubDomain.Length > 0) && (!_truefile))
             TempUrl = TempUrl.Replace("<#SiteDir#><#ChannelDir#>", _Channel.SubDomain);
         TempUrl = TempUrl.Replace("<#SiteDir#>", site.Dir);
         TempUrl = TempUrl.Replace("<#SiteStaticExt#>", site.StaticExt);
         TempUrl = TempUrl.Replace("<#ChannelId#>", _channelid);
         TempUrl = TempUrl.Replace("<#ChannelDir#>", _Channel.Dir.ToLower());
         TempUrl = TempUrl.Replace("<#ChannelType#>", _Channel.Type.ToLower());
         TempUrl = TempUrl.Replace("<#ClassFilePath#>", _Class.FilePath.ToLower());
         TempUrl = TempUrl.Replace("<#id#>", _classid);
         if (_page > 0) TempUrl = TempUrl.Replace("<#page#>", _page.ToString());
         return TempUrl;
     }
     else
         return _Class.FirstPage;
 }
Esempio n. 13
0
 /// <summary>
 /// 得到内容页地址
 /// </summary>
 /// <param name="_page"></param>
 /// <param name="_ishtml"></param>
 /// <param name="_channelid"></param>
 /// <param name="_contentid"></param>
 /// <param name="_truefile"></param>
 /// <returns></returns>
 public string GetContentLink(int _page, bool _ishtml, string _channelid, string _contentid, bool _truefile)
 {
     JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_channelid);
     object[] _value = new ModuleContentDAL().GetSome(_channelid, _Channel.Type, _contentid);
     string _date = _value[0].ToString();
     string _firstpage = _value[1].ToString();
     string _aliaspage = _value[2].ToString();
     string TempUrl = JumboTCMS.Common.PageFormat.View(_ishtml, site.Dir, site.UrlReWriter, _page);
     if (_aliaspage.Length > 5 && _page == 1 && _ishtml)
         return _aliaspage;
     if ((_Channel.SubDomain.Length > 0) && (!_truefile))
         TempUrl = TempUrl.Replace("<#SiteDir#><#ChannelDir#>", _Channel.SubDomain);
     TempUrl = TempUrl.Replace("<#SiteDir#>", site.Dir);
     TempUrl = TempUrl.Replace("<#SiteStaticExt#>", site.StaticExt);
     TempUrl = TempUrl.Replace("<#ChannelId#>", _channelid);
     TempUrl = TempUrl.Replace("<#ChannelDir#>", _Channel.Dir.ToLower());
     TempUrl = TempUrl.Replace("<#ChannelType#>", _Channel.Type.ToLower());
     TempUrl = TempUrl.Replace("<#id#>", _contentid);
     if (_date != "")
     {
         TempUrl = TempUrl.Replace("<#year#>", DateTime.Parse(_date).ToString("yyyy"));
         TempUrl = TempUrl.Replace("<#month#>", DateTime.Parse(_date).ToString("MM"));
         TempUrl = TempUrl.Replace("<#day#>", DateTime.Parse(_date).ToString("dd"));
     }
     if (_page > 0) TempUrl = TempUrl.Replace("<#page#>", _page.ToString());
     return TempUrl;
 }
Esempio n. 14
0
        public virtual string GetContent(string _ChannelId, string _ContentId, int _CurrentPage)
        {
            using (DbOperHandler _doh = new Common().Doh())
            {
                JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_ChannelId);
                if (_Channel.Enabled == false)
                {
                    return "频道错误";
                }
                _doh.Reset();
                _doh.SqlCmd = "SELECT [ClassId] FROM [jcms_module_article] WHERE [ChannelId]=" + _ChannelId + " and [Id]=" + _ContentId;
                DataTable dtSearch = _doh.GetDataTable();
                if (dtSearch.Rows.Count == 0)
                {
                    dtSearch.Clear();
                    dtSearch.Dispose();
                    return "内容错误";
                }
                string ClassId = dtSearch.Rows[0]["ClassId"].ToString();
                dtSearch.Clear();
                dtSearch.Dispose();
                TemplateEngineDAL te = new TemplateEngineDAL(_ChannelId);
                _doh.Reset();
                _doh.SqlCmd = "SELECT Id FROM [jcms_normal_class] WHERE [IsOut]=0 AND [ChannelId]=" + _ChannelId + " and [Id]=" + ClassId;
                if (_doh.GetDataTable().Rows.Count == 0)
                {
                    return "栏目错误";
                }
                string PageStr = string.Empty;
                _doh.Reset();
                _doh.SqlCmd = "SELECT * FROM [jcms_module_article] WHERE [ChannelId]=" + _ChannelId + " and [Id]=" + _ContentId;
                DataTable dtContent = _doh.GetDataTable();
                string _FirstPage = dtContent.Rows[0]["FirstPage"].ToString();
                System.Collections.ArrayList ContentList = new System.Collections.ArrayList();
                p__GetChannel_Article(te, dtContent, ref PageStr, ref ContentList, 0);
                te.ReplaceContentTag(ref PageStr, _ContentId);
                te.ReplaceContentLoopTag(ref PageStr);//主要解决通过tags关联
                te.ExcuteLastHTML(ref PageStr);
                ContentList.Add(PageStr);
                p__replaceSingleArticle(dtContent, ref _CurrentPage, ref PageStr, ref ContentList);

                dtContent.Clear();
                dtContent.Dispose();

                return ContentList[0].ToString().Replace("{$Content}", ContentList[_CurrentPage].ToString()).Replace("{$_getPageBar()}", getPageBar(1, "html", 7, ContentList.Count - 1, 1, _CurrentPage, Go2View(1, (_Channel.IsHtml), _ChannelId, _ContentId, false), Go2View(-1, (_Channel.IsHtml), _ChannelId, _ContentId, false), Go2View(-1, (_Channel.IsHtml), _ChannelId, _ContentId, false), 0));
            }
        }
Esempio n. 15
0
 public string GetChannelLink(bool _ishtml, string _channelid, bool _truefile)
 {
     JumboTCMS.Entity.Normal_Channel _Channel = new JumboTCMS.DAL.Normal_ChannelDAL().GetEntity(_channelid);
     string TempUrl = JumboTCMS.Common.PageFormat.Channel(site.Dir, site.UrlReWriter);
     if ((_Channel.SubDomain.Length > 0) && (!_truefile))
         TempUrl = TempUrl.Replace("<#SiteDir#><#ChannelDir#>", _Channel.SubDomain);
     TempUrl = TempUrl.Replace("<#SiteDir#>", site.Dir);
     TempUrl = TempUrl.Replace("<#SiteStaticExt#>", site.StaticExt);
     TempUrl = TempUrl.Replace("<#ChannelId#>", _channelid);
     TempUrl = TempUrl.Replace("<#ChannelDir#>", _Channel.Dir);
     return TempUrl;
 }