/// <summary> /// The On PreRender event. /// </summary> /// <param name="e"> /// the Event Arguments /// </param> protected override void OnPreRender([NotNull] EventArgs e) { // setup jQuery and Jquery Ui Tabs. YafContext.Current.PageElements.RegisterJsBlock( "yafPmTabsJs", JavaScriptBlocks.JqueryUITabsLoadJs( this.PmTabs.ClientID, this.hidLastTab.ClientID, this.hidLastTabId.ClientID, false)); base.OnPreRender(e); }
/// <summary> /// Handles page load event. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { this.PageContext.PageElements.RegisterJsBlockStartup( nameof(JavaScriptBlocks.FormValidatorJs), JavaScriptBlocks.FormValidatorJs(this.Save.ClientID)); // this needs to be done just once, not during post-backs if (!this.IsPostBack) { // bind data this.BindData(); } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.IsPostBack) { return; } this.PageContext.PageElements.RegisterJsBlockStartup( nameof(JavaScriptBlocks.FormValidatorJs), JavaScriptBlocks.FormValidatorJs(this.Send.ClientID)); this.BindData(); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (!this.PageContext.User.UserFlags.IsHostAdmin) { this.Get <LinkBuilder>().AccessDenied(); } this.PageContext.PageElements.RegisterJsBlock( "tablesorterLoadJs", JavaScriptBlocks.LoadTableSorter( ".table", null)); }
/// <summary> /// Handles the PreRender event of the AttachmentsUploadDialog control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void AttachmentsUploadDialog_PreRender([NotNull] object sender, [NotNull] EventArgs e) { // Setup Hover Card JS YafContext.Current.PageElements.RegisterJsBlockStartup( "fileUploadjs", JavaScriptBlocks.FileUploadLoadJs( string.Join("|", this.FileExentsions.Select(ext => ext.Extension)), this.Get <YafBoardSettings>().MaxFileSize, "{0}YafUploader.ashx".FormatWith(YafForumInfo.ForumClientFileRoot), this.PageContext.PageForumID, this.PageContext.PageBoardID, this.Get <YafBoardSettings>().ImageAttachmentResizeWidth, this.Get <YafBoardSettings>().ImageAttachmentResizeHeight)); }
/// <summary> /// Binds the data. /// </summary> private void BindData() { var cultureTable = StaticDataHelper.Cultures(); this.List.DataSource = cultureTable; YafContext.Current.PageElements.RegisterJsBlock( "tablesorterLoadJs", JavaScriptBlocks.LoadTableSorter( "#language-table", cultureTable.HasRows() ? "headers: { 4: { sorter: false }}" : null)); this.DataBind(); }
/// <summary> /// The On PreRender event. /// </summary> /// <param name="e"> /// the Event Arguments /// </param> protected override void OnPreRender([NotNull] EventArgs e) { // setup jQuery and DatePicker JS... this.PageContext.PageElements.RegisterJsBlockStartup( "DatePickerJs", JavaScriptBlocks.DatePickerLoadJs( this.GetText("COMMON", "CAL_JQ_CULTURE_DFORMAT"), this.GetText("COMMON", "CAL_JQ_CULTURE"))); this.PageContext.PageElements.RegisterJsBlock("dropDownToggleJs", JavaScriptBlocks.DropDownToggleJs()); base.OnPreRender(e); }
/// <summary> /// Binds the active user data. /// </summary> private void BindActiveUserData() { var activeUsers = this.GetActiveUsersData(true, true); if (activeUsers.HasRows()) { BoardContext.Current.PageElements.RegisterJsBlock( "ActiveUsersTablesorterLoadJs", JavaScriptBlocks.LoadTableSorter("#ActiveUsers", "sortList: [[0,0]]", "#ActiveUsersPager")); } this.ActiveList.DataSource = activeUsers; this.ActiveList.DataBind(); }
/// <summary> /// The register CKEditor custom JS. /// </summary> protected override void RegisterCKEditorCustomJS() { BoardContext.Current.PageElements.RegisterJsBlock( "ckeditorinitbbcodebasic", JavaScriptBlocks.CKEditorBasicLoadJs( this.TextAreaControl.ClientID, BoardContext.Current.User.Culture.IsSet() ? BoardContext.Current.User.Culture.Substring(0, 2) : this.PageContext.BoardSettings.Culture.Substring(0, 2), this.MaxCharacters, this.Get <ITheme>().BuildThemePath("bootstrap-forum.min.css"), BoardInfo.GetURLToContent("forum.min.css"), this.PageContext.BoardSettings.EditorToolbarBasic)); }
/// <summary> /// Registers the needed Java Scripts /// </summary> /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param> protected override void OnPreRender([NotNull] EventArgs e) { // setup jQuery and YAF JS... YafContext.Current.PageElements.RegisterJQuery(); YafContext.Current.PageElements.RegisterJQueryUI(); YafContext.Current.PageElements.RegisterJsBlock( "yafTabsJs", JavaScriptBlocks.JqueryUITabsLoadJs(this.HostSettingsTabs.ClientID, this.hidLastTab.ClientID, false)); YafContext.Current.PageElements.RegisterJsBlock("spinnerJs", JavaScriptBlocks.LoadSpinnerWidget()); base.OnPreRender(e); }
/// <summary> /// Handles the PreRender event /// </summary> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); // Setup Hover Card JS this.PageBoardContext.PageElements.RegisterJsBlockStartup( nameof(JavaScriptBlocks.FileUploadLoadJs), JavaScriptBlocks.FileUploadLoadJs( this.PageBoardContext.BoardSettings.AllowedFileExtensions.Replace(",", "|"), this.PageBoardContext.BoardSettings.MaxFileSize, $"{BoardInfo.ForumClientFileRoot}FileUploader.ashx", this.PageBoardContext.BoardSettings.ImageAttachmentResizeWidth, this.PageBoardContext.BoardSettings.ImageAttachmentResizeHeight)); }
/// <summary> /// Handles the PreRender event of the AttachmentsUploadDialog control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void AttachmentsUploadDialogPreRender([NotNull] object sender, [NotNull] EventArgs e) { // Setup Hover Card JS YafContext.Current.PageElements.RegisterJsBlockStartup( name: "fileUploadjs", script: JavaScriptBlocks.FileUploadLoadJs( acceptedFileTypes: string.Join(separator: "|", values: this.FileExtensions.Select(selector: ext => ext.Extension)), maxFileSize: this.Get <YafBoardSettings>().MaxFileSize, fileUploaderUrl: $"{YafForumInfo.ForumClientFileRoot}YafUploader.ashx", forumId: this.PageContext.PageForumID, boardId: this.PageContext.PageBoardID, imageMaxWidth: this.Get <YafBoardSettings>().ImageAttachmentResizeWidth, imageMaxHeight: this.Get <YafBoardSettings>().ImageAttachmentResizeHeight)); }
/// <summary> /// Handles the PreRender event /// </summary> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); this.PageContext.PageElements.RegisterJsBlockStartup( "ForumModsPopoverJs", JavaScriptBlocks.ForumModsPopoverJs( $"<i class=\"fa fa-user-secret fa-fw text-secondary\"></i> {this.GetText("DEFAULT", "MODERATORS")} ...")); var content = new StringBuilder(); content.Append(@"<ol class=""list-unstyled"">"); this.DataSource.ForEach( row => { content.Append("<li>"); if (row.IsGroup) { // render mod group content.Append( this.PageContext.BoardSettings.EnableDisplayName ? row.DisplayName : row.Name); } else { // Render Moderator User Link var userLink = new UserLink { Style = row.Style, UserID = row.ModeratorID, ReplaceName = this.PageContext.BoardSettings.EnableDisplayName ? row.DisplayName : row.Name }; content.Append(userLink.RenderToString()); } content.Append(@"</li>"); }); content.Append("</ol>"); this.ShowMods.DataContent = content.ToString().ToJsString(); this.ShowMods.Text = $"{this.GetText("SHOW")} {this.GetText("DEFAULT", "MODERATORS")}"; }
/// <summary> /// Delete The Forum /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void Save_Click([NotNull] object sender, [NotNull] EventArgs e) { string errorMessage; if (this.MoveTopics.Checked) { // Simply Delete the Forum with all of its Content var forumId = this.GetQueryStringAsInt("fa"); // schedule... ForumDeleteTask.Start( this.PageContext.PageBoardID, forumId.Value, this.ForumList.SelectedValue.ToType <int>(), out errorMessage); // enable timer... this.UpdateStatusTimer.Enabled = true; this.LocalizedLabel6.LocalizedTag = "DELETE_MOVE_TITLE"; // show blocking ui... this.PageContext.PageElements.RegisterJsBlockStartup( "BlockUIExecuteJs", JavaScriptBlocks.BlockUIExecuteJs("DeleteForumMessage")); } else { // Simply Delete the Forum with all of its Content var forumId = this.GetQueryStringAsInt("fa"); // schedule... ForumDeleteTask.Start(this.PageContext.PageBoardID, forumId.Value, out errorMessage); // enable timer... this.UpdateStatusTimer.Enabled = true; this.LocalizedLabel6.LocalizedTag = "DELETE_TITLE"; // show blocking ui... this.PageContext.PageElements.RegisterJsBlockStartup( "BlockUIExecuteJs", JavaScriptBlocks.BlockUIExecuteJs("DeleteForumMessage")); } // show blocking ui... this.PageContext.PageElements.RegisterJsBlockStartup( "BlockUIExecuteJs", JavaScriptBlocks.BlockUIExecuteJs("DeleteForumMessage")); if (errorMessage.IsSet()) { this.PageContext.AddLoadMessage(errorMessage, MessageTypes.Error); } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.Get <HttpRequestBase>().QueryString.Exists("m")) { // We check here if the user have access to the option if (!this.Get <IPermissions>().Check(this.Get <BoardSettings>().ReportPostPermissions)) { BuildLink.Redirect(ForumPages.Info, "i=1"); } this.messageID = Security.StringToIntOrRedirect(this.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("m")); } this.PageContext.PageElements.RegisterJsBlockStartup( nameof(JavaScriptBlocks.FormValidatorJs), JavaScriptBlocks.FormValidatorJs(this.btnReport.ClientID)); if (this.IsPostBack) { return; } // Get reported message text for better quoting var message = this.GetRepository <Message>().GetMessageWithAccess(this.messageID, this.PageContext.PageUserID); // Checking if the user has a right to view the message and getting data if (message != null) { this.topicName = message.Item1.TopicName; this.MessagePreview.CurrentMessage = message.Item2; this.UserLink1.Suspended = message.Item3.Suspended; this.UserLink1.ReplaceName = this.Get <IUserDisplayName>().GetName(message.Item3); this.UserLink1.Style = message.Item3.UserStyle; this.UserLink1.UserID = message.Item3.ID; this.Posted.DateTime = message.Item2.Posted; } else { BuildLink.Redirect(ForumPages.Info, "i=1"); } this.Report.MaxLength = this.Get <BoardSettings>().MaxReportPostChars; this.LocalizedLblMaxNumberOfPost.Param0 = this.Get <BoardSettings>().MaxReportPostChars.ToString(); }
/// <summary> /// The On PreRender event. /// </summary> /// <param name="e"> /// the Event Arguments /// </param> protected override void OnPreRender([NotNull] EventArgs e) { // setup jQuery and Jquery Ui Tabs. YafContext.Current.PageElements.RegisterJsBlock( "TopicsTabsJs", JavaScriptBlocks.JqueryUITabsLoadJs( this.TopicsTabs.ClientID, this.hidLastTab.ClientID, this.hidLastTabId.ClientID, this.Page.ClientScript.GetPostBackEventReference(this.ChangeTab, string.Empty), false, true)); base.OnPreRender(e); }
/// <summary> /// Registers the needed Java Scripts /// </summary> /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param> protected override void OnPreRender([NotNull] EventArgs e) { // setup jQuery and YAF JS... YafContext.Current.PageElements.RegisterJQuery(); YafContext.Current.PageElements.RegisterJQueryUI(); YafContext.Current.PageElements.RegisterJsResourceInclude( "tablesorter", "js/jquery.tablesorter.js"); YafContext.Current.PageElements.RegisterJsBlock( "spinnerJs", JavaScriptBlocks.LoadSpinnerWidget()); base.OnPreRender(e); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { this.PageContext.PageElements.RegisterJsBlockStartup( nameof(JavaScriptBlocks.FormValidatorJs), JavaScriptBlocks.FormValidatorJs(this.RunQuery.ClientID)); if (this.IsPostBack) { return; } this.chkRunInTransaction.Text = this.GetText("ADMIN_RUNSQL", "RUN_TRANSCATION"); this.BindData(); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e) { if (this.IsPostBack) { return; } this.PageContext.PageElements.RegisterJsBlockStartup( nameof(JavaScriptBlocks.FormValidatorJs), JavaScriptBlocks.FormValidatorJs(this.Save.ClientID)); // Populate Category Table this.CreateImagesDataTable(); this.BindData(); }
/// <summary> /// Handles the PreRender event /// </summary> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); // Setup Hover Card JS YafContext.Current.PageElements.RegisterJsBlockStartup( "fileUploadjs", JavaScriptBlocks.FileUploadLoadJs( string.Join("|", this.FileExtensions.Select(ext => ext.Extension)), this.Get <BoardSettings>().MaxFileSize, $"{BoardInfo.ForumClientFileRoot}YafUploader.ashx", this.PageContext.PageForumID, this.PageContext.PageBoardID, this.Get <BoardSettings>().ImageAttachmentResizeWidth, this.Get <BoardSettings>().ImageAttachmentResizeHeight)); }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param> protected override void OnPreRender([NotNull] EventArgs e) { if (this.User.ID == this.PageContext.PageUserID) { // Register Js Blocks. this.PageContext.PageElements.RegisterJsBlockStartup( "AlbumEventsJs", JavaScriptBlocks.AlbumEventsJs( this.Get <ILocalization>().GetText("ALBUM_CHANGE_TITLE").ToJsString(), this.Get <ILocalization>().GetText("ALBUM_IMAGE_CHANGE_CAPTION").ToJsString())); this.PageContext.PageElements.RegisterJsBlockStartup( "AlbumCallbackSuccessJS", JavaScriptBlocks.AlbumCallbackSuccessJs); } base.OnPreRender(e); }
/// <summary> /// The On PreRender event. /// </summary> /// <param name="e"> /// the Event Arguments /// </param> protected override void OnPreRender([NotNull] EventArgs e) { this.PageContext.PageElements.RegisterJsBlockStartup( "passwordStrengthCheckJs", JavaScriptBlocks.PasswordStrengthCheckerJs( this.Password.ClientID, this.ConfirmPassword.ClientID, this.PageContext.BoardSettings.MinRequiredPasswordLength, this.GetText("PASSWORD_NOTMATCH"), this.GetTextFormatted("PASSWORD_MIN", this.PageContext.BoardSettings.MinRequiredPasswordLength), this.GetText("PASSWORD_GOOD"), this.GetText("PASSWORD_STRONGER"), this.GetText("PASSWORD_WEAK"))); base.OnPreRender(e); }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.PreRender" /> event. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param> protected override void OnPreRender([NotNull] EventArgs e) { if (!this.PageContext.IsGuest) { this.PageContext.PageElements.RegisterJsBlockStartup( nameof(JavaScriptBlocks.LogOutJs), JavaScriptBlocks.LogOutJs( this.GetText("TOOLBAR", "LOGOUT_TITLE"), this.GetText("TOOLBAR", "LOGOUT_QUESTION"), this.GetText("TOOLBAR", "LOGOUT"), this.GetText("COMMON", "CANCEL"), this.Get <LinkBuilder>().GetLink(ForumPages.Account_Logout))); } base.OnPreRender(e); }
/// <summary> /// The On PreRender event. /// </summary> /// <param name="e"> /// the Event Arguments /// </param> protected override void OnPreRender([NotNull] EventArgs e) { // setup jQuery and DatePicker JS... YafContext.Current.PageElements.RegisterJQuery(); YafContext.Current.PageElements.RegisterJsResourceInclude("msdropdown", "js/jquery.msDropDown.js"); var country = (DropDownList)this.CreateUserWizard1.FindWizardControlRecursive("Country"); YafContext.Current.PageElements.RegisterJsBlockStartup( "dropDownJs", JavaScriptBlocks.DropDownLoadJs(country.ClientID)); YafContext.Current.PageElements.RegisterCssIncludeResource("css/jquery.msDropDown.css"); base.OnPreRender(e); }
/// <summary> /// Ranks the list item command. /// </summary> /// <param name="source">The source.</param> /// <param name="e">The <see cref="RepeaterCommandEventArgs"/> instance containing the event data.</param> protected void RankListItemCommand([NotNull] object source, [NotNull] RepeaterCommandEventArgs e) { switch (e.CommandName) { case "edit": this.EditDialog.BindData(e.CommandArgument.ToType <int>()); YafContext.Current.PageElements.RegisterJsBlockStartup( "openModalJs", JavaScriptBlocks.OpenModalJs("NntpForumEditDialog")); break; case "delete": LegacyDb.nntpforum_delete(e.CommandArgument); this.BindData(); break; } }
/// <summary> /// The On PreRender event. /// </summary> /// <param name="e"> /// the Event Arguments /// </param> protected override void OnPreRender([NotNull] EventArgs e) { // setup jQuery and Jquery Ui Tabs. this.PageBoardContext.PageElements.RegisterJsBlock( "dropDownToggleJs", JavaScriptBlocks.DropDownToggleJs()); this.PageBoardContext.PageElements.RegisterJsBlockStartup( nameof(JavaScriptBlocks.SelectForumsLoadJs), JavaScriptBlocks.SelectForumsLoadJs( "ForumList", this.GetText("PRUNE_FORUM"), false, true, this.ForumListSelected.ClientID)); base.OnPreRender(e); }
/// <summary> /// The On PreRender event. /// </summary> /// <param name="e"> /// the Event Arguments /// </param> protected override void OnPreRender([NotNull] EventArgs e) { this.PageContext.PageElements.RegisterJsBlockStartup( "DatePickerJs", JavaScriptBlocks.DatePickerLoadJs( this.GetText("COMMON", "CAL_JQ_CULTURE_DFORMAT"), this.GetText("COMMON", "CAL_JQ_CULTURE"))); this.PageContext.PageElements.RegisterJsBlock("dropDownToggleJs", JavaScriptBlocks.DropDownToggleJs()); this.PageContext.PageElements.RegisterJsBlock( "collapseToggleJs", JavaScriptBlocks.CollapseToggleJs( this.GetText("ADMIN_EVENTLOG", "HIDE"), this.GetText("ADMIN_EVENTLOG", "SHOW"))); base.OnPreRender(e); }
/// <summary> /// The On PreRender event. /// </summary> /// <param name="e"> /// the Event Arguments /// </param> protected override void OnPreRender([NotNull] EventArgs e) { this.PageContext.PageElements.RegisterJsBlockStartup( "TopicStarterPopoverJs", JavaScriptBlocks.TopicLinkPopoverJs( $"{this.GetText("TOPIC_STARTER")} ...", ".topic-starter-popover", "hover")); this.PageContext.PageElements.RegisterJsBlockStartup( "TopicLinkPopoverJs", JavaScriptBlocks.TopicLinkPopoverJs( $"{this.GetText("LASTPOST")} {this.GetText("SEARCH", "BY")} ...", ".topic-link-popover", "focus hover")); base.OnPreRender(e); }
/// <summary> /// The On PreRender event. /// </summary> /// <param name="e"> /// the Event Arguments /// </param> protected override void OnPreRender([NotNull] EventArgs e) { // setup jQuery and Jquery Ui Tabs. YafContext.Current.PageElements.RegisterJQuery(); YafContext.Current.PageElements.RegisterJQueryUI(); YafContext.Current.PageElements.RegisterJsBlock( "ProfileTabsJs", JavaScriptBlocks.JqueryUITabsLoadJs(this.ProfileTabs.ClientID, this.hidLastTab.ClientID, true)); // Setup Syntax Highlight JS YafContext.Current.PageElements.RegisterJsResourceInclude( "syntaxhighlighter", "js/jquery.syntaxhighligher.js"); YafContext.Current.PageElements.RegisterCssIncludeResource("css/jquery.syntaxhighligher.css"); YafContext.Current.PageElements.RegisterJsBlockStartup( "syntaxhighlighterjs", JavaScriptBlocks.SyntaxHighlightLoadJs); base.OnPreRender(e); }
/// <summary> /// The On PreRender event. /// </summary> /// <param name="e"> /// the Event Arguments /// </param> protected override void OnPreRender([NotNull] EventArgs e) { // setup jQuery and Jquery Ui Tabs. YafContext.Current.PageElements.RegisterJsBlock( "ProfileTabsJs", JavaScriptBlocks.JqueryUITabsLoadJs( this.ProfileTabs.ClientID, this.hidLastTab.ClientID, this.hidLastTabId.ClientID, string.Empty, false, true)); // Setup Syntax Highlight JS YafContext.Current.PageElements.RegisterJsBlockStartup( "syntaxhighlighterjs", JavaScriptBlocks.SyntaxHighlightLoadJs); base.OnPreRender(e); }