// Token: 0x06001A8F RID: 6799 RVA: 0x0006F468 File Offset: 0x0006D668 private void PopulateCalculatedProperties(ADRawEntry entry) { MiniRecipient miniRecipient = entry as MiniRecipient; bool flag = false; foreach (ADPropertyDefinition adpropertyDefinition in this.CachedADProperties) { if (adpropertyDefinition.IsCalculated) { if (miniRecipient == null || miniRecipient.HasSupportingProperties(adpropertyDefinition)) { object obj = entry[adpropertyDefinition]; } else { flag = true; ComponentTrace <ADRecipientCacheTags> .TraceInformation <string>(0, (long)this.GetHashCode(), "After lookup, supporting properties are missing for the calculated property: {0}.", adpropertyDefinition.Name); } } } if (flag) { ComponentTrace <ADRecipientCacheTags> .TraceWarning <string>(0, (long)this.GetHashCode(), "Supporting properties were missing for the type: {0}.", entry.GetType().Name); } }
public EvaluatorResponse Evaluate(Node node, EvaluatorOption options) { if (node.nodeType != enumNodeType.COMMENT) { return(null); } /// NOTO: There are two place for evaluating comment command. if (Commands.CommandManager.IsCommand(node as Comment)) { var response = new EvaluatorResponse(); List <IRenderTask> result = new List <IRenderTask>(); Guid OwnerObjectId = options.OwnerObjectId; var command = Commands.CommandParser.ParseCommand(node as Comment); if (command.Name.ToLower() == "layout") { if ((options.IgnoreEvaluators & EnumEvaluator.LayoutCommand) == EnumEvaluator.LayoutCommand) { return(null); } var task = new CommandRenderTask(node as Comment, options); task.ClearBefore = true; result.Add(task); response.AppendTask = result; } else { var task = new CommandRenderTask(node as Comment, options); result.Add(task); response.ContentTask = result; } response.StopNextEvaluator = true; response.OmitTag = true; if (options.RequireBindingInfo) { if (response.BindingTask == null) { response.BindingTask = new List <IRenderTask>(); } var traceability = new ComponentTrace(command.Name, "command"); var bindingTask = new BindingRenderTask(traceability); response.BindingTask.Add(bindingTask); if (response.EndBindingTask == null) { response.EndBindingTask = new List <IRenderTask>(); } response.EndBindingTask.Add(bindingTask.BindingEndRenderTask); } return(response); } return(null); }
// Token: 0x06001A8E RID: 6798 RVA: 0x0006F320 File Offset: 0x0006D520 private Result <TEntry> LookUpRecipientInAD(ProxyAddress proxyAddress, ADPropertyDefinition[] properties) { if (ADRecipientCache <TEntry> .PerfCounters != null) { ADRecipientCache <TEntry> .PerfCounters.IndividualAddressLookupsTotal.Increment(); ADRecipientCache <TEntry> .PerfCounters.RequestsPendingTotal.Increment(); ADRecipientCache <TEntry> .PerfCounters.AggregateLookupsTotal.Increment(); this.IncrementQueriesPerCacheCounter(); } ComponentTrace <ADRecipientCacheTags> .TraceDebug <ProxyAddress>(0, -1L, "Lookup recipient {0}", proxyAddress); TEntry entry = default(TEntry); Stopwatch stopwatch = Stopwatch.StartNew(); try { ADNotificationAdapter.RunADOperation(delegate() { if (typeof(TEntry) == typeof(ADRawEntry)) { entry = (TEntry)((object)this.ADSession.FindByProxyAddress(proxyAddress, properties)); return; } if (typeof(TEntry) == typeof(TransportMiniRecipient)) { entry = (this.ADSession.FindByProxyAddress <TransportMiniRecipient>(proxyAddress) as TEntry); return; } throw new NotSupportedException(); }); if (entry == null) { return(new Result <TEntry>(default(TEntry), ProviderError.NotFound)); } } catch (DataValidationException ex) { ComponentTrace <ADRecipientCacheTags> .TraceError <DataValidationException>(0, -1L, "DataValidationException: {0}", ex); return(new Result <TEntry>(default(TEntry), ex.Error)); } finally { stopwatch.Stop(); if (ADRecipientCache <TEntry> .PerfCounters != null) { ADRecipientCache <TEntry> .PerfCounters.AverageLookupQueryLatency.IncrementBy(stopwatch.ElapsedMilliseconds); } ADRecipientCache <TEntry> .DecrementPendingRequestsCounter(); } return(new Result <TEntry>(entry, null)); }
public EvaluatorResponse Evaluate(Node node, EvaluatorOption options) { if (options.IgnoreEvaluators.HasFlag(EnumEvaluator.Label)) { return(null); } if (node.nodeType != enumNodeType.ELEMENT) { return(null); } var element = node as Element; string LabelName = null; foreach (var item in element.attributes) { var lower = item.name.ToLower(); if (lower == "tal-label" || lower == "k-label") { LabelName = item.name; break; } } if (!string.IsNullOrEmpty(LabelName)) { var response = new EvaluatorResponse(); var result = new List <IRenderTask>(); string value = element.getAttribute(LabelName); element.removeAttribute(LabelName); if (options.RequireBindingInfo) { if (response.BindingTask == null) { response.BindingTask = new List <IRenderTask>(); } var traceability = new ComponentTrace(value, "label"); var bindingTask = new BindingRenderTask(traceability); response.BindingTask.Add(bindingTask); if (response.EndBindingTask == null) { response.EndBindingTask = new List <IRenderTask>(); } response.EndBindingTask.Add(bindingTask.BindingEndRenderTask); } result.Add(new LabelRenderTask(value)); response.ContentTask = result; return(response); } return(null); }
public static async Task <string> RenderPageAsync(FrontContext context) { if (context.Page.Parameters.Count > 0) { context.RenderContext.DataContext.Push(context.Page.Parameters); } string result = string.Empty; List <IRenderTask> RenderPlan = null; var option = RenderOptionHelper.GetPageOption(context); if (option.RequireBindingInfo) { string html = DomService.ApplyKoobooId(context.Page.Body); RenderPlan = RenderEvaluator.Evaluate(html, option); var traceability = new ComponentTrace(context.Page.Id.ToString(), "page"); var bindingTask = new BindingRenderTask(traceability, new Dictionary <string, string> { { "scope", "true" } }); RenderPlan.Insert(0, bindingTask); RenderPlan.Add(bindingTask.BindingEndRenderTask); result = RenderHelper.Render(RenderPlan, context.RenderContext); result = DomService.EnsureDocType(result); } else { RenderPlan = Cache.RenderPlan.GetOrAddRenderPlan(context.SiteDb, context.Page.Id, () => RenderEvaluator.Evaluate(context.Page.Body, option)); result = RenderHelper.Render(RenderPlan, context.RenderContext); } if (context.Page.Type == Models.PageType.RichText) { //special for richtext editor. meta name = "viewport" content = "width=device-width, initial-scale=1" var header = new Models.HtmlHeader(); Dictionary <string, string> content = new Dictionary <string, string>(); content.Add("", "width=device-width, initial-scale=1"); header.Metas.Add(new Models.HtmlMeta() { name = "viewport", content = content }); result = HtmlHeadService.SetHeaderToHtml(result, header); } return(result); }
public EvaluatorResponse Evaluate(Node node, EvaluatorOption options) { if (options.IgnoreEvaluators.HasFlag(EnumEvaluator.Form)) { return(null); } if (node.nodeType != enumNodeType.ELEMENT) { return(null); } var element = node as Element; if (ShouldEvaluate(element)) { var response = new EvaluatorResponse(); List <IRenderTask> result = new List <IRenderTask>(); Guid OwnerObjectId = options.OwnerObjectId; string KoobooId = Service.DomService.GetKoobooId(element); Guid FormId = Kooboo.Data.IDGenerator.GetFormId(OwnerObjectId, KoobooId); result.Add(new FormRenderTask(element, OwnerObjectId, FormId, options)); response.ContentTask = result; response.StopNextEvaluator = true; response.OmitTag = true; if (options.RequireBindingInfo) { if (response.BindingTask == null) { response.BindingTask = new List <IRenderTask>(); } var traceability = new ComponentTrace(FormId.ToString(), "innerform"); var bindingTask = new BindingRenderTask(traceability); response.BindingTask.Add(bindingTask); if (response.EndBindingTask == null) { response.EndBindingTask = new List <IRenderTask>(); } response.EndBindingTask.Add(bindingTask.BindingEndRenderTask); } return(response); } return(null); }
public EvaluatorResponse Evaluate(Node node, EvaluatorOption options) { if (options.IgnoreEvaluators.HasFlag(EnumEvaluator.Component)) { return(null); } if (node.nodeType != enumNodeType.ELEMENT) { return(null); } var element = node as Element; if (Components.Manager.IsComponent(element)) { var response = new EvaluatorResponse(); var result = new List <IRenderTask>(); result.Add(new ComponentRenderTask(element)); response.ContentTask = result; response.OmitTag = true; response.StopNextEvaluator = true; if (options.RequireBindingInfo) { if (response.BindingTask == null) { response.BindingTask = new List <IRenderTask>(); } var traceability = new ComponentTrace(element.id, element.tagName); var bindingTask = new BindingRenderTask(traceability, new Dictionary <string, string> { { "scope", "true" } }); response.BindingTask.Add(bindingTask); if (response.EndBindingTask == null) { response.EndBindingTask = new List <IRenderTask>(); } response.EndBindingTask.Add(bindingTask.BindingEndRenderTask); } return(response); } return(null); }
public EvaluatorResponse Evaluate(Node node, EvaluatorOption options) { if (options.IgnoreEvaluators.HasFlag(EnumEvaluator.SiteLayout)) { return(null); } if (node.nodeType != enumNodeType.ELEMENT) { return(null); } var element = node as Element; if (element.tagName == "layout" && (element.hasAttribute("id") || element.hasAttribute("name"))) { var response = new EvaluatorResponse(); var result = new List <IRenderTask>(); result.Add(new SiteLayoutRenderTask(element, options)); response.ContentTask = result; response.OmitTag = true; if (options.RequireBindingInfo) { if (response.BindingTask == null) { response.BindingTask = new List <IRenderTask>(); } var traceability = new ComponentTrace(element.id, element.tagName); var bindingTask = new BindingRenderTask(traceability, new Dictionary <string, string> { { "scope", "true" } }); response.BindingTask.Add(bindingTask); if (response.EndBindingTask == null) { response.EndBindingTask = new List <IRenderTask>(); } response.EndBindingTask.Add(bindingTask.BindingEndRenderTask); } return(response); } return(null); }
public static async Task <string> RenderPageAsync(FrontContext context) { if (context.Page.Parameters.Count > 0) { context.RenderContext.DataContext.Push(context.Page.Parameters); } string result = string.Empty; List <IRenderTask> RenderPlan = null; var option = RenderOptionHelper.GetPageOption(context); if (option.RequireBindingInfo) { string html = DomService.ApplyKoobooId(context.Page.Body); RenderPlan = RenderEvaluator.Evaluate(html, option); var traceability = new ComponentTrace(context.Page.Id.ToString(), "page"); var bindingTask = new BindingRenderTask(traceability, new Dictionary <string, string> { { "scope", "true" } }); RenderPlan.Insert(0, bindingTask); RenderPlan.Add(bindingTask.BindingEndRenderTask); result = RenderHelper.Render(RenderPlan, context.RenderContext); result = DomService.EnsureDocType(result); } else { RenderPlan = Cache.RenderPlan.GetOrAddRenderPlan(context.SiteDb, context.Page.Id, () => RenderEvaluator.Evaluate(context.Page.Body, option)); // check the cache. if (context.Page.EnableCache) { Dictionary <string, string> querystring = null; if (!string.IsNullOrWhiteSpace(context.Page.CacheQueryKeys)) { //querystring = RequestManager.GetQueryString(context.RenderContext.Request); querystring = GetParaValues(context.RenderContext, context.Page.CacheKeys); } if (context.Page.CacheByVersion) { result = PageCache.PageCache.GetByVersion(context.SiteDb.Id, context.Page.Id, context.Page.Version, querystring); } else { result = PageCache.PageCache.GetByMinutes(context.SiteDb.Id, context.Page.Id, context.Page.CacheMinutes, querystring, context.Page.Version); } if (string.IsNullOrEmpty(result)) { result = RenderHelper.Render(RenderPlan, context.RenderContext); Kooboo.Sites.Render.PageCache.PageCache.Set(context.SiteDb.Id, context.Page.Id, result, context.Page.Version, querystring); } // cache result may have replacement. } else { result = RenderHelper.Render(RenderPlan, context.RenderContext); } } if (context.Page.Type == Models.PageType.RichText) { //special for richtext editor. meta name = "viewport" content = "width=device-width, initial-scale=1" var header = new Models.HtmlHeader(); Dictionary <string, string> content = new Dictionary <string, string>(); content.Add("", "width=device-width, initial-scale=1"); header.Metas.Add(new Models.HtmlMeta() { name = "viewport", content = content }); result = HtmlHeadService.SetHeaderToHtml(result, header); } return(result); }
// Token: 0x06001A76 RID: 6774 RVA: 0x0006E40C File Offset: 0x0006C60C public virtual Result <TEntry> FindAndCacheRecipient(ADObjectId objectId) { if (objectId == null) { throw new ArgumentNullException("objectId"); } if (ADRecipientCache <TEntry> .PerfCounters != null) { ADRecipientCache <TEntry> .PerfCounters.IndividualAddressLookupsTotal.Increment(); ADRecipientCache <TEntry> .PerfCounters.RequestsPendingTotal.Increment(); ADRecipientCache <TEntry> .PerfCounters.AggregateHits_Base.Increment(); ADRecipientCache <TEntry> .PerfCounters.AggregateMisses.Increment(); ADRecipientCache <TEntry> .PerfCounters.AggregateLookupsTotal.Increment(); this.IncrementQueriesPerCacheCounter(); } Stopwatch stopwatch = Stopwatch.StartNew(); Result <TEntry> result; try { TEntry entry = default(TEntry); ADNotificationAdapter.RunADOperation(delegate() { if (typeof(TEntry) == typeof(TransportMiniRecipient)) { entry = (this.ADSession.ReadMiniRecipient <TransportMiniRecipient>(objectId, this.properties) as TEntry); return; } if (this.isFullADRecipientObject) { entry = (TEntry)((object)this.ADSession.Read(objectId)); return; } entry = (TEntry)((object)this.ADSession.ReadADRawEntry(objectId, this.properties)); }); if (entry == null) { result = new Result <TEntry>(default(TEntry), ProviderError.NotFound); } else { result = new Result <TEntry>(entry, null); } } catch (DataValidationException ex) { ComponentTrace <ADRecipientCacheTags> .TraceError <DataValidationException>(0, -1L, "DataValidationException: {0}", ex); result = new Result <TEntry>(default(TEntry), ex.Error); } finally { stopwatch.Stop(); if (ADRecipientCache <TEntry> .PerfCounters != null) { ADRecipientCache <TEntry> .PerfCounters.AverageLookupQueryLatency.IncrementBy(stopwatch.ElapsedMilliseconds); } ADRecipientCache <TEntry> .DecrementPendingRequestsCounter(); } if (result.Data != null) { ProxyAddress primarySmtpAddress = ADRecipientCache <TEntry> .GetPrimarySmtpAddress(result.Data); if (primarySmtpAddress != null) { this.AddCacheEntry(primarySmtpAddress, result); } } return(result); }