/// <summary> /// Creates breadcrumbs array leading to specified node using given tree provider and starting at given starting path. /// </summary> /// <param name="node">Tree node to generate breadcrumbs for.</param> /// <param name="startingPath">Path where to start to generate.</param> protected virtual string[,] CreateBreadcrumbs(TreeNode node, string startingPath) { string[,] breadcrumbs = null; if (node != null) { const string columns = "NodeID, NodeAliasPath, NodeSiteID, NodeOwner, DocumentName, DocumentLastVersionName, DocumentMenuCaption, DocumentCulture, SiteName, ClassName, NodeACLID"; // Prepare the where condition string where = SqlHelperClass.AddWhereCondition(null, TreeProvider.GetNodesOnPathWhereCondition(node.NodeAliasPath, true, true)); DataSet ds = DocumentHelper.GetDocuments(CurrentSiteName, startingPath, TreeProvider.ALL_CULTURES, true, null, where, "NodeAliasPath ASC", -1, false, 0, columns, node.TreeProvider); ds = TreeSecurityProvider.FilterDataSetByPermissions(ds, NodePermissionsEnum.Read, CMSContext.CurrentUser); if (!DataHelper.DataSourceIsEmpty(ds)) { // Initialize resolver ContextResolver currentResolver = CMSContext.CurrentResolver.CreateContextChild(); currentResolver.EncodeResolvedValues = true; DataRow[] resolverData = new DataRow[1]; DataTable table = ds.Tables[0]; // Prepare breadcrumbs breadcrumbs = new string[table.Rows.Count + 1, 4]; int i = 0; foreach (DataRow dr in table.Rows) { // Add current datarow to the resolver resolverData[0] = dr; currentResolver.SourceData = resolverData; // Prepare the item name. Disable encoding. currentResolver.EncodeResolvedValues = false; string linkName = currentResolver.ResolveMacros(TreePathUtils.GetMenuCaption(ValidationHelper.GetString(dr["DocumentMenuCaption"], String.Empty), ValidationHelper.GetString(dr["DocumentName"], String.Empty))); currentResolver.EncodeResolvedValues = true; // Use site name for root node linkName = string.IsNullOrEmpty(linkName) ? CMSContext.CurrentSite.DisplayName : linkName; // Create breadcrumb breadcrumbs[i, 0] = HTMLHelper.HTMLEncode(linkName); breadcrumbs[i, 1] = "~/CMSModules/Ecommerce/Pages/Tools/Products/Product_List.aspx?nodeid=" + dr["NodeID"]; breadcrumbs[i, 3] = string.Format("EditDocument({0}); RefreshTree({0},{0});", dr["NodeID"]); // Increment index i++; } // Add 'properties' breadcrumb breadcrumbs[i, 0] = HTMLHelper.HTMLEncode(GetString((Action == "new") ? "com.productsection.new" : "com.productsection.properties")); breadcrumbs[i, 1] = ""; breadcrumbs[i, 2] = ""; } } return(breadcrumbs); }