public void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } var fieldId = Utils.ToInt(Request.QueryString["fieldId"]); var fieldInfo = Main.Instance.FieldDao.GetFieldInfo(fieldId, false); var settings = new FieldSettings(fieldInfo.Settings); Utils.SelectSingleItem(DdlIsRequired, settings.IsRequired.ToString()); if (Utils.EqualsIgnoreCase(fieldInfo.FieldType, InputType.Text.Value) || Utils.EqualsIgnoreCase(fieldInfo.FieldType, InputType.TextArea.Value)) { PhNum.Visible = PhValidateType.Visible = true; } else { PhNum.Visible = PhValidateType.Visible = false; } TbMinNum.Text = settings.MinNum.ToString(); TbMaxNum.Text = settings.MaxNum.ToString(); ValidateTypeUtils.AddListItems(DdlValidateType); Utils.SelectSingleItem(DdlValidateType, settings.ValidateType.Value); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _tableStyleId = AuthRequest.GetQueryInt("TableStyleID"); _relatedIdentities = TranslateUtils.StringCollectionToIntList(AuthRequest.GetQueryString("RelatedIdentities")); if (_relatedIdentities.Count == 0) { _relatedIdentities.Add(0); } _tableName = AuthRequest.GetQueryString("TableName"); _attributeName = AuthRequest.GetQueryString("AttributeName"); _redirectUrl = StringUtils.ValueFromUrl(AuthRequest.GetQueryString("RedirectUrl")); _styleInfo = _tableStyleId != 0 ? TableStyleManager.GetTableStyleInfo(_tableStyleId) : TableStyleManager.GetTableStyleInfo(_tableName, _attributeName, _relatedIdentities); if (IsPostBack) { return; } DdlIsValidate.Items[0].Value = true.ToString(); DdlIsValidate.Items[1].Value = false.ToString(); ControlUtils.SelectSingleItem(DdlIsValidate, _styleInfo.Additional.IsValidate.ToString()); DdlIsRequired.Items[0].Value = true.ToString(); DdlIsRequired.Items[1].Value = false.ToString(); ControlUtils.SelectSingleItem(DdlIsRequired, _styleInfo.Additional.IsRequired.ToString()); PhNum.Visible = InputTypeUtils.EqualsAny(_styleInfo.InputType, InputType.Text, InputType.TextArea); TbMinNum.Text = _styleInfo.Additional.MinNum.ToString(); TbMaxNum.Text = _styleInfo.Additional.MaxNum.ToString(); ValidateTypeUtils.AddListItems(DdlValidateType); ControlUtils.SelectSingleItem(DdlValidateType, _styleInfo.Additional.ValidateType.Value); TbRegExp.Text = _styleInfo.Additional.RegExp; TbErrorMessage.Text = _styleInfo.Additional.ErrorMessage; DdlValidate_SelectedIndexChanged(null, EventArgs.Empty); }
public void Page_Load(object sender, EventArgs e) { _apiUrl = HttpUtility.UrlDecode(Request.QueryString["apiUrl"]); _siteId = Convert.ToInt32(Request.QueryString["siteId"]); _channelId = Convert.ToInt32(Request.QueryString["channelId"]); _contentId = Convert.ToInt32(Request.QueryString["contentId"]); _returnUrl = HttpUtility.UrlDecode(Request.QueryString["returnUrl"]); if (!Main.AdminApi.IsSiteAuthorized(_siteId)) { Response.Write("<h1>未授权访问</h1>"); Response.End(); return; } if (IsPostBack) { return; } //删除样式 if (!string.IsNullOrEmpty(Request.QueryString["delete"])) { var fieldId = Convert.ToInt32(Request.QueryString["fieldId"]); Main.FieldDao.Delete(fieldId); LtlMessage.Text = Utils.GetMessageHtml("字段删除成功!", true); } if (!string.IsNullOrEmpty(Request.QueryString["taxis"])) { var fieldId = Convert.ToInt32(Request.QueryString["fieldId"]); var direction = Request.QueryString["direction"]; switch (direction.ToUpper()) { case "UP": Main.FieldDao.TaxisUp(fieldId); break; case "DOWN": Main.FieldDao.TaxisDown(fieldId); break; } LtlMessage.Text = Utils.GetMessageHtml("排序成功!", true); } var fieldList = Main.FieldDao.GetFieldInfoList(_siteId, _channelId, _contentId, false); DgContents.DataSource = fieldList; DgContents.ItemDataBound += DgContents_ItemDataBound; DgContents.DataBind(); //BtnReturn.Attributes.Add("onclick", // $"location.href='{PageManagement.GetRedirectUrl(_siteId)}';return false;"); BtnAddField.Attributes.Add("onclick", $"location.href = '{PageUrl}&addField={true}';return false;"); if (!string.IsNullOrEmpty(Request.QueryString["addField"])) { PhModalAdd.Visible = true; var fieldId = Convert.ToInt32(Request.QueryString["fieldId"]); var fieldInfo = fieldId > 0 ? Main.FieldDao.GetFieldInfo(fieldId, true) : new FieldInfo(); LtlModalAddTitle.Text = fieldId > 0 ? "编辑字段" : "新增字段"; LtlScript.Text = @"<script> setTimeout(function() { $('#modalAdd').modal(); }, 100); </script>"; FieldTypeUtils.AddListItems(DdlFieldType); DdlItemType.SelectedValue = fieldInfo.Id != 0 ? false.ToString() : true.ToString(); TbAttributeName.Text = fieldInfo.AttributeName; TbDisplayName.Text = fieldInfo.DisplayName; TbPlaceHolder.Text = fieldInfo.PlaceHolder; Utils.SelectListItems(DdlFieldType, fieldInfo.FieldType); Utils.SelectListItems(DdlIsDisabled, fieldInfo.IsDisabled.ToString()); TbItemCount.Text = fieldInfo.Items.Count.ToString(); RptItems.DataSource = FieldManager.GetFieldItemDataSet(fieldInfo.Items.Count, fieldInfo.Items); RptItems.ItemDataBound += RptItems_ItemDataBound; RptItems.DataBind(); var isSelected = false; var list = new List <string>(); foreach (var item in fieldInfo.Items) { list.Add(item.Value); if (item.IsSelected) { isSelected = true; } } DdlItemType.SelectedValue = (!isSelected).ToString(); TbItemValues.Text = string.Join(",", list); ReFresh(null, EventArgs.Empty); } else if (!string.IsNullOrEmpty(Request.QueryString["validateField"])) { PhModalValidate.Visible = true; var fieldId = Convert.ToInt32(Request.QueryString["fieldId"]); var fieldInfo = Main.FieldDao.GetFieldInfo(fieldId, false); LtlScript.Text = @"<script> setTimeout(function() { $('#modalValidate').modal(); }, 100); </script>"; var settings = new FieldSettings(fieldInfo.FieldSettings); Utils.SelectListItems(DdlIsValidate, settings.IsValidate.ToString()); Utils.SelectListItems(DdlIsRequired, settings.IsRequired.ToString()); if (Utils.EqualsIgnoreCase(fieldInfo.FieldType, nameof(FieldType.Text)) || Utils.EqualsIgnoreCase(fieldInfo.FieldType, nameof(FieldType.TextArea))) { PhNum.Visible = true; } else { PhNum.Visible = false; } TbMinNum.Text = settings.MinNum.ToString(); TbMaxNum.Text = settings.MaxNum.ToString(); ValidateTypeUtils.AddListItems(DdlValidateType); Utils.SelectListItems(DdlValidateType, settings.ValidateType.Value); TbErrorMessage.Text = settings.ErrorMessage; Validate_SelectedIndexChanged(null, EventArgs.Empty); } //var redirectUrl = GetRedirectUrl(PublishmentSystemId, _tableStyle, _tableName, _relatedIdentity, _itemId); //btnAddStyle.Attributes.Add("onclick", ModalTableStyleAdd.GetOpenWindowString(PublishmentSystemId, 0, _relatedIdentities, _tableName, string.Empty, _tableStyle, redirectUrl)); //btnAddStyles.Attributes.Add("onclick", ModalTableStylesAdd.GetOpenWindowString(PublishmentSystemId, _relatedIdentities, _tableName, _tableStyle, redirectUrl)); //btnImport.Attributes.Add("onclick", ModalTableStyleImport.GetOpenWindowString(_tableName, _tableStyle, PublishmentSystemId, _relatedIdentity)); //btnExport.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(_tableStyle, _tableName, PublishmentSystemId, _relatedIdentity)); }
public void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } //删除样式 if (!string.IsNullOrEmpty(Request.QueryString["delete"])) { var fieldId = Convert.ToInt32(Request.QueryString["fieldId"]); Main.Instance.FieldDao.Delete(fieldId); LtlMessage.Text = Utils.GetMessageHtml("字段删除成功!", true); } if (!string.IsNullOrEmpty(Request.QueryString["taxis"])) { var fieldId = Convert.ToInt32(Request.QueryString["fieldId"]); var direction = Request.QueryString["direction"]; switch (direction.ToUpper()) { case "UP": Main.Instance.FieldDao.TaxisUp(fieldId); break; case "DOWN": Main.Instance.FieldDao.TaxisDown(fieldId); break; } LtlMessage.Text = Utils.GetMessageHtml("排序成功!", true); } var fieldList = Main.Instance.FieldDao.GetFieldInfoList(FormInfo.Id, false); DgContents.DataSource = fieldList; DgContents.ItemDataBound += DgContents_ItemDataBound; DgContents.DataBind(); //BtnReturn.Attributes.Add("onclick", // $"location.href='{PageManagement.GetRedirectUrl(_siteId)}';return false;"); BtnAddField.Attributes.Add("onclick", $"location.href = '{PageFieldsUrl}&addField={true}';return false;"); if (!string.IsNullOrEmpty(Request.QueryString["addField"])) { PhModalAdd.Visible = true; var fieldId = Convert.ToInt32(Request.QueryString["fieldId"]); var fieldInfo = fieldId > 0 ? Main.Instance.FieldDao.GetFieldInfo(fieldId, true) : new FieldInfo(); LtlModalAddTitle.Text = fieldId > 0 ? "编辑字段" : "新增字段"; LtlScript.Text = @"<script> setTimeout(function() { $('#modalAdd').modal(); }, 100); </script>"; FieldTypeUtils.AddListItems(DdlFieldType); DdlIsRapid.SelectedValue = fieldInfo.Id != 0 ? false.ToString() : true.ToString(); TbTitle.Text = fieldInfo.Title; TbDescription.Text = fieldInfo.Description; TbPlaceHolder.Text = fieldInfo.PlaceHolder; Utils.SelectSingleItem(DdlFieldType, fieldInfo.FieldType); TbItemCount.Text = fieldInfo.Items.Count.ToString(); RptItems.DataSource = GetDataSource(fieldInfo.Items.Count, fieldInfo.Items); RptItems.ItemDataBound += RptItems_ItemDataBound; RptItems.DataBind(); var isSelected = false; var isExtras = false; var list = new List <string>(); foreach (var item in fieldInfo.Items) { list.Add(item.Value); if (item.IsSelected) { isSelected = true; } if (item.IsExtras) { isExtras = true; } } DdlIsRapid.SelectedValue = (!isSelected && !isExtras).ToString(); TbRapidValues.Text = string.Join(",", list); ReFresh(null, EventArgs.Empty); } else if (!string.IsNullOrEmpty(Request.QueryString["validateField"])) { PhModalValidate.Visible = true; var fieldId = Convert.ToInt32(Request.QueryString["fieldId"]); var fieldInfo = Main.Instance.FieldDao.GetFieldInfo(fieldId, false); LtlScript.Text = @"<script> setTimeout(function() { $('#modalValidate').modal(); }, 100); </script>"; var settings = new FieldSettings(fieldInfo.Settings); Utils.SelectSingleItem(DdlIsRequired, settings.IsRequired.ToString()); if (Utils.EqualsIgnoreCase(fieldInfo.FieldType, nameof(FieldType.Text)) || Utils.EqualsIgnoreCase(fieldInfo.FieldType, nameof(FieldType.TextArea))) { PhNum.Visible = PhValidateType.Visible = true; } else { PhNum.Visible = PhValidateType.Visible = false; } TbMinNum.Text = settings.MinNum.ToString(); TbMaxNum.Text = settings.MaxNum.ToString(); ValidateTypeUtils.AddListItems(DdlValidateType); Utils.SelectSingleItem(DdlValidateType, settings.ValidateType.Value); } //var redirectUrl = GetRedirectUrl(SiteId, _tableStyle, _tableName, _relatedIdentity, _itemId); //btnAddStyle.Attributes.Add("onclick", ModalTableStyleAdd.GetOpenWindowString(SiteId, 0, _relatedIdentities, _tableName, string.Empty, _tableStyle, redirectUrl)); //btnAddStyles.Attributes.Add("onclick", ModalTableStylesAdd.GetOpenWindowString(SiteId, _relatedIdentities, _tableName, _tableStyle, redirectUrl)); //btnImport.Attributes.Add("onclick", ModalTableStyleImport.GetOpenWindowString(_tableName, _tableStyle, SiteId, _relatedIdentity)); //btnExport.Attributes.Add("onclick", ModalExportMessage.GetOpenWindowStringToSingleTableStyle(_tableStyle, _tableName, SiteId, _relatedIdentity)); }