コード例 #1
0
        public static String getServiceTemplates( String filterString, String tpl, MvcContext ctx, IContentSectionTemplateService templateService )
        {
            String thumbPath = BinderUtils.GetBinderTemplateThumbPath();
            StringBuilder builder = new StringBuilder();
            builder.Append( "<table style=\"width: 100%\" cellpadding='5'><tr>" );

            List<ContentSectionTemplate> templates = templateService.GetBy( filterString );
            if (ctx.owner.obj is Site) {
                templates = TemplateUtil.addJson( templates );
            }

            int icount = 0;
            foreach (ContentSectionTemplate template in templates) {

                builder.AppendFormat( "<td style=\"vertical-align:top;\"><label for=\"template{0}\"><img src='{1}{2}.png' style='width:150px;height:100px;' /></label><br/>", template.Id, thumbPath, template.TemplateName );
                builder.AppendFormat( "<input name=\"templateId\" id=\"template{0}\" type=\"radio\" value=\"{0}\"", template.Id );
                if (tpl.Equals( template.TemplateName )) builder.Append( " checked " );
                builder.AppendFormat( "/><label for=\"template{0}\">{1}</label></td>", template.Id, template.Name );

                if ((icount % 4) == 3) builder.Append( "</tr><tr>" );

                icount++;
            }
            builder.Append( "</table>" );
            return builder.ToString();
        }
コード例 #2
0
        public static String getServiceTemplates(String filterString, String tpl, MvcContext ctx, IContentSectionTemplateService templateService)
        {
            String        thumbPath = BinderUtils.GetBinderTemplateThumbPath();
            StringBuilder builder   = new StringBuilder();

            builder.Append("<table style=\"width: 100%\" cellpadding='5'><tr>");

            List <ContentSectionTemplate> templates = templateService.GetBy(filterString);

            if (ctx.owner.obj is Site)
            {
                templates = TemplateUtil.addJson(templates);
            }

            int icount = 0;

            foreach (ContentSectionTemplate template in templates)
            {
                builder.AppendFormat("<td style=\"vertical-align:top;\"><label for=\"template{0}\"><img src='{1}{2}.png' style='width:150px;height:100px;' /></label><br/>", template.Id, thumbPath, template.TemplateName);
                builder.AppendFormat("<input name=\"templateId\" id=\"template{0}\" type=\"radio\" value=\"{0}\"", template.Id);
                if (tpl.Equals(template.TemplateName))
                {
                    builder.Append(" checked ");
                }
                builder.AppendFormat("/><label for=\"template{0}\">{1}</label></td>", template.Id, template.Name);

                if ((icount % 4) == 3)
                {
                    builder.Append("</tr><tr>");
                }

                icount++;
            }
            builder.Append("</table>");
            return(builder.ToString());
        }