public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } _appointmentId = Body.GetQueryInt("appointmentID"); _appointmentItemId = Body.GetQueryInt("appointmentItemID"); var selectImageClick = ModalSelectImage.GetOpenWindowString(PublishmentSystemInfo, TbContentImageUrl.ClientID); var uploadImageClick = ModalUploadImageSingle.GetOpenWindowStringToTextBox(PublishmentSystemId, TbContentImageUrl.ClientID); var cuttingImageClick = ModalCuttingImage.GetOpenWindowStringWithTextBox(PublishmentSystemId, TbContentImageUrl.ClientID); var previewImageClick = ModalMessage.GetOpenWindowStringToPreviewImage(PublishmentSystemId, TbContentImageUrl.ClientID); LtlContentImageUrl.Text = $@" <a class=""btn"" href=""javascript:;"" onclick=""{selectImageClick};return false;"" title=""选择""><i class=""icon-th""></i></a> <a class=""btn"" href=""javascript:;"" onclick=""{uploadImageClick};return false;"" title=""上传""><i class=""icon-arrow-up""></i></a> <a class=""btn"" href=""javascript:;"" onclick=""{cuttingImageClick};return false;"" title=""裁切""><i class=""icon-crop""></i></a> <a class=""btn"" href=""javascript:;"" onclick=""{previewImageClick};return false;"" title=""预览""><i class=""icon-eye-open""></i></a>"; var selectVideoClick = ModalSelectVideo.GetOpenWindowString(PublishmentSystemInfo, TbContentVideoUrl.ClientID); var uploadVideoClick = ModalUploadVideo.GetOpenWindowStringToTextBox(PublishmentSystemId, TbContentVideoUrl.ClientID); var previewVideoClick = ModalMessage.GetOpenWindowStringToPreviewVideoByUrl(PublishmentSystemId, TbContentVideoUrl.ClientID); LtlContentVideoUrl.Text = $@" <a class=""btn"" href=""javascript:;"" onclick=""{selectVideoClick};return false;"" title=""选择""><i class=""icon-th""></i></a> <a class=""btn"" href=""javascript:;"" onclick=""{uploadVideoClick};return false;"" title=""上传""><i class=""icon-arrow-up""></i></a> <a class=""btn"" href=""javascript:;"" onclick=""{previewVideoClick};return false;"" title=""预览""><i class=""icon-eye-open""></i></a>"; if (!IsPostBack) { LtlTopImageUrl.Text = $@"<img id=""preview_topImageUrl"" src=""{AppointmentManager.GetImageUrl(PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />"; if (_appointmentItemId > 0) { var appointmentItemInfo = DataProviderWx.AppointmentItemDao.GetItemInfo(_appointmentItemId); if (appointmentItemInfo != null) { TbTitle.Text = appointmentItemInfo.Title; TopImageUrl.Value = appointmentItemInfo.TopImageUrl; CbIsDescription.Checked = appointmentItemInfo.IsDescription; TbDescriptionTitle.Text = appointmentItemInfo.DescriptionTitle; TbDescription.Text = appointmentItemInfo.Description; CbIsImageUrl.Checked = appointmentItemInfo.IsImageUrl; TbImageUrlTitle.Text = appointmentItemInfo.ImageUrlTitle; TbContentImageUrl.Text = appointmentItemInfo.ImageUrl; CbIsVideoUrl.Checked = appointmentItemInfo.IsVideoUrl; TbVideoUrlTitle.Text = appointmentItemInfo.VideoUrlTitle; TbContentVideoUrl.Text = appointmentItemInfo.VideoUrl; CbIsImageUrlCollection.Checked = appointmentItemInfo.IsImageUrlCollection; TbImageUrlCollectionTitle.Text = appointmentItemInfo.ImageUrlCollectionTitle; ImageUrlCollection.Value = appointmentItemInfo.ImageUrlCollection; LargeImageUrlCollection.Value = appointmentItemInfo.LargeImageUrlCollection; CbIsMap.Checked = appointmentItemInfo.IsMap; TbMapTitle.Text = appointmentItemInfo.MapTitle; TbMapAddress.Text = appointmentItemInfo.MapAddress; CbIsTel.Checked = appointmentItemInfo.IsTel; TbTelTitle.Text = appointmentItemInfo.TelTitle; TbTel.Text = appointmentItemInfo.Tel; if (!string.IsNullOrEmpty(appointmentItemInfo.TopImageUrl)) { LtlTopImageUrl.Text = $@"<img id=""preview_topImageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, appointmentItemInfo.TopImageUrl)}"" width=""370"" align=""middle"" />"; } if (!string.IsNullOrEmpty(appointmentItemInfo.MapAddress)) { LtlMap.Text = $@"<iframe style=""width:100%;height:100%;background-color:#ffffff;margin-bottom:15px;"" scrolling=""auto"" frameborder=""0"" width=""100%"" height=""100%"" src=""{MapManager.GetMapUrl(PublishmentSystemInfo, TbMapAddress.Text)}""></iframe>"; } if (!string.IsNullOrEmpty(appointmentItemInfo.ImageUrlCollection)) { var scriptBuilder = new StringBuilder(); scriptBuilder.AppendFormat(@" addImage('{0}','{1}'); ", appointmentItemInfo.ImageUrlCollection, appointmentItemInfo.LargeImageUrlCollection); LtlScript.Text = $@" $(document).ready(function(){{ {scriptBuilder} }}); "; } } } } // this.btnAddImageUrl.Attributes.Add("onclick", Modal.AppointmentItemPhotoUpload.GetOpenWindowStringToAdd(base.PublishmentSystemId, this.imageUrlCollection.Value)); }
private static string ParseVideo(IAttributes attributes, SiteInfo siteInfo, int channelId, TableStyleInfo styleInfo, StringBuilder extraBulder) { var attributeName = styleInfo.AttributeName; var btnAddHtml = string.Empty; if (channelId > 0) { btnAddHtml = $@" <button class=""btn"" onclick=""add_{attributeName}('',true);return false;""> 新增 </button> "; } extraBulder.Append($@" <div class=""btn-group btn-group-sm""> <button class=""btn"" onclick=""{ModalUploadVideo.GetOpenWindowStringToTextBox(siteInfo.Id, attributeName)}""> 上传 </button> <button class=""btn"" onclick=""{ModalSelectVideo.GetOpenWindowString(siteInfo, attributeName)}""> 选择 </button> <button class=""btn"" onclick=""{ModalMessage.GetOpenWindowStringToPreviewVideo(siteInfo.Id, attributeName)}""> 预览 </button> {btnAddHtml} </div>"); var extendAttributeName = ContentAttribute.GetExtendAttributeName(attributeName); extraBulder.Append($@" <script type=""text/javascript""> function select_{attributeName}(obj, index){{ var cmd = ""{ModalSelectVideo.GetOpenWindowString(siteInfo, attributeName)}"".replace('{attributeName}', '{attributeName}_' + index).replace('return false;', ''); eval(cmd); }} function upload_{attributeName}(obj, index){{ var cmd = ""{ModalUploadVideo.GetOpenWindowStringToTextBox(siteInfo.Id, attributeName)}"".replace('{attributeName}', '{attributeName}_' + index).replace('return false;', ''); eval(cmd); }} function preview_{attributeName}(obj, index){{ var cmd = ""{ModalMessage.GetOpenWindowStringToPreviewVideo(siteInfo.Id, attributeName)}"".replace(/{attributeName}/g, '{attributeName}_' + index).replace('return false;', ''); eval(cmd); }} function delete_{attributeName}(obj){{ $(obj).parent().parent().parent().remove(); }} var index_{attributeName} = 0; function add_{attributeName}(val,foucs){{ index_{attributeName}++; var inputHtml = '<input id=""{attributeName}_'+index_{attributeName}+'"" name=""{extendAttributeName}"" type=""text"" class=""form-control"" value=""'+val+'"" />'; var btnHtml = '<div class=""btn-group btn-group-sm"">'; btnHtml += '<button class=""btn"" href=""javascript:;"" onclick=""select_{attributeName}(this, '+index_{attributeName}+');return false;"">选择</button>'; btnHtml += '<button class=""btn"" href=""javascript:;"" onclick=""upload_{attributeName}(this, '+index_{attributeName}+');return false;"">上传</button>'; btnHtml += '<button class=""btn"" href=""javascript:;"" onclick=""preview_{attributeName}(this, '+index_{attributeName}+');return false;"">预览</button>'; btnHtml += '<button class=""btn"" href=""javascript:;"" onclick=""delete_{attributeName}(this);return false;"">删除</button>'; btnHtml += '</div>'; var div = $('.{extendAttributeName}').length == 0 ? $('#{attributeName}').parent().parent() : $('.{extendAttributeName}:last'); div.after('<div class=""form-group form-row {extendAttributeName}""><label class=""col-sm-1 col-form-label text-right""></label><div class=""col-sm-6"">' + inputHtml + '</div><div class=""col-sm-5"">' + btnHtml + '</div></div>'); if (foucs) $('#{attributeName}_'+index_{attributeName}).focus(); }} "); var extendValues = attributes.GetString(extendAttributeName); if (!string.IsNullOrEmpty(extendValues)) { foreach (var extendValue in TranslateUtils.StringCollectionToStringList(extendValues)) { if (!string.IsNullOrEmpty(extendValue)) { extraBulder.Append($"add_{attributeName}('{extendValue}',false);"); } } } extraBulder.Append("</script>"); return($@"<input id=""{attributeName}"" name=""{attributeName}"" type=""text"" class=""form-control"" value=""{attributes.GetString(attributeName)}"" />"); }
public void Page_Load(object sender, EventArgs e) { if (IsForbidden) { return; } PageUtils.CheckRequestParameter("PublishmentSystemId"); _appointmentId = Body.GetQueryInt("appointmentID"); _appointmentItemId = Body.GetQueryInt("appointmentItemID"); var selectImageClick = ModalSelectImage.GetOpenWindowString(PublishmentSystemInfo, TbContentImageUrl.ClientID); var uploadImageClick = ModalUploadImageSingle.GetOpenWindowStringToTextBox(PublishmentSystemId, TbContentImageUrl.ClientID); var cuttingImageClick = ModalCuttingImage.GetOpenWindowStringWithTextBox(PublishmentSystemId, TbContentImageUrl.ClientID); var previewImageClick = ModalMessage.GetOpenWindowStringToPreviewImage(PublishmentSystemId, TbContentImageUrl.ClientID); LtlContentImageUrl.Text = $@" <a class=""btn"" href=""javascript:;"" onclick=""{selectImageClick};return false;"" title=""选择""><i class=""icon-th""></i></a> <a class=""btn"" href=""javascript:;"" onclick=""{uploadImageClick};return false;"" title=""上传""><i class=""icon-arrow-up""></i></a> <a class=""btn"" href=""javascript:;"" onclick=""{cuttingImageClick};return false;"" title=""裁切""><i class=""icon-crop""></i></a> <a class=""btn"" href=""javascript:;"" onclick=""{previewImageClick};return false;"" title=""预览""><i class=""icon-eye-open""></i></a>"; var selectVideoClick = ModalSelectVideo.GetOpenWindowString(PublishmentSystemInfo, TbContentVideoUrl.ClientID); var uploadVideoClick = ModalUploadVideo.GetOpenWindowStringToTextBox(PublishmentSystemId, TbContentVideoUrl.ClientID); var previewVideoClick = ModalMessage.GetOpenWindowStringToPreviewVideoByUrl(PublishmentSystemId, TbContentVideoUrl.ClientID); LtlContentVideoUrl.Text = $@" <a class=""btn"" href=""javascript:;"" onclick=""{selectVideoClick};return false;"" title=""选择""><i class=""icon-th""></i></a> <a class=""btn"" href=""javascript:;"" onclick=""{uploadVideoClick};return false;"" title=""上传""><i class=""icon-arrow-up""></i></a> <a class=""btn"" href=""javascript:;"" onclick=""{previewVideoClick};return false;"" title=""预览""><i class=""icon-eye-open""></i></a>"; if (!IsPostBack) { var pageTitle = _appointmentId > 0 ? "编辑微预约" : "添加微预约"; BreadCrumb(AppManager.WeiXin.LeftMenu.IdFunction, AppManager.WeiXin.LeftMenu.Function.IdAppointment, pageTitle, AppManager.WeiXin.Permission.WebSite.Appointment); LtlPageTitle.Text = pageTitle; LtlImageUrl.Text = $@"<img id=""preview_imageUrl"" src=""{AppointmentManager.GetImageUrl(PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />"; LtlTopImageUrl.Text = $@"<img id=""preview_topImageUrl"" src=""{AppointmentManager.GetItemTopImageUrl( PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />"; LtlResultTopImageUrl.Text = $@"<img id=""preview_resultTopImageUrl"" src=""{AppointmentManager.GetContentResultTopImageUrl( PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />"; LtlContentImageUrl.Text = $@"<img id=""preview_contentImageUrl"" src=""{AppointmentManager.GetContentImageUrl( PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />"; LtlEndImageUrl.Text = $@"<img id=""preview_endImageUrl"" src=""{AppointmentManager.GetEndImageUrl(PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />"; if (_appointmentId == 0) { DtbEndDate.DateTime = DateTime.Now.AddMonths(1); } else { var appointmentInfo = DataProviderWx.AppointmentDao.GetAppointmentInfo(_appointmentId); if (appointmentInfo != null) { TbKeywords.Text = DataProviderWx.KeywordDao.GetKeywords(appointmentInfo.KeywordId); CbIsEnabled.Checked = !appointmentInfo.IsDisabled; DtbStartDate.DateTime = appointmentInfo.StartDate; DtbEndDate.DateTime = appointmentInfo.EndDate; TbTitle.Text = appointmentInfo.Title; if (!string.IsNullOrEmpty(appointmentInfo.ImageUrl)) { LtlImageUrl.Text = $@"<img id=""preview_imageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, appointmentInfo.ImageUrl)}"" width=""370"" align=""middle"" />"; } if (!string.IsNullOrEmpty(appointmentInfo.ContentResultTopImageUrl)) { LtlResultTopImageUrl.Text = $@"<img id=""preview_resultTopImageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, appointmentInfo.ContentResultTopImageUrl)}"" width=""370"" align=""middle"" />"; } TbSummary.Text = appointmentInfo.Summary; TbEndTitle.Text = appointmentInfo.EndTitle; TbEndSummary.Text = appointmentInfo.EndSummary; if (!string.IsNullOrEmpty(appointmentInfo.EndImageUrl)) { LtlEndImageUrl.Text = $@"<img id=""preview_endImageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, appointmentInfo.EndImageUrl)}"" width=""370"" align=""middle"" />"; } ImageUrl.Value = appointmentInfo.ImageUrl; ContentImageUrl.Value = appointmentInfo.ContentImageUrl; ResultTopImageUrl.Value = appointmentInfo.ContentResultTopImageUrl; EndImageUrl.Value = appointmentInfo.EndImageUrl; #region 拓展属性 #region 姓名 if (appointmentInfo.IsFormRealName == "True") { CbIsFormRealName.Checked = true; TbFormRealNameTitle.Text = appointmentInfo.FormRealNameTitle; } else if (string.IsNullOrEmpty(appointmentInfo.IsFormRealName)) { CbIsFormRealName.Checked = true; TbFormRealNameTitle.Text = "姓名"; } else { CbIsFormRealName.Checked = false; TbFormRealNameTitle.Text = appointmentInfo.FormRealNameTitle; } #endregion #region 电话 if (appointmentInfo.IsFormMobile == "True") { CbIsFormMobile.Checked = true; TbFormMobileTitle.Text = appointmentInfo.FormMobileTitle; } else if (string.IsNullOrEmpty(appointmentInfo.IsFormMobile)) { CbIsFormMobile.Checked = true; TbFormMobileTitle.Text = "电话"; } else { CbIsFormMobile.Checked = false; TbFormMobileTitle.Text = appointmentInfo.FormMobileTitle; } #endregion #region 邮箱 if (appointmentInfo.IsFormEmail == "True") { CbIsFormEmail.Checked = true; TbFormEmailTitle.Text = appointmentInfo.FormEmailTitle; } else if (string.IsNullOrEmpty(appointmentInfo.IsFormEmail)) { CbIsFormEmail.Checked = true; TbFormEmailTitle.Text = "电话"; } else { CbIsFormEmail.Checked = false; TbFormEmailTitle.Text = appointmentInfo.FormEmailTitle; } #endregion _appointmentItemId = DataProviderWx.AppointmentItemDao.GetItemId(PublishmentSystemId, _appointmentId); var configExtendInfoList = DataProviderWx.ConfigExtendDao.GetConfigExtendInfoList(PublishmentSystemId, appointmentInfo.Id, EKeywordTypeUtils.GetValue(EKeywordType.Appointment)); var itemBuilder = new StringBuilder(); foreach (var configExtendInfo in configExtendInfoList) { if (string.IsNullOrEmpty(configExtendInfo.IsVisible)) { configExtendInfo.IsVisible = "checked=checked"; } else if (configExtendInfo.IsVisible == "True") { configExtendInfo.IsVisible = "checked=checked"; } else { configExtendInfo.IsVisible = ""; } itemBuilder.AppendFormat(@"{{id: '{0}', attributeName: '{1}',isVisible:'{2}'}},", configExtendInfo.Id, configExtendInfo.AttributeName, configExtendInfo.IsVisible); } if (itemBuilder.Length > 0) { itemBuilder.Length--; } LtlAwardItems.Text = $@"itemController.itemCount = {configExtendInfoList.Count};itemController.items = [{itemBuilder}];"; #endregion } } if (_appointmentItemId > 0) { var appointmentItemInfo = DataProviderWx.AppointmentItemDao.GetItemInfo(_appointmentItemId); if (appointmentItemInfo != null) { TbItemTitle.Text = appointmentItemInfo.Title; TopImageUrl.Value = appointmentItemInfo.TopImageUrl; CbIsDescription.Checked = appointmentItemInfo.IsDescription; TbDescriptionTitle.Text = appointmentItemInfo.DescriptionTitle; TbDescription.Text = appointmentItemInfo.Description; CbIsImageUrl.Checked = appointmentItemInfo.IsImageUrl; TbImageUrlTitle.Text = appointmentItemInfo.ImageUrlTitle; TbContentImageUrl.Text = appointmentItemInfo.ImageUrl; CbIsVideoUrl.Checked = appointmentItemInfo.IsVideoUrl; TbVideoUrlTitle.Text = appointmentItemInfo.VideoUrlTitle; TbContentVideoUrl.Text = appointmentItemInfo.VideoUrl; CbIsImageUrlCollection.Checked = appointmentItemInfo.IsImageUrlCollection; TbImageUrlCollectionTitle.Text = appointmentItemInfo.ImageUrlCollectionTitle; ImageUrlCollection.Value = appointmentItemInfo.ImageUrlCollection; LargeImageUrlCollection.Value = appointmentItemInfo.LargeImageUrlCollection; CbIsMap.Checked = appointmentItemInfo.IsMap; TbMapTitle.Text = appointmentItemInfo.MapTitle; TbMapAddress.Text = appointmentItemInfo.MapAddress; CbIsTel.Checked = appointmentItemInfo.IsTel; TbTelTitle.Text = appointmentItemInfo.TelTitle; TbTel.Text = appointmentItemInfo.Tel; if (!string.IsNullOrEmpty(appointmentItemInfo.TopImageUrl)) { LtlTopImageUrl.Text = $@"<img id=""preview_imageUrl"" src=""{PageUtility.ParseNavigationUrl( PublishmentSystemInfo, appointmentItemInfo.TopImageUrl)}"" width=""370"" align=""middle"" />"; } if (!string.IsNullOrEmpty(appointmentItemInfo.MapAddress)) { LtlMap.Text = $@"<iframe style=""width:100%;height:100%;background-color:#ffffff;margin-bottom:15px;"" scrolling=""auto"" frameborder=""0"" width=""100%"" height=""100%"" src=""{MapManager.GetMapUrl(PublishmentSystemInfo, TbMapAddress.Text)}""></iframe>"; } if (!string.IsNullOrEmpty(appointmentItemInfo.ImageUrlCollection)) { var scriptBuilder = new StringBuilder(); scriptBuilder.AppendFormat(@" addImage('{0}','{1}'); ", appointmentItemInfo.ImageUrlCollection, appointmentItemInfo.LargeImageUrlCollection); LtlScript.Text = $@" $(document).ready(function(){{ {scriptBuilder} }}); "; } } } BtnReturn.Attributes.Add("onclick", $@"location.href=""{PageAppointment.GetRedirectUrl(PublishmentSystemId)}"";return false"); } }