예제 #1
0
        internal static ILinkBuilder BuildLink(NodeAdapter adapter, ContentItem item, bool selected, string target)
        {
            INode  node      = item;
            string className = node.ClassNames;

            if (selected)
            {
                className += "selected ";
            }

            ILinkBuilder builder = Link.To(node)
                                   .Target(target)
                                   .Class(className)
                                   .Href(adapter.GetPreviewUrl(item))
                                   .Text("<img src='" + adapter.GetIconUrl(item) + "'/>" + node.Contents)
                                   .Attribute("id", item.Path.Replace('/', '_'))
                                   .Attribute("title", "#" + item.ID + ": " + N2.Context.Current.Definitions.GetDefinition(item).Title)
                                   .Attribute("data-id", item.ID.ToString())
                                   .Attribute("data-type", item.GetContentType().Name)
                                   .Attribute("data-path", item.Path)
                                   .Attribute("data-url", item.Url)
                                   .Attribute("data-page", item.IsPage.ToString().ToLower())
                                   .Attribute("data-zone", item.ZoneName)
                                   .Attribute("data-permission", adapter.GetMaximumPermission(item).ToString());

            builder.Href(adapter.GetPreviewUrl(item));

            return(builder);
        }
예제 #2
0
        internal static ILinkBuilder BuildLink(NodeAdapter adapter, ContentItem item, bool isSelected, string target, bool isSelectable)
        {
            var    node      = adapter.GetTreeNode(item);
            string className = node.CssClass;

            if (isSelected)
            {
                className += " selected";
            }
            if (isSelectable)
            {
                className += " selectable";
            }
            else
            {
                className += " unselectable";
            }

            StringBuilder text = new StringBuilder();

            text.AppendFormat("<img src='{0}' alt='icon'/>", node.IconUrl);
            text.Append(node.Title);
            foreach (var mi in node.MetaInforation)
            {
                text.AppendFormat(" <span class='meta {0}' title='{1}'>{2}</span>", mi.Name, mi.ToolTip, mi.Text);
            }

            var builder = new Link(text.ToString(), node.ToolTip, node.Target ?? target, node.PreviewUrl, className)
                          .Attribute("id", item.Path.Replace('/', '_'))
                          .Attribute("data-id", item.ID.ToString())
                          .Attribute("data-type", item.GetContentType().Name)
                          .Attribute("data-path", item.Path)
                          .Attribute("data-url", item.Url)
                          .Attribute("data-page", item.IsPage.ToString().ToLower())
                          .Attribute("data-zone", item.ZoneName)
                          .Attribute("data-permission", node.MaximumPermission.ToString());

            if (isSelected)
            {
                builder.Attribute("data-selected", "true");
            }
            if (isSelectable)
            {
                builder.Attribute("data-selectable", "true");
            }

            builder.Href(adapter.GetPreviewUrl(item));

            return(builder);
        }
예제 #3
0
파일: Tree.cs 프로젝트: Jobu/n2cms
        internal static ILinkBuilder BuildLink(NodeAdapter adapter, ContentItem item, bool selected, string target)
        {
            INode node = item;
            string className = node.ClassNames;
            if (selected)
                className += "selected ";

            ILinkBuilder builder = Link.To(node)
                .Target(target)
                .Class(className)
                .Href(adapter.GetPreviewUrl(item))
                .Text("<img src='" + adapter.GetIconUrl(item) + "'/>" + node.Contents)
                .Attribute("id", item.Path.Replace('/', '_'))
                .Attribute("title", "#" + item.ID + ": " + N2.Context.Current.Definitions.GetDefinition(item).Title)
                .Attribute("data-id", item.ID.ToString())
                .Attribute("data-type", item.GetContentType().Name)
                .Attribute("data-path", item.Path)
                .Attribute("data-url", item.Url)
                .Attribute("data-page", item.IsPage.ToString().ToLower())
                .Attribute("data-zone", item.ZoneName)
                .Attribute("data-permission", adapter.GetMaximumPermission(item).ToString());

            builder.Href(adapter.GetPreviewUrl(item));

            return builder;
        }
예제 #4
0
파일: Tree.cs 프로젝트: spmason/n2cms
        internal static ILinkBuilder BuildLink(NodeAdapter adapter, ContentItem item, bool selected, string target)
        {
            INode node = item;
            string className = node.ClassNames;
            if (selected)
                className += "selected ";

            ILinkBuilder builder = Link.To(node)
                .Target(target)
                .Class(className)
                .Href(adapter.GetPreviewUrl(item))
                .Text("<img src='" + adapter.GetIconUrl(item) + "'/>" + node.Contents)
                .Attribute("rel", node.Path)
                .Attribute("data-id", item.ID.ToString())
                .Attribute("data-type", item.GetContentType().Name)
                .Attribute("data-path", item.Path)
                .Attribute("data-url", item.Url)
                .Attribute("data-page", item.IsPage.ToString().ToLower())
                .Attribute("data-zone", item.ZoneName);

            builder.Href(adapter.GetPreviewUrl(item));

            return builder;
        }