/// <summary>Executes the event.</summary> /// <param name="uploadedItems">The uploaded items.</param> protected void Done(string uploadedItems) { Assert.ArgumentNotNull((object)uploadedItems, "uploadedItems"); List <Item> items = new List <Item>(); string str = uploadedItems; char[] chArray = new char[1] { '|' }; foreach (string itemUri1 in new ListString(str.TrimEnd(chArray)).Items) { ItemUri itemUri2 = ItemUri.Parse(itemUri1); Assert.IsNotNull((object)itemUri2, "uploaded uri"); Database database = Factory.GetDatabase(itemUri2.DatabaseName); Assert.IsNotNull((object)database, "database"); Item obj = database.GetItem(itemUri2.ToDataUri()); if (obj != null) { items.Add(obj); } } UploadedItems.Set(items); SheerResponse.Eval("document.body.parentNode.removeChild(document.body);"); SheerResponse.Eval("scForm.getParentForm().postRequest('', '', '', 'item:refreshchildren(id=" + WebUtil.GetQueryString("id") + ")');"); SheerResponse.Eval("scForm.getParentForm().postRequest('', '', '', 'item:refresh');"); }
public bool StillExists(ItemUri uri) { Database db = Database.GetDatabase(uri.DatabaseName); Item foundItem = db.GetItem(uri.ToDataUri()); return foundItem != null; }
protected override void OnOK(object sender, EventArgs args) { DeviceDefinition device = Device; Assert.IsNotNull(device, "device"); MultivariateTestDefinitionItem testDefinition = TestingUtil.MultiVariateTesting.GetTestDefinition(device, new ID( RenderingUniqueId), Client. ContentDatabase); if (testDefinition == null) { ItemUri contextItemUri = ContextItemUri; if (contextItemUri == null) { return; } Item item = Client.ContentDatabase.GetItem(contextItemUri.ToDataUri()); if (item != null) { testDefinition = TestingUtil.MultiVariateTesting.AddTestDefinition(item); } } if (testDefinition == null) { SheerResponse.Alert("The action cannot be executed because of security restrictions.", new string[0]); } else if (Rendering != null) { MultivariateTestVariableItem variableItem = TestingUtil.MultiVariateTesting.GetVariableItem(Rendering, Client.ContentDatabase); if (variableItem == null) { variableItem = TestingUtil.MultiVariateTesting.AddVariable(testDefinition, Rendering, Client.ContentDatabase); } if (variableItem == null) { SheerResponse.Alert("The action cannot be executed because of security restrictions.", new string[0]); } else { List <ID> list; if (!UpdateVariableValues(variableItem, out list)) { SheerResponse.Alert("The action cannot be executed because of security restrictions.", new string[0]); } else { SheerResponse.SetDialogValue(SetTestDetailsOptions.GetDialogResut(variableItem.ID, list)); SheerResponse.CloseWindow(); } } } }
private static Item GetItemByUri(string uri) { ItemUri itemUri = ItemUri.Parse(uri); return(Sitecore.Configuration.Factory.GetDatabase(itemUri.DatabaseName).GetItem(itemUri.ToDataUri())); }