Пример #1
0
		protected bool wwDataBinder_BeforeUnbindControl(GalleryServerPro.WebControls.wwDataBindingItem item)
		{
			if (!this.chkEnablePaging.Checked)
			{
				// When paging is disabled, we store "0" in the config file.
				if (item.ControlId == this.txtPageSize.ID)
				{
					txtPageSize.Text = "0";
					return true; // true indicates that we want to save this setting to the config file
				}

				// When paging is unchecked, several child items are disabled via javascript. Disabled HTML items are not
				// posted during a postback, so we don't have accurate information about their states. For these controls 
				// (except the page size as configured above) don't save anything by returning false. Furthermore, to 
				// prevent these child controls from incorrectly reverting to an empty or unchecked state in the UI, 
				// assign their properties to their config setting. 
				if (item.ControlId == this.ddlPagerLocation.ID)
				{
					this.ddlPagerLocation.SelectedValue = Core.PagerLocation;
					return false;
				}
			}

			return true;
		}
Пример #2
0
		protected bool wwDataBinder_BeforeUnbindControl(GalleryServerPro.WebControls.wwDataBindingItem item)
		{
			// When auto trim is disabled, we store "0" in the config file.
			if (!chkAutoTrimLog.Checked)
				txtMaxErrorItems.Text = "0";

			return true;
		}
Пример #3
0
		protected bool wwDataBinder_ValidateControl(GalleryServerPro.WebControls.wwDataBindingItem item)
		{
			// Validate various settings to make sure they don't conflict with each other.

			// Validate the media object path.
			if (item.ControlInstance == this.txtMoPath)
			{
				if (this.chkPathIsReadOnly.Checked)
					return ValidateReadOnlyGallery(item) && ValidatePathIsReadable(item, this.txtMoPath.Text, this.lblMoPath);
				else
					return ValidatePathIsWriteable(item, this.txtMoPath.Text, this.lblMoPath);
			}

				// Validate the media object thumbnail path.
			else if (item.ControlInstance == this.txtThumbnailCachePath)
			{
				string pathToTest = this.txtThumbnailCachePath.Text.Trim();
				if (String.IsNullOrEmpty(pathToTest))
					pathToTest = this.txtMoPath.Text;

				if (this.chkPathIsReadOnly.Checked)
					return ValidateReadOnlyGallery(item) && ValidatePathIsWriteable(item, pathToTest, this.lblThumbnailCachePath);
				else
					return ValidatePathIsWriteable(item, pathToTest, this.lblThumbnailCachePath);
			}

			// Validate the media object optimized image path.
			else if (item.ControlInstance == this.txtOptimizedCachePath)
			{
				string pathToTest = this.txtOptimizedCachePath.Text.Trim();
				if (String.IsNullOrEmpty(pathToTest))
					pathToTest = this.txtMoPath.Text;

				if (this.chkPathIsReadOnly.Checked)
					return ValidateReadOnlyGallery(item) && ValidatePathIsWriteable(item, pathToTest, this.lblOptimizedCachePath);
				else
					return ValidatePathIsWriteable(item, pathToTest, this.lblOptimizedCachePath);
			}

			// Validate the "media files are read-only" option
			else if (item.ControlInstance == this.chkPathIsReadOnly)
			{
				if (this.chkPathIsReadOnly.Checked)
					return ValidateReadOnlyGallery(item) && ValidatePathIsReadable(item, this.txtMoPath.Text, this.lblMoPath);
				else
					return ValidatePathIsWriteable(item, this.txtMoPath.Text, this.lblMoPath);
			}

			return true;
		}
Пример #4
0
		protected bool wwDataBinder_ValidateControl(GalleryServerPro.WebControls.wwDataBindingItem Item)
		{
			if (Item.ControlInstance == this.txtMoPath)
			{
				return ValidatePath(Item, this.txtMoPath.Text, this.lblMoPath);
			}
			else if (Item.ControlInstance == this.txtThumbnailCachePath)
			{
				return ValidatePath(Item, this.txtThumbnailCachePath.Text, this.lblThumbnailCachePath);
			}
			else if (Item.ControlInstance == this.txtOptimizedCachePath)
			{
				return ValidatePath(Item, this.txtOptimizedCachePath.Text, this.lblOptimizedCachePath);
			}

			return true;
		}
Пример #5
0
		private static void PersistToDataStore(GalleryServerPro.Business.Interfaces.IAppError appError)
		{
			if (appError.AppErrorId == int.MinValue)
			{
				SqlCommand cmd = GetCommandErrorInsert(appError);
				cmd.Connection.Open();
				cmd.ExecuteNonQuery();
				cmd.Connection.Close();

				int ID = Convert.ToInt32(cmd.Parameters["@Identity"].Value, System.Globalization.NumberFormatInfo.CurrentInfo);

				if (appError.AppErrorId != ID)
					appError.AppErrorId = ID;
			}
			else
			{
				throw new DataException("Cannot save a previously existing application error to the data store.");
			}
		}
Пример #6
0
		protected void wwDataBinder_AfterBindControl(GalleryServerPro.WebControls.wwDataBindingItem item)
		{
			// 
			if (item.ControlInstance == txtMaxErrorItems)
			{
				int maxErrorItems = Convert.ToInt32(this.txtMaxErrorItems.Text);
				if (maxErrorItems == 0)
				{
					// Disable the checkbox because feature is turned off (a "0" indicates it is off). Set textbox to
					// an empty string because we don't want to display 0.
					chkAutoTrimLog.Checked = false;
					txtMaxErrorItems.Text = String.Empty;
				}
				else if (maxErrorItems > 0)
					chkAutoTrimLog.Checked = true; // Select the checkbox when max # of items is > 0
				else
				{
					// We'll never get here because the config definition uses an IntegerValidator to force the number
					// to be greater than 0.
				}
			}
		}
Пример #7
0
		private static bool ValidatePathIsReadable(GalleryServerPro.WebControls.wwDataBindingItem item, string pathToTest, Label pathLabel)
		{
			// Verify that the IIS process identity has read permission to the specified path.
			bool isValid = false;

			string fullPhysicalPath = HelperFunctions.CalculateFullPath(AppSetting.Instance.PhysicalApplicationPath, pathToTest);
			try
			{
				HelperFunctions.ValidatePhysicalPathExistsAndIsReadable(fullPhysicalPath);
				isValid = true;
			}
			catch (GalleryServerPro.ErrorHandler.CustomExceptions.CannotReadFromDirectoryException ex)
			{
				item.BindingErrorMessage = ex.Message;
			}

			if (isValid)
			{
				pathLabel.Text = fullPhysicalPath;
				pathLabel.CssClass = "gsp_msgfriendly";
			}
			else
			{
				pathLabel.Text = String.Concat("<", Resources.GalleryServerPro.Admin_MediaObjects_InvalidPath, ">");
				pathLabel.CssClass = "gsp_msgwarning";
			}

			return isValid;
		}
Пример #8
0
		protected bool wwDataBinder_ValidateControl(GalleryServerPro.WebControls.wwDataBindingItem item)
		{
			if (item.ControlInstance == txtMaxErrorItems)
			{
				if ((chkAutoTrimLog.Checked) && (Convert.ToInt32(txtMaxErrorItems.Text) <= 0))
				{
					item.BindingErrorMessage = Resources.GalleryServerPro.Admin_Error_Invalid_MaxNumberErrorItems_Msg;
					return false;
				}
			}

			return true;
		}
Пример #9
0
		protected void wwDataBinder_AfterBindControl(GalleryServerPro.WebControls.wwDataBindingItem item)
		{
			// We need to HTML decode the role name that appears in the combo box
			if (item.ControlId == cboUserRoles.ID)
			{
				cboUserRoles.Text = Util.HtmlDecode(cboUserRoles.Text);
			}
		}
Пример #10
0
 /// <summary>
 /// Handles the OnValidateControl event of the wwDataBinder control.
 /// </summary>
 /// <param name="item">The wwDataBindingItem item.</param>
 /// <returns>Returns <c>true</c> if the item is valid; otherwise returns <c>false</c>.</returns>
 protected bool wwDataBinder_ValidateControl(GalleryServerPro.WebControls.wwDataBindingItem item)
 {
     // Validate various settings to make sure they don't conflict with each other.
     return true;
 }
        /// <summary>
        /// Handles the OnBeforeUnBindControl event of the wwDataBinder control.
        /// </summary>
        /// <param name="item">The wwDataBindingItem item.</param>
        protected bool wwDataBinder_BeforeUnbindControl(GalleryServerPro.WebControls.wwDataBindingItem item)
        {
            // When auto trim is disabled, we store "0" in the config file.
            if (item.ControlId == chkAutoTrimLog.ID)
            {
                if (!chkAutoTrimLog.Checked)
                {
                    txtMaxErrorItems.Text = "0";
                }
            }

            if (item.ControlId == txtJQueryScriptPath.ID)
            {
                string url = txtJQueryScriptPath.Text.Trim();

                if (!String.IsNullOrEmpty(url) && !Utils.IsAbsoluteUrl(url) && (!url.StartsWith("~", StringComparison.Ordinal)))
                {
                    url = String.Concat("~", url); // Ensure relative URLs start with "~"
                }

                txtJQueryScriptPath.Text = url;
            }

            if (item.ControlId == txtJQueryUiScriptPath.ID)
            {
                string url = txtJQueryUiScriptPath.Text.Trim();

                if (!String.IsNullOrEmpty(url) && !Utils.IsAbsoluteUrl(url) && (!url.StartsWith("~", StringComparison.Ordinal)))
                {
                    url = String.Concat("~", url); // Ensure relative URLs start with "~"
                }

                txtJQueryUiScriptPath.Text = url;
            }

            return true;
        }
        /// <summary>
        /// Handles the OnValidateControl event of the wwDataBinder control.
        /// </summary>
        /// <param name="item">The wwDataBindingItem item.</param>
        /// <returns>Returns <c>true</c> if the item is valid; otherwise returns <c>false</c>.</returns>
        protected bool wwDataBinder_ValidateControl(GalleryServerPro.WebControls.wwDataBindingItem item)
        {
            if (item.ControlInstance == txtMaxErrorItems)
            {
                if ((chkAutoTrimLog.Checked) && (Convert.ToInt32(txtMaxErrorItems.Text, CultureInfo.InvariantCulture) <= 0))
                {
                    item.BindingErrorMessage = Resources.GalleryServerPro.Admin_Error_Invalid_MaxNumberErrorItems_Msg;
                    return false;
                }
            }

            if (item.ControlInstance == txtJQueryScriptPath)
            {
                if (!ValidateUrl(txtJQueryScriptPath.Text.Trim()))
                {
                    item.BindingErrorMessage = Resources.GalleryServerPro.Admin_Site_Settings_InvalidJQueryPath;
                    return false;
                }
            }

            if (item.ControlInstance == txtJQueryUiScriptPath)
            {
                if (!ValidateUrl(txtJQueryUiScriptPath.Text.Trim()))
                {
                    item.BindingErrorMessage = Resources.GalleryServerPro.Admin_Site_Settings_InvalidJQueryPath;
                    return false;
                }
            }

            return true;
        }
Пример #13
0
		protected bool wwDataBinder_ValidateControl(GalleryServerPro.WebControls.wwDataBindingItem item)
		{
			if (item.ControlInstance == txtPageSize)
			{
				if ((chkEnablePaging.Checked) && (Convert.ToInt32(txtPageSize.Text) <= 0))
				{
					item.BindingErrorMessage = Resources.GalleryServerPro.Admin_Error_Invalid_PageSize_Msg;
					return false;
				}
			}

			return true;
		}
Пример #14
0
        /// <summary>
        /// Handles the OnValidateControl event of the wwDataBinder control.
        /// </summary>
        /// <param name="item">The wwDataBindingItem item.</param>
        /// <returns>Returns <c>true</c> if the item is valid; otherwise returns <c>false</c>.</returns>
        protected bool wwDataBinder_ValidateControl(GalleryServerPro.WebControls.wwDataBindingItem item)
        {
            if (item.ControlInstance == txtPageSize)
            {
                if ((chkEnablePaging.Checked) && (Convert.ToInt32(txtPageSize.Text, CultureInfo.CurrentCulture) <= 0))
                {
                    item.BindingErrorMessage = Resources.GalleryServerPro.Admin_Error_Invalid_PageSize_Msg;
                    return false;
                }
            }

            if (item.ControlInstance == txtRemoteAccessPassword)
            {
                if (chkEnableRemoteSync.Checked && String.IsNullOrEmpty(txtRemoteAccessPassword.Text))
                {
                    item.BindingErrorMessage = Resources.GalleryServerPro.Admin_Albums_RemoteAccessPassword_Required_Msg;
                    return false;
                }
            }

            return true;
        }
Пример #15
0
		private bool ValidatePathIsWriteable(GalleryServerPro.WebControls.wwDataBindingItem item, string pathToTest, Label pathLabel)
		{
			// Verify that the IIS process identity has write permission to the specified path.

			// We only need to execute this once for each unique path. If we already tested this path, then return that test result. This helps
			// prevent the same error message from being shown multiple times.
			if (_pathsThatHaveBeenTestedForWriteability.ContainsKey(pathToTest))
				return _pathsThatHaveBeenTestedForWriteability[pathToTest];

			bool isValid = false;

			string fullPhysicalPath = HelperFunctions.CalculateFullPath(AppSetting.Instance.PhysicalApplicationPath, pathToTest);
			try
			{
				HelperFunctions.ValidatePhysicalPathExistsAndIsReadWritable(fullPhysicalPath);
				isValid = true;
			}
			catch (GalleryServerPro.ErrorHandler.CustomExceptions.CannotWriteToDirectoryException ex)
			{
				item.BindingErrorMessage = ex.Message;
			}

			if (isValid)
			{
				pathLabel.Text = fullPhysicalPath;
				pathLabel.CssClass = "gsp_msgfriendly";
			}
			else
			{
				pathLabel.Text = String.Concat("&lt;", Resources.GalleryServerPro.Admin_MediaObjects_InvalidPath, "&gt;");
				pathLabel.CssClass = "gsp_msgwarning";
			}

			// Set the flag so we don't have to repeat the validation later in the page lifecycle.
			_pathsThatHaveBeenTestedForWriteability.Add(pathToTest, isValid);

			return isValid;
		}
Пример #16
0
        /// <summary>
        /// Handles the OnValidateControl event of the wwDataBinder control.
        /// </summary>
        /// <param name="item">The wwDataBindingItem item.</param>
        /// <returns>Returns <c>true</c> if the item is valid; otherwise returns <c>false</c>.</returns>
        protected bool wwDataBinder_ValidateControl(GalleryServerPro.WebControls.wwDataBindingItem item)
        {
            // Validate various settings to make sure they don't conflict with each other.

            if (item.ControlInstance == this.txtMoPath)
                return ValidateMediaObjectPath(item);

            else if (item.ControlInstance == this.txtThumbnailCachePath)
                return ValidateThumbnailPath(item);

            else if (item.ControlInstance == this.txtOptimizedCachePath)
                return ValidateOptimizedPath(item);

            else if (item.ControlInstance == this.chkPathIsReadOnly)
                return ValidateMediaObjectPath(item); // Validate the "media files are read-only" option

            return true;
        }
Пример #17
0
		private bool ValidatePath(GalleryServerPro.WebControls.wwDataBindingItem Item, string pathToTest, System.Web.UI.WebControls.Label pathLabel)
		{
			bool isValid = false;

			string fullPhysicalPath = HelperFunctions.CalculateFullPath(AppSetting.Instance.PhysicalApplicationPath, pathToTest);
			try
			{
				HelperFunctions.ValidatePhysicalPathExistsAndIsReadWritable(fullPhysicalPath);
				isValid = true;
			}
			catch (GalleryServerPro.ErrorHandler.CustomExceptions.InvalidMediaObjectDirectoryException)
			{
				string msg = String.Format(CultureInfo.CurrentCulture, "Invalid media object directory: Gallery Server Pro cannot find or does not have permission to access the media object path {0}. Verify that the setting corresponds to a valid directory and that the web application has read, write and modify permission to this location.", Server.HtmlEncode(fullPhysicalPath));
				Item.BindingErrorMessage = msg;
			}
			catch (GalleryServerPro.ErrorHandler.CustomExceptions.CannotWriteToDirectoryException ex)
			{
				Item.BindingErrorMessage = ex.Message;
			}

			if (isValid)
			{
				pathLabel.Text = fullPhysicalPath;
				pathLabel.CssClass = "msgfriendly";
			}
			else
			{
				pathLabel.Text = "&lt;Invalid path&gt;";
				pathLabel.CssClass = "msgwarning";
			}
			return isValid;
		}
        /// <summary>
        /// Throws an exception to indicate the .NET Framework is unable to load an image file into the System.Drawing.Bitmap 
        /// class. This is probably because it is corrupted, not an image supported by the .NET Framework, or the server does
        /// not have enough memory to process the image.
        /// </summary>
        /// <param name="mediaObject">The media object that contains the unsupported image file.</param>
        /// <param name="innerException">The exception that is the cause of the current exception. If the 
        /// innerException parameter is not a null reference, the current exception is raised in a catch
        /// block that handles the inner exception.</param>
        public UnsupportedImageTypeException(GalleryServerPro.Business.Interfaces.IGalleryObject mediaObject, Exception innerException)
            : base(String.Format(CultureInfo.CurrentCulture, Resources.UnsupportedImageType_Ex_Msg2, ((mediaObject != null) && (mediaObject.Original != null) ? mediaObject.Original.FileName : String.Empty)), innerException)
        {
            this._state.MediaObject = mediaObject;

            // In response to SerializeObjectState, we need to provide any state to serialize with the exception.  In this
            // case, since our state is already stored in an ISafeSerializationData implementation, we can just provide that.
            SerializeObjectState += (exception, eventArgs) => eventArgs.AddSerializedState(_state);
        }
Пример #19
0
		/// <summary>
		/// Throws an exception to indicate the .NET Framework is unable to load an image file into the System.Drawing.Bitmap 
		/// class. This is probably because it is corrupted, not an image supported by the .NET Framework, or the server does
		/// not have enough memory to process the image.
		/// </summary>
		/// <param name="mediaObject">The media object that contains the unsupported image file.</param>
		public UnsupportedImageTypeException(GalleryServerPro.Business.Interfaces.IGalleryObject mediaObject)
			: base(string.Format(CultureInfo.CurrentCulture, Resources.UnsupportedImageType_Ex_Msg2, ((mediaObject != null) && (mediaObject.Original != null) ? mediaObject.Original.FileName : String.Empty)))
		{
			this._mediaObject = mediaObject;
		}
Пример #20
0
        /// <summary>
        /// Verifies the currently logged-on user has permission to specify the <paramref name="mediaObjectPath"/> in this gallery. The
        /// path must not be used by any other galleries unless the user is a gallery admin for each of those galleries or a site
        /// admin. Returns <c>true</c> if the user has permission; otherwise returns <c>false</c>.
        /// </summary>
        /// <param name="item">The binding item representing the control being tested.</param>
        /// <param name="mediaObjectPath">The relative or full file path the user wishes to use to store media objects, whether they are
        /// the original media object files, thumbnails, or optimized image files. Relative paths should be relative
        /// to the root of the running application so that, when it is combined with physicalAppPath parameter, it creates a valid path.
        /// Examples: "C:\inetpub\wwwroot\galleryserverpro\myimages\", "C:/inetpub/wwwroot/galleryserverpro/myimages",
        /// "\myimages\", "\myimages", "myimages\", "myimages",	"/myimages/", "/myimages"</param>
        /// <returns>
        /// Returns <c>true</c> if the user has permission; otherwise returns <c>false</c>.
        /// </returns>
        private bool ValidateUserHasPermissionToSpecifyPath(GalleryServerPro.WebControls.wwDataBindingItem item, string mediaObjectPath)
        {
            if (UserCanAdministerSite)
                return true; // Site admins always have permission.

            if (!UserCanAdministerGallery)
                return false; // Must be at least a gallery admin. Kind of a redundant test but we include it for extra safety.

            string fullMediaObjectPath = HelperFunctions.CalculateFullPath(AppSetting.Instance.PhysicalApplicationPath, mediaObjectPath);

            bool isValid = true;

            // Get a list of galleries the current user is a gallery admin for.
            IGalleryCollection adminGalleries = UserController.GetGalleriesCurrentUserCanAdminister();

            // Iterate through each gallery and check to see if the path is used in it.
            foreach (IGallery gallery in Factory.LoadGalleries())
            {
                if (gallery.GalleryId == GalleryId)
                    continue; // No need to evaluate the current gallery

                IGallerySettings gallerySettings = Factory.LoadGallerySetting(gallery.GalleryId);

                if ((fullMediaObjectPath.Equals(gallerySettings.FullMediaObjectPath, StringComparison.OrdinalIgnoreCase))
                        || (fullMediaObjectPath.Equals(gallerySettings.FullThumbnailPath, StringComparison.OrdinalIgnoreCase))
                        || (fullMediaObjectPath.Equals(gallerySettings.FullOptimizedPath, StringComparison.OrdinalIgnoreCase)))
                {
                    // We found another gallery that is using this path. This is not valid unless the user is a gallery admin for it.
                    if (!adminGalleries.Contains(gallery))
                    {
                        isValid = false;
                        item.BindingErrorMessage = String.Format(CultureInfo.CurrentCulture, Resources.GalleryServerPro.Admin_MediaObjects_MO_Path_Used_By_Another_Gallery, mediaObjectPath);
                    }
                }
            }

            return isValid;
        }
Пример #21
0
        private bool ValidatePathIsWritable(GalleryServerPro.WebControls.wwDataBindingItem item, string fullPathToTest)
        {
            // Verify that the IIS process identity has write permission to the specified path.

            // We only need to execute this once for each unique path. If we already tested this path, then return that test result. This helps
            // prevent the same error message from being shown multiple times.
            if (_pathsThatHaveBeenTestedForWriteability.ContainsKey(fullPathToTest))
                return _pathsThatHaveBeenTestedForWriteability[fullPathToTest];

            bool isValid = false;

            try
            {
                HelperFunctions.ValidatePhysicalPathExistsAndIsReadWritable(fullPathToTest);
                isValid = true;
            }
            catch (GalleryServerPro.Events.CustomExceptions.CannotWriteToDirectoryException ex)
            {
                item.BindingErrorMessage = ex.Message;
            }

            // Set the flag so we don't have to repeat the validation later in the page lifecycle.
            _pathsThatHaveBeenTestedForWriteability.Add(fullPathToTest, isValid);

            return isValid;
        }
Пример #22
0
		private bool ValidateReadOnlyGallery(GalleryServerPro.WebControls.wwDataBindingItem item)
		{
			// When a gallery is read only, the following must be true:
			// 1. The thumbnail and optimized path must be different than the media object path.
			// 2. The SynchAlbumTitleAndDirectoryName setting must be false.
			// 3. User albums must be disabled.

			// We only need to execute this once on a postback. If we already ran it, then return our previous result. This helps
			// prevent the same error message from being shown multiple times.
			if (_validateReadOnlyGalleryHasExecuted)
				return _validateReadOnlyGalleryResult;

			bool isValid = true;

			string mediaObjectPath = this.txtMoPath.Text;
			string thumbnailPath = (String.IsNullOrEmpty(this.txtThumbnailCachePath.Text) ? mediaObjectPath : this.txtThumbnailCachePath.Text);
			string optimizedPath = (String.IsNullOrEmpty(this.txtOptimizedCachePath.Text) ? mediaObjectPath : this.txtOptimizedCachePath.Text);

			// 1. The thumbnail and optimized path must be different than the media object path.
			if ((mediaObjectPath.Equals(thumbnailPath, StringComparison.OrdinalIgnoreCase)) ||
				(mediaObjectPath.Equals(optimizedPath, StringComparison.OrdinalIgnoreCase)))
			{
				isValid = false;
				item.BindingErrorMessage = string.Format(CultureInfo.CurrentCulture, Resources.GalleryServerPro.Admin_MediaObjects_Cannot_Set_MO_Path_Read_Only_Cache_Location_Not_Set, mediaObjectPath, thumbnailPath, optimizedPath);
			}

			// 2. The SynchAlbumTitleAndDirectoryName setting must be false.
			if (chkSynchAlbumTitleAndDirectoryName.Checked)
			{
				isValid = false;
				item.BindingErrorMessage = Resources.GalleryServerPro.Admin_MediaObjects_Cannot_Set_MO_Path_Read_Only_Synch_Title_And_Directory_Enabled;
			}

			// 3. User albums must be disabled.
			if (Configuration.ConfigManager.GetGalleryServerProConfigSection().Core.EnableUserAlbum)
			{
				isValid = false;
				item.BindingErrorMessage = Resources.GalleryServerPro.Admin_MediaObjects_Cannot_Set_MO_Path_Read_Only_User_Albums_Enabled;
			}

			// Set the flag so we don't have to repeat the validation later in the page lifecycle.
			this._validateReadOnlyGalleryHasExecuted = true;
			this._validateReadOnlyGalleryResult = isValid;

			return isValid;
		}
Пример #23
0
        /// <summary>
        /// Handles the OnAfterBindControl event of the wwDataBinder control.
        /// </summary>
        /// <param name="item">The wwDataBindingItem item.</param>
        protected void wwDataBinder_AfterBindControl(GalleryServerPro.WebControls.wwDataBindingItem item)
        {
            if (item.ControlInstance == txtPageSize)
            {
                int pageSize = Convert.ToInt32(this.txtPageSize.Text, CultureInfo.CurrentCulture);
                if (pageSize == 0)
                {
                    // Disable the checkbox because feature is turned off (a "0" indicates it is off). Set textbox to
                    // an empty string because we don't want to display 0.
                    chkEnablePaging.Checked = false;
                    txtPageSize.Text = String.Empty;
                }
                else if (pageSize > 0)
                    chkEnablePaging.Checked = true; // Select the checkbox when max # of items is > 0
                else
                {
                    // We'll never get here because the config definition uses an IntegerValidator to force the number
                    // to be greater than 0.
                }
            }

            if (item.ControlInstance == lblLastAutoSync)
            {
                if (GallerySettings.LastAutoSync == DateTime.MinValue)
                {
                    lblLastAutoSync.Text = Resources.GalleryServerPro.Admin_Albums_LastAutoSync_Never_Lbl;
                }
            }
        }
Пример #24
0
 /// <summary>
 /// Handles the OnAfterBindControl event of the wwDataBinder control.
 /// </summary>
 /// <param name="item">The wwDataBindingItem item.</param>
 protected void wwDataBinder_AfterBindControl(GalleryServerPro.WebControls.wwDataBindingItem item)
 {
     // HTML encode the data
     if (item.ControlId == lblUserName.ID)
     {
         lblUserName.Text = Utils.HtmlEncode(lblUserName.Text);
     }
 }
Пример #25
0
        /// <summary>
        /// Handles the OnBeforeUnBindControl event of the wwDataBinder control.
        /// </summary>
        /// <param name="item">The wwDataBindingItem item.</param>
        protected bool wwDataBinder_BeforeUnbindControl(GalleryServerPro.WebControls.wwDataBindingItem item)
        {
            if (!this.chkEnablePaging.Checked)
            {
                // When paging is disabled, we store "0" in the config file.
                if (item.ControlId == this.txtPageSize.ID)
                {
                    txtPageSize.Text = "0";
                    return true; // true indicates that we want to save this setting
                }

                // Disabled HTML items are not posted during a postback, so we don't have accurate information about their states.
                // Look for the checkboxes that cause other controls to be disabled, and assign the value of the disabled control to their
                // database setting. This allows disabled controls to retain their original value if an admin later re-enables them.
                if (item.ControlId == this.ddlPagerLocation.ID)
                {
                    this.ddlPagerLocation.SelectedValue = GallerySettingsUpdateable.PagerLocation.ToString();
                    return false;
                }
            }

            if (!this.chkEnableAutoSync.Checked)
            {
                // When the auto-sync feature is unchecked, the interval textbox is disabled via javascript.
                if (item.ControlId == this.txtAutoSyncIntervalMinutes.ID)
                {
                    this.txtAutoSyncIntervalMinutes.Text = GallerySettings.AutoSyncIntervalMinutes.ToString(CultureInfo.CurrentCulture);
                    return false;
                }
            }

            if (!this.chkEnableRemoteSync.Checked)
            {
                // When the remote sync feature is unchecked, the remote access password textbox is disabled via javascript.
                if (item.ControlId == this.txtRemoteAccessPassword.ID)
                {
                    this.txtRemoteAccessPassword.Text = GallerySettings.RemoteAccessPassword;
                    return false;
                }
            }

            return true;
        }