コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public OpenIdConnectSiteInfo(StringDictionary properties)
     : base(properties)
 {
 }
コード例 #4
0
        /// <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);
                });
            }
        }
コード例 #5
0
 public FakeSiteContext(StringDictionary parameters)
   : base(SiteInfo.Create(parameters))
 {
 }
コード例 #6
0
 public FakeSiteContext(StringDictionary parameters)
     : base(SiteInfo.Create(parameters))
 {
 }
コード例 #7
0
 public SiteInfoPropertiesBuilder(string siteName)
 {
     SiteInfoProperties = new StringDictionary();
     WithSiteName(siteName);
 }
コード例 #8
0
 public WsFederatedSiteInfo(StringDictionary properties)
     : base(properties)
 {
 }
コード例 #9
0
 public OAuthSiteInfo(StringDictionary properties)
     : base(properties)
 {
 }
コード例 #10
0
 public LoginSiteInfo(StringDictionary properties)
 {
     Properties = properties;
 }