Пример #1
0
    /// <summary>
    /// Init event handler.
    /// </summary>
    protected override void OnInit(EventArgs e)
    {
        ucUIToolbar.ModuleName  = MODULE_NAME;
        ucUIToolbar.ElementName = ELEMENT_NAME;

        // Set the viewmode according the the URL param
        if (ViewMode.IsLiveSite() && QueryHelper.Contains("viewmode"))
        {
            ViewModeEnum queryStringViewMode = ViewModeCode.GetPageEnumFromString(QueryHelper.GetString("viewmode", "livesite"));
            if (queryStringViewMode.IsEditLive())
            {
                SetViewMode(queryStringViewMode);
            }
        }

        if (ViewMode.IsEditLive())
        {
            // Check if there is required a redirect to the specific document
            if (QueryHelper.Contains("onsitenodeid"))
            {
                int          nodeId       = QueryHelper.GetInteger("onsitenodeid", 0);
                TreeProvider treeProvider = new TreeProvider();
                TreeNode     node         = treeProvider.SelectSingleNode(nodeId);
                string       url          = URLHelper.ResolveUrl(DocumentURLProvider.GetUrl(node.NodeAliasPath, string.Empty /* ensure getting the link (not the linked document) */, node.NodeSiteName, RequestContext.CurrentURLLangPrefix));
                URLHelper.Redirect(url);
            }
        }

        base.OnInit(e);
    }
    /// <summary>
    /// Init event handler.
    /// </summary>
    protected override void OnInit(EventArgs e)
    {
        ucUIToolbar.ModuleName  = MODULE_NAME;
        ucUIToolbar.ElementName = ELEMENT_NAME;

        // Set the viewmode according the the URL param
        if (ViewMode.IsLiveSite() && QueryHelper.Contains("viewmode"))
        {
            ViewModeEnum queryStringViewMode = ViewModeCode.GetPageEnumFromString(QueryHelper.GetString("viewmode", "livesite"));
            if (queryStringViewMode.IsEditLive())
            {
                SetViewMode(queryStringViewMode);
            }
        }

        if (ViewMode.IsEditLive())
        {
            // Check if there is required a redirect to the specific document
            if (QueryHelper.Contains("onsitenodeid"))
            {
                var nodeId       = QueryHelper.GetInteger("onsitenodeid", 0);
                var treeProvider = new TreeProvider();
                var node         = treeProvider.SelectSingleNode(nodeId);
                var url          = UrlResolver.ResolveUrl(DocumentURLProvider.GetUrl(node));
                URLHelper.Redirect(url);
            }
        }

        base.OnInit(e);
    }