This commit is contained in:
2019-09-01 15:21:42 +02:00
parent a083e412fd
commit 797062b8a9
26 changed files with 5154 additions and 5136 deletions

View File

@@ -1,127 +1,127 @@
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System;
using System.Collections;
namespace DayPilot.Web.Ui
{
/// <summary>
/// Block is a set of concurrent events.
/// </summary>
internal class Block
{
internal ArrayList Columns;
private ArrayList events = new ArrayList();
internal Block()
{
}
internal void Add(Event ev)
{
events.Add(ev);
arrangeColumns();
}
private Column createColumn()
{
Column col = new Column();
this.Columns.Add(col);
col.Block = this;
return col;
}
private void arrangeColumns()
{
// cleanup
this.Columns = new ArrayList();
foreach(Event e in events)
e.Column = null;
// there always will be at least one column because arrangeColumns is called only from Add()
createColumn();
foreach (Event e in events)
{
foreach (Column col in Columns)
{
if (col.CanAdd(e))
{
col.Add(e);
break;
}
}
// it wasn't placed
if (e.Column == null)
{
Column col = createColumn();
col.Add(e);
}
}
}
internal bool OverlapsWith(Event e)
{
if (events.Count == 0)
return false;
return (this.BoxStart < e.BoxEnd && this.BoxEnd > e.BoxStart);
}
internal DateTime BoxStart
{
get
{
DateTime min = DateTime.MaxValue;
foreach(Event ev in events)
{
if (ev.BoxStart < min)
min = ev.BoxStart;
}
return min;
}
}
internal DateTime BoxEnd
{
get
{
DateTime max = DateTime.MinValue;
foreach(Event ev in events)
{
if (ev.BoxEnd > max)
max = ev.BoxEnd;
}
return max;
}
}
}
}
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System;
using System.Collections;
namespace DayPilot.Web.Ui
{
/// <summary>
/// Block is a set of concurrent events.
/// </summary>
internal class Block
{
internal ArrayList Columns;
private ArrayList events = new ArrayList();
internal Block()
{
}
internal void Add(Event ev)
{
events.Add(ev);
arrangeColumns();
}
private Column createColumn()
{
Column col = new Column();
this.Columns.Add(col);
col.Block = this;
return col;
}
private void arrangeColumns()
{
// cleanup
this.Columns = new ArrayList();
foreach(Event e in events)
e.Column = null;
// there always will be at least one column because arrangeColumns is called only from Add()
createColumn();
foreach (Event e in events)
{
foreach (Column col in Columns)
{
if (col.CanAdd(e))
{
col.Add(e);
break;
}
}
// it wasn't placed
if (e.Column == null)
{
Column col = createColumn();
col.Add(e);
}
}
}
internal bool OverlapsWith(Event e)
{
if (events.Count == 0)
return false;
return (this.BoxStart < e.BoxEnd && this.BoxEnd > e.BoxStart);
}
internal DateTime BoxStart
{
get
{
DateTime min = DateTime.MaxValue;
foreach(Event ev in events)
{
if (ev.BoxStart < min)
min = ev.BoxStart;
}
return min;
}
}
internal DateTime BoxEnd
{
get
{
DateTime max = DateTime.MinValue;
foreach(Event ev in events)
{
if (ev.BoxEnd > max)
max = ev.BoxEnd;
}
return max;
}
}
}
}

View File

@@ -1,119 +1,119 @@
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System;
using System.Collections;
using DayPilot.Web.Ui;
namespace DayPilot.Web.Ui
{
/// <summary>
/// Column is a column of events in a Block.
/// </summary>
public class Column
{
private ArrayList events = new ArrayList();
internal Block Block;
/// <summary>
/// Gets the width of the column in percent.
/// </summary>
public int WidthPct
{
get
{
if (Block == null)
throw new ApplicationException("This Column does not belong to any Block.");
if (Block.Columns.Count == 0)
throw new ApplicationException("Internal error: Problem with Block.Column.Counts (it is zero).");
// the last block will be a bit longer to make sure the total width is 100%
if (isLastInBlock)
return 100 / Block.Columns.Count + 100 % Block.Columns.Count;
else
return 100 / Block.Columns.Count;
}
}
/// <summary>
/// Gets the starting percent of the column.
/// </summary>
public int StartsAtPct
{
get
{
if (Block == null)
throw new ApplicationException("This Column does not belong to any Block.");
if (Block.Columns.Count == 0)
throw new ApplicationException("Internal error: Problem with Block.Column.Counts (it is zero).");
return 100 / Block.Columns.Count * Number;
}
}
private bool isLastInBlock
{
get
{
return Block.Columns[Block.Columns.Count - 1] == this;
}
}
internal Column()
{
}
internal bool CanAdd(Event e)
{
foreach (Event ev in events)
{
if (ev.OverlapsWith(e))
return false;
}
return true;
}
internal void Add(Event e)
{
if (e.Column != null)
throw new ApplicationException("This Event was already placed into a Column.");
events.Add(e);
e.Column = this;
}
/// <summary>
/// Gets the order number of the column.
/// </summary>
public int Number
{
get
{
if (Block == null)
throw new ApplicationException("This Column doesn't belong to any Block.");
return Block.Columns.IndexOf(this);
}
}
}
}
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System;
using System.Collections;
using DayPilot.Web.Ui;
namespace DayPilot.Web.Ui
{
/// <summary>
/// Column is a column of events in a Block.
/// </summary>
public class Column
{
private ArrayList events = new ArrayList();
internal Block Block;
/// <summary>
/// Gets the width of the column in percent.
/// </summary>
public int WidthPct
{
get
{
if (Block == null)
throw new ApplicationException("This Column does not belong to any Block.");
if (Block.Columns.Count == 0)
throw new ApplicationException("Internal error: Problem with Block.Column.Counts (it is zero).");
// the last block will be a bit longer to make sure the total width is 100%
if (isLastInBlock)
return 100 / Block.Columns.Count + 100 % Block.Columns.Count;
else
return 100 / Block.Columns.Count;
}
}
/// <summary>
/// Gets the starting percent of the column.
/// </summary>
public int StartsAtPct
{
get
{
if (Block == null)
throw new ApplicationException("This Column does not belong to any Block.");
if (Block.Columns.Count == 0)
throw new ApplicationException("Internal error: Problem with Block.Column.Counts (it is zero).");
return 100 / Block.Columns.Count * Number;
}
}
private bool isLastInBlock
{
get
{
return Block.Columns[Block.Columns.Count - 1] == this;
}
}
internal Column()
{
}
internal bool CanAdd(Event e)
{
foreach (Event ev in events)
{
if (ev.OverlapsWith(e))
return false;
}
return true;
}
internal void Add(Event e)
{
if (e.Column != null)
throw new ApplicationException("This Event was already placed into a Column.");
events.Add(e);
e.Column = this;
}
/// <summary>
/// Gets the order number of the column.
/// </summary>
public int Number
{
get
{
if (Block == null)
throw new ApplicationException("This Column doesn't belong to any Block.");
return Block.Columns.IndexOf(this);
}
}
}
}

View File

@@ -1,236 +1,236 @@
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace DayPilot.Web.Ui
{
/// <summary>
/// Day handles events of a single day.
/// </summary>
internal class Day : ISerializable
{
internal List<Event> events = new List<Event>();
private List<Block> blocks = new List<Block>();
internal int cellDuration; // in minutes
private DateTime start;
internal DateTime end;
internal string Name;
internal string Value;
internal DateTime Start
{
get { return start; }
}
internal DateTime End
{
get { return end; }
}
public Day(DateTime date)
{
this.start = date.Date;
this.end = date.Date.AddDays(1);
}
internal Day(DateTime start, DateTime end, string header, string id, int cellDuration)
{
this.start = start.Date;
this.end = end.Date;
this.Name = header;
this.Value = id;
this.cellDuration = cellDuration;
}
private void stripAndAddEvent(Event e)
{
stripAndAddEvent(e.Start, e.End, e.PK, e.Name, e.Resource, e.Owner);
}
private void stripAndAddEvent(DateTime start, DateTime end, string pk, string name, string resource, string owner)
{
if (!String.IsNullOrEmpty(Value)) // this applies to resources view only
{
if (Value != resource) // don't add events that don't belong to this column
return;
}
// the event happens before this day
if (end <= Start)
return;
// the event happens after this day
if (start >= End)
return;
// this is invalid event that does have no duration
if (start >= end)
return;
// fix the starting time
if (start < Start)
start = Start;
// fix the ending time
if (end > End)
end = End;
events.Add(new Event(pk, start, end, name, resource, owner));
}
/*
private void stripAndAddEvent(Event e)
{
if (!String.IsNullOrEmpty(Value)) // this applies to resources view only
{
if (Value != e.Resource) // don't add events that don't belong to this column
return;
}
// the event happens before this day
if (e.End <= Start)
return;
// the event happens after this day
if (e.Start >= End.AddDays(1))
return;
// this is invalid event that has no duration
if (e.Start >= e.End)
return;
// Event part = new Event(this, e);
events.Add(e);
}
*/
/// <summary>
/// Loads events from ArrayList of Events.
/// </summary>
/// <param name="events">ArrayList that contains the Events.</param>
public void Load(ArrayList events)
{
if (events == null)
{
return;
}
foreach (Event e in events)
{
stripAndAddEvent(e);
}
putIntoBlocks();
}
private void putIntoBlocks()
{
foreach (Event e in events)
{
// if there is no block, create the first one
if (lastBlock == null)
{
blocks.Add(new Block());
}
// or if the event doesn't overlap with the last block, create a new block
else if (!lastBlock.OverlapsWith(e))
{
blocks.Add(new Block());
}
// any case, add it to some block
lastBlock.Add(e);
}
}
private Block lastBlock
{
get
{
if (blocks.Count == 0)
return null;
return blocks[blocks.Count - 1];
}
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
}
internal int MaxColumns()
{
int i = 1;
foreach (Block b in blocks)
{
if (b.Columns.Count > i)
i = b.Columns.Count;
}
return i;
}
public DateTime BoxStart
{
get
{
DateTime min = DateTime.MaxValue;
foreach (Block block in blocks)
{
if (block.BoxStart < min)
min = block.BoxStart;
}
return min;
}
}
/// <summary>
/// The end of the box of the last event.
/// </summary>
public DateTime BoxEnd
{
get
{
DateTime max = DateTime.MinValue;
foreach (Block block in blocks)
{
if (block.BoxEnd > max)
max = block.BoxEnd;
}
return max;
}
}
}
}
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace DayPilot.Web.Ui
{
/// <summary>
/// Day handles events of a single day.
/// </summary>
internal class Day : ISerializable
{
internal List<Event> events = new List<Event>();
private List<Block> blocks = new List<Block>();
internal int cellDuration; // in minutes
private DateTime start;
internal DateTime end;
internal string Name;
internal string Value;
internal DateTime Start
{
get { return start; }
}
internal DateTime End
{
get { return end; }
}
public Day(DateTime date)
{
this.start = date.Date;
this.end = date.Date.AddDays(1);
}
internal Day(DateTime start, DateTime end, string header, string id, int cellDuration)
{
this.start = start.Date;
this.end = end.Date;
this.Name = header;
this.Value = id;
this.cellDuration = cellDuration;
}
private void stripAndAddEvent(Event e)
{
stripAndAddEvent(e.Start, e.End, e.PK, e.Name, e.Resource, e.Owner);
}
private void stripAndAddEvent(DateTime start, DateTime end, string pk, string name, string resource, string owner)
{
if (!String.IsNullOrEmpty(Value)) // this applies to resources view only
{
if (Value != resource) // don't add events that don't belong to this column
return;
}
// the event happens before this day
if (end <= Start)
return;
// the event happens after this day
if (start >= End)
return;
// this is invalid event that does have no duration
if (start >= end)
return;
// fix the starting time
if (start < Start)
start = Start;
// fix the ending time
if (end > End)
end = End;
events.Add(new Event(pk, start, end, name, resource, owner));
}
/*
private void stripAndAddEvent(Event e)
{
if (!String.IsNullOrEmpty(Value)) // this applies to resources view only
{
if (Value != e.Resource) // don't add events that don't belong to this column
return;
}
// the event happens before this day
if (e.End <= Start)
return;
// the event happens after this day
if (e.Start >= End.AddDays(1))
return;
// this is invalid event that has no duration
if (e.Start >= e.End)
return;
// Event part = new Event(this, e);
events.Add(e);
}
*/
/// <summary>
/// Loads events from ArrayList of Events.
/// </summary>
/// <param name="events">ArrayList that contains the Events.</param>
public void Load(ArrayList events)
{
if (events == null)
{
return;
}
foreach (Event e in events)
{
stripAndAddEvent(e);
}
putIntoBlocks();
}
private void putIntoBlocks()
{
foreach (Event e in events)
{
// if there is no block, create the first one
if (lastBlock == null)
{
blocks.Add(new Block());
}
// or if the event doesn't overlap with the last block, create a new block
else if (!lastBlock.OverlapsWith(e))
{
blocks.Add(new Block());
}
// any case, add it to some block
lastBlock.Add(e);
}
}
private Block lastBlock
{
get
{
if (blocks.Count == 0)
return null;
return blocks[blocks.Count - 1];
}
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
}
internal int MaxColumns()
{
int i = 1;
foreach (Block b in blocks)
{
if (b.Columns.Count > i)
i = b.Columns.Count;
}
return i;
}
public DateTime BoxStart
{
get
{
DateTime min = DateTime.MaxValue;
foreach (Block block in blocks)
{
if (block.BoxStart < min)
min = block.BoxStart;
}
return min;
}
}
/// <summary>
/// The end of the box of the last event.
/// </summary>
public DateTime BoxEnd
{
get
{
DateTime max = DateTime.MinValue;
foreach (Block block in blocks)
{
if (block.BoxEnd > max)
max = block.BoxEnd;
}
return max;
}
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,44 +1,44 @@
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System.Collections;
using System.Web.UI.Design.WebControls;
namespace DayPilot.Web.Ui.Design
{
public class DayPilotCalendarDesigner : DataBoundControlDesigner
{
protected override void PreFilterProperties(IDictionary properties)
{
base.PreFilterProperties(properties);
properties.Remove("Height");
properties.Remove("BorderStyle");
properties.Remove("BorderWidth");
properties.Remove("CssClass");
properties.Remove("Font");
properties.Remove("ForeColor");
properties.Remove("ToolTip");
properties.Remove("EndDate");
}
}
}
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System.Collections;
using System.Web.UI.Design.WebControls;
namespace DayPilot.Web.Ui.Design
{
public class DayPilotCalendarDesigner : DataBoundControlDesigner
{
protected override void PreFilterProperties(IDictionary properties)
{
base.PreFilterProperties(properties);
properties.Remove("Height");
properties.Remove("BorderStyle");
properties.Remove("BorderWidth");
properties.Remove("CssClass");
properties.Remove("Font");
properties.Remove("ForeColor");
properties.Remove("ToolTip");
properties.Remove("EndDate");
}
}
}

View File

@@ -1,55 +1,55 @@
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
namespace DayPilot.Web.Ui.Enums
{
/// <summary>
/// Header grouping units.
/// </summary>
public enum GroupByEnum
{
/// <summary>
/// Grouped by hour.
/// </summary>
Hour,
/// <summary>
/// Grouped by day.
/// </summary>
Day,
/// <summary>
/// Grouped by week.
/// </summary>
Week,
/// <summary>
/// Grouped by month.
/// </summary>
Month,
/// <summary>
/// No grouping.
/// </summary>
None
}
}
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
namespace DayPilot.Web.Ui.Enums
{
/// <summary>
/// Header grouping units.
/// </summary>
public enum GroupByEnum
{
/// <summary>
/// Grouped by hour.
/// </summary>
Hour,
/// <summary>
/// Grouped by day.
/// </summary>
Day,
/// <summary>
/// Grouped by week.
/// </summary>
Week,
/// <summary>
/// Grouped by month.
/// </summary>
Month,
/// <summary>
/// No grouping.
/// </summary>
None
}
}

View File

@@ -1,142 +1,142 @@
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System;
namespace DayPilot.Web.Ui
{
/// <summary>
/// Summary description for Event.
/// </summary>
[Serializable]
public class Event
{
/// <summary>
/// Event start.
/// </summary>
public DateTime Start;
/// <summary>
/// Event end;
/// </summary>
public DateTime End;
/// <summary>
/// Event name;
/// </summary>
public string Name;
/// <summary>
/// Event primary key.
/// </summary>
public string PK;
public string Resource;
public string Owner;
/// <summary>
/// Column to which this event belongs.
/// </summary>
[NonSerialized]
public Column Column;
/// <summary>
/// Constructor.
/// </summary>
public Event()
{
}
/// <summary>
/// Constructor that prefills the fields.
/// </summary>
/// <param name="pk"></param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="name"></param>
public Event(string pk, DateTime start, DateTime end, string name) : this(pk, start, end, name, null)
{
}
public Event(string pk, DateTime start, DateTime end, string name, string resource): this(pk, start, end, name, resource, null)
{
}
public Event(string pk, DateTime start, DateTime end, string name, string resource, string owner)
{
this.PK = pk;
this.Start = start;
this.End = end;
this.Name = name;
this.Resource = resource;
this.Owner = owner;
}
/// <summary>
/// Gets the starting time of an event box.
/// </summary>
public DateTime BoxStart
{
get
{
if (Start.Minute >= 30)
return new DateTime(Start.Year, Start.Month, Start.Day, Start.Hour, 30, 0);
else
return new DateTime(Start.Year, Start.Month, Start.Day, Start.Hour, 0, 0);
}
}
/// <summary>
/// Gets the ending time of an event box.
/// </summary>
public DateTime BoxEnd
{
get
{
if (End.Minute > 30)
{
DateTime hourPlus = End.AddHours(1);
return new DateTime(hourPlus.Year, hourPlus.Month, hourPlus.Day, hourPlus.Hour, 0, 0);
}
else if (End.Minute > 0)
{
return new DateTime(End.Year, End.Month, End.Day, End.Hour, 30, 0);
}
else
{
return new DateTime(End.Year, End.Month, End.Day, End.Hour, 0, 0);
}
}
}
/// <summary>
/// Returns true if this box overlaps with e's box.
/// </summary>
/// <param name="e"></param>
/// <returns></returns>
public bool OverlapsWith(Event e)
{
return (this.BoxStart < e.BoxEnd && this.BoxEnd > e.Start);
}
}
}
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System;
namespace DayPilot.Web.Ui
{
/// <summary>
/// Summary description for Event.
/// </summary>
[Serializable]
public class Event
{
/// <summary>
/// Event start.
/// </summary>
public DateTime Start;
/// <summary>
/// Event end;
/// </summary>
public DateTime End;
/// <summary>
/// Event name;
/// </summary>
public string Name;
/// <summary>
/// Event primary key.
/// </summary>
public string PK;
public string Resource;
public string Owner;
/// <summary>
/// Column to which this event belongs.
/// </summary>
[NonSerialized]
public Column Column;
/// <summary>
/// Constructor.
/// </summary>
public Event()
{
}
/// <summary>
/// Constructor that prefills the fields.
/// </summary>
/// <param name="pk"></param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="name"></param>
public Event(string pk, DateTime start, DateTime end, string name) : this(pk, start, end, name, null)
{
}
public Event(string pk, DateTime start, DateTime end, string name, string resource): this(pk, start, end, name, resource, null)
{
}
public Event(string pk, DateTime start, DateTime end, string name, string resource, string owner)
{
this.PK = pk;
this.Start = start;
this.End = end;
this.Name = name;
this.Resource = resource;
this.Owner = owner;
}
/// <summary>
/// Gets the starting time of an event box.
/// </summary>
public DateTime BoxStart
{
get
{
if (Start.Minute >= 30)
return new DateTime(Start.Year, Start.Month, Start.Day, Start.Hour, 30, 0);
else
return new DateTime(Start.Year, Start.Month, Start.Day, Start.Hour, 0, 0);
}
}
/// <summary>
/// Gets the ending time of an event box.
/// </summary>
public DateTime BoxEnd
{
get
{
if (End.Minute > 30)
{
DateTime hourPlus = End.AddHours(1);
return new DateTime(hourPlus.Year, hourPlus.Month, hourPlus.Day, hourPlus.Hour, 0, 0);
}
else if (End.Minute > 0)
{
return new DateTime(End.Year, End.Month, End.Day, End.Hour, 30, 0);
}
else
{
return new DateTime(End.Year, End.Month, End.Day, End.Hour, 0, 0);
}
}
}
/// <summary>
/// Returns true if this box overlaps with e's box.
/// </summary>
/// <param name="e"></param>
/// <returns></returns>
public bool OverlapsWith(Event e)
{
return (this.BoxStart < e.BoxEnd && this.BoxEnd > e.Start);
}
}
}

View File

@@ -1,52 +1,52 @@
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System.Collections;
namespace DayPilot.Web.Ui
{
public class EventComparer : IComparer
{
// Calls CaseInsensitiveComparer.Compare with the parameters reversed.
public int Compare(object x, object y)
{
Event first = (Event) x;
Event second = (Event) y;
if (first.Start < second.Start)
{
return -1;
}
if (first.Start > second.Start)
{
return 1;
}
if (first.End > second.End)
return -1;
return 0;
}
}
}
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System.Collections;
namespace DayPilot.Web.Ui
{
public class EventComparer : IComparer
{
// Calls CaseInsensitiveComparer.Compare with the parameters reversed.
public int Compare(object x, object y)
{
Event first = (Event) x;
Event second = (Event) y;
if (first.Start < second.Start)
{
return -1;
}
if (first.Start > second.Start)
{
return 1;
}
if (first.End > second.End)
return -1;
return 0;
}
}
}

View File

@@ -1,80 +1,80 @@
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System;
namespace DayPilot.Web.Ui
{
/// <summary>
/// Delegate for passing an event primary key.
/// </summary>
public delegate void EventClickDelegate(object sender, EventClickEventArgs e);
/// <summary>
/// Delegate for passing a starting time.
/// </summary>
public delegate void FreeClickDelegate(object sender, FreeClickEventArgs e);
public class EventClickEventArgs : EventArgs
{
private string value;
public string Value
{
get { return value; }
}
public EventClickEventArgs(string value)
{
this.value = value;
}
}
public class FreeClickEventArgs : EventArgs
{
private DateTime start;
private string resource;
public DateTime Start
{
get { return start; }
}
public string Resource
{
get { return resource; }
}
public FreeClickEventArgs(DateTime start)
{
this.start = start;
}
public FreeClickEventArgs(DateTime start, string resource)
{
this.start = start;
this.resource = resource;
}
}
}
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System;
namespace DayPilot.Web.Ui
{
/// <summary>
/// Delegate for passing an event primary key.
/// </summary>
public delegate void EventClickDelegate(object sender, EventClickEventArgs e);
/// <summary>
/// Delegate for passing a starting time.
/// </summary>
public delegate void FreeClickDelegate(object sender, FreeClickEventArgs e);
public class EventClickEventArgs : EventArgs
{
private string value;
public string Value
{
get { return value; }
}
public EventClickEventArgs(string value)
{
this.value = value;
}
}
public class FreeClickEventArgs : EventArgs
{
private DateTime start;
private string resource;
public DateTime Start
{
get { return start; }
}
public string Resource
{
get { return resource; }
}
public FreeClickEventArgs(DateTime start)
{
this.start = start;
}
public FreeClickEventArgs(DateTime start, string resource)
{
this.start = start;
this.resource = resource;
}
}
}

View File

@@ -1,45 +1,45 @@
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
namespace DayPilot.Web.Ui
{
/// <summary>
/// Behavior of the non-business hours.
/// </summary>
public enum NonBusinessHoursBehavior
{
/// <summary>
/// Hides the non-business hours if there is no event in that time.
/// </summary>
HideIfPossible,
/// <summary>
/// Always hides the non-business hours.
/// </summary>
Hide,
/// <summary>
/// Always shows the non-business hours.
/// </summary>
Show
}
}
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
namespace DayPilot.Web.Ui
{
/// <summary>
/// Behavior of the non-business hours.
/// </summary>
public enum NonBusinessHoursBehavior
{
/// <summary>
/// Hides the non-business hours if there is no event in that time.
/// </summary>
HideIfPossible,
/// <summary>
/// Always hides the non-business hours.
/// </summary>
Hide,
/// <summary>
/// Always shows the non-business hours.
/// </summary>
Show
}
}

View File

@@ -1,87 +1,87 @@
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System;
namespace DayPilot.Web.Ui
{
/// <summary>
/// Class representing a resource <see cref="DayPilotScheduler">DayPilotScheduler</see>.
/// </summary>
[Serializable]
public class Resource
{
private string val;
private string name;
/// <summary>
/// Default constructor.
/// </summary>
public Resource()
{
}
/// <summary>
/// Constructor that sets the default values.
/// </summary>
/// <param name="name">Row name (visible).</param>
/// <param name="val">Row value (id).</param>
public Resource(string name, string val)
{
this.name = name;
this.val = val;
}
/// <summary>
/// Row value (id).
/// </summary>
public string Value
{
get { return val; }
set { val = value; }
}
/// <summary>
/// Get or set the row name (<see cref="Resource.Name">Row.Name</see>).
/// </summary>
public string Name
{
get { return name; }
set { name = value; }
}
///<summary>
///Returns a <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
///</summary>
///
///<returns>
///A <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
///</returns>
///<filterpriority>2</filterpriority>
public override string ToString()
{
return Name;
}
}
}
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System;
namespace DayPilot.Web.Ui
{
/// <summary>
/// Class representing a resource <see cref="DayPilotScheduler">DayPilotScheduler</see>.
/// </summary>
[Serializable]
public class Resource
{
private string val;
private string name;
/// <summary>
/// Default constructor.
/// </summary>
public Resource()
{
}
/// <summary>
/// Constructor that sets the default values.
/// </summary>
/// <param name="name">Row name (visible).</param>
/// <param name="val">Row value (id).</param>
public Resource(string name, string val)
{
this.name = name;
this.val = val;
}
/// <summary>
/// Row value (id).
/// </summary>
public string Value
{
get { return val; }
set { val = value; }
}
/// <summary>
/// Get or set the row name (<see cref="Resource.Name">Row.Name</see>).
/// </summary>
public string Name
{
get { return name; }
set { name = value; }
}
///<summary>
///Returns a <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
///</summary>
///
///<returns>
///A <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see>.
///</returns>
///<filterpriority>2</filterpriority>
public override string ToString()
{
return Name;
}
}
}

View File

@@ -1,155 +1,155 @@
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System.Collections;
using System.ComponentModel;
using DayPilot.Web.Ui.Serialization;
namespace DayPilot.Web.Ui
{
/// <summary>
/// Collection of resources definitions.
/// </summary>
[TypeConverter(typeof(ResourceCollectionConverter))]
public class ResourceCollection : CollectionBase
{
internal bool designMode;
/// <summary>
/// Gets the specified <see cref="Resource">Resource</see>.
/// </summary>
/// <param name="index">Item index</param>
/// <returns>Resource at the specified position.</returns>
public Resource this[int index]
{
get
{
return ((Resource)List[index]);
}
set
{
List[index] = value;
}
}
/// <summary>
/// Converts ResourceCollection to ArrayList.
/// </summary>
/// <returns>ArrayList with ResourceCollection items.</returns>
public ArrayList ToArrayList()
{
ArrayList retArray = new ArrayList();
for (int i = 0; i < this.Count; i++)
{
retArray.Add(this[i]);
}
return retArray;
}
/// <summary>
/// Adds a new <see cref="Resource">Resource</see> to the collection.
/// </summary>
/// <param name="value">Resource to be added.</param>
/// <returns></returns>
public int Add(Resource value)
{
return (List.Add(value));
}
/// <summary>
/// Adds a new <see cref="Resource">Resource</see> to the collection.
/// </summary>
/// <param name="name">Resource name</param>
/// <param name="id">Resource id</param>
/// <returns></returns>
public int Add(string name, string id)
{
return Add(new Resource(name, id));
}
/// <summary>
/// Determines the index of a specific item in the collection.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public int IndexOf(Resource value)
{
return (List.IndexOf(value));
}
/// <summary>
/// Inserts a new resource at the specified position.
/// </summary>
/// <param name="index">New resource position.</param>
/// <param name="value">Resource to be added.</param>
public void Insert(int index, Resource value)
{
List.Insert(index, value);
}
/// <summary>
/// Removes a Resource from the collection.
/// </summary>
/// <param name="value">Resource to be removed.</param>
public void Remove(Resource value)
{
List.Remove(value);
}
/// <summary>
/// Determines whether the collection contains a specified resource.
/// </summary>
/// <param name="value">Resource to be found.</param>
/// <returns>True if the collection contains the resource</returns>
public bool Contains(Resource value)
{
return (List.Contains(value));
}
/// <summary>
/// Creates a new collection from an ArrayList.
/// </summary>
/// <param name="items">ArrayList that contains the new resources.</param>
public ResourceCollection(ArrayList items)
: base()
{
for (int i = 0; i < items.Count; i++)
{
if (items[i] is Resource)
{
this.Add((Resource)items[i]);
}
}
}
/// <summary>
/// Creates a new ResourceCollection.
/// </summary>
public ResourceCollection()
: base()
{ }
}
}
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System.Collections;
using System.ComponentModel;
using DayPilot.Web.Ui.Serialization;
namespace DayPilot.Web.Ui
{
/// <summary>
/// Collection of resources definitions.
/// </summary>
[TypeConverter(typeof(ResourceCollectionConverter))]
public class ResourceCollection : CollectionBase
{
internal bool designMode;
/// <summary>
/// Gets the specified <see cref="Resource">Resource</see>.
/// </summary>
/// <param name="index">Item index</param>
/// <returns>Resource at the specified position.</returns>
public Resource this[int index]
{
get
{
return ((Resource)List[index]);
}
set
{
List[index] = value;
}
}
/// <summary>
/// Converts ResourceCollection to ArrayList.
/// </summary>
/// <returns>ArrayList with ResourceCollection items.</returns>
public ArrayList ToArrayList()
{
ArrayList retArray = new ArrayList();
for (int i = 0; i < this.Count; i++)
{
retArray.Add(this[i]);
}
return retArray;
}
/// <summary>
/// Adds a new <see cref="Resource">Resource</see> to the collection.
/// </summary>
/// <param name="value">Resource to be added.</param>
/// <returns></returns>
public int Add(Resource value)
{
return (List.Add(value));
}
/// <summary>
/// Adds a new <see cref="Resource">Resource</see> to the collection.
/// </summary>
/// <param name="name">Resource name</param>
/// <param name="id">Resource id</param>
/// <returns></returns>
public int Add(string name, string id)
{
return Add(new Resource(name, id));
}
/// <summary>
/// Determines the index of a specific item in the collection.
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public int IndexOf(Resource value)
{
return (List.IndexOf(value));
}
/// <summary>
/// Inserts a new resource at the specified position.
/// </summary>
/// <param name="index">New resource position.</param>
/// <param name="value">Resource to be added.</param>
public void Insert(int index, Resource value)
{
List.Insert(index, value);
}
/// <summary>
/// Removes a Resource from the collection.
/// </summary>
/// <param name="value">Resource to be removed.</param>
public void Remove(Resource value)
{
List.Remove(value);
}
/// <summary>
/// Determines whether the collection contains a specified resource.
/// </summary>
/// <param name="value">Resource to be found.</param>
/// <returns>True if the collection contains the resource</returns>
public bool Contains(Resource value)
{
return (List.Contains(value));
}
/// <summary>
/// Creates a new collection from an ArrayList.
/// </summary>
/// <param name="items">ArrayList that contains the new resources.</param>
public ResourceCollection(ArrayList items)
: base()
{
for (int i = 0; i < items.Count; i++)
{
if (items[i] is Resource)
{
this.Add((Resource)items[i]);
}
}
}
/// <summary>
/// Creates a new ResourceCollection.
/// </summary>
public ResourceCollection()
: base()
{ }
}
}

View File

@@ -1,136 +1,136 @@
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System;
using System.Collections;
using System.ComponentModel;
using Encoder=DayPilot.Utils.Encoder;
namespace DayPilot.Web.Ui.Serialization
{
/// <summary>
/// Internal class for serializing ResourceCollection (ViewState).
/// </summary>
public class ResourceCollectionConverter : TypeConverter
{
/// <summary>
///
/// </summary>
/// <param name="context"></param>
/// <param name="sourceType"></param>
/// <returns></returns>
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
if (sourceType == typeof(String))
return true;
return base.CanConvertFrom(context, sourceType);
}
/// <summary>
///
/// </summary>
/// <param name="context"></param>
/// <param name="destinationType"></param>
/// <returns></returns>
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
if (destinationType == typeof(String))
return true;
return base.CanConvertTo(context, destinationType);
}
/// <summary>
///
/// </summary>
/// <param name="context"></param>
/// <param name="culture"></param>
/// <param name="value"></param>
/// <returns></returns>
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
String state = value as String;
if (state == null)
{
return base.ConvertFrom(context, culture, value);
}
if (state == String.Empty)
{
return new ResourceCollection();
}
String[] parts = state.Split('&');
ResourceCollection collection = new ResourceCollection();
foreach (string encRes in parts)
{
string[] props = Encoder.UrlDecode(encRes).Split('&');
Resource r = new Resource();
r.Name = Encoder.UrlDecode(props[0]);
r.Value = Encoder.UrlDecode(props[1]);
collection.Add(r);
}
return collection;
}
/// <summary>
///
/// </summary>
/// <param name="context"></param>
/// <param name="culture"></param>
/// <param name="value"></param>
/// <param name="destinationType"></param>
/// <returns></returns>
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
if (destinationType == null)
throw new ArgumentException("destinationType");
ResourceCollection collection = value as ResourceCollection;
if (collection == null)
{
return base.ConvertTo(context, culture, value, destinationType);
}
if (collection.designMode)
{
return "(Collection)";
}
ArrayList al = new ArrayList();
foreach (Resource r in collection)
{
ArrayList properties = new ArrayList();
properties.Add(r.Name);
properties.Add(r.Value);
al.Add(Encoder.UrlEncode(properties));
}
return Encoder.UrlEncode(al);
}
}
}
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
using System;
using System.Collections;
using System.ComponentModel;
using Encoder=DayPilot.Utils.Encoder;
namespace DayPilot.Web.Ui.Serialization
{
/// <summary>
/// Internal class for serializing ResourceCollection (ViewState).
/// </summary>
public class ResourceCollectionConverter : TypeConverter
{
/// <summary>
///
/// </summary>
/// <param name="context"></param>
/// <param name="sourceType"></param>
/// <returns></returns>
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
if (sourceType == typeof(String))
return true;
return base.CanConvertFrom(context, sourceType);
}
/// <summary>
///
/// </summary>
/// <param name="context"></param>
/// <param name="destinationType"></param>
/// <returns></returns>
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
if (destinationType == typeof(String))
return true;
return base.CanConvertTo(context, destinationType);
}
/// <summary>
///
/// </summary>
/// <param name="context"></param>
/// <param name="culture"></param>
/// <param name="value"></param>
/// <returns></returns>
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
String state = value as String;
if (state == null)
{
return base.ConvertFrom(context, culture, value);
}
if (state == String.Empty)
{
return new ResourceCollection();
}
String[] parts = state.Split('&');
ResourceCollection collection = new ResourceCollection();
foreach (string encRes in parts)
{
string[] props = Encoder.UrlDecode(encRes).Split('&');
Resource r = new Resource();
r.Name = Encoder.UrlDecode(props[0]);
r.Value = Encoder.UrlDecode(props[1]);
collection.Add(r);
}
return collection;
}
/// <summary>
///
/// </summary>
/// <param name="context"></param>
/// <param name="culture"></param>
/// <param name="value"></param>
/// <param name="destinationType"></param>
/// <returns></returns>
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
if (destinationType == null)
throw new ArgumentException("destinationType");
ResourceCollection collection = value as ResourceCollection;
if (collection == null)
{
return base.ConvertTo(context, culture, value, destinationType);
}
if (collection.designMode)
{
return "(Collection)";
}
ArrayList al = new ArrayList();
foreach (Resource r in collection)
{
ArrayList properties = new ArrayList();
properties.Add(r.Name);
properties.Add(r.Value);
al.Add(Encoder.UrlEncode(properties));
}
return Encoder.UrlEncode(al);
}
}
}

View File

@@ -1,39 +1,39 @@
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
namespace DayPilot.Web.Ui
{
/// <summary>
/// Options for the time format.
/// </summary>
public enum TimeFormat
{
/// <summary>
/// 12-hours time format (e.g. 2 p.m.)
/// </summary>
Clock12Hours,
/// <summary>
/// 24-hours time format (e.g. 14:00)
/// </summary>
Clock24Hours
}
}
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
namespace DayPilot.Web.Ui
{
/// <summary>
/// Options for the time format.
/// </summary>
public enum TimeFormat
{
/// <summary>
/// 12-hours time format (e.g. 2 p.m.)
/// </summary>
Clock12Hours,
/// <summary>
/// 24-hours time format (e.g. 14:00)
/// </summary>
Clock24Hours
}
}

View File

@@ -1,40 +1,40 @@
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
namespace DayPilot.Web.Ui
{
/// <summary>
/// Summary description for UserActionHandling.
/// </summary>
public enum UserActionHandling
{
/// <summary>
/// It should run a JavaScript action.
/// </summary>
JavaScript,
/// <summary>
/// It should call a PostBack.
/// </summary>
PostBack
}
}
/*
Copyright <20> 2005 - 2008 Annpoint, s.r.o.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-------------------------------------------------------------------------
NOTE: Reuse requires the following acknowledgement (see also NOTICE):
This product includes DayPilot (http://www.daypilot.org) developed by Annpoint, s.r.o.
*/
namespace DayPilot.Web.Ui
{
/// <summary>
/// Summary description for UserActionHandling.
/// </summary>
public enum UserActionHandling
{
/// <summary>
/// It should run a JavaScript action.
/// </summary>
JavaScript,
/// <summary>
/// It should call a PostBack.
/// </summary>
PostBack
}
}