private string RenderXml(IConfigBean config, IPayLoad context) { BaseAttributeConfigBean cp = config as BaseAttributeConfigBean; ConfigurationPayLoad cg = context as ConfigurationPayLoad; cp.AddSearchConfigKey(cg.SearceKeys); return new XMLSerializer().Serializer(cp); }
public string Process(IPayLoad payload) { ConfigurationPayLoad configPayload = payload as ConfigurationPayLoad; string type = configPayload.ConfigType.ToLower(); ConfigurationType configType; IConfigBean bean; if (type == "files") { configType = ConfigurationType.File; configPayload.Type = RenderType.Xml; bean = configService.GetConfigBean(configPayload, configType); return bean.GetRenderer().Render(configPayload, bean); } else if (type == "beans") { string action = configPayload.Action; if (action == "change") { int status = configService.UpdateConfigBean(configPayload, configPayload.KeyValuePair); return new JSONSerializer().Serializer(status); } configType = ConfigurationType.Bean; bean = configService.GetConfigBean(configPayload, configType); return bean.GetRenderer().Render(configPayload, bean); } else { configType = ConfigurationType.Bean; bean = defaultService.GetConfigBean(configPayload, configType); return bean.GetRenderer().Render(configPayload, bean); } }
private bool IsLocalHost(IPayLoad cxt) { if (cxt.UrlHost == "localhost" || cxt.UrlHost == "127.0.0.1" || cxt.TargetIP.Equals("127.0.0.1") || IISHelper.CheckTargetIP(cxt.TargetIP)) { return true; } return false; }
private string RenderHtml(IComponent component, IPayLoad context) { if (string.IsNullOrEmpty(ViewHtml)) { ViewHtml = ReadLayout(); ; } string content = BuildContent(component, context); content = ViewHtml.Replace("@Body@", content); return content; }
public string Process(IPayLoad context) { IComponent component=service.GetComponent(context.ID); if (component == null) { ComponentResult result = new ComponentResult() { Code = 404, Message = "Not found Component : " + context.ID }; return CommonHelper.CreateComponentResult(result, context.Type); } return component.GetRenderer().Render(context, component); }
public IConfigBean GetConfigBean(IPayLoad payload) { ConfigurationPayLoad config = payload as ConfigurationPayLoad; BaseAttributeConfigBean att = manager.GetConfigBean(config.ID) as BaseAttributeConfigBean; if (att == null) { return att; } att.Init(config.AppPath); return att; }
public VerifyMessage Verify(IPayLoad pay) { string rawUrl = pay.RawUrl; VerifyMessage vf = new VerifyMessage(); vf.IsSuccess = true; if (rawUrl.IndexOf(LogoutFormat) >= 0) { Authorization.Instance.LogOut(); vf.IsSuccess = false; } return vf; }
public VerifyMessage Verify(IPayLoad pay) { VerifyMessage vf = new VerifyMessage(); vf.IsSuccess = true; string url = pay.AbsoluteUri; if (!Regex.IsMatch(url, UrlPatten, RegexOptions.IgnoreCase)) { vf.IsSuccess = false; vf.Message = UrlTemplate; } return vf; }
public string Render(IPayLoad context, IConfigBean config) { switch (context.Type) { case RenderType.Html: return RenderHtml(config); case RenderType.Xml: return RenderXml(config, context); case RenderType.Json: return RenderJson(config, context); } return RenderHtml(config); }
public string Render(IPayLoad context, IComponent component) { switch (context.Type) { case RenderType.Html: return RenderHtml(component); case RenderType.Xml: return RenderXml(component, context); case RenderType.Json: return RenderJson(component, context); } return RenderJson(component, context); }
private VerifyMessage VerifyProcess(IPayLoad pay) { ISerializer serializer = GetSerializer(pay); IEnumerable<ICheckVerify> vs = VenusContainerLoader.Container.LookupList<ICheckVerify>(); VerifyMessage vf = null; foreach (ICheckVerify v in vs) { vf = v.Verify(pay); if (!vf.IsSuccess) { return vf; } } return vf; }
private string RenderHtml(IComponent component, IPayLoad context) { if (string.IsNullOrEmpty(ViewHtml)) { UserInfo user = Authorization.Instance.CurrentUser(); string userid = string.Empty; if (user != null) { userid = user.UserID; } ViewHtml = new ViewResult(layOutViewName, new PageModel() { ActiveMenuIndex = 0, DisplayName = userid, IsLogin = true }).Execute(); ViewHtml = ViewHtml.Replace("@ComponentBody@", BuildContent(context)); } return ViewHtml; }
public VerifyMessage Verify(IPayLoad pay) { VerifyMessage vf = new VerifyMessage(); vf.IsSuccess = true; bool IsAuthorized = true; if (!(PermissionValidate.Instance.CheckViewIPPermission() || PermissionValidate.Instance.CheckChangeIPPermission())) { IsAuthorized = Authorization.Instance.Authorizate(); } if (!IsAuthorized) { vf.IsSuccess = false; vf.Message = "Sorry,Your IP Address Doesn't Have Update Permission."; } return vf; }
private string BuildContent(IComponent component,IPayLoad context) { BaseAttributeComponent cp = component as BaseAttributeComponent; string host = ContextHelper.GetHostUrl(); StringBuilder content = new StringBuilder(); content.AppendLine("<div class=\"main-content-inner\">"); content.AppendLine("<div class=\"breadcrumbs\" id=\"breadcrumbs\">"); content.AppendLine(" <script type=\"text/javascript\">"); content.AppendLine(" try { ace.settings.check('breadcrumbs', 'fixed') } catch (e) { }"); content.AppendLine("</script>"); content.AppendLine("<ul class=\"breadcrumb\">"); content.AppendLine(" <li>"); content.AppendLine("<i class=\"ace-icon fa fa-home home-icon\"></i>"); content.AppendLine("<a href=\"" + host +"\">Component</a>"); content.AppendLine("</li>"); content.AppendFormat("<li class=\"active\" >{0}</li>", cp.GetID()); content.AppendLine(" </ul>"); content.AppendLine(" </div>"); content.AppendLine("<div class=\"page-content\">"); content.AppendLine("<table class=\"table table-striped table-bordered table-hover\">"); content.AppendLine("<colgroup>"); content.AppendLine("<col style=\"width: 120px; \">"); content.AppendLine("<col style=\"width: 120px; \">"); content.AppendLine("<col />"); content.AppendLine("</colgroup>"); List<FieldAttributeInfo> attInfos = AttributeHelper.GetComponentField(cp.GetAttribute()); foreach (FieldAttributeInfo info in attInfos) { object value = cp.GetAttribute().Get(info.Name); IModel m = new StringModel(); BaseCptEntity cpt = m.ToModel(info.Title, info.Name, value); cpt.Detail = info.Detail; cpt.Link = info.Link; content.Append(CreateItem(cpt as StringEntity)); } content.AppendLine("</table>"); content.AppendLine("</div>"); content.AppendLine("</div>"); return content.ToString(); }
private string RenderBarChart(IComponent component, IPayLoad context) { string result = string.Empty; var cp = component as BaseChartComponent; var attr = cp.GetAttribute(); List<FieldAttributeInfo> attrInfos = AttributeHelper.GetComponentField(attr); foreach (FieldAttributeInfo info in attrInfos) { if (info.Name == ChartType.BarChart.ToString()) { object value = attr.Get(info.Name); result = value.ToString(); break; } } return result; }
private ComponentCollection GetComponentList(IPayLoad context) { IComponentManager manager = new ComponentsManager(); var mc = new ComponentCollection(); mc.Name = "Componets"; var hostUrl = context.HostUrl; List<IComponent> list = manager.GetAllComponents(); List<Component> components = new List<Component>(); foreach (IComponent c in list) { string name = c.GetID(); components.Add(new Component() { Name = name, Url = hostUrl + "component/" + name + context.Query }); } components = components.OrderBy(o => o.Name).ToList(); mc.Components = components; return mc; }
public IConfigBean GetConfigBean(IPayLoad payload, ConfigurationType type) { ConfigurationPayLoad config = payload as ConfigurationPayLoad; if (type == ConfigurationType.File) { string serviceName = string.Format(_FileNameFormat, config.ID); ; return GetFileConfigBean(config, serviceName); } else { BaseAttributeConfigBean att = manager.GetConfigBean(config.ID) as BaseAttributeConfigBean; if (att == null) { return att; } att.Init(config.AppPath); return att; } }
public VerifyMessage Verify(IPayLoad pay) { VerifyMessage vf = new VerifyMessage(); vf.IsSuccess = true; string action = pay.Action; if (!PermissionValidate.Instance.IsInnerIp(IPHelper.GetClientIP())) { vf.IsSuccess = false; if (HostingEnvironment.IsHosted) { vf.Message = HostingEnvironment.ApplicationVirtualPath; } else { vf.Message = "Sorry,Your IP Address Doesn't Have " + action + " Permission."; } } return vf; }
public int UpdateConfigBean(IPayLoad payload) { ConfigurationPayLoad config = payload as ConfigurationPayLoad; BaseAttributeConfigBean bean = manager.GetConfigBean(config.ID) as BaseAttributeConfigBean; if (bean == null) { return 0; } bean.Init(config.AppPath); int statue; foreach (string key in config.KeyValuePair.Keys) { statue = bean.Set(key, config.KeyValuePair[key]); if (statue != 1) { return statue; } } return 1; }
private ComponentCollection GetComponentList(IPayLoad context) { IComponentManager manager = new ComponentsManager(); var mc = new ComponentCollection(); mc.Name = "Componets"; List<IComponent> list = manager.GetAllComponents(); List<Component> components = new List<Component>(); foreach (IComponent c in list) { string name = c.GetID(); if (name == "fx.default" || name == "fx.allcomponents") { continue; } components.Add(new Component() { Name = name, Url = context.HostUrl + "components/" + name, Detail = AttributeHelper.GetComponentDetail(c) }); } components = components.OrderBy(o => o.Name).ToList(); mc.Components = components; return mc; }
public VerifyMessage Verify(IPayLoad pay) { VerifyMessage vf = new VerifyMessage(); vf.IsSuccess = true; string action = pay.Action; bool isChange = action.Equals("update", StringComparison.Ordinal); if (isChange && !PermissionValidate.Instance.CheckChangePermission()) { vf.IsSuccess = false; if (HostingEnvironment.IsHosted) { vf.Message = HostingEnvironment.ApplicationVirtualPath; } else { vf.Message = "Sorry,Your IP Address Doesn't Have " + action + " Permission."; } } return vf; }
private ComponentCollection GetConigurationList(IPayLoad context) { ConfigurationPayLoad config = context as ConfigurationPayLoad; var mc = new ComponentCollection(); mc.Name = "Configurations"; List<Component> components = new List<Component>(); IConfigBeanManager manager = new ConfigBeanManager(); List<IConfigBean> configList = manager.GetAllConfigBeans(); foreach (IConfigBean c in configList) { string name = c.GetID(); if (name == "fx.configuration.default") { continue; } components.Add(new Component() { Name = name, Url = context.HostUrl + "configurations/beans/" + name }); } //IConfigFile dirFile = new ConfigDirFile(config.AppPath); //if (dirFile.GetFileInfos() != null) //{ // foreach (FileInfo file in dirFile.GetFileInfos()) // { // components.Add(new Component() { Name = file.Name, Url = context.HostUrl + "configurations/files/" + file.FileName() }); // } //} //IConfigFile runFile = new ConfigRunDirFile(config.AppPath); //if (runFile.GetFileInfos() != null) //{ // foreach (FileInfo file in runFile.GetFileInfos()) // { // components.Add(new Component() { Name = file.Name, Url = context.HostUrl + "configurations/files/" + file.FileName() }); // } //} components = components.OrderBy(o => o.Name).ToList(); mc.Components = components; return mc; }
public string Process(IPayLoad payload) { ConfigurationPayLoad configPayload = payload as ConfigurationPayLoad; IConfigBean bean; if (string.IsNullOrEmpty(configPayload.ID)) { bean = defaultService.GetConfigBean(configPayload); return bean.GetRenderer().Render(configPayload, bean); } string action = configPayload.Action; if (action == "update") { return new JSONSerializer().Serializer(UpdateConfigBean(configPayload)); } bean = configService.GetConfigBean(configPayload); if (bean == null) { ComponentResult result = new ComponentResult() { Code = 404, Message = "Not found ConfigBean : " + configPayload.ID }; return CommonHelper.CreateComponentResult(result, payload.Type); } return bean.GetRenderer().Render(configPayload, bean); }
private string BuildContent(IPayLoad context) { StringBuilder content = new StringBuilder(); ComponentCollection list = GetConigurationList(context); content.Append("<ul class=\" \" style=\"margin: 3px; padding-left:10px;\">"); foreach (Component c in list.Components) { content.Append("<li style=\"margin-right:8px; list-style-type:none;display:block\">"); content.Append("<a href=\"" + c.Url + "\" target=\"_self\" style=\" display:inline-block; width:350px \">"); if (RegexHelper.VerifyName(c.Name)) { content.Append("<strong style=\"color:#5a5a5a !important; font-size:14px;\">" + c.Name + " </strong>"); } else { content.Append("<strong style=\"color:red !important; font-size:14px;\">" + c.Name + " </strong>"); } content.Append("</a> " + c.Detail); content.Append("</li>"); } content.Append("</ul>"); return content.ToString(); }
private string RenderXml(IComponent component, IPayLoad context) { return new XMLSerializer().Serializer(GetComponentList(context)); }
private string RenderJson(IComponent component, IPayLoad context) { return new JSONSerializer().Serializer(GetComponentList(context)); }
private string RenderXml(IConfigBean component, IPayLoad context) { return new XMLSerializer().Serializer(GetConigurationList(context)); }
public int UpdateConfigBean(IPayLoad payload) { return 1; }
public IConfigBean GetConfigBean(IPayLoad payload) { return manager.GetConfigBean(_Id); //return component.GetRenderer().Render(context, component); }
public string NewToken <T>(IPayLoad payload) { return(_token.Encode(payload)); }
private ISerializer GetSerializer(IPayLoad cxt) { if (cxt.Type == RenderType.Xml) { return new XMLSerializer(); } return new JSONSerializer(); }