private void ConfigureControls() { // Sueetie Modified - Add Album Content Types List <ContentTypeDescription> albumContentTypes = SueetieMedia.GetAlbumContentTypeDescriptionList(); foreach (ContentTypeDescription _albumContentType in albumContentTypes) { ddSueetieAlbumType.Items.Add(new ListItem(_albumContentType.Description, _albumContentType.ContentTypeID.ToString())); } this.TaskHeaderText = Resources.GalleryServerPro.Task_Create_Album_Header_Text; this.TaskBodyText = Resources.GalleryServerPro.Task_Create_Album_Body_Text; this.OkButtonText = Resources.GalleryServerPro.Task_Create_Album_Ok_Button_Text; this.OkButtonToolTip = Resources.GalleryServerPro.Task_Create_Album_Ok_Button_Tooltip; this.PageTitle = Resources.GalleryServerPro.Task_Create_Album_Page_Title; txtTitle.MaxLength = DataConstants.AlbumTitleLength; lblMaxTitleLengthInfo.Text = String.Format(CultureInfo.CurrentCulture, Resources.GalleryServerPro.Task_Create_Album_Title_Max_Length_Text, DataConstants.AlbumTitleLength.ToString(CultureInfo.InvariantCulture)); tvUC.RequiredSecurityPermissions = SecurityActions.AddChildAlbum; if (this.GetAlbum().IsPrivate) { chkIsPrivate.Checked = true; chkIsPrivate.Enabled = false; lblPrivateAlbumIsInherited.Text = Resources.GalleryServerPro.Task_Create_Album_Is_Private_Disabled_Text; } IAlbum albumToSelect = this.GetAlbum(); if (!IsUserAuthorized(SecurityActions.AddChildAlbum, albumToSelect)) { albumToSelect = AlbumController.GetHighestLevelAlbumWithCreatePermission(GalleryId); } if (albumToSelect == null) { tvUC.BindTreeView(); } else { tvUC.BindTreeView(albumToSelect); } this.Page.Form.DefaultFocus = txtTitle.ClientID; }
protected void ActivitiesGridView_OnRowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow && ((e.Row.RowState & DataControlRowState.Edit) > 0)) { SueetieMediaAlbum _sueetieMediaAlbum = ((SueetieMediaAlbum)e.Row.DataItem); List <ContentTypeDescription> _contentTypeDescriptions = SueetieMedia.GetAlbumContentTypeDescriptionList(); DropDownList ddContentTypes = (DropDownList)e.Row.FindControl("ddContentTypes") as DropDownList; foreach (ContentTypeDescription _contentTypeDescription in _contentTypeDescriptions) { ddContentTypes.Items.Add(new ListItem(_contentTypeDescription.Description, _contentTypeDescription.ContentTypeID.ToString())); } ddContentTypes.Items.FindByValue(_sueetieMediaAlbum.ContentTypeID.ToString()).Selected = true; ddContentTypes.DataBind(); this.ContentID = _sueetieMediaAlbum.ContentID; } }
private int btnOkClicked() { //User clicked 'Create album'. Create the new album and return the new album ID. TreeViewNode selectedNode = tvUC.SelectedNode; int parentAlbumID = Int32.Parse(selectedNode.Value, CultureInfo.InvariantCulture); IAlbum parentAlbum = Factory.LoadAlbumInstance(parentAlbumID, false); this.CheckUserSecurity(SecurityActions.AddChildAlbum, parentAlbum); int newAlbumID; if (parentAlbumID > 0) { IAlbum newAlbum = Factory.CreateEmptyAlbumInstance(parentAlbum.GalleryId); newAlbum.Title = GetAlbumTitle(); //newAlbum.ThumbnailMediaObjectId = 0; // not needed newAlbum.Parent = parentAlbum; newAlbum.IsPrivate = (parentAlbum.IsPrivate ? true : chkIsPrivate.Checked); GalleryObjectController.SaveGalleryObject(newAlbum); newAlbumID = newAlbum.Id; // Sueetie Modified - Save New Album to Sueetie_Content, Sueetie_gs_Album and log it in User Activity Log string grpString = string.Empty; if (SueetieApplications.Current.IsGroup) { grpString = "/" + SueetieApplications.Current.GroupKey; } string albumUrl = grpString + "/" + SueetieApplications.Current.ApplicationKey + "/" + CurrentSueetieGallery.GalleryKey + ".aspx?aid=" + newAlbumID.ToString(); SueetieContent sueetieContent = new SueetieContent { SourceID = newAlbumID, ContentTypeID = int.Parse(ddSueetieAlbumType.SelectedValue), ApplicationID = (int)SueetieApplications.Current.ApplicationID, UserID = CurrentSueetieUserID, IsRestricted = newAlbum.IsPrivate, Permalink = albumUrl, }; int contentID = SueetieCommon.AddSueetieContent(sueetieContent); var albumLogCategory = SueetieMedia.GetAlbumContentTypeDescriptionList().Single(contentDescription => contentDescription.ContentTypeID.Equals(sueetieContent.ContentTypeID)); UserLogEntry entry = new UserLogEntry { UserLogCategoryID = albumLogCategory.UserLogCategoryID, ItemID = contentID, UserID = CurrentSueetieUserID, }; if (CurrentSueetieGallery.IsLogged) { SueetieLogs.LogUserEntry(entry); } string albumPath = SueetieMedia.CreateSueetieAlbumPath(newAlbum.FullPhysicalPath); SueetieMedia.CreateSueetieAlbum(newAlbumID, albumPath, sueetieContent.ContentTypeID); SueetieMedia.ClearSueetieMediaAlbumListCache(CurrentSueetieGalleryID); SueetieMedia.ClearSueetieMediaGalleryListCache(); HelperFunctions.PurgeCache(); } else { throw new GalleryServerPro.ErrorHandler.CustomExceptions.InvalidAlbumException(parentAlbumID); } return(newAlbumID); }