protected virtual void AdjustOptions(SitecoreIndexableItem item) { if (!string.IsNullOrEmpty(Site)) { var siteContext = SiteContext.GetSite(Site); if (siteContext == null) { throw new Exception($"Site {Site} cannot be reached"); } //we typically generate index on CM but site URLs in CM will not work for CD //replacing "targetHostName" is not good solution because it breaks PE in CM //"cdTargetHostName" site argument should solve that issue. Index uses it instead of targetHostName and PE continue using "targetHostName" var cmTargetHostName = siteContext.Properties["cdTargetHostName"]; if (!String.IsNullOrWhiteSpace(cmTargetHostName)) { var props = new Sitecore.Collections.StringDictionary(ToDictionary(siteContext.SiteInfo.Properties)); props["targetHostName"] = cmTargetHostName; var siteInfo = new SiteInfo(props); siteContext = new SiteContext(siteInfo); } UrlOptions.Site = siteContext; } }
public static StringDictionary GetDictionary(this IDictionaryField dict) { var stringDict = new StringDictionary(); if (!(dict is FieldType dictField)) { return(stringDict); } var nvl = (NameValueListField)dictField.InnerField; foreach (var key in nvl.NameValues.AllKeys) { stringDict.Add(key, nvl.NameValues[key]); } return(stringDict); }
public OpenIdConnectSiteInfo(StringDictionary properties) : base(properties) { }
/// <summary>Runs the specified args.</summary> /// <param name="args">The arguments.</param> protected void Run(ClientPipelineArgs args) { Assert.ArgumentNotNull((object)args, "args"); bool flag1 = args.IsPostBack; bool flag2 = args.Parameters["checkmodified"] == "1"; if (!this.CheckCommandValidity(Sitecore.Client.ContentDatabase.Items[args.Parameters["id"], Language.Parse(args.Parameters["language"]), Sitecore.Data.Version.Parse(args.Parameters["version"])], args.Parameters["commandid"])) { return; } if (flag2) { if (!flag1) { if (Context.ClientPage.Modified) { SheerResponse.CheckModified(true); args.WaitForPostBack(); return; } } else if (args.Result == "cancel") { return; } args.Parameters["checkmodified"] = (string)null; flag1 = false; } if (flag1 && args.Result == "cancel") { return; } Sitecore.Collections.StringDictionary commentFields = new Sitecore.Collections.StringDictionary(); bool flag3 = StringUtil.GetString(new string[1] { args.Parameters["ui"] }) != "1"; bool flag4 = StringUtil.GetString(new string[1] { args.Parameters["suppresscomment"] }) == "1"; string commandId = args.Parameters["commandid"]; string workflowId = args.Parameters["workflowid"]; ItemUri itemUri = new ItemUri(args.Parameters["id"], Language.Parse(args.Parameters["language"]), Sitecore.Data.Version.Parse(args.Parameters["version"]), Sitecore.Client.ContentDatabase); if (!flag1 && flag3 && !flag4) { ID result = ID.Null; ID.TryParse(commandId, out result); WorkflowUIHelper.DisplayCommentDialog(itemUri, result); args.WaitForPostBack(); } else { if (flag1) { if (args.Result == "null" || args.Result == "undefined") { return; } commentFields = WorkflowUIHelper.ExtractFieldsFromFieldEditor(args.Result); } var workflow = Context.ContentDatabase.WorkflowProvider.GetWorkflow(workflowId); var repository = new WorxboxItemsRepository(workflow); var item = Context.ContentDatabase.GetItem(itemUri.ItemID, itemUri.Language, itemUri.Version); var workflowState = workflow.GetState(item); var completionCallback = new Processor("Workflow completed callback", (object)this, "WorkflowCompleteCallback"); if (repository.IsWorxboxItem(workflowState, new DataUri(itemUri)) && repository.GetWorkflowCommandIDs().Any(x => x == ID.Parse(commandId))) { var items = repository.GetWorxboxItems( repository.GetWorxboxWorkflowStates(workflow) .First(x => x.WorkflowCommands.Any(y => y.CommandID == commandId)), item); foreach (var compositeItem in items) { WorkflowUIHelper.ExecuteCommand(compositeItem.Uri, workflowId, commandId, commentFields, () => { // NOP }); } } WorkflowUIHelper.ExecuteCommand(itemUri, workflowId, commandId, commentFields, () => { WorkflowCompleteCallback(null); }); } }
public FakeSiteContext(StringDictionary parameters) : base(SiteInfo.Create(parameters)) { }
public SiteInfoPropertiesBuilder(string siteName) { SiteInfoProperties = new StringDictionary(); WithSiteName(siteName); }
public WsFederatedSiteInfo(StringDictionary properties) : base(properties) { }
public OAuthSiteInfo(StringDictionary properties) : base(properties) { }
public LoginSiteInfo(StringDictionary properties) { Properties = properties; }