',
'
',
@@ -120,7 +120,7 @@ calendar.Calendars = zk.$extends(zul.Widget, {
this.$supers('bind_', arguments);
this._dragItems = {};
this._ghost = {};
- this._eventKey = {};
+ this._itemKey = {};
this.params = {};
zWatch.listen({onSize: this, onShow: this, onResponse: this});
},
@@ -140,7 +140,7 @@ calendar.Calendars = zk.$extends(zul.Widget, {
}
}
}
- this._dragItems = this._ghost = this._eventKey = this.params = this._restoreCE = null;
+ this._dragItems = this._ghost = this._itemKey = this.params = this._restoreCE = null;
this.$supers('unbind_', arguments);
},
@@ -154,16 +154,16 @@ calendar.Calendars = zk.$extends(zul.Widget, {
this.clearGhost();
},
- processEvtData_: function (event) {
- event.isLocked = event.isLocked == 'true' ? true : false;
- event.beginDate = new Date(zk.parseInt(event.beginDate));
- event.endDate = new Date(zk.parseInt(event.endDate));
+ processItemData_: function (item) {
+ item.isLocked = item.isLocked == 'true' ? true : false;
+ item.beginDate = new Date(zk.parseInt(item.beginDate));
+ item.endDate = new Date(zk.parseInt(item.endDate));
- event.zoneBd = this.fixTimeZoneFromServer(event.beginDate);
- event.zoneEd = this.fixTimeZoneFromServer(event.endDate);
+ item.zoneBd = this.fixTimeZoneFromServer(item.beginDate);
+ item.zoneEd = this.fixTimeZoneFromServer(item.endDate);
- var key = event.key,
- period = this._eventKey[key],
+ var key = item.key,
+ period = this._itemKey[key],
inMon = this.mon;
if (!period) {
var keyDate = zk.fmt.Date.parseDate(key);
@@ -175,36 +175,36 @@ calendar.Calendars = zk.$extends(zul.Widget, {
if (inMon)
period.week = Math.floor(keyDate / 7);
- this._eventKey[key] = period;
+ this._itemKey[key] = period;
}
- event._preOffset = period.day;
+ item._preOffset = period.day;
if (inMon)
- event.startWeek = this._weekDates[period.week];
+ item.startWeek = this._weekDates[period.week];
- return event;
+ return item;
},
createChildrenWidget_: function () {
- this.cleanEvtAry_();
- //append all event be widget children
- for (var i = 0, j = this._events.length; i < j; i++) {
- var events = this._events[i];
- for (var k = 0, l = events.length; k < l; k++) {
- var event = this.processEvtData_(events[k]);
+ this.cleanItemAry_();
+ //append all item be widget children
+ for (var i = 0, j = this._items.length; i < j; i++) {
+ var items = this._items[i];
+ for (var k = 0, l = items.length; k < l; k++) {
+ var item = this.processItemData_(items[k]);
//over range
//Bug ZKCAL-36: should check if event endDate and view begin Date are equal
- if (event.zoneBd >= this.zoneEd || event.zoneEd <= this.zoneBd)
+ if (item.zoneBd >= this.zoneEd || item.zoneEd <= this.zoneBd)
continue;
- this.processChildrenWidget_(_isExceedOneDay(this, event), event);
+ this.processChildrenWidget_(_isExceedOneDay(this, item), item);
}
}
},
- processChildrenWidget_: function (isExceedOneDay, event) {
+ processChildrenWidget_: function (isExceedOneDay, item) {
},
- drawEvent_: function (preOffset, className, tr, dayNode) {
+ drawItem_: function (preOffset, className, tr, dayNode) {
var html = [],
s = '
';
for (var n = preOffset; n--;)
@@ -323,7 +323,7 @@ calendar.Calendars = zk.$extends(zul.Widget, {
change: cls._changeDaydrag,
draw: cls._drawDaydrag,
ignoredrag: cls._ignoreDaydrag
- }): null;
+ }) : null;
},
addDayClickEvent_: function (element) {
@@ -346,10 +346,10 @@ calendar.Calendars = zk.$extends(zul.Widget, {
},
//ZKCAL-48: support tooltip
doTooltipOver_: function (evt) {
- if (this.isListen('onEventTooltip')) {
+ if (this.isListen('onItemTooltip')) {
var zcls = this.getZclass(),
node = evt.target,
- ce = zk.Widget.$(node).event;
+ ce = zk.Widget.$(node).item;
if (jq(node).hasClass(zcls + '-evt-faker-more') && node.parentNode.id.indexOf('-frow') > 0)
return;
@@ -367,7 +367,7 @@ calendar.Calendars = zk.$extends(zul.Widget, {
var p = [Math.round(evt.pageX), Math.round(evt.pageY)],
data = {data: [ce.id, p[0], p[1], jq.innerWidth(), jq.innerHeight()]},
- e = new zk.Event(this, 'onEventTooltip', data, null, evt.domEvent),
+ e = new zk.Event(this, 'onItemTooltip', data, null, evt.domEvent),
self = this;
setTimeout(function () {
@@ -389,80 +389,80 @@ calendar.Calendars = zk.$extends(zul.Widget, {
this.$supers('doTooltipOut_', arguments);
},
- setAddDayEvent: function (eventArray) {
- eventArray = jq.evalJSON(eventArray);
- if (!eventArray.length) return;
+ setAddDayItem: function (itemArray) {
+ itemArray = jq.evalJSON(itemArray);
+ if (!itemArray.length) return;
this.clearGhost();
var hasAdd = {day: false, daylong: false};
- for (var event; (event = eventArray.shift());) {
- if (zk.Widget.$(event.id)) continue;
- event = this.processEvtData_(event);
+ for (var item; (item = itemArray.shift());) {
+ if (zk.Widget.$(item.id)) continue;
+ item = this.processItemData_(item);
//over range
- //Bug ZKCAL-36: should check if event endDate and view begin Date are equal
- if (event.zoneBd >= this.zoneEd || event.zoneEd <= this.zoneBd)
+ //Bug ZKCAL-36: should check if item endDate and view begin Date are equal
+ if (item.zoneBd >= this.zoneEd || item.zoneEd <= this.zoneBd)
continue;
- var isExceedOneDay = _isExceedOneDay(this, event);
- this.processChildrenWidget_(isExceedOneDay, event);
+ var isExceedOneDay = _isExceedOneDay(this, item);
+ this.processChildrenWidget_(isExceedOneDay, item);
hasAdd[isExceedOneDay ? 'daylong' : 'day'] = true;
}
- this.reAlignEvents_(hasAdd);
+ this.reAlignItems_(hasAdd);
},
- setModifyDayEvent: function (eventArray) {
- eventArray = jq.evalJSON(eventArray);
- if (!eventArray.length) return;
+ setModifyDayItem: function (itemArray) {
+ itemArray = jq.evalJSON(itemArray);
+ if (!itemArray.length) return;
this.clearGhost();
var hasAdd = {day: false, daylong: false};
- for (var event; (event = eventArray.shift());) {
- var childWidget = zk.Widget.$(event.id),
+ for (var item; (item = itemArray.shift());) {
+ var childWidget = zk.Widget.$(item.id),
inMon = this.mon,
isBeginTimeChange = false;
- event = this.processEvtData_(event);
+ item = this.processItemData_(item);
//Bug ZKCAL-47: childWidget may not in the range and has beem removed.
if (!childWidget) {
- if (event.zoneBd > this.zoneEd || event.zoneEd < this.zoneBd) {
- //if event still not in the range, skip
+ if (item.zoneBd > this.zoneEd || item.zoneEd < this.zoneBd) {
+ //if item still not in the range, skip
continue;
} else {
- //if event is in the range, create childWidget.
- this.processChildrenWidget_(_isExceedOneDay(this, event), event);
- childWidget = zk.Widget.$(event.id);
+ //if item is in the range, create childWidget.
+ this.processChildrenWidget_(_isExceedOneDay(this, item), item);
+ childWidget = zk.Widget.$(item.id);
}
}
if (inMon &&
- (isBeginTimeChange = childWidget.isBeginTimeChange(event)))
+ (isBeginTimeChange = childWidget.isBeginTimeChange(item)))
this.removeNodeInArray_(childWidget);
//over range
- if (event.zoneBd > this.zoneEd || event.zoneEd < this.zoneBd) {
+ if (item.zoneBd > this.zoneEd || item.zoneEd < this.zoneBd) {
if (!inMon)
this.removeNodeInArray_(childWidget, hasAdd);
this.removeChild(childWidget);
continue;
}
- var isExceedOneDay = _isExceedOneDay(this, event),
+ var isExceedOneDay = _isExceedOneDay(this, item),
clsName = childWidget.className,
- isDayEvent = inMon ? clsName == 'calendar.DayOfMonthEvent' : clsName == 'calendar.DayEvent',
- isChangeEvent = isExceedOneDay ? isDayEvent : !isDayEvent;
+ isDayItem = inMon ? clsName == 'calendar.DayOfMonthItem' : clsName == 'calendar.DayItem',
+ isChangeEvent = isExceedOneDay ? isDayItem : !isDayItem;
if (isChangeEvent) {
if (!inMon)
- this[isDayEvent ? '_dayEvents' : '_daylongEvents'].$remove(childWidget.$n());
+ this[isDayItem ? '_dayItems' : '_daylongItems'].$remove(childWidget.$n());
this.removeChild(childWidget);
- this.processChildrenWidget_(isExceedOneDay, event);
+ this.processChildrenWidget_(isExceedOneDay, item);
hasAdd.day = hasAdd.daylong = true;
} else {
- childWidget.event = event;
+ childWidget.item = item;
childWidget.update(isBeginTimeChange);
if (inMon) {
@@ -475,23 +475,23 @@ calendar.Calendars = zk.$extends(zul.Widget, {
}
}
- this.reAlignEvents_(hasAdd);
+ this.reAlignItems_(hasAdd);
},
- setRemoveDayEvent: function (eventArray) {
- eventArray = jq.evalJSON(eventArray);
- if (!eventArray.length) return;
+ setRemoveDayItem: function (itemArray) {
+ itemArray = jq.evalJSON(itemArray);
+ if (!itemArray.length) return;
var hasAdd = {day: false, daylong: false};
- for (var event; (event = eventArray.shift());) {
- var childWidget = zk.Widget.$(event.id);
+ for (var item; (item = itemArray.shift());) {
+ var childWidget = zk.Widget.$(item.id);
if (!childWidget) continue;
this.removeNodeInArray_(childWidget, hasAdd);
this.removeChild(childWidget);
}
- this.reAlignEvents_(hasAdd);
+ this.reAlignItems_(hasAdd);
},
dateSorting_: function (x, y) {
@@ -562,9 +562,9 @@ calendar.Calendars = zk.$extends(zul.Widget, {
onPopupClick: function (evt) {
var childWidget = zk.Widget.$(evt.target);
- if (childWidget.$instanceof(calendar.Event)) {
+ if (childWidget.$instanceof(calendar.Item)) {
var p = [Math.round(evt.pageX), Math.round(evt.pageY)]; //ZKCAL-42: sometimes it returns float number in IE 10
- this.fire('onEventEdit',{data:[childWidget.uuid, p[0], p[1], jq.innerWidth(), jq.innerHeight()]});
+ this.fire('onItemEdit',{data:[childWidget.uuid, p[0], p[1], jq.innerWidth(), jq.innerHeight()]});
evt.stop();
}
},
@@ -593,8 +593,8 @@ calendar.Calendars = zk.$extends(zul.Widget, {
jq(n).hasClass(widget.getZclass() + '-month-date-cnt'))
return true;
if (n.nodeType == 1 && jq(n).hasClass(p._fakerMoreCls) && !jq(n).hasClass(p._fakerNoMoreCls) ||
- (targetWidget.$instanceof(calendar.Event) &&
- (!n.parentNode || targetWidget.event.isLocked)))
+ (targetWidget.$instanceof(calendar.Item) &&
+ (!n.parentNode || targetWidget.item.isLocked)))
return true;
return false;
},
@@ -607,7 +607,7 @@ calendar.Calendars = zk.$extends(zul.Widget, {
inMon = widget.mon,
dataObj = widget.getDragDataObj_(),
targetWidget = zk.Widget.$(evt.domEvent),
- ce = targetWidget.$instanceof(calendar.Event) ? targetWidget.$n() : null,
+ ce = targetWidget.$instanceof(calendar.Item) ? targetWidget.$n() : null,
hs = [];
jq(document.body).prepend(dataObj.getRope(widget, cnt, hs));
var row = dataObj.getRow(cnt),
@@ -649,7 +649,7 @@ calendar.Calendars = zk.$extends(zul.Widget, {
jq(document.body.firstChild).before(jq(faker));
dg.node = jq('#' + uuid + '-dd')[0];
- dg._zdur = _getEventPeriod(targetWidget.event);
+ dg._zdur = _getItemPeriod(targetWidget.item);
dg._zevt = ce;
}
@@ -760,9 +760,9 @@ calendar.Calendars = zk.$extends(zul.Widget, {
if (dg._zevt) {
var zcls = widget.getZclass(),
targetWidget = zk.Widget.$(dg._zevt),
- event = targetWidget.event,
+ item = targetWidget.item,
bd = new Date(widget.zoneBd),
- ebd = new Date(event.zoneBd),
+ ebd = new Date(item.zoneBd),
ddClass = zcls + '-evt-dd',
inMon = widget.mon;
bd = calUtil.addDay(bd, dataObj.getDur(dg));
@@ -780,16 +780,16 @@ calendar.Calendars = zk.$extends(zul.Widget, {
jq(cloneNodes[n]).removeClass(ddClass);
}
- if (!calUtil.isTheSameDay(ebd, event.zoneBd)) {
+ if (!calUtil.isTheSameDay(ebd, item.zoneBd)) {
ce = dg._zevt;
ce.style.visibility = 'hidden';
- var ed = new Date(event.zoneEd);
+ var ed = new Date(item.zoneEd);
ed.setFullYear(bd.getFullYear());
ed.setDate(1);
ed.setMonth(bd.getMonth());
- ed.setDate(bd.getDate() + _getEventPeriod(event) - (_isZeroTime(ed) ? 0 : 1));
- widget.fire('onEventUpdate', {
+ ed.setDate(bd.getDate() + _getItemPeriod(item) - (_isZeroTime(ed) ? 0 : 1));
+ widget.fire('onItemUpdate', {
data: [
dg._zevt.id,
widget.fixTimeZoneFromClient(ebd),
@@ -800,14 +800,14 @@ calendar.Calendars = zk.$extends(zul.Widget, {
jq.innerHeight()
]
});
- widget._restoreCE = ce; //ZKCAL-39: should store calendar event
+ widget._restoreCE = ce; //ZKCAL-39: should store calendar item
}
jq('#' + widget.uuid + '-rope').remove();
jq('#' + widget.uuid + '-dd').remove();
} else {
var newData = dataObj.getNewDate(widget, dg);
- widget.fire('onEventCreate', {
+ widget.fire('onItemCreate', {
data: [
widget.fixTimeZoneFromClient(newData.bd),
widget.fixTimeZoneFromClient(newData.ed),
diff --git a/calendar/src/archive/web/js/calendar/CalendarsDefault.js b/calendar/src/archive/web/js/calendar/CalendarsDefault.js
index aae78f7..8841d4d 100644
--- a/calendar/src/archive/web/js/calendar/CalendarsDefault.js
+++ b/calendar/src/archive/web/js/calendar/CalendarsDefault.js
@@ -14,19 +14,19 @@ it will be useful, but WITHOUT ANY WARRANTY.
*/
(function () {
function _getHightOffsPercent(date, timeslots) {
- var timeslotTime = 60/timeslots,
- bdTimeslot = date.getMinutes()%timeslotTime;
+ var timeslotTime = 60 / timeslots,
+ bdTimeslot = date.getMinutes() % timeslotTime;
if (!bdTimeslot) return 0;
- return bdTimeslot/timeslotTime;
+ return bdTimeslot / timeslotTime;
}
- function _setEvtWgtHeight(wgt, node, id, height) {
- var body = jq(node).find('#'+id+'-body')[0],
+ function _setItemWgtHeight(wgt, node, id, height) {
+ var body = jq(node).find('#' + id + '-body')[0],
inner = body.firstChild.firstChild;
for (var child = jq(node).children()[0]; child; child = child.nextSibling) {
- if (wgt.isLegalChild(child))
+ if (wgt.isLegalChild(child))
height -= child.offsetHeight;
}
height = zk(body).revisedHeight(height);
@@ -36,27 +36,27 @@ it will be useful, but WITHOUT ANY WARRANTY.
}
function _getSlotCount(bd, ed, timeslots) {
- var timeslotTime = 60/timeslots,
- bdHour = (typeof bd) == "number" ? bd: bd.getHours(),
- edHour = (typeof ed) == "number" ? ed: ed.getHours(),
- bdMinu = (typeof bd) == "number" ? 0: bd.getMinutes(),
- edMinu = (typeof ed) == "number" ? 0: ed.getMinutes();
- return (edHour - bdHour) * timeslots +
- (edMinu - bdMinu)/timeslotTime;
+ var timeslotTime = 60 / timeslots,
+ bdHour = (typeof bd) == 'number' ? bd : bd.getHours(),
+ edHour = (typeof ed) == 'number' ? ed : ed.getHours(),
+ bdMinu = (typeof bd) == 'number' ? 0 : bd.getMinutes(),
+ edMinu = (typeof ed) == 'number' ? 0 : ed.getMinutes();
+ return (edHour - bdHour) * timeslots +
+ (edMinu - bdMinu) / timeslotTime;
}
function _updateCntHeight(wgt) {
- var $cnt = jq(wgt.$n("cnt")),
+ var $cnt = jq(wgt.$n('cnt')),
timeslots = wgt._timeslots,
hourCount = wgt._et - wgt._bt,
$firstSlot = $cnt.find('.z-calendars-hour-sep')[0], //fine tune if user customize height by CSS
- slotHeight = $firstSlot ?
+ slotHeight = $firstSlot ?
($firstSlot.offsetHeight + zk($firstSlot).sumStyles('tb', jq.margins) + 1) : 46,
- totalHeight = hourCount * slotHeight * timeslots/2;
+ totalHeight = hourCount * slotHeight * timeslots / 2;
$cnt.find('.z-calendars-week-cnt').height(totalHeight);
jq(wgt.cntRows).find('.z-calendars-week-day-cnt').height(totalHeight).css('margin-bottom', -totalHeight);
- jq(wgt.cntRows).find('.z-calendars-hour-of-day').height(slotHeight * timeslots/2 - 1);
- wgt._slotOffs = 12/timeslots;
+ jq(wgt.cntRows).find('.z-calendars-hour-of-day').height(slotHeight * timeslots / 2 - 1);
+ wgt._slotOffs = 12 / timeslots;
wgt.beginIndex = wgt._bt * timeslots;
}
@@ -74,20 +74,20 @@ it will be useful, but WITHOUT ANY WARRANTY.
var hourRowHtml = '
',
hourSepRowHtml = '
',
html = [];
- for(var i = offset; i--;)
+ for (var i = offset; i--;)
html.push(hourRowHtml);
html = html.join('');
for (var i = ts; i--;)
jq(timeRows[ts - i - 1]).append(html);
html = [];
- for(var i = offset * timeslots/2; i--;)
+ for (var i = offset * timeslots / 2; i--;)
html.push(hourSepRowHtml);
jq(cntRows.previousSibling.lastChild).find('.z-calendars-hour-inner').append(html.join(''));
- } else if (offset < 0){
+ } else if (offset < 0) {
for (var i = ts; i--;)
- jq(timeRows[ts - i - 1]).children('.z-calendars-hour-of-day:gt('+(hourCount-1)+')').remove();
- jq(cntRows.previousSibling.lastChild).find('.z-calendars-hour-sep:gt('+(hourCount * timeslots/2 - 1)+')').remove();
+ jq(timeRows[ts - i - 1]).children('.z-calendars-hour-of-day:gt(' + (hourCount - 1) + ')').remove();
+ jq(cntRows.previousSibling.lastChild).find('.z-calendars-hour-sep:gt(' + (hourCount * timeslots / 2 - 1) + ')').remove();
}
_updateCntHeight(wgt);
@@ -104,7 +104,7 @@ it will be useful, but WITHOUT ANY WARRANTY.
if (!offset) return;
var header = wgt.$n('header'),
- a = wgt.$n("hdarrow");
+ a = wgt.$n('hdarrow');
a.style.left = jq.px((a.parentNode.offsetWidth * ts - a.offsetWidth) - 5);
if (offset > 0) {
var zoneTH = '
',
@@ -112,7 +112,7 @@ it will be useful, but WITHOUT ANY WARRANTY.
zoneHourTD = '
' + jq(cntRows).children('.z-calendars-timezone-end').html() + ' ',
html1 = [], html2 = [], html3 = [];
- for(var i = offset; i--;) {
+ for (var i = offset; i--;) {
html1.push(zoneTH);
html2.push(zoneTD);
html3.push(zoneHourTD);
@@ -120,7 +120,7 @@ it will be useful, but WITHOUT ANY WARRANTY.
jq(header).children('.z-calendars-timezone-end').before(html1.join(''));
jq(cntRows.previousSibling).children('.z-calendars-timezone-end').before(html2.join(''));
jq(cntRows).children('.z-calendars-timezone-end').before(html3.join(''));
- } else if (offset < 0){
+ } else if (offset < 0) {
jq(header).children('.z-calendars-timezone-end').prevAll().slice(ts - 1).remove();
jq(cntRows.previousSibling).children('.z-calendars-timezone-end').prevAll().slice(ts - 1).remove();
jq(cntRows).children('.z-calendars-timezone-end').prevAll().slice(ts - 1).remove();
@@ -137,9 +137,9 @@ it will be useful, but WITHOUT ANY WARRANTY.
return uuid;
}));
var temp = jq('#' + uuid + '-tempblock'),
- hdTable = wgt.$n('header').offsetParent,
+ hdTable = wgt.$n('header').offsetParent,
parent = hdTable.parentNode,
- cnt = wgt.$n('cnt'),
+ cnt = wgt.$n('cnt'),
cntTable = cnt.firstChild;
temp.append(hdTable);
@@ -173,32 +173,32 @@ it will be useful, but WITHOUT ANY WARRANTY.
cIndex = 0;
jq(cells[begin + cIndex].firstChild).append(
widget.ddTemplate.replace(new RegExp("%([1-2])", "g"), function (match, index) {
- return index < 2 ? widget.uuid + '-dd' : 'z-calevent';
+ return index < 2 ? widget.uuid + '-dd' : 'z-calitem';
}));
dg._zoffs.x = x;
dg._zoffs.y = y;
- dg.node = jq('#'+uuid+'-dd')[0];
+ dg.node = jq('#' + uuid + '-dd')[0];
dg.node.parent = jq(cells[begin + cIndex].firstChild);
dg._zecnt = dg.node.childNodes[0].firstChild.firstChild;
- jq(dg.node).addClass(widget.getZclass() + "-evt-ghost");
+ jq(dg.node).addClass(widget.getZclass() + '-evt-ghost');
var r = y + dg.handle.scrollTop - y1;
r = Math.floor(r / ph);
dg.node.style.top = jq.px(r * ph);
var offsHgh = 0,
- body = jq('#'+uuid+'-dd-body')[0],
+ body = jq('#' + uuid + '-dd-body')[0],
height = 0,
inner = body.firstChild.firstChild;
- inner.firstChild.innerHTML =
- widget._dateTime[r*widget._slotOffs] + ' - ' +
- widget._dateTime[r*widget._slotOffs + 12];
+ inner.firstChild.innerHTML =
+ widget._dateTime[r * widget._slotOffs] + ' - ' +
+ widget._dateTime[r * widget._slotOffs + 12];
- for(var child = jq(dg.node).children().get(0);child;child=child.nextSibling){
- if(widget.isLegalChild(child))
- height+=child.offsetHeight;
+ for (var child = jq(dg.node).children().get(0);child;child = child.nextSibling) {
+ if (widget.isLegalChild(child))
+ height += child.offsetHeight;
}
height += zk(body).padBorderHeight();
@@ -238,7 +238,7 @@ it will be useful, but WITHOUT ANY WARRANTY.
if (r < b) b = r;
else if (r > b) e = r;
- if (faker.offsetTop != b * ph)
+ if (faker.offsetTop != b * ph)
faker.style.top = jq.px(b * ph);
var hgh = ((e - b) * ph) - dg._zrzoffs,
@@ -247,9 +247,9 @@ it will be useful, but WITHOUT ANY WARRANTY.
dg._zecnt.style.height = jq.px(hgh);
// Update header
- dg._zhd.innerHTML =
- widget._dateTime[(beginIndex + b)*widget._slotOffs] + ' - ' +
- widget._dateTime[(beginIndex + e)*widget._slotOffs];
+ dg._zhd.innerHTML =
+ widget._dateTime[(beginIndex + b) * widget._slotOffs] + ' - ' +
+ widget._dateTime[(beginIndex + e) * widget._slotOffs];
}
function _createDragEndghost(dg) {
@@ -257,25 +257,25 @@ it will be useful, but WITHOUT ANY WARRANTY.
hgh = dg._zoffs.ph;
dg._zdata = {
- rows: dg.node.offsetTop / hgh,
- cols: dg.node.parentNode.parentNode.cellIndex - widget.ts,
- dur: Math.ceil(dg.node.offsetHeight / hgh),
+ rows: dg.node.offsetTop / hgh,
+ cols: dg.node.parentNode.parentNode.cellIndex - widget.ts,
+ dur: Math.ceil(dg.node.offsetHeight / hgh),
ghostNode: dg.node
- };
+ };
}
function _createDragEnd(dg, evt) {
var widget = dg.control,
rows = dg._zdata.rows,
bd = new Date(widget.zoneBd),
- timeslotTime = 60/widget._timeslots;
+ timeslotTime = 60 / widget._timeslots;
bd.setDate(bd.getDate() + dg._zdata.cols);
- bd.setMilliseconds(0);// clean
+ bd.setMilliseconds(0);// clean
var ed = new Date(bd);
rows += widget.beginIndex;
- bd.setMinutes(bd.getMinutes() + rows * timeslotTime );
- ed.setMinutes(ed.getMinutes() + (rows + dg._zdata.dur) * timeslotTime );
+ bd.setMinutes(bd.getMinutes() + rows * timeslotTime);
+ ed.setMinutes(ed.getMinutes() + (rows + dg._zdata.dur) * timeslotTime);
widget.fireCalEvent(bd, ed, evt);
}
@@ -316,9 +316,9 @@ it will be useful, but WITHOUT ANY WARRANTY.
}
// Update header
r += widget.beginIndex;
- dg._zhd.innerHTML =
- widget._dateTime[zoffs.bi*widget._slotOffs] + ' - ' +
- widget._dateTime[r*widget._slotOffs];
+ dg._zhd.innerHTML =
+ widget._dateTime[zoffs.bi * widget._slotOffs] + ' - ' +
+ widget._dateTime[r * widget._slotOffs];
}
function _resizeDragEndghost(dg) {
@@ -338,10 +338,10 @@ it will be useful, but WITHOUT ANY WARRANTY.
isOverEndTime = edHour > et || (edHour == et && ed.getMinutes() > 0);
if (dur || isOverEndTime) {
- //reset in time range
+ //reset in time range
if (isOverEndTime)
ed.setHours(widget._et, 0);
- ed.setMinutes(ed.getMinutes() + dur * (60/widget._timeslots));
+ ed.setMinutes(ed.getMinutes() + dur * (60 / widget._timeslots));
//reset in time range
if (bd.getHours() < bt)
bd.setHours(bt);
@@ -349,8 +349,8 @@ it will be useful, but WITHOUT ANY WARRANTY.
widget.fireCalEvent(bd, ed, evt, ce.id);
widget._restoreCE = ce;
} else {
- jq('#'+widget.uuid+'-dd').remove();
- ce.style.visibility = "";
+ jq('#' + widget.uuid + '-dd').remove();
+ ce.style.visibility = '';
}
dg._zrz = false;
}
@@ -364,23 +364,23 @@ it will be useful, but WITHOUT ANY WARRANTY.
bt = widget._bt,
et = widget._et,
timeslots = widget._timeslots,
- timeslotTime = 60/timeslots,
+ timeslotTime = 60 / timeslots,
ph = dg._zoffs.ph,
isOverBeginTime = bd.getHours() < bt,
isOverEndTime = edHour > et || (edHour == et && ed.getMinutes() > 0);
- dg._overIndex = 0;
+ dg._overIndex = 0;
if (isOverBeginTime || isOverEndTime) {
- var minutes = (ed-bd) / 60000,
+ var minutes = (ed - bd) / 60000,
id = faker.id;
- _setEvtWgtHeight(widget, faker, targetWgt.uuid,(minutes/60 * timeslots * ph));
+ _setItemWgtHeight(widget, faker, targetWgt.uuid,(minutes / 60 * timeslots * ph));
if (isOverEndTime)
dg._overIndex = _getSlotCount(et, ed, timeslots);
if (isOverBeginTime)
dg._overIndex = _getSlotCount(bd, bt, timeslots);
- }
+ }
dg._zdelta = ce.offsetTop - (evt.pageY + dg.handle.scrollTop - dg._zoffs.t);
}
@@ -397,7 +397,7 @@ it will be useful, but WITHOUT ANY WARRANTY.
cIndex = dg._zoffs.s,
lefts = cnt._lefts,
cells = dg._zcells,
- begin = zoffs.b
+ begin = zoffs.b,
ph = zoffs.ph,
th = zoffs.th;
@@ -429,9 +429,9 @@ it will be useful, but WITHOUT ANY WARRANTY.
}
// Update header
- dg._zhd.innerHTML =
- widget._dateTime[(r + widget.beginIndex)*widget._slotOffs] + ' - ' +
- widget._dateTime[(r + zoffs.ei + dg._overIndex)*widget._slotOffs];
+ dg._zhd.innerHTML =
+ widget._dateTime[(r + widget.beginIndex) * widget._slotOffs] + ' - ' +
+ widget._dateTime[(r + zoffs.ei + dg._overIndex) * widget._slotOffs];
}
function _updateDragEndghost(dg) {
@@ -439,12 +439,12 @@ it will be useful, but WITHOUT ANY WARRANTY.
ce = dg._zevt;
gostNode.parent = jq(gostNode.parentNode);
- dg._zdata = {
+ dg._zdata = {
rows: (ce.offsetTop - gostNode.offsetTop) / dg._zoffs.ph,
- cols: ce.parentNode.parentNode.cellIndex -
- gostNode.parentNode.parentNode.cellIndex,
+ cols: ce.parentNode.parentNode.cellIndex -
+ gostNode.parentNode.parentNode.cellIndex,
ghostNode: gostNode
- };
+ };
}
function _updateDragEnd(dg, evt) {
@@ -455,7 +455,7 @@ it will be useful, but WITHOUT ANY WARRANTY.
ce = dg._zevt;
if (cols || rows) {
var timeslots = widget._timeslots,
- timeslotTime = 60/timeslots,
+ timeslotTime = 60 / timeslots,
bd = new Date(ce._bd),
ed = new Date(ce._ed),
bdTimeslot = _getHightOffsPercent(bd, timeslots),
@@ -467,27 +467,27 @@ it will be useful, but WITHOUT ANY WARRANTY.
//adjust time in time range
if (bd.getHours() < bt) {
var slotCount = _getSlotCount(bd, bt, timeslots);
- bd.setMinutes(bd.getMinutes() +
+ bd.setMinutes(bd.getMinutes() +
slotCount * timeslotTime);
- ed.setMinutes(ed.getMinutes() +
+ ed.setMinutes(ed.getMinutes() +
slotCount * timeslotTime);
}
bd.setDate(bd.getDate() - offset[0]);
- bd.setMinutes(bd.getMinutes() - offset[1]);
+ bd.setMinutes(bd.getMinutes() - offset[1]);
ed.setDate(ed.getDate() - offset[0]);
ed.setMinutes(ed.getMinutes() - offset[1]);
var bdOffset = bd.getTimezoneOffset(),
edOffset2 = ed.getTimezoneOffset();
//DST: Fixed different offset after update time
- if (edOffset != edOffset2 && ed.getHours()== bd.getHours()) {
+ if (edOffset != edOffset2 && ed.getHours() == bd.getHours()) {
ed = new Date(bd);
- ed.setUTCMinutes(ed.getUTCMinutes() + _getSlotCount(bd, ed, timeslots) * timeslotTime);
+ ed.setUTCMinutes(ed.getUTCMinutes() + _getSlotCount(bd, ed, timeslots) * timeslotTime);
}
widget.fireCalEvent(bd, ed, evt, ce.id);
widget._restoreCE = ce;
} else {
- jq('#'+widget.uuid+'-dd').remove();
- ce.style.visibility = "";
+ jq('#' + widget.uuid + '-dd').remove();
+ ce.style.visibility = '';
}
}
@@ -500,40 +500,40 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
'
'].join(''),
_dateTime: [
- '00:00', '00:05', '00:10', '00:15', '00:20', '00:25', '00:30', '00:35', '00:40', '00:45', '00:50', '00:55',
- '01:00', '01:05', '01:10', '01:15', '01:20', '01:25', '01:30', '01:35', '01:40', '01:45', '01:50', '01:55',
- '02:00', '02:05', '02:10', '02:15', '02:20', '02:25', '02:30', '02:35', '02:40', '02:45', '02:50', '02:55',
- '03:00', '03:05', '03:10', '03:15', '03:20', '03:25', '03:30', '03:35', '03:40', '03:45', '03:50', '03:55',
- '04:00', '04:05', '04:10', '04:15', '04:20', '04:25', '04:30', '04:35', '04:40', '04:45', '04:50', '04:55',
- '05:00', '05:05', '05:10', '05:15', '05:20', '05:25', '05:30', '05:35', '05:40', '05:45', '05:50', '05:55',
- '06:00', '06:05', '06:10', '06:15', '06:20', '06:25', '06:30', '06:35', '06:40', '06:45', '06:50', '06:55',
- '07:00', '07:05', '07:10', '07:15', '07:20', '07:25', '07:30', '07:35', '07:40', '07:45', '07:50', '07:55',
- '08:00', '08:05', '08:10', '08:15', '08:20', '08:25', '08:30', '08:35', '08:40', '08:45', '08:50', '08:55',
- '09:00', '09:05', '09:10', '09:15', '09:20', '09:25', '09:30', '09:35', '09:40', '09:45', '09:50', '09:55',
- '10:00', '10:05', '10:10', '10:15', '10:20', '10:25', '10:30', '10:35', '10:40', '10:45', '10:50', '10:55',
- '11:00', '11:05', '11:10', '11:15', '11:20', '11:25', '11:30', '11:35', '11:40', '11:45', '11:50', '11:55',
- '12:00', '12:05', '12:10', '12:15', '12:20', '12:25', '12:30', '12:35', '12:40', '12:45', '12:50', '12:55',
- '13:00', '13:05', '13:10', '13:15', '13:20', '13:25', '13:30', '13:35', '13:40', '13:45', '13:50', '13:55',
- '14:00', '14:05', '14:10', '14:15', '14:20', '14:25', '14:30', '14:35', '14:40', '14:45', '14:50', '14:55',
- '15:00', '15:05', '15:10', '15:15', '15:20', '15:25', '15:30', '15:35', '15:40', '15:45', '15:50', '15:55',
- '16:00', '16:05', '16:10', '16:15', '16:20', '16:25', '16:30', '16:35', '16:40', '16:45', '16:50', '16:55',
- '17:00', '17:05', '17:10', '17:15', '17:20', '17:25', '17:30', '17:35', '17:40', '17:45', '17:50', '17:55',
- '18:00', '18:05', '18:10', '18:15', '18:20', '18:25', '18:30', '18:35', '18:40', '18:45', '18:50', '18:55',
- '19:00', '19:05', '19:10', '19:15', '19:20', '19:25', '19:30', '19:35', '19:40', '19:45', '19:50', '19:55',
- '20:00', '20:05', '20:10', '20:15', '20:20', '20:25', '20:30', '20:35', '20:40', '20:45', '20:50', '20:55',
- '21:00', '21:05', '21:10', '21:15', '21:20', '21:25', '21:30', '21:35', '21:40', '21:45', '21:50', '21:55',
- '22:00', '22:05', '22:10', '22:15', '22:20', '22:25', '22:30', '22:35', '22:40', '22:45', '22:50', '22:55',
- '23:00', '23:05', '23:10', '23:15', '23:20', '23:25', '23:30', '23:35', '23:40', '23:45', '23:50', '23:55',
+ '00:00', '00:05', '00:10', '00:15', '00:20', '00:25', '00:30', '00:35', '00:40', '00:45', '00:50', '00:55',
+ '01:00', '01:05', '01:10', '01:15', '01:20', '01:25', '01:30', '01:35', '01:40', '01:45', '01:50', '01:55',
+ '02:00', '02:05', '02:10', '02:15', '02:20', '02:25', '02:30', '02:35', '02:40', '02:45', '02:50', '02:55',
+ '03:00', '03:05', '03:10', '03:15', '03:20', '03:25', '03:30', '03:35', '03:40', '03:45', '03:50', '03:55',
+ '04:00', '04:05', '04:10', '04:15', '04:20', '04:25', '04:30', '04:35', '04:40', '04:45', '04:50', '04:55',
+ '05:00', '05:05', '05:10', '05:15', '05:20', '05:25', '05:30', '05:35', '05:40', '05:45', '05:50', '05:55',
+ '06:00', '06:05', '06:10', '06:15', '06:20', '06:25', '06:30', '06:35', '06:40', '06:45', '06:50', '06:55',
+ '07:00', '07:05', '07:10', '07:15', '07:20', '07:25', '07:30', '07:35', '07:40', '07:45', '07:50', '07:55',
+ '08:00', '08:05', '08:10', '08:15', '08:20', '08:25', '08:30', '08:35', '08:40', '08:45', '08:50', '08:55',
+ '09:00', '09:05', '09:10', '09:15', '09:20', '09:25', '09:30', '09:35', '09:40', '09:45', '09:50', '09:55',
+ '10:00', '10:05', '10:10', '10:15', '10:20', '10:25', '10:30', '10:35', '10:40', '10:45', '10:50', '10:55',
+ '11:00', '11:05', '11:10', '11:15', '11:20', '11:25', '11:30', '11:35', '11:40', '11:45', '11:50', '11:55',
+ '12:00', '12:05', '12:10', '12:15', '12:20', '12:25', '12:30', '12:35', '12:40', '12:45', '12:50', '12:55',
+ '13:00', '13:05', '13:10', '13:15', '13:20', '13:25', '13:30', '13:35', '13:40', '13:45', '13:50', '13:55',
+ '14:00', '14:05', '14:10', '14:15', '14:20', '14:25', '14:30', '14:35', '14:40', '14:45', '14:50', '14:55',
+ '15:00', '15:05', '15:10', '15:15', '15:20', '15:25', '15:30', '15:35', '15:40', '15:45', '15:50', '15:55',
+ '16:00', '16:05', '16:10', '16:15', '16:20', '16:25', '16:30', '16:35', '16:40', '16:45', '16:50', '16:55',
+ '17:00', '17:05', '17:10', '17:15', '17:20', '17:25', '17:30', '17:35', '17:40', '17:45', '17:50', '17:55',
+ '18:00', '18:05', '18:10', '18:15', '18:20', '18:25', '18:30', '18:35', '18:40', '18:45', '18:50', '18:55',
+ '19:00', '19:05', '19:10', '19:15', '19:20', '19:25', '19:30', '19:35', '19:40', '19:45', '19:50', '19:55',
+ '20:00', '20:05', '20:10', '20:15', '20:20', '20:25', '20:30', '20:35', '20:40', '20:45', '20:50', '20:55',
+ '21:00', '21:05', '21:10', '21:15', '21:20', '21:25', '21:30', '21:35', '21:40', '21:45', '21:50', '21:55',
+ '22:00', '22:05', '22:10', '22:15', '22:20', '22:25', '22:30', '22:35', '22:40', '22:45', '22:50', '22:55',
+ '23:00', '23:05', '23:10', '23:15', '23:20', '23:25', '23:30', '23:35', '23:40', '23:45', '23:50', '23:55',
'00:00'
],
- $define : {
- days: function() {
+ $define: {
+ days: function () {
if (!this.desktop) return;
var days = this._days,
header = this.$n('header'),
- cnt = this.$n('cnt'),
+ cnt = this.$n('cnt'),
$row = jq(this.cntRows),
daylongMoreRows = this.daylongMoreRows,
zcls = this.getZclass(),
@@ -541,19 +541,19 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
offset = days - oldRowCount;
if (zk.ie) {
- jq(header.offsetParent).find("td:not(.z-calendars-daylong-evt)").attr('colspan',days);
+ jq(header.offsetParent).find('td:not(.z-calendars-daylong-evt)').attr('colspan',days);
jq(cnt).find('tr:eq(1) td:last').attr('colspan',days);
- } else jq(this.$n('inner')).find("[colspan]").attr('colspan',days);
+ } else jq(this.$n('inner')).find('[colspan]').attr('colspan',days);
if (offset > 0) {
- var titleRowHtml = '
',
+ var titleRowHtml = '
',
daylongRowHtml = '
',
- cntRowHtml ='
',
+ cntRowHtml = '
',
html1 = [],
html2 = [],
html3 = [];
- for(var i = offset; i--;) {
+ for (var i = offset; i--;) {
html1.push(titleRowHtml);
html2.push(daylongRowHtml);
html3.push(cntRowHtml);
@@ -562,9 +562,9 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
jq(daylongMoreRows).append(html2.join(''));
$row.append(html3.join(''));
} else if (offset < 0) {
- jq(this.$n('daylong')).find('.z-calendars-daylong-more:gt('+(days-1)+')').remove();
- jq(header).children('.z-calendars-day-of-week:gt('+(days-1)+')').remove();
- $row.children('.z-calendars-week-day:gt('+(days-1)+')').remove();
+ jq(this.$n('daylong')).find('.z-calendars-daylong-more:gt(' + (days - 1) + ')').remove();
+ jq(header).children('.z-calendars-day-of-week:gt(' + (days - 1) + ')').remove();
+ $row.children('.z-calendars-week-day:gt(' + (days - 1) + ')').remove();
}
if (zk.ie || zk.opera)
@@ -573,14 +573,14 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
this.title = jq(header).find('.' + this.getZclass() + '-day-of-week-cnt');
this.updateDateRange_();
},
- events: function () {
- this._events = jq.evalJSON(this._events);
+ items: function () {
+ this._items = jq.evalJSON(this._items);
if (!this.$n()) return;
for (var i = this.nChildren; i--;) {
var child = this.getChildAt(i),
className = child.className;
- if (className == 'calendar.DayEvent' || className == 'calendar.DaylongEvent')
+ if (className == 'calendar.DayItem' || className == 'calendar.DaylongItem')
this.removeChild(child);
}
@@ -602,7 +602,7 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
for (var i = this._zonesOffset.length; i--;)
this._zonesOffset[i] = zk.parseInt(this._zonesOffset[i]);
- if (!this.desktop) return;
+ if (!this.desktop) return;
this.updateDateOfBdAndEd_();
@@ -610,12 +610,12 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
this.updateTimeZoneCol_({ignoreFirstCol: true});
},
- timeslots: function(){
+ timeslots: function () {
if (!this.desktop) return;
var hourSepRowHtml = '
',
html = [];
- for(var i = this._timeslots/2; i--;)
+ for (var i = this._timeslots / 2; i--;)
html.push(hourSepRowHtml);
hourSepRowHtml = html.join('');
@@ -629,7 +629,7 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
this.beforeSize();
this.onSize();
},
- bt: _zkf = function(){
+ bt: _zkf = function () {
if (!this.desktop) return;
this.updateTimeZoneCol_(this);
},
@@ -640,35 +640,35 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
this.$supers('bind_', arguments);
this._scrollInfo = {};
- this._dayEvents = [];
- this._daylongEvents = [];
+ this._dayItems = [];
+ this._daylongItems = [];
this._daylongSpace = [];
this._daySpace = [];
var zcls = this.getZclass(),
p = this.params;
- p._fakerMoreCls = zcls + "-daylong-faker-more";
- p._fakerNoMoreCls = zcls + "-daylong-faker-nomore";
+ p._fakerMoreCls = zcls + '-daylong-faker-more';
+ p._fakerNoMoreCls = zcls + '-daylong-faker-nomore';
var widget = this,
- $cnt = jq(this.$n("cnt")),
+ $cnt = jq(this.$n('cnt')),
zcls = this.getZclass();
//define all positions
//put the title
- this.title = jq(this.$n("header")).find('.' + zcls + '-day-of-week-cnt');
+ this.title = jq(this.$n('header')).find('.' + zcls + '-day-of-week-cnt');
//put the daylong event
this.daylongRows = this.$n('daylong').firstChild.firstChild;
//put the daylong more space
this.daylongMoreRows = this.daylongRows.firstChild;
//put the day event
- this.cntRows = $cnt.find("tr")[zk.ie ? 2: 1];
+ this.cntRows = $cnt.find('tr')[zk.ie ? 2 : 1];
- this.weekDay = jq(this.cntRows).children('.'+ zcls +'-week-day');
+ this.weekDay = jq(this.cntRows).children('.' + zcls + '-week-day');
-/****************************** zone arrow ******************************/
- var a = this.$n("hdarrow"),
- hd = this.$n("header"),
+/****************************** zone arrow ******************************/
+ var a = this.$n('hdarrow'),
+ hd = this.$n('header'),
title = this.title,
ed = new Date(this.zoneEd);
//store value in head tag
@@ -676,12 +676,12 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
ed = calUtil.addDay(ed, -1);
title[i].time = this.fixTimeZoneFromClient(ed);
}
- jq(a).bind("click", this.onArrowClick);
-/************************** head event **************************************/
+ jq(a).bind('click', this.onArrowClick);
+/************************** head event **************************************/
if (hd.childNodes.length > this.ts + 2)
this.addDayClickEvent_(hd);
- $cnt.bind("scroll", function () {
+ $cnt.bind('scroll', function () {
widget._scrollInfo[widget.uuid] = $cnt[0].scrollTop;
});
@@ -689,76 +689,76 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
this.editMode(true);
},
- unbind_ : function () {
- this.title = this.daylongRows = this.daylongMoreRows = this.cntRows =
- this._scrollInfo = this._dayEvents = this._daylongEvents =
+ unbind_: function () {
+ this.title = this.daylongRows = this.daylongMoreRows = this.cntRows =
+ this._scrollInfo = this._dayItems = this._daylongItems =
this._daylongSpace = this._daySpace = null;
this.$supers('unbind_', arguments);
},
_resetDaylongPosition: function () {
var daylongRows = jq(this.daylongRows),
- zcls = this.getZclass();
- //clean all rows exclusive blank row
+ zcls = this.getZclass();
+ //clean all rows exclusive blank row
daylongRows.children().not(':last-child').remove();
- // append all rows
+ // append all rows
for (var i = this._daylongSpace.length; i--;) {
daylongRows.prepend('
');
var rowSpace = this._daylongSpace[i],
- tr = jq(daylongRows[0].firstChild);
+ tr = jq(daylongRows[0].firstChild);
//append events
for (var k = 0, l = rowSpace.length; k < l; k++) {
var childWgt = rowSpace[k],
ce = childWgt;
- if (k == 0){//first
- ce._days = childWgt._days;
- this.drawEvent_(childWgt._preOffset, zcls + '-daylong-evt', tr, ce);
+ if (k == 0) {//first
+ ce._days = childWgt._days;
+ this.drawItem_(childWgt._preOffset, zcls + '-daylong-evt', tr, ce);
} else {
- var preWidget = rowSpace[k-1],
+ var preWidget = rowSpace[k - 1],
start = childWgt._preOffset,
preEnd = preWidget._preOffset + preWidget._days,
offset = start - preEnd;
ce._days = childWgt._days;
- this.drawEvent_(offset, zcls + '-daylong-evt', tr, ce);
+ this.drawItem_(offset, zcls + '-daylong-evt', tr, ce);
}
- ce.style.visibility = "";//recover moving event
+ ce.style.visibility = '';//recover moving event
if (k == l - 1) {//last
var html = '';
- for (var n = childWgt._afterOffset; n--;)
+ for (var n = childWgt._afterOffset; n--;)
html += '
';
tr.append(html);
}
}
}
jq('#' + this.uuid + '-hdarrow').removeClass(this.getZclass() + '-week-header-arrow-close');
- },
+ },
_rePositionDay: function () {
- this._dayEvents.sort(this.dateSorting_);
+ this._dayItems.sort(this.dateSorting_);
this._daySpace = [];
for (var i = this._days; i--;)
this._daySpace.push([]);
// all daylong event
- for (var i = 0 ,j = this._dayEvents.length; i < j; i++) {
- var dayEvent = this._dayEvents[i];
- this._daySpace[dayEvent._preOffset].push(dayEvent);
+ for (var i = 0 ,j = this._dayItems.length; i < j; i++) {
+ var dayItem = this._dayItems[i];
+ this._daySpace[dayItem._preOffset].push(dayItem);
}
this.fixPosition();
},
- _rePositionDaylong: function () {
- this._daylongEvents.sort(this.dateSorting_);
- this._daylongSpace = [];
+ _rePositionDaylong: function () {
+ this._daylongItems.sort(this.dateSorting_);
+ this._daylongSpace = [];
var uuid = this.uuid;
// all daylong event
- for (var i = 0, j = this._daylongEvents.length; i < j; i++) {
- var daylongEvent = this._daylongEvents[i];
+ for (var i = 0, j = this._daylongItems.length; i < j; i++) {
+ var daylongEvent = this._daylongItems[i];
this.putInDaylongSpace_(this._daylongSpace, daylongEvent);
}
@@ -779,7 +779,7 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
_updateHourColSize(this);
if (_updateTimeZoneColSize(this))
- opts = {ignoreFirstCol: false}
+ opts = {ignoreFirstCol: false};
//update texts
for (var i = ts; i--;) {
@@ -791,7 +791,7 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
div = str.substr(str.indexOf('<'),str.length);
zoneText.html(zones[index] + div);
this.clearCache();
- jq(this.$n("hdarrow")).bind("click", this.onArrowClick);
+ jq(this.$n('hdarrow')).bind('click', this.onArrowClick);
} else zoneText.html(zones[index]);
//fist column is not need to redraw
@@ -802,7 +802,7 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
current.setMinutes(0);
for (var k = beginHour; k < endHour; k++) {
current.setHours(k);
- var context = captionByTimeOfDay ? captionByTimeOfDay[ index * 24 + k ]:
+ var context = captionByTimeOfDay ? captionByTimeOfDay[ index * 24 + k ] :
zk.fmt.Date.formatDate(this.getTimeZoneTime(current,zk.parseInt(this._zonesOffset[index])),'HH:mm');
jq(cell[k - bt]).html(context);
@@ -813,22 +813,22 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
updateDateRange_: function () {
this.updateDateOfBdAndEd_();
- this._captionByDate = this.captionByDate ? jq.evalJSON(this.captionByDate): null;
+ this._captionByDate = this.captionByDate ? jq.evalJSON(this.captionByDate) : null;
//ZKCAL-54: Fix setting time label format by DateFormatter not working
- this._captionByTimeOfDay = this.captionByTimeOfDay ? jq.evalJSON(this.captionByTimeOfDay): null;
- if(!this.$n())return;
+ this._captionByTimeOfDay = this.captionByTimeOfDay ? jq.evalJSON(this.captionByTimeOfDay) : null;
+ if (!this.$n()) return;
var zcls = this.getZclass();
- this.weekDay = jq(this.cntRows).children('.'+ zcls +'-week-day');
+ this.weekDay = jq(this.cntRows).children('.' + zcls + '-week-day');
- var hd = jq(this.$n("header")),
- cnt = jq(this.$n("cnt")),
+ var hd = jq(this.$n('header')),
+ cnt = jq(this.$n('cnt')),
titles = this.title,
ed = new Date(this.zoneEd),
current = new Date(),
- week_day = zcls + "-week-day",
- week_today = zcls + "-week-today",
- week_weekend = zcls + "-week-weekend",
+ week_day = zcls + '-week-day',
+ week_today = zcls + '-week-today',
+ week_weekend = zcls + '-week-weekend',
weekDay = this.weekDay;
//remove today and weekend class
@@ -846,9 +846,9 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
d.setHours(d.getHours() + 2); //adjust to correct date
var title = titles[i],
- content = this._captionByDate ? this._captionByDate[i] :
+ content = this._captionByDate ? this._captionByDate[i] :
zk.fmt.Date.formatDate(d, 'EEE ') +
- '
' + zk.fmt.Date.formatDate(d, this.weekFmt) + '
';
+ '
' + zk.fmt.Date.formatDate(d, this.weekFmt) + '
';
jq(title).html(content);
title.time = this.fixTimeZoneFromClient(ed);
if (ed.getDay() == 0 || ed.getDay() == 6) {//SUNDAY or SATURDAY
@@ -863,24 +863,24 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
}
},
- cleanEvtAry_: function () {
- this._eventKey = {};
- this._daylongEvents = [];
- this._dayEvents = [];
+ cleanItemAry_: function () {
+ this._itemKey = {};
+ this._daylongItems = [];
+ this._dayItems = [];
},
- processChildrenWidget_: function (isExceedOneDay, event) {
- var dayEvent = isExceedOneDay ?
- new calendar.DaylongEvent({event:event}):
- new calendar.DayEvent({event:event})
- zoneBd = event.zoneBd,
- zoneEd = event.zoneEd;
- if (!isExceedOneDay &&
- (zoneBd.getHours() >= this._et ||
+ processChildrenWidget_: function (isExceedOneDay, item) {
+ var dayItem = isExceedOneDay ?
+ new calendar.DaylongItem({item: item}) :
+ new calendar.DayItem({item: item}),
+ zoneBd = item.zoneBd,
+ zoneEd = item.zoneEd;
+ if (!isExceedOneDay &&
+ (zoneBd.getHours() >= this._et ||
(zoneEd.getHours() <= this._bt && zoneEd.getHours() != 0 && zoneEd.getMinutes() == 0)))
- return;
- this.appendChild(dayEvent);
- this[isExceedOneDay ? '_daylongEvents': '_dayEvents'].push(dayEvent.$n());
+ return;
+ this.appendChild(dayItem);
+ this[isExceedOneDay ? '_daylongItems' : '_dayItems'].push(dayItem.$n());
},
getDragDataObj_: function () {
@@ -898,37 +898,37 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
html.push('
');
hs.push(cnt.firstChild.offsetHeight);
return html.join('');
- },
+ },
getRow: function (cnt) {
return cnt.firstChild.firstChild.lastChild.firstChild;
- },
+ },
getCols: function (p, dg) {
- return Math.floor((p[0] - dg._zoffs.l)/dg._zdim.w);
- },
+ return Math.floor((p[0] - dg._zoffs.l) / dg._zdim.w);
+ },
getRows: function () {
return 0;
- },
- getDur: function (dg) {
+ },
+ getDur: function (dg) {
return dg._zpos1[0];
- },
+ },
getNewDate: function (widget, dg) {
var c = dg._zpos[0],
c1 = dg._zpos1[0],
offs = c < c1 ? c : c1,
- bd = new Date(widget.zoneBd)
+ bd = new Date(widget.zoneBd),
ed = new Date(widget.zoneBd);
bd.setDate(bd.getDate() + offs);
ed.setDate(bd.getDate() + dg._zpos1[2]);
- return {bd:bd, ed:ed};
- }
+ return {bd: bd, ed: ed};
+ }
};
return this._dragDataObj;
- },
+ },
- reAlignEvents_: function (hasAdd) {
- if (hasAdd.day)
+ reAlignItems_: function (hasAdd) {
+ if (hasAdd.day)
this._rePositionDay();
if (hasAdd.daylong)
@@ -937,13 +937,13 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
// recalculate
this.beforeSize();
this.onSize();
- },
+ },
removeNodeInArray_: function (childWidget, hasAdd) {
- var isDayEvent = childWidget.className == 'calendar.DayEvent';
- this[isDayEvent ? '_dayEvents': '_daylongEvents'].$remove(childWidget.$n());
- hasAdd[isDayEvent ? 'day': 'daylong'] = true;
- },
+ var isDayItem = childWidget.className == 'calendar.DayItem';
+ this[isDayItem ? '_dayItems' : '_daylongItems'].$remove(childWidget.$n());
+ hasAdd[isDayItem ? 'day' : 'daylong'] = true;
+ },
onClick: function (cnt, evt) {
var widget = zk.Widget.$(cnt),
@@ -951,10 +951,10 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
if (!cnt._lefts || p[0] <= cnt._lefts[0]) return;
- var ce = zk.Widget.$(evt.target).event;
+ var ce = zk.Widget.$(evt.target).item;
if (ce) {
- widget.fire("onEventEdit",{
+ widget.fire('onItemEdit', {
data: [ce.id,p[0],p[1], jq.innerWidth(),jq.innerHeight()]});
} else {
var ts = widget.ts,
@@ -968,7 +968,7 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
cIndex = cells.length - ts,
rows = Math.floor((y + cnt.scrollTop - offs[1]) / ph),
timeslots = widget._timeslots,
- timeslotTime = 60/timeslots;
+ timeslotTime = 60 / timeslots;
for (; cIndex--;) {
//Fix ZKCAL-55: Problems with horizontal scrollbar
@@ -982,42 +982,42 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
jq(cells[ts + cIndex].firstChild).prepend(
widget.ddTemplate.replace(new RegExp("%([1-2])", "g"), function (match, index) {
- return index < 2 ? widget.uuid + '-dd' : 'z-calevent';
+ return index < 2 ? widget.uuid + '-dd' : 'z-calitem';
})
);
- var faker = jq('#'+widget.uuid+'-dd')[0];
- jq(faker).addClass(widget.getZclass() + "-evt-ghost");
+ var faker = jq('#' + widget.uuid + '-dd')[0];
+ jq(faker).addClass(widget.getZclass() + '-evt-ghost');
faker.style.top = jq.px(rows * ph);
var offsHgh = 0,
- body = jq('#'+widget.uuid+'-dd-body')[0],
+ body = jq('#' + widget.uuid + '-dd-body')[0],
height = 0,
inner = body.firstChild.firstChild;
rows += widget.beginIndex;
var beginIndex = rows * widget._slotOffs,
- eventTimeSlot = this.getNewEventTimeSlots_();
- endIndex = beginIndex + (eventTimeSlot * timeslotTime / 5);
+ itemTimeSlot = this.getNewItemTimeSlots_();
+ endIndex = beginIndex + (itemTimeSlot * timeslotTime / 5);
inner.firstChild.innerHTML = widget._dateTime[beginIndex] + ' - ' + widget._dateTime[endIndex];
- for (var child = jq(faker).children().get(0);child;child=child.nextSibling) {
- if (this.isLegalChild(child))
- height+=child.offsetHeight;
+ for (var child = jq(faker).children().get(0);child;child = child.nextSibling) {
+ if (this.isLegalChild(child))
+ height += child.offsetHeight;
}
height += zk(body).padBorderHeight();
height += zk(body.firstChild).padBorderHeight();
height += zk(inner).padBorderHeight();
height += 2;
- inner.style.height = jq.px((ph*eventTimeSlot) - height);
+ inner.style.height = jq.px((ph * itemTimeSlot) - height);
var bd = new Date(widget.zoneBd);
bd.setDate(bd.getDate() + cIndex);
bd.setMilliseconds(0);// clean
bd.setMinutes(bd.getMinutes() + rows * timeslotTime);
var ed = new Date(bd);
- ed.setMinutes(ed.getMinutes() + eventTimeSlot * timeslotTime);
+ ed.setMinutes(ed.getMinutes() + itemTimeSlot * timeslotTime);
//ZKCAL-50: available to click on DST day start from 01:00
if (bd.getTime() == ed.getTime() && rows == timeslots) {
bd.setHours(bd.getHours() + 1);
@@ -1029,22 +1029,22 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
evt.stop();
},
- //Feature ZKCAL-51: override to define default event time duration
- getNewEventTimeSlots_: function() {
+ //Feature ZKCAL-51: override to define default item time duration
+ getNewItemTimeSlots_: function () {
return this._timeslots;
},
onDaylongClick: function (daylong, evt) {
var widget = zk.Widget.$(daylong),
- ce = zk.Widget.$(evt.target).event,
+ ce = zk.Widget.$(evt.target).item,
p = [Math.round(evt.pageX), Math.round(evt.pageY)]; //ZKCAL-42: sometimes it returns float number in IE 10
- if (ce) {
- widget.fire("onEventEdit",{
- data: [ce.id, p[0], p[1], jq.innerWidth(), jq.innerHeight()]});
+ if (ce) {
+ widget.fire('onItemEdit', {
+ data: [ce.id, p[0], p[1], jq.innerWidth(), jq.innerHeight()]});
} else {
var zcls = widget.getZclass(),
- html = '
'
+ html = '
';
jq(document.body).prepend(html);
@@ -1052,7 +1052,7 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
var row = daylong.firstChild.firstChild.lastChild,
width = row.firstChild.offsetWidth,
offs = zk(daylong).revisedOffset(),
- cols = Math.floor((p[0] - offs[0])/width),
+ cols = Math.floor((p[0] - offs[0]) / width),
zoneBd = widget.zoneBd,
bd = new Date(widget.zoneBd);
if (zoneBd.getHours() == 23) //ZKCAL-50: DST cross between week
@@ -1074,25 +1074,25 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
s: zinfo.length
};
- widget.fixRope_(zinfo, jq('#'+widget.uuid+"-rope")[0].firstChild, cols,
- 0, zoffs, {w: width, h: daylong.offsetHeight, hs:[daylong.offsetHeight]}, 1);
+ widget.fixRope_(zinfo, jq('#' + widget.uuid + '-rope')[0].firstChild, cols,
+ 0, zoffs, {w: width, h: daylong.offsetHeight, hs: [daylong.offsetHeight]}, 1);
var ed = new Date(bd);
ed = calUtil.addDay(ed, 1);
ed.setHours(0); //DST case
- widget.fire("onEventCreate", {
+ widget.fire('onItemCreate', {
data: [
- widget.fixTimeZoneFromClient(bd),
- widget.fixTimeZoneFromClient(ed),
- p[0],
- p[1],
- jq.innerWidth(),
+ widget.fixTimeZoneFromClient(bd),
+ widget.fixTimeZoneFromClient(ed),
+ p[0],
+ p[1],
+ jq.innerWidth(),
jq.innerHeight()
]
});
widget._ghost[widget.uuid] = function () {
- jq('#'+widget.uuid+"-rope").remove();
+ jq('#' + widget.uuid + '-rope').remove();
delete widget._ghost[widget.uuid];
};
}
@@ -1105,21 +1105,21 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
$a = jq(a),
widget = zk.Widget.$(a),
zcls = widget.getZclass(),
- cls = zcls + "-week-header-arrow-close";
+ cls = zcls + '-week-header-arrow-close';
isClose = $a.hasClass(cls),
- daylong = widget.$n("daylong"),
- rows = daylong.firstChild.rows,
+ daylong = widget.$n('daylong'),
+ rows = daylong.firstChild.rows,
len = rows.length;
widget.clearGhost();
- isClose ? $a.removeClass(cls): $a.addClass(cls);
+ isClose ? $a.removeClass(cls) : $a.addClass(cls);
if (len < 2) return; // nothing to do
if (!isClose) {
var data = [],
- datas = rows[len-1].cells.length;
+ datas = rows[len - 1].cells.length;
for (var i = 0, c = datas; c--; i++)
data[i] = [];
@@ -1127,32 +1127,32 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
for (var k = 0, z = 0, cells = rows[i].cells,
cl = cells.length; k < cl && z + k < datas; k++) {
if (cells[k].firstChild.id)
- data[k+z].push(cells[k].firstChild);
+ data[k + z].push(cells[k].firstChild);
var cols = cells[k].colSpan;
while (--cols > 0)
- data[k+ ++z].push(cells[k].firstChild);
+ data[k + ++z].push(cells[k].firstChild);
}
- rows[i].style.display = "none";
+ rows[i].style.display = 'none';
}
var faker = daylong.firstChild.insertRow(len - 1);
for (var i = datas; i--;) {
cell = faker.insertCell(0);
cell.className = rows[len].cells[i].className;
- jq(cell).addClass(zcls + "-daylong-faker-more");
+ jq(cell).addClass(zcls + '-daylong-faker-more');
if (data[i].length > 0) {
var evts = data[i];
- cell.innerHTML = calUtil.format(msgcal.dayMORE, [evts.length] )
- jq(cell).bind("click", widget.onMoreClick);
+ cell.innerHTML = calUtil.format(msgcal.dayMORE, [evts.length]);
+ jq(cell).bind('click', widget.onMoreClick);
} else {
- cell.innerHTML = zk.ie ? " " : "";
- jq(cell).addClass(zcls + "-daylong-faker-nomore");
+ cell.innerHTML = zk.ie ? ' ' : '';
+ jq(cell).addClass(zcls + '-daylong-faker-nomore');
}
}
- widget._evtsData = data;
+ widget._itemsData = data;
} else {
for (var i = 0, j = len - 1; i < j; i++)
- rows[i].style.display = "";
+ rows[i].style.display = '';
jq(rows[len - 2]).remove();
}
@@ -1170,22 +1170,22 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
uuid = widget.uuid,
ci = cell.cellIndex,
pp,
- table = jq('#'+widget.uuid+'-ppcnt')[0];
+ table = jq('#' + widget.uuid + '-ppcnt')[0];
- widget.clearGhost();
+ widget.clearGhost();
if (!widget._pp) {
jq(document.body).append(widget.ppTemplate.replace(new RegExp("%([1-2])", "g"), function (match, index) {
return index < 2 ? uuid : 'z-calpp';
- }));
- pp = widget._pp = jq('#'+uuid+'-pp')[0];
+ }));
+ pp = widget._pp = jq('#' + uuid + '-pp')[0];
jq(document.body).bind('click', widget.proxy(widget.unMoreClick));
- table = jq('#'+uuid+'-ppcnt')[0];
+ table = jq('#' + uuid + '-ppcnt')[0];
- if(!widget._readonly)
- jq(widget._pp).bind("click", widget.proxy(widget.onPopupClick));
+ if (!widget._readonly)
+ jq(widget._pp).bind('click', widget.proxy(widget.onPopupClick));
} else {
if (widget._pp.ci == ci) {
- // ignore onEventCreate
+ // ignore onItemCreate
evt.stop();
return;
}
@@ -1200,18 +1200,18 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
var date = jq('#' + widget.uuid).find('.z-calendars-day-of-week-cnt')[ci],
targetDate = new Date(date.time);
if (targetDate)
- jq('#' + widget.uuid+'-pphd')[0].innerHTML = zk.fmt.Date.formatDate(targetDate, 'EEE, MMM/d');
+ jq('#' + widget.uuid + '-pphd')[0].innerHTML = zk.fmt.Date.formatDate(targetDate, 'EEE, MMM/d');
- var offs= zk(cell).revisedOffset(),
+ var offs = zk(cell).revisedOffset(),
wd = daylong.offsetWidth,
csz = cell.parentNode.cells.length,
- single = wd/csz;
+ single = wd / csz;
- wd = csz > 2 ? single*3*0.9 : wd * 0.8;
+ wd = csz > 2 ? single * 3 * 0.9 : wd * 0.8;
if (csz > 2 && ci > 0)
- if (csz > ci+1)
- pp.style.left = jq.px(offs[0] - (wd - single)/2);
+ if (csz > ci + 1)
+ pp.style.left = jq.px(offs[0] - (wd - single) / 2);
else
pp.style.left = jq.px(offs[0] - (wd - single));
else if (csz > 2)
@@ -1222,69 +1222,69 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
pp.style.width = jq.px(wd);
//filling data
- var evts = widget._evtsData[ci],
+ var evts = widget._itemsData[ci],
oneDay = calUtil.DAYTIME,
bd = widget.zoneBd;
ed = new Date(bd);
ed = calUtil.addDay(ed, 1);
- for (var i = evts.length; i--;) {
+ for (var i = evts.length; i--;) {
var tr = table.insertRow(0),
cr = tr.insertCell(0),
cm = tr.insertCell(0),
cl = tr.insertCell(0),
ce = evts[i],
- event = zk.Widget.$(ce).event,
- hc = event.headerColor,
- cc = event.contentColor,
- zcls = event.zclass;
+ item = zk.Widget.$(ce).item,
+ hc = item.headerColor,
+ cc = item.contentColor,
+ zcls = item.zclass;
- ce._bd = ce._bd || event.zoneBd;
- ce._ed = ce._ed || event.zoneEd;
- cl.className = "z-calpp-evt-l";
+ ce._bd = ce._bd || item.zoneBd;
+ ce._ed = ce._ed || item.zoneEd;
+ cl.className = 'z-calpp-evt-l';
if (bd.getTime() + (oneDay * ci) - ce._bd.getTime() >= 1000) {
var info = [
- ce.id + "-fl",
+ ce.id + '-fl',
zcls,
- zcls + "-left",
- ce._bd.getMonth() + 1 + "/" + ce._bd.getDate(),
+ zcls + '-left',
+ ce._bd.getMonth() + 1 + '/' + ce._bd.getDate(),
hc ? ' style="background:' + hc + '"' : '',
cc ? ' style="background:' + cc + '"' : '',
cc ? ' style="border-bottom-color:' + cc + ';border-top-color:' + cc + '"' : '',
cc ? ' style="background:' + cc + '"' : '',
- ];
- cl.innerHTML = widget.evtTemplate.replace(new RegExp("%([1-8])", "g"), function (match, index) {
+ ];
+ cl.innerHTML = widget.itemTemplate.replace(new RegExp("%([1-8])", "g"), function (match, index) {
return info[index - 1];
});
} else
- cl.innerHTML = "";
+ cl.innerHTML = '';
- cm.className = "z-calpp-evt-m";
+ cm.className = 'z-calpp-evt-m';
var faker = ce.cloneNode(true);
- jq(faker).addClass("z-calpp-evt-faker");
+ jq(faker).addClass('z-calpp-evt-faker');
cm.appendChild(faker);
- cr.className = "z-calpp-evt-r";
+ cr.className = 'z-calpp-evt-r';
if (ce._ed.getTime() - (ed.getTime() + (oneDay * ci)) >= 1000) {
var d = new Date(ce._ed.getTime() - 1000),
info = [
- ce.id + "-fr",
+ ce.id + '-fr',
zcls,
- zcls + "-right",
- d.getMonth() + 1 + "/" + d.getDate(),
+ zcls + '-right',
+ d.getMonth() + 1 + '/' + d.getDate(),
hc ? ' style="background:' + hc + '"' : '',
cc ? ' style="background:' + cc + '"' : '',
cc ? ' style="border-bottom-color:' + cc + ';border-top-color:' + cc + '"' : '',
cc ? ' style="background:' + cc + '"' : ''
- ];
- cr.innerHTML = widget.evtTemplate.replace(new RegExp("%([1-8])", "g"), function (match, index) {
+ ];
+ cr.innerHTML = widget.itemTemplate.replace(new RegExp("%([1-8])", "g"), function (match, index) {
return info[index - 1];
});
} else
- cr.innerHTML = "";
+ cr.innerHTML = '';
}
- zk(pp).cleanVisibility();
+ zk(pp).cleanVisibility();
evt.stop();
},
@@ -1294,24 +1294,24 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
data = zk.copy({dragged: drag.control}, evt.data),
ce;
- if ((ce = zk.Widget.$(target)) &&
+ if ((ce = zk.Widget.$(target)) &&
ce.className != 'calendar.CalendarsDefault') {
- data.ce = ce.event.id;
+ data.ce = ce.item.id;
target = ce.$n().parentNode;
}
- if (jq.nodeName(target, 'td') &&
+ if (jq.nodeName(target, 'td') &&
jq(target.offsetParent).hasClass('z-calendars-daylong-cnt')) {
time.setDate(time.getDate() + target.cellIndex);
} else if (jq(target).hasClass('z-calendars-week-day-cnt')) {
target = target.parentNode;
time.setDate(time.getDate() + target.cellIndex - this.ts);
- var cnt = this.$n("cnt"),
+ var cnt = this.$n('cnt'),
offs = zk(cnt).revisedOffset(),
- rows = Math.floor((evt.pageY + cnt.scrollTop - offs[1]) / this.perHeight)
+ rows = Math.floor((evt.pageY + cnt.scrollTop - offs[1]) / this.perHeight)
+ this.beginIndex;
- time.setMinutes(time.getMinutes() + rows * 60/this._timeslots );
+ time.setMinutes(time.getMinutes() + rows * 60 / this._timeslots);
} else return;
data.time = this.fixTimeZoneFromClient(time);
this.fire('onDrop', data, null, zk.Widget.auDelay);
@@ -1326,10 +1326,10 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
var uuid = this.uuid;
if (bd.getMinutes() == ed.getMinutes() && bd.getHours() == ed.getHours()) {
jq.alert('The DST begin time and end time cannot be equal', {icon: 'ERROR'});
- jq('#'+uuid+'-dd').remove();
+ jq('#' + uuid + '-dd').remove();
delete this._ghost[uuid];
if (id)
- jq(id, zk)[0].style.visibility = "";
+ jq(id, zk)[0].style.visibility = '';
} else {
//ZKCAL-50: add event on DST start day
var zoneBd = this.zoneBd,
@@ -1345,15 +1345,15 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
jq.innerWidth(),
jq.innerHeight()
],
- eventName = "onEventCreate";
+ eventName = 'onItemCreate';
if (id) {
data.unshift(id);
- eventName = "onEventUpdate";
+ eventName = 'onItemUpdate';
}
this.fire(eventName, {data: data});
var widget = this;
- this._ghost[uuid] = function () {
- jq('#'+uuid+'-dd').remove();
+ this._ghost[uuid] = function () {
+ jq('#' + uuid + '-dd').remove();
delete widget._ghost[uuid];
};
}
@@ -1361,13 +1361,13 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
getTimeIndex: function (date) {
var timeslots = this._timeslots,
- timeslotTime = 60/timeslots,
+ timeslotTime = 60 / timeslots,
// ZKCAL-70: index out of number of total slots index
index = Math.max(((date.getHours() - this._bt) * timeslots) +
- Math.floor(date.getMinutes()/timeslotTime), 0),
+ Math.floor(date.getMinutes() / timeslotTime), 0),
maxAvailableTimeslotIndex = (this._et - this._bt) * timeslots - 1;
- return Math.min(index, maxAvailableTimeslotIndex);
+ return Math.min(index, maxAvailableTimeslotIndex);
},
_getTimeOffset: function (d, dur, dur2) {
@@ -1375,14 +1375,14 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
index = dur2 ? dur2 : this.getTimeIndex(d) + dur,
timeslots = this._timeslots;
- d1.setHours(this._bt + Math.floor(index/timeslots), (index%timeslots) * (60/timeslots), 0, 0);
+ d1.setHours(this._bt + Math.floor(index / timeslots), (index % timeslots) * (60 / timeslots), 0, 0);
d.setMilliseconds(0);
return dur2 ? d1 - d : d - d1;
- },
+ },
- fixPosition: function () {
- var cnt = this.$n("cnt"),
+ fixPosition: function () {
+ var cnt = this.$n('cnt'),
row = this.cntRows,
perHgh = this.perHeight,
weekDay = this.weekDay,
@@ -1394,19 +1394,19 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
var list = this._daySpace[i];
if (!list.length) continue;
var data = [];
- for (var n = slotCount; n--;)
+ for (var n = slotCount; n--;)
data[n] = [];
- for (var k = 0, l =list.length; k < l; k++) {
+ for (var k = 0, l = list.length; k < l; k++) {
var ce = list[k],
- childWidget = zk.Widget.$(ce),
- target= weekDay[ce._preOffset].firstChild,
- event = childWidget.event,
- bd = new Date(event.zoneBd),
- ed = new Date(event.zoneEd),
+ childWidget = zk.Widget.$(ce),
+ target = weekDay[ce._preOffset].firstChild,
+ item = childWidget.item,
+ bd = new Date(item.zoneBd),
+ ed = new Date(item.zoneEd),
isCrossDay = ed.getDate() != bd.getDate();
- jq(target).append(ce);
- ce.style.visibility = "";
+ jq(target).append(ce);
+ ce.style.visibility = '';
ce._bd = bd;
ce._ed = ed;
@@ -1415,7 +1415,7 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
ed = new Date(ed.getTime() - 1000);
// fix hgh
- var bi = this.getTimeIndex(bd),
+ var bi = this.getTimeIndex(bd),
ei = this.getTimeIndex(ed),
top = bi * perHgh,
timeslots = this._timeslots,
@@ -1423,12 +1423,12 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
edHeightOffs = 0;
if (bi) {
- var bdTimeslot = _getHightOffsPercent(bd, timeslots)
- bdHeightOffs = bdTimeslot ? perHgh * bdTimeslot: 0;
+ var bdTimeslot = _getHightOffsPercent(bd, timeslots);
+ bdHeightOffs = bdTimeslot ? perHgh * bdTimeslot : 0;
}
if (ei) {
- var edTimeslot = _getHightOffsPercent(ed, timeslots)
- edHeightOffs = edTimeslot ? perHgh * edTimeslot: 0;
+ var edTimeslot = _getHightOffsPercent(ed, timeslots);
+ edHeightOffs = edTimeslot ? perHgh * edTimeslot : 0;
if (isCrossDay)//ZKCAL-29
ed = new Date(ed.getTime() + 1000);
}
@@ -1436,7 +1436,7 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
ce._bi = bi;
ce._ei = ei;
ce.style.top = jq.px(top + bdHeightOffs);
- _setEvtWgtHeight(this, ce, ce.id, ((ei -bi) * perHgh) - bdHeightOffs + edHeightOffs);
+ _setItemWgtHeight(this, ce, ce.id, ((ei - bi) * perHgh) - bdHeightOffs + edHeightOffs);
if (bi < 0) continue;
@@ -1445,7 +1445,7 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
var tmp = data[bi++];
if (tmp[n]) {
for (;;) {
- if (!tmp[++n])
+ if (!tmp[++n])
break;
}
}
@@ -1455,46 +1455,46 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
this.clearGhost();
- // fix width
+ // fix width
var childWidget = list[list.length - 1],
target = weekDay[childWidget._preOffset].firstChild;
for (var ce = target.firstChild; ce; ce = ce.nextSibling) {
- var bd = ce._bd,
- bi = ce._bi,
- ei = ce._ei,
- maxSize = 0,
+ var bd = ce._bd,
+ bi = ce._bi,
+ ei = ce._ei,
+ maxSize = 0,
tmp = {};
if (bi < 0) continue;
for (var m = bi; m <= ei && m < slotCount; m++) {
var len = data[m].length;
- if (maxSize < len)
+ if (maxSize < len)
maxSize = len;
for (var n = 0; n < len; n++) {
- if (!data[m][n] || tmp[data[m][n].id])
+ if (!data[m][n] || tmp[data[m][n].id])
continue;
tmp[data[m][n].id] = 1;
var ei2 = data[m][n]._ei;
- if (ei < ei2)
+ if (ei < ei2)
ei = ei2;
}
}
- var len = maxSize? maxSize: 1,
+ var len = maxSize ? maxSize : 1,
width = 100 / len,
index = data[bi].indexOf(ce);
- if (index == maxSize - 1)
- ce.style.width = width + "%";
- else
- ce.style.width = (width * 1.7) + "%";
- ce.style.left = width * index + "%";
+ if (index == maxSize - 1)
+ ce.style.width = width + '%';
+ else
+ ce.style.width = (width * 1.7) + '%';
+ ce.style.left = width * index + '%';
- var fce = ce.previousSibling,
- moved = false;
+ var fce = ce.previousSibling,
+ moved = false;
// adjust the order
- while (fce) {
+ while (fce) {
if (data[fce._bi].indexOf(fce) > index) {
fce = fce.previousSibling;
moved = true;
@@ -1506,15 +1506,15 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
}
break;
}
- }
+ }
}
}
- },
+ },
beforeSize: zk.ie6_ ? function (cmp) {
- var inner = this.$n("inner");
- inner.style.height = "0px";
- inner.lastChild.style.height = "0px";
+ var inner = this.$n('inner');
+ inner.style.height = '0px';
+ inner.lastChild.style.height = '0px';
} : function () {return false;},
onSize: _zkf = function () {
@@ -1524,7 +1524,7 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
this.createChildrenWidget_();
this._rePositionDaylong();
this._rePositionDay();
- var a = this.$n("hdarrow");
+ var a = this.$n('hdarrow');
//arrow position
a.style.left = jq.px((a.parentNode.offsetWidth * this.ts - a.offsetWidth) - 5);
}
@@ -1534,12 +1534,12 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
this.clearGhost();
if (!hgh) return;
- var inner = this.$n("inner"),
- cnt = this.$n("cnt"),
+ var inner = this.$n('inner'),
+ cnt = this.$n('cnt'),
cntHeight = zk(inner.parentNode).padBorderHeight() +
zk(inner).padBorderHeight() +
zk(cnt).padBorderHeight() +
- jq(cnt).find('.z-calendars-week-cnt').outerHeight() +
+ jq(cnt).find('.z-calendars-week-cnt').outerHeight() +
jq(inner).find('.z-calendars-week-header').height(),
row = this.cntRows;
for (var child = cmp.firstChild; child; child = child.nextSibling) {
@@ -1587,16 +1587,16 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
var cnt = dg.node,
widget = dg.control;
- if (zk.processing || !cnt._lefts || p[0] <= cnt._lefts[0] || p[0] > cnt._lefts[cnt._lefts.length-1])
+ if (zk.processing || !cnt._lefts || p[0] <= cnt._lefts[0] || p[0] > cnt._lefts[cnt._lefts.length - 1])
return true;
// clear ghost
widget.clearGhost();
var n = evt.domTarget,
targetWidget = zk.Widget.$(n);
- if (targetWidget.className == 'calendar.DayEvent' && (!n.parentNode || targetWidget.event.isLocked ))
+ if (targetWidget.className == 'calendar.DayItem' && (!n.parentNode || targetWidget.item.isLocked))
return true;
- else if (n.nodeType == 1 && (jq(n).hasClass("z-calevent-resizer-icon")) || jq(n).hasClass("z-calevent-resizer")) {
+ else if (n.nodeType == 1 && (jq(n).hasClass('z-calitem-resizer-icon')) || jq(n).hasClass('z-calitem-resizer')) {
if (widget._dragItems[cnt.id])
widget._dragItems[cnt.id]._zrz = true;
}
@@ -1607,7 +1607,7 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
var cnt = dg.node,
targetWidget = dg.control._resizing ? dg.control._resizing : zk.Widget.$(evt.domTarget),
- ce = targetWidget.className == 'calendar.DayEvent'? targetWidget.$n(): null,
+ ce = targetWidget.className == 'calendar.DayItem' ? targetWidget.$n() : null,
widget = dg.control,
ts = widget.ts,
cells = widget.cntRows.cells,
@@ -1620,18 +1620,18 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
b: ts, // begin index
ph: ph, // per height
th: cells[ts].firstChild.offsetHeight // total height
- }
+ };
if (!ce) _createDragStart(dg, evt);
else {
- var timeslotTime = 60/widget._timeslots,
- bdOffs = ce._bd.getMinutes()%timeslotTime,
- edOffs = ce._ed.getMinutes()%timeslotTime;
+ var timeslotTime = 60 / widget._timeslots,
+ bdOffs = ce._bd.getMinutes() % timeslotTime,
+ edOffs = ce._ed.getMinutes() % timeslotTime;
if (bdOffs || edOffs) {
jq.alert('Only allowed to move within fitted timeslot', {icon: 'ERROR'});
ce._error = true;
- ce.style.visibility = "";
- jq('#'+widget.uuid+'-dd').remove();
+ ce.style.visibility = '';
+ jq('#' + widget.uuid + '-dd').remove();
}
var faker = ce.cloneNode(true),
@@ -1643,8 +1643,8 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
//reset
ce.parentNode.appendChild(faker);
- ce.style.visibility = "hidden";
- dg.node = jq('#'+uuid+'-dd')[0];
+ ce.style.visibility = 'hidden';
+ dg.node = jq('#' + uuid + '-dd')[0];
dg._zevt = ce;
dg._zhd = dg.node.childNodes[0].firstChild.firstChild.firstChild;
@@ -1656,12 +1656,12 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
dg._zoffs.bi = beginIndex + Math.floor(ce.offsetTop / ph);
// end index
dg._zoffs.ei = beginIndex + Math.ceil(ce.offsetHeight / ph);
- }
+ }
return dg.node;
},
_drawDaydrag: function (dg, p, evt) {
- if(dg._zevt && dg._zevt._error) return;
+ if (dg._zevt && dg._zevt._error) return;
var widget = dg.control,
zoffs = dg._zoffs,
@@ -1671,8 +1671,8 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
ph = zoffs.ph;
// avoid the wrong mousemove event in IE6.
- if (zk.ie6_ && zoffs.x &&
- evt.pageX == zoffs.x &&
+ if (zk.ie6_ && zoffs.x &&
+ evt.pageX == zoffs.x &&
zoffs.y == y) {
zoffs.x = null;
return;
@@ -1705,12 +1705,12 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
else _updateDragging(dg, evt);
},
- _endghostDaydrag: function (dg, origin){
- if (dg._zevt) {
+ _endghostDaydrag: function (dg, origin) {
+ if (dg._zevt) {
_updateDragEndghost(dg);
- if (dg._zrz)
+ if (dg._zrz)
_resizeDragEndghost(dg);
- } else _createDragEndghost(dg);
+ } else _createDragEndghost(dg);
},
_endDaydrag: function (dg, evt) {
@@ -1718,14 +1718,14 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
var widget = dg.control,
ghostNode = dg._zdata.ghostNode;
- if(widget._resizing){
+ if (widget._resizing) {
widget._resizing = null;
}
if (dg._zevt && dg._zevt._error) {
dg._zevt._error = false;
- dg._zevt.style.visibility = "";
- jq('#'+widget.uuid+'-dd').remove();
+ dg._zevt.style.visibility = '';
+ jq('#' + widget.uuid + '-dd').remove();
return;
}
clearInterval(widget.run);
@@ -1737,18 +1737,18 @@ calendar.CalendarsDefault = zk.$extends(calendar.Calendars, {
else _updateDragEnd(dg, evt);
// fix opera jumping
- if (zk.opera)
+ if (zk.opera)
dg.handle.scrollTop = widget._scrollInfo[widget.uuid];
- dg._zchanged = dg._zecnt = dg._zrzoffs =
- dg._zrs = dg._zdata = dg._zcells =
+ dg._zchanged = dg._zecnt = dg._zrzoffs =
+ dg._zrs = dg._zdata = dg._zcells =
dg._zoffs = dg._zevt = null;
},
- _resetPosition: function (faker, widget) {
- faker.style.width = "100%";
- faker.style.left = "0px";
- jq(faker).addClass(widget.getZclass() + "-evt-ghost");
+ _resetPosition: function (faker, widget) {
+ faker.style.width = '100%';
+ faker.style.left = '0px';
+ jq(faker).addClass(widget.getZclass() + '-evt-ghost');
}
});
})();
\ No newline at end of file
diff --git a/calendar/src/archive/web/js/calendar/CalendarsMonth.js b/calendar/src/archive/web/js/calendar/CalendarsMonth.js
index d33ff81..6d83599 100644
--- a/calendar/src/archive/web/js/calendar/CalendarsMonth.js
+++ b/calendar/src/archive/web/js/calendar/CalendarsMonth.js
@@ -29,22 +29,22 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
woyRowTemplate: '
',
$define: {
- events: function () {
- this._events = jq.evalJSON(this._events);
+ items: function () {
+ this._items = jq.evalJSON(this._items);
if (!this.$n()) return;
for (var i = this.nChildren; i--;) {
var child = this.getChildAt(i),
className = child.className;
- if (className == 'calendar.DayOfMonthEvent' || className == 'calendar.DaylongOfMonthEvent')
+ if (className == 'calendar.DayOfMonthItem' || className == 'calendar.DaylongOfMonthItem')
this.removeChild(child);
}
this.createChildrenWidget_();
this._rePositionDay();
- //reset evt data
- this._evtsData = this._createEvtsData(false);
+ //reset items data
+ this._itemsData = this._createItemsData(false);
// recalculate
this.onSize();
},
@@ -82,7 +82,7 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
this.woyCnt = jq(this.$n('woy')).contents().find('.' + zcls + '-week-of-year-text');
//put all day title
this.allDayTitle = jq(cnt).contents().find('.' + zcls + '-month-date-cnt');
- //put day event
+ //put day item
this.weekRows = jq(cnt).contents().find('.' + zcls + '-day-of-month-body');
this.weekRowsBg = jq(cnt).contents().find('.' + zcls + '-day-of-month-bg');
@@ -118,7 +118,7 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
});
}
- this._evtsData = this._createEvtsData(true);
+ this._itemsData = this._createItemsData(true);
if (!this._readonly)
this.editMode(true);
@@ -129,7 +129,7 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
this.$supers('unbind_', arguments);
},
- _createEvtsData: function (isAddClkEvt) {
+ _createItemsData: function (isAddClkEvt) {
var cnt = this.$n('cnt'),
rdata = [];
for (var ri = 0, n = cnt.firstChild; n; n = n.nextSibling, ri++) {
@@ -180,24 +180,24 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
this._weekDates = weekDates;
},
- _putInMapList: function (dayEvent) {
- var node = dayEvent.$n(),
- list = this._eventWeekSet[this._weekDates.indexOf(node.startWeek)];
+ _putInMapList: function (dayItem) {
+ var node = dayItem.$n(),
+ list = this._itemWeekSet[this._weekDates.indexOf(node.startWeek)];
if (!list) {
list = [];
- this._eventWeekSet[this._weekDates.indexOf(node.startWeek)] = list;
+ this._itemWeekSet[this._weekDates.indexOf(node.startWeek)] = list;
}
list.push(node);
//add cut node
- var cloneNodes = dayEvent.cloneNodes;
+ var cloneNodes = dayItem.cloneNodes;
if (!cloneNodes) return;
for (var n = cloneNodes.length; n--;) {
var cloneNode = cloneNodes[n],
index = this._weekDates.indexOf(cloneNode.startWeek);
- list = this._eventWeekSet[index];
+ list = this._itemWeekSet[index];
if (!list) {
list = [];
- this._eventWeekSet[index] = list;
+ this._itemWeekSet[index] = list;
}
list.push(cloneNode);
}
@@ -226,14 +226,14 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
var dayNode = allEvent[m];
if (m == 0)//first
- this.drawEvent_(dayNode._preOffset, zcls + '-month-date-evt', prevTr, dayNode);
+ this.drawItem_(dayNode._preOffset, zcls + '-month-date-evt', prevTr, dayNode);
else {
var preDayNode = allEvent[m - 1],
start = dayNode._preOffset,
preEnd = preDayNode._preOffset + preDayNode._days,
offset = start - preEnd;
- this.drawEvent_(offset, zcls + '-month-date-evt', prevTr, dayNode);
+ this.drawItem_(offset, zcls + '-month-date-evt', prevTr, dayNode);
}
dayNode.style.visibility = '';
if (m == n - 1) {//last
@@ -252,12 +252,12 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
var sortFunc = this.dateSorting_,
daySpace = this._daySpace,
- eventWeekSet = this._eventWeekSet,
+ itemWeekSet = this._itemWeekSet,
uuid = this.uuid;
// all day event
- for (var i = 0, j = eventWeekSet.length; i < j; i++) {
- var list = eventWeekSet[i],
+ for (var i = 0, j = itemWeekSet.length; i < j; i++) {
+ var list = itemWeekSet[i],
weekList = [];
if (!list || !list.length) continue;
list.sort(sortFunc);
@@ -448,18 +448,18 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
}
},
- cleanEvtAry_: function () {
- this._eventKey = {};
- this._eventWeekSet = [];
+ cleanItemAry_: function () {
+ this._itemKey = {};
+ this._itemWeekSet = [];
},
- processChildrenWidget_: function (isExceedOneDay, event) {
- var dayEvent = isExceedOneDay ?
- new calendar.DaylongOfMonthEvent({event: event}) :
- new calendar.DayOfMonthEvent({event: event});
+ processChildrenWidget_: function (isExceedOneDay, item) {
+ var dayItem = isExceedOneDay ?
+ new calendar.DaylongOfMonthItem({item: item}) :
+ new calendar.DayOfMonthItem({item: item});
- this.appendChild(dayEvent);
- this._putInMapList(dayEvent);
+ this.appendChild(dayItem);
+ this._putInMapList(dayItem);
},
getDragDataObj_: function () {
@@ -513,9 +513,9 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
return this._dragDataObj;
},
- reAlignEvents_: function (hasAdd) {
+ reAlignItems_: function (hasAdd) {
this._rePositionDay();
- this._evtsData = this._createEvtsData(false);
+ this._itemsData = this._createItemsData(false);
// recalculate
this.onSize();
},
@@ -523,14 +523,14 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
removeNodeInArray_: function (childWidget, hasAdd) {
var node = childWidget.$n(),
weekIndex = this._weekDates.indexOf(node.startWeek);
- this._eventWeekSet[weekIndex].$remove(node);
+ this._itemWeekSet[weekIndex].$remove(node);
var cloneNodes = childWidget.cloneNodes;
if (!cloneNodes) return;
weekIndex++;
for (var n = cloneNodes.length; n--;) {
var cloneNode = cloneNodes[n];
- this._eventWeekSet[weekIndex + n].$remove(cloneNode);
+ this._itemWeekSet[weekIndex + n].$remove(cloneNode);
}
},
@@ -544,12 +544,12 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
var widget = zk.Widget.$(cnt),
zcls = widget.getZclass(),
node = evt.target,
- ce = zk.Widget.$(node).event,
+ ce = zk.Widget.$(node).item,
p = [Math.round(evt.pageX), Math.round(evt.pageY)]; //ZKCAL-42: sometimes it returns float number in IE 10
if (jq(node).hasClass(zcls + '-evt-faker-more') && node.parentNode.id.indexOf('-frow') > 0) return;
if (ce) {
- widget.fire('onEventEdit', {
+ widget.fire('onItemEdit', {
data: [ce.id, p[0], p[1], jq.innerWidth(), jq.innerHeight()]});
} else {
var cmp = widget.$n(),
@@ -600,7 +600,7 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
ed.setHours(ed.getHours() + 2);
}
- widget.fire('onEventCreate', {
+ widget.fire('onItemCreate', {
data: [
widget.fixTimeZoneFromClient(bd),
widget.fixTimeZoneFromClient(ed),
@@ -642,7 +642,7 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
jq(pp).bind('click', widget.proxy(widget.onPopupClick));
} else {
if (widget._pp.ci == ci) {
- // ignore onEventCreate
+ // ignore onItemCreate
evt.stop();
return;
}
@@ -683,7 +683,7 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
//filling data
var cmp = widget.$n(),
- evts = widget._evtsData[widget.getIndex(row)][ci],
+ evts = widget._itemsData[widget.getIndex(row)][ci],
oneDay = calUtil.DAYTIME,
bd = targetDate,
ed = new Date(bd);
@@ -695,14 +695,14 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
cl = tr.insertCell(0),
ce = evts[i],
cewgt = zk.Widget.$(ce),
- event = cewgt.event,
- isDayLongEvent = cewgt.$instanceof(calendar.DaylongOfMonthEvent),
- hc = event.headerColor,
- cc = event.contentColor,
- zcls = event.zclass;
-
- ce._bd = ce._bd || event.zoneBd;
- ce._ed = ce._ed || event.zoneEd;
+ item = cewgt.item,
+ isDayLongEvent = cewgt.$instanceof(calendar.DaylongOfMonthItem),
+ hc = item.headerColor,
+ cc = item.contentColor,
+ zcls = item.zclass;
+
+ ce._bd = ce._bd || item.zoneBd;
+ ce._ed = ce._ed || item.zoneEd;
cl.className = 'z-calpp-month-evt-l';
if (isDayLongEvent && bd - ce._bd >= 1000) {
var info = [
@@ -716,7 +716,7 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
cc ? ' style="background:' + cc + ';border-left-color:' + cc + ';border-right-color:' + cc + '"' : '',
cc ? ' style="background:' + cc + '"' : ''
];
- cl.innerHTML = widget.evtTemplate.replace(new RegExp("%([1-9])", "g"), function (match, index) {
+ cl.innerHTML = widget.itemTemplate.replace(new RegExp("%([1-9])", "g"), function (match, index) {
return info[index - 1];
});
} else
@@ -740,7 +740,7 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
cc ? ' style="background:' + cc + ';border-left-color:' + cc + ';border-right-color:' + cc + '"' : '',
cc ? ' style="background:' + cc + '"' : ''
];
- cr.innerHTML = widget.evtTemplate.replace(new RegExp("%([1-9])", "g"), function (match, index) {
+ cr.innerHTML = widget.itemTemplate.replace(new RegExp("%([1-9])", "g"), function (match, index) {
return info[index - 1];
});
} else
@@ -771,7 +771,7 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
if ((ce = zk.Widget.$(target)) &&
ce.className != 'calendar.CalendarsMonth') {
- data.ce = ce.event.id;
+ data.ce = ce.item.id;
target = ce.$n().parentNode;
}
@@ -801,7 +801,7 @@ calendar.CalendarsMonth = zk.$extends(calendar.Calendars, {
table = n.lastChild,
rows = table.rows,
len = rows.length,
- data = this._evtsData[ri];
+ data = this._itemsData[ri];
if (len > 1 && (h < sh || rows[len - 1].id)) {
if (rows[len - 1].id && rows[len - 1].id.startsWith(this.uuid + '-frow')) {
jq(rows[len - 1]).remove();
diff --git a/calendar/src/archive/web/js/calendar/DayEvent.js b/calendar/src/archive/web/js/calendar/DayItem.js
similarity index 86%
rename from calendar/src/archive/web/js/calendar/DayEvent.js
rename to calendar/src/archive/web/js/calendar/DayItem.js
index c3efd5f..9d25dc6 100644
--- a/calendar/src/archive/web/js/calendar/DayEvent.js
+++ b/calendar/src/archive/web/js/calendar/DayItem.js
@@ -1,126 +1,126 @@
-/* Calendars.js
-
- Purpose:
-
- Description:
-
- History:
- Thu Nov 5 12:33:21 TST 2009, Created by Jimmy
-
-Copyright (C) 2009 Potix Corporation. All Rights Reserved.
-
-This program is distributed under GPL Version 3.0 in the hope that
-it will be useful, but WITHOUT ANY WARRANTY.
- */
-calendar.DayEvent = zk.$extends(calendar.Event, {
- redraw: function (out) {
- this.defineClassName_();
-
- var ce = this.event,
- id = ce.id,
- p = this.params,
- headerStyle = p.headerStyle,
- contentStyle = p.contentStyle,
- resizer = p.resizer;
- p._resizerCnt = '
';
-
- out.push('
',
- '
',
- '
',
- '
',
- '',
- '',
- '', ce.content, '
');
- // resizer
- if (!ce.isLocked)
- out.push(p._resizerCnt);
-
- out.push(' ',
- '
');
- },
- bind_: function (e) {
- this.$supers('bind_', arguments);
- var ce = this.event;
- if (ce && !ce.isLocked) {
- var wgt = this;
- jq(this.$n('resizer')).mousedown(function () {
- if (wgt.parent) {
- wgt.parent._resizing = wgt;
- }
- }).mouseup(function () {
- if (wgt.parent) wgt.parent._resizing = null;
- });
- }
- },
- unbind_: function () {
- var ce = this.event;
- if (ce && !ce.isLocked) {
- var wgt = this;
- jq(this.$n('resizer')).unbind('mousedown');
- jq(this.$n('resizer')).unbind('mouseup');
- if (this.parent) {
- this.parent._resizing = null;
- }
- }
- this.$supers('unbind_', arguments);
- },
- getEvtTitle: function (ce) {
- var bd = ce.zoneBd,
- ed = ce.zoneEd;
- return ce.title ? ce.title : (ed - bd < (7200000 / this.parent._timeslots)) ?
- (zk.fmt.Date.formatDate(bd,'HH:mm') + ' - ' + ce.content) :
- (zk.fmt.Date.formatDate(bd,'HH:mm') + ' - ' + zk.fmt.Date.formatDate(ed,'HH:mm'));
- },
-
- update: function (updateLastModify) {
- this.clearCache();
- this.defineCss_();
-
- var ce = this.event,
- p = this.params,
- contentStyle = p.contentStyle,
- cnt = jq(this.$n('cnt'));
-
- this.updateHeaderStyle_(p.headerStyle);
-
- jq(this.$n('inner')).attr('style', contentStyle);
- cnt.attr('style', contentStyle);
- cnt.children('.' + p.text).html(ce.content);
-
- jq(this.$n('hd')).html(this.getEvtTitle(ce));
-
- this._createResizer();
-
- this.calculate_(updateLastModify);
- },
-
- _createResizer: function () {
- var inner = this.$n('inner'),
- target = inner.lastChild,
- p = this.params,
- hasResizer = target.className == p.resizer;
-
- if (!this.event.isLocked) {
- if (!hasResizer)
- jq(inner).append(p._resizerCnt);
- } else if (hasResizer)
- jq(target).remove();
- },
-
- defineClassName_: function () {
- this.$super('defineClassName_', arguments);
- // CSS ClassName
- var zcls = this.getZclass(),
- p = this.params;
-
- p.header = zcls + '-header',
- p.resizer = zcls + '-resizer',
- p.resizer_icon = p.resizer + '-icon';
- },
-
- updateHeaderStyle_: function (headerStyle) {
- this.$super('updateHeaderStyle_', arguments);
- jq(this.$n('hd')).attr('style',headerStyle);
- }
+/* Calendars.js
+
+ Purpose:
+
+ Description:
+
+ History:
+ Thu Nov 5 12:33:21 TST 2009, Created by Jimmy
+
+Copyright (C) 2009 Potix Corporation. All Rights Reserved.
+
+This program is distributed under GPL Version 3.0 in the hope that
+it will be useful, but WITHOUT ANY WARRANTY.
+ */
+calendar.DayItem = zk.$extends(calendar.Item, {
+ redraw: function (out) {
+ this.defineClassName_();
+
+ var ce = this.item,
+ id = ce.id,
+ p = this.params,
+ headerStyle = p.headerStyle,
+ contentStyle = p.contentStyle,
+ resizer = p.resizer;
+ p._resizerCnt = '
';
+
+ out.push('
',
+ '
',
+ '
',
+ '
',
+ '',
+ '',
+ '', ce.content, '
');
+ // resizer
+ if (!ce.isLocked)
+ out.push(p._resizerCnt);
+
+ out.push(' ',
+ '
');
+ },
+ bind_: function (e) {
+ this.$supers('bind_', arguments);
+ var ce = this.item;
+ if (ce && !ce.isLocked) {
+ var wgt = this;
+ jq(this.$n('resizer')).mousedown(function () {
+ if (wgt.parent) {
+ wgt.parent._resizing = wgt;
+ }
+ }).mouseup(function () {
+ if (wgt.parent) wgt.parent._resizing = null;
+ });
+ }
+ },
+ unbind_: function () {
+ var ce = this.item;
+ if (ce && !ce.isLocked) {
+ var wgt = this;
+ jq(this.$n('resizer')).unbind('mousedown');
+ jq(this.$n('resizer')).unbind('mouseup');
+ if (this.parent) {
+ this.parent._resizing = null;
+ }
+ }
+ this.$supers('unbind_', arguments);
+ },
+ getItemTitle: function (ce) {
+ var bd = ce.zoneBd,
+ ed = ce.zoneEd;
+ return ce.title ? ce.title : (ed - bd < (7200000 / this.parent._timeslots)) ?
+ (zk.fmt.Date.formatDate(bd,'HH:mm') + ' - ' + ce.content) :
+ (zk.fmt.Date.formatDate(bd,'HH:mm') + ' - ' + zk.fmt.Date.formatDate(ed,'HH:mm'));
+ },
+
+ update: function (updateLastModify) {
+ this.clearCache();
+ this.defineCss_();
+
+ var ce = this.item,
+ p = this.params,
+ contentStyle = p.contentStyle,
+ cnt = jq(this.$n('cnt'));
+
+ this.updateHeaderStyle_(p.headerStyle);
+
+ jq(this.$n('inner')).attr('style', contentStyle);
+ cnt.attr('style', contentStyle);
+ cnt.children('.' + p.text).html(ce.content);
+
+ jq(this.$n('hd')).html(this.getItemTitle(ce));
+
+ this._createResizer();
+
+ this.calculate_(updateLastModify);
+ },
+
+ _createResizer: function () {
+ var inner = this.$n('inner'),
+ target = inner.lastChild,
+ p = this.params,
+ hasResizer = target.className == p.resizer;
+
+ if (!this.item.isLocked) {
+ if (!hasResizer)
+ jq(inner).append(p._resizerCnt);
+ } else if (hasResizer)
+ jq(target).remove();
+ },
+
+ defineClassName_: function () {
+ this.$super('defineClassName_', arguments);
+ // CSS ClassName
+ var zcls = this.getZclass(),
+ p = this.params;
+
+ p.header = zcls + '-header',
+ p.resizer = zcls + '-resizer',
+ p.resizer_icon = p.resizer + '-icon';
+ },
+
+ updateHeaderStyle_: function (headerStyle) {
+ this.$super('updateHeaderStyle_', arguments);
+ jq(this.$n('hd')).attr('style', headerStyle);
+ }
});
\ No newline at end of file
diff --git a/calendar/src/archive/web/js/calendar/DayOfMonthEvent.js b/calendar/src/archive/web/js/calendar/DayOfMonthItem.js
similarity index 90%
rename from calendar/src/archive/web/js/calendar/DayOfMonthEvent.js
rename to calendar/src/archive/web/js/calendar/DayOfMonthItem.js
index 69ff562..230b12e 100644
--- a/calendar/src/archive/web/js/calendar/DayOfMonthEvent.js
+++ b/calendar/src/archive/web/js/calendar/DayOfMonthItem.js
@@ -1,63 +1,63 @@
-/* Calendars.js
-
- Purpose:
-
- Description:
-
- History:
- Thu Nov 5 12:33:21 TST 2009, Created by Jimmy
-
-Copyright (C) 2009 Potix Corporation. All Rights Reserved.
-
-This program is distributed under GPL Version 3.0 in the hope that
-it will be useful, but WITHOUT ANY WARRANTY.
- */
-calendar.DayOfMonthEvent = zk.$extends(calendar.Event, {
-
- redraw: function (out) {
- var ce = this.event,
- id = ce.id,
- headerColor = ce.headerColor,
- innerStyle = headerColor ? ' style="background:' + headerColor + '"' : '',
- zcls = this.getZclass(),
- inner = zcls + '-inner',
- header = zcls + '-header',
- content = zcls + '-cnt';
-
- this.uuid = id;
-
- out.push('
',
- '
',
- '',
- '', ce.content, '
');
- },
-
- getCntText: function (ce) {
- return ce.title ? ce.title.substr(0,ce.title.indexOf(' - ')) :
- zk.fmt.Date.formatDate(ce.zoneBd,'HH:mm');
- },
-
- domClass_: function (no) {
- var scls = this.$supers('domClass_', arguments);
- return scls + ' ' + this.getZclass() + '-month';
- },
-
- getDays: function () {
- return 1;
- },
-
- update: function (updateLastModify) {
- var ce = this.event,
- inner = jq(this.$n('inner')),
- hd = jq(this.$n('hd')),
- cnt = jq(this.$n('cnt')),
- headerColor = ce.headerColor,
- innerStyle = headerColor ? 'background:' + headerColor : '';
-
- inner.attr('style', innerStyle);
- hd.html(this.getCntText(ce) + ' ');
- cnt.html(ce.content);
-
- this.calculate_(updateLastModify);
- }
+/* Calendars.js
+
+ Purpose:
+
+ Description:
+
+ History:
+ Thu Nov 5 12:33:21 TST 2009, Created by Jimmy
+
+Copyright (C) 2009 Potix Corporation. All Rights Reserved.
+
+This program is distributed under GPL Version 3.0 in the hope that
+it will be useful, but WITHOUT ANY WARRANTY.
+ */
+calendar.DayOfMonthItem = zk.$extends(calendar.Item, {
+
+ redraw: function (out) {
+ var ce = this.item,
+ id = ce.id,
+ headerColor = ce.headerColor,
+ innerStyle = headerColor ? ' style="background:' + headerColor + '"' : '',
+ zcls = this.getZclass(),
+ inner = zcls + '-inner',
+ header = zcls + '-header',
+ content = zcls + '-cnt';
+
+ this.uuid = id;
+
+ out.push('
',
+ '
',
+ '',
+ '', ce.content, '
');
+ },
+
+ getCntText: function (ce) {
+ return ce.title ? ce.title.substr(0,ce.title.indexOf(' - ')) :
+ zk.fmt.Date.formatDate(ce.zoneBd,'HH:mm');
+ },
+
+ domClass_: function (no) {
+ var scls = this.$supers('domClass_', arguments);
+ return scls + ' ' + this.getZclass() + '-month';
+ },
+
+ getDays: function () {
+ return 1;
+ },
+
+ update: function (updateLastModify) {
+ var ce = this.item,
+ inner = jq(this.$n('inner')),
+ hd = jq(this.$n('hd')),
+ cnt = jq(this.$n('cnt')),
+ headerColor = ce.headerColor,
+ innerStyle = headerColor ? 'background:' + headerColor : '';
+
+ inner.attr('style', innerStyle);
+ hd.html(this.getCntText(ce) + ' ');
+ cnt.html(ce.content);
+
+ this.calculate_(updateLastModify);
+ }
});
\ No newline at end of file
diff --git a/calendar/src/archive/web/js/calendar/DaylongEvent.js b/calendar/src/archive/web/js/calendar/DaylongItem.js
similarity index 84%
rename from calendar/src/archive/web/js/calendar/DaylongEvent.js
rename to calendar/src/archive/web/js/calendar/DaylongItem.js
index f3febcb..cf2b531 100644
--- a/calendar/src/archive/web/js/calendar/DaylongEvent.js
+++ b/calendar/src/archive/web/js/calendar/DaylongItem.js
@@ -1,25 +1,25 @@
-/* Calendars.js
-
- Purpose:
-
- Description:
-
- History:
- Thu Nov 5 12:33:21 TST 2009, Created by Jimmy
-
-Copyright (C) 2009 Potix Corporation. All Rights Reserved.
-
-This program is distributed under GPL Version 3.0 in the hope that
-it will be useful, but WITHOUT ANY WARRANTY.
- */
-calendar.DaylongEvent = zk.$extends(calendar.LongEvent, {
-
- getCornerStyle_: function () {
- return '';
- },
-
- getDays: function () {
- var node = this.$n();
- return this.parent._days - node._preOffset - node._afterOffset;
- }
+/* Calendars.js
+
+ Purpose:
+
+ Description:
+
+ History:
+ Thu Nov 5 12:33:21 TST 2009, Created by Jimmy
+
+Copyright (C) 2009 Potix Corporation. All Rights Reserved.
+
+This program is distributed under GPL Version 3.0 in the hope that
+it will be useful, but WITHOUT ANY WARRANTY.
+ */
+calendar.DaylongItem = zk.$extends(calendar.LongItem, {
+
+ getCornerStyle_: function () {
+ return '';
+ },
+
+ getDays: function () {
+ var node = this.$n();
+ return this.parent._days - node._preOffset - node._afterOffset;
+ }
});
\ No newline at end of file
diff --git a/calendar/src/archive/web/js/calendar/DaylongOfMonthEvent.js b/calendar/src/archive/web/js/calendar/DaylongOfMonthItem.js
similarity index 87%
rename from calendar/src/archive/web/js/calendar/DaylongOfMonthEvent.js
rename to calendar/src/archive/web/js/calendar/DaylongOfMonthItem.js
index dffb956..a382730 100644
--- a/calendar/src/archive/web/js/calendar/DaylongOfMonthEvent.js
+++ b/calendar/src/archive/web/js/calendar/DaylongOfMonthItem.js
@@ -1,157 +1,157 @@
-/* Calendars.js
-
- Purpose:
-
- Description:
-
- History:
- Thu Nov 5 12:33:21 TST 2009, Created by Jimmy
-
-Copyright (C) 2009 Potix Corporation. All Rights Reserved.
-
-This program is distributed under GPL Version 3.0 in the hope that
-it will be useful, but WITHOUT ANY WARRANTY.
- */
-calendar.DaylongOfMonthEvent = zk.$extends(calendar.LongEvent, {
-
- $init: function () {
- this.$supers('$init', arguments);
- this.cloneNodes = [];
- },
-
- getCornerStyle_: function () {
- return this.params.contentStyle;
- },
-
- getInnerStyle_: function () {
- return this.params.innerStyle;
- },
-
- domClass_: function (no) {
- var scls = this.$supers('domClass_', arguments);
- return scls + ' ' + this.getZclass() + '-daylong-month';
- },
-
- getDays: function () {
- var node = this.$n();
-
- if (this.cloneCount)
- return 7 - node._preOffset;
-
- return 7 - node._preOffset - node._afterOffset;
- },
-
- processCloneNode_: function (node) {
- var parent = this.parent,
- weekDates = parent._weekDates,
- ed = node.lowerBoundEd,
- startWeek = node.startWeek,
- cloneCount;
- //calculate over next week
- if (ed > startWeek.zoneEd)
- cloneCount = Math.ceil(calUtil.getPeriod(ed, startWeek.zoneEd) / 7);
- this._processCloneNode(weekDates, cloneCount);
-
- node.zoneEd = cloneCount ? startWeek.zoneEd : this.event.zoneEd;
- },
-
- _createCloneNode: function (index) {
- var uuid = this.uuid,
- event = this.event,
- cloneNode = this.$n().cloneNode(true),
- body = jq(cloneNode).children('#' + this.uuid + '-body')[0],
- cnt = body.firstChild.firstChild;
-
- //change id
- cloneNode.id = uuid + '-sub' + index;
- body.id = uuid + '-sub' + index + '-body';
- cnt.id = uuid + '-sub' + index + '-cnt';
-
- cloneNode.cnt = cnt;
- cloneNode.body = body;
- cloneNode._preOffset = 0;
- cloneNode._afterOffset = 0;
- cloneNode.zoneBd = event.zoneBd;
- cloneNode.zoneEd = event.zoneEd;
- cloneNode._days = 7;
-
- return cloneNode;
- },
-
- _processCloneNode: function (weekDates, cloneCount) {
- this.cloneNodes = [];
- this.cloneCount = cloneCount;
- if (!cloneCount) return;
-
- var node = this.$n(),
- body = jq(this.$n('body')),
- startWeekIndex = weekDates.indexOf(node.startWeek) + 1,
- p = this.params,
- left_arrow = p.left_arrow,
- hasLeftArrow = body.hasClass(left_arrow);
- left_arrowCnt = p.left_arrowCnt;
-
- //add right arrow if over next week
- body.addClass(p.right_arrow);
-
- //clone node
- for (var i = 0, j = cloneCount; i < j; i++) {
- var cloneNode = this._createCloneNode(i),
- cloneBody = jq(cloneNode.body),
- startWeek = weekDates[startWeekIndex + i];
-
- cloneNode.startWeek = startWeek;
- cloneNode.upperBoundBd = startWeek.zoneBd;
- cloneNode.lowerBoundEd = startWeek.zoneEd;
-
- // always has left arrow because clone node always over previous week
- if (!hasLeftArrow) {
- cloneBody.addClass(left_arrow);
- }
- this.cloneNodes.push(cloneNode);
- }
-
- this._processLastCloneNode(cloneCount);
-
- },
-
- _processLastCloneNode: function (cloneCount) {
- var cloneNode = this.cloneNodes[cloneCount - 1],
- cloneBody = jq(cloneNode.body),
- lowerBoundEd = this.$n().lowerBoundEd,
- p = this.params,
- isAfter = this.event.zoneEd > this.parent.zoneEd;
-
- cloneNode.lowerBoundEd = lowerBoundEd;
- cloneNode._afterOffset = calUtil.getPeriod(cloneNode.startWeek.zoneEd, lowerBoundEd);
- cloneNode._days = 7 - cloneNode._afterOffset;
-
- if (!isAfter) {
- cloneBody.removeClass(p.right_arrow);
- }
- },
-
- defineClassName_: function () {
- this.$super('defineClassName_', arguments);
-
- var contentColor = this.event.contentColor;
-
- this.params.innerStyle = contentColor ? ' style="background:' + contentColor +
- ';border-left-color:' + contentColor +
- ';border-right-color:' + contentColor + '"' : '';
- },
-
- defineCss_: function () {
- this.$super('defineCss_', arguments);
-
- var contentColor = this.event.contentColor;
-
- this.params.innerStyle = contentColor ? 'background:' + contentColor +
- ';border-left-color:' + contentColor +
- ';border-right-color:' + contentColor : '';
- },
-
- updateContentStyle_: function (contentStyle) {
- // do nothing after ZKCAL-76, t2/b2 was removed
- }
+/* Calendars.js
+
+ Purpose:
+
+ Description:
+
+ History:
+ Thu Nov 5 12:33:21 TST 2009, Created by Jimmy
+
+Copyright (C) 2009 Potix Corporation. All Rights Reserved.
+
+This program is distributed under GPL Version 3.0 in the hope that
+it will be useful, but WITHOUT ANY WARRANTY.
+ */
+calendar.DaylongOfMonthItem = zk.$extends(calendar.LongItem, {
+
+ $init: function () {
+ this.$supers('$init', arguments);
+ this.cloneNodes = [];
+ },
+
+ getCornerStyle_: function () {
+ return this.params.contentStyle;
+ },
+
+ getInnerStyle_: function () {
+ return this.params.innerStyle;
+ },
+
+ domClass_: function (no) {
+ var scls = this.$supers('domClass_', arguments);
+ return scls + ' ' + this.getZclass() + '-daylong-month';
+ },
+
+ getDays: function () {
+ var node = this.$n();
+
+ if (this.cloneCount)
+ return 7 - node._preOffset;
+
+ return 7 - node._preOffset - node._afterOffset;
+ },
+
+ processCloneNode_: function (node) {
+ var parent = this.parent,
+ weekDates = parent._weekDates,
+ ed = node.lowerBoundEd,
+ startWeek = node.startWeek,
+ cloneCount;
+ //calculate over next week
+ if (ed > startWeek.zoneEd)
+ cloneCount = Math.ceil(calUtil.getPeriod(ed, startWeek.zoneEd) / 7);
+ this._processCloneNode(weekDates, cloneCount);
+
+ node.zoneEd = cloneCount ? startWeek.zoneEd : this.item.zoneEd;
+ },
+
+ _createCloneNode: function (index) {
+ var uuid = this.uuid,
+ item = this.item,
+ cloneNode = this.$n().cloneNode(true),
+ body = jq(cloneNode).children('#' + this.uuid + '-body')[0],
+ cnt = body.firstChild.firstChild;
+
+ //change id
+ cloneNode.id = uuid + '-sub' + index;
+ body.id = uuid + '-sub' + index + '-body';
+ cnt.id = uuid + '-sub' + index + '-cnt';
+
+ cloneNode.cnt = cnt;
+ cloneNode.body = body;
+ cloneNode._preOffset = 0;
+ cloneNode._afterOffset = 0;
+ cloneNode.zoneBd = item.zoneBd;
+ cloneNode.zoneEd = item.zoneEd;
+ cloneNode._days = 7;
+
+ return cloneNode;
+ },
+
+ _processCloneNode: function (weekDates, cloneCount) {
+ this.cloneNodes = [];
+ this.cloneCount = cloneCount;
+ if (!cloneCount) return;
+
+ var node = this.$n(),
+ body = jq(this.$n('body')),
+ startWeekIndex = weekDates.indexOf(node.startWeek) + 1,
+ p = this.params,
+ left_arrow = p.left_arrow,
+ hasLeftArrow = body.hasClass(left_arrow);
+ left_arrowCnt = p.left_arrowCnt;
+
+ //add right arrow if over next week
+ body.addClass(p.right_arrow);
+
+ //clone node
+ for (var i = 0, j = cloneCount; i < j; i++) {
+ var cloneNode = this._createCloneNode(i),
+ cloneBody = jq(cloneNode.body),
+ startWeek = weekDates[startWeekIndex + i];
+
+ cloneNode.startWeek = startWeek;
+ cloneNode.upperBoundBd = startWeek.zoneBd;
+ cloneNode.lowerBoundEd = startWeek.zoneEd;
+
+ // always has left arrow because clone node always over previous week
+ if (!hasLeftArrow) {
+ cloneBody.addClass(left_arrow);
+ }
+ this.cloneNodes.push(cloneNode);
+ }
+
+ this._processLastCloneNode(cloneCount);
+
+ },
+
+ _processLastCloneNode: function (cloneCount) {
+ var cloneNode = this.cloneNodes[cloneCount - 1],
+ cloneBody = jq(cloneNode.body),
+ lowerBoundEd = this.$n().lowerBoundEd,
+ p = this.params,
+ isAfter = this.item.zoneEd > this.parent.zoneEd;
+
+ cloneNode.lowerBoundEd = lowerBoundEd;
+ cloneNode._afterOffset = calUtil.getPeriod(cloneNode.startWeek.zoneEd, lowerBoundEd);
+ cloneNode._days = 7 - cloneNode._afterOffset;
+
+ if (!isAfter) {
+ cloneBody.removeClass(p.right_arrow);
+ }
+ },
+
+ defineClassName_: function () {
+ this.$super('defineClassName_', arguments);
+
+ var contentColor = this.item.contentColor;
+
+ this.params.innerStyle = contentColor ? ' style="background:' + contentColor +
+ ';border-left-color:' + contentColor +
+ ';border-right-color:' + contentColor + '"' : '';
+ },
+
+ defineCss_: function () {
+ this.$super('defineCss_', arguments);
+
+ var contentColor = this.item.contentColor;
+
+ this.params.innerStyle = contentColor ? 'background:' + contentColor +
+ ';border-left-color:' + contentColor +
+ ';border-right-color:' + contentColor : '';
+ },
+
+ updateContentStyle_: function (contentStyle) {
+ // do nothing after ZKCAL-76, t2/b2 was removed
+ }
});
\ No newline at end of file
diff --git a/calendar/src/archive/web/js/calendar/Event.js b/calendar/src/archive/web/js/calendar/Item.js
similarity index 79%
rename from calendar/src/archive/web/js/calendar/Event.js
rename to calendar/src/archive/web/js/calendar/Item.js
index d475799..e4e147f 100644
--- a/calendar/src/archive/web/js/calendar/Event.js
+++ b/calendar/src/archive/web/js/calendar/Item.js
@@ -1,143 +1,143 @@
-/* Calendars.js
-
- Purpose:
-
- Description:
-
- History:
- Thu Nov 5 12:33:21 TST 2009, Created by Jimmy
-
-Copyright (C) 2009 Potix Corporation. All Rights Reserved.
-
-This program is distributed under GPL Version 3.0 in the hope that
-it will be useful, but WITHOUT ANY WARRANTY.
- */
-calendar.Event = zk.$extends(zk.Widget, {
- bind_: function () {
- this.$supers('bind_', arguments);
- this.calculate_(true);
- },
-
- unbind_: function () {
- var node = this.$n();
-
- node.zoneBd = node.zoneEd = node._preOffset = node._afterOffset =
- node._days = this.event = null;
- this.$supers('unbind_', arguments);
- },
-
- defineClassName_: function () {
- var zcls = this.getZclass(),
- ce = this.event,
- headerColor = ce.headerColor,
- contentColor = ce.contentColor;
-
- this.params = {
- // CSS ClassName
- body: zcls + '-body',
- inner: zcls + '-inner',
- content: zcls + '-cnt',
- text: zcls + '-text',
- headerStyle: headerColor ? ' style="background:' + headerColor + '"' : '',
- contentStyle: contentColor ? ' style="background:' + contentColor + '"' : ''
- };
- this.uuid = ce.id;
- },
-
- defineCss_: function () {
- var ce = this.event,
- headerColor = ce.headerColor,
- contentColor = ce.contentColor,
- p = this.params;
- p.headerStyle = headerColor ? 'background:' + headerColor : '';
- p.contentStyle = contentColor ? 'background:' + contentColor : '';
- },
-
- updateHeaderStyle_: function (headerStyle) {
- var node = jq(this.$n()),
- body = jq(this.$n('body')),
- p = this.params;
- body.attr('style', headerStyle);
- body.children('.' + p.inner).attr('style', this.getInnerStyle_());
- },
-
- getZclass: function () {
- var zcls = this.event.zclass;
- return zcls ? zcls : 'z-calevent';
- },
-
- getInnerStyle_: function () {
- return this.params.headerStyle;
- },
-
- calculate_: function (updateLastModify) {
- var node = this.$n(),
- event = this.event,
- parent = this.parent,
- bd = event.zoneBd,
- ed = event.zoneEd,
- inMon = parent.mon;
-
- if (inMon)
- node.startWeek = event.startWeek;
-
- var time = inMon ? node.startWeek : parent;
-
- node.zoneBd = bd;
- node.zoneEd = ed;
-
- this._createBoundTime(node, bd, ed);
-
- //_afterOffset could be calculated using bound time after processing clone node
- if (this.processCloneNode_)
- this.processCloneNode_(node);
-
- node._preOffset = event._preOffset;
-
- if (this._isDayEvent()) return;
-
- node._afterOffset = this.cloneCount ? 0 :
- this._getOffset({start: node.lowerBoundEd, end: time.zoneEd});
-
- node._days = event._days = this.getDays();
- if (updateLastModify)
- node._lastModify = new Date().getTime();
- },
-
- isBeginTimeChange: function (event) {
- return this.$n().zoneBd.getTime() != event.zoneBd.getTime();
- },
-
- _createBoundTime: function (node, bd, ed) {
- //have findBoundTime_ function
- if (this.findBoundTime_) {
- var time = this.findBoundTime_(bd, ed);
- bd = time.bd;
- ed = time.ed;
- }
- node.upperBoundBd = this._setBoundDate(bd);
- if (this._isDayEvent()) return;
- node.lowerBoundEd = this._setBoundDate(ed, true);
- },
-
- _isDayEvent: function () {
-// zk.log(this.$instanceof(calendarDayEvent));
- if (!this._isDayEvt)
- this._isDayEvt = this.className == 'calendar.DayEvent';
- return this._isDayEvt;
- },
-
- _getOffset: function (time) {
- return calUtil.getPeriod(time.end, time.start);
- },
-
- _setBoundDate: function (date, isAddOneDay) {
- var result = new Date(date);
- if (date.getHours() + date.getMinutes() + date.getSeconds() + date.getMilliseconds() != 0) {
- if (isAddOneDay)
- result = calUtil.addDay(date, 1);
- result.setHours(0,0,0,0);
- }
- return result;
- }
+/* Calendars.js
+
+ Purpose:
+
+ Description:
+
+ History:
+ Thu Nov 5 12:33:21 TST 2009, Created by Jimmy
+
+Copyright (C) 2009 Potix Corporation. All Rights Reserved.
+
+This program is distributed under GPL Version 3.0 in the hope that
+it will be useful, but WITHOUT ANY WARRANTY.
+ */
+calendar.Item = zk.$extends(zk.Widget, {
+ bind_: function () {
+ this.$supers('bind_', arguments);
+ this.calculate_(true);
+ },
+
+ unbind_: function () {
+ var node = this.$n();
+
+ node.zoneBd = node.zoneEd = node._preOffset = node._afterOffset =
+ node._days = this.item = null;
+ this.$supers('unbind_', arguments);
+ },
+
+ defineClassName_: function () {
+ var zcls = this.getZclass(),
+ ce = this.item,
+ headerColor = ce.headerColor,
+ contentColor = ce.contentColor;
+
+ this.params = {
+ // CSS ClassName
+ body: zcls + '-body',
+ inner: zcls + '-inner',
+ content: zcls + '-cnt',
+ text: zcls + '-text',
+ headerStyle: headerColor ? ' style="background:' + headerColor + '"' : '',
+ contentStyle: contentColor ? ' style="background:' + contentColor + '"' : ''
+ };
+ this.uuid = ce.id;
+ },
+
+ defineCss_: function () {
+ var ce = this.item,
+ headerColor = ce.headerColor,
+ contentColor = ce.contentColor,
+ p = this.params;
+ p.headerStyle = headerColor ? 'background:' + headerColor : '';
+ p.contentStyle = contentColor ? 'background:' + contentColor : '';
+ },
+
+ updateHeaderStyle_: function (headerStyle) {
+ var node = jq(this.$n()),
+ body = jq(this.$n('body')),
+ p = this.params;
+ body.attr('style', headerStyle);
+ body.children('.' + p.inner).attr('style', this.getInnerStyle_());
+ },
+
+ getZclass: function () {
+ var zcls = this.item.zclass;
+ return zcls ? zcls : 'z-calitem';
+ },
+
+ getInnerStyle_: function () {
+ return this.params.headerStyle;
+ },
+
+ calculate_: function (updateLastModify) {
+ var node = this.$n(),
+ item = this.item,
+ parent = this.parent,
+ bd = item.zoneBd,
+ ed = item.zoneEd,
+ inMon = parent.mon;
+
+ if (inMon)
+ node.startWeek = item.startWeek;
+
+ var time = inMon ? node.startWeek : parent;
+
+ node.zoneBd = bd;
+ node.zoneEd = ed;
+
+ this._createBoundTime(node, bd, ed);
+
+ //_afterOffset could be calculated using bound time after processing clone node
+ if (this.processCloneNode_)
+ this.processCloneNode_(node);
+
+ node._preOffset = item._preOffset;
+
+ if (this._isDayItem()) return;
+
+ node._afterOffset = this.cloneCount ? 0 :
+ this._getOffset({start: node.lowerBoundEd, end: time.zoneEd});
+
+ node._days = item._days = this.getDays();
+ if (updateLastModify)
+ node._lastModify = new Date().getTime();
+ },
+
+ isBeginTimeChange: function (item) {
+ return this.$n().zoneBd.getTime() != item.zoneBd.getTime();
+ },
+
+ _createBoundTime: function (node, bd, ed) {
+ //have findBoundTime_ function
+ if (this.findBoundTime_) {
+ var time = this.findBoundTime_(bd, ed);
+ bd = time.bd;
+ ed = time.ed;
+ }
+ node.upperBoundBd = this._setBoundDate(bd);
+ if (this._isDayItem()) return;
+ node.lowerBoundEd = this._setBoundDate(ed, true);
+ },
+
+ _isDayItem: function () {
+// zk.log(this.$instanceof(calendarDayEvent));
+ if (!this._isDayEvt)
+ this._isDayEvt = this.className == 'calendar.DayItem';
+ return this._isDayEvt;
+ },
+
+ _getOffset: function (time) {
+ return calUtil.getPeriod(time.end, time.start);
+ },
+
+ _setBoundDate: function (date, isAddOneDay) {
+ var result = new Date(date);
+ if (date.getHours() + date.getMinutes() + date.getSeconds() + date.getMilliseconds() != 0) {
+ if (isAddOneDay)
+ result = calUtil.addDay(date, 1);
+ result.setHours(0,0,0,0);
+ }
+ return result;
+ }
});
\ No newline at end of file
diff --git a/calendar/src/archive/web/js/calendar/LongEvent.js b/calendar/src/archive/web/js/calendar/LongItem.js
similarity index 90%
rename from calendar/src/archive/web/js/calendar/LongEvent.js
rename to calendar/src/archive/web/js/calendar/LongItem.js
index 5d9058a..2bdd03e 100644
--- a/calendar/src/archive/web/js/calendar/LongEvent.js
+++ b/calendar/src/archive/web/js/calendar/LongItem.js
@@ -1,122 +1,122 @@
-/* Calendars.js
-
- Purpose:
-
- Description:
-
- History:
- Thu Nov 5 12:33:21 TST 2009, Created by Jimmy
-
-Copyright (C) 2009 Potix Corporation. All Rights Reserved.
-
-This program is distributed under GPL Version 3.0 in the hope that
-it will be useful, but WITHOUT ANY WARRANTY.
- */
-calendar.LongEvent = zk.$extends(calendar.Event, {
-
- redraw: function (out) {
- this.defineClassName_();
-
- var ce = this.event,
- id = ce.id,
- p = this.params,
- headerStyle = p.headerStyle,
- contentStyle = p.contentStyle,
- arrowStyle = p.arrowStyle,
- parent = this.parent,
- isBefore = ce.zoneBd < parent.zoneBd,
- isAfter = ce.zoneEd > parent.zoneEd,
- cornerStyle = this.getCornerStyle_();
-
- out.push('
',
- '
',
- '
',
- '
');
-
- out.push('
', ce.content, '
',
- '
');
- },
-
- update: function (updateLastModify) {
- this.defineCss_();
-
- var cnt = jq(this.$n('cnt')),
- parent = this.parent,
- ce = this.event,
- p = this.params,
- isBefore = ce.zoneBd < parent.zoneBd,
- isAfter = ce.zoneEd > parent.zoneEd;
-
- this.updateHeaderStyle_(p.headerStyle);
-
- if (this.updateContentStyle_)
- this.updateContentStyle_(p.contentStyle);
-
- cnt.attr('class', p.content);
- cnt.attr('style', p.contentStyle);
- cnt.children('.' + p.text).html(ce.content);
-
- this.updateArrow_(isAfter, p.right_arrow);
- this.updateArrow_(isBefore, p.left_arrow);
-
- this.calculate_(updateLastModify);
- },
-
- findBoundTime_: function (bd, ed) {
- var parent = this.parent,
- pbd = parent.zoneBd,
- ped = parent.zoneEd;
-
- if (bd < pbd)
- bd = new Date(pbd);
-
- if (ed > ped)
- ed = new Date(ped);
-
- //end equals calendar begin, Bug ZKCAL-32: should check to seconds
- if (ed.getHours() == 0 && ed.getMinutes() == 0 && ed.getSeconds() == 0 && calUtil.isTheSameDay(ed, pbd))
- ed = calUtil.addDay(ed, 1);
-
- return {bd: bd, ed: ed};
- },
-
- defineClassName_: function () {
- this.$super('defineClassName_', arguments);
- // CSS ClassName
- var zcls = this.getZclass(),
- p = this.params,
- contentColor = this.event.contentColor;
-
- p.left_arrow = zcls + '-left-arrow';
- p.right_arrow = zcls + '-right-arrow';
-
- p.arrowStyle = contentColor ?
- ' style="border-bottom-color:' + contentColor +
- ';border-top-color:' + contentColor + '"' : '';
- },
-
- defineCss_: function () {
- this.$super('defineCss_', arguments);
-
- var contentColor = this.event.contentColor,
- p = this.params;
-
- p.arrowStyle = contentColor ?
- ' style="border-bottom-color:' + contentColor +
- ';border-top-color:' + contentColor + '"' : '';
- },
-
- updateArrow_: function (needAdd, arrowCls) {
- jq(this.$n('body')).toggleClass(arrowCls, needAdd);
- }
-
+/* Calendars.js
+
+ Purpose:
+
+ Description:
+
+ History:
+ Thu Nov 5 12:33:21 TST 2009, Created by Jimmy
+
+Copyright (C) 2009 Potix Corporation. All Rights Reserved.
+
+This program is distributed under GPL Version 3.0 in the hope that
+it will be useful, but WITHOUT ANY WARRANTY.
+ */
+calendar.LongItem = zk.$extends(calendar.Item, {
+
+ redraw: function (out) {
+ this.defineClassName_();
+
+ var ce = this.item,
+ id = ce.id,
+ p = this.params,
+ headerStyle = p.headerStyle,
+ contentStyle = p.contentStyle,
+ arrowStyle = p.arrowStyle,
+ parent = this.parent,
+ isBefore = ce.zoneBd < parent.zoneBd,
+ isAfter = ce.zoneEd > parent.zoneEd,
+ cornerStyle = this.getCornerStyle_();
+
+ out.push('
',
+ '
',
+ '
',
+ '
');
+
+ out.push('
', ce.content, '
',
+ '
');
+ },
+
+ update: function (updateLastModify) {
+ this.defineCss_();
+
+ var cnt = jq(this.$n('cnt')),
+ parent = this.parent,
+ ce = this.item,
+ p = this.params,
+ isBefore = ce.zoneBd < parent.zoneBd,
+ isAfter = ce.zoneEd > parent.zoneEd;
+
+ this.updateHeaderStyle_(p.headerStyle);
+
+ if (this.updateContentStyle_)
+ this.updateContentStyle_(p.contentStyle);
+
+ cnt.attr('class', p.content);
+ cnt.attr('style', p.contentStyle);
+ cnt.children('.' + p.text).html(ce.content);
+
+ this.updateArrow_(isAfter, p.right_arrow);
+ this.updateArrow_(isBefore, p.left_arrow);
+
+ this.calculate_(updateLastModify);
+ },
+
+ findBoundTime_: function (bd, ed) {
+ var parent = this.parent,
+ pbd = parent.zoneBd,
+ ped = parent.zoneEd;
+
+ if (bd < pbd)
+ bd = new Date(pbd);
+
+ if (ed > ped)
+ ed = new Date(ped);
+
+ //end equals calendar begin, Bug ZKCAL-32: should check to seconds
+ if (ed.getHours() == 0 && ed.getMinutes() == 0 && ed.getSeconds() == 0 && calUtil.isTheSameDay(ed, pbd))
+ ed = calUtil.addDay(ed, 1);
+
+ return {bd: bd, ed: ed};
+ },
+
+ defineClassName_: function () {
+ this.$super('defineClassName_', arguments);
+ // CSS ClassName
+ var zcls = this.getZclass(),
+ p = this.params,
+ contentColor = this.item.contentColor;
+
+ p.left_arrow = zcls + '-left-arrow';
+ p.right_arrow = zcls + '-right-arrow';
+
+ p.arrowStyle = contentColor ?
+ ' style="border-bottom-color:' + contentColor +
+ ';border-top-color:' + contentColor + '"' : '';
+ },
+
+ defineCss_: function () {
+ this.$super('defineCss_', arguments);
+
+ var contentColor = this.item.contentColor,
+ p = this.params;
+
+ p.arrowStyle = contentColor ?
+ ' style="border-bottom-color:' + contentColor +
+ ';border-top-color:' + contentColor + '"' : '';
+ },
+
+ updateArrow_: function (needAdd, arrowCls) {
+ jq(this.$n('body')).toggleClass(arrowCls, needAdd);
+ }
+
});
\ No newline at end of file
diff --git a/calendar/src/archive/web/js/calendar/less/style/_calendar.less b/calendar/src/archive/web/js/calendar/less/style/_calendar.less
index b066431..e578420 100644
--- a/calendar/src/archive/web/js/calendar/less/style/_calendar.less
+++ b/calendar/src/archive/web/js/calendar/less/style/_calendar.less
@@ -17,7 +17,7 @@ e('<%@ taglib uri="http://www.zkoss.org/dsp/web/theme" prefix="t" %>');
zoom: 1;
}
-.z-calendars-week-body .z-calevent-body {
+.z-calendars-week-body .z-calitem-body {
border: 1px solid @bodyColor;
}
@@ -232,7 +232,7 @@ e('<%@ taglib uri="http://www.zkoss.org/dsp/web/theme" prefix="t" %>');
height: 300px;
}
.z-calendars-month-cnt,.z-calendars-daylong-cnt {
- & .z-calevent-body {
+ & .z-calitem-body {
margin: 0 @basePadding;
}
}
@@ -387,41 +387,41 @@ e('<%@ taglib uri="http://www.zkoss.org/dsp/web/theme" prefix="t" %>');
}
}
// Calendar Event
-.z-calevent {
+.z-calitem {
color: @invertFontColor;
overflow: hidden;
cursor: pointer;
}
-.z-calevent-body {
+.z-calitem-body {
border-radius: @borderRadius;
overflow: hidden;
zoom:1;
}
-.z-calevent-body.z-calevent-left-arrow {
+.z-calitem-body.z-calitem-left-arrow {
margin-left: 0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
-.z-calevent-body.z-calevent-left-arrow .z-calevent-cnt {
+.z-calitem-body.z-calitem-left-arrow .z-calitem-cnt {
padding-left: 10px;
}
-.z-calevent-body.z-calevent-right-arrow {
+.z-calitem-body.z-calitem-right-arrow {
margin-right: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
-.z-calevent-inner dt,
-.z-calevent-inner dd,
-.z-calevent-inner dl {
+.z-calitem-inner dt,
+.z-calitem-inner dd,
+.z-calitem-inner dl {
margin: 0;
overflow: hidden;
text-align: left;
}
-.z-calevent-inner dl {
+.z-calitem-inner dl {
background: @eventColor;
}
-.z-calevent-header {
+.z-calitem-header {
background: @eventColor;
font-size: @fontSizeL;
font-family: @fontFamilyC;
@@ -430,7 +430,7 @@ e('<%@ taglib uri="http://www.zkoss.org/dsp/web/theme" prefix="t" %>');
white-space: nowrap;
padding: 0 @basePadding;
}
-.z-calevent-inner .z-calevent-cnt {
+.z-calitem-inner .z-calitem-cnt {
background: @eventColor;
font-size: @fontSizeL;
font-family: @fontFamilyC;
@@ -439,7 +439,7 @@ e('<%@ taglib uri="http://www.zkoss.org/dsp/web/theme" prefix="t" %>');
line-height: 20px;
color: @invertFontColor;
}
-.z-calevent-resizer {
+.z-calitem-resizer {
bottom: 2px;
cursor: s-resize;
height: 7px;
@@ -457,78 +457,78 @@ e('<%@ taglib uri="http://www.zkoss.org/dsp/web/theme" prefix="t" %>');
width: 10px;
}
}
-.z-calendars-daylong-evt .z-calevent-inner .z-calevent-left-arrow,
-.z-calevent-daylong-month .z-calevent-inner .z-calevent-left-arrow,
-.z-calevent-left-more-faker .z-calevent-inner .z-calevent-left-arrow {
+.z-calendars-daylong-evt .z-calitem-inner .z-calitem-left-arrow,
+.z-calitem-daylong-month .z-calitem-inner .z-calitem-left-arrow,
+.z-calitem-left-more-faker .z-calitem-inner .z-calitem-left-arrow {
margin-left: 0;
zoom: 1;
}
-.z-calendars-daylong-evt .z-calevent-inner .z-calevent-right-arrow,
-.z-calevent-daylong-month .z-calevent-inner .z-calevent-right-arrow,
-.z-calevent-right-more-faker .z-calevent-inner .z-calevent-right-arrow {
+.z-calendars-daylong-evt .z-calitem-inner .z-calitem-right-arrow,
+.z-calitem-daylong-month .z-calitem-inner .z-calitem-right-arrow,
+.z-calitem-right-more-faker .z-calitem-inner .z-calitem-right-arrow {
margin-right: 0;
zoom: 1;
}
-.z-calendars-daylong-evt .z-calevent-text,
-.z-calevent-daylong-month .z-calevent-text,
-.z-calpp .z-calevent-text,
-.z-calpp-month .z-calevent-text,
-.z-calendars-evt-faker-dd .z-calevent-text {
+.z-calendars-daylong-evt .z-calitem-text,
+.z-calitem-daylong-month .z-calitem-text,
+.z-calpp .z-calitem-text,
+.z-calpp-month .z-calitem-text,
+.z-calendars-evt-faker-dd .z-calitem-text {
height: 20px;
width: 100%;
white-space: nowrap;
overflow: hidden;
}
-.z-calevent-daylong-month .z-calevent-text {
+.z-calitem-daylong-month .z-calitem-text {
height: 20px;
line-height: 20px;
}
-.z-calendars-week-day-cnt .z-calevent {
+.z-calendars-week-day-cnt .z-calitem {
width: 100%;
position: absolute;
}
-.z-calendars-daylong-evt .z-calevent-cnt,
-.z-calevent-daylong-month .z-calevent-cnt {
+.z-calendars-daylong-evt .z-calitem-cnt,
+.z-calitem-daylong-month .z-calitem-cnt {
padding: 0 @basePadding;
white-space: nowrap;
cursor: pointer;
overflow: hidden;
}
-.z-calevent-daylong-month .z-calevent-cnt {
+.z-calitem-daylong-month .z-calitem-cnt {
padding: 0 @basePadding;
}
-.z-calevent-daylong-month .z-calevent-t3,
-.z-calevent-daylong-month .z-calevent-b3,
-.z-calpp-month-evt-cnt .z-calevent-t3,
-.z-calpp-month-evt-cnt .z-calevent-b3 {
+.z-calitem-daylong-month .z-calitem-t3,
+.z-calitem-daylong-month .z-calitem-b3,
+.z-calpp-month-evt-cnt .z-calitem-t3,
+.z-calpp-month-evt-cnt .z-calitem-b3 {
background: @eventColor;
}
-.z-calevent-daylong-month .z-calevent-inner,
-.z-calpp-month-evt-cnt .z-calevent-inner {
+.z-calitem-daylong-month .z-calitem-inner,
+.z-calpp-month-evt-cnt .z-calitem-inner {
border-left-color: @eventColor;
border-right-color: @eventColor;
}
-.z-calevent-month {
+.z-calitem-month {
white-space: nowrap;
zoom: 1;
padding: 0 @basePadding;
line-height: 18px;
}
-.z-calevent-month .z-calevent-inner {
+.z-calitem-month .z-calitem-inner {
background: @eventColor;
border-radius: @borderRadius;
overflow: hidden;
}
-.z-calevent-month .z-calevent-header {
+.z-calitem-month .z-calitem-header {
background: transparent;
color: @invertFontColor;
font-size: @fontSizeL;
font-family: @fontFamilyC;
white-space: nowrap;
}
-.z-calevent-month .z-calevent-cnt {
+.z-calitem-month .z-calitem-cnt {
background: transparent;
color: @invertFontColor;
font-size: @fontSizeL;
@@ -605,7 +605,7 @@ e('<%@ taglib uri="http://www.zkoss.org/dsp/web/theme" prefix="t" %>');
vertical-align: top;
position: relative;
- & .z-calevent-left-more-faker {
+ & .z-calitem-left-more-faker {
position: absolute;
left: 0px;
height: 20px;
@@ -622,7 +622,7 @@ e('<%@ taglib uri="http://www.zkoss.org/dsp/web/theme" prefix="t" %>');
vertical-align: top;
position: relative;
- & .z-calevent-right-more-faker {
+ & .z-calitem-right-more-faker {
position: absolute;
right: 0px;
height: 20px;
@@ -636,10 +636,10 @@ e('<%@ taglib uri="http://www.zkoss.org/dsp/web/theme" prefix="t" %>');
&-m {
vertical-align: top;
padding: 1px 0 0;
- .z-calevent-month {
+ .z-calitem-month {
padding: 0;
}
- .z-calevent-text {
+ .z-calitem-text {
padding: 0 @basePadding;
}
}
@@ -653,31 +653,31 @@ e('<%@ taglib uri="http://www.zkoss.org/dsp/web/theme" prefix="t" %>');
}
}
// popup override
- & .z-calevent-body.z-calevent-left-arrow .z-calevent-cnt {
+ & .z-calitem-body.z-calitem-left-arrow .z-calitem-cnt {
padding-left: @basePadding;
}
}
-.z-calevent-left-more-faker,
-.z-calevent-right-more-faker {
+.z-calitem-left-more-faker,
+.z-calitem-right-more-faker {
cursor: pointer;
}
-.z-calpp-evt-faker .z-calevent-left-arrow-icon,
-.z-calpp-evt-faker .z-calevent-right-arrow-icon,
-.z-calpp-month-evt-faker .z-calevent-left-arrow-icon,
-.z-calpp-month-evt-faker .z-calevent-right-arrow-icon {
+.z-calpp-evt-faker .z-calitem-left-arrow-icon,
+.z-calpp-evt-faker .z-calitem-right-arrow-icon,
+.z-calpp-month-evt-faker .z-calitem-left-arrow-icon,
+.z-calpp-month-evt-faker .z-calitem-right-arrow-icon {
display: none;
}
-.z-calpp-evt-faker .z-calevent-inner .z-calevent-left-arrow,
-.z-calpp-evt-faker .z-calevent-inner .z-calevent-right-arrow,
-.z-calpp-month-evt-faker .z-calevent-inner .z-calevent-left-arrow,
-.z-calpp-month-evt-faker .z-calevent-inner .z-calevent-right-arrow {
+.z-calpp-evt-faker .z-calitem-inner .z-calitem-left-arrow,
+.z-calpp-evt-faker .z-calitem-inner .z-calitem-right-arrow,
+.z-calpp-month-evt-faker .z-calitem-inner .z-calitem-left-arrow,
+.z-calpp-month-evt-faker .z-calitem-inner .z-calitem-right-arrow {
padding: 0 1px;
}
-.z-calevent-left-more-faker .z-calevent-text {
+.z-calitem-left-more-faker .z-calitem-text {
text-align: right;
}
-.z-calevent-right-more-faker .z-calevent-text {
+.z-calitem-right-more-faker .z-calitem-text {
text-align: left;
}
@@ -714,11 +714,11 @@ e('<%@ taglib uri="http://www.zkoss.org/dsp/web/theme" prefix="t" %>');
left: 0;
z-index: 28; // less than zkau.initZIndex
}
-.z-calendars-evt-faker-dd .z-calevent-inner .z-calevent-left-arrow {
+.z-calendars-evt-faker-dd .z-calitem-inner .z-calitem-left-arrow {
padding-left: 10px;
zoom: 1;
}
-.z-calendars-evt-faker-dd .z-calevent-inner .z-calevent-right-arrow {
+.z-calendars-evt-faker-dd .z-calitem-inner .z-calitem-right-arrow {
padding-right: 7px;
zoom: 1;
}
diff --git a/calendar/src/archive/web/js/calendar/zk.wpd b/calendar/src/archive/web/js/calendar/zk.wpd
index beecf66..6317ebe 100644
--- a/calendar/src/archive/web/js/calendar/zk.wpd
+++ b/calendar/src/archive/web/js/calendar/zk.wpd
@@ -14,11 +14,11 @@ Copyright (C) 2009 Potix Corporation. All Rights Reserved.
-
-
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/calendar/src/org/zkoss/calendar/Calendars.java b/calendar/src/org/zkoss/calendar/Calendars.java
index 64dc013..f9967ba 100644
--- a/calendar/src/org/zkoss/calendar/Calendars.java
+++ b/calendar/src/org/zkoss/calendar/Calendars.java
@@ -32,10 +32,10 @@
import java.util.Map.Entry;
import java.util.TimeZone;
-import org.zkoss.calendar.api.CalendarEvent;
+import org.zkoss.calendar.api.CalendarItem;
import org.zkoss.calendar.api.CalendarModel;
import org.zkoss.calendar.api.DateFormatter;
-import org.zkoss.calendar.api.EventRender;
+import org.zkoss.calendar.api.ItemRender;
import org.zkoss.calendar.api.RenderContext;
import org.zkoss.calendar.event.CalendarDataEvent;
import org.zkoss.calendar.event.CalendarDataListener;
@@ -62,9 +62,9 @@
* In the month mold, seven days is always assumed.
*
*
The Calendars component allows only one single toolbar as its child component, and now it can
- * only manipulate the calendar event by a model named {@link CalendarModel}. And there
- * are three events, onEventCreate
, onEventEdit
, and
- * onEventUpdate
that can be listened to operate the calendar event
+ * only manipulate the calendar item by a model named {@link CalendarModel}. And there
+ * are three events, onItemCreate
, onItemEdit
, and
+ * onItemUpdate
that can be listened to operate the calendar event
* triggering by user action, in addition to there are two events onDayClick
and
* onWeekClick
to be triggered when user clicks on the caption of
* the day number and the week number within the current year. Besides,
@@ -81,7 +81,7 @@ public class Calendars extends XulElement {
private Date _curDate;
private int _days = 7;
private DateFormatter _dfmter;
- private Map> _evts;
+ private Map> _items;
private Map _tzones;
private Map _ids;
private CalendarModel _model;
@@ -91,27 +91,27 @@ public class Calendars extends XulElement {
private boolean _weekOfYear;
private boolean _hasEmptyZone= false;
private boolean _escapeXML = true;
- private List _addEvtList, _mdyEvtList, _rmEvtList;
+ private List _addItemList, _mdyItemList, _rmItemList;
private int _beginTime = 0, _endTime = 24, _timeslots = 2;
- private static final String ATTR_ON_ADD_EVENT_RESPONSE = "org.zkoss.calendar.Calendars.onAddEventResponse";
- private static final String ATTR_ON_REMOVE_EVENT_RESPONSE = "org.zkoss.calendar.Calendars.onRemoveEventResponse";
- private static final String ATTR_ON_MODIFY_EVENT_RESPONSE = "org.zkoss.calendar.Calendars.onModifyEventResponse";
+ private static final String ATTR_ON_ADD_ITEM_RESPONSE = "org.zkoss.calendar.Calendars.onAddItemResponse";
+ private static final String ATTR_ON_REMOVE_ITEM_RESPONSE = "org.zkoss.calendar.Calendars.onRemoveItemResponse";
+ private static final String ATTR_ON_MODIFY_ITEM_RESPONSE = "org.zkoss.calendar.Calendars.onModifyItemResponse";
- private static final Comparator _defCompare = new Comparator() {
- public int compare(CalendarEvent o1, CalendarEvent o2) {
+ private static final Comparator _defCompare = new Comparator() {
+ public int compare(CalendarItem o1, CalendarItem o2) {
return o1.getBeginDate().compareTo(o2.getBeginDate());
}
};
static {
- addClientEvent(Calendars.class, CalendarsEvent.ON_EVENT_CREATE, 0);
- addClientEvent(Calendars.class, CalendarsEvent.ON_EVENT_EDIT, 0);
- addClientEvent(Calendars.class, CalendarsEvent.ON_EVENT_UPDATE, 0);
+ addClientEvent(Calendars.class, CalendarsEvent.ON_ITEM_CREATE, 0);
+ addClientEvent(Calendars.class, CalendarsEvent.ON_ITEM_EDIT, 0);
+ addClientEvent(Calendars.class, CalendarsEvent.ON_ITEM_UPDATE, 0);
addClientEvent(Calendars.class, CalendarsEvent.ON_DAY_CLICK, CE_REPEAT_IGNORE);
addClientEvent(Calendars.class, CalendarsEvent.ON_WEEK_CLICK, CE_REPEAT_IGNORE);
//since 2.1.5
- addClientEvent(Calendars.class, CalendarsEvent.ON_EVENT_TOOLTIP, CE_REPEAT_IGNORE);
+ addClientEvent(Calendars.class, CalendarsEvent.ON_ITEM_TOOLTIP, CE_REPEAT_IGNORE);
}
public Calendars() {
@@ -120,7 +120,7 @@ public Calendars() {
}
private void init() {
- _evts = new HashMap>(32);
+ _items = new HashMap>(32);
_tzones = new LinkedHashMap();
_ids = new HashMap(32);
_firstDayOfWeek = getCalendar().getFirstDayOfWeek();
@@ -177,7 +177,7 @@ public void setDateFormatter(DateFormatter dfmater) {
_dfmter = dfmater;
reSendDateRange();
smartUpdate("cd", Util.getDSTTime(this.getDefaultTimeZone(), getCurrentDate()));
- reSendEventGroup();
+ reSendItemGroup();
}
}
@@ -215,7 +215,7 @@ public void setDays(int days) {
if (!inMonthMold()) {
reSendDateRange();
smartUpdate("days", _days);
- reSendEventGroup();
+ reSendItemGroup();
}
}
}
@@ -244,7 +244,7 @@ public void setFirstDayOfWeek(int value) {
if (_days == 7 || inMonthMold()){
reSendDateRange();
smartUpdate("firstDayOfWeek", _firstDayOfWeek);
- reSendEventGroup();
+ reSendItemGroup();
}
}
}
@@ -287,55 +287,55 @@ public int getFirstDayOfWeek() {
return _firstDayOfWeek;
}
- public void onAddDayEventResponse() {
- removeAttribute(ATTR_ON_ADD_EVENT_RESPONSE);
- response("addEvent" + getUuid(), new AuSetAttribute(this,"addDayEvent",Util.encloseEventList(this, _addEvtList)));
+ public void onAddDayItemResponse() {
+ removeAttribute(ATTR_ON_ADD_ITEM_RESPONSE);
+ response("addEvent" + getUuid(), new AuSetAttribute(this,"addDayItem",Util.encloseItemList(this, _addItemList)));
}
- public void onRemoveDayEventResponse() {
- removeAttribute(ATTR_ON_REMOVE_EVENT_RESPONSE);
- response("removeEvent" + getUuid(), new AuSetAttribute(this,"removeDayEvent",Util.encloseEventList(this, _rmEvtList)));
+ public void onRemoveDayItemResponse() {
+ removeAttribute(ATTR_ON_REMOVE_ITEM_RESPONSE);
+ response("removeEvent" + getUuid(), new AuSetAttribute(this,"removeDayItem",Util.encloseItemList(this, _rmItemList)));
}
- public void onModifyDayEventResponse() {
- removeAttribute(ATTR_ON_MODIFY_EVENT_RESPONSE);
- response("modifyEvent" + getUuid(), new AuSetAttribute(this,"modifyDayEvent",Util.encloseEventList(this, _mdyEvtList)));
+ public void onModifyDayItemResponse() {
+ removeAttribute(ATTR_ON_MODIFY_ITEM_RESPONSE);
+ response("modifyEvent" + getUuid(), new AuSetAttribute(this,"modifyDayItem",Util.encloseItemList(this, _mdyItemList)));
}
- public void addDayEvent(CalendarEvent ce){
+ public void addDayItem(CalendarItem ce) {
if (ce == null) return;
- if (_addEvtList == null)
- _addEvtList = new LinkedList();
- _addEvtList.add(ce);
- if (getAttribute(ATTR_ON_ADD_EVENT_RESPONSE) == null) {
- setAttribute(ATTR_ON_ADD_EVENT_RESPONSE, Boolean.TRUE);
- Events.postEvent(-20000, "onAddDayEventResponse", this, null);
+ if (_addItemList == null)
+ _addItemList = new LinkedList();
+ _addItemList.add(ce);
+ if (getAttribute(ATTR_ON_ADD_ITEM_RESPONSE) == null) {
+ setAttribute(ATTR_ON_ADD_ITEM_RESPONSE, Boolean.TRUE);
+ Events.postEvent(-20000, "onAddDayItemResponse", this, null);
}
}
- public void modifyDayEvent(CalendarEvent ce) {
+ public void modifyDayItem(CalendarItem ce) {
if (ce == null) return;
- if (_mdyEvtList == null)
- _mdyEvtList = new LinkedList();
- _mdyEvtList.add(ce);
- if (getAttribute(ATTR_ON_MODIFY_EVENT_RESPONSE) == null) {
- setAttribute(ATTR_ON_MODIFY_EVENT_RESPONSE, Boolean.TRUE);
- Events.postEvent(-20000, "onModifyDayEventResponse", this, null);
+ if (_mdyItemList == null)
+ _mdyItemList = new LinkedList();
+ _mdyItemList.add(ce);
+ if (getAttribute(ATTR_ON_MODIFY_ITEM_RESPONSE) == null) {
+ setAttribute(ATTR_ON_MODIFY_ITEM_RESPONSE, Boolean.TRUE);
+ Events.postEvent(-20000, "onModifyDayItemResponse", this, null);
}
}
- public void removeDayEvent(CalendarEvent ce){
+ public void removeDayItem(CalendarItem ce) {
if (ce == null) return;
- if (_rmEvtList == null)
- _rmEvtList = new LinkedList();
- _rmEvtList.add(ce);
- if (getAttribute(ATTR_ON_REMOVE_EVENT_RESPONSE) == null) {
- setAttribute(ATTR_ON_REMOVE_EVENT_RESPONSE, Boolean.TRUE);
- Events.postEvent(-20000, "onRemoveDayEventResponse", this, null);
+ if (_rmItemList == null)
+ _rmItemList = new LinkedList();
+ _rmItemList.add(ce);
+ if (getAttribute(ATTR_ON_REMOVE_ITEM_RESPONSE) == null) {
+ setAttribute(ATTR_ON_REMOVE_ITEM_RESPONSE, Boolean.TRUE);
+ Events.postEvent(-20000, "onRemoveDayItemResponse", this, null);
}
}
- private void cleanEmptyZone(){
+ private void cleanEmptyZone() {
Map tzones = new HashMap(_tzones);
for (Iterator> it = tzones.entrySet().iterator(); it.hasNext();) {
@@ -346,7 +346,7 @@ private void cleanEmptyZone(){
_hasEmptyZone = false;
}
- private Calendar getCalendar(){
+ private Calendar getCalendar() {
return Calendar.getInstance(getDefaultTimeZone(), Locales.getCurrent());
}
@@ -375,7 +375,7 @@ public void addTimeZone(String label, TimeZone timezone) {
smartUpdate("tz", (tz.getRawOffset())/60000);
smartUpdate("bd", Util.getDSTTime(tz,getBeginDate()));
smartUpdate("ed", Util.getDSTTime(tz,getEndDate()));
- reSendEventGroup();
+ reSendItemGroup();
}
/**
@@ -424,7 +424,7 @@ public boolean removeTimeZone(TimeZone timezone) {
TimeZone tz = getDefaultTimeZone();
smartUpdate("bd", Util.getDSTTime(tz,getBeginDate()));
smartUpdate("ed", Util.getDSTTime(tz,getEndDate()));
- reSendEventGroup();
+ reSendItemGroup();
return true;
}
return false;
@@ -451,7 +451,7 @@ public Map getTimeZones() {
return Collections.unmodifiableMap(_tzones);
}
- public String getCalendarEventId(CalendarEvent ce) {
+ public String getCalendarItemId(CalendarItem ce) {
Object o = _ids.get(ce);
if (o == null) {
o = ((DesktopCtrl)getDesktop()).getNextUuid(this);
@@ -461,41 +461,41 @@ public String getCalendarEventId(CalendarEvent ce) {
return (String) o;
}
- public CalendarEvent getCalendarEventById(String id) {
- return (CalendarEvent)_ids.get(id);
+ public CalendarItem getCalendarItemById(String id) {
+ return (CalendarItem)_ids.get(id);
}
- protected String getEventKey(CalendarEvent evt) {
+ protected String getItemKey(CalendarItem evt) {
Date begin = evt.getBeginDate();
Date end = evt.getEndDate();
if (begin == null)
throw new UiException("Begin date cannot be null: " + evt);
if (end == null)
throw new UiException("End date cannot be null: " + evt);
- return getEventKey(begin);
+ return getItemKey(begin);
}
- private String getEventKey(Date date) {
+ private String getItemKey(Date date) {
return _sdfKey.format(date);
}
/**
- * Returns the unmodifiable list including all the calendar events matching
+ * Returns the unmodifiable list including all the calendar items matching
* from the specified date in the same date. e.g. "20090324" exclusive the
* time of the date "23:30".
*
* Note: never null.
*/
- public List getEvent(Date beginDate) {
- String key = getEventKey(beginDate);
- List list = _evts.get(key);
+ public List getItem(Date beginDate) {
+ String key = getItemKey(beginDate);
+ List list = _items.get(key);
if (list != null)
Collections.sort(list, getDefaultBeginDateComparator());
else list = Collections.emptyList();
return Collections.unmodifiableList(list);
}
- private static final Comparator getDefaultBeginDateComparator() {
+ private static final Comparator getDefaultBeginDateComparator() {
return _defCompare;
}
@@ -598,7 +598,7 @@ public void setCurrentDate(Date curDate) {
_curDate = curDate;
reSendDateRange();
smartUpdate("cd", Util.getDSTTime(this.getDefaultTimeZone(),getCurrentDate()));
- reSendEventGroup();
+ reSendItemGroup();
}
}
@@ -623,7 +623,7 @@ public void setBeginTime(int beginTime) {
if (_beginTime != beginTime) {
_beginTime = beginTime;
smartUpdate("bt", beginTime);
- reSendEventGroup();
+ reSendItemGroup();
}
}
/**
@@ -647,7 +647,7 @@ public void setEndTime(int endTime) {
if (_endTime != endTime) {
_endTime = endTime;
smartUpdate("et", endTime);
- reSendEventGroup();
+ reSendItemGroup();
}
}
/**
@@ -670,7 +670,7 @@ public void setTimeslots(int timeslots) {
if (_timeslots != timeslots) {
this._timeslots = timeslots;
smartUpdate("timeslots", timeslots);
- reSendEventGroup();
+ reSendItemGroup();
}
}
/**
@@ -749,7 +749,7 @@ public int getWeekOfMonth() {
}
}
- protected void reSendEventGroup() {
+ protected void reSendItemGroup() {
if (getAttribute(ATTR_ON_INIT_POSTED) == null) {
setAttribute(ATTR_ON_INIT_POSTED, Boolean.TRUE);
Events.postEvent(-10100, "onInitRender", this, null);
@@ -758,7 +758,7 @@ protected void reSendEventGroup() {
public void onInitRender() {
removeAttribute(ATTR_ON_INIT_POSTED);
- _evts.clear();
+ _items.clear();
_ids.clear();
final TimeZone tzone = getDefaultTimeZone();
@@ -769,7 +769,7 @@ public void onInitRender() {
_sdfKey.setTimeZone(tzone);
if (_model != null) {
Date beginDate = getBeginDate();
- List list = _model.get(beginDate, getEndDate(),
+ List list = _model.get(beginDate, getEndDate(),
new RenderContext() {
public TimeZone getTimeZone() {
return tzone;
@@ -777,25 +777,25 @@ public TimeZone getTimeZone() {
});
if (list != null) {
- for (Iterator it = list.iterator(); it.hasNext();) {
- CalendarEvent ce = it.next();
- if (ce.getBeginDate().after(ce.getEndDate()))
- throw new IllegalArgumentException("Illegal date: from " + ce.getBeginDate() + " to " + ce.getEndDate());
+ for (Iterator it = list.iterator(); it.hasNext();) {
+ CalendarItem ci = it.next();
+ if (ci.getBeginDate().after(ci.getEndDate()))
+ throw new IllegalArgumentException("Illegal date: from " + ci.getBeginDate() + " to " + ci.getEndDate());
- String key = ce.getBeginDate().before(beginDate) ?
- getEventKey(beginDate):
- getEventKey(ce.getBeginDate());
+ String key = ci.getBeginDate().before(beginDate) ?
+ getItemKey(beginDate):
+ getItemKey(ci.getBeginDate());
- List dayevt = _evts.get(key);
- if (dayevt == null) {
- dayevt = new LinkedList();
- _evts.put(key, dayevt);
+ List dayItems = _items.get(key);
+ if (dayItems == null) {
+ dayItems = new LinkedList();
+ _items.put(key, dayItems);
}
- dayevt.add(ce);
+ dayItems.add(ci);
}
}
}
- smartUpdate("events", Util.encloseEventMap(this, _evts));
+ smartUpdate("items", Util.encloseItemMap(this, _items));
}
public Toolbar getToolbar() {
@@ -825,7 +825,7 @@ public void setModel(CalendarModel model) {
_model.removeCalendarDataListener(_dataListener);
_model = null;
}
- reSendEventGroup();
+ reSendItemGroup();
}
/** Initializes _dataListener and register the listener to the model
@@ -834,20 +834,20 @@ private void initDataListener() {
if (_dataListener == null)
_dataListener = new CalendarDataListener() {
public void onChange(CalendarDataEvent event) {
- CalendarEvent ce = event.getCalendarEvent();
- if (ce == null) { // if large scope change, such as clearAll
- reSendEventGroup();
+ CalendarItem ci = event.getCalendarItem();
+ if (ci == null) { // if large scope change, such as clearAll
+ reSendItemGroup();
return;
}
switch (event.getType()) {
case CalendarDataEvent.INTERVAL_ADDED:
- addDayEvent(event.getCalendarEvent());
+ addDayItem(event.getCalendarItem());
break;
case CalendarDataEvent.INTERVAL_REMOVED:
- removeDayEvent(event.getCalendarEvent());
+ removeDayItem(event.getCalendarItem());
break;
case CalendarDataEvent.CONTENTS_CHANGED:
- modifyDayEvent(event.getCalendarEvent());
+ modifyDayItem(event.getCalendarItem());
}
}
};
@@ -860,7 +860,7 @@ public void setMold(String mold) {
mold = "default";
if (!Objects.equals(getMold(), mold)) {
super.setMold(mold);
- reSendEventGroup();
+ reSendItemGroup();
}
}
@@ -869,18 +869,18 @@ public void setMold(String mold) {
}
/**
- * Sets whether the event content escape XML
+ * Sets whether the item content escape XML
* @param escapeXML
*/
public void setEscapeXML(boolean escapeXML) {
if (_escapeXML != escapeXML) {
this._escapeXML = escapeXML;
smartUpdate("escapeXML", escapeXML);
- reSendEventGroup();
+ reSendItemGroup();
}
}
/**
- * Return whether the event content escape XML
+ * Return whether the item content escape XML
* @return boolean
*/
public boolean isEscapeXML() {
@@ -930,18 +930,18 @@ private synchronized void readObject(java.io.ObjectInputStream s)
public void service(org.zkoss.zk.au.AuRequest request, boolean everError) {
final String cmd = request.getCommand();
- if (cmd.equals(CalendarsEvent.ON_EVENT_CREATE))
+ if (cmd.equals(CalendarsEvent.ON_ITEM_CREATE))
Events.postEvent(CalendarsEvent.getCreateEvent(request));
- else if (cmd.equals(CalendarsEvent.ON_EVENT_EDIT))
+ else if (cmd.equals(CalendarsEvent.ON_ITEM_EDIT))
Events.postEvent(CalendarsEvent.getEditEvent(request));
- else if (cmd.equals(CalendarsEvent.ON_EVENT_UPDATE))
+ else if (cmd.equals(CalendarsEvent.ON_ITEM_UPDATE))
Events.postEvent(CalendarsEvent.getUpdateEvent(request));
else if (cmd.equals(CalendarsEvent.ON_DAY_CLICK) ||
cmd.equals(CalendarsEvent.ON_WEEK_CLICK))
Events.postEvent(CalendarsEvent.getClickEvent(request, cmd));
else if (cmd.equals(Events.ON_DROP)) {
Events.postEvent(CalendarDropEvent.getCalendarDropEvent(request));
- } else if (cmd.equals(CalendarsEvent.ON_EVENT_TOOLTIP)) {
+ } else if (cmd.equals(CalendarsEvent.ON_ITEM_TOOLTIP)) {
Events.postEvent(CalendarsEvent.getTooltipEvent(request));
} else {
super.service(request, everError);
@@ -990,7 +990,7 @@ protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
renderer.render("days", _days);
renderer.render("escapeXML", _escapeXML);
- renderer.render("events", Util.encloseEventMap(this, _evts));
+ renderer.render("items", Util.encloseItemMap(this, _items));
String pattern = ((SimpleDateFormat) DateFormat.getDateInstance(
DateFormat.SHORT, Locales.getCurrent())).toPattern().replaceAll(
"[^\\p{Alpha}]*y+[^\\p{Alpha}]*", "");
@@ -1023,20 +1023,20 @@ private void rendererMonthData(DateFormatter dfhandler, ContentRenderer renderer
/**
* @deprecated As of release 2.0-RC
- * Returns the event renderer used for {@link CalendarEvent} to draw its
+ * Returns the item renderer used for {@link CalendarItem} to draw its
* outline (i.e. HTML), like the DSP renderer of ZK component.
*
* Note: never null.
*/
- public EventRender getEventRender() {
+ public ItemRender getItemRender() {
return null;
}
/**
* @deprecated As of release 2.0-RC
- * Sets the event renderer.
+ * Sets the item renderer.
*/
- public void setEventRender(EventRender render) {
+ public void setItemRender(ItemRender render) {
}
diff --git a/calendar/src/org/zkoss/calendar/api/CalendarEvent.java b/calendar/src/org/zkoss/calendar/api/CalendarItem.java
similarity index 66%
rename from calendar/src/org/zkoss/calendar/api/CalendarEvent.java
rename to calendar/src/org/zkoss/calendar/api/CalendarItem.java
index 242bdcb..28a3ebe 100644
--- a/calendar/src/org/zkoss/calendar/api/CalendarEvent.java
+++ b/calendar/src/org/zkoss/calendar/api/CalendarItem.java
@@ -1,106 +1,106 @@
-/* Calevent.java
-
-{{IS_NOTE
- Purpose:
-
- Description:
-
- History:
- Mar 10, 2009 3:10:27 PM , Created by jumperchen
- Dec 3, 2009 7:10:27 PM , Created by jimmy
-}}IS_NOTE
-
-Copyright (C) 2009 Potix Corporation. All Rights Reserved.
-
-{{IS_RIGHT
-}}IS_RIGHT
- */
-package org.zkoss.calendar.api;
-
-import java.time.Instant;
-import java.util.Date;
-
-/**
- * This interface defines the methods used for {@link Calendars} to render the
- * event data.
- *
- * @author jumperchen,jimmy
- *
- */
-public interface CalendarEvent {
- /**
- * Returns the beginning date of the calendar event.
- *
- * @deprecated since 3.0.0
- */
- @Deprecated
- default public Date getBeginDate() {
- return getBegin() == null ? null : Date.from(getBegin());
- }
-
- /**
- * Returns the beginning date of the calendar event in Instant.
- *
- * @since 3.0.0
- */
- public Instant getBegin();
-
- /**
- * Returns the end date of the calendar event. (exclusive)
- *
- * @deprecated since 3.0.0
- */
- @Deprecated
- default public Date getEndDate() {
- return getEnd() == null ? null : Date.from(getEnd());
- }
-
- /**
- * Returns the beginning date of the calendar event in Instant.
- *
- * @since 3.0.0
- */
- public Instant getEnd();
-
- /**
- * Returns the title of the calendar event.
- *
- * Note: never null
- */
- public String getTitle();
-
- /**
- * Returns the content of the calendar event.
- *
- * Note: never null
- */
- public String getContent();
-
- /**
- * Returns the color of the header in the calendar event.
- * Only allows the value being recognized by CSS.
- *
- * Note: never null
- */
- public String getHeaderColor();
-
- /**
- * Returns the color of the content in the calendar event.
- * Only allows the value being recognized by CSS.
- *
- * Note: never null
- */
- public String getContentColor();
-
- /**
- * Returns the zclass of the calendar event.
- *
- * Note: never null
- */
- public String getZclass();
-
- /**
- * Returns whether the calendar event is locked or not.
- */
- public boolean isLocked();
-}
+/* CalendarItem.java
+
+{{IS_NOTE
+ Purpose:
+
+ Description:
+
+ History:
+ Mar 10, 2009 3:10:27 PM , Created by jumperchen
+ Dec 3, 2009 7:10:27 PM , Created by jimmy
+}}IS_NOTE
+
+Copyright (C) 2009 Potix Corporation. All Rights Reserved.
+
+{{IS_RIGHT
+}}IS_RIGHT
+ */
+package org.zkoss.calendar.api;
+
+import java.time.Instant;
+import java.util.Date;
+
+/**
+ * This interface defines the methods used for {@link Calendars} to render the
+ * event data.
+ *
+ * @author jumperchen,jimmy
+ *
+ */
+public interface CalendarItem {
+ /**
+ * Returns the beginning date of the calendar item.
+ *
+ * @deprecated since 3.0.0
+ */
+ @Deprecated
+ default public Date getBeginDate() {
+ return getBegin() == null ? null : Date.from(getBegin());
+ }
+
+ /**
+ * Returns the beginning date of the calendar item in Instant.
+ *
+ * @since 3.0.0
+ */
+ public Instant getBegin();
+
+ /**
+ * Returns the end date of the calendar item. (exclusive)
+ *
+ * @deprecated since 3.0.0
+ */
+ @Deprecated
+ default public Date getEndDate() {
+ return getEnd() == null ? null : Date.from(getEnd());
+ }
+
+ /**
+ * Returns the beginning date of the calendar item in Instant.
+ *
+ * @since 3.0.0
+ */
+ public Instant getEnd();
+
+ /**
+ * Returns the title of the calendar item.
+ *
+ * Note: never null
+ */
+ public String getTitle();
+
+ /**
+ * Returns the content of the calendar item.
+ *
+ * Note: never null
+ */
+ public String getContent();
+
+ /**
+ * Returns the color of the header in the calendar item.
+ * Only allows the value being recognized by CSS.
+ *
+ * Note: never null
+ */
+ public String getHeaderColor();
+
+ /**
+ * Returns the color of the content in the calendar item.
+ * Only allows the value being recognized by CSS.
+ *
+ * Note: never null
+ */
+ public String getContentColor();
+
+ /**
+ * Returns the zclass of the calendar item.
+ *
+ * Note: never null
+ */
+ public String getZclass();
+
+ /**
+ * Returns whether the calendar item is locked or not.
+ */
+ public boolean isLocked();
+}
diff --git a/calendar/src/org/zkoss/calendar/api/CalendarModel.java b/calendar/src/org/zkoss/calendar/api/CalendarModel.java
index 5ab18df..850f76c 100644
--- a/calendar/src/org/zkoss/calendar/api/CalendarModel.java
+++ b/calendar/src/org/zkoss/calendar/api/CalendarModel.java
@@ -29,13 +29,13 @@
*/
public interface CalendarModel {
/**
- * Returns the list that must be a list of {@link CalendarEvent} type.
+ * Returns the list that must be a list of {@link CalendarItem} type.
*
* @param beginDate the begin date
* @param endDate the end date
* @param rc a RenderContext encapsulates the information needed for Calendars.
*/
- public List get(Date beginDate, Date endDate, RenderContext rc);
+ public List get(Date beginDate, Date endDate, RenderContext rc);
/** Adds a listener to the calendar model that's notified each time a change
* to the data model occurs.
*/
diff --git a/calendar/src/org/zkoss/calendar/api/Calendars.java b/calendar/src/org/zkoss/calendar/api/Calendars.java
index aa9cb57..0768f55 100644
--- a/calendar/src/org/zkoss/calendar/api/Calendars.java
+++ b/calendar/src/org/zkoss/calendar/api/Calendars.java
@@ -100,22 +100,22 @@ public interface Calendars {
*
* Note: never null.
*/
- public List getEvent(Date beginDate);
+ public List getEvent(Date beginDate);
/**
* @deprecated As of release 2.0-RC
- * Returns the event renderer used for {@link CalendarEvent} to draw its
+ * Returns the item renderer used for {@link CalendarItem} to draw its
* outline (i.e. HTML), like the DSP renderer of ZK component.
*
* Note: never null.
*/
- public EventRender getEventRender();
+ public ItemRender getItemRender();
/**
* @deprecated As of release 2.0-RC
- * Sets the event renderer.
+ * Sets the item renderer.
*/
- public void setEventRender(EventRender render);
+ public void setItemRender(ItemRender render);
/**
* Sets the date formatter. In fact, there are five places in the calendar
diff --git a/calendar/src/org/zkoss/calendar/api/EventRender.java b/calendar/src/org/zkoss/calendar/api/ItemRender.java
similarity index 63%
rename from calendar/src/org/zkoss/calendar/api/EventRender.java
rename to calendar/src/org/zkoss/calendar/api/ItemRender.java
index 7fc2864..5add6d1 100644
--- a/calendar/src/org/zkoss/calendar/api/EventRender.java
+++ b/calendar/src/org/zkoss/calendar/api/ItemRender.java
@@ -1,51 +1,51 @@
-/* EventDrawer.java
-
-{{IS_NOTE
- Purpose:
-
- Description:
-
- History:
- Mar 16, 2009 3:00:11 PM , Created by jumperchen
-}}IS_NOTE
-
-Copyright (C) 2009 Potix Corporation. All Rights Reserved.
-
-{{IS_RIGHT
-}}IS_RIGHT
-*/
-package org.zkoss.calendar.api;
-
-import java.util.Date;
-
-import org.zkoss.calendar.Calendars;
-
-/**
- * A renderer of the calendar event.(Like the mold renderer of ZK component)
- * @author jumperchen
- */
-public interface EventRender {
- /**
- * Draws the day in the default mold of the calendar.
- * @param id auto-created by the calendars component
- */
- public String drawDay(Calendars cal, CalendarEvent evt, String id);
-
- /**
- * Draws the all day in the default mold of the calendar.
- * @param id auto-created by the calendars component
- */
- public String drawAllDay(Calendars cal, CalendarEvent evt, String id);
-
- /**
- * Draws the day in the month mold of the calendar.
- * @param id auto-created by the calendars component
- */
- public String drawDayByMonth(Calendars cal, CalendarEvent evt, String id);
-
- /**
- * Draws the all day in the month mold of the calendar.
- * @param id auto-created by the calendars component
- */
- public String drawAllDayByMonth(Calendars cal, CalendarEvent evt, String id, Date begin, Date end);
-}
+/* EventDrawer.java
+
+{{IS_NOTE
+ Purpose:
+
+ Description:
+
+ History:
+ Mar 16, 2009 3:00:11 PM , Created by jumperchen
+}}IS_NOTE
+
+Copyright (C) 2009 Potix Corporation. All Rights Reserved.
+
+{{IS_RIGHT
+}}IS_RIGHT
+*/
+package org.zkoss.calendar.api;
+
+import java.util.Date;
+
+import org.zkoss.calendar.Calendars;
+
+/**
+ * A renderer of the calendar item.(Like the mold renderer of ZK component)
+ * @author jumperchen
+ */
+public interface ItemRender {
+ /**
+ * Draws the day in the default mold of the calendar.
+ * @param id auto-created by the calendars component
+ */
+ public String drawDay(Calendars cal, CalendarItem evt, String id);
+
+ /**
+ * Draws the all day in the default mold of the calendar.
+ * @param id auto-created by the calendars component
+ */
+ public String drawAllDay(Calendars cal, CalendarItem evt, String id);
+
+ /**
+ * Draws the day in the month mold of the calendar.
+ * @param id auto-created by the calendars component
+ */
+ public String drawDayByMonth(Calendars cal, CalendarItem evt, String id);
+
+ /**
+ * Draws the all day in the month mold of the calendar.
+ * @param id auto-created by the calendars component
+ */
+ public String drawAllDayByMonth(Calendars cal, CalendarItem evt, String id, Date begin, Date end);
+}
diff --git a/calendar/src/org/zkoss/calendar/event/CalendarDataEvent.java b/calendar/src/org/zkoss/calendar/event/CalendarDataEvent.java
index b6fb740..6651a83 100644
--- a/calendar/src/org/zkoss/calendar/event/CalendarDataEvent.java
+++ b/calendar/src/org/zkoss/calendar/event/CalendarDataEvent.java
@@ -21,7 +21,7 @@
import java.util.Date;
import java.util.TimeZone;
-import org.zkoss.calendar.api.CalendarEvent;
+import org.zkoss.calendar.api.CalendarItem;
import org.zkoss.calendar.api.CalendarModel;
/**
@@ -42,10 +42,10 @@ public class CalendarDataEvent implements Serializable {
private final int _type;
private final Date _begin, _end;
private final TimeZone _timezone;
- private final CalendarEvent _e;
+ private final CalendarItem _e;
/** Contructor.
- *@deprecated As of release 2.0-RC, replaced with {@link #CalendarDataEvent(CalendarModel model, int type, CalendarEvent e, TimeZone timezone)}
+ *@deprecated As of release 2.0-RC, replaced with {@link #CalendarDataEvent(CalendarModel model, int type, CalendarItem e, TimeZone timezone)}
* @param type one of {@link #CONTENTS_CHANGED},
* {@link #INTERVAL_ADDED}, {@link #INTERVAL_REMOVED}.
*/
@@ -65,7 +65,7 @@ public CalendarDataEvent(CalendarModel model, int type, Date begin, Date end, Ti
* @param type one of {@link #CONTENTS_CHANGED},
* {@link #INTERVAL_ADDED}, {@link #INTERVAL_REMOVED}.
*/
- public CalendarDataEvent(CalendarModel model, int type, CalendarEvent e, TimeZone timezone) {
+ public CalendarDataEvent(CalendarModel model, int type, CalendarItem e, TimeZone timezone) {
if (model == null)
throw new IllegalArgumentException();
_model = model;
@@ -104,9 +104,9 @@ public TimeZone getTimeZone() {
}
/**
* @since 1.1.1_50
- * Return the CalendarEvent of the calendar
+ * Return the CalendarItem of the calendar
*/
- public CalendarEvent getCalendarEvent() {
+ public CalendarItem getCalendarItem() {
return _e;
}
diff --git a/calendar/src/org/zkoss/calendar/event/CalendarDropEvent.java b/calendar/src/org/zkoss/calendar/event/CalendarDropEvent.java
index 479874d..b434480 100644
--- a/calendar/src/org/zkoss/calendar/event/CalendarDropEvent.java
+++ b/calendar/src/org/zkoss/calendar/event/CalendarDropEvent.java
@@ -18,7 +18,7 @@
import java.util.Map;
import org.zkoss.calendar.Calendars;
-import org.zkoss.calendar.api.CalendarEvent;
+import org.zkoss.calendar.api.CalendarItem;
import org.zkoss.calendar.impl.Util;
import org.zkoss.zk.au.AuRequest;
import org.zkoss.zk.au.AuRequests;
@@ -37,7 +37,7 @@ public class CalendarDropEvent extends DropEvent {
private static final long serialVersionUID = 20110830181507L;
private Date _date;
- private CalendarEvent _ce;
+ private CalendarItem _ce;
/** Converts an AU request to a drop event.
* @since 5.0.0
@@ -58,12 +58,12 @@ public static CalendarDropEvent getCalendarDropEvent(AuRequest request) {
request.getDesktop().getComponentByUuid((String)data.get("dragged")),
AuRequests.getInt(data, "x", 0), AuRequests.getInt(data, "y", 0),
AuRequests.getInt(data, "pageX", 0), AuRequests.getInt(data, "pageY", 0),
- keys, date, cmp.getCalendarEventById(String.valueOf(data.get("ce"))));
+ keys, date, cmp.getCalendarItemById(String.valueOf(data.get("ce"))));
}
public CalendarDropEvent(String name, Component target, Component dragged,
- int x, int y, int pageX, int pageY, int keys, Date date, CalendarEvent ce) {
+ int x, int y, int pageX, int pageY, int keys, Date date, CalendarItem ce) {
super(name, target, dragged, x, y, pageX, pageY, keys);
_date = date;
_ce = ce;
@@ -80,7 +80,7 @@ public Date getDate() {
/**
* Returns the calendar event.
*/
- public CalendarEvent getCalendarEvent() {
+ public CalendarItem getCalendarEvent() {
return _ce;
}
}
diff --git a/calendar/src/org/zkoss/calendar/event/CalendarsEvent.java b/calendar/src/org/zkoss/calendar/event/CalendarsEvent.java
index 40a7fef..f273d5c 100644
--- a/calendar/src/org/zkoss/calendar/event/CalendarsEvent.java
+++ b/calendar/src/org/zkoss/calendar/event/CalendarsEvent.java
@@ -1,4 +1,4 @@
-/* CalendarEvent.java
+/* CalendarsEvent.java
{{IS_NOTE
Purpose:
@@ -21,7 +21,7 @@
import java.util.TimeZone;
import org.zkoss.calendar.Calendars;
-import org.zkoss.calendar.api.CalendarEvent;
+import org.zkoss.calendar.api.CalendarItem;
import org.zkoss.calendar.impl.Util;
import org.zkoss.json.JSONArray;
import org.zkoss.zk.au.AuRequest;
@@ -33,7 +33,7 @@
import org.zkoss.zk.ui.util.Clients;
/**
- * The event is used for Calendars when user create/update/edit the calendar event.
+ * The event is used for Calendars when user create/update/edit the calendar item.
*
The event is able to stop or clear the dragging ghost from server to client,
* that is, when application developer doesn't invoke the {@link #stopClearGhost()},
* the dragging ghost will be cleared by default. Otherwise, application developer
@@ -44,23 +44,23 @@
public class CalendarsEvent extends Event {
private static final long serialVersionUID = 20090331171731L;
- public static final String ON_EVENT_CREATE = "onEventCreate";
- public static final String ON_EVENT_EDIT = "onEventEdit";
- public static final String ON_EVENT_UPDATE = "onEventUpdate";
+ public static final String ON_ITEM_CREATE = "onItemCreate";
+ public static final String ON_ITEM_EDIT = "onItemEdit";
+ public static final String ON_ITEM_UPDATE = "onItemUpdate";
public static final String ON_DAY_CLICK = "onDayClick";
public static final String ON_WEEK_CLICK = "onWeekClick";
//since 2.1.5
- public static final String ON_EVENT_TOOLTIP = "onEventTooltip";
+ public static final String ON_ITEM_TOOLTIP = "onItemTooltip";
private Date _beginDate;
private Date _endDate;
- private CalendarEvent _ce;
+ private CalendarItem _ce;
private final int _x, _y, _dtwd, _dthgh;
- public CalendarsEvent(String name, Component target, CalendarEvent ce,
+ public CalendarsEvent(String name, Component target, CalendarItem ce,
Date beginDate, Date endDate, int x, int y, int dtwd, int dthgh) {
super(name, target);
_ce = ce;
@@ -82,7 +82,7 @@ public static CalendarsEvent getCreateEvent(AuRequest request) {
Date eventBegin = Util.fixDSTTime(tz, new Date(getLong(data.get(0))));
Date eventEnd = Util.fixDSTTime(tz, new Date(getLong(data.get(1))));
- return new CalendarsEvent(ON_EVENT_CREATE, cmp, null,
+ return new CalendarsEvent(ON_ITEM_CREATE, cmp, null,
eventBegin, eventEnd,
getInt(data.get(2)), getInt(data.get(3)),
getInt(data.get(4)),getInt(data.get(5)));
@@ -92,11 +92,11 @@ public static CalendarsEvent getEditEvent(AuRequest request) {
final JSONArray data = (JSONArray) request.getData().get("data");
final Calendars cmp = verifyEvent(request, data, 5);
- CalendarEvent ce = cmp.getCalendarEventById(String.valueOf(data.get(0)));
+ CalendarItem ce = cmp.getCalendarItemById(String.valueOf(data.get(0)));
if (ce == null) return null;
- return new CalendarsEvent(ON_EVENT_EDIT, cmp, ce, null, null,
+ return new CalendarsEvent(ON_ITEM_EDIT, cmp, ce, null, null,
getInt(data.get(1)), getInt(data.get(2)),
getInt(data.get(3)), getInt(data.get(4)));
}
@@ -105,14 +105,14 @@ public static CalendarsEvent getUpdateEvent(AuRequest request) {
final JSONArray data = (JSONArray) request.getData().get("data");
final Calendars cmp = verifyEvent(request, data, 7);
- CalendarEvent ce = cmp.getCalendarEventById(String.valueOf(data.get(0)));
+ CalendarItem ce = cmp.getCalendarItemById(String.valueOf(data.get(0)));
if (ce == null) return null;
TimeZone tz = cmp.getDefaultTimeZone();
Date eventBegin = Util.fixDSTTime(tz, new Date(getLong(data.get(1))));
Date eventEnd = Util.fixDSTTime(tz, new Date(getLong(data.get(2))));
- return new CalendarsEvent(ON_EVENT_UPDATE, cmp, ce,
+ return new CalendarsEvent(ON_ITEM_UPDATE, cmp, ce,
eventBegin, eventEnd,
getInt(data.get(3)), getInt(data.get(4)),
getInt(data.get(5)),getInt(data.get(6)));
@@ -129,12 +129,12 @@ public static Event getTooltipEvent(AuRequest request) {
final JSONArray data = (JSONArray) request.getData().get("data");
final Calendars cmp = verifyEvent(request, data, 5);
- CalendarEvent ce = cmp.getCalendarEventById(String.valueOf(data.get(0)));
+ CalendarItem ce = cmp.getCalendarItemById(String.valueOf(data.get(0)));
if (ce == null)
return null;
- return new CalendarsEvent(ON_EVENT_TOOLTIP, cmp, ce, null, null,
+ return new CalendarsEvent(ON_ITEM_TOOLTIP, cmp, ce, null, null,
getInt(data.get(1)), getInt(data.get(2)),
getInt(data.get(3)), getInt(data.get(4)));
}
@@ -177,23 +177,23 @@ public void clearGhost() {
}
/**
- * Returns the update beginning date. If the event name is onEventEdit, null is assumed.
+ * Returns the update beginning date. If the event name is onItemEdit, null is assumed.
*/
public Date getBeginDate() {
return _beginDate;
}
/**
- * Returns the update end date. If the event name is onEventEdit, null is assumed.
+ * Returns the update end date. If the event name is onItemEdit, null is assumed.
*/
public Date getEndDate() {
return _endDate;
}
/**
- * Returns the calendar event. If the event name is onEventCreate, null is assumed.
+ * Returns the calendar item. If the event name is onItemCreate, null is assumed.
*/
- public CalendarEvent getCalendarEvent() {
+ public CalendarItem getCalendarItem() {
return _ce;
}
diff --git a/calendar/src/org/zkoss/calendar/impl/AbstractCalendarEvent.java b/calendar/src/org/zkoss/calendar/impl/AbstractCalendarItem.java
similarity index 82%
rename from calendar/src/org/zkoss/calendar/impl/AbstractCalendarEvent.java
rename to calendar/src/org/zkoss/calendar/impl/AbstractCalendarItem.java
index b20d5fd..f0b0ac2 100644
--- a/calendar/src/org/zkoss/calendar/impl/AbstractCalendarEvent.java
+++ b/calendar/src/org/zkoss/calendar/impl/AbstractCalendarItem.java
@@ -1,4 +1,4 @@
-/* AbstractCalendarEvent.java
+/* AbstractCalendarItem.java
Purpose:
@@ -13,14 +13,14 @@
import java.time.Instant;
-import org.zkoss.calendar.api.CalendarEvent;
+import org.zkoss.calendar.api.CalendarItem;
/**
- * A skeletal implementation for {@link CalendarEvent}
+ * A skeletal implementation for {@link CalendarItem}
* @author leon
* @since 3.0.0
*/
-public abstract class AbstractCalendarEvent implements CalendarEvent {
+public abstract class AbstractCalendarItem implements CalendarItem {
private String _title;
private String _content;
private String _headerColor;
@@ -29,7 +29,7 @@ public abstract class AbstractCalendarEvent implements CalendarEvent {
private T _begin;
private T _end;
- public AbstractCalendarEvent(String title, String content, String headerColor, String contentColor, boolean locked, T begin, T end) {
+ public AbstractCalendarItem(String title, String content, String headerColor, String contentColor, boolean locked, T begin, T end) {
this._title = title;
this._content = content;
this._headerColor = headerColor;
@@ -95,7 +95,7 @@ public void setContentColor(String contentColor) {
@Override
public String getZclass() {
- return "z-calevent";
+ return "z-calitem";
}
@Override
diff --git a/calendar/src/org/zkoss/calendar/impl/AbstractCalendarModel.java b/calendar/src/org/zkoss/calendar/impl/AbstractCalendarModel.java
index 0d07cd1..f2865a2 100644
--- a/calendar/src/org/zkoss/calendar/impl/AbstractCalendarModel.java
+++ b/calendar/src/org/zkoss/calendar/impl/AbstractCalendarModel.java
@@ -24,7 +24,7 @@
import java.util.List;
import java.util.TimeZone;
-import org.zkoss.calendar.api.CalendarEvent;
+import org.zkoss.calendar.api.CalendarItem;
import org.zkoss.calendar.api.CalendarModel;
import org.zkoss.calendar.event.CalendarDataEvent;
import org.zkoss.calendar.event.CalendarDataListener;
@@ -40,7 +40,7 @@ abstract public class AbstractCalendarModel implements CalendarModel, Serializab
private transient List _listeners = new LinkedList();
/**
- * @deprecated As of release 2.0-RC, replaced with {@link #fireEvent(int type, CalendarEvent e)}
+ * @deprecated As of release 2.0-RC, replaced with {@link #fireEvent(int type, CalendarItem e)}
* Fires a {@link CalendarDataEvent} for all registered listener
* (thru {@link #addCalendarDataListener}.
*
@@ -54,11 +54,11 @@ protected void fireEvent(int type, Date begin, Date end) {
*
* @see #fireEvent(int, Date, Date, TimeZone)
*/
- protected void fireEvent(int type, CalendarEvent e) {
+ protected void fireEvent(int type, CalendarItem e) {
fireEvent(type, e, null);
}
/**
- * @deprecated As of release 2.0-RC, replaced with {@link #fireEvent(int type, CalendarEvent e, TimeZone timezone)}
+ * @deprecated As of release 2.0-RC, replaced with {@link #fireEvent(int type, CalendarItem e, TimeZone timezone)}
* Fires a {@link CalendarDataEvent} for all registered listener
* (thru {@link #addCalendarDataListener}.
*
@@ -74,7 +74,7 @@ protected void fireEvent(int type, Date begin, Date end, TimeZone timezone) {
*
* Note: you can invoke this method only in an event listener.
*/
- protected void fireEvent(int type, CalendarEvent e, TimeZone timezone) {
+ protected void fireEvent(int type, CalendarItem e, TimeZone timezone) {
final CalendarDataEvent evt = new CalendarDataEvent(this, type, e, timezone);
for (Iterator it = _listeners.iterator(); it.hasNext();)
it.next().onChange(evt);
diff --git a/calendar/src/org/zkoss/calendar/impl/LocaleDateTimeCalendarEvent.java b/calendar/src/org/zkoss/calendar/impl/LocaleDateTimeCalendarItem.java
similarity index 65%
rename from calendar/src/org/zkoss/calendar/impl/LocaleDateTimeCalendarEvent.java
rename to calendar/src/org/zkoss/calendar/impl/LocaleDateTimeCalendarItem.java
index 9cbe7da..58ea952 100644
--- a/calendar/src/org/zkoss/calendar/impl/LocaleDateTimeCalendarEvent.java
+++ b/calendar/src/org/zkoss/calendar/impl/LocaleDateTimeCalendarItem.java
@@ -1,4 +1,4 @@
-/* LocaleDateTimeCalendarEvent.java
+/* LocaleDateTimeCalendarItem.java
Purpose:
@@ -19,20 +19,20 @@
import org.zkoss.zk.ui.WrongValueException;
/**
- * A LocaleDateTime implementation of {@link AbstractCalendarEvent}
+ * A LocaleDateTime implementation of {@link AbstractCalendarItem}
* @author leon
* @since since 3.0.0
*/
-public class LocaleDateTimeCalendarEvent extends AbstractCalendarEvent implements Serializable {
+public class LocaleDateTimeCalendarItem extends AbstractCalendarItem implements Serializable {
private static final long serialVersionUID = 20210112095645L;
private ZoneId _zoneId;
- public LocaleDateTimeCalendarEvent(LocalDateTime begin, LocalDateTime end, ZoneId zoneId) {
+ public LocaleDateTimeCalendarItem(LocalDateTime begin, LocalDateTime end, ZoneId zoneId) {
super("", "", "", "", false, begin, end);
this._zoneId = zoneId;
}
- public LocaleDateTimeCalendarEvent(String title, String content, String headerColor, String contentColor, boolean locked, LocalDateTime begin, LocalDateTime end, ZoneId zoneId) {
+ public LocaleDateTimeCalendarItem(String title, String content, String headerColor, String contentColor, boolean locked, LocalDateTime begin, LocalDateTime end, ZoneId zoneId) {
super(title, content, headerColor, contentColor, locked, begin, end);
this._zoneId = zoneId;
}
diff --git a/calendar/src/org/zkoss/calendar/impl/SimpleCalendarEvent.java b/calendar/src/org/zkoss/calendar/impl/SimpleCalendarItem.java
similarity index 62%
rename from calendar/src/org/zkoss/calendar/impl/SimpleCalendarEvent.java
rename to calendar/src/org/zkoss/calendar/impl/SimpleCalendarItem.java
index d16db86..1ed7bfa 100644
--- a/calendar/src/org/zkoss/calendar/impl/SimpleCalendarEvent.java
+++ b/calendar/src/org/zkoss/calendar/impl/SimpleCalendarItem.java
@@ -1,55 +1,55 @@
-/* CalendarEventImpl.java
-
-{{IS_NOTE
- Purpose:
-
- Description:
-
- History:
- Mar 16, 2009 2:31:35 PM , Created by jumperchen
-}}IS_NOTE
-
-Copyright (C) 2009 Potix Corporation. All Rights Reserved.
-
-{{IS_RIGHT
-}}IS_RIGHT
-*/
-package org.zkoss.calendar.impl;
-
-import java.io.Serializable;
-import java.time.Instant;
-import java.util.Date;
-
-import org.zkoss.calendar.api.CalendarEvent;
-
-/**
- * A simple implementation of {@link CalendarEvent}
- * @author jumperchen
- * @deprecated since 3.0.0
- * @see AbstractCalendarEvent
- */
-@Deprecated
-public class SimpleCalendarEvent extends AbstractCalendarEvent implements Serializable {
- private static final long serialVersionUID = 20090316143135L;
-
- public SimpleCalendarEvent() {
- super("", "", "", "", false, null, null);
- }
-
- public SimpleCalendarEvent(String title, String content, String headerColor, String contentColor, boolean locked, Date begin, Date end) {
- super(title, content, headerColor, contentColor, locked, begin, end);
- }
-
- @Override
- protected Instant convertToInstant(Date date) {
- return date == null ? null : date.toInstant();
- }
-
- public void setBeginDate(Date begin) {
- setBegin(begin);
- }
-
- public void setEndDate(Date end) {
- setEnd(end);
- }
-}
+/* SimpleCalendarItem.java
+
+{{IS_NOTE
+ Purpose:
+
+ Description:
+
+ History:
+ Mar 16, 2009 2:31:35 PM , Created by jumperchen
+}}IS_NOTE
+
+Copyright (C) 2009 Potix Corporation. All Rights Reserved.
+
+{{IS_RIGHT
+}}IS_RIGHT
+*/
+package org.zkoss.calendar.impl;
+
+import java.io.Serializable;
+import java.time.Instant;
+import java.util.Date;
+
+import org.zkoss.calendar.api.CalendarItem;
+
+/**
+ * A simple implementation of {@link CalendarItem}
+ * @author jumperchen
+ * @deprecated since 3.0.0
+ * @see AbstractCalendarItem
+ */
+@Deprecated
+public class SimpleCalendarItem extends AbstractCalendarItem implements Serializable {
+ private static final long serialVersionUID = 20090316143135L;
+
+ public SimpleCalendarItem() {
+ super("", "", "", "", false, null, null);
+ }
+
+ public SimpleCalendarItem(String title, String content, String headerColor, String contentColor, boolean locked, Date begin, Date end) {
+ super(title, content, headerColor, contentColor, locked, begin, end);
+ }
+
+ @Override
+ protected Instant convertToInstant(Date date) {
+ return date == null ? null : date.toInstant();
+ }
+
+ public void setBeginDate(Date begin) {
+ setBegin(begin);
+ }
+
+ public void setEndDate(Date end) {
+ setEnd(end);
+ }
+}
diff --git a/calendar/src/org/zkoss/calendar/impl/SimpleCalendarModel.java b/calendar/src/org/zkoss/calendar/impl/SimpleCalendarModel.java
index ffaf131..62172d9 100644
--- a/calendar/src/org/zkoss/calendar/impl/SimpleCalendarModel.java
+++ b/calendar/src/org/zkoss/calendar/impl/SimpleCalendarModel.java
@@ -28,7 +28,7 @@
import java.util.TimeZone;
import org.zkoss.calendar.Calendars;
-import org.zkoss.calendar.api.CalendarEvent;
+import org.zkoss.calendar.api.CalendarItem;
import org.zkoss.calendar.api.CalendarModel;
import org.zkoss.calendar.api.RenderContext;
import org.zkoss.calendar.event.CalendarDataEvent;
@@ -43,7 +43,7 @@ public class SimpleCalendarModel extends AbstractCalendarModel implements
Serializable {
private static final long serialVersionUID = 20090320175712L;
- protected List _list;
+ protected List _list;
/**
* Constructor
@@ -61,29 +61,29 @@ public class SimpleCalendarModel extends AbstractCalendarModel implements
* since {@link Calendars} is not smart enough to handle it.
* Instead, modify it thru this object.
*/
- public SimpleCalendarModel(List list, boolean live) {
- _list = live ? list: new ArrayList(list);
+ public SimpleCalendarModel(List list, boolean live) {
+ _list = live ? list: new ArrayList(list);
}
/**
* Constructor.
*/
public SimpleCalendarModel() {
- _list = new ArrayList();
+ _list = new ArrayList();
}
/**
* Constructor.
* It makes a copy of the specified collection (i.e., not live).
*/
- public SimpleCalendarModel(Collection c) {
- _list = new ArrayList(c);
+ public SimpleCalendarModel(Collection c) {
+ _list = new ArrayList(c);
}
/**
* Constructor.
* It makes a copy of the specified array (i.e., not live).
*/
- public SimpleCalendarModel(CalendarEvent[] array) {
+ public SimpleCalendarModel(CalendarItem[] array) {
_list = Arrays.asList(array);
}
@@ -92,33 +92,33 @@ public SimpleCalendarModel(CalendarEvent[] array) {
* @param initialCapacity the initial capacity for this SimpleCalendarModel.
*/
public SimpleCalendarModel(int initialCapacity) {
- _list = new ArrayList(initialCapacity);
+ _list = new ArrayList(initialCapacity);
}
/**
- * Adds the calendar event to the specified index of the list.
+ * Adds the calendar item to the specified index of the list.
*/
- public void add(int index, CalendarEvent e) {
- if (e == null) throw new NullPointerException("CalendarEvent cannot be null!");
+ public void add(int index, CalendarItem e) {
+ if (e == null) throw new NullPointerException("CalendarItem cannot be null!");
_list.add(index, e);
fireEvent(CalendarDataEvent.INTERVAL_ADDED, e);
}
/**
- * Adds the calendar event to the list.
+ * Adds the calendar item to the list.
*/
- public boolean add(CalendarEvent e) {
- if (e == null) throw new NullPointerException("CalendarEvent cannot be null!");
+ public boolean add(CalendarItem e) {
+ if (e == null) throw new NullPointerException("CalendarItem cannot be null!");
boolean ret = _list.add(e);
fireEvent(CalendarDataEvent.INTERVAL_ADDED, e);
return ret;
}
/**
- * Update the calendar event to the list.
+ * Update the calendar item to the list.
*/
- public boolean update(CalendarEvent e) {
- if (e == null) throw new NullPointerException("CalendarEvent cannot be null!");
+ public boolean update(CalendarItem e) {
+ if (e == null) throw new NullPointerException("CalendarItem cannot be null!");
fireEvent(CalendarDataEvent.CONTENTS_CHANGED, e);
boolean ret = _list.remove(e);
if(!ret) return ret;
@@ -126,10 +126,10 @@ public boolean update(CalendarEvent e) {
return ret;
}
/**
- * Removes the calendar event from the specified index.
+ * Removes the calendar item from the specified index.
*/
- public CalendarEvent remove(int index) {
- CalendarEvent ret = (CalendarEvent)_list.remove(index);
+ public CalendarItem remove(int index) {
+ CalendarItem ret = (CalendarItem)_list.remove(index);
fireEvent(CalendarDataEvent.INTERVAL_REMOVED, ret);
return ret;
}
@@ -138,15 +138,15 @@ public CalendarEvent remove(int index) {
* Returns the index of the first occurrence of the specified element
* in this list.
*/
- public int indexOf(CalendarEvent elem) {
+ public int indexOf(CalendarItem elem) {
return _list.indexOf(elem);
}
/**
- * Removes from the specified calendar event.
+ * Removes from the specified calendar item.
*/
- public boolean remove(CalendarEvent e) {
- if (e == null) throw new NullPointerException("CalendarEvent cannot be null!");
+ public boolean remove(CalendarItem e) {
+ if (e == null) throw new NullPointerException("CalendarItem cannot be null!");
int index = indexOf(e);
if (index >= 0) {
remove(index);
@@ -172,19 +172,19 @@ public int size() {
return _list.size();
}
/**
- * Returns the list that must be a list of {@link CalendarEvent} type.
+ * Returns the list that must be a list of {@link CalendarItem} type.
*
* @param beginDate the begin date
* @param endDate the end date
* @param rc a RenderContext encapsulates the information needed for Calendars.
*/
- public List get(Date beginDate, Date endDate, RenderContext rc) {
- List list = new LinkedList();
+ public List get(Date beginDate, Date endDate, RenderContext rc) {
+ List list = new LinkedList();
long begin = beginDate.getTime();
long end = endDate.getTime();
- for (Iterator it = _list.iterator(); it.hasNext();) {
- CalendarEvent ce = (CalendarEvent) it.next();
+ for (Iterator it = _list.iterator(); it.hasNext();) {
+ CalendarItem ce = (CalendarItem) it.next();
long b = ce.getBeginDate().getTime();
long e = ce.getEndDate().getTime();
diff --git a/calendar/src/org/zkoss/calendar/impl/Util.java b/calendar/src/org/zkoss/calendar/impl/Util.java
index 1d49fba..3e9cb79 100644
--- a/calendar/src/org/zkoss/calendar/impl/Util.java
+++ b/calendar/src/org/zkoss/calendar/impl/Util.java
@@ -32,7 +32,7 @@ public class Util {
private static final int ONE_HOUR = 60 * 60 * 1000;
private static final SimpleDateFormat _sdfKey = new SimpleDateFormat("yyyy/MM/dd");
- public static String createEventTitle(DateFormatter df, Locale locale, TimeZone timezone, CalendarEvent ce) {
+ public static String createItemTitle(DateFormatter df, Locale locale, TimeZone timezone, CalendarItem ce) {
if (df == null) return ce.getTitle();
Date begin = ce.getBeginDate();
@@ -108,16 +108,16 @@ public static List packZonesOffset(Map _tzones) {
return result;
}
- public static String encloseEventList(Calendars calendars, Collection collection) {
+ public static String encloseItemList(Calendars calendars, Collection collection) {
final StringBuffer sb = new StringBuffer().append('[');
Date beginDate = calendars.getBeginDate();
_sdfKey.setTimeZone(calendars.getDefaultTimeZone());
- for (Iterator it = collection.iterator(); it.hasNext();) {
- CalendarEvent ce = it.next();
+ for (Iterator it = collection.iterator(); it.hasNext();) {
+ CalendarItem ce = it.next();
String key = ce.getBeginDate().before(beginDate) ?
- getEventKey(beginDate):
- getEventKey(ce.getBeginDate());
- appendEventByJSON(sb, calendars, key, ce);
+ getItemKey(beginDate):
+ getItemKey(ce.getBeginDate());
+ appendItemByJSON(sb, calendars, key, ce);
}
int len = sb.length();
collection.clear();
@@ -133,15 +133,15 @@ public static String encloseList(Collection collection) {
return sb.replace(len - 2, len, "]").toString();
}
- public static String encloseEventMap(Calendars calendars, Map> map) {
+ public static String encloseItemMap(Calendars calendars, Map> map) {
final StringBuffer sb = new StringBuffer().append('[');
int len;
- for (Iterator>> it = map.entrySet().iterator(); it.hasNext();) {
- Entry> entry = it.next();
+ for (Iterator>> it = map.entrySet().iterator(); it.hasNext();) {
+ Entry> entry = it.next();
sb.append('[');
String key = (String) entry.getKey();
- for (Iterator it2 = entry.getValue().iterator(); it2.hasNext();) {
- appendEventByJSON(sb, calendars, key, (CalendarEvent) it2.next());
+ for (Iterator it2 = entry.getValue().iterator(); it2.hasNext();) {
+ appendItemByJSON(sb, calendars, key, (CalendarItem) it2.next());
}
len = sb.length();
@@ -155,14 +155,14 @@ public static String encloseEventMap(Calendars calendars, Map() {
public void onEvent(Event event) throws Exception {
- cm.remove(((CalendarsEvent)event.getData()).getCalendarEvent());
+ cm.remove(((CalendarsEvent)event.getData()).getCalendarItem());
syncModel();
}
});
@@ -161,12 +161,12 @@ public void onUpdateFirstDayOfWeek(Event event) {
syncModel();
}
- @Listen("onEventTooltip = #calendars")
+ @Listen("onItemTooltip = #calendars")
public void showTooltip(CalendarsEvent event) {
- tooltipMsg.setValue(event.getCalendarEvent().getContent());
+ tooltipMsg.setValue(event.getCalendarItem().getContent());
}
- @Listen("onEventCreate = #calendars")
+ @Listen("onItemCreate = #calendars")
public void createEvent(CalendarsEvent event) {
if (createOrEdit == null) {
Map args = new HashMap();
@@ -179,7 +179,7 @@ public void createEvent(CalendarsEvent event) {
event.stopClearGhost();
}
- @Listen("onEventEdit = #calendars")
+ @Listen("onItemEdit = #calendars")
public void editEvent(CalendarsEvent event) {
if (createOrEdit == null) {
Map args = new HashMap();
@@ -192,12 +192,12 @@ public void editEvent(CalendarsEvent event) {
event.stopClearGhost();
}
- @Listen("onEventUpdate = #calendars")
+ @Listen("onItemUpdate = #calendars")
public void onUpdateEvent(CalendarsEvent event) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/d");
sdf.setTimeZone(calendars.getDefaultTimeZone());
StringBuffer sb = new StringBuffer("Update... from ");
- sb.append(sdf.format(event.getCalendarEvent().getBeginDate()));
+ sb.append(sdf.format(event.getCalendarItem().getBeginDate()));
sb.append(" to ");
sb.append(sdf.format(event.getBeginDate()));
updateMsg.setValue(sb.toString());
@@ -209,7 +209,7 @@ public void onUpdateEvent(CalendarsEvent event) {
left = event.getDesktopWidth() - 330;
updatePopup.open(left, top);
timer.start();
- SimpleCalendarEvent ce = (SimpleCalendarEvent) event.getCalendarEvent();
+ SimpleCalendarItem ce = (SimpleCalendarItem) event.getCalendarItem();
ce.setBeginDate(event.getBeginDate());
ce.setEndDate(event.getEndDate());
cm.update(ce);
@@ -261,7 +261,7 @@ private void initCalendarModel() {
cm = new SimpleCalendarModel();
for (int i = 0, len = evts.length; i < len; i++) {
- SimpleCalendarEvent sce = new SimpleCalendarEvent();
+ SimpleCalendarItem sce = new SimpleCalendarItem();
try {
sce.setBeginDate(dataSDF.parse(evts[i][0]));
sce.setEndDate(dataSDF.parse(evts[i][1]));
@@ -279,10 +279,10 @@ private void initCalendarModel() {
private void syncModel() {
if (!hasPE)
return;
- List list = cm.get(calendars.getBeginDate(), calendars.getEndDate(), null);
+ List list = cm.get(calendars.getBeginDate(), calendars.getEndDate(), null);
double red = 0, blue = 0, green = 0, purple = 0, khaki = 0;
int size = list.size();
- for (Iterator it = list.iterator(); it.hasNext();) {
+ for (Iterator it = list.iterator(); it.hasNext();) {
String color = it.next().getContentColor();
if ("#D96666".equals(color))
red += 1;
diff --git a/zkcalendardemo/src/main/java/test/Cal68Controller.java b/zkcalendardemo/src/main/java/test/Cal68Controller.java
index 1f95f26..1f9d0e6 100644
--- a/zkcalendardemo/src/main/java/test/Cal68Controller.java
+++ b/zkcalendardemo/src/main/java/test/Cal68Controller.java
@@ -2,20 +2,16 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.Calendar;
import java.util.Date;
-import java.util.TimeZone;
import org.zkoss.calendar.Calendars;
import org.zkoss.calendar.event.CalendarsEvent;
-import org.zkoss.calendar.impl.SimpleCalendarEvent;
+import org.zkoss.calendar.impl.SimpleCalendarItem;
import org.zkoss.calendar.impl.SimpleCalendarModel;
import org.zkoss.zk.ui.Component;
-import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.select.SelectorComposer;
import org.zkoss.zk.ui.select.annotation.Listen;
import org.zkoss.zk.ui.select.annotation.Wire;
-import org.zkoss.zul.Textbox;
public class Cal68Controller extends SelectorComposer {
@@ -41,7 +37,7 @@ private Date getDate(String dateText) {
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
calendarModel = new SimpleCalendarModel();
- SimpleCalendarEvent calEvent = new SimpleCalendarEvent();
+ SimpleCalendarItem calEvent = new SimpleCalendarItem();
calEvent.setBeginDate(getDate("2016/11/01 13:00"));
calEvent.setEndDate(getDate("2016/11/01 18:00"));
calEvent.setTitle("zkcal issue");
@@ -54,9 +50,9 @@ public void doAfterCompose(Component comp) throws Exception {
//listen to the calendar-update of event data, usually send when user drag the event data
- @Listen("onEventUpdate = #calendars")
+ @Listen("onItemUpdate = #calendars")
public void updateEvent(CalendarsEvent event) {
- SimpleCalendarEvent data = (SimpleCalendarEvent) event.getCalendarEvent();
+ SimpleCalendarItem data = (SimpleCalendarItem) event.getCalendarItem();
data.setBeginDate(event.getBeginDate());
data.setEndDate(event.getEndDate());
calendarModel.update(data);
diff --git a/zkcalendardemo/src/main/java/test/Cal70Composer.java b/zkcalendardemo/src/main/java/test/Cal70Composer.java
index 301c5df..70ffb4a 100644
--- a/zkcalendardemo/src/main/java/test/Cal70Composer.java
+++ b/zkcalendardemo/src/main/java/test/Cal70Composer.java
@@ -14,7 +14,7 @@
import java.util.Calendar;
import org.zkoss.calendar.Calendars;
-import org.zkoss.calendar.impl.SimpleCalendarEvent;
+import org.zkoss.calendar.impl.SimpleCalendarItem;
import org.zkoss.calendar.impl.SimpleCalendarModel;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.select.SelectorComposer;
@@ -36,7 +36,7 @@ public void doAfterCompose(Component comp) throws Exception {
@Listen("onClick = #add")
public void add(){
- SimpleCalendarEvent event1 = new SimpleCalendarEvent();
+ SimpleCalendarItem event1 = new SimpleCalendarItem();
java.util.Calendar calendar = java.util.Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 40);
@@ -45,7 +45,7 @@ public void add(){
event1.setEndDate(calendar.getTime());
model.add(event1);
- SimpleCalendarEvent event2 = new SimpleCalendarEvent();
+ SimpleCalendarItem event2 = new SimpleCalendarItem();
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 45);
event2.setBeginDate(calendar.getTime());
@@ -53,7 +53,7 @@ public void add(){
event2.setEndDate(calendar.getTime());
model.add(event2);
- SimpleCalendarEvent event3 = new SimpleCalendarEvent();
+ SimpleCalendarItem event3 = new SimpleCalendarItem();
calendar.set(Calendar.HOUR_OF_DAY, 18);
calendar.set(Calendar.MINUTE, 33);
event3.setBeginDate(calendar.getTime());
diff --git a/zkcalendardemo/src/main/java/test/Cal71Controller.java b/zkcalendardemo/src/main/java/test/Cal71Controller.java
index adb9c26..b285340 100644
--- a/zkcalendardemo/src/main/java/test/Cal71Controller.java
+++ b/zkcalendardemo/src/main/java/test/Cal71Controller.java
@@ -14,7 +14,7 @@
import java.util.Calendar;
import org.zkoss.calendar.Calendars;
-import org.zkoss.calendar.impl.SimpleCalendarEvent;
+import org.zkoss.calendar.impl.SimpleCalendarItem;
import org.zkoss.calendar.impl.SimpleCalendarModel;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.select.SelectorComposer;
@@ -33,7 +33,7 @@ public void doAfterCompose(Component comp) throws Exception {
java.util.Calendar calendar = java.util.Calendar.getInstance();
for (int i = 0; i < 100; i++) {
- SimpleCalendarEvent event = new SimpleCalendarEvent();
+ SimpleCalendarItem event = new SimpleCalendarItem();
calendar.set(Calendar.HOUR_OF_DAY, 9);
calendar.set(Calendar.MINUTE, 30);
event.setBeginDate(calendar.getTime());
diff --git a/zkcalendardemo/src/main/java/test/Cal73Controller.java b/zkcalendardemo/src/main/java/test/Cal73Controller.java
index 138b135..ca04505 100644
--- a/zkcalendardemo/src/main/java/test/Cal73Controller.java
+++ b/zkcalendardemo/src/main/java/test/Cal73Controller.java
@@ -17,8 +17,8 @@
import java.util.Calendar;
import org.zkoss.calendar.Calendars;
-import org.zkoss.calendar.impl.LocaleDateTimeCalendarEvent;
-import org.zkoss.calendar.impl.SimpleCalendarEvent;
+import org.zkoss.calendar.impl.LocaleDateTimeCalendarItem;
+import org.zkoss.calendar.impl.SimpleCalendarItem;
import org.zkoss.calendar.impl.SimpleCalendarModel;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.select.SelectorComposer;
@@ -38,11 +38,11 @@ public void doAfterCompose(Component comp) throws Exception {
LocalDateTime start = LocalDateTime.now().truncatedTo(ChronoUnit.HOURS);
LocalDateTime end = start.plusMinutes(120);
ZoneId zoneId = ZoneId.of("Europe/Paris");
- LocaleDateTimeCalendarEvent event = new LocaleDateTimeCalendarEvent(start, end, zoneId);
+ LocaleDateTimeCalendarItem event = new LocaleDateTimeCalendarItem(start, end, zoneId);
event.setContent("LocaleDateTimeCalendarEvent: " + start.toString());
calendarModel.add(event);
- SimpleCalendarEvent event2 = new SimpleCalendarEvent();
+ SimpleCalendarItem event2 = new SimpleCalendarItem();
java.util.Calendar calendar = java.util.Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 9);
calendar.set(Calendar.MINUTE, 30);
diff --git a/zkcalendardemo/src/main/java/test/Cal76Controller.java b/zkcalendardemo/src/main/java/test/Cal76Controller.java
index 4b72f3d..adff495 100644
--- a/zkcalendardemo/src/main/java/test/Cal76Controller.java
+++ b/zkcalendardemo/src/main/java/test/Cal76Controller.java
@@ -19,7 +19,7 @@
import org.zkoss.calendar.Calendars;
import org.zkoss.calendar.event.CalendarsEvent;
-import org.zkoss.calendar.impl.SimpleCalendarEvent;
+import org.zkoss.calendar.impl.SimpleCalendarItem;
import org.zkoss.calendar.impl.SimpleCalendarModel;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Page;
@@ -50,7 +50,7 @@ public void doAfterCompose(Component comp) throws Exception {
}
private void add(){
- SimpleCalendarEvent event1 = new SimpleCalendarEvent();
+ SimpleCalendarItem event1 = new SimpleCalendarItem();
java.util.Calendar calendar = java.util.Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 8);
calendar.set(Calendar.MINUTE, 40);
@@ -61,7 +61,7 @@ private void add(){
event1.setContent("event1");
model.add(event1);
- SimpleCalendarEvent event2 = new SimpleCalendarEvent();
+ SimpleCalendarItem event2 = new SimpleCalendarItem();
calendar.set(Calendar.HOUR_OF_DAY, 10);
calendar.set(Calendar.MINUTE, 0);
event2.setBeginDate(calendar.getTime());
@@ -71,7 +71,7 @@ private void add(){
event2.setContent("event2");
model.add(event2);
- SimpleCalendarEvent event3 = new SimpleCalendarEvent();
+ SimpleCalendarItem event3 = new SimpleCalendarItem();
calendar.set(Calendar.HOUR_OF_DAY, 12);
calendar.set(Calendar.MINUTE, 30);
event3.setBeginDate(calendar.getTime());
@@ -143,7 +143,7 @@ private void initCalendarModel(Page page) {
model = new SimpleCalendarModel();
for (int i = 0; i < evts.length; i++) {
- SimpleCalendarEvent sce = new SimpleCalendarEvent();
+ SimpleCalendarItem sce = new SimpleCalendarItem();
try {
sce.setBeginDate(dataSDF.parse(evts[i][0]));
sce.setEndDate(dataSDF.parse(evts[i][1]));
@@ -159,9 +159,9 @@ private void initCalendarModel(Page page) {
page.setAttribute("model", model);
}
- @Listen("onEventUpdate = #calendars")
+ @Listen("onItemUpdate = #calendars")
public void onUpdateEvent(CalendarsEvent event) {
- SimpleCalendarEvent ce = (SimpleCalendarEvent) event.getCalendarEvent();
+ SimpleCalendarItem ce = (SimpleCalendarItem) event.getCalendarItem();
ce.setBeginDate(event.getBeginDate());
ce.setEndDate(event.getEndDate());
model.update(ce);
diff --git a/zkcalendardemo/src/main/webapp/test/zkcal67.zul b/zkcalendardemo/src/main/webapp/test/zkcal67.zul
index 1545e13..ef69650 100644
--- a/zkcalendardemo/src/main/webapp/test/zkcal67.zul
+++ b/zkcalendardemo/src/main/webapp/test/zkcal67.zul
@@ -17,7 +17,7 @@ Copyright (C) 2020 Potix Corporation. All Rights Reserved.
load this page, you should not see any error message.
diff --git a/zkdoc/release-note b/zkdoc/release-note
index d1b67d5..68dcfd7 100644
--- a/zkdoc/release-note
+++ b/zkdoc/release-note
@@ -4,6 +4,7 @@ calendar 3.0.0
ZKCAL-78: Change Java compiler source/target to 8
ZKCAL-76: update ZK Calendar's look & feel
ZKCAL-73: Add compatibility with java.time API
+ ZKCAL-82: Rename CalendarEvent and SimpleCalendarEvent to avoid confusing
* Bugs:
ZKCAL-70: adding 2 short duration events causes a JavaScript error
@@ -13,7 +14,8 @@ calendar 3.0.0
* Upgrade Notes:
+ The Java binary-compatible level is Java 8 since ZK Calendar 3.
- + Some methods in CalendarEvent with java.util.Date are deprecated, and add ZonedDateTimeFormatter/LocaleDateTimeCalendarEvent for java.time API.
+ + CalendarEvent and SimpleCalendarEvent are renamed to CalendarItem and SimpleCalendarItem, the related API are renamed too.
+ + Some methods in CalendarItem with java.util.Date are deprecated, and add ZonedDateTimeFormatter/LocaleDateTimeCalendarItem for java.time API.
--------
calendar 2.1.5