public int CreateCustomTemplate(string tempName)
        {
            CustomPage page = new CustomPage();

            if (string.IsNullOrEmpty(tempName))
            {
                return(0);
            }
            page = new CustomPage
            {
                Name          = "页面名称",
                CreateTime    = DateTime.Now,
                Status        = 1,
                TempIndexName = (tempName == "none") ? "" : tempName,
                PageUrl       = page.CreateTime.ToString("yyyyMMddHHmmss"),
                Details       = "自定义页面",
                IsShowMenu    = true,
                DraftDetails  = "自定义页面",
                DraftName     = "页面名称",
                DraftPageUrl  = page.PageUrl,
                PV            = 0,
                DraftJson     = (tempName == "none") ? this.GetCustomTempDefaultJson() : this.GetIndexTempJsonByName(tempName),
                FormalJson    = (tempName == "none") ? this.GetCustomTempDefaultJson() : this.GetIndexTempJsonByName(tempName)
            };
            return(CustomPageHelp.Create(page));
        }
예제 #2
0
        public string GetTemplateJson(System.Web.HttpContext context, int id)
        {
            string result;

            try
            {
                CustomPage customPageByID = CustomPageHelp.GetCustomPageByID(id);
                if (customPageByID == null)
                {
                    result = "";
                }
                else if (customPageByID.Status == 0)
                {
                    result = customPageByID.FormalJson.Replace("\r\n", "").Replace("\n", "");
                }
                else
                {
                    result = customPageByID.DraftJson.Replace("\r\n", "").Replace("\n", "");
                }
            }
            catch
            {
                result = "";
            }
            return(result);
        }
 public bool DeleteCustomPage(int id)
 {
     if (id < 1)
     {
         return(false);
     }
     return(CustomPageHelp.DeletePage(id));
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            string path = (this.Page.RouteData.Values["custpath"] != null) ? this.Page.RouteData.Values["custpath"].ToString() : "notfound";

            this.H_Page.CustomPagePath = path;
            CustomPage customDraftPageByPath = CustomPageHelp.GetCustomDraftPageByPath(path);

            if (customDraftPageByPath == null)
            {
                base.Response.Redirect("/default.aspx");
            }
            this.DraftIsShowMenu = customDraftPageByPath.DraftIsShowMenu;
            string text1 = base.Request.QueryString["ReferralId"];

            this.cssSrc        = this.cssSrc + customDraftPageByPath.TempIndexName + "/css/head.css";
            this.siteSettings  = SettingsManager.GetMasterSettings(true);
            this.htmlTitleName = customDraftPageByPath.DraftName;
            this.Desc          = customDraftPageByPath.DraftDetails;
            string userAgent = this.Page.Request.UserAgent;

            this.EnabeHomePageBottomLink       = this.siteSettings.EnabeHomePageBottomLink;
            this.EnableHomePageBottomCopyright = this.siteSettings.EnableHomePageBottomCopyright;
            this.EnableGuidePageSet            = this.siteSettings.EnableGuidePageSet;
            this.IsAutoGuide          = this.siteSettings.IsAutoGuide;
            this.IsMustConcern        = this.siteSettings.IsMustConcern;
            this.DistributionLinkName = this.siteSettings.DistributionLinkName;
            this.DistributionLink     = string.IsNullOrEmpty(this.siteSettings.DistributionLink) ? "javascript:void(0);" : this.siteSettings.DistributionLink;
            this.CopyrightLinkName    = this.siteSettings.CopyrightLinkName;
            this.CopyrightLink        = string.IsNullOrEmpty(this.siteSettings.CopyrightLink) ? "javascript:void(0);" : this.siteSettings.CopyrightLink;
            if (this.siteSettings.EnableAliPayFuwuGuidePageSet)
            {
                this.AlinfollowUrl = this.siteSettings.AliPayFuwuGuidePageSet;
            }
            if (this.siteSettings.EnableGuidePageSet)
            {
                this.WeixinfollowUrl = this.siteSettings.GuidePageSet;
            }
            if (!base.IsPostBack)
            {
                HiAffiliation.LoadPage();
                string getCurrentWXOpenId = Globals.GetCurrentWXOpenId;
                int    num = Globals.RequestQueryNum("go");
                if ((userAgent.ToLower().Contains("micromessenger") && string.IsNullOrEmpty(getCurrentWXOpenId)) && (this.siteSettings.IsValidationService && (num != 1)))
                {
                    this.Page.Response.Redirect("Follow.aspx?ReferralId=" + Globals.GetCurrentDistributorId());
                    this.Page.Response.End();
                }
                if (((Globals.GetCurrentMemberUserId(false) == 0) && this.siteSettings.IsAutoToLogin) && userAgent.ToLower().Contains("micromessenger"))
                {
                    Uri    url         = HttpContext.Current.Request.Url;
                    string urlToEncode = Globals.GetWebUrlStart() + "/default.aspx?ReferralId=" + Globals.RequestQueryNum("ReferralId").ToString();
                    base.Response.Redirect("/UserLogining.aspx?returnUrl=" + Globals.UrlEncode(urlToEncode));
                    base.Response.End();
                }
                this.showMenu = this.siteSettings.EnableShopMenu;
                this.BindWXInfo();
            }
        }
예제 #5
0
파일: Custom.cs 프로젝트: llenroc/kangaroo
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string text = (this.Page.RouteData.Values["custpath"] != null) ? this.Page.RouteData.Values["custpath"].ToString() : "notfound";

            this.H_Page.CustomPagePath = text;
            CustomPage customPageByPath = CustomPageHelp.GetCustomPageByPath(text);

            if (customPageByPath == null)
            {
                base.Response.Redirect("/default.aspx");
            }
            this.IsShowMenu = customPageByPath.IsShowMenu;
            string value = base.Request.QueryString["ReferralId"];

            if (!string.IsNullOrEmpty(value))
            {
                customPageByPath.PV++;
                CustomPageHelp.Update(customPageByPath);
            }
            if (!string.IsNullOrEmpty(customPageByPath.TempIndexName))
            {
                this.cssSrc     = this.cssSrc + customPageByPath.TempIndexName + "/css/head.css";
                this.cssLinkStr = "<link rel=\"stylesheet\" href=\"" + this.cssSrc + "\">";
            }
            this.siteSettings  = SettingsManager.GetMasterSettings(true);
            this.htmlTitleName = customPageByPath.Name;
            this.Desc          = customPageByPath.Details;
            string userAgent = this.Page.Request.UserAgent;

            if (!base.IsPostBack)
            {
                HiAffiliation.LoadPage();
                string getCurrentWXOpenId = Globals.GetCurrentWXOpenId;
                int    num = Globals.RequestQueryNum("go");
                if (userAgent.ToLower().Contains("micromessenger") && string.IsNullOrEmpty(getCurrentWXOpenId) && this.siteSettings.IsValidationService && num != 1)
                {
                    this.Page.Response.Redirect("Follow.aspx?ReferralId=" + Globals.GetCurrentDistributorId());
                    this.Page.Response.End();
                }
                if (Globals.GetCurrentMemberUserId(false) == 0 && this.siteSettings.IsAutoToLogin && userAgent.ToLower().Contains("micromessenger"))
                {
                    System.Uri arg_1DF_0   = System.Web.HttpContext.Current.Request.Url;
                    string     urlToEncode = Globals.GetWebUrlStart() + "/default.aspx?ReferralId=" + Globals.RequestQueryNum("ReferralId").ToString();
                    base.Response.Redirect("/UserLogining.aspx?returnUrl=" + Globals.UrlEncode(urlToEncode));
                    base.Response.End();
                }
                this.showMenu = this.siteSettings.EnableShopMenu;
                this.BindWXInfo();
            }
        }
예제 #6
0
        public override void DataBind()
        {
            CustomPageQuery query = new CustomPageQuery {
                Name      = this.Page.Request.QueryString["Name"],
                Status    = new int?(this.status),
                PageIndex = this.pager.PageIndex,
                PageSize  = this.pager.PageSize
            };
            DbQueryResult pages = CustomPageHelp.GetPages(query);

            this.Repeater1.DataSource = pages.Data;
            this.Repeater1.DataBind();
            this.pager.TotalRecords = pages.TotalRecords;
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         this.id             = base.Request.QueryString["id"];
         this.model          = CustomPageHelp.GetCustomPageByID(Convert.ToInt32(this.id));
         this.j_pageID.Value = this.id;
         this.La_script.Text = this.GetTemplatescript(this.model.TempIndexName);
         this.isModuleEdit   = true;
         this.modelStatus    = this.model.Status;
         if (!string.IsNullOrEmpty(this.model.TempIndexName) && (this.model.TempIndexName != "none"))
         {
             this.cssSrc        = this.cssSrc + this.model.TempIndexName + "/css/head.css";
             this.scriptSrc     = this.scriptSrc + this.model.TempIndexName + "/script/head.js";
             this.scriptLinkSrc = "<script src=\"" + this.scriptSrc + "\"></script>";
             this.cssLinkSrc    = "<link rel=\"stylesheet\" href=\"" + this.cssSrc + "\">";
         }
     }
 }
 public string GetTemplateJson(HttpContext context, int id)
 {
     try
     {
         CustomPage customPageByID = CustomPageHelp.GetCustomPageByID(id);
         if (customPageByID == null)
         {
             return("");
         }
         if (customPageByID.Status == 0)
         {
             return(customPageByID.FormalJson.Replace("\r\n", "").Replace("\n", ""));
         }
         return(customPageByID.DraftJson.Replace("\r\n", "").Replace("\n", ""));
     }
     catch
     {
         return("");
     }
 }
예제 #9
0
        public int CreateCustomTemplate(string tempName)
        {
            if (string.IsNullOrEmpty(tempName))
            {
                return(0);
            }
            CustomPage customPage = new CustomPage();

            customPage.Name          = "页面名称";
            customPage.CreateTime    = System.DateTime.Now;
            customPage.Status        = 1;
            customPage.TempIndexName = ((tempName == "none") ? "" : tempName);
            customPage.PageUrl       = customPage.CreateTime.ToString("yyyyMMddHHmmss");
            customPage.Details       = "自定义页面";
            customPage.IsShowMenu    = true;
            customPage.DraftDetails  = "自定义页面";
            customPage.DraftName     = "页面名称";
            customPage.DraftPageUrl  = customPage.PageUrl;
            customPage.PV            = 0;
            customPage.DraftJson     = ((tempName == "none") ? this.GetCustomTempDefaultJson() : this.GetIndexTempJsonByName(tempName));
            customPage.FormalJson    = ((tempName == "none") ? this.GetCustomTempDefaultJson() : this.GetIndexTempJsonByName(tempName));
            return(CustomPageHelp.Create(customPage));
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string           str     = context.Request.Form["content"];
            string           str2    = context.Request.Form["id"];
            CustomPageStatus status  = (context.Request.Form["type"] != null) ? ((CustomPageStatus)Convert.ToInt32(context.Request.Form["type"])) : CustomPageStatus.草稿;
            JObject          jo      = (JObject)JsonConvert.DeserializeObject(str);
            string           message = "保存成功";
            string           str4    = "1";

            try
            {
                CustomPage customPageByID = CustomPageHelp.GetCustomPageByID(Convert.ToInt32(str2));
                if (customPageByID == null)
                {
                    context.Response.Write("{\"status\":" + 0 + ",\"msg\":\"找不到相关页面\"}");
                    return;
                }
                if (status == CustomPageStatus.正常)
                {
                    customPageByID.PageUrl    = jo["page"]["pageurl"].ToString().Trim();
                    customPageByID.Name       = jo["page"]["title"].ToString();
                    customPageByID.IsShowMenu = Convert.ToBoolean(jo["page"]["isshowmenu"]);
                    customPageByID.Details    = jo["page"]["subtitle"].ToString();
                    customPageByID.FormalJson = str;
                }
                else
                {
                    customPageByID.DraftPageUrl    = jo["page"]["pageurl"].ToString().Trim();
                    customPageByID.DraftName       = jo["page"]["title"].ToString();
                    customPageByID.DraftIsShowMenu = Convert.ToBoolean(jo["page"]["isshowmenu"]);
                    customPageByID.DraftDetails    = jo["page"]["subtitle"].ToString();
                    customPageByID.DraftJson       = str;
                }
                customPageByID.Status = (int)status;
                if (!CustomPageHelp.Update(customPageByID))
                {
                    context.Response.Write("{\"status\":" + 0 + ",\"msg\":\"保存失败\"}");
                    return;
                }
                if (status == CustomPageStatus.正常)
                {
                    string str5 = "<%@ Control Language=\"C#\" %>\n<%@ Register TagPrefix=\"Hi\" Namespace=\"HiTemplate\" Assembly=\"HiTemplate\" %>";
                    str5 = str5 + this.GetPModulesHtml(context, jo);
                    string lModulesHtml = this.GetLModulesHtml(context, jo);
                    str5 = str5 + lModulesHtml;
                    string path = "/Templates/vshop/custom/" + customPageByID.PageUrl;
                    if (!Directory.Exists(context.Server.MapPath(path)))
                    {
                        Directory.CreateDirectory(context.Server.MapPath(path));
                    }
                    StreamWriter writer = new StreamWriter(context.Server.MapPath(path + "/Skin-HomePage.html"), false, Encoding.UTF8);
                    foreach (char ch in str5)
                    {
                        writer.Write(ch);
                    }
                    writer.Close();
                }
                else
                {
                    string str8 = "<%@ Control Language=\"C#\" %>\n<%@ Register TagPrefix=\"Hi\" Namespace=\"HiTemplate\" Assembly=\"HiTemplate\" %>";
                    str8 = str8 + this.GetPModulesHtml(context, jo);
                    string str9 = this.GetLModulesHtml(context, jo);
                    str8 = str8 + str9;
                    string str10 = "/Templates/vshop/custom/draft/" + customPageByID.DraftPageUrl;
                    if (!Directory.Exists(context.Server.MapPath(str10)))
                    {
                        Directory.CreateDirectory(context.Server.MapPath(str10));
                    }
                    StreamWriter writer2 = new StreamWriter(context.Server.MapPath(str10 + "/Skin-HomePage.html"), false, Encoding.UTF8);
                    foreach (char ch2 in str8)
                    {
                        writer2.Write(ch2);
                    }
                    writer2.Close();
                }
            }
            catch (Exception exception)
            {
                message = exception.Message;
                str4    = "0";
            }
            if (context.Request.Form["is_preview"] == "1")
            {
                context.Response.Write("{\"status\":" + str4 + ",\"msg\":\"" + message + "\",\"link\":\"default.aspx\"}");
            }
            else
            {
                context.Response.Write("{\"status\":" + str4 + ",\"msg\":\"" + message + "\"}");
            }
        }
 public DbQueryResult GetCustomPageTable(HttpContext context)
 {
     return(CustomPageHelp.GetPages(this.GetCustomPageSearch(context)));
 }
예제 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string custPath = Page.RouteData.Values["custpath"] != null ? Page.RouteData.Values["custpath"].ToString() : "notfound";

            H_Page.CustomPagePath = custPath;
            var model = CustomPageHelp.GetCustomPageByPath(custPath);

            if (model == null)
            {
                Response.Redirect("/default.aspx");
            }

            IsShowMenu = model.IsShowMenu;
            string reId = Request.QueryString["ReferralId"];

            if (!string.IsNullOrEmpty(reId))
            {
                model.PV += 1;
                CustomPageHelp.Update(model);
            }
            if (!string.IsNullOrEmpty(model.TempIndexName))
            {
                cssSrc    += model.TempIndexName + "/css/head.css";
                cssLinkStr = "<link rel=\"stylesheet\" href=\"" + cssSrc + "\">";
            }
            siteSettings = SettingsManager.GetMasterSettings(true);
            //ShowCopyRight = siteSettings.ShowCopyRight;
            htmlTitleName = model.Name;
            Desc          = model.Details;
            string userAgent = Page.Request.UserAgent;//获取浏览器信息

            //EnabeHomePageBottomLink = siteSettings.EnabeHomePageBottomLink;//控制底部菜单是否显示
            //EnableHomePageBottomCopyright = siteSettings.EnableHomePageBottomCopyright;//控制是否显示版权信息
            //EnableGuidePageSet = siteSettings.EnableGuidePageSet;
            //IsAutoGuide = siteSettings.IsAutoGuide;
            //IsMustConcern = siteSettings.IsMustConcern;
            //DistributionLinkName = siteSettings.DistributionLinkName;//分销申请栏目名称
            //DistributionLink = string.IsNullOrEmpty(siteSettings.DistributionLink) ? "javascript:void(0);" : siteSettings.DistributionLink; //分销申请链接
            //CopyrightLinkName = siteSettings.CopyrightLinkName;//版本信息文字
            //CopyrightLink = string.IsNullOrEmpty(siteSettings.CopyrightLink) ? "javascript:void(0);" : siteSettings.CopyrightLink; //文字对应跳转链接

            //if (siteSettings.EnableAliPayFuwuGuidePageSet)
            //{
            //    AlinfollowUrl = siteSettings.AliPayFuwuGuidePageSet;//服务窗口关注连接
            //}
            //if (siteSettings.EnableGuidePageSet)
            //{
            //    WeixinfollowUrl = siteSettings.GuidePageSet; //微信关注连接
            //}

            if (!IsPostBack)
            {
                HiAffiliation.LoadPage();//放在前面,防止参数丢失

                string weiXinOpenID = Globals.GetCurrentWXOpenId;
                int    goId         = Globals.RequestQueryNum("go");
                if (userAgent.ToLower().Contains("micromessenger") && string.IsNullOrEmpty(weiXinOpenID) && siteSettings.IsValidationService && goId != 1)   //判断是否是在微信中打开
                {
                    Page.Response.Redirect("Follow.aspx?ReferralId=" + Globals.GetCurrentDistributorId());
                    Page.Response.End();
                }
                int memberID = Globals.GetCurrentMemberUserId();
                if (memberID == 0 && siteSettings.IsAutoToLogin && userAgent.ToLower().Contains("micromessenger"))//判断是否是在微信中打开
                {
                    Uri    linkUri = HttpContext.Current.Request.Url;
                    string toUrl   = Globals.GetWebUrlStart() + "/default.aspx?ReferralId=" + Globals.RequestQueryNum("ReferralId").ToString();
                    Response.Redirect("/UserLogining.aspx?returnUrl=" + Globals.UrlEncode(toUrl));
                    Response.End();
                }


                showMenu = siteSettings.EnableShopMenu;

                BindWXInfo();
            }
        }
예제 #13
0
        public void ProcessRequest(System.Web.HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string           text             = context.Request.Form["content"];
            string           value            = context.Request.Form["id"];
            CustomPageStatus customPageStatus = (CustomPageStatus)((context.Request.Form["type"] != null) ? System.Convert.ToInt32(context.Request.Form["type"]) : 1);
            JObject          jObject          = (JObject)JsonConvert.DeserializeObject(text);
            string           text2            = "保存成功";
            string           text3            = "1";

            try
            {
                CustomPage customPageByID = CustomPageHelp.GetCustomPageByID(System.Convert.ToInt32(value));
                if (customPageByID == null)
                {
                    context.Response.Write("{\"status\":" + 0 + ",\"msg\":\"找不到相关页面\"}");
                    return;
                }
                if (customPageStatus == CustomPageStatus.正常)
                {
                    customPageByID.PageUrl    = jObject["page"]["pageurl"].ToString().Trim();
                    customPageByID.Name       = jObject["page"]["title"].ToString();
                    customPageByID.IsShowMenu = System.Convert.ToBoolean(jObject["page"]["isshowmenu"]);
                    customPageByID.Details    = jObject["page"]["subtitle"].ToString();
                    customPageByID.FormalJson = text;
                }
                else
                {
                    customPageByID.DraftPageUrl    = jObject["page"]["pageurl"].ToString().Trim();
                    customPageByID.DraftName       = jObject["page"]["title"].ToString();
                    customPageByID.DraftIsShowMenu = System.Convert.ToBoolean(jObject["page"]["isshowmenu"]);
                    customPageByID.DraftDetails    = jObject["page"]["subtitle"].ToString();
                    customPageByID.DraftJson       = text;
                }
                customPageByID.Status = (int)customPageStatus;
                if (!CustomPageHelp.Update(customPageByID))
                {
                    context.Response.Write("{\"status\":" + 0 + ",\"msg\":\"保存失败\"}");
                    return;
                }
                if (customPageStatus == CustomPageStatus.正常)
                {
                    string text4 = "<%@ Control Language=\"C#\" %>\n<%@ Register TagPrefix=\"Hi\" Namespace=\"HiTemplate\" Assembly=\"HiTemplate\" %>";
                    text4 += this.GetPModulesHtml(context, jObject);
                    string lModulesHtml = this.GetLModulesHtml(context, jObject);
                    text4 += lModulesHtml;
                    string text5 = "/Templates/vshop/custom/" + customPageByID.PageUrl;
                    if (!System.IO.Directory.Exists(context.Server.MapPath(text5)))
                    {
                        System.IO.Directory.CreateDirectory(context.Server.MapPath(text5));
                    }
                    System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(context.Server.MapPath(text5 + "/Skin-HomePage.html"), false, System.Text.Encoding.UTF8);
                    string text6 = text4;
                    for (int i = 0; i < text6.Length; i++)
                    {
                        char value2 = text6[i];
                        streamWriter.Write(value2);
                    }
                    streamWriter.Close();
                }
                else
                {
                    string text7 = "<%@ Control Language=\"C#\" %>\n<%@ Register TagPrefix=\"Hi\" Namespace=\"HiTemplate\" Assembly=\"HiTemplate\" %>";
                    text7 += this.GetPModulesHtml(context, jObject);
                    string lModulesHtml2 = this.GetLModulesHtml(context, jObject);
                    text7 += lModulesHtml2;
                    string text8 = "/Templates/vshop/custom/draft/" + customPageByID.DraftPageUrl;
                    if (!System.IO.Directory.Exists(context.Server.MapPath(text8)))
                    {
                        System.IO.Directory.CreateDirectory(context.Server.MapPath(text8));
                    }
                    System.IO.StreamWriter streamWriter2 = new System.IO.StreamWriter(context.Server.MapPath(text8 + "/Skin-HomePage.html"), false, System.Text.Encoding.UTF8);
                    string text9 = text7;
                    for (int j = 0; j < text9.Length; j++)
                    {
                        char value3 = text9[j];
                        streamWriter2.Write(value3);
                    }
                    streamWriter2.Close();
                }
            }
            catch (System.Exception ex)
            {
                text2 = ex.Message;
                text3 = "0";
            }
            if (context.Request.Form["is_preview"] == "1")
            {
                context.Response.Write(string.Concat(new string[]
                {
                    "{\"status\":",
                    text3,
                    ",\"msg\":\"",
                    text2,
                    "\",\"link\":\"default.aspx\"}"
                }));
                return;
            }
            context.Response.Write(string.Concat(new string[]
            {
                "{\"status\":",
                text3,
                ",\"msg\":\"",
                text2,
                "\"}"
            }));
        }
예제 #14
0
 public bool DeleteCustomPage(int id)
 {
     return(id >= 1 && CustomPageHelp.DeletePage(id));
 }