コード例 #1
0
        private void SaveSettings()
        {
            // Step 1: Update config manually with those items that are not managed via the wwDataBinder
            int albumId;

            if ((tvUC.SelectedNode != null) && (Int32.TryParse(tvUC.SelectedNode.Value, out albumId)))
            {
                GallerySettingsUpdateable.UserAlbumParentAlbumId = albumId;
            }

            // Step 2: Save
            this.wwDataBinder.Unbind(this);

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                this.wwMessage.CssClass = "wwErrorFailure gsp_msgwarning";
                this.wwMessage.Text     = wwDataBinder.BindingErrors.ToHtml();
                return;
            }

            GallerySettingsUpdateable.Save();

            ConfigureOrphanUserAlbums();

            this.wwMessage.CssClass = "wwErrorSuccess gsp_msgfriendly gsp_bold";
            this.wwMessage.ShowMessage(Resources.GalleryServerPro.Admin_Save_Success_Text);
        }
コード例 #2
0
        private void SaveSettings()
        {
            this.wwDataBinder.Unbind(this);

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title   = Resources.GalleryServerPro.Validation_Summary_Text,
                    Message = wwDataBinder.BindingErrors.ToString(),
                    Style   = MessageStyle.Error
                };

                return;
            }

            GallerySettingsUpdateable.Save();

            HelperFunctions.PurgeCache();

            ClientMessage = new ClientMessageOptions
            {
                Title   = Resources.GalleryServerPro.Admin_Save_Success_Hdr,
                Message = Resources.GalleryServerPro.Admin_Save_Success_Text,
                Style   = MessageStyle.Success
            };
        }
コード例 #3
0
        private void SaveSettings()
        {
            // Step 1: Update config manually with those items that are not managed via the wwDataBinder
            UnbindUsersToNotifyWhenErrorOccurs();

            // Step 2: Save
            this.wwDataBinder.Unbind(this);

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title   = Resources.GalleryServerPro.Validation_Summary_Text,
                    Message = wwDataBinder.BindingErrors.ToString(),
                    Style   = MessageStyle.Error
                };

                return;
            }

            GallerySettingsUpdateable.Save();

            HelperFunctions.PurgeCache();

            // Since we are changing settings that affect how and which controls are rendered to the page, let us redirect to the current page and
            // show the save success message. If we simply show a message without redirecting, two things happen: (1) the user doesn't see the effect
            // of their change until the next page load, (2) there is the potential for a viewstate validation error
            const MessageType msg = MessageType.SettingsSuccessfullyChanged;

            Utils.Redirect(PageId.admin_gallerysettings, "aid={0}&msg={1}", GetAlbumId(), ((int)msg).ToString(CultureInfo.InvariantCulture));
        }
コード例 #4
0
        private void SaveSettings()
        {
            UnbindData();

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title   = Resources.GalleryServer.Validation_Summary_Text,
                    Message = wwDataBinder.BindingErrors.ToString(),
                    Style   = MessageStyle.Error
                };

                return;
            }

            GallerySettingsUpdateable.Save();

            ClientMessage = new ClientMessageOptions
            {
                Title   = Resources.GalleryServer.Admin_Save_Success_Hdr,
                Message = GetSaveSuccessText(),
                Style   = MessageStyle.Success
            };

            if (chkUpdateSort.Checked)
            {
                UpdateSortOnExistingAlbumsAsync();
            }
        }
コード例 #5
0
        private void SaveSettings()
        {
            string encoderSettingsStr = hdnEncoderSettings.Value;

            var encoderSettings = encoderSettingsStr.FromJson <Entity.MediaEncoderSettings[]>();

            GallerySettingsUpdateable.MediaEncoderSettings = MediaEncoderSettingsController.ToMediaEncoderSettingsCollection(encoderSettings);


            this.wwDataBinder.Unbind(this);

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title   = Resources.GalleryServer.Validation_Summary_Text,
                    Message = wwDataBinder.BindingErrors.ToString(),
                    Style   = MessageStyle.Error
                };

                return;
            }

            GallerySettingsUpdateable.Save();

            ClientMessage = new ClientMessageOptions
            {
                Title   = Resources.GalleryServer.Admin_Save_Success_Hdr,
                Message = Resources.GalleryServer.Admin_Save_Success_Text,
                Style   = MessageStyle.Success
            };

            hdnEncoderSettings.Value = MediaEncoderSettingsController.ToEntities(GallerySettingsUpdateable.MediaEncoderSettings).ToJson();
        }
コード例 #6
0
        private void SaveSettings()
        {
            this.wwDataBinder.Unbind(this);

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title   = Resources.GalleryServer.Validation_Summary_Text,
                    Message = wwDataBinder.BindingErrors.ToString(),
                    Style   = MessageStyle.Error
                };

                return;
            }

            GallerySettingsUpdateable.Save();

            // In case the media objects path has changed, clear the inflated albums cache, since those albums hold a
            // reference to the full path to the album/media asset.
            CacheController.RemoveInflatedAlbumsFromCache();

            ClientMessage = new ClientMessageOptions
            {
                Title   = Resources.GalleryServer.Admin_Save_Success_Hdr,
                Message = Resources.GalleryServer.Admin_Save_Success_Text,
                Style   = MessageStyle.Success
            };
        }
コード例 #7
0
        private void SaveSettings()
        {
            string encoderSettingsStr = hdnEncoderSettings.Value;

            Entity.MediaEncoderSettings[] encoderSettings = encoderSettingsStr.FromJson <Entity.MediaEncoderSettings[]>();

            GallerySettingsUpdateable.MediaEncoderSettings = MediaEncoderSettingsController.ToMediaEncoderSettingsCollection(encoderSettings);


            this.wwDataBinder.Unbind(this);

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                this.wwMessage.CssClass = "wwErrorFailure gsp_msgwarning";
                this.wwMessage.Text     = wwDataBinder.BindingErrors.ToHtml();

                return;
            }

            GallerySettingsUpdateable.Save();

            this.wwMessage.CssClass = "wwErrorSuccess gsp_msgfriendly gsp_bold";
            this.wwMessage.ShowMessage(Resources.GalleryServerPro.Admin_Save_Success_Text);

            hdnEncoderSettings.Value = MediaEncoderSettingsController.ToEntities(GallerySettingsUpdateable.MediaEncoderSettings).ToJson();
        }
コード例 #8
0
ファイル: images.ascx.cs プロジェクト: vbraziel/GalleryServer
        private void SaveSettings()
        {
            UnbindWatermarkImage();

            this.wwDataBinder.Unbind(this);

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title   = Resources.GalleryServer.Validation_Summary_Text,
                    Message = wwDataBinder.BindingErrors.ToString(),
                    Style   = MessageStyle.Error
                };

                return;
            }

            GallerySettingsUpdateable.Save();

            Factory.ClearWatermarkCache();
            imgWatermarkImage.ImageUrl = WatermarkImageFileSource;

            ClientMessage = new ClientMessageOptions
            {
                Title   = Resources.GalleryServer.Admin_Save_Success_Hdr,
                Message = Resources.GalleryServer.Admin_Save_Success_Text,
                Style   = MessageStyle.Success
            };
        }
コード例 #9
0
        private void SaveSettings()
        {
            this.wwDataBinder.Unbind(this);

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                this.wwMessage.CssClass = "wwErrorFailure gsp_msgwarning";
                this.wwMessage.Text     = wwDataBinder.BindingErrors.ToHtml();

                return;
            }

            GallerySettingsUpdateable.Save();

            this.wwMessage.CssClass = "wwErrorSuccess gsp_msgfriendly gsp_bold";
            this.wwMessage.ShowMessage(Resources.GalleryServerPro.Admin_Save_Success_Text);
        }
コード例 #10
0
        private void SaveSettings()
        {
            this.wwDataBinder.Unbind(this);

            bool previousAllowAllValue = GallerySettings.AllowUnspecifiedMimeTypes;

            if (GallerySettingsUpdateable.AllowUnspecifiedMimeTypes != previousAllowAllValue)
            {
                GallerySettingsUpdateable.Save();
            }

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title   = Resources.GalleryServerPro.Validation_Summary_Text,
                    Message = wwDataBinder.BindingErrors.ToString(),
                    Style   = MessageStyle.Error
                };

                return;
            }

            var encoderSettingsStr = hdnMimeTypes.Value;

            var mimeTypes = encoderSettingsStr.FromJson <Entity.MimeType[]>();

            // Loop through each MIME type entity. For each file extension, get the matching MIME type. If the value has changed, update it.
            foreach (var mte in mimeTypes)
            {
                var mimeType = Factory.LoadMimeType(GalleryId, mte.Extension);
                if (mimeType.AllowAddToGallery != mte.Enabled)
                {
                    mimeType.AllowAddToGallery = mte.Enabled;
                    mimeType.Save();
                }
            }

            ClientMessage = new ClientMessageOptions
            {
                Title   = Resources.GalleryServerPro.Admin_Save_Success_Hdr,
                Message = Resources.GalleryServerPro.Admin_Save_Success_Text,
                Style   = MessageStyle.Success
            };
        }
コード例 #11
0
        private void SaveSettings()
        {
            string meta = hdnMetadataDefinitions.Value;

            MetadataDefinition[] metas = meta.FromJson <MetadataDefinition[]>();

            ValidateBeforeSave(metas);

            GallerySettingsUpdateable.MetadataDisplaySettings.Clear();
            foreach (var metaDef in metas)
            {
                GallerySettingsUpdateable.MetadataDisplaySettings.Add(metaDef);
            }

            this.wwDataBinder.Unbind(this);

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title   = Resources.GalleryServer.Validation_Summary_Text,
                    Message = wwDataBinder.BindingErrors.ToString(),
                    Style   = MessageStyle.Error
                };

                return;
            }

            GallerySettingsUpdateable.Save();

            CacheController.RemoveCache(CacheItem.AlbumAssets);
            CacheController.RemoveCache(CacheItem.MediaAssets);
            CacheController.RemoveCache(CacheItem.InflatedAlbums);

            BindMetadata();

            ClientMessage = new ClientMessageOptions
            {
                Title   = Resources.GalleryServer.Admin_Save_Success_Hdr,
                Message = Resources.GalleryServer.Admin_Save_Success_Text,
                Style   = MessageStyle.Success
            };
        }
コード例 #12
0
        private void SaveSettings()
        {
            this.wwDataBinder.Unbind(this);

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                this.MessageText    = wwDataBinder.BindingErrors.ToHtml();
                this.MessageIsError = true;
                UpdateUI();
                return;
            }

            GallerySettingsUpdateable.Save();

            // Since we are changing settings that affect how and which controls are rendered to the page, let us redirect to the current page and
            // show the save success message. If we simply show a message without redirecting, two things happen: (1) the user doesn't see the effect
            // of their change until the next page load, (2) there is the potential for a viewstate validation error
            const Message msg = Message.SettingsSuccessfullyChanged;

            Util.Redirect(PageId.admin_gallerysettings, "aid={0}&msg={1}", GetAlbumId(), ((int)msg).ToString(CultureInfo.InvariantCulture));
        }
コード例 #13
0
        private void SaveSettings()
        {
            // Step 1: Update config manually with those items that are not managed via the wwDataBinder
            UnbindUserAlbumId();

            UnbindDefaultRoles();

            UnbindUsersToNotify();

            // Step 2: Save
            this.wwDataBinder.Unbind(this);

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                ClientMessage = new ClientMessageOptions
                {
                    Title   = Resources.GalleryServer.Validation_Summary_Text,
                    Message = wwDataBinder.BindingErrors.ToString(),
                    Style   = MessageStyle.Error
                };

                return;
            }

            GallerySettingsUpdateable.Save();

            ConfigureOrphanUserAlbums();

            ConfigureUserAlbumParentComboBox();

            ClientMessage = new ClientMessageOptions
            {
                Title   = Resources.GalleryServer.Admin_Save_Success_Hdr,
                Message = Resources.GalleryServer.Admin_Save_Success_Text,
                Style   = MessageStyle.Success
            };
        }
コード例 #14
0
        private void SaveSettings()
        {
            this.wwDataBinder.Unbind(this);

            bool previousAllowAllValue = GallerySettings.AllowUnspecifiedMimeTypes;

            if (GallerySettingsUpdateable.AllowUnspecifiedMimeTypes != previousAllowAllValue)
            {
                GallerySettingsUpdateable.Save();
            }

            if (wwDataBinder.BindingErrors.Count > 0)
            {
                this.wwMessage.CssClass = "wwErrorFailure gsp_msgwarning";
                this.wwMessage.Text     = wwDataBinder.BindingErrors.ToHtml();
                return;
            }

            // Loop through each record in the grid. For each file extension, get the matching MIME type. If the value has changed, update it.
            foreach (GridItem row in gdMimeTypes.Items)
            {
                object[] rowValues = (object[])row.DataItem;
                bool     enabled   = Convert.ToBoolean(rowValues[0], CultureInfo.InvariantCulture);
                string   fileExt   = rowValues[1].ToString();

                IMimeType mimeType = MimeType.LoadMimeType(GalleryId, fileExt);
                if (mimeType.AllowAddToGallery != enabled)
                {
                    mimeType.AllowAddToGallery = enabled;
                    mimeType.Save();
                }
            }

            this.wwMessage.CssClass = "wwErrorSuccess gsp_msgfriendly gsp_bold";
            this.wwMessage.ShowMessage(Resources.GalleryServerPro.Admin_Save_Success_Text);
        }