// Methods public new void Execute(CopyItemsArgs args) { Event.RaiseEvent("item:bucketing:cloning", args, this); Assert.ArgumentNotNull(args, "args"); var items = GetItems(args); if (args.IsNotNull()) { var itemId = args.Parameters["destination"]; if (itemId.IsNotNull()) { var database = GetDatabase(args); if (database.GetItem(itemId).IsBucketItemCheck()) { var list = new ArrayList(); foreach (var item3 in from item2 in items where item2.IsNotNull() let item = BucketManager.CreateAndReturnDateFolderDestination(database.GetItem(itemId), item2) let copyOfName = ItemUtil.GetCopyOfName(item, item2.Name) select item2.CloneTo(item, copyOfName, true)) { list.Add(item3); } args.Copies = list.ToArray(typeof(Item)) as Item[]; Event.RaiseEvent("item:bucketing:cloned", args, this); args.AbortPipeline(); } } } }
public void Process([NotNull] CopyItemsArgs args) { Assert.ArgumentNotNull(args, "args"); var parameters = args.Parameters; Assert.IsNotNull(parameters, "parameters"); if (!string.Equals(parameters["mode"], "smart", StringComparison.OrdinalIgnoreCase)) { return; } var copies = args.Copies; Assert.IsNotNull(copies, "copies"); var sources = GetItems(args).ToArray(); for (var i = 0; i < copies.Length; i++) { var copy = copies[i]; var source = sources[i]; Helper.ReplaceItemReferences(source, copy, true, isAsync); } // if mode is smart then this should be the last processor args.AbortPipeline(); }
public void CheckLanguage(CopyItemsArgs args) { Assert.ArgumentNotNull(args, "args"); if (args.IsPostBack) { if (args.Result != "yes") { args.AbortPipeline(); } } else { bool flag = false; foreach (Item item in GetSubItems(args)) { if (item.TemplateID == TemplateIDs.Language) { flag = true; break; } } if (flag) { SheerResponse.Confirm("You are coping a language.\n\nA language item must have a name that is a valid ISO-code.\n\nPlease rename the copied item afterward.\n\nAre you sure you want to continue?"); args.WaitForPostBack(); } } }
public void Process([NotNull] CopyItemsArgs args) { Assert.ArgumentNotNull(args, "args"); var parameters = args.Parameters; Assert.IsNotNull(parameters, "parameters"); if (!string.Equals(parameters["mode"], "smart", StringComparison.OrdinalIgnoreCase)) { return; } var copies = args.Copies; Assert.IsNotNull(copies, "copies"); foreach (var copy in copies) { if (this.isAsync) { ReferenceReplacementJob.StartAsync(copy.Source, copy); } else { ReferenceReplacementJob.Start(copy.Source, copy); } } // if mode is smart then this should be the last processor args.AbortPipeline(); }
public new void Execute(CopyItemsArgs args) { Event.RaiseEvent("item:bucketing:copying", args, this); Assert.ArgumentNotNull(args, "args"); var items = GetItems(args); Item currentItem = null; if (items[0].IsNotNull()) { currentItem = items[0]; } Error.AssertItem(items[0], "Item"); var database = GetDatabase(args); var topParent = database.GetItem(args.Parameters["destination"]); if (BucketManager.IsBucket(topParent)) { Shell.Applications.Dialogs.ProgressBoxes.ProgressBox.Execute("Copying Items", "Copying Items", Images.GetThemedImageSource("Business/16x16/chest_add.png"), this.StartProcess, new object[] { currentItem, BucketManager.CreateAndReturnDateFolderDestination(topParent, DateTime.Now), true }); if (currentItem.IsNotNull()) { Log.Info("Item " + currentItem.ID + " has been copied to another bucket", this); } Event.RaiseEvent("item:bucketing:copied", args, this); args.AbortPipeline(); } }
public void CheckPollCloneDestination(CopyItemsArgs args) { string str = args.Parameters[1]; if (!string.IsNullOrEmpty(str)) { Item item = Context.ContentDatabase.Items.GetItem(new ID(str)); if ((item != null) && (item.TemplateID == PollConstants.PollTemplateID)) { Context.ClientPage.ClientResponse.Alert("Can't clone DMS Poll items."); args.AbortPipeline(); } } }
public void CheckDestination(CopyItemsArgs args) { Assert.ArgumentNotNull(args, "args"); if (!args.HasResult) { args.AbortPipeline(); } else { Database database = GetDatabase(args); if (((args.Result != null) && (args.Result.Length > 0)) && (args.Result != "undefined")) { if (!database.GetItem(args.Result).Access.CanCreate()) { Context.ClientPage.ClientResponse.Alert("You do not have permission to create items here."); args.AbortPipeline(); return; } args.Parameters["destination"] = args.Result; } args.IsPostBack = false; } }