// Methods /// <summary> /// Called when the version has added /// </summary> /// <param name="sender">The sender</param> /// <param name="args">The arguments</param> protected void OnVersionAdded(object sender, EventArgs args) { if (args != null) { if (Settings.GetBoolSetting("VersionManager.AutomaticCleanupEnabled", true)) { var item = Event.ExtractParameter(args, 0) as Item; if ((item != null) && VersionManager.IsItemUnderRoots(item)) { VersionManager.DeleteItemVersions(item); } } } }
protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.IsPostBack) { if (args.Result == "yes") { var str = new ListString(args.Parameters["item"]); foreach (string str2 in str) { Item item2 = VersionManager.GetItemFromStr(str2); if (item2 != null) { VersionManager.DeleteItemVersions(item2); Log.Audit(this, "Delete version from item {0}, language \"{1}\"", new[] { item2.Name, item2.Language.ToString() }); } } if (!this.isFromCE) { SheerResponse.SetLocation(string.Empty); } } } else { var str3 = new ListString(args.Parameters["item"]); if (str3.Count == 1) { string str4 = str3[0]; Item item = VersionManager.GetItemFromStr(str4); if (item == null) { SheerResponse.Alert("Item not found.", new string[0]); return; } SheerResponse.Confirm(Translate.Text("Are you sure you want to delete all obsolete versions of the \"{1}\" in \"{0}\" language? Only the latest {2} versions will be kept.", new object[] { item.Language.ToString(), item.Name, Settings.GetSetting("VersionManager.NumberOfVersionsToKeep") })); } else { SheerResponse.Confirm(Translate.Text("Are you sure you want to delete versions of these {0} items?", new object[] { str3.Count })); } args.WaitForPostBack(); } }