/// <summary>
        /// Gets the start marker.
        ///
        /// </summary>
        /// <param name="placeholderKey">The placeholder key.</param><param name="data">The data.</param><param name="selectable">if set to <c>true</c> [selectable].</param>
        /// <returns>
        /// The start marker.
        /// </returns>
        public static string GetStartMarker(string placeholderKey, ChromeData data, bool selectable)
        {
            Assert.ArgumentNotNull((object)placeholderKey, "placeholderKey");
            Assert.ArgumentNotNull((object)data, "data");
            StringBuilder stringBuilder = new StringBuilder();
            string        str           = Placeholder72.EscapeNonWordCharacters(placeholderKey);

            stringBuilder.AppendFormat("<code type='text/sitecore' chromeType='placeholder' kind='open' id='{0}' key='{1}' class='scpm' data-selectable='{2}'>", (object)str, (object)placeholderKey, (object)MainUtil.BoolToString(selectable));
            stringBuilder.Append(data.ToJson());
            stringBuilder.Append("</code>");
            return(((object)stringBuilder).ToString());
        }
        /// <summary>
        /// Renders the control start marker.
        ///
        /// </summary>
        /// <param name="controlId">The control id.</param><param name="data">The data.</param><param name="selectable">Defines wheter element is selectable in</param>
        /// <returns>
        /// HTML that precedes the control in page editing mode.
        ///
        /// </returns>
        public static string GetControlStartMarker(string controlId, ChromeData data, bool selectable)
        {
            Assert.ArgumentNotNull((object)controlId, "controlId");
            Assert.ArgumentNotNull((object)data, "data");
            StringBuilder stringBuilder = new StringBuilder();
            string        str1          = Placeholder72.SanitizeAttribute(data.DisplayName);
            string        str2          = data.ToJson();

            stringBuilder.Append(StringExtensions.FormatWith("<code type='text/sitecore' chromeType='rendering' kind='open' hintName='{0}' id='r_{1}' class='scpm' data-selectable='{2}'>", (object)str1, (object)controlId, (object)MainUtil.BoolToString(selectable)));
            stringBuilder.Append(str2);
            stringBuilder.Append("</code>");
            return(((object)stringBuilder).ToString());
        }
Exemplo n.º 3
0
        /// <summary>
        /// Starts the publisher.
        ///
        /// </summary>
        protected void StartPublisher()
        {
            Language[]  languages         = GetLanguages();
            List <Item> publishingTargets = GetPublishingTargets();

            Database[] publishingTargetDatabases = GetPublishingTargetDatabases();
            bool       incremental     = Context.ClientPage.ClientRequest.Form["PublishMode"] == "IncrementalPublish";
            bool       smart           = Context.ClientPage.ClientRequest.Form["PublishMode"] == "SmartPublish";
            bool       republish       = Context.ClientPage.ClientRequest.Form["PublishMode"] == "Republish";
            bool       rebuild         = this.Rebuild;
            bool       childrenChecked = this.PublishChildren.Checked;
            bool       relatedChecked  = this.PublishRelatedItems.Checked;

            if (rebuild)
            {
                Log.Audit(this, "Rebuild database, databases: {0}", new string[] { StringUtil.Join(publishingTargetDatabases, ", ") });
            }
            else
            {
                Log.Audit(this, "Publish, languages:{0}, targets:{1}, databases:{2}, incremental:{3}, smart:{4}, republish:{5}, children:{6}, related:{7}", StringUtil.Join(languages, ", "), StringUtil.Join(publishingTargets, ", ", "Name"), StringUtil.Join(publishingTargetDatabases, ", "), MainUtil.BoolToString(incremental), MainUtil.BoolToString(smart), MainUtil.BoolToString(republish), MainUtil.BoolToString(childrenChecked), MainUtil.BoolToString(relatedChecked));
            }
            var listString1 = new ListString();

            foreach (Language language in languages)
            {
                listString1.Add(language.ToString());
            }
            Registry.SetString("/Current_User/Publish/Languages", listString1.ToString());
            var listString2 = new ListString();

            foreach (Item obj in publishingTargets)
            {
                listString2.Add(obj.ID.ToString());
            }
            Registry.SetString("/Current_User/Publish/Targets", listString2.ToString());
            Registry.SetBool("/Current_User/Publish/IncrementalPublish", incremental);
            Registry.SetBool("/Current_User/Publish/SmartPublish", smart);
            Registry.SetBool("/Current_User/Publish/Republish", republish);
            Registry.SetBool("/Current_User/Publish/PublishChildren", childrenChecked);
            Registry.SetBool("/Current_User/Publish/PublishRelatedItems", relatedChecked);
            this.JobHandle = (string.IsNullOrEmpty(this.ItemID) ? (!incremental ? (!smart ? (!rebuild ? PublishManager.Republish(Sitecore.Client.ContentDatabase, publishingTargetDatabases, languages, Context.Language) : PublishManager.RebuildDatabase(Sitecore.Client.ContentDatabase, publishingTargetDatabases)) : PublishManager.PublishSmart(Sitecore.Client.ContentDatabase, publishingTargetDatabases, languages, Context.Language)) : PublishManager.PublishIncremental(Sitecore.Client.ContentDatabase, publishingTargetDatabases, languages, Context.Language)) : PublishManager.PublishItem(Sitecore.Client.GetItemNotNull(this.ItemID), publishingTargetDatabases, languages, childrenChecked, smart, relatedChecked)).ToString();
            SheerResponse.Timer("CheckStatus", Settings.Publishing.PublishDialogPollingInterval);
        }