예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string url = QueryHelper.GetString("splitUrl", null);

        if (!string.IsNullOrEmpty(url) && CMSContext.DisplaySplitMode)
        {
            // Register script files
            ltlScript.Text += ScriptHelper.GetIncludeScript("~/CMSModules/Content/CMSDesk/SplitView.js");

            // Decode url
            url = HttpUtility.UrlDecode(url);

            // Update view mode
            UpdateViewMode(CMSContext.ViewMode);

            // Set frame1 url
            docSplitView.Frame1Url = url;

            // Get the URL of the other frame
            NameValueCollection param = new NameValueCollection();
            param.Add("culture", CMSContext.SplitModeCultureCode);

            // Set frame2 url
            docSplitView.Frame2Url = VirtualContext.GetVirtualContextPath(url, param);

            // Set script prefix
            param.Set("culture", "##c##");
            string scriptPrefix = VirtualContext.GetVirtualContextPrefix(param);

            StringBuilder script = new StringBuilder();
            script.Append(
                @"function InitSplitViewSyncScroll(frameElement, body, refreshSameCulture, unbind) {
  if (InitSyncScroll) {
    InitSyncScroll(frameElement, body, refreshSameCulture, unbind);
  }
}
function SplitModeRefreshFrame() {
    if (FSP_SplitModeRefreshFrame) {
        FSP_SplitModeRefreshFrame();
    }
}
var FSP_appPref = '", URLHelper.GetFullApplicationUrl(), @"';
var FSP_cntPref = '", scriptPrefix, "';");

            ScriptHelper.RegisterClientScriptBlock(Page, typeof(string), "splitViewSync_" + Page.ClientID, ScriptHelper.GetScript(script.ToString()));
        }
    }
예제 #2
0
    private List <HeaderAction> GetSitesAvailableForVirtualAccess()
    {
        List <HeaderAction> actions = new List <HeaderAction>();

        CacheHelper.Cache(() =>
        {
            var sitesData = SiteInfoProvider.GetSites()
                            .Columns("SiteName", "SiteDisplayName")
                            .OrderBy("SiteDisplayName")
                            .TypedResult;

            foreach (SiteInfo s in sitesData)
            {
                // Prepare the parameters
                NameValueCollection values = new NameValueCollection();
                values.Add(VirtualContext.PARAM_SITENAME, s.SiteName);

                HeaderAction site = new HeaderAction
                {
                    Text        = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(s.DisplayName)),
                    ButtonStyle = ButtonStyle.Default,
                    RedirectUrl = VirtualContext.GetVirtualContextPath(Request.Path, values),
                    Target      = "_blank"
                };

                actions.Add(site);
            }

            return(actions);
        },
                          new CacheSettings(60, "DevMenu", "Sites", "VirtualContext")
        {
            GetCacheDependency = () => CacheHelper.GetCacheDependency(new[]
            {
                SiteInfo.OBJECT_TYPE + "|all",
            })
        });

        return(actions);
    }
예제 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (SystemContext.DevelopmentMode)
        {
            // Restart application
            menu.AddAction(new HeaderAction
            {
                Text          = GetString("administration-system.btnrestart"),
                ButtonStyle   = ButtonStyle.Default,
                Tooltip       = GetString("administration-system.btnrestart"),
                OnClientClick = "function RestartPerformed() {return alert('" + GetString("administration-system.restartsuccess") + "');} if (confirm('" + GetString("system.restartconfirmation") + "')) {" + Page.ClientScript.GetCallbackEventReference(this, "'restart'", "RestartPerformed", String.Empty, true) + "}"
            });

            // Clear cache
            menu.AddAction(new HeaderAction
            {
                Text          = GetString("administration-system.btnclearcache"),
                ButtonStyle   = ButtonStyle.Default,
                Tooltip       = GetString("administration-system.btnclearcache"),
                OnClientClick = "function ClearCachePerformed() {return alert('" + GetString("administration-system.clearcachesuccess") + "');} if (confirm('" + GetString("system.clearcacheconfirmation") + "')) {" + Page.ClientScript.GetCallbackEventReference(this, "'clearcache'", "ClearCachePerformed", String.Empty, true) + "}"
            });

            // Event log
            HeaderAction eventLog = new HeaderAction
            {
                Text        = GetString("administration.ui.eventlog"),
                ButtonStyle = ButtonStyle.Default,
                Tooltip     = GetString("administration.ui.eventlog"),
                RedirectUrl = "~/CMSModules/EventLog/EventLog.aspx",
                Target      = "_blank"
            };

            // Event log items
            DataSet ds =
                EventLogProvider.GetEvents()
                .OrderByDescending("EventTime")
                .TopN(10)
                .Columns("EventTime", "EventType", "Source", "EventCode");

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                HeaderAction ev = new HeaderAction
                {
                    Text        = string.Format("{0} {1} {2} {3}", row["EventTime"], row["EventType"], row["Source"], row["EventCode"]),
                    ButtonStyle = ButtonStyle.Default
                };
                eventLog.AlternativeActions.Add(ev);
            }

            menu.AddAction(eventLog);

            // Debug
            menu.AddAction(new HeaderAction
            {
                Text        = GetString("Administration-System.Debug"),
                ButtonStyle = ButtonStyle.Default,
                Tooltip     = GetString("Administration-System.Debug"),
                RedirectUrl = URLHelper.AppendQuery(UIContextHelper.GetElementUrl(ModuleName.CMS, "Debug"), "displaytitle=true"),
                Target      = "_blank"
            });

            // Submit defect
            menu.AddAction(new HeaderAction
            {
                Text        = "Submit defect",
                ButtonStyle = ButtonStyle.Default,
                Tooltip     = "Submit defect",
                RedirectUrl = "https://kentico.atlassian.net/secure/CreateIssue!default.jspa",
                Target      = "_blank"
            });

            // Virtual site
            HeaderAction sites = new HeaderAction
            {
                Text        = GetString("devmenu.sites"),
                ButtonStyle = ButtonStyle.Default,
                Tooltip     = GetString("devmenu.sites"),
                Inactive    = true
            };

            // Site items
            var sitesDs = SiteInfoProvider.GetSites().Columns("SiteName", "SiteDisplayName").OrderBy("SiteDisplayName");

            foreach (SiteInfo s in sitesDs)
            {
                // Prepare the parameters
                NameValueCollection values = new NameValueCollection();
                values.Add(VirtualContext.PARAM_SITENAME, s.SiteName);

                HeaderAction site = new HeaderAction
                {
                    Text        = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(s.DisplayName)),
                    ButtonStyle = ButtonStyle.Default,
                    RedirectUrl = VirtualContext.GetVirtualContextPath(Request.Path, values),
                    Target      = "_blank"
                };

                sites.AlternativeActions.Add(site);
            }

            menu.AddAction(sites);
        }
        else
        {
            Visible = false;
        }
    }