Exemplo n.º 1
0
        /// <summary>
        /// Registers the client scripts.
        /// </summary>
        protected virtual void RegisterClientScripts()
        {
            this.DisableSubstateAnimation = true;

            this.stateDropDownList.Attributes["onchange"] = string.Format("var s=$('#{0}');if(s.length!=0)s.toggle('slide',{{direction:'up'}},300,function(){{{1}}});else {1};", this.SubstateContainer.ClientID, this.Page.ClientScript.GetPostBackEventReference(this.StateDropDownList, string.Empty));
            ScriptManagerExtensions.RegisterStartupScript(ScriptManager.GetCurrent(this.Page), string.Format(this.DisableSubstateAnimation ? "$('#{0}').show()" : "$('#{0}').toggle('slide',{{direction:'up'}},300)", this.SubstateContainer.ClientID), this.SubstateContainer);
        }
        public static void OpenPageEditor(Page page, Item item, Language language = null)
        {
            string cookieValue = WebUtil.GetCookieValue("shell#lang", item.Language.Name);

            WebUtil.SetCookieValue("shell#lang", item.Language.Name);
            UrlString urlString = new UrlString(LinkManager.GetItemUrl(Context.Database.GetItem(ID.Parse(UiItemIds.IframeDialogPageGuid))));

            urlString.Parameters["size"] = "full";
            UrlHandle urlHandle = new UrlHandle();

            urlHandle["FrameSrc"] = GetPageEditorLink(item, language);
            urlHandle["PreventPeUnloadMessage"] = true.ToString((IFormatProvider)CultureInfo.InvariantCulture);
            urlHandle.Add(urlString);
            string result;

            ScriptManager.GetCurrent(page).ShowPopup(HttpUtility.UrlPathEncode(urlString.ToString()), out result);
            if (!string.IsNullOrEmpty(result))
            {
                //EnumerableExtensions.ForEach<MessageBody>(ControlCollectionExtensions.Flatten<MessageBody>(page.Controls), (System.Action<MessageBody>)(mb => mb.Refresh()));
                ScriptManagerExtensions.RegisterStartupScript(ScriptManager.GetCurrent(page), "$('.collapsible input:visible').focus().blur();", (Control)null);
            }
            WebUtil.SetCookieValue("shell#lang", cookieValue);
        }