private bool MoveToTrash() { MoveToTrashEventArgs e = new MoveToTrashEventArgs(); FireBeforeMoveToTrash(e); if (!e.Cancel) { if (MediaItem != null) { ApplicationContext.Current.Services.MediaService.MoveToRecycleBin(MediaItem); } else { var media = ApplicationContext.Current.Services.MediaService.GetById(Id); ApplicationContext.Current.Services.MediaService.MoveToRecycleBin(media); } //Move((int)RecycleBin.RecycleBinType.Media); //TODO: Now that we've moved it to trash, we need to move the actual files so they are no longer accessible //from the original URL. FireAfterMoveToTrash(e); } return(!e.Cancel); }
/// <summary> /// Fires the after move to trash. /// </summary> /// <param name="e">The <see cref="umbraco.cms.businesslogic.MoveToTrashEventArgs"/> instance containing the event data.</param> protected virtual void FireAfterMoveToTrash(MoveToTrashEventArgs e) { if (AfterMoveToTrash != null) { AfterMoveToTrash(this, e); } }
/// <summary> /// Raises the <see cref="E:BeforeDelete"/> event. /// </summary> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected virtual void FireBeforeMoveToTrash(MoveToTrashEventArgs e) { if (BeforeMoveToTrash != null) { BeforeMoveToTrash(this, e); } }
private static void DocumentAfterMoveToTrash(Document sender, MoveToTrashEventArgs e) { if (sender.ContentType.Alias.StartsWith(Store.NodeAlias)) { var reg = new Regex(@"\s*"); var storeAlias = reg.Replace(sender.Text, ""); StoreHelper.UnInstallStore(storeAlias); } ClearCaches(sender); }
/// <summary>On event, after moving document to trash.</summary> protected void Document_AfterMoveToTrash(Document sender, MoveToTrashEventArgs e) { // Validate document have a relation and is trashed. if(sender.Relations.Length > 0) { foreach(var r in sender.Relations) { // Validate document is from "Main Site" sender and relation type. if(r.Parent.Id == sender.Id && r.RelType.Alias == "relateDocumentOnCopy") { // Get document from relation object. var doc = new Document(r.Child.Id); // Append log, audit trail. Log.Add(LogTypes.Delete, doc.ParentId, String.Format("Document (name:{0} id:{1}) related to document (name:{2} id:{3}) moved to trash.", r.Child.Text, r.Child.Id, sender.Text, sender.Id)); // Unpublish and move document (that is child related) to trash. doc.delete(); } } } }
/// <summary> /// Used internally to move the node to the recyle bin /// </summary> /// <returns>Returns true if the move was not cancelled</returns> private bool MoveToTrash() { MoveToTrashEventArgs e = new MoveToTrashEventArgs(); FireBeforeMoveToTrash(e); if (!e.Cancel) { Move((int)RecycleBin.RecycleBinType.Media); //TODO: Now that we've moved it to trash, we need to move the actual files so they are no longer accessible //from the original URL. FireAfterMoveToTrash(e); } return(!e.Cancel); }
/// <summary>On event, before moving document to trash.</summary> protected void Document_BeforeMoveToTrash(Document sender, MoveToTrashEventArgs e) { // Future implemetation, ask user for confirmation or give user options. throw new NotImplementedException(); }
/// <summary> /// Fires the after move to trash. /// </summary> /// <param name="e">The <see cref="umbraco.cms.businesslogic.MoveToTrashEventArgs"/> instance containing the event data.</param> protected virtual void FireAfterMoveToTrash(MoveToTrashEventArgs e) { if (AfterMoveToTrash != null) AfterMoveToTrash(this, e); }
/// <summary> /// Raises the <see cref="E:BeforeDelete"/> event. /// </summary> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected virtual void FireBeforeMoveToTrash(MoveToTrashEventArgs e) { if (BeforeMoveToTrash != null) BeforeMoveToTrash(this, e); }
private bool MoveToTrash() { MoveToTrashEventArgs e = new MoveToTrashEventArgs(); FireBeforeMoveToTrash(e); if (!e.Cancel) { umbraco.BusinessLogic.Actions.Action.RunActionHandlers(this, ActionDelete.Instance); UnPublish(); if (Content != null) { ApplicationContext.Current.Services.ContentService.MoveToRecycleBin(Content); } else { Content = ApplicationContext.Current.Services.ContentService.GetById(Id); ApplicationContext.Current.Services.ContentService.MoveToRecycleBin(Content); } FireAfterMoveToTrash(e); } return !e.Cancel; }
protected virtual void FireBeforeMoveToTrash(MoveToTrashEventArgs e);
protected void Document_AfterMoveToTrash(Document sender, MoveToTrashEventArgs e) { ClearCache(); }
protected virtual void FireAfterMoveToTrash(MoveToTrashEventArgs e);
private bool MoveToTrash() { MoveToTrashEventArgs e = new MoveToTrashEventArgs(); FireBeforeMoveToTrash(e); if (!e.Cancel) { UnPublish(); if (Content != null) { ApplicationContext.Current.Services.ContentService.MoveToRecycleBin(Content); } else { Content = ApplicationContext.Current.Services.ContentService.GetById(Id); ApplicationContext.Current.Services.ContentService.MoveToRecycleBin(Content); } FireAfterMoveToTrash(e); } return !e.Cancel; }
private bool MoveToTrash() { MoveToTrashEventArgs e = new MoveToTrashEventArgs(); FireBeforeMoveToTrash(e); if (!e.Cancel) { if (MediaItem != null) { ApplicationContext.Current.Services.MediaService.MoveToRecycleBin(MediaItem); } else { var media = ApplicationContext.Current.Services.MediaService.GetById(Id); ApplicationContext.Current.Services.MediaService.MoveToRecycleBin(media); } //Move((int)RecycleBin.RecycleBinType.Media); //TODO: Now that we've moved it to trash, we need to move the actual files so they are no longer accessible //from the original URL. FireAfterMoveToTrash(e); } return !e.Cancel; }
/// <summary> /// Used internally to move the node to the recyle bin /// </summary> /// <returns>Returns true if the move was not cancelled</returns> private bool MoveToTrash() { MoveToTrashEventArgs e = new MoveToTrashEventArgs(); FireBeforeMoveToTrash(e); if (!e.Cancel) { Move((int)RecycleBin.RecycleBinType.Media); //TODO: Now that we've moved it to trash, we need to move the actual files so they are no longer accessible //from the original URL. FireAfterMoveToTrash(e); } return !e.Cancel; }
/// <summary> /// Used internally to move the node to the recyle bin /// </summary> /// <returns>Returns true if the move was not cancelled</returns> private bool MoveToTrash() { MoveToTrashEventArgs e = new MoveToTrashEventArgs(); FireBeforeMoveToTrash(e); if (!e.Cancel) { umbraco.BusinessLogic.Actions.Action.RunActionHandlers(this, ActionDelete.Instance); UnPublish(); Move((int)RecycleBin.RecycleBinType.Content); FireAfterMoveToTrash(e); } return !e.Cancel; }