示例#1
0
        /// <summary>
        /// Renders as dropdown.
        /// </summary>
        /// <param name="menu">The menu.</param>
        /// <param name="converter">The converter.</param>
        /// <returns></returns>
        public static string RenderAsDropdown(this reportLinkCollection menu, converterBase converter)
        {
            StringBuilder output = new StringBuilder();

            output.AppendLine(converter.GetContainerOpen(bootstrap_containers.dropdown_complete, bootstrap_color.basic, bootstrap_size.lg, menu.title, "#"));
            //output.AppendLine(converter.GetContent(bootstrap_component.dropdown_menuheadlink, bootstrap_color.basic, bootstrap_size.lg, menu.title));
            var Group = menu.GetGroupOfFirstLink();

            if (Group == null)
            {
                return("");
            }

            string currentGroup = Group.name;

            foreach (reportLink link in menu)
            {
                if (link.state != reportLinkState.pathIsUrl)
                {
                    throw new aceReportException("Link was not compiled!! compile links before rendering", aceReportExceptionType.executeScriptError);
                }
                if (link.group.name != currentGroup)
                {
                    output.AppendLine(converter.GetContent(bootstrap_component.dropdown_menuheader, bootstrap_color.basic, bootstrap_size.lg, currentGroup.imbTitleCamelOperation(true, false))); //. //.ToTitleCase(), "#"));
                    currentGroup = link.group.name;
                }
                output.AppendLine(converter.GetContent(bootstrap_component.dropdown_menuitem, bootstrap_color.basic, bootstrap_size.lg, link.linkTitle, link.linkPath));
            }

            output.AppendLine(converter.GetContainerClose(bootstrap_containers.dropdown_complete));
            string outstr = output.ToString();

            return(outstr);
        }
示例#2
0
        /// <summary>
        /// Renders as dropdown.
        /// </summary>
        /// <param name="menu">The menu.</param>
        /// <param name="converter">The converter.</param>
        /// <returns></returns>
        public static string RenderAsToolbar(this reportLinkCollection menu, converterBase converter, bootstrap_size size = bootstrap_size.unknown)
        {
            if (size == bootstrap_size.unknown)
            {
                if (menu is reportLinkToolbar)
                {
                    reportLinkToolbar menu_reportLinkToolbar = (reportLinkToolbar)menu;
                    size = menu_reportLinkToolbar.size;
                }
                else
                {
                    size = bootstrap_size.md;
                }
            }

            var Group = menu.GetGroupOfFirstLink();

            if (Group == null)
            {
                return("");
            }

            string currentGroup = Group.name;

            StringBuilder output = new StringBuilder();

            output.AppendLine(converter.GetContainerOpen(bootstrap_containers.buttontoolbar, bootstrap_color.primary, size, menu.title, "#"));

            output.AppendLine(converter.GetContainerOpen(bootstrap_containers.buttongroup, bootstrap_color.primary, size, currentGroup.imbTitleCamelOperation(), "#"));

            foreach (reportLink link in menu)
            {
                if (link.state != reportLinkState.pathIsUrl)
                {
                    throw new aceReportException("Link was not compiled!! compile links before rendering", aceReportExceptionType.executeScriptError);
                }
                if (link.group.name != currentGroup)
                {
                    output.AppendLine(converter.GetContainerClose(bootstrap_containers.buttongroup));
                    currentGroup = link.group.name;
                    output.AppendLine(converter.GetContainerOpen(bootstrap_containers.buttongroup, bootstrap_color.primary, size, currentGroup.imbTitleCamelOperation(), "#"));
                }
                output.AppendLine(converter.GetContent(bootstrap_component.button, link.importance.ConvertToBootstrapColor(), size, link.linkTitle, link.linkPath));
            }

            output.AppendLine(converter.GetContainerClose(bootstrap_containers.buttongroup));

            output.AppendLine(converter.GetContainerClose(bootstrap_containers.buttontoolbar));
            string outstr = output.ToString();

            return(outstr);
        }
示例#3
0
        /// <summary>
        /// Renders the set as drop downs.
        /// </summary>
        /// <param name="menu">The menu.</param>
        /// <param name="converter">The converter.</param>
        /// <returns></returns>
        public static string RenderSetAsDropDowns(this reportLinkCollectionSet menu, converterBase converter)
        {
            StringBuilder output = new StringBuilder();

            foreach (var pair in menu)
            {
                if (pair.Value.Count() > 0)
                {
                    output.AppendLine(pair.Value.RenderAsDropdown(converter));
                }
            }
            string outstr = output.ToString();

            return(outstr);
        }