예제 #1
0
        public void LbTemplate_Click(object sender, EventArgs e)
        {
            CacheUtils.InsertMinutes("SiteServer.BackgroundPages.Cms.PageTemplatePreview", Main.Instance.DataApi.Encrypt(ParseUtils.GetFormStlElement(FormInfo)), 5);
            var url =
                Main.Instance.FilesApi.GetAdminDirectoryUrl(
                    $"cms/pageTemplatePreview.aspx?siteId={SiteId}&fromCache={true}&returnUrl={Main.Instance.DataApi.Encrypt(PageLogsUrl)}");

            Response.Redirect(Main.Instance.FilesApi.GetAdminDirectoryUrl($"loading.aspx?redirectUrl={Main.Instance.DataApi.Encrypt(url)}"));
        }
예제 #2
0
        public void Page_Load(object sender, EventArgs e)
        {
            _apiUrl    = HttpUtility.UrlDecode(Request.QueryString["apiUrl"]);
            _siteId    = Convert.ToInt32(Request.QueryString["siteId"]);
            _formId    = Convert.ToInt32(Request.QueryString["formId"]);
            _returnUrl = GetRedirectUrl(_apiUrl, _siteId);

            if (!Main.Instance.AdminApi.IsSiteAuthorized(_siteId))
            {
                Response.Write("<h1>未授权访问</h1>");
                Response.End();
                return;
            }

            if (_formId > 0)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["up"]) || !string.IsNullOrEmpty(Request.QueryString["down"]))
                {
                    if (string.IsNullOrEmpty(Request.QueryString["down"]))
                    {
                        Main.Instance.FormDao.UpdateTaxisToDown(_siteId, _formId);
                    }
                    else
                    {
                        Main.Instance.FormDao.UpdateTaxisToUp(_siteId, _formId);
                    }
                }
                if (!string.IsNullOrEmpty(Request.QueryString["delete"]))
                {
                    Main.Instance.FormDao.Delete(_formId);

                    LtlMessage.Text = Utils.GetMessageHtml("表单删除成功!", true);
                }
                if (!string.IsNullOrEmpty(Request.QueryString["template"]))
                {
                    var formInfo = Main.Instance.FormDao.GetFormInfo(_formId);
                    CacheUtils.InsertMinutes("SiteServer.BackgroundPages.Cms.PageTemplatePreview",
                                             Main.Instance.DataApi.Encrypt(ParseUtils.GetFormStlElement(formInfo)),
                                             5);
                    Response.Redirect(Main.Instance.FilesApi.GetAdminDirectoryUrl($"cms/pageTemplatePreview.aspx?siteId={_siteId}&fromCache={true}&returnUrl={Main.Instance.DataApi.Encrypt(_returnUrl)}"));
                    return;
                }
            }

            if (IsPostBack)
            {
                return;
            }

            DgContents.DataSource     = Main.Instance.FormDao.GetFormInfoListNotInChannel(_siteId);
            DgContents.ItemDataBound += DgContents_ItemDataBound;
            DgContents.DataBind();

            BtnAddInput.Attributes.Add("onclick", $"location.href = '{_returnUrl}&add={true}';return false;");
            BtnImport.Attributes.Add("onclick", $"location.href = '{_returnUrl}&import={true}';return false;");

            if (!string.IsNullOrEmpty(Request.QueryString["add"]))
            {
                PhModalAdd.Visible = true;
                if (_formId > 0)
                {
                    LtlModalAddTitle.Text = "编辑表单";

                    var formInfo = Main.Instance.FormDao.GetFormInfo(_formId);

                    TbTitle.Text       = formInfo.Title;
                    TbDescription.Text = formInfo.Description;
                }
                else
                {
                    LtlModalAddTitle.Text = "添加表单";
                }
            }
            else if (!string.IsNullOrEmpty(Request.QueryString["import"]))
            {
                PhModalImport.Visible = true;
            }
            //else if (!string.IsNullOrEmpty(Request.QueryString["export"]))
            //{
            //    string fileName;
            //    if (Utils.ExportInput(_formId, out fileName))
            //    {
            //        LtlScript.Text = Utils.SwalSuccess("导出成功", "点击按钮下载导出文件", "下 载", $"location.href = '{Main.Instance.Context.FilesApi.GetRootUrl($"sitefiles/temporaryfiles/{fileName}")}'");
            //    }
            //}
        }