class %ZEN.ComponentEx.schedulePane
extends %ZEN.Component.component
Displays a daily schedule for a given time period
as an HTML component. The schedule displays time slots
for one or more days. User-defined scheduled items are
placed on top of the appropriate time slots.
Controlling the Display of the Schedule
The
view property controls what timespan
is displayed: day, week, or month.
The
date controls what time period
is displayed. If a weekly
view is used, then
the week containing
date is displayed.
The
interval property specifies the size of each time slot
in minutes.
while the
cellHeight property
specifies how tall each slot will be (in pixels).
The number of intervals displayed for each day is determined by the
startTime and
endTime properties;
these provide the default starting and ending times for each day (in minutes from
midnight). If there are scheduled items outside this range, additional
slots are added to make the items visible.
When the user clicks on a cell, the
onselectitem
event handler is invoked. This handler is passed 2 variables:
id-the user defined id value for a scheduled
item as provided by the
OnGetScheduleInfo callback (or null for an empty cell);
and
time-the time value
associated with the cell (in yyyy-mm-dd hh:mm:ss format).
Providing Data for the Schedule
The scheduled items are provided by the user-defined
server-side callback method
OnGetScheduleInfo.
This callback is passed an array of parameter values (from the
parameters collection; the starting day value (as
$H format) and the ending day value (also as $H format). It returns
an array containing a list of items to display.
The array of scheduled items takes the form:
pInfo(day,time,n) = $LB(duration,id,text,type,style)
Where
day is the day ($H) for the item;
time is the start time (in minutes from midnight)
for the item;
n is a arbitrary number (typically 1)
used just in case there are two or more items with the same day and time
value. The data for each element contains
duration, length of the item in minutes;
id, a logical id value associated with this item
(and passed on to the
onselectitem event handler;
text, text to display within the item;
type, indicates the type of item: 0 is "unavailable"
time slot and 1 is a scheduled time slot;
style is option css style to apply to the time slot.
You can also provide day-wide styles by using the top-nodes of the
array:
pInfo(day) = "css style for this day"
For example:
parameter DOMAIN = "%ZEN";
Localization domain
property OnGetScheduleInfo
as %ZEN.Datatype.delegator(FORMALSPEC="&pParms:%String,pStartDate:%Date,pEndDate:%Date,&pInfo:%List",RETURNTYPE="%Boolean");
Name of Server-side callback method to call to get information
used to display the schedule.
This must be the name of a server-only method in the page
class that contains this component.
property caption
as %ZEN.Datatype.caption(ZENEXPRESSION=1);
If provided, this text is displayed as a caption
along the top of the schedule. The text is *not*
HTML escaped, so that it can contain markup.
property cellHeight
as %ZEN.Datatype.length(ZENEXPRESSION=1) [ InitialExpression = 30 ];
Height of time slot cell.
property date
as %ZEN.Datatype.string(ZENEXPRESSION=1);
Date to display (in YYYY-MM-DD format).
If not specified, the current day is used.
The schedule will display a range of days that contain
this date value. The range of values depends on the current
value of the view property.
property dateFormat
as %ZEN.Datatype.integer(MAXVAL=13,MINVAL=-1) [ InitialExpression = -1 ];
Date format used for sub-caption. Refer to the
$ZDT function for details.
property dayList
as %ZEN.Datatype.csv(ZENLOCALIZE=1) [ InitialExpression = $$$Text("Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday") ];
List of localized day names.
property endTime
as %ZEN.Datatype.integer(MAXVAL=1440,MINVAL=0,ZENEXPRESSION=1) [ InitialExpression = 1080 ];
Ending time (in minutes from midnight) to show for the daily
calendar.
property firstDayOfWeek
as %ZEN.Datatype.integer(MAXVAL=6,MINVAL=0) [ InitialExpression = 0 ];
Specified which day of the week (Sunday=0, Saturday = 6) is displayed as
the starting day of the week.
This allows for customizing for locales in which weeks start with
other days of the week.
property headerHeight
as %ZEN.Datatype.length(ZENEXPRESSION=1) [ InitialExpression = 40 ];
Height of header cells.
property interval
as %ZEN.Datatype.integer(MINVAL=5,ZENEXPRESSION=1) [ InitialExpression = 30 ];
Specifies the size (duration) of the calendar slots (in minutes).
property monthList
as %ZEN.Datatype.csv(ZENLOCALIZE=1) [ InitialExpression = $$$Text("January,February,March,April,May,June,July,August,September,October,November,December") ];
List of localized month names.
property onchangeview
as %ZEN.Datatype.eventHandler;
onchangeview event handler:
If defined, this event is fired when the user changes the view mode of the schedule (such as from month to day view).
property onselectitem
as %ZEN.Datatype.eventHandler;
onselectitem event handler:
If defined, this event is fired when the user clicks on an item within the schedule.
property parameters
as array of %ZEN.Auxiliary.parameter(XMLKEYNAME="paramName",XMLNAME="parameter",XMLPROJECTION="ELEMENT");
User-defined set of parameters. These are passed
along to the OnGetScheduleInfo
callback method.
property selectedInterval
as %ZEN.Datatype.integer(XMLPROJECTION="none",ZENSETTING=0);
Length (in minutes) of the current selected cell(s).
property selectedTime
as %ZEN.Datatype.integer(XMLPROJECTION="none",ZENSETTING=0);
Start time of the current selected cell(s).
property shortDayList
as %ZEN.Datatype.csv(ZENLOCALIZE=1) [ InitialExpression = $$$Text("Sun,Mon,Tue,Wed,Thu,Fri,Sat") ];
List of localized short day names.
property shortMonthList
as %ZEN.Datatype.csv(ZENLOCALIZE=1) [ InitialExpression = $$$Text("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec") ];
List of localized short month names.
property startTime
as %ZEN.Datatype.integer(MAXVAL=1440,MINVAL=0,ZENEXPRESSION=1) [ InitialExpression = 480 ];
Starting time (in minutes from midnight) to show for the daily
calendar.
property view
as %ZEN.Datatype.string(MAXLEN=20,VALUELIST=",day,week,month",ZENEXPRESSION=1) [ InitialExpression = "day" ];
Specifies what type of schedule to display.
classmethod %DaysInMonth(y, m)
as %Integer
Return number of days in the given year and month.
method %DrawHTML()
Draw the contents of this component.
method %DrawHeader()
Draw the header for the schedule.
method %DrawMonthView(ByRef pInfo, pStartDate As %Date, pEndDate As %Date)
Draw the month view for the schedule.
classmethod %FormatTime(pTime As %Integer)
as %String
Take a time value (number of minutes from midnight) and return
a formatted display value.
classmethod %GetMonthRange(pDate As %Date, Output pEndDate, pStartOfWeek As %Integer = 0)
as %Date
Given a date (as a $H value), return the
date (as a $H value) of the first and last dates to display for the month the date is in.
method %GetScheduleInfo(pStartDate As %Date, pEndDate As %Date, ByRef pInfo As %String)
as %Status
Get an array (pInfo) containing info used to show the schedule.
This array is subscripted by item number.
classmethod %GetStartOfWeek(pDate As %Date, pStartOfWeek As %Integer = 0)
as %Date
Given a date (as a $H value), return the
date (as a $H value) of the start of the week the date is in.
pStartOfWeek indicates which is the starting day of the week (Sunday=0, Saturday = 6).
classmethod %IsLeapYear(y)
as %Boolean
Return whether the given year is a leap year.
method getDropTimeSlot()
[ Language = javascript ]
Return information about the most recent
data drop. This is intended to be called from
a ondrop handler.
It returns the time slot where the data was dropped in
yyyy-mm-dd hh:mm:ss format or '' if data was not dropped
on a valid slot.
method mouseClickHandler(evt, type, time, cellId, userId, duration)
[ Language = javascript ]
Mouse click handler
type can be: -1 for unassigned slot, 0 for unavailable, 1 for booked item.
cellId is HTML id of the item
itemId is the user provided id of the item.
method mouseDownHandler(evt)
[ Language = javascript ]
Grab mouse down to prevent text selection.
method moveToNewDay(delta)
[ Language = javascript ]
Move ahead or back the given number of days.
method nextPeriod()
[ Language = javascript ]
Display the next time period.
method onRefreshContents()
[ Language = javascript ]
This client callback is called just from refreshContents
just after the new HTML is delivered from the server.
method previousPeriod()
[ Language = javascript ]
Display the previous time period.
method setDate(date)
[ Language = javascript ]
Set the date mode of this control.
method setInterval(interval)
[ Language = javascript ]
Set the interval property of this control.
method setProperty(property, value, value2)
[ Language = javascript ]
Set the value of a named property.
method setView(view)
[ Language = javascript ]
Set the view mode of this control.