private bool AddExternalHtmlContent() { string externalHtmlSource = txtExternalHtmlSource.Text.Trim(); if (!this.ValidateExternalHtmlSource(externalHtmlSource)) { return(false); } MimeTypeCategory mimeTypeCategory = MimeTypeCategory.Other; string mimeTypeCategoryString = ddlMediaTypes.SelectedValue; try { mimeTypeCategory = (MimeTypeCategory)Enum.Parse(typeof(MimeTypeCategory), mimeTypeCategoryString, true); } catch { } // Suppress any parse errors so that category remains the default value 'Other'. string title = txtTitle.Text.Trim(); if (String.IsNullOrEmpty(title)) { // If user didn't enter a title, use the media category (e.g. Video, Audio, Image, Other). title = mimeTypeCategory.ToString(); } IGalleryObject mediaObject = Factory.CreateExternalMediaObjectInstance(externalHtmlSource, mimeTypeCategory, this.GetAlbum()); mediaObject.Title = Utils.CleanHtmlTags(title, GalleryId); GalleryObjectController.SaveGalleryObject(mediaObject); HelperFunctions.PurgeCache(); return(true); }
/// <summary> /// Initializes a new instance of the <see cref="MimeType"/> class with the specified MIME type category. The <see cref="MajorType" /> property is /// assigned the string representation of the <paramref name="mimeType"/>. Remaining properties are set to empty strings or false /// (<see cref="AllowAddToGallery" />). This constructor is intended to be used to help describe an external media object, which is /// not represented by a locally stored file but for which it is useful to describe its general type (audio, video, etc). /// </summary> /// <param name="mimeType">Specifies the category to which this mime type belongs. This usually corresponds to the first portion of /// the full mime type description. (e.g. "image" if the full mime type is "image/jpeg").</param> private MimeType(MimeTypeCategory mimeType) { this._typeCategory = mimeType; this._majorType = mimeType.ToString(); this._extension = String.Empty; this._subtype = String.Empty; this._allowAddToGallery = false; this._browserMimeTypes = new Dictionary <string, string>(0); }
/// <summary> /// Initializes a new instance of the <see cref="MimeType"/> class with the specified MIME type category. The <see cref="MajorType" /> property is /// assigned the string representation of the <paramref name="mimeType"/>. Remaining properties are set to empty strings or false /// (<see cref="AllowAddToGallery" />). This constructor is intended to be used to help describe an external media object, which is /// not represented by a locally stored file but for which it is useful to describe its general type (audio, video, etc). /// </summary> /// <param name="mimeType">Specifies the category to which this mime type belongs. This usually corresponds to the first portion of /// the full mime type description. (e.g. "image" if the full mime type is "image/jpeg").</param> private MimeType(MimeTypeCategory mimeType) { this._galleryId = Int32.MinValue; this._typeCategory = mimeType; this._majorType = mimeType.ToString(); this._extension = String.Empty; this._subtype = String.Empty; this._browserMimeType = String.Empty; this._allowAddToGallery = false; }
/// <summary> /// Initializes a new instance of the <see cref="MimeType"/> class with the specified MIME type category. The <see cref="MajorType" /> property is /// assigned the string representation of the <paramref name="mimeType"/>. Remaining properties are set to empty strings or false /// (<see cref="AllowAddToGallery" />). This constructor is intended to be used to help describe an external media object, which is /// not represented by a locally stored file but for which it is useful to describe its general type (audio, video, etc). /// </summary> /// <param name="mimeType">Specifies the category to which this mime type belongs. This usually corresponds to the first portion of /// the full mime type description. (e.g. "image" if the full mime type is "image/jpeg").</param> private MimeType(MimeTypeCategory mimeType) { this._galleryId = Int32.MinValue; this._typeCategory = mimeType; this._majorType = mimeType.ToString(); this._extension = String.Empty; this._subtype = String.Empty; this._browserMimeType = String.Empty; this._allowAddToGallery = false; }
/// <summary> /// Initializes a new instance of the <see cref="MimeType"/> class with the specified MIME type category. The <see cref="MajorType" /> property is /// assigned the string representation of the <paramref name="mimeType"/>. Remaining properties are set to empty strings or false /// (<see cref="AllowAddToGallery" />). This constructor is intended to be used to help describe an external media object, which is /// not represented by a locally stored file but for which it is useful to describe its general type (audio, video, etc). /// </summary> /// <param name="mimeType">Specifies the category to which this mime type belongs. This usually corresponds to the first portion of /// the full mime type description. (e.g. "image" if the full mime type is "image/jpeg").</param> private MimeType(MimeTypeCategory mimeType) { this._typeCategory = mimeType; this._majorType = mimeType.ToString(); this._extension = String.Empty; this._subtype = String.Empty; this._allowAddToGallery = false; this._browserMimeTypes = new Dictionary<string, string>(0); }