/// <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);
                }
            }
        }
        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);
                        }
                    }
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 生成模板文件
        /// </summary>
        public void MarkTemplet(string sitePath, string tempPath, string skinName, string dirPath, string xPath)
        {
            XmlNodeList xnList = XmlHelper.ReadNodes(dirPath + DTKeys.FILE_PLUGIN_XML_CONFING, xPath);

            foreach (XmlElement xe in xnList)
            {
                if (xe.NodeType != XmlNodeType.Comment && xe.Name.ToLower() == "rewrite")
                {
                    if (xe.Attributes["page"] != null && !string.IsNullOrEmpty(xe.Attributes["page"].InnerText) &&
                        !string.IsNullOrEmpty(xe.Attributes["templet"].InnerText) && !string.IsNullOrEmpty(xe.Attributes["inherit"].InnerText))
                    {
                        //检查是否带有分页数量,如果有则传过去
                        string pagesizeStr = string.Empty;
                        if (xe.Attributes["pagesize"] != null)
                        {
                            pagesizeStr = xe.Attributes["pagesize"].InnerText;
                        }
                        //频道类型
                        string urlType = xe.Attributes["type"].InnerText;
                        //判断是否开启缓存
                        string isCache   = string.Empty;
                        string cachePath = string.Empty;
                        if (xe.Attributes["cache"] != null && xe.Attributes["cachepath"] != null)
                        {
                            isCache   = xe.Attributes["cache"].InnerText;
                            cachePath = xe.Attributes["cachepath"].InnerText;
                        }
                        //生成模板文件
                        PageTemplate.GetTemplate(sitePath, tempPath, skinName, xe.Attributes["templet"].InnerText, xe.Attributes["page"].InnerText, xe.Attributes["inherit"].InnerText, DTKeys.DIRECTORY_REWRITE_PLUGIN, string.Empty, pagesizeStr, isCache, cachePath, urlType, 0, 1);
                    }
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// 生成全部模板
        /// </summary>
        /// <param name="skinName"></param>
        protected void MarkTemplates(string skinName)
        {
            //遍历站点目录的Aspx文件夹下的aspx文件
            DirectoryInfo dirInfo = new DirectoryInfo(Utils.GetMapPath(webset.WebPath + "Aspx/"));

            foreach (FileInfo file in dirInfo.GetFiles())
            {
                if (file.Name.EndsWith(".aspx"))
                {
                    //生成模板文件
                    PageTemplate.GetTemplate(webset.WebPath, skinName, file.Name.Substring(0, file.Name.LastIndexOf(".")) + ".htm", 1);
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// 生成模板文件
        /// </summary>
        public void MarkTemplet(string sitePath, string tempPath, string skinName, string dirPath, string xPath)
        {
            XmlNodeList xnList = XmlHelper.ReadNodes(dirPath + DTKeys.FILE_PLUGIN_XML_CONFING, xPath);

            foreach (XmlElement xe in xnList)
            {
                if (xe.NodeType != XmlNodeType.Comment && xe.Name.ToLower() == "rewrite")
                {
                    if (xe.Attributes["page"] != null && !string.IsNullOrEmpty(xe.Attributes["page"].InnerText) &&
                        !string.IsNullOrEmpty(xe.Attributes["templet"].InnerText) && !string.IsNullOrEmpty(xe.Attributes["inherit"].InnerText))
                    {
                        //生成模板文件
                        PageTemplate.GetTemplate(sitePath, tempPath, skinName, xe.Attributes["templet"].InnerText, xe.Attributes["page"].InnerText, xe.Attributes["inherit"].InnerText, DTKeys.DIRECTORY_REWRITE_PLUGIN, 1);
                    }
                }
            }
        }
Beispiel #6
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);
                }
            }
        }
Beispiel #7
0
 public void MarkTemplet(
     string sitePath,
     string tempPath,
     string skinName,
     string dirPath,
     string xPath)
 {
     foreach (XmlElement readNode in XmlHelper.ReadNodes(dirPath + "plugin.config", xPath))
     {
         if (readNode.NodeType != XmlNodeType.Comment && readNode.Name.ToLower() == "rewrite" && (readNode.Attributes["page"] != null && !string.IsNullOrEmpty(readNode.Attributes["page"].InnerText) && !string.IsNullOrEmpty(readNode.Attributes["templet"].InnerText) && !string.IsNullOrEmpty(readNode.Attributes["inherit"].InnerText)))
         {
             string pageSize = string.Empty;
             if (readNode.Attributes["pagesize"] != null)
             {
                 pageSize = readNode.Attributes["pagesize"].InnerText;
             }
             PageTemplate.GetTemplate(sitePath, tempPath, skinName, readNode.Attributes["templet"].InnerText, readNode.Attributes["page"].InnerText, readNode.Attributes["inherit"].InnerText, nameof(plugin), string.Empty, pageSize, 1);
         }
     }
 }
Beispiel #8
0
        private void MarkTemplates(string buildPath, string skinName)
        {
            string mapPath = Utils.GetMapPath(string.Format("{0}aspx/{1}/", (object)this.siteConfig.webpath, (object)buildPath));
            List <Rain.Model.url_rewrite> list = new Rain.BLL.url_rewrite().GetList("");
            DirectoryInfo directoryInfo        = new DirectoryInfo(mapPath);

            if (Directory.Exists(mapPath))
            {
                foreach (FileSystemInfo file in directoryInfo.GetFiles())
                {
                    file.Delete();
                }
            }
            foreach (Rain.Model.url_rewrite urlRewrite in list)
            {
                if (File.Exists(Utils.GetMapPath(string.Format("{0}templates/{1}/{2}", (object)this.siteConfig.webpath, (object)skinName, (object)urlRewrite.templet))))
                {
                    PageTemplate.GetTemplate(this.siteConfig.webpath, "templates", skinName, urlRewrite.templet, urlRewrite.page, urlRewrite.inherit, buildPath, urlRewrite.channel, urlRewrite.pagesize, 1);
                }
            }
        }
        /// <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);
                        }
                    }
                }
            }
        }
Beispiel #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);
                        }
                    }
                }
            }
        }
Beispiel #11
0
        /// <summary>
        /// 生成模板文件
        /// </summary>
        public void MarkTemplet(string sitePath, string tempPath, string skinName, string dirPath, string xPath)
        {
            XmlNodeList xnList = XmlHelper.ReadNodes(dirPath + DTKeys.FILE_PLUGIN_XML_CONFING, xPath);

            foreach (XmlElement xe in xnList)
            {
                if (xe.NodeType != XmlNodeType.Comment && xe.Name.ToLower() == "rewrite")
                {
                    if (xe.Attributes["page"] != null && !string.IsNullOrEmpty(xe.Attributes["page"].InnerText) &&
                        !string.IsNullOrEmpty(xe.Attributes["templet"].InnerText) && !string.IsNullOrEmpty(xe.Attributes["inherit"].InnerText))
                    {
                        //检查是否带有分页数量,如果有则传过去
                        string pagesizeStr = string.Empty;
                        if (xe.Attributes["pagesize"] != null)
                        {
                            pagesizeStr = xe.Attributes["pagesize"].InnerText;
                        }
                        //生成模板文件
                        PageTemplate.GetTemplate(sitePath, tempPath, skinName, xe.Attributes["templet"].InnerText, xe.Attributes["page"].InnerText, xe.Attributes["inherit"].InnerText, skinName, string.Empty, pagesizeStr, 0, 1, xe.Attributes["name"].InnerText);
                    }
                }
            }
        }