Esempio n. 1
0
        /// <summary>
        /// 获取生成静态地址
        /// </summary>
        /// <param name="context"></param>
        public void getpublishsite(HttpContext context)
        {
            string lang = MXRequest.GetQueryString("lang");
            string name = MXRequest.GetQueryString("name");
            string type = MXRequest.GetQueryString("type");

            StringBuilder sbjson = new StringBuilder();
            //获得URL配置列表
            BLL.url_rewrite bll = new BLL.url_rewrite();
            List<Model.url_rewrite> ls = (!string.IsNullOrEmpty(type)) ? bll.GetList(name, type) : bll.GetList(name);
            string linkurl = string.Empty;
            sbjson.Append("[");
            foreach (Model.url_rewrite modeltrewrite in ls)
            {
                if (modeltrewrite.url_rewrite_items.Count > 0)
                {
                    if (modeltrewrite.channel == string.Empty || modeltrewrite.channel == name)
                    {
                        //遍历URL字典的子节点
                        foreach (Model.url_rewrite_item item in modeltrewrite.url_rewrite_items)
                        {
                            if (item.querystring == string.Empty)
                            {
                                linkurl = string.Format("{0}/{1}/{2}", MXKeys.DIRECTORY_REWRITE_ASPX, lang, modeltrewrite.page);
                                string HTMLPattern = string.Format("{0}/{1}/{2}", MXKeys.DIRECTORY_REWRITE_HTML, lang, Utils.GetUrlExtension(item.pattern, config.staticextension)); //替换扩展名
                                if (sbjson.ToString().Length > 1)
                                    sbjson.Append(",");
                                sbjson.AppendFormat(urlstr, config.webpath, lang, linkurl, HTMLPattern);
                            }
                            else
                            {
                                if (sbjson.ToString().Length > 1)
                                    sbjson.Append(",");
                                switch (modeltrewrite.type.ToLower())
                                {
                                    case "list":
                                        sbjson.Append(GetArticleUrlList(lang, name, modeltrewrite.page, item.pattern, item.path, item.querystring, objchannel.GetPageSize(name)));
                                        break;
                                    case "detail":
                                        sbjson.Append(GetDetailUrlList(lang, name, modeltrewrite.page, item.pattern, item.path, item.querystring));
                                        break;
                                    case "category":
                                        sbjson.Append(GetCategoryUrlList(lang, name, modeltrewrite.page, item.pattern, item.path, item.querystring, objchannel.GetPageSize(name)));
                                        break;
                                }
                            }
                        }
                    }
                }
            }
            sbjson.Append("]");
            context.Response.Write(sbjson.ToString());
        }
        private void MarkTemplates(string dirName)
        {
            BLL.url_rewrite          bll = new BLL.url_rewrite();
            List <Model.url_rewrite> ls  = bll.GetList("");
            //插件目录
            string pluginPath = Utils.GetMapPath("../../plugins/" + dirName + "/templet/");

            if (!Directory.Exists(pluginPath))
            {
                return;
            }
            DirectoryInfo dirInfo = new DirectoryInfo(pluginPath);

            foreach (FileInfo file in dirInfo.GetFiles())
            {
                if (!file.Name.StartsWith("_") && file.Name.EndsWith(".html"))
                {
                    foreach (Model.url_rewrite model in ls)
                    {
                        if (file.Name.ToLower() == model.templet && !string.IsNullOrEmpty(model.inherit))
                        {
                            //生成模板文件
                            PageTemplate.GetTemplate(siteConfig.webpath, "plugins/" + dirName, "templet", model.templet, model.page, model.inherit, 0, 1);
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 生成全部模板
        /// </summary>
        private void MarkTemplates(string buildPath, string skinName)
        {
            //取得ASP目录下的所有文件
            string        fullDirPath = Utils.GetMapPath(string.Format("{0}aspx/{1}/", siteConfig.webpath, buildPath));
            DirectoryInfo dirFile     = new DirectoryInfo(fullDirPath);

            //获得URL配置列表
            BLL.url_rewrite          bll = new BLL.url_rewrite();
            List <Model.url_rewrite> ls  = bll.GetList("");

            //删除不属于URL映射表里的文件,防止冗余
            if (Directory.Exists(fullDirPath))
            {
                foreach (FileInfo file in dirFile.GetFiles())
                {
                    //检查文件
                    Model.url_rewrite modelt = ls.Find(p => p.page.ToLower() == file.Name.ToLower());
                    if (modelt == null)
                    {
                        file.Delete();
                    }
                }
            }

            //遍历URL配置列表
            foreach (Model.url_rewrite modelt in ls)
            {
                //如果URL配置对应的模板文件存在则生成
                string fullPath = Utils.GetMapPath(string.Format("{0}templates/{1}/{2}", siteConfig.webpath, skinName, modelt.templet));
                if (File.Exists(fullPath))
                {
                    PageTemplate.GetTemplate(siteConfig.webpath, "templates", skinName, modelt.templet, modelt.page, modelt.inherit, buildPath, 1);
                }
            }
        }
Esempio n. 4
0
 private void MarkTemplates(string dirName)
 {
     BLL.url_rewrite bll = new BLL.url_rewrite();
     List<Model.url_rewrite> ls = bll.GetList("");
     //业务模块目录
     string pluginPath = Utils.GetMapPath("../../plugins/" + dirName + "/templet/");
     if (!Directory.Exists(pluginPath))
     {
         return;
     }
     DirectoryInfo dirInfo = new DirectoryInfo(pluginPath);
     foreach (FileInfo file in dirInfo.GetFiles())
     {
         if (!file.Name.StartsWith("_") && file.Name.EndsWith(".html"))
         {
             foreach (Model.url_rewrite model in ls)
             {
                 if (file.Name.ToLower() == model.templet && !string.IsNullOrEmpty(model.inherit))
                 {
                     //生成模板文件
                     PageTemplate.GetTemplate(siteConfig.webpath, "plugins/" + dirName, "templet", model.templet, model.page, model.inherit, 0, 1);
                 }
             }
         }
     }
 }
Esempio n. 5
0
        //构造函数
        private SiteUrls()
        {
            Urls = new ArrayList();
            BLL.url_rewrite          bll = new BLL.url_rewrite();
            List <Model.url_rewrite> ls  = bll.GetList("");

            foreach (Model.url_rewrite model in ls)
            {
                foreach (Model.url_rewrite_item item in model.url_rewrite_items)
                {
                    item.querystring = item.querystring.Replace("^", "&");
                }
                Urls.Add(model);
            }
        }
Esempio n. 6
0
        private SiteUrls()
        {
            Urls = new ArrayList();
            Paths = new NameValueCollection();

            BLL.url_rewrite bll = new BLL.url_rewrite();
            List<Model.url_rewrite> ls = bll.GetList("");
            foreach (Model.url_rewrite model in ls)
            {
                Paths.Add(model.name, model.path);
                model.page = model.page.Replace("^", "&");
                model.querystring = model.querystring.Replace("^", "&");
                Urls.Add(model);
            }
        }
Esempio n. 7
0
        //构造函数
        private SiteUrls(string sitePath)
        {
            Urls = new ArrayList();
            BLL.url_rewrite          bll = new BLL.url_rewrite();
            List <Model.url_rewrite> ls  = bll.GetList("");

            foreach (Model.url_rewrite model in ls)
            {
                if (string.IsNullOrEmpty(model.site) || model.site == sitePath)
                {
                    foreach (Model.url_rewrite_item item in model.url_rewrite_items)
                    {
                        item.querystring = item.querystring.Replace("^", "&");
                    }
                    Urls.Add(model);
                }
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 生成全部模板
        /// </summary>
        /// <param name="buildPath">生成目录</param>
        /// <param name="skinName">模板名称</param>
        /// <param name="site_id">网点ID</param>
        private void MarkTemplates(string buildPath, string skinName, int _site_id)
        {
            //取得ASP目录下的所有文件
            string fullDirPath = Utils.GetMapPath(string.Format("{0}aspx/{1}/", siteConfig.webpath, buildPath));

            //获得URL配置列表
            BLL.url_rewrite          bll = new BLL.url_rewrite();
            List <Model.url_rewrite> ls  = bll.GetList("");

            DirectoryInfo dirFile = new DirectoryInfo(fullDirPath);

            //删除不属于URL映射表里的文件,防止冗余
            if (Directory.Exists(fullDirPath))
            {
                foreach (FileInfo file in dirFile.GetFiles())
                {
                    //检查文件
                    //Model.url_rewrite modelt = ls.Find(p => p.page.ToLower() == file.Name.ToLower());
                    //if (modelt == null)
                    //{
                    file.Delete();
                    //}
                }
            }

            //遍历URL配置列表
            foreach (Model.url_rewrite modelt in ls)
            {
                //如果URL配置对应的模板文件存在则生成
                string fullPath = Utils.GetMapPath(string.Format("{0}templates/{1}/{2}", siteConfig.webpath, skinName, modelt.templet));
                if (File.Exists(fullPath))
                {
                    //判断是否开启缓存
                    string isCache   = string.Empty;
                    string cachePath = string.Empty;
                    if (modelt.cache != null && modelt.cachepath != null)
                    {
                        isCache   = modelt.cache;
                        cachePath = modelt.cachepath;
                    }
                    PageTemplate.GetTemplate(siteConfig.webpath, "templates", skinName, modelt.templet, modelt.page, modelt.inherit, buildPath, modelt.channel, modelt.pagesize, isCache, cachePath, modelt.type, _site_id, 1);
                }
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 生成全部模板
        /// </summary>
        private void MarkTemplates(string skinName)
        {
            //取得ASP目录下的所有文件
            DirectoryInfo dirFile = new DirectoryInfo(Utils.GetMapPath(siteConfig.webpath + "aspx/"));

            //获得URL映射列表
            BLL.url_rewrite          bll = new BLL.url_rewrite();
            List <Model.url_rewrite> ls  = bll.GetList("");

            //删除不属于URL映射表里的文件,防止冗余
            foreach (FileInfo file in dirFile.GetFiles())
            {
                //检查文件
                Model.url_rewrite model2 = ls.Find(p => p.page.ToLower() == file.Name.ToLower());
                if (model2 == null)
                {
                    file.Delete();
                }
            }
            //遍历站点目录的templates文件夹下的模板文件
            DirectoryInfo dirInfo = new DirectoryInfo(Utils.GetMapPath(siteConfig.webpath + @"templates/" + skinName));

            foreach (FileInfo file in dirInfo.GetFiles())
            {
                if (!file.Name.StartsWith("_") && file.Name.EndsWith(".html"))
                {
                    //查找相对应的继承类名
                    foreach (Model.url_rewrite model in ls)
                    {
                        if (file.Name.ToLower() == model.templet && !string.IsNullOrEmpty(model.inherit))
                        {
                            //检查频道ID
                            int channelId = Utils.StrToInt(model.channel, 0);
                            //生成模板文件
                            PageTemplate.GetTemplate(siteConfig.webpath, "templates", skinName, model.templet, model.page, model.inherit, channelId, 1);
                        }
                    }
                }
            }
        }
Esempio n. 10
0
        /// <summary>
        /// 生成全部範本
        /// </summary>
        private void MarkTemplates(string skinName)
        {
            //取得ASP目錄下的所有檔
            DirectoryInfo dirFile = new DirectoryInfo(Utils.GetMapPath(siteConfig.webpath + "aspx/"));

            //獲得URL映射列表
            BLL.url_rewrite          bll = new BLL.url_rewrite();
            List <Model.url_rewrite> ls  = bll.GetList("");

            //刪除不屬於URL映射表裡的檔,防止冗餘
            foreach (FileInfo file in dirFile.GetFiles())
            {
                //檢查檔
                Model.url_rewrite model2 = ls.Find(p => p.page.ToLower() == file.Name.ToLower());
                if (model2 == null)
                {
                    file.Delete();
                }
            }
            //遍歷網站目錄的templates資料夾下的範本檔
            DirectoryInfo dirInfo = new DirectoryInfo(Utils.GetMapPath(siteConfig.webpath + @"templates/" + skinName));

            foreach (FileInfo file in dirInfo.GetFiles())
            {
                if (!file.Name.StartsWith("_") && file.Name.EndsWith(".html"))
                {
                    //查找相對應的繼承類名
                    foreach (Model.url_rewrite model in ls)
                    {
                        if (file.Name.ToLower() == model.templet && !string.IsNullOrEmpty(model.inherit))
                        {
                            //檢查頻道ID
                            int channelId = Utils.StrToInt(model.channel, 0);
                            //生成範本檔
                            PageTemplate.GetTemplate(siteConfig.webpath, "templates", skinName, model.templet, model.page, model.inherit, channelId, 1);
                        }
                    }
                }
            }
        }
Esempio n. 11
0
 /// <summary>
 /// 生成全部模板
 /// </summary>
 private void MarkTemplates(string skinName)
 {
     //取得ASP目录下的所有文件
     DirectoryInfo dirFile = new DirectoryInfo(Utils.GetMapPath(siteConfig.webpath + "aspx/"));
     //获得URL映射列表
     BLL.url_rewrite bll = new BLL.url_rewrite();
     List<Model.url_rewrite> ls = bll.GetList("");
     //删除不属于URL映射表里的文件,防止冗余
     foreach (FileInfo file in dirFile.GetFiles())
     {
         //检查文件
         Model.url_rewrite model2 = ls.Find(p => p.page.ToLower() == file.Name.ToLower());
         if (model2 == null)
         {
             file.Delete();
         }
     }
     //遍历站点目录的templates文件夹下的模板文件
     DirectoryInfo dirInfo = new DirectoryInfo(Utils.GetMapPath(siteConfig.webpath + @"templates/" + skinName));
     foreach (FileInfo file in dirInfo.GetFiles())
     {
         if (!file.Name.StartsWith("_") && file.Name.EndsWith(".html"))
         {
             //查找相对应的继承类名
             foreach (Model.url_rewrite model in ls)
             {
                 if (file.Name.ToLower()==model.templet && !string.IsNullOrEmpty(model.inherit))
                 {
                     //检查频道ID
                     int channelId = Utils.StrToInt(model.channel, 0);
                     //生成模板文件
                     PageTemplate.GetTemplate(siteConfig.webpath, "templates", skinName, model.templet, model.page, model.inherit, channelId, 1);
                 }
             }
         }
     }
 }
Esempio n. 12
0
        /// <summary>
        /// 获取生成静态地址
        /// </summary>
        /// <param name="context"></param>
        public void getpublishsite(HttpContext context)
        {
            string lang = PLRequest.GetQueryString("lang");
            string name = PLRequest.GetQueryString("name");
            string type = PLRequest.GetQueryString("type");

            StringBuilder sbjson = new StringBuilder();


            //获得URL配置列表
            BLL.url_rewrite          bll = new BLL.url_rewrite();
            List <Model.url_rewrite> ls  = (!string.IsNullOrEmpty(type)) ? bll.GetList(name, type) : bll.GetList(name);
            string linkurl = string.Empty;

            sbjson.Append("[");
            if (type == "indexlist")
            {
                #region 针对特殊需求
                List <Model.url_rewrite> ls2 = (!string.IsNullOrEmpty("list")) ? bll.GetList(name, "list") : bll.GetList(name, "list");
                foreach (Model.url_rewrite modeltrewrite2 in ls2)
                {
                    if (modeltrewrite2.url_rewrite_items.Count > 0)
                    {
                        if (modeltrewrite2.channel == string.Empty || modeltrewrite2.channel == name)
                        {
                            //遍历URL字典的子节点
                            foreach (Model.url_rewrite_item item2 in modeltrewrite2.url_rewrite_items)
                            {
                                if (sbjson.ToString().Length > 1)
                                {
                                    sbjson.Append(",");
                                }
                                switch (modeltrewrite2.type.ToLower())
                                {
                                case "list":
                                    sbjson.Append(GetArticleIndexUrlList(lang, name, modeltrewrite2.page, item2.pattern, item2.path, item2.querystring, Utils.StrToInt(modeltrewrite2.pagesize, 0)));
                                    break;
                                }
                            }
                        }
                    }
                }
                #endregion
            }
            else
            {
                foreach (Model.url_rewrite modeltrewrite in ls)
                {
                    if (modeltrewrite.url_rewrite_items.Count > 0)
                    {
                        if (modeltrewrite.channel == string.Empty || modeltrewrite.channel == name)
                        {
                            //遍历URL字典的子节点
                            foreach (Model.url_rewrite_item item in modeltrewrite.url_rewrite_items)
                            {
                                if (item.querystring == string.Empty)
                                {
                                    linkurl = string.Format("{0}/{1}/{2}", PLKeys.DIRECTORY_REWRITE_ASPX, lang, modeltrewrite.page);
                                    string HTMLPattern = string.Format("{0}/{1}/{2}", PLKeys.DIRECTORY_REWRITE_HTML, lang, Utils.GetUrlExtension(item.pattern, config.staticextension)); //替换扩展名
                                    if (sbjson.ToString().Length > 1)
                                    {
                                        sbjson.Append(",");
                                    }
                                    sbjson.AppendFormat(urlstr, config.webpath, lang, linkurl, HTMLPattern);
                                }
                                else
                                {
                                    if (sbjson.ToString().Length > 1)
                                    {
                                        sbjson.Append(",");
                                    }
                                    switch (modeltrewrite.type.ToLower())
                                    {
                                    case "list":
                                        sbjson.Append(GetArticleUrlList(lang, name, modeltrewrite.page, item.pattern, item.path, item.querystring, Utils.StrToInt(modeltrewrite.pagesize, 0)));
                                        break;

                                    case "detail":
                                        sbjson.Append(GetDetailUrlList(lang, name, modeltrewrite.page, item.pattern, item.path, item.querystring));
                                        break;

                                    case "category":
                                        sbjson.Append(GetCategoryUrlList(lang, name, modeltrewrite.page, item.pattern, item.path, item.querystring, Utils.StrToInt(modeltrewrite.pagesize, 0)));
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            sbjson.Append("]");
            context.Response.Write(sbjson.ToString());
        }
Esempio n. 13
0
 //构造函数
 private SiteUrls()
 {
     Urls = new ArrayList();
     BLL.url_rewrite bll = new BLL.url_rewrite();
     List<Model.url_rewrite> ls = bll.GetList("");
     foreach(Model.url_rewrite model in ls)
     {
         foreach (Model.url_rewrite_item item in model.url_rewrite_items)
         {
             item.querystring = item.querystring.Replace("^", "&");
         }
         Urls.Add(model);
     }
 }
Esempio n. 14
0
        private SiteUrls()
        {
            Urls = new ArrayList();
            Paths = new NameValueCollection();

            BLL.url_rewrite bll = new BLL.url_rewrite();
            List<Model.url_rewrite> ls = bll.GetList("");
            foreach (Model.url_rewrite model in ls)
            {
                Paths.Add(model.name, model.path);
                model.page = model.page.Replace("^", "&");
                model.querystring = model.querystring.Replace("^", "&");
                Urls.Add(model);
            }
        }
Esempio n. 15
0
        /// <summary>
        /// 生成全部模板
        /// </summary>
        private void MarkTemplates(string buildPath, string skinName)
        {
            //取得ASP目录下的所有文件
            string fullDirPath = Utils.GetMapPath(string.Format("{0}aspx/{1}/", siteConfig.webpath, buildPath));
            //获得URL配置列表
            BLL.url_rewrite bll = new BLL.url_rewrite();
            List<Model.url_rewrite> ls = bll.GetList("");

            DirectoryInfo dirFile = new DirectoryInfo(fullDirPath);
            //删除不属于URL映射表里的文件,防止冗余
            if (Directory.Exists(fullDirPath))
            {
                foreach (FileInfo file in dirFile.GetFiles())
                {
                    //检查文件
                    //Model.url_rewrite modelt = ls.Find(p => p.page.ToLower() == file.Name.ToLower());
                    //if (modelt == null)
                    //{
                    file.Delete();
                    //}
                }
            }

            //遍历URL配置列表
            foreach (Model.url_rewrite modelt in ls)
            {
                //如果URL配置对应的模板文件存在则生成
                string fullPath = Utils.GetMapPath(string.Format("{0}templates/{1}/{2}", siteConfig.webpath, skinName, modelt.templet));
                if (File.Exists(fullPath))
                {
                    PageTemplate.GetTemplate(siteConfig.webpath, "templates", skinName, modelt.templet, modelt.page, modelt.inherit, buildPath, modelt.channel, modelt.pagesize, 1);
                }
            }
        }