Esempio n. 1
0
 protected void doMake(object sender, EventArgs e)
 {
     makeresult.Text = "";
     var temple = temples.FirstOrDefault(x => x.key == temple_type.SelectedValue);
     if (temple == null)
     {
         return;
     }
     string path = HttpContext.Current.Server.MapPath(temple.inpath);
     di = new DirectoryInfo(path);
     if (!di.Exists)
     {
         makeresult.Text = "<span style='color:red;'>模板文件夹路径错误!" + path + "</span>";
     }
     TagConfig __config = new TagConfig();
     __config.GetingHtml += new GetHtml(getHtml);
     __config.GetingTableStr += new GetTableStr(getTable);
     __config.current_pairs = getCurrentTagPair(currenttagpair);
     __config.input = temple.inpath;
     __config.output = temple.outpath;
     __config.db = new Entities();
     __config.protected_tables = "Admin";//受保护的表,不允许通过标签在前台展示
     __config.creatScriptForAllPages = true;
     __config.DefaultBase = "xx.yy.PageBase";//页面默认继承类
     __config.convert = isconvert.Checked;
     AddDialect(__config);
     if (__config.convert)
     {
         __config.convert_pairs = getCurrentTagPair(toTagpairs);
     }
     else if (clearBefor.Checked)
     {
         clearOutpu(__config.input, __config.output);
         clearBefor.Checked = false;
     }
     var its = pages.Items;
     CheckBox cb = null;
     foreach (RepeaterItem it in its)
     {
         cb = it.FindControl("cb_id") as CheckBox;
         if (cb.Checked)
         {
             if (showTagInfos.Checked)
             {
                 string text = "";
                 makeresult.Text += __config.MakePage(cb.Text.Trim(), out text);
                 makeresult.Text += text;
             }
             else
             {
                 makeresult.Text += __config.MakePage(cb.Text.Trim());
             }
         }
     }
     makeresult.Text += "<span style='color:green;'>" +
         (isconvert.Checked ? @"转换标签完成!转换后的文件保存在各目录的下的'\convert\'里." : "生成页面完成!")
         + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>" + DateTime.Now.ToString() + "!</span>";
 }
Esempio n. 2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="mText">经过处理的标签文本(去除空格 \s*、br/hr替换)</param>
 /// <param name="mOrigin">原始标签文本</param>
 /// <param name="mDeep">嵌套深度</param>
 /// <param name="config">配置</param>
 /// <param name="no_">标签的递增编码</param>
 protected BaseTag(string mText, string mOrigin, int mDeep, TagConfig config, int no_)
 {
     this.Config = config;
     this.Deep = mDeep;
     this.Text = mText;
     this.Origin = mOrigin;
     this.NO_ = no_;
     this.TagName = string.Concat(this.GetType().Name, "_", this.Text.Length, TagHelper.RandomNext(999), "_", (this.NO_ + 1));
     this.PlaceHolderName = string.Concat("#", this.TagName, "#");
     this.In_Pairs = this.Text.LastIndexOf('/') != this.Text.Length - 2;
     this.Discover();
 }
Esempio n. 3
0
 public ItemPage(string style, int mDeep, TagConfig config, string listTagName)
     : base(style, mDeep, config, ListTag.FakeItemStr)
 {
     this.PageName = string.Concat(listTagName, "#", this.PageName);
     FindEmpty();
 }
Esempio n. 4
0
 public ItemPage(string mHtmlpPath, string mPageName, int mDeep, TagConfig config)
     : base(mHtmlpPath, mPageName, mDeep, config, false)
 {
     FindEmpty();
 }
Esempio n. 5
0
 public StaticTag(string mtext, string mOrigin, int Deep, string mParPageName, TagConfig config, int no_)
     : base(mtext, mOrigin, Deep, config, no_)
 {
     this.ParPageName = mParPageName;
 }
Esempio n. 6
0
    private void show()
    {
        tagArea.Visible = false;
        if (string.IsNullOrEmpty(selectedFilePath))
        {
            Labelname.Text = "请选择文件进行操作!";
            btnSave.Visible = false;
            editable.Value = "no";
            return;
        }
        Labelname.Text = GetShorterFileName(selectedFilePath);
        if (Regex.IsMatch(selectedFilePath, @".*?\.(?:html|htm|xhtml|xml|json|js|css|text)$", RegexOptions.IgnoreCase))
        {
            Content.Text = ReadFile(selectedFilePath);
            editable.Value = "yes";
            btnSave.Visible = true;
            Content.Visible = true;
            imgview.Visible = false;
            tagArea.Visible = true;
            TagConfig __config = new TagConfig();
            __config.current_pairs = getCurrentTagPair(currenttagpair);
            __config.db = new Entities();
            __config.protected_tables = "Manage|ManageRole|WxConfig|Log";
            __config.creatScriptForAllPages = true;
            __config.DefaultBase = "web.x2015x.UserBase";
            var taglist = __config.GetTagList(selectedFilePath);
            StringBuilder sb = new StringBuilder("<ul>");

            foreach (var x in taglist)
            {
                sb.AppendFormat("<li data-no='{0}'><span title='{2}'>{1}</span></li>", x.no_, x.text.Replace(">", "&gt;").Replace("<", "&lt;"),
                      ("" + x.style).Replace(">", "&gt;").Replace("<", "&lt;"));
            }
            sb.Append("</ul>");
            tagList.Text = sb.ToString();
        }
        else if (Regex.IsMatch(selectedFilePath, @".*?\.(?:aspx|ascx|cs)$", RegexOptions.IgnoreCase))
        {
            Content.Text = ReadFile(selectedFilePath);
            editable.Value = "yes";
            btnSave.Visible = true;
            Content.Visible = true;
            imgview.Visible = false;
            btnSave.Visible = false;
        }
        else if (Regex.IsMatch(selectedFilePath, @".*?\.(?:jpeg|jpg|png|gif}bmp)$", RegexOptions.IgnoreCase))
        {
            Content.Visible = false;
            imgview.Visible = true;
            editable.Value = "no";
            imgview.Src = getImagePath(selectedFilePath);
            btnSave.Visible = false;
        }
        else
        {
            Content.Visible = true;
            Content.Text = "当前文件夹或文件不支持编辑";
            editable.Value = "no";
            btnSave.Visible = false;
            imgview.Visible = false;
        }
    }
Esempio n. 7
0
 internal BasePage(string mPageName, TagConfig config, bool justGetTagList)
     : this(string.Empty, mPageName, 1, config, justGetTagList)
 {
 }
Esempio n. 8
0
 protected StyleAbleTag(string mtext, string origin, int mdeep, TagConfig config, int no_)
     : base(mtext, origin, mdeep, config, no_)
 {
 }
Esempio n. 9
0
 public ListTag(string mtext, string origin, int Deep, string mParPageName, TagConfig config, int no_)
     : base(mtext, origin, Deep, config, no_)
 {
     this.ParPageName = mParPageName;
     this.Lev = 1;
 }
Esempio n. 10
0
 public ReadPage(string style, int mDeep, TagConfig config)
     : base(style, mDeep, config, "x-read-fake-x")
 {
 }
Esempio n. 11
0
 public ReadTag(string mtext, string mOrigin, int Deep, TagConfig config, int no_)
     : base(mtext, mOrigin, Deep, config, no_)
 {
     this.Lev = 2;
 }
Esempio n. 12
0
 public IfTag(string mtext, IfType type, int Deep, TagConfig config, int no_)
     : base(mtext, mtext, Deep, config, no_)
 {
     this.Type = type;
 }
Esempio n. 13
0
 /// <summary>
 /// 页面入口方法,以文件路径
 /// </summary>
 /// <param name="mHtmlpPath">somepage.html文件路径</param>
 /// <param name="mPageName">页面名称,如: somepage </param>
 /// <param name="mDeep">嵌套深度</param>
 /// <param name="config">配置信息</param>
 /// <param name="justGetTagList">是否仅获取页面内标签列表</param>
 internal BasePage(string mHtmlpPath, string mPageName, int mDeep, TagConfig config, bool justGetTagList)
 {
     config.Init();
     this.JustGetTagList = justGetTagList;
     this.Config = config;
     this.Extends = config.DefaultBase;
     this.SubpageExtends = config.DefaultUCBase;
     this.Deep = mDeep + 1;
     this.PageName = mPageName;
     if (Deep > config.MAXD_EEP)
     {
         this.Msg += string.Format("{0}-镶套层数达到{1}层,为防止循环套用已停止解析。<br />", this.PageName, config.MAXD_EEP);
         return;
     }
     if (justGetTagList) //仅获取标签列表是,直接传入要解析的文件物理路径
     {
         this.HtmlpPath = mPageName;
         try
         {
             Html = File.ReadAllText(HtmlpPath);
         }
         catch (Exception e)
         {
             Msg += string.Format("无法打开文件:{0}。  {1}", HtmlpPath, e.Message);
         }
     }
     else// 设置文件路径
     {
         this.HtmlpPath = string.IsNullOrEmpty(mHtmlpPath) ? config.PagePath : mHtmlpPath;
         ReadFile();
     }
     GetTegs();
 }
Esempio n. 14
0
 public SubListPage(string mHtmlpPath, string mPageName, int mDeep, TagConfig config)
     : base(mHtmlpPath, mPageName, mDeep, config)
 {
 }
Esempio n. 15
0
 public StaticPage(string mHtmlpPath, string mPageName, int mDeep, TagConfig config)
     : base(mHtmlpPath, mPageName, mDeep, config, false)
 {
 }
Esempio n. 16
0
 public MethodTag(string mtext, string mOrigin, int Deep, TagConfig config, int no_)
     : base(mtext, mOrigin, Deep, config, no_)
 {
 }
Esempio n. 17
0
    private void AddDialect(TagConfig config)
    {
        TableDialect article = new TableDialect("Article", new HashSet<string>()
        {
            "文章"
        });

        article.Fields.Add(new Dialect("Id", new HashSet<string>() { "主键ID" }));
        article.Fields.Add(new Dialect("Categ", new HashSet<string>() { "栏目", "分类" }));
        article.Fields.Add(new Dialect("UID", new HashSet<string>() { "用户ID", "作者ID" }));
        article.Fields.Add(new Dialect("title", new HashSet<string>() { "文章标题", "标题" }));
        article.Fields.Add(new Dialect("Desc", new HashSet<string>() { "文章摘要", "摘要" }));
        article.Fields.Add(new Dialect("Author", new HashSet<string>() { "作者", "作者名字" }));
        article.Fields.Add(new Dialect("Img", new HashSet<string>() { "图片", "logo" }));
        article.Fields.Add(new Dialect("Content", new HashSet<string>() { "文章内容", "正文" }));
        article.Fields.Add(new Dialect("View", new HashSet<string>() { "查看", "点击" }));
        article.Fields.Add(new Dialect("IsLock", new HashSet<string>() { "锁定", "禁止查看" }));
        article.Fields.Add(new Dialect("IsTop", new HashSet<string>() { "置顶", "是否置顶" }));
        article.Fields.Add(new Dialect("ding", new HashSet<string>() { "被顶", "被顶次数" }));
        article.Fields.Add(new Dialect("time", new HashSet<string>() { "发布时间", "时间" }));

        config.AddDialect(article);

        TableDialect categgory = new TableDialect("Category", new HashSet<string>()
        {
            "栏目"
        });

        categgory.Fields.Add(new Dialect("Id", new HashSet<string>() { "主键ID" }));
        categgory.Fields.Add(new Dialect("name", new HashSet<string>() { "栏目名称", "名称" }));
        /*
         *
         * .......
         *
         */
        config.AddDialect(categgory);
    }
Esempio n. 18
0
 public IfGroupTag(string mtext, int Deep, TagConfig config, int no_)
     : base(mtext, mtext, Deep, config, no_)
 {
 }
Esempio n. 19
0
 /// <summary>
 /// 页面入口方法,以html文本
 /// </summary>
 /// <param name="style">html文本</param>
 /// <param name="mDeep">嵌套深度</param>
 /// <param name="config">配置信息</param>
 /// <param name="fakeName">虚拟的页面名称</param>
 internal BasePage(string style, int mDeep, TagConfig config, string fakeName)
 {
     this.Config = config;
     this.Extends = config.DefaultBase;
     this.SubpageExtends = config.DefaultUCBase;
     this.Deep = mDeep + 1;
     this.PageName = fakeName;
     this.Html = style;
     if (Deep > config.MAXD_EEP)
     {
         this.Msg += string.Format("{0}-镶套层数达到{1}层,为防止循环套用已停止解析。<br />", this.PageName, config.MAXD_EEP);
         return;
     }
     GetTegs();
 }