/// <summary> /// Called when the page loads /// </summary> /// <param name="sender"> /// the sender. /// </param> /// <param name="e"> /// the e. /// </param> protected void Page_Load(object sender, EventArgs e) { this._attachGroupID = Guid.NewGuid().ToString().Substring(0, 5); if (this.UserID == this.PageContext.PageUserID) { // Register AjaxPro. Utility.RegisterTypeForAjax(typeof(YafAlbum)); // Register Js Blocks. YafContext.Current.PageElements.RegisterJsBlockStartup( "AlbumEventsJs", JavaScriptBlocks.AlbumEventsJs( this.PageContext.Localization.GetText("ALBUM_CHANGE_TITLE"), this.PageContext.Localization.GetText("ALBUM_IMAGE_CHANGE_CAPTION"))); YafContext.Current.PageElements.RegisterJsBlockStartup( "ChangeAlbumTitleJs", JavaScriptBlocks.ChangeAlbumTitleJs); YafContext.Current.PageElements.RegisterJsBlockStartup( "ChangeImageCaptionJs", JavaScriptBlocks.ChangeImageCaptionJs); YafContext.Current.PageElements.RegisterJsBlockStartup( "asynchCallFailedJs", JavaScriptBlocks.asynchCallFailedJs); YafContext.Current.PageElements.RegisterJsBlockStartup( "AlbumCallbackSuccessJS", JavaScriptBlocks.AlbumCallbackSuccessJS); this.ltrTitleOnly.Visible = false; } // Initialize the edit control. this.EditAlbums.Visible = this.UserID == this.PageContext.PageUserID; this.EditAlbums.Text = this.PageContext.Localization.GetText("BUTTON", "BUTTON_EDITALBUMIMAGES"); this.BindData(); }
/// <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.UserID == this.PageContext.PageUserID) { // Register jQuery Ajax Plugin. YafContext.Current.PageElements.RegisterJsResourceInclude("yafPageMethodjs", "js/jquery.pagemethod.js"); // Register Js Blocks. YafContext.Current.PageElements.RegisterJsBlockStartup( "AlbumEventsJs", JavaScriptBlocks.AlbumEventsJs( this.GetText("ALBUM_CHANGE_TITLE").ToJsString(), this.GetText("ALBUM_IMAGE_CHANGE_CAPTION").ToJsString())); YafContext.Current.PageElements.RegisterJsBlockStartup( "ChangeAlbumTitleJs", JavaScriptBlocks.ChangeAlbumTitleJs); YafContext.Current.PageElements.RegisterJsBlockStartup( "ChangeImageCaptionJs", JavaScriptBlocks.ChangeImageCaptionJs); YafContext.Current.PageElements.RegisterJsBlockStartup( "asynchCallFailedJs", JavaScriptBlocks.AsynchCallFailedJs); YafContext.Current.PageElements.RegisterJsBlockStartup( "AlbumCallbackSuccessJS", JavaScriptBlocks.AlbumCallbackSuccessJS); this.ltrTitleOnly.Visible = false; } 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.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> /// 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.UserID == this.PageContext.PageUserID) { // Register Js Blocks. YafContext.Current.PageElements.RegisterJsBlockStartup( "AlbumEventsJs", JavaScriptBlocks.AlbumEventsJs( this.GetText("ALBUM_CHANGE_TITLE").ToJsString(), this.GetText("ALBUM_IMAGE_CHANGE_CAPTION").ToJsString())); YafContext.Current.PageElements.RegisterJsBlockStartup( "ChangeAlbumTitleJs", JavaScriptBlocks.ChangeAlbumTitleJs); YafContext.Current.PageElements.RegisterJsBlockStartup( "ChangeImageCaptionJs", JavaScriptBlocks.ChangeImageCaptionJs); YafContext.Current.PageElements.RegisterJsBlockStartup( "AlbumCallbackSuccessJS", JavaScriptBlocks.AlbumCallbackSuccessJs); this.ltrTitleOnly.Visible = false; } base.OnPreRender(e); }
/// <summary> /// Called when the page loads /// </summary> /// <param name="sender"> /// the sender. /// </param> /// <param name="e"> /// the e. /// </param> protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { if (this.UserID == this.PageContext.PageUserID) { // Register AjaxPro. Utility.RegisterTypeForAjax(typeof(YafAlbum)); // Register Js Blocks. YafContext.Current.PageElements.RegisterJsBlockStartup( "AlbumEventsJs", JavaScriptBlocks.AlbumEventsJs( this.PageContext.Localization.GetText("ALBUM_CHANGE_TITLE"), this.PageContext.Localization.GetText("ALBUM_IMAGE_CHANGE_CAPTION"))); YafContext.Current.PageElements.RegisterJsBlockStartup( "ChangeAlbumTitleJs", JavaScriptBlocks.ChangeAlbumTitleJs); YafContext.Current.PageElements.RegisterJsBlockStartup( "asynchCallFailedJs", JavaScriptBlocks.asynchCallFailedJs); YafContext.Current.PageElements.RegisterJsBlockStartup( "AlbumCallbackSuccessJS", JavaScriptBlocks.AlbumCallbackSuccessJS); } string umhdn = UserMembershipHelper.GetDisplayNameFromID(this.UserID); this.AlbumHeaderLabel.Param0 = !string.IsNullOrEmpty(umhdn) ? this.HtmlEncode(umhdn) : this.HtmlEncode(UserMembershipHelper.GetUserNameFromID(this.UserID)); this.BindData(); // vzrus: replaced registry check for db data //System.Data.DataTable sigData = DB.user_getalbumsdata(this.PageContext.PageUserID, YafContext.Current.PageBoardID); var usrAlbums = DB.user_getalbumsdata(this.PageContext.PageUserID, YafContext.Current.PageBoardID).GetFirstRowColumnAsValue <int?>( "UsrAlbums", null); if (usrAlbums.HasValue && usrAlbums > 0) { //this.AddAlbum.Visible = true; this.AddAlbum.Visible = (DB.album_getstats(this.PageContext.PageUserID, null)[0] < usrAlbums && this.UserID == this.PageContext.PageUserID) ? true : false; } /*if (sigData.Rows.Count > 0) * { * this.AddAlbum.Visible = (DB.album_getstats(this.PageContext.PageUserID, null)[0] < * Convert.ToInt32(sigData.Rows[0]["UsrAlbums"]) && * this.UserID == this.PageContext.PageUserID) * ? true * : false; * * /* this.AddAlbum.Visible = (DB.album_getstats(this.PageContext.PageUserID, null)[0] < * this.PageContext.BoardSettings.AlbumsMax && * this.UserID == this.PageContext.PageUserID) * ? true * : false; */ // }*/ if (this.AddAlbum.Visible) { this.AddAlbum.Text = this.PageContext.Localization.GetText("BUTTON", "BUTTON_ADDALBUM"); } HttpContext.Current.Session["imagePreviewWidth"] = this.PageContext.BoardSettings.ImageAttachmentResizeWidth; HttpContext.Current.Session["imagePreviewHeight"] = this.PageContext.BoardSettings.ImageAttachmentResizeHeight; HttpContext.Current.Session["imagePreviewCropped"] = this.PageContext.BoardSettings.ImageAttachmentResizeCropped; HttpContext.Current.Session["localizationFile"] = this.PageContext.Localization.LanguageFileName; // Show Albums Max Info if (this.UserID == this.PageContext.PageUserID) { if (usrAlbums.HasValue && usrAlbums > 0) { albumsInfo.Text = this.PageContext.Localization.GetTextFormatted("ALBUMS_INFO", Albums.Items.Count, usrAlbums); } else if (usrAlbums.HasValue && usrAlbums.Equals(0) || !usrAlbums.HasValue) { albumsInfo.Text = this.PageContext.Localization.GetText("ALBUMS_NOTALLOWED"); } albumsInfo.Visible = true; } else { albumsInfo.Visible = false; } } }