示例#1
0
        /// <summary>
        /// 呈现内容,默认不压缩
        /// </summary>
        /// <param name="content"></param>
        /// <param name="data"></param>
        /// <param name="compress"></param>
        /// <returns></returns>
        public static string Render(string content, object data, bool compress)
        {
            TemplatePage page = new TemplatePage(null, data);

            page.TemplateContent = content;
            return(page.ToString());
        }
示例#2
0
        public string BasicSetting(HttpContext context)
        {
            PluginPackAttribute attr = this._plugin.GetAttribute();
            TemplatePage        page = this._app.GetPage(this._plugin, "mg/basic_setting.html");

            string url = String.Format("http://{0}/{1}.sh.aspx/serve",
                                       context.Request.Url.Host, attr.WorkIndent);
            string token = attr.Settings["Weixin_Token"] ??
                           String.Empty.RandomLetters(6);
            string appId              = attr.Settings["Weixin_AppId"] ?? "";
            string appSecret          = attr.Settings["Weixin_AppSecret"] ?? "";
            string appEncodeString    = attr.Settings["Weixin_AppEncodeString"] ?? "";
            string wlc                = attr.Settings["Weixin_WelcomeMessage"] ?? "";
            string enterMessage       = attr.Settings["Weixin_EnterMessage"] ?? "";
            string defaultRspMesssage = attr.Settings["Weixin_DefaultResponseMessage"] ?? "";

            page.AddVariable("data", new
            {
                url               = url,
                token             = token,
                appId             = appId,
                appSecret         = appSecret,
                aes               = appEncodeString,
                welcomeMessage    = wlc,
                enterMessage      = enterMessage,
                defaultRspMessage = defaultRspMesssage,
            });
            return(page.ToString());
        }
        public string Case_List(HttpContext context)
        {
            TemplatePage page = Cms.Plugins.GetPage <Main>("admin/case_list.html");

            page.AddVariable("page", new PageVariable());
            return(page.ToString());
        }
示例#4
0
        /// <summary>
        /// 返回模板内容
        /// </summary>
        /// <param name="templateId"></param>
        /// <param name="pageFunc">对模板处理前操作,可以添加数据对象</param>
        public static string Require(string templateId, TemplatePageHandler pageFunc)
        {
            using (CmsTemplates tpl = new CmsTemplates())
            {
                TemplatePage page = new TemplatePage(templateId);
                //if (data != null)
                //{
                //   page.AddDataObject(data);
                //}
                page.TemplateHandleObject = tpl;
                page.OnPreInit           += PreHandler;
                page.OnPreRender         += CompliedTemplate;

                //注册扩展的模板解析事件
                if (OnPreRender != null)
                {
                    page.OnPreRender += OnPreRender;
                }

                if (pageFunc != null)
                {
                    pageFunc(page);
                }

                return(page.ToString());
            }
        }
示例#5
0
        public string EditMenu(HttpContext context)
        {
            int    pi = 0;
            int    si = -1;
            string mi = context.Request["mi"];

            if (mi.Contains("-"))
            {
                string[] arr = mi.Split('-');
                pi = int.Parse(arr[0]) - 1;
                si = int.Parse(arr[1]) - 1;
            }
            else
            {
                pi = int.Parse(mi) - 1;
            }

            TemplatePage page       = this._app.GetPage(this._plugin, "mg/menu_edit.html");
            String       entityJson = JsonConvert.SerializeObject(WeixinHelper.GetMenuNode(pi, si));

            page.AddVariable("entity", entityJson);
            page.AddVariable("pi", pi);
            page.AddVariable("si", si);
            return(page.ToString());
        }
示例#6
0
        public string Menu(HttpContext context)
        {
            TemplatePage page     = this._app.GetPage(this._plugin, "mg/menu.html");
            String       menuJson = JsonConvert.SerializeObject(WeixinHelper.GetMenuTreeNode());

            page.AddVariable("menu", menuJson);
            return(page.ToString());
        }
        public string Export_Import(HttpContext context)
        {
            TemplatePage page = Cms.Plugins.GetPage <Main>("admin/export_import.html");

            page.AddVariable("page", new PageVariable());
            page.AddVariable("case", new { json = new object() });
            return(page.ToString());
        }
        public string Export_Setup(HttpContext context)
        {
            TemplatePage page = Cms.Plugins.GetPage <Main>("admin/export_setup.html");

            page.AddVariable("page", new PageVariable());
            page.AddVariable("export", new { setup = ExportHandle.Setup(context.Request["portal"]) });
            return(page.ToString());
        }
        public string Case_Gallery(HttpContext context)
        {
            int          caseId = int.Parse(context.Request["caseId"]);
            TemplatePage page   = Cms.Plugins.GetPage <Main>("admin/case_gallery.html");

            page.AddVariable("page", new PageVariable());
            page.AddVariable("case", new { Id = caseId });
            return(page.ToString());
        }
示例#10
0
文件: test.cs 项目: ReinhardHsu/devfw
 private void Main()
 {
     TemplatePage tp = new TemplatePage();
     tp.TemplateContent = "$m=item  KEY:${item.key} Note:${item.note}<br />${m.key}";
     tp.AddVariable("item", new {Key = "Key", Note = "Note"});
     var x = System.Web.HttpContext.Current.Items;
     string y = tp.ToString();
     // return y;
 }
示例#11
0
        public string CreateTextRes(HttpContext context)
        {
            TemplatePage page = this._app.GetPage(this._plugin, "mg/text_res.html");

            page.AddVariable("entity", "{Id:0}");
            page.AddVariable("content", "");

            return(page.ToString());
        }
示例#12
0
        private void Main()
        {
            TemplatePage tp = new TemplatePage();

            tp.TemplateContent = "$m=item  KEY:${item.key} Note:${item.note}<br />${m.key}";
            tp.AddVariable("item", new { Key = "Key", Note = "Note" });
            var    x = System.Web.HttpContext.Current.Items;
            string y = tp.ToString();
            // return y;
        }
示例#13
0
        public string CreateMenu(HttpContext context)
        {
            int          pi       = int.Parse(context.Request["pi"]) - 1;
            TemplatePage page     = this._app.GetPage(this._plugin, "mg/menu_create.html");
            String       menuJson = JsonConvert.SerializeObject(WeixinHelper.GetMenuTreeNode());

            page.AddVariable("menu", menuJson);
            page.AddVariable("pi", pi);
            return(page.ToString());
        }
示例#14
0
        private void Main()
        {
            IDataContainer dc = new BasicDataContainer(null);
            TemplatePage   tp = new TemplatePage(dc);

            tp.SetTemplateContent("$m=item  KEY:${item.key} Note:${item.note}<br />${m.key}");
            tp.AddVariable("item", new { Key = "Key", Note = "Note" });
            //var x = System.Web.HttpContext.Current.Items;
            string y = tp.ToString();
            // return y;
        }
        public string Partner(HttpContext context)
        {
            string template = Helper.IsWapPortal(context.Request)
                ? "html/partner_mobile.html"
                : "html/partner.html";

            TemplatePage page = Cms.Plugins.GetPage <Main>(template);

            page.AddVariable("page", new PageVariable());
            return(page.ToString());
        }
示例#16
0
        public string EditArticleRes(HttpContext context)
        {
            int          id   = int.Parse(context.Request["id"]);
            TemplatePage page = this._app.GetPage(this._plugin, "mg/article_res.html");
            ArticleRes   res  = IocObject.WeixinRes.GetResById(id) as ArticleRes;

            res.Items = null;
            page.AddVariable("entity", res != null ? JsonConvert.SerializeObject(res) : "{}");

            return(page.ToString());
        }
示例#17
0
        public string CreateArticleItem(HttpContext context)
        {
            string       resId = context.Request["res_id"];
            TemplatePage page  = this._app.GetPage(this._plugin, "mg/article_item.html");

            page.AddVariable("entity", "{Id:0,Enabled:true}");
            page.AddVariable("resId", resId);
            page.AddVariable("content", "");
            page.AddVariable("description", "");

            return(page.ToString());
        }
示例#18
0
        public string Export_Import(HttpContext context)
        {
            if (!RequestProxry.VerifyLogin(context))
            {
                return(null);
            }

            TemplatePage page = Cms.Plugins.GetPage <Main>("admin/export_import.html");

            page.AddVariable("page", new PageVariable());
            page.AddVariable("case", new { json = new object() });
            return(page.ToString());
        }
示例#19
0
        /// <summary>
        /// 导出
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string Export_Setup(HttpContext context)
        {
            if (!RequestProxry.VerifyLogin(context))
            {
                return(null);
            }

            TemplatePage page = Cms.Plugins.GetPage <Main>("mg/export_setup.html");

            page.AddVariable("page", new PageVariable());
            page.AddVariable("export", new { setup = ExportHandle.Setup(context.Request["portal"]) });
            return(page.ToString());
        }
示例#20
0
        public string CreateArticleRes(HttpContext context)
        {
            TemplatePage page = this._app.GetPage(this._plugin, "mg/article_res.html");

            page.AddVariable("entity", "{Id:0}");
            page.AddVariable("data", new
            {
                content     = "",
                description = ""
            });

            return(page.ToString());
        }
示例#21
0
        public string Case_List(HttpContext context)
        {
            if (!RequestProxry.VerifyLogin(context))
            {
                return(null);
            }

            IocObject.Case.UpgradeCaseState();

            TemplatePage page = Cms.Plugins.GetPage <Main>("admin/case_list.html");

            page.AddVariable("page", new PageVariable());
            return(page.ToString());
        }
示例#22
0
        public string EditArticleItem(HttpContext context)
        {
            string         resId = context.Request["res_id"];
            int            id    = int.Parse(context.Request["id"]);
            TemplatePage   page  = this._app.GetPage(this._plugin, "mg/article_item.html");
            ArticleResItem res   = IocObject.WeixinRes.GetArticleItem(id);

            page.AddVariable("content", res.Content);
            page.AddVariable("description", res.Description);
            res.Content     = null;
            res.Description = null;
            page.AddVariable("entity", res != null ? JsonConvert.SerializeObject(res) : "{}");
            page.AddVariable("resId", resId);
            return(page.ToString());
        }
示例#23
0
        /// <summary>
        /// 返回模板内容
        /// </summary>
        /// <param name="templateID"></param>
        /// <param name="data"></param>
        public static string Require(string templateID, object data)
        {
            TemplatePage page = new TemplatePage(templateID, data);

            page.TemplateHandleObject = new Spc.Template.MultLangCmsTemplates();
            page.OnPreInit           += PreHandler;
            page.OnPreRender         += Spc.Template.MultLangCmsTemplates.CompliedTemplate;

            //注册扩展的模板解析事件
            if (OnPreRender != null)
            {
                page.OnPreRender += OnPreRender;
            }

            return(page.ToString());
        }
示例#24
0
        public string EditTextRes(HttpContext context)
        {
            int          id   = int.Parse(context.Request["id"]);
            TemplatePage page = this._app.GetPage(this._plugin, "mg/text_res.html");
            TextRes      res  = IocObject.WeixinRes.GetResById(id) as TextRes;

            if (res == null)
            {
                page.AddVariable("content", "");
                page.AddVariable("entity", "{}");
            }
            else
            {
                page.AddVariable("content", res.Content == null ? "" : res.Content);
                page.AddVariable("entity", JsonConvert.SerializeObject(res));
            }

            return(page.ToString());
        }
        public string Partner_VerifyCase_post(HttpContext context)
        {
            string cashNo      = context.Request["s_cashNo"];
            string partnerCode = context.Request["s_partnerCode"];
            string verifyCode  = context.Request["verifyCode"];

            if (!VerifyCodeManager.Compare(verifyCode))
            {
                return(JsonConvert.SerializeObject(new { result = false, message = "验证码不正确!" }));
            }

            Case _case = IocObject.Case.GetCaseByPartnerCodeAndCashNo(partnerCode, cashNo);

            if (_case == null)
            {
                return(JsonConvert.SerializeObject(new { result = false, message = "" }));
            }
            else
            {
                context.Session["partnerCode"] = partnerCode;

                if (_case.State == -2 || _case.State == -1)
                {
                    return(JsonConvert.SerializeObject(new { result = false, message = "案件不存在" }));
                }
                else if (_case.State == 2)
                {
                    return(JsonConvert.SerializeObject(new { result = false, message = "exists" }));
                }
                else
                {
                    TemplatePage page        = Cms.Plugins.GetPage <Main>("html/partner_saveCase.html");
                    string       entityJson  = JsonConvert.SerializeObject(_case);
                    string       galleryJson = JsonConvert.SerializeObject(IocObject.Case.GetGalleryOfCase(_case.Id));
                    page.AddVariable("entity", new { json = entityJson, galleryJson = galleryJson });

                    return(JsonConvert.SerializeObject(new { result = true, html = page.ToString() }));
                }
            }
        }
示例#26
0
        /// <summary>
        /// 返回模板内容
        /// </summary>
        /// <param name="templateId"></param>
        /// <param name="pageFunc">对模板处理前操作,可以添加数据对象</param>
        public static string Require(string templateId,TemplatePageHandler pageFunc)
        {
            using (CmsTemplates tpl = new CmsTemplates())
            {
                TemplatePage page = new TemplatePage(templateId);
                //if (data != null)
                //{
                //   page.AddDataObject(data);
                //}
                page.TemplateHandleObject = tpl;
                page.OnPreInit += PreHandler;
                page.OnPreRender += CompliedTemplate;

                //注册扩展的模板解析事件
                if (OnPreRender != null) page.OnPreRender += OnPreRender;

                if (pageFunc != null) pageFunc(page);

                return page.ToString();
            }
        }
示例#27
0
 /// <summary>
 /// 呈现内容,默认不压缩
 /// </summary>
 /// <param name="content"></param>
 /// <param name="data"></param>
 /// <param name="compress"></param>
 /// <returns></returns>
 public static string Render(string content, object data,bool compress)
 {
     TemplatePage page = new TemplatePage(null,data);
     page.TemplateContent = content;
     return page.ToString();
 }
示例#28
0
        /// <summary>
        /// 素材管理
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string ResourceList(HttpContext context)
        {
            TemplatePage page = this._app.GetPage(this._plugin, "mg/resource_list.html");

            return(page.ToString());
        }
示例#29
0
        /// <summary>
        /// 返回模板内容
        /// </summary>
        /// <param name="templateID"></param>
        /// <param name="data"></param>
        public static string Require(string templateID, object data)
        {
            TemplatePage page=new TemplatePage(templateID, data);
            page.TemplateHandleObject = new Spc.Template.MultLangCmsTemplates();
            page.OnPreInit += PreHandler;
            page.OnPreRender += Spc.Template.MultLangCmsTemplates.CompliedTemplate;

            //注册扩展的模板解析事件
            if (OnPreRender != null) page.OnPreRender += OnPreRender;

            return page.ToString() ;
        }