Пример #1
0
        public static ContentSectionTemplate getJsonTemplate()
        {
            ContentSectionTemplate ct = new ContentSectionTemplate();
            ct.Name = "json自定义模板<br/><span class=\"note\">(需要自己写js来绑定)</span>";
            ct.TemplateName = "json";

            return ct;
        }
 private Boolean isNeeded( ContentSectionTemplate template, string[] arrFilter ) {
     foreach (String ft in arrFilter) {
         if (strUtil.HasText( ft ) && template.TemplateName.Equals( ft.Trim() )) {
             return true;
         }
     }
     return false;
 }
        private void bindServiceThree( long serviceId, long templateId, Service service, ContentSectionTemplate template ) {
            set( "service.Id", serviceId );
            set( "service.Name", service.Name );
            set( "template.Id", templateId );
            set( "template.Name", template.Name );

            StringBuilder builder = new StringBuilder();
            IList parms = service.GetParams();
            for (int i = 0; i < parms.Count; i++) {
                ParamControl control = parms[i] as ParamControl;

                builder.Append( "<div>" );
                builder.Append( control.Html );
                builder.Append( "</div>" );
            }
            set( "settingList", builder.ToString() );
        }
Пример #4
0
        private ContentSectionTemplate checkJsonTemplate( ContentSectionTemplate template )
        {
            if (template != null) return template;
            if (ctx.owner.obj is Site == false) throw new NullReferenceException( "模板不能为空:请正确设置模板" );

            return TemplateUtil.getJsonTemplate();
        }
Пример #5
0
 // 得到视图view的模板文件
 public static String GetBinderTemplatePath( ContentSectionTemplate sectionTemplate )
 {
     return "Content/Binder/" + sectionTemplate.TemplateName;
 }
Пример #6
0
        public static ISectionBinder GetBinder( ContentSectionTemplate template, MvcContext ctx, Template currentView )
        {
            String binderName = string.Format( "wojilu.Web.Controller.Content.Binder.{0}BinderController", template.TemplateName );

            ControllerBase controller = ControllerFactory.FindController( binderName, ctx ) as ControllerBase;
            if (controller == null) throw new Exception( "ISectionBinder not found:" + binderName );
            controller.utils.setCurrentView( currentView );
            return controller as ISectionBinder;
        }
Пример #7
0
 public static String getServiceTemplates( String filterString, ContentSectionTemplate tpl, MvcContext ctx, IContentSectionTemplateService templateService )
 {
     String tplName = tpl==null? "json": tpl.TemplateName;
     return getServiceTemplates( filterString, tplName, ctx, templateService );
 }