Пример #1
0
        public async Task <IActionResult> OnPostSavePlugin()
        {
            var modalDetails = new ModalMessage
            {
                RequestPage = "add",
            };

            if (IsValid())
            {
                await SetValues();

                var response = await _pluginsController.PostAddPlugin(PrivatePlugin);

                var statusCode = (response as StatusCodeResult).StatusCode;

                if (statusCode.Equals(200))
                {
                    modalDetails.ModalType = ModalType.SuccessMessage;
                    modalDetails.Message   = $"{PrivatePlugin.Name} was added.";
                }
            }
            else
            {
                modalDetails.Title     = string.Empty;
                modalDetails.Message   = "Please fill all required values.";
                modalDetails.ModalType = ModalType.WarningMessage;
            }
            return(Partial("_ModalPartial", modalDetails));
        }
Пример #2
0
        /// <summary>
        /// Load questions sets into cbbQuestionsSets
        /// </summary>
        protected void LoadQuestionsSets()
        {
            var response = _triviaApp.GetQuestionsSets();

            if (response.Success)
            {
                _questionsSets = response.Data;

                ListStore store = new ListStore(typeof(string));
                this.cbbQuestionsSets.Model = store;

                foreach (var questionsSet in _questionsSets)
                {
                    this.cbbQuestionsSets.AppendText(questionsSet.Name);
                }
                if (_questionsSets.Any())
                {
                    cbbQuestionsSets.Active         = DEFAULT_QUESTIONS_SET_IDX;
                    _triviaApp.SelectedQuestionsSet = _questionsSets.ElementAt(DEFAULT_QUESTIONS_SET_IDX);
                }
            }
            else
            {
                ModalMessage.Error(this, response.Message);
            }
        }
Пример #3
0
        public async Task <IActionResult> OnPostSavePluginAsync()
        {
            var modalDetails = new ModalMessage();

            if (IsValid())
            {
                SetEditedValues();

                // make a call to Plugins controller
                var response = await _pluginsController.PutPrivatePlugin(PrivatePlugin);

                var statusCode = (response as StatusCodeResult).StatusCode;
                if (statusCode.Equals(200))
                {
                    modalDetails.ModalType = ModalType.SuccessMessage;
                    modalDetails.Title     = "Success!";
                    modalDetails.Message   = $"{PrivatePlugin.Name} was updated";
                }
            }
            else
            {
                modalDetails.Title     = string.Empty;
                modalDetails.Message   = "Please fill all required values.";
                modalDetails.ModalType = ModalType.WarningMessage;
            }

            return(Partial("_ModalPartial", modalDetails));
        }
Пример #4
0
        protected void Answer()
        {
            this._answerTimer.Stop();
            this._answerTimer.Dispose();

            var answers = new List <AnswerDTO>();

            if (cbbAnswers.Active >= 0)
            {
                answers.Add(_answers.ElementAt(cbbAnswers.Active));
            }
            var response = this._triviaApp.AddAnswer(_question, answers);

            if (response.Success)
            {
                var answerResult = response.Data;
                if (answerResult.IsCorrect)
                {
                    ModalMessage.Info(this, response.Message);
                }
                else
                {
                    ModalMessage.Error(this, $"{response.Message}. Correct Answer: {response.Data.GetCorrectAnswers()}");
                }
                new SessionDialog(_triviaApp).Show();
                this.Hide();
            }
            else
            {
                ModalMessage.Error(this, response.Message);
            }
        }
Пример #5
0
        public IActionResult Login(Login info)
        {
            using (AuthContext auth = new AuthContext())
            {
                var account = from a in auth.Accounts
                              where a.Username.ToLower() == info.user.ToLower()
                              select a;
                bool pwdOk = false;
                if (account.Count() > 0)
                {
                    var acc = account.ToArray()[0];

                    var hash = new byte[24];
                    using (var pbkdf2 = new Rfc2898DeriveBytes(info.pwd, Convert.FromBase64String(acc.Salt), 24000))
                        hash = pbkdf2.GetBytes(24);

                    if (acc.Password == Convert.ToBase64String(hash))
                    {
                        pwdOk = true;
                        HttpContext.Session.SetInt32("Id", acc.Id);
                        HttpContext.Session.SetString("Account", acc.Username);
                    }
                }

                if (!pwdOk)
                {
                    ViewData["message"] = new ModalMessage("danger", "Usuario o Contraseña incorrecto");
                    return(View());
                }
            }
            return(Redirect(Request.Headers["Referer"].ToString()));
        }
Пример #6
0
        protected void LoadNextQuestion()
        {
            var nextQuestionResponse = _triviaApp.NextQuestion();

            if (nextQuestionResponse.Success)
            {
                _question = nextQuestionResponse.Data;
                this.entryQuestion.Text = _question.Question;

                _answers = _question.GetAnswers();
                foreach (AnswerDTO answer in _answers)
                {
                    this.cbbAnswers.AppendText(answer.Answer);
                }
            }
            else
            {
                if (ResponseCode.NoContent == nextQuestionResponse.Code)
                {
                    var sessionResultResponse = this._triviaApp.FinishSession();
                    if (sessionResultResponse.Success)
                    {
                        ModalMessage.Info(this, sessionResultResponse.Message);
                    }
                    else
                    {
                        ModalMessage.Error(this, sessionResultResponse.Message);
                    }
                }
                this._answerTimer.Stop();
                this._answerTimer.Dispose();
                this.Hide();
            }
        }
Пример #7
0
        public async Task <IActionResult> OnPostGoToPage(string pageUrl)
        {
            var modalDetails = new ModalMessage
            {
                RequestPage = $"{pageUrl}",
                ModalType   = ModalType.WarningMessage,
                Title       = "Unsaved changes!",
                Message     = $"Discard changes for {PrivatePlugin.Name}?"
            };

            return(Partial("_ModalPartial", modalDetails));
        }
Пример #8
0
        public async Task <IActionResult> OnPostDeleteVersionAsync(string id)
        {
            await _pluginRepository.RemovePluginVersion(PrivatePlugin.Id, id);

            var modalDetails = new ModalMessage
            {
                ModalType = ModalType.SuccessMessage,
                Title     = "Version removed!",
                Message   = $"Clik \"Ok\" to continue!"
            };

            return(Partial("_ModalPartial", modalDetails));
        }
Пример #9
0
 public MainWindow(TriviaApp pTriviaApp) : base(Gtk.WindowType.Toplevel)
 {
     this._triviaApp = pTriviaApp;
     if (_triviaApp.LoggedUser == null)
     {
         this.Hide();
         ModalMessage.Error(this, "Permission denied");
     }
     this.Build();
     this.lblUsername.Text    = _triviaApp.LoggedUser.Username;
     this.btnSettings.Visible = _triviaApp.LoggedUser.IsAdmin;
     this.LoadQuestionsSets();
 }
Пример #10
0
        /// <summary>
        /// Event triggered when user clicks on LogIn button.
        /// Makes the login for the entered Username and Password
        /// </summary>
        protected void OnClickLogIn(object sender, EventArgs e)
        {
            var response = _triviaApp.Login(this.entUsername.Text, this.entPassword.Text);

            if (response.Success)
            {
                this.Hide();
                new MainWindow(_triviaApp).Show();
            }
            else
            {
                ModalMessage.Error(this, response.Message);
            }
        }
Пример #11
0
        protected void OnEntExpectedAnswerTimeChanged(object sender, EventArgs e)
        {
            if (entExpectedAnswerTime.Text.Length == 0)
            {
                return;
            }
            bool parseIntSuccess = int.TryParse(this.entExpectedAnswerTime.Text, out int expectedAnswerTimeValue);

            if (!parseIntSuccess)
            {
                this.entExpectedAnswerTime.Text = this._triviaApp.SelectedQuestionsSet.ExpectedAnswerTime.ToString();
                ModalMessage.Error(this, "Invalid number");
            }
        }
Пример #12
0
        protected void OnBtnConfirmClicked(object sender, EventArgs e)
        {
            var response = _triviaApp.SignUp(this.entUsername.Text, this.entPassword.Text, this.entConfirmPassword.Text);

            if (response.Success)
            {
                ModalMessage.Info(this, Gtk.ButtonsType.Ok, response.Message);
                this.Hide();
            }
            else
            {
                ModalMessage.Error(this, response.Message);
            }
        }
Пример #13
0
        protected void OnBtnUpdateDataClicked(object sender, EventArgs e)
        {
            this.lblLoading.Visible = true;
            var response = this._triviaApp.UpdateQuestionsSetData();

            if (response.Success)
            {
                this.lblLoading.Visible = false;
                ModalMessage.Info(this, Gtk.ButtonsType.Ok, response.Message);
            }
            else
            {
                ModalMessage.Error(this, response.Message);
            }
        }
Пример #14
0
        public static string GetImageUrlButtonGroupHtml(PublishmentSystemInfo publishmentSystemInfo, string textBoxID)
        {
            var selectImageClick  = ModalSelectImage.GetOpenWindowString(publishmentSystemInfo, textBoxID);
            var uploadImageClick  = ModalUploadImageSingle.GetOpenWindowStringToTextBox(publishmentSystemInfo.PublishmentSystemId, textBoxID);
            var cuttingImageClick = ModalCuttingImage.GetOpenWindowStringWithTextBox(publishmentSystemInfo.PublishmentSystemId, textBoxID);
            var previewImageClick = ModalMessage.GetOpenWindowStringToPreviewImage(publishmentSystemInfo.PublishmentSystemId, textBoxID);

            return($@"
<div class=""btn-group"">
    <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>
</div>
");
        }
Пример #15
0
        private void ChangesetDownload()
        {
            if (string.IsNullOrWhiteSpace(Settings.Default.TfsServerName))
            {
                if (IoC.Get <IMessageBoxService>().ShowOkCancel("TFS Server must be specified. Enter now?", "Required Data"))
                {
                    SettingsCommand.Execute(null);
                }
            }

            if (string.IsNullOrWhiteSpace(Settings.Default.TfsServerName))
            {
                return;
            }

            //TODO: save last work item id in settings and pass in a default?
            //TODO: work item id validation?
            var vm  = new WorkItemSelectorViewModel();
            var msg = new ModalMessage <WorkItemSelectorViewModel>(
                vm, (confirm, resultVm) =>
            {
                if (!confirm || !resultVm.WorkItemId.HasValue)
                {
                    return;
                }

                try
                {
                    this.BusyText = "Getting work item info from TFS";
                    this.IsBusy   = true;
                    //TODO: use command pattern for this
                    var known  = IoC.Get <KnownFileTypes>();
                    var csInfo = new ChangesetInfo(Settings.Default.TfsServerName, known);
                    csInfo.GetInfo(resultVm.WorkItemId.Value);
                    this.BusyText = "Downloading work item files";
                    csInfo.Downloader.DownloadAllFiles();
                    csInfo.Downloader.OpenWorkItemDirectory();
                }
                finally
                {
                    this.IsBusy = false;
                }
            });

            Messenger.Default.Send(msg);
        }
Пример #16
0
        protected void OnBtnSaveClicked(object sender, EventArgs e)
        {
            int oldExpectedAnswerTime = this._triviaApp.SelectedQuestionsSet.ExpectedAnswerTime;

            this._triviaApp.SelectedQuestionsSet.ExpectedAnswerTime = int.Parse(this.entExpectedAnswerTime.Text);
            var response = this._triviaApp.SaveQuestionsSet();

            if (response.Success)
            {
                ModalMessage.Info(this, Gtk.ButtonsType.Ok, response.Message);
                this.Hide();
            }
            else
            {
                ModalMessage.Error(this, response.Message);
            }
        }
Пример #17
0
        protected void OnButtonOkClicked(object sender, EventArgs e)
        {
            var category        = _triviaApp.SelectedQuestionsSet.Categories.ElementAt(cbbCategories.Active);
            var level           = _triviaApp.SelectedQuestionsSet.Levels.ElementAt(cbbLevels.Active);
            var questionsNumber = _possiblesQuestionsNumber.ElementAt(cbbQuestionsNumber.Active);

            var response = _triviaApp.StartNewSession(category, level, questionsNumber);

            if (response.Success)
            {
                _triviaApp.CurrentSession = response.Data;
                new SessionDialog(_triviaApp).Show();
                this.Hide();
            }
            else
            {
                ModalMessage.Error(this, response.Message);
            }
        }
Пример #18
0
        public static string GetImageUrlButtonGroupHtml(SiteInfo siteInfo, string attributeName)
        {
            return($@"
<div class=""btn-group btn-group-sm"">
    <button class=""btn"" onclick=""{ModalUploadImage.GetOpenWindowString(siteInfo.Id, attributeName)}"">
        上传
    </button>
    <button class=""btn"" onclick=""{ModalSelectImage.GetOpenWindowString(siteInfo, attributeName)}"">
        选择
    </button>
    <button class=""btn"" onclick=""{ModalCuttingImage.GetOpenWindowStringWithTextBox(siteInfo.Id, attributeName)}"">
        裁切
    </button>
    <button class=""btn"" onclick=""{ModalMessage.GetOpenWindowStringToPreviewImage(siteInfo.Id, attributeName)}"">
        预览
    </button>
</div>
");
        }
Пример #19
0
        public async Task <IActionResult> OnPostGoToPage(string pageUrl)
        {
            var foundPluginDetails = await _pluginRepository.GetPluginById(PrivatePlugin.Id);

            if (IsSaved(foundPluginDetails))
            {
                return(Redirect(pageUrl));
            }

            var modalDetails = new ModalMessage
            {
                ModalType   = ModalType.WarningMessage,
                Title       = "Warning!",
                Message     = $"There is unsaved data for {PrivatePlugin.Name}. Discard changes?",
                RequestPage = $"{pageUrl}"
            };

            return(Partial("_ModalPartial", modalDetails));
        }
Пример #20
0
        protected void LoadData()
        {
            var response = _triviaApp.ShowRanking();

            if (response.Success)
            {
                var rankingListStore = new ListStore(typeof(string), typeof(string), typeof(string), typeof(string));
                var ranking          = response.Data;
                foreach (var sessionResult in ranking)
                {
                    rankingListStore.AppendValues(sessionResult.Username, sessionResult.Score.ToString(), sessionResult.Time.ToString(), sessionResult.Date.ToString());
                }
                this.treeviewRanking.Model = rankingListStore;
            }
            else
            {
                ModalMessage.Error(this, response.Message);
            }
        }
Пример #21
0
        public async Task <IActionResult> OnPostImportFile()
        {
            var modalDetails = new ModalMessage();
            var success      = await _repository.TryImportPluginsFromFile(ImportedFile);

            if (success)
            {
                modalDetails.RequestPage = "/ConfigTool";
                modalDetails.ModalType   = ModalType.SuccessMessage;
                modalDetails.Title       = "Success!";
                modalDetails.Message     = $"The file content was imported! Return to plugins list?";
            }
            else
            {
                modalDetails.Title     = string.Empty;
                modalDetails.Message   = "The file is empty or in wrong format!";
                modalDetails.ModalType = ModalType.WarningMessage;
            }

            return(Partial("_ModalPartial", modalDetails));
        }
Пример #22
0
        void dlContents_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var imageUrl      = TranslateUtils.EvalString(e.Item.DataItem, "ImageUrl");
                var largeImageUrl = TranslateUtils.EvalString(e.Item.DataItem, "LargeImageUrl");

                var tbContentImageUrl = e.Item.FindControl("tbContentImageUrl") as TextBox;
                var ltlImageUrl       = e.Item.FindControl("ltlImageUrl") as Literal;

                if (string.IsNullOrEmpty(imageUrl))
                {
                    ltlImageUrl.Text = @"<i class=""appmsg_thumb default"">缩略图</i>";
                }
                else
                {
                    var previewImageClick = ModalMessage.GetOpenWindowStringToPreviewImage(PublishmentSystemId, tbContentImageUrl.ClientID);
                    tbContentImageUrl.Text = PageUtility.ParseNavigationUrl(PublishmentSystemInfo, largeImageUrl);
                    ltlImageUrl.Text       =
                        $@"<a  href=""javascript:;"" onclick=""{previewImageClick}""> <img class=""img-rounded"" style=""width:80px;"" src=""{PageUtility
                            .ParseNavigationUrl(PublishmentSystemInfo, imageUrl)}""> </a>";
                }
            }
        }
Пример #23
0
        public static string GetContentTitle(SiteInfo siteInfo, ContentInfo contentInfo, string pageUrl)
        {
            string url;
            var    title = ContentUtility.FormatTitle(contentInfo.GetString(BackgroundContentAttribute.TitleFormatString), contentInfo.Title);

            var displayString = contentInfo.IsTop ? $"<span style='color:#ff0000;text-decoration:none' title='醒目'>{title}</span>" : title;

            if (contentInfo.ChannelId < 0)
            {
                url = displayString;
            }
            else if (contentInfo.IsChecked)
            {
                url =
                    $"<a href='{PageRedirect.GetRedirectUrlToContent(siteInfo.Id, contentInfo.ChannelId, contentInfo.Id)}' target='blank'>{displayString}</a>";
            }
            else
            {
                url =
                    $"<a href='{PageContentView.GetContentViewUrl(siteInfo.Id, contentInfo.ChannelId, contentInfo.Id, pageUrl)}'>{displayString}</a>";
            }

            var image = string.Empty;

            if (contentInfo.IsRecommend)
            {
                image += "&nbsp;<img src='../pic/icon/recommend.gif' title='推荐' align='absmiddle' border=0 />";
            }
            if (contentInfo.IsHot)
            {
                image += "&nbsp;<img src='../pic/icon/hot.gif' title='热点' align='absmiddle' border=0 />";
            }
            if (contentInfo.IsTop)
            {
                image += "&nbsp;<img src='../pic/icon/top.gif' title='置顶' align='absmiddle' border=0 />";
            }
            if (contentInfo.ReferenceId > 0)
            {
                if (contentInfo.GetString(ContentAttribute.TranslateContentType) == ETranslateContentType.ReferenceContent.ToString())
                {
                    image += "&nbsp;<img src='../pic/icon/reference.png' title='引用内容' align='absmiddle' border=0 />(引用内容)";
                }
                else if (contentInfo.GetString(ContentAttribute.TranslateContentType) != ETranslateContentType.ReferenceContent.ToString())
                {
                    image += "&nbsp;<img src='../pic/icon/reference.png' title='引用地址' align='absmiddle' border=0 />(引用地址)";
                }
            }
            if (!string.IsNullOrEmpty(contentInfo.GetString(ContentAttribute.LinkUrl)))
            {
                image += "&nbsp;<img src='../pic/icon/link.png' title='外部链接' align='absmiddle' border=0 />";
            }
            if (!string.IsNullOrEmpty(contentInfo.GetString(BackgroundContentAttribute.ImageUrl)))
            {
                var imageUrl         = PageUtility.ParseNavigationUrl(siteInfo, contentInfo.GetString(BackgroundContentAttribute.ImageUrl), true);
                var openWindowString = ModalMessage.GetOpenWindowString(siteInfo.Id, "预览图片", $"<img src='{imageUrl}' />", 500, 500);
                image +=
                    $@"&nbsp;<a href=""javascript:;"" onclick=""{openWindowString}""><img src='../assets/icons/img.gif' title='预览图片' align='absmiddle' border=0 /></a>";
            }
            if (!string.IsNullOrEmpty(contentInfo.GetString(BackgroundContentAttribute.VideoUrl)))
            {
                var openWindowString = ModalMessage.GetOpenWindowStringToPreviewVideoByUrl(siteInfo.Id, contentInfo.GetString(BackgroundContentAttribute.VideoUrl));
                image +=
                    $@"&nbsp;<a href=""javascript:;"" onclick=""{openWindowString}""><img src='../pic/icon/video.png' title='预览视频' align='absmiddle' border=0 /></a>";
            }
            if (!string.IsNullOrEmpty(contentInfo.GetString(BackgroundContentAttribute.FileUrl)))
            {
                image += "&nbsp;<img src='../pic/icon/attachment.gif' title='附件' align='absmiddle' border=0 />";
                if (siteInfo.Additional.IsCountDownload)
                {
                    var count = CountManager.GetCount(siteInfo.TableName, contentInfo.Id.ToString(), ECountType.Download);
                    image += $"下载次数:<strong>{count}</strong>";
                }
            }
            if (!string.IsNullOrEmpty(contentInfo.WritingUserName))
            {
                var openWindowString = ModalUserView.GetOpenWindowString(contentInfo.WritingUserName);
                image +=
                    $@"&nbsp;(<a href=""javascript:;"" onclick=""{openWindowString}"">投稿用户:{contentInfo.WritingUserName}</a>)";
            }
            return(url + image);
        }
Пример #24
0
        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));
        }
Пример #25
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemId");
            _view360Id = Body.GetQueryInt("view360ID");

            if (!IsPostBack)
            {
                var pageTitle = _view360Id > 0 ? "编辑360全景" : "添加360全景";

                BreadCrumb(AppManager.WeiXin.LeftMenu.IdFunction, AppManager.WeiXin.LeftMenu.Function.IdView360, pageTitle, AppManager.WeiXin.Permission.WebSite.View360);
                LtlPageTitle.Text = pageTitle;

                LtlImageUrl.Text =
                    $@"<img id=""preview_imageUrl"" src=""{View360Manager.GetImageUrl(PublishmentSystemInfo,
                        string.Empty)}"" width=""370"" align=""middle"" />";

                var selectImageClick  = ModalSelectImage.GetOpenWindowString(PublishmentSystemInfo, TbContentImageUrl1.ClientID);
                var uploadImageClick  = ModalUploadImageSingle.GetOpenWindowStringToTextBox(PublishmentSystemId, TbContentImageUrl1.ClientID);
                var cuttingImageClick = ModalCuttingImage.GetOpenWindowStringWithTextBox(PublishmentSystemId, TbContentImageUrl1.ClientID);
                var previewImageClick = ModalMessage.GetOpenWindowStringToPreviewImage(PublishmentSystemId, TbContentImageUrl1.ClientID);
                LtlContentImageUrl1.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>";

                LtlContentImageUrl2.Text = LtlContentImageUrl1.Text.Replace(TbContentImageUrl1.ClientID, TbContentImageUrl2.ClientID);
                LtlContentImageUrl3.Text = LtlContentImageUrl1.Text.Replace(TbContentImageUrl1.ClientID, TbContentImageUrl3.ClientID);
                LtlContentImageUrl4.Text = LtlContentImageUrl1.Text.Replace(TbContentImageUrl1.ClientID, TbContentImageUrl4.ClientID);
                LtlContentImageUrl5.Text = LtlContentImageUrl1.Text.Replace(TbContentImageUrl1.ClientID, TbContentImageUrl5.ClientID);
                LtlContentImageUrl6.Text = LtlContentImageUrl1.Text.Replace(TbContentImageUrl1.ClientID, TbContentImageUrl6.ClientID);

                if (_view360Id == 0)
                {
                    TbContentImageUrl1.Text = View360Manager.GetContentImageUrl(PublishmentSystemInfo, string.Empty, 1);
                    TbContentImageUrl2.Text = View360Manager.GetContentImageUrl(PublishmentSystemInfo, string.Empty, 2);
                    TbContentImageUrl3.Text = View360Manager.GetContentImageUrl(PublishmentSystemInfo, string.Empty, 3);
                    TbContentImageUrl4.Text = View360Manager.GetContentImageUrl(PublishmentSystemInfo, string.Empty, 4);
                    TbContentImageUrl5.Text = View360Manager.GetContentImageUrl(PublishmentSystemInfo, string.Empty, 5);
                    TbContentImageUrl6.Text = View360Manager.GetContentImageUrl(PublishmentSystemInfo, string.Empty, 6);
                }
                else
                {
                    var view360Info = DataProviderWx.View360Dao.GetView360Info(_view360Id);

                    TbKeywords.Text     = DataProviderWx.KeywordDao.GetKeywords(view360Info.KeywordId);
                    CbIsEnabled.Checked = !view360Info.IsDisabled;
                    TbTitle.Text        = view360Info.Title;
                    if (!string.IsNullOrEmpty(view360Info.ImageUrl))
                    {
                        LtlImageUrl.Text =
                            $@"<img id=""preview_imageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, view360Info.ImageUrl)}"" width=""370"" align=""middle"" />";
                    }
                    TbSummary.Text = view360Info.Summary;

                    TbContentImageUrl1.Text = View360Manager.GetContentImageUrl(PublishmentSystemInfo, view360Info.ContentImageUrl1, 1);
                    TbContentImageUrl2.Text = View360Manager.GetContentImageUrl(PublishmentSystemInfo, view360Info.ContentImageUrl2, 2);
                    TbContentImageUrl3.Text = View360Manager.GetContentImageUrl(PublishmentSystemInfo, view360Info.ContentImageUrl3, 3);
                    TbContentImageUrl4.Text = View360Manager.GetContentImageUrl(PublishmentSystemInfo, view360Info.ContentImageUrl4, 4);
                    TbContentImageUrl5.Text = View360Manager.GetContentImageUrl(PublishmentSystemInfo, view360Info.ContentImageUrl5, 5);
                    TbContentImageUrl6.Text = View360Manager.GetContentImageUrl(PublishmentSystemInfo, view360Info.ContentImageUrl6, 6);

                    ImageUrl.Value = view360Info.ImageUrl;
                }

                BtnReturn.Attributes.Add("onclick",
                                         $@"location.href=""{PageView360.GetRedirectUrl(PublishmentSystemId)}"";return false");
            }
        }
Пример #26
0
        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");
            }
        }
Пример #27
0
        public static string GetContentTitle(SiteInfo siteInfo, ContentInfo contentInfo, string pageUrl)
        {
            string url;
            var    title = ContentUtility.FormatTitle(contentInfo.GetString(ContentAttribute.GetFormatStringAttributeName(ContentAttribute.Title)), contentInfo.Title);

            var displayString = contentInfo.IsColor ? $"<span style='color:#ff0000;text-decoration:none' title='醒目'>{title}</span>" : title;

            if (contentInfo.IsChecked && contentInfo.ChannelId > 0)
            {
                url =
                    $"<a>{displayString}</a>";
            }
            else
            {
                url =
                    $@"<a href=""javascript:;"" >{displayString}</a>";
            }

            var image = string.Empty;

            if (contentInfo.IsRecommend)
            {
                image += "&nbsp;<img src='../pic/icon/recommend.gif' title='推荐' align='absmiddle' border=0 />";
            }
            if (contentInfo.IsHot)
            {
                image += "&nbsp;<img src='../pic/icon/hot.gif' title='热点' align='absmiddle' border=0 />";
            }
            if (contentInfo.IsTop)
            {
                image += "&nbsp;<img src='../pic/icon/top.gif' title='置顶' align='absmiddle' border=0 />";
            }
            if (contentInfo.ReferenceId > 0)
            {
                if (contentInfo.GetString(ContentAttribute.TranslateContentType) == ETranslateContentType.ReferenceContent.ToString())
                {
                    image += "&nbsp;<img src='../pic/icon/reference.png' title='引用内容' align='absmiddle' border=0 />(引用内容)";
                }
                else if (contentInfo.GetString(ContentAttribute.TranslateContentType) != ETranslateContentType.ReferenceContent.ToString())
                {
                    image += "&nbsp;<img src='../pic/icon/reference.png' title='引用地址' align='absmiddle' border=0 />(引用地址)";
                }
            }
            if (!string.IsNullOrEmpty(contentInfo.GetString(ContentAttribute.LinkUrl)))
            {
                image += "&nbsp;<img src='../pic/icon/link.png' title='外部链接' align='absmiddle' border=0 />";
            }
            if (!string.IsNullOrEmpty(contentInfo.GetString(BackgroundContentAttribute.ImageUrl)))
            {
                var imageUrl         = PageUtility.ParseNavigationUrl(siteInfo, contentInfo.GetString(BackgroundContentAttribute.ImageUrl), true);
                var openWindowString = ModalMessage.GetOpenWindowString(siteInfo.Id, "预览图片", $"<img src='{imageUrl}' />", 500, 500);
                image +=
                    $@"&nbsp;<a href=""javascript:;"" onclick=""{openWindowString}""><img src='../assets/icons/img.gif' title='预览图片' align='absmiddle' border=0 /></a>";
            }
            if (!string.IsNullOrEmpty(contentInfo.GetString(BackgroundContentAttribute.VideoUrl)))
            {
                var openWindowString = ModalMessage.GetOpenWindowStringToPreviewVideoByUrl(siteInfo.Id, contentInfo.GetString(BackgroundContentAttribute.VideoUrl));
                image +=
                    $@"&nbsp;<a href=""javascript:;"" onclick=""{openWindowString}""><img src='../pic/icon/video.png' title='预览视频' align='absmiddle' border=0 /></a>";
            }
            if (!string.IsNullOrEmpty(contentInfo.GetString(BackgroundContentAttribute.FileUrl)))
            {
                image += "&nbsp;<img src='../pic/icon/attachment.gif' title='附件' align='absmiddle' border=0 />";
            }
            return(url + image);
        }
Пример #28
0
        private static void ShowSettings()
        {
            var msg = new ModalMessage <SettingsViewModel>((c, v) => { return; });

            Messenger.Default.Send(msg);
        }
Пример #29
0
        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)}"" />");
        }
Пример #30
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemId");
            _conferenceId = Body.GetQueryInt("conferenceID");

            if (!IsPostBack)
            {
                var pageTitle = _conferenceId > 0 ? "编辑会议(活动)" : "添加会议(活动)";
                BreadCrumb(AppManager.WeiXin.LeftMenu.IdFunction, AppManager.WeiXin.LeftMenu.Function.IdConference, pageTitle, AppManager.WeiXin.Permission.WebSite.Conference);
                LtlPageTitle.Text = pageTitle;

                LtlImageUrl.Text =
                    $@"<img id=""preview_imageUrl"" src=""{ConferenceManager.GetImageUrl(PublishmentSystemInfo,
                        string.Empty)}"" width=""370"" align=""middle"" />";
                LtlBackgroundImageUrl.Text =
                    $@"{ComponentsManager.GetBackgroundImageSelectHtml(PublishmentSystemInfo, string.Empty)}<hr /><img id=""preview_backgroundImageUrl"" src=""{ComponentsManager
                        .GetBackgroundImageUrl(PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />";
                LtlEndImageUrl.Text =
                    $@"<img id=""preview_endImageUrl"" src=""{ConferenceManager.GetEndImageUrl(PublishmentSystemInfo,
                        string.Empty)}"" width=""370"" align=""middle"" />";

                var selectImageClick  = ModalSelectImage.GetOpenWindowString(PublishmentSystemInfo, "itemPicUrl_");
                var uploadImageClick  = ModalUploadImageSingle.GetOpenWindowStringToTextBox(PublishmentSystemId, "itemPicUrl_");
                var cuttingImageClick = ModalCuttingImage.GetOpenWindowStringWithTextBox(PublishmentSystemId, "itemPicUrl_");
                var previewImageClick = ModalMessage.GetOpenWindowStringToPreviewImage(PublishmentSystemId, "itemPicUrl_");
                LtlGuestScript.Text =
                    $@"guestController.selectImageClickString = ""{selectImageClick}"";guestController.uploadImageClickString = ""{uploadImageClick}"";guestController.cuttingImageClickString = ""{cuttingImageClick}"";guestController.previewImageClickString = ""{previewImageClick}"";";

                if (_conferenceId == 0)
                {
                    LtlAgendaScript.Text += "agendaController.agendaCount = 2;agendaController.items = [{}, {}];";
                    LtlGuestScript.Text  += "guestController.guestCount = 2;guestController.items = [{}, {}];";
                    DtbEndDate.DateTime   = DateTime.Now.AddMonths(1);
                }
                else
                {
                    var conferenceInfo = DataProviderWx.ConferenceDao.GetConferenceInfo(_conferenceId);

                    TbKeywords.Text       = DataProviderWx.KeywordDao.GetKeywords(conferenceInfo.KeywordId);
                    CbIsEnabled.Checked   = !conferenceInfo.IsDisabled;
                    DtbStartDate.DateTime = conferenceInfo.StartDate;
                    DtbEndDate.DateTime   = conferenceInfo.EndDate;
                    TbTitle.Text          = conferenceInfo.Title;
                    if (!string.IsNullOrEmpty(conferenceInfo.ImageUrl))
                    {
                        LtlImageUrl.Text =
                            $@"<img id=""preview_imageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, conferenceInfo.ImageUrl)}"" width=""370"" align=""middle"" />";
                    }
                    TbSummary.Text = conferenceInfo.Summary;
                    if (!string.IsNullOrEmpty(conferenceInfo.BackgroundImageUrl))
                    {
                        LtlBackgroundImageUrl.Text =
                            $@"{ComponentsManager.GetBackgroundImageSelectHtml(PublishmentSystemInfo, conferenceInfo.BackgroundImageUrl)}<hr /><img id=""preview_backgroundImageUrl"" src=""{ComponentsManager
                                .GetBackgroundImageUrl(PublishmentSystemInfo, conferenceInfo.BackgroundImageUrl)}"" width=""370"" align=""middle"" />";
                    }

                    TbConferenceName.Text = conferenceInfo.ConferenceName;
                    TbAddress.Text        = conferenceInfo.Address;
                    TbDuration.Text       = conferenceInfo.Duration;
                    BreIntroduction.Text  = conferenceInfo.Introduction;

                    CbIsAgenda.Checked = conferenceInfo.IsAgenda;
                    TbAgendaTitle.Text = conferenceInfo.AgendaTitle;
                    var agendaInfoList = new List <ConferenceAgendaInfo>();
                    agendaInfoList = TranslateUtils.JsonToObject(conferenceInfo.AgendaList, agendaInfoList) as List <ConferenceAgendaInfo>;
                    if (agendaInfoList != null)
                    {
                        var agendaBuilder = new StringBuilder();
                        foreach (var agendaInfo in agendaInfoList)
                        {
                            agendaBuilder.AppendFormat(@"{{dateTime: '{0}', title: '{1}', summary: '{2}'}},", agendaInfo.DateTime, agendaInfo.Title, agendaInfo.Summary);
                        }
                        if (agendaBuilder.Length > 0)
                        {
                            agendaBuilder.Length--;
                        }

                        LtlAgendaScript.Text +=
                            $@"agendaController.agendaCount = {agendaInfoList.Count};agendaController.items = [{agendaBuilder}];";
                    }
                    else
                    {
                        LtlAgendaScript.Text += "agendaController.agendaCount = 0;agendaController.items = [{}];";
                    }

                    CbIsGuest.Checked = conferenceInfo.IsGuest;
                    TbGuestTitle.Text = conferenceInfo.GuestTitle;
                    var guestInfoList = new List <ConferenceGuestInfo>();
                    guestInfoList = TranslateUtils.JsonToObject(conferenceInfo.GuestList, guestInfoList) as List <ConferenceGuestInfo>;
                    if (guestInfoList != null)
                    {
                        var guestBuilder = new StringBuilder();
                        foreach (var guestInfo in guestInfoList)
                        {
                            guestBuilder.AppendFormat(@"{{displayName: '{0}', position: '{1}', picUrl: '{2}'}},", guestInfo.DisplayName, guestInfo.Position, guestInfo.PicUrl);
                        }
                        if (guestBuilder.Length > 0)
                        {
                            guestBuilder.Length--;
                        }

                        LtlGuestScript.Text +=
                            $@"guestController.guestCount = {guestInfoList.Count};guestController.items = [{guestBuilder}];";
                    }
                    else
                    {
                        LtlGuestScript.Text += "guestController.guestCount = 0;guestController.items = [{}];";
                    }

                    TbEndTitle.Text   = conferenceInfo.EndTitle;
                    TbEndSummary.Text = conferenceInfo.EndSummary;
                    if (!string.IsNullOrEmpty(conferenceInfo.EndImageUrl))
                    {
                        LtlEndImageUrl.Text =
                            $@"<img id=""preview_endImageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, conferenceInfo.EndImageUrl)}"" width=""370"" align=""middle"" />";
                    }

                    ImageUrl.Value           = conferenceInfo.ImageUrl;
                    BackgroundImageUrl.Value = conferenceInfo.BackgroundImageUrl;
                    EndImageUrl.Value        = conferenceInfo.EndImageUrl;
                }

                BtnReturn.Attributes.Add("onclick",
                                         $@"location.href=""{PageConference.GetRedirectUrl(PublishmentSystemId)}"";return false");
            }
        }