private void ConfigureControls() { this.TaskHeaderText = Resources.GalleryServerPro.Task_Edit_Captions_Header_Text; this.TaskBodyText = Resources.GalleryServerPro.Task_Edit_Captions_Body_Text; this.OkButtonText = SueetieLocalizer.GetString("process_updates", "MediaGallery.xml"); this.OkButtonToolTip = Resources.GalleryServerPro.Task_Edit_Captions_Ok_Button_Tooltip; this.PageTitle = Resources.GalleryServerPro.Task_Edit_Captions_Page_Title; // Sueetie Modified - Converting GSP galleryObjects into SueetieGalleryObjects List <SueetieMediaObject> sueetieMediaObjects = new List <SueetieMediaObject>(); IGalleryObjectCollection albumChildren = this.GetAlbum().GetChildGalleryObjects(GalleryObjectType.MediaObject, true); foreach (IGalleryObject _galleryObject in albumChildren) { SueetieMediaObject _sueetieMediaObject = SueetieMedia.GetSueetieMediaObject(this.CurrentSueetieGalleryID, _galleryObject.Id); MediaHelper.PopulateMediaObject(_sueetieMediaObject, _galleryObject); sueetieMediaObjects.Add(_sueetieMediaObject); } if (albumChildren.Count > 0) { const int textareaWidthBuffer = 30; // Extra width padding to allow room for the caption. const int textareaHeightBuffer = 72; // Extra height padding to allow room for the caption. SetThumbnailCssStyle(albumChildren, textareaWidthBuffer, textareaHeightBuffer); rptr.DataSource = sueetieMediaObjects; rptr.DataBind(); } else { this.RedirectToAlbumViewPage("msg={0}", ((int)Message.CannotEditCaptionsNoEditableObjectsExistInAlbum).ToString(CultureInfo.InvariantCulture)); } }
/// <summary> /// Displays thumbnail versions of the specified <paramref name="galleryObjects"/>. /// </summary> /// <param name="galleryObjects">The gallery objects to display.</param> /// <param name="showAddObjectsLink">If set to <c>true</c> show a message and a link allowing the user to add objects to the /// current album as specified in the query string. Set to false when displaying objects that may belong to more than one /// album.</param> private void DisplayThumbnails(IGalleryObjectCollection galleryObjects, bool showAddObjectsLink) { string msg; if (galleryObjects.Count > 0) { // At least one album or media object in album. //msg = String.Format(CultureInfo.CurrentCulture, "<p class='gsp_addtopmargin2'>{0}</p>", Resources.GalleryServerPro.UC_ThumbnailView_Intro_Text_With_Objects); //phMsg.Controls.Add(new LiteralControl(msg)); } else if ((showAddObjectsLink) && (this.GalleryPage.UserCanAddMediaObject) && (!this.GalleryPage.GallerySettings.MediaObjectPathIsReadOnly)) { // We have no objects to display. The user is authorized to add objects to this album and the gallery is writeable, so show // message and link to add objects page. string innerMsg = String.Format(CultureInfo.CurrentCulture, Resources.GalleryServerPro.UC_ThumbnailView_Intro_Text_No_Objects_User_Has_Add_MediaObject_Permission, Util.GetUrl(PageId.task_addobjects, "aid={0}", this.GalleryPage.GetAlbumId())); msg = String.Format(CultureInfo.CurrentCulture, "<p class='gsp_addtopmargin2 gsp_msgfriendly'>{0}</p>", innerMsg); phMsg.Controls.Add(new LiteralControl(msg)); } else { // No objects and/or user doesn't have permission to add media objects. msg = String.Format(CultureInfo.CurrentCulture, "<p class='gsp_addtopmargin2 gsp_msgfriendly'>{0}</p>", Resources.GalleryServerPro.UC_ThumbnailView_Intro_Text_No_Objects); phMsg.Controls.Add(new LiteralControl(msg)); } this.GalleryPage.SetThumbnailCssStyle(galleryObjects); // Sueetie Modified - Converting GSP galleryObjects into SueetieGalleryObjects SueetieConfiguration config = SueetieConfiguration.Get(); List <SueetieMediaObject> sueetieMediaObjects = new List <SueetieMediaObject>(); foreach (IGalleryObject _galleryObject in galleryObjects) { if (_galleryObject is Album) { SueetieMediaAlbum _album = SueetieMedia.GetSueetieMediaAlbum(CurrentSueetieGalleryID, _galleryObject.Id); sueetieMediaObjects.Insert(0, new SueetieMediaObject { MediaObjectID = _galleryObject.Id, MediaObjectTitle = _galleryObject.Title, AlbumID = _galleryObject.Id, IsAlbum = true, MediaObjectUrl = String.Concat(Util.GetUrl(PageId.album, "aid={0}", _galleryObject.Id)), MediaObjectDescription = _album.AlbumDescription, DisplayName = _album.DisplayName, ThumbnailHeight = config.Media.ThumbnailHeight, ThumbnailWidth = config.Media.ThumbnailWidth, DateTimeCreated = _album.DateTimeCreated, SueetieUserID = _album.SueetieUserID }); } else { SueetieMediaObject _sueetieMediaObject = SueetieMedia.GetSueetieMediaObject(this.CurrentSueetieGalleryID, _galleryObject.Id); MediaHelper.PopulateMediaObject(_sueetieMediaObject, _galleryObject); _sueetieMediaObject.MediaObjectUrl = GenerateUrl(_galleryObject); sueetieMediaObjects.Add(_sueetieMediaObject); } } if (PagingEnabled) { rptr.DataSource = CreatePaging(sueetieMediaObjects); RegisterPagingScript(); } else { rptr.DataSource = sueetieMediaObjects; } rptr.DataBind(); }
private Message saveCaptions() { // Iterate through all the textboxes, saving any captions that have changed. // The media object IDs are stored in a hidden input tag. HtmlInputText ta; HtmlTextArea tdesc; HtmlInputHidden gc; IGalleryObject mo; string newTitle, previousTitle, previousTags, previousDescription; Message msg = Message.None; if (!IsUserAuthorized(SecurityActions.EditMediaObject)) { return(msg); } try { HelperFunctions.BeginTransaction(); // Loop through each item in the repeater control. If an item is checked, extract the ID. foreach (RepeaterItem rptrItem in rptr.Items) { ta = (HtmlInputText)rptrItem.Controls[1]; // The <input TEXT> tag tdesc = (HtmlTextArea)rptrItem.Controls[3]; // The <TEXTAREA> tag gc = (HtmlInputHidden)rptrItem.Controls[5]; // The hidden <input> tag // Retrieve new title. Since the Value property of <TEXTAREA> HTML ENCODEs the text, // and we want to store the actual text, we must decode to get back to the original. newTitle = Util.HtmlDecode(ta.Value); mo = Factory.LoadMediaObjectInstance(Convert.ToInt32(gc.Value, CultureInfo.InvariantCulture), true); previousTitle = mo.Title; mo.Title = Util.RemoveHtmlTags(newTitle); if (mo.Title != previousTitle) { GalleryObjectController.SaveGalleryObject(mo); } SueetieMediaObject _sueetieMediaObject = SueetieMedia.GetSueetieMediaObject(CurrentSueetieGalleryID, mo.Id); previousDescription = _sueetieMediaObject.MediaObjectDescription; _sueetieMediaObject.MediaObjectDescription = tdesc.Value; if (_sueetieMediaObject.MediaObjectTitle != newTitle || _sueetieMediaObject.MediaObjectDescription != previousDescription) { SueetieMedia.UpdateSueetieMediaObject(_sueetieMediaObject); } } HelperFunctions.CommitTransaction(); } catch { HelperFunctions.RollbackTransaction(); throw; } HelperFunctions.PurgeCache(); SueetieMedia.ClearSueetieMediaObjectListCache(CurrentSueetieGalleryID); return(msg); }
protected string GenerateUrl(IGalleryObject _galleryObject) { SueetieMediaObject sueetieMediaObject = SueetieMedia.GetSueetieMediaObject(CurrentSueetieGalleryID, _galleryObject.Id); return(GenerateUrl(sueetieMediaObject)); }