public override void Render(StringBuilder builder, DHXScheduler par) { if (!this.HandleDifferentResources) { return; } List <SchedulerView> schedulerViewList = new List <SchedulerView>(); for (int index = 0; index < par.Views.Count; ++index) { if (par.Views[index] is UnitsView || par.Views[index] is TimelineView) { schedulerViewList.Add(par.Views[index]); } } if (schedulerViewList.Count == 0) { return; } List <string> stringList = new List <string>(); foreach (SchedulerView schedulerView in schedulerViewList) { UnitsView unitsView = schedulerView as UnitsView; if (unitsView != null) { stringList.Add(unitsView.Property); } else { TimelineView timelineView = schedulerView as TimelineView; if (timelineView != null) { stringList.Add(timelineView.Y_Property); } } } string[] strArray = new string[stringList.Count]; for (int index = 0; index < stringList.Count; ++index) { strArray[index] = string.Format("(ev.{0} == evs[i].{0})", (object)stringList[index]); } builder.Append(string.Format("\n\t{0}.attachEvent(\"onEventCollision\", function(ev, evs){{ var c = 0, l = {0}.config.collision_limit;for (var i=0; i<evs.length; i++) {{ if (", (object)par.Name)); builder.Append(string.Join("&&", strArray)); builder.Append("&& ev.id != evs[i].id) c++; } return !(c < l);});"); }
public string GenerateJSCode() { StringBuilder builder = new StringBuilder(); if (this.Name != this.DefaultName) { builder.Append(string.Format("\n\twindow.{0} = Scheduler.getSchedulerInstance();", (object)this.Name)); } builder.Append("\n"); builder.Append(string.Format(DHXScheduler.GetServerList().InitConfigSection, (object)this.Name)); if (DHXScheduler.GetServerList().Count > 0) { builder.Append(DHXScheduler.GetServerList().RenderCollections(this.Name)); } foreach (SchedulerControlsBase control in this._Controls) { control.Render(builder, this.Name); } foreach (SchedulerSettingsBase setting in this._Settings) { setting.Render(builder, this.Name); } if (this.HasBeforeInitCode) { builder.Append("\n"); builder.Append(string.Join("\n", this.BeforeInit.ToArray())); builder.Append("\n"); } if (this.EventHandlers.Events.Count > 0) { this.EventHandlers.Render(builder, this.Name); } if (this.TimeSpans.Items.Count > 0) { this.TimeSpans.Render(builder, this.Name); } if (this.Highlighter.Enabled) { this.Highlighter.Render(builder, this.Name); } List <string> stringList = new List <string>(); stringList.Add(string.Format("'{0}_here'", (object)this.Name)); DateTime initialDate = this.InitialDate; string str = initialDate == new DateTime() ? "null" : DateFormatHelper.DateToJS(initialDate); string initialView = this.InitialView; if (initialDate != new DateTime() || initialView != (string)null) { if (initialView != (string)null) { stringList.Add(str); stringList.Add("'" + initialView + "'"); } else if (initialDate != new DateTime()) { stringList.Add(str); } } builder.Append(string.Format("\n\t{0}.init({1});", (object)this.Name, (object)string.Join(",", stringList.ToArray()))); if (this.Extensions != null && this.Extensions.Items != null && this.Extensions.Items.Count != 0) { foreach (KeyValuePair <SchedulerExtensions.Extension, DHXExtension> keyValuePair in this.Extensions.Items) { keyValuePair.Value.Render(builder, this); } } if (this.HasAfterInitCode) { builder.Append("\n"); builder.Append(string.Join("\n", this.AfterInit.ToArray())); builder.Append("\n"); } if (this.HasDefaultValues) { this.EventHandlers.Events.Add(new DHXSchedulerEvent(DHXSchedulerEvent.Types.onEventCreated, this._ProcessDefaultValues())); } this.Data.DateFormat = this.Config.xml_date; this.Data.Render(builder, this.Name); foreach (SchedulerControlsBase control in this._Controls) { builder.Append(control.AfterInit()); } return(builder.ToString()); }
public abstract void Render(StringBuilder builder, DHXScheduler parent);
public static IDHXServerList GetServerList() { return(DHXScheduler.GetServerList(DHXScheduler.ServerListName)); }