Esempio n. 1
0
        private void ConfigureControlsFirstTime()
        {
            this.OkButtonIsVisible     = false;         // Instead, we'll use our own buttons inside the tab control.
            this.CancelButtonIsVisible = false;
            this.TaskHeaderText        = Resources.GalleryServerPro.Task_Add_Objects_Header_Text;
            this.TaskBodyText          = Resources.GalleryServerPro.Task_Add_Objects_Body_Text;

            this.PageTitle = Resources.GalleryServerPro.Task_Add_Objects_Page_Title;

            cpe.ExpandedImage  = Util.GetUrl("/images/collapse.jpg");
            cpe.CollapsedImage = Util.GetUrl("/images/expand.jpg");
            imgExpCol.ImageUrl = Util.GetUrl("/images/expand.jpg");

            ConfigureTabStrip();

            if (!HelperFunctions.IsFileAuthorizedForAddingToGallery("dummy.zip", GalleryId))
            {
                chkDoNotExtractZipFile.Enabled  = false;
                chkDoNotExtractZipFile.CssClass = "gsp_disabledtext";
            }

            if (GallerySettings.DiscardOriginalImageDuringImport)
            {
                chkDiscardOriginalImage.Checked  = true;
                chkDiscardOriginalImage.Enabled  = false;
                chkDiscardOriginalImage.CssClass = "gsp_disabledtext";
            }

            // Sueetie Modified - Clear Gallery Cache in case gallery just created and this the first object addition
            SueetieMedia.ClearSueetieMediaGalleryListCache();
        }
Esempio n. 2
0
        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);
        }