protected virtual void Render(HtmlTextWriter output, IDataView dataView, string filter, Item root, Item folder) { Assert.ArgumentNotNull(output, "output"); Assert.ArgumentNotNull(dataView, "dataView"); Assert.ArgumentNotNull(filter, "filter"); Assert.ArgumentNotNull(root, "root"); Assert.ArgumentNotNull(folder, "folder"); output.Write(string.Format("<div id=\"{0}\"", this.ID)); //double click custom event output.Write(string.Format(" onclick=\"javascript:return Sitecore.Treeview.onTreeClick(this,event);\" ondblclick=\"FieldSuite.Fields.Treelist.AddItem('{0}',event);", this.ParentId)); output.Write("\""); if (!string.IsNullOrEmpty(this.ContextMenu)) { output.Write(" oncontextmenu=\""); output.Write(AjaxScriptManager.GetEventReference(this.ContextMenu)); output.Write("\""); } if (this.AllowDragging) { output.Write( " onmousedown=\"javascript:return Sitecore.Treeview.onTreeDrag(this,event)\" onmousemove=\"javascript:return Sitecore.Treeview.onTreeDrag(this,event)\" ondragstart=\"javascript:return Sitecore.Treeview.onTreeDrag(this,event)\" ondragover=\"javascript:return Sitecore.Treeview.onTreeDrop(this,event)\" ondrop=\"javascript:return Sitecore.Treeview.onTreeDrop(this,event)\""); } output.Write(">"); output.Write("<input id=\""); output.Write(this.ID); output.Write("_Selected\" type=\"hidden\" value=\"" + folder.ID.ToShortID() + "\"/>"); output.Write("<input id=\""); output.Write(this.ID); output.Write("_Database\" type=\"hidden\" value=\"" + folder.Database.Name + "\"/>"); output.Write("<input id=\""); output.Write(this.ID); output.Write("_Parameters\" type=\"hidden\" value=\"" + this.GetParameters() + "\"/>"); output.Write("<input id=\""); output.Write(this.ID); output.Write("_ExcludedTemplatesForSelection\" type=\"hidden\" value=\"" + this.GetExcludedTemplates() + "\"/>"); output.Write("<input id=\""); output.Write(this.ID); output.Write("_IncludedTemplatesForSelection\" type=\"hidden\" value=\"" + this.GetIncludedTemplates() + "\"/>"); if (this.ShowRoot) { this.RenderNode(output, dataView, filter, root, root, folder); } else { ItemCollection children = dataView.GetChildren(root, string.Empty, true, 0, 0, this.GetFilter()); foreach (Item item in children) { this.RenderNode(output, dataView, filter, root, item, folder); } } output.Write("</div>"); }
private void Render(HtmlTextWriter output, IDataView dataView, string filter, Item root, Item folder) { Assert.ArgumentNotNull(output, "output"); Assert.ArgumentNotNull(dataView, "dataView"); Assert.ArgumentNotNull(filter, "filter"); Assert.ArgumentNotNull(root, "root"); Assert.ArgumentNotNull(folder, "folder"); output.Write("<div id=\""); output.Write(this.ID); output.Write("\" onclick=\"javascript:return Sitecore.Treeview.onTreeClick(this,event"); if (!string.IsNullOrEmpty(this.Click)) { output.Write(",'"); output.Write(StringUtil.EscapeQuote(this.Click)); output.Write("'"); } output.Write(")\""); if (!string.IsNullOrEmpty(this.DblClick)) { output.Write(" ondblclick=\""); output.Write(AjaxScriptManager.GetEventReference(this.DblClick)); output.Write("\""); } if (!string.IsNullOrEmpty(this.ContextMenu)) { output.Write(" oncontextmenu=\""); output.Write(AjaxScriptManager.GetEventReference(this.ContextMenu)); output.Write("\""); } if (this.AllowDragging) { output.Write(" onmousedown=\"javascript:return Sitecore.Treeview.onTreeDrag(this,event)\" onmousemove=\"javascript:return Sitecore.Treeview.onTreeDrag(this,event)\" ondragstart=\"javascript:return Sitecore.Treeview.onTreeDrag(this,event)\" ondragover=\"javascript:return Sitecore.Treeview.onTreeDrop(this,event)\" ondrop=\"javascript:return Sitecore.Treeview.onTreeDrop(this,event)\""); } output.Write(">"); output.Write("<input id=\""); output.Write(this.ID); string selectedVal = (this.SelectedIDs.Count > 0) ? StringUtil.Join(this.SelectedIDs, ",") : folder.ID.ToShortID().ToString(); output.Write("_Selected\" type=\"hidden\" value=\"" + selectedVal + "\" />"); output.Write("<input id=\""); output.Write(this.ID); output.Write("_Database\" type=\"hidden\" value=\"" + folder.Database.Name + "\" />"); output.Write("<input id=\""); output.Write(this.ID); output.Write("_Parameters\" type=\"hidden\" value=\"" + this.GetParameters() + "\" />"); if (!Sitecore.Data.ID.IsNullOrEmpty(this.EnabledItemsTemplateId)) { output.Write("<input id=\""); output.Write(this.ID); output.Write("_templateID\" type=\"hidden\" value=\"" + this.EnabledItemsTemplateId + "\"/>"); } if (this.ShowRoot) { this.RenderNode(output, dataView, filter, root, root, folder); } else { foreach (Item item in dataView.GetChildren(root, string.Empty, true, 0, 0, this.GetFilter())) { this.RenderNode(output, dataView, filter, root, item, folder); } } output.Write("</div>"); }