protected override void OnInit(EventArgs e) { base.OnInit(e); contenttree.Values.AddRange(new[] { new UILayoutValue("NodeID", ResultNodeID), new UILayoutValue("ExpandNodeID", ExpandNodeID), new UILayoutValue("Culture", SelectedCulture) }); string contentUrl = "Product_List.aspx" + URLHelper.Url.Query; if (NodeID <= 0) { // Root string baseDoc = "/"; if (!string.IsNullOrEmpty(ProductsStartingPath)) { // Change to products root node baseDoc = ProductsStartingPath.TrimEnd('/'); } // Get the root node TreeNode rootNode = Tree.SelectSingleNode(CMSContext.CurrentSiteName, baseDoc, TreeProvider.ALL_CULTURES, false, null, false); if (rootNode != null) { string nodeString = rootNode.NodeID.ToString(); contentUrl = URLHelper.AddParameterToUrl(contentUrl, "nodeId", nodeString); } } contentview.Src = contentUrl; AddMenuButtonSelectScript("Products", string.Empty); ScriptHelper.RegisterScriptFile(Page, @"~/CMSModules/Content/CMSDesk/Content.js"); // Override content SetMode function, force editform mode when in edit mode AddScript(@" function SetMode(mode, passive) { if (!CheckChanges()) { return false; } if (mode == 'edit') mode = 'editform'; SetSelectedMode(mode); if (!passive) { DisplayDocument(); } return true; } "); }
protected override void OnInit(EventArgs e) { base.OnInit(e); string contentUrl = "Product_List.aspx" + RequestContext.CurrentQueryString; // Display product list if display tree of product sections is not allowed if (ECommerceSettings.ProductsTree(SiteContext.CurrentSiteID) == ProductsTreeModeEnum.None) { URLHelper.Redirect(URLHelper.ResolveUrl(contentUrl)); } contenttree.Values.AddRange(new[] { new UILayoutValue("NodeID", ResultNodeID), new UILayoutValue("ExpandNodeID", ExpandNodeID), new UILayoutValue("Culture", SelectedCulture) }); if (NodeID <= 0) { // Root string baseDoc = "/"; if (!string.IsNullOrEmpty(ProductsStartingPath)) { // Change to products root node baseDoc = ProductsStartingPath.TrimEnd('/'); } // Get the root node TreeNode rootNode = Tree.SelectSingleNode(SiteContext.CurrentSiteName, baseDoc, TreeProvider.ALL_CULTURES, false, null, false); if (rootNode != null) { string nodeString = rootNode.NodeID.ToString(); contentUrl = URLHelper.AddParameterToUrl(contentUrl, "nodeId", nodeString); // Set default live site URL in header link string liveURL = URLHelper.ResolveUrl(rootNode.RelativeURL) + "?viewmode=livesite"; ScriptHelper.RegisterStartupScript(this, typeof(string), "SetDefaultLiveSiteURL", ScriptHelper.GetScript("SetLiveSiteURL('" + liveURL + "');")); } } contentview.Src = contentUrl; ScriptHelper.RegisterScriptFile(Page, "~/CMSModules/Content/CMSDesk/Content.js"); // Override content functions AddScript( @" function SetMode(mode, passive) { if (!CheckChanges()) { return false; } SetSelectedMode(mode); if (!passive) { DisplayDocument(); } return true; } function DragOperation(nodeId, targetNodeId, operation) { window.PerformContentRedirect(null, 'drag', nodeId, '&action=' + operation + '&targetnodeid=' + targetNodeId + '&mode=productssection'); } "); }