"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "phprojekt/application/Calendar2/Views/dojo/scripts/DefaultView.js" between
PHProjekt-6.2.0.tar.gz and PHProjekt-6.2.1.tar.gz

About: PHProjekt is an application suite that supports communication and management of teams and companies. It includes a group calendar, project management, a request tracker and 12 other modules.

DefaultView.js  (PHProjekt-6.2.0):DefaultView.js  (PHProjekt-6.2.1)
skipping to change at line 320 skipping to change at line 320
// Updates internal class variables with current sizes of schedule // Updates internal class variables with current sizes of schedule
if (this.main.dayListSelf !== null) { if (this.main.dayListSelf !== null) {
this.stepH = dojo.byId('scheduleBackground').offsetWidth - this._cel lTimeWidth; this.stepH = dojo.byId('scheduleBackground').offsetWidth - this._cel lTimeWidth;
} else if (this.main.dayListSelect !== null) { } else if (this.main.dayListSelect !== null) {
this.stepH = (dojo.byId('scheduleBackground').offsetWidth - this._ce llTimeWidth) / this.users.length; this.stepH = (dojo.byId('scheduleBackground').offsetWidth - this._ce llTimeWidth) / this.users.length;
} else if (this.main.weekList !== null) { } else if (this.main.weekList !== null) {
this.stepH = (dojo.byId('scheduleBackground').offsetWidth - this._ce llTimeWidth) / 7; this.stepH = (dojo.byId('scheduleBackground').offsetWidth - this._ce llTimeWidth) / 7;
} }
this.stepH = dojo.number.round(this.stepH, 1); this.stepH = dojo.number.round(this.stepH, 1);
this.stepY = this.cellTimeHeight; this.stepY = this.cellTimeHeight;
this.posHMax = parseInt(dojo.byId('eventsArea').style.width) - this.posHMax = parseInt(dojo.byId('eventsArea').style.width, 1
this.stepH; 0) - this.stepH;
this.posYMaxComplement = parseInt(dojo.byId('eventsArea').style.height); this.posYMaxComplement = parseInt(dojo.byId('eventsArea').style.height,
10);
}, },
timeToDivPosition: function(moment, isEvent, type) { timeToDivPosition: function(moment, isEvent, type) {
// Summary // Summary
// Receives a time string and returns a number for the corresponding vertical position in pixels. // Receives a time string and returns a number for the corresponding vertical position in pixels.
// Parameters: // Parameters:
// moment: string, e.g.: '14:40' // moment: string, e.g.: '14:40'
// isEvent: whether the number returned will be used to position an e vent (not background 'eventsArea' div) // isEvent: whether the number returned will be used to position an e vent (not background 'eventsArea' div)
// type: used when isEvent = true, whether we are receiving the start or the end time of the event. // type: used when isEvent = true, whether we are receiving the start or the end time of the event.
var tmp = moment.split(':'); var tmp = moment.split(':');
skipping to change at line 355 skipping to change at line 355
if (type == this.TYPE_EVENT_START || type === undefined) { if (type == this.TYPE_EVENT_START || type === undefined) {
row += Math.floor(minutes / 30); row += Math.floor(minutes / 30);
} else if (type == this.TYPE_EVENT_END) { } else if (type == this.TYPE_EVENT_END) {
row += Math.ceil(minutes / 30); row += Math.ceil(minutes / 30);
} }
var position = row * this.cellTimeHeight; var position = row * this.cellTimeHeight;
if (!isEvent && (this.main.dayListSelect !== null || this.main.weekList !== null)) { if (!isEvent && (this.main.dayListSelect !== null || this.main.weekList !== null)) {
position += this._cellHeaderHeight; position += this._cellHeaderHeight;
} }
position = parseInt(position); position = parseInt(position, 10);
return position; return position;
}, },
columnToDivPosition: function(column, isEvent) { columnToDivPosition: function(column, isEvent) {
// Summary // Summary
// Receives a column order number and returns a number for the corres ponding horizontal position in pixels. // Receives a column order number and returns a number for the corres ponding horizontal position in pixels.
// Parameters: // Parameters:
// isEvent: whether the number returned will be used to position an e vent // isEvent: whether the number returned will be used to position an e vent
// (not the background 'eventsArea' div) // (not the background 'eventsArea' div)
skipping to change at line 378 skipping to change at line 378
if (this.main.weekList !== null) { if (this.main.weekList !== null) {
position = column * widthColumns / 7; position = column * widthColumns / 7;
} else if (this.main.dayListSelf !== null) { } else if (this.main.dayListSelf !== null) {
position = 0; position = 0;
} else if (this.main.dayListSelect !== null) { } else if (this.main.dayListSelect !== null) {
position = column * widthColumns / this.users.length; position = column * widthColumns / this.users.length;
} }
if (!isEvent) { if (!isEvent) {
position += this._cellTimeWidth; position += this._cellTimeWidth;
} }
position = parseInt(position); position = parseInt(position, 10);
return position; return position;
}, },
divPositionToTime: function(verticalPos) { divPositionToTime: function(verticalPos) {
// Summary // Summary
// Receives a schedule position in pixels and returns a time string // Receives a schedule position in pixels and returns a time string
var row = Math.floor(verticalPos / this.cellTimeHeight); var row = Math.floor(verticalPos / this.cellTimeHeight);
var hour = 8 + Math.floor(row / 2); var hour = 8 + Math.floor(row / 2);
var minutes = (row % 2) * 30; var minutes = (row % 2) * 30;
skipping to change at line 489 skipping to change at line 489
eventDiv2.innerHTML = textualContents; eventDiv2.innerHTML = textualContents;
} else { } else {
visibility = 'hidden'; visibility = 'hidden';
} }
dojo.style(eventDiv1, 'visibility', visibility); dojo.style(eventDiv1, 'visibility', visibility);
} }
if (this.main.weekList !== null) { if (this.main.weekList !== null) {
// Any remaining unused html divs? // Any remaining unused html divs?
var lastIndex = parseInt(i); var lastIndex = parseInt(i, 10);
if ((lastIndex + 1) < this._htmlEventDivsAmount) { if ((lastIndex + 1) < this._htmlEventDivsAmount) {
// Yes, hide them // Yes, hide them
for (indexToHide = lastIndex + 1; indexToHide < this._htmlEventD ivsAmount; indexToHide ++) { for (indexToHide = lastIndex + 1; indexToHide < this._htmlEventD ivsAmount; indexToHide ++) {
var eventDiv1 = dojo.byId(this.EVENTS_MAIN_DIV_ID + indexToH ide); var eventDiv1 = dojo.byId(this.EVENTS_MAIN_DIV_ID + indexToH ide);
dojo.style(eventDiv1, 'visibility', 'hidden'); dojo.style(eventDiv1, 'visibility', 'hidden');
} }
} }
} }
}, },
skipping to change at line 545 skipping to change at line 545
// shapes of events according to 'simultaneous events' criteria and a ctivate Save button. // shapes of events according to 'simultaneous events' criteria and a ctivate Save button.
// Parameters: // Parameters:
// node: the div node of the moved event // node: the div node of the moved event
// dropped: (boolean) whether the mouse button was released, so the d ragged actioni has been finished // dropped: (boolean) whether the mouse button was released, so the d ragged actioni has been finished
// resized: (boolean) whether the event has just been resized (not mo ved) // resized: (boolean) whether the event has just been resized (not mo ved)
// 1 - Put div in the front of stack // 1 - Put div in the front of stack
this.putDivInTheFront(node); this.putDivInTheFront(node);
// 2 - Define some variables // 2 - Define some variables
var posLeftNew = parseInt(node.style.left); var posLeftNew = parseInt(node.style.left, 10);
var posTopNew = parseInt(node.style.top); var posTopNew = parseInt(node.style.top, 10);
var posBottomNew = posTopNew + node.offsetHeight; var posBottomNew = posTopNew + node.offsetHeight;
var movedEventIndex = this.nodeIdToEventOrder(node.id); var movedEventIndex = this.nodeIdToEventOrder(node.id);
var movedEvent = this.events[movedEventIndex]; var movedEvent = this.events[movedEventIndex];
var posTopCurrent = movedEvent.currentTop; var posTopCurrent = movedEvent.currentTop;
var posBottomCurrent = movedEvent.currentBottom; var posBottomCurrent = movedEvent.currentBottom;
var posLeftCurrent = movedEvent.currentLeft; var posLeftCurrent = movedEvent.currentLeft;
var dragged = !resized; var dragged = !resized;
var startTime = null; var startTime = null;
var endTime = null; var endTime = null;
skipping to change at line 676 skipping to change at line 676
this.classesSetup(); this.classesSetup();
} }
}, },
nodeIdToEventOrder: function(nodeId) { nodeIdToEventOrder: function(nodeId) {
// Summary: // Summary:
// Receives the id of a node of an event (the main div) and returns a number corresponding to the // Receives the id of a node of an event (the main div) and returns a number corresponding to the
// corresponding index in the events array. // corresponding index in the events array.
var pos = this.EVENTS_MAIN_DIV_ID.length; var pos = this.EVENTS_MAIN_DIV_ID.length;
var event = nodeId.substr(pos, nodeId.length); var event = nodeId.substr(pos, nodeId.length);
event = parseInt(event); event = parseInt(event, 10);
return event; return event;
}, },
saveChanges: function() { saveChanges: function() {
// Summary: // Summary:
// Save the changes in the server, if any // Save the changes in the server, if any
// Description: // Description:
// Get all the new modified values and send them to the server // Get all the new modified values and send them to the server
var content = []; var content = [];
skipping to change at line 878 skipping to change at line 878
return hour + ':' + minutes; return hour + ':' + minutes;
}, },
isFirstTimeEarlier: function(time1, time2) { isFirstTimeEarlier: function(time1, time2) {
// Summary: // Summary:
// Returns whether the first time is earlier than the second one // Returns whether the first time is earlier than the second one
var result = false; var result = false;
var tmp = time1.split(':'); var tmp = time1.split(':');
var hour1 = parseInt(tmp[0]); var hour1 = parseInt(tmp[0], 10);
var minutes1 = parseInt(tmp[1]); var minutes1 = parseInt(tmp[1], 10);
tmp = time2.split(':'); tmp = time2.split(':');
var hour2 = parseInt(tmp[0]); var hour2 = parseInt(tmp[0], 10);
var minutes2 = parseInt(tmp[1]); var minutes2 = parseInt(tmp[1], 10);
if (hour1 < hour2) { if (hour1 < hour2) {
result = true; result = true;
} else if (hour1 == hour2 && minutes1 < minutes2) { } else if (hour1 == hour2 && minutes1 < minutes2) {
result = true; result = true;
} }
return result; return result;
}, },
updateSimultEventWidths: function() { updateSimultEventWidths: function() {
// Summary: // Summary:
// Checks every event and updates its 'simultaneous' type properties // Checks every event and updates its 'simultaneous' type properties
for (var i in this.events) { for (var i in this.events) {
if (this.events[i] !== undefined) { if (this.events[i] !== undefined) {
// parseInt is very important here: // parseInt is very important here:
i = parseInt(i); i = parseInt(i, 10);
var simultEvents = this.isSharingSpace(i); var simultEvents = this.isSharingSpace(i);
if (simultEvents.sharing) { if (simultEvents.sharing) {
this.events[i].simultWidth = true; this.events[i].simultWidth = true;
this.events[i].simultAmount = simultEvents.amountEvents; this.events[i].simultAmount = simultEvents.amountEvents;
this.events[i].simultOrder = simultEvents.order; this.events[i].simultOrder = simultEvents.order;
} else { } else {
this.events[i].simultWidth = false; this.events[i].simultWidth = false;
} }
} }
} }
skipping to change at line 1700 skipping to change at line 1700
var originalTop = this.parentClass.timeToDivPosition(movedEvent.startTi me, true); var originalTop = this.parentClass.timeToDivPosition(movedEvent.startTi me, true);
// Following value will be checked by onMoveStop function of this class // Following value will be checked by onMoveStop function of this class
this.parentClass.eventClickDisabled = true; this.parentClass.eventClickDisabled = true;
// Calculate new left position // Calculate new left position
if (movedEvent.simultWidth) { if (movedEvent.simultWidth) {
// If event is concurrent and it is not the first one from left to r ight, // If event is concurrent and it is not the first one from left to r ight,
// attach its left side to column border // attach its left side to column border
leftTop.l -= stepH / movedEvent.simultAmount * (movedEvent.simultOrd er - 1); leftTop.l -= stepH / movedEvent.simultAmount * (movedEvent.simultOrd er - 1);
leftTop.l = parseInt(leftTop.l); leftTop.l = parseInt(leftTop.l, 10);
} }
if (this.parentClass.main.weekList !== null) { if (this.parentClass.main.weekList !== null) {
var rest = leftTop.l % stepH; var rest = leftTop.l % stepH;
var left; var left;
if (rest < stepH / 2) { if (rest < stepH / 2) {
left = leftTop.l - rest; left = leftTop.l - rest;
} else { } else {
left = leftTop.l + stepH - rest; left = leftTop.l + stepH - rest;
} }
if (left < 0) { if (left < 0) {
left = 0; left = 0;
} else if (left > posHmax) { } else if (left > posHmax) {
left = posHmax; left = posHmax;
} }
leftTop.l = parseInt(left); leftTop.l = parseInt(left, 10);
} else { } else {
leftTop.l = originalLeft; leftTop.l = originalLeft;
} }
// Calculate new top position // Calculate new top position
var top = leftTop.t - (leftTop.t % stepY); var top = leftTop.t - (leftTop.t % stepY);
if (top < 0) { if (top < 0) {
top = 0; top = 0;
} else if (top > posYmax) { } else if (top > posYmax) {
top = stepY * parseInt(posYmax / stepY); top = stepY * parseInt(posYmax / stepY, 10);
} }
leftTop.t = parseInt(top); leftTop.t = parseInt(top, 10);
// According to new calculated left and top values, the div will be move d? // According to new calculated left and top values, the div will be move d?
if (originalLeft != leftTop.l || originalTop != leftTop.t) { if (originalLeft != leftTop.l || originalTop != leftTop.t) {
// Yes // Yes
// If the event is a concurrent one, return it to 100% column width // If the event is a concurrent one, return it to 100% column width
if (movedEvent.simultWidth) { if (movedEvent.simultWidth) {
var eventDivSecond = dojo.byId('plainDiv' + movedEventIndex) ; var eventDivSecond = dojo.byId('plainDiv' + movedEventIndex) ;
var eventWidthComplete = this.parentClass.cellColumnWidth - (2 * this.parentClass.EVENTS_BORDER_WIDTH); var eventWidthComplete = this.parentClass.cellColumnWidth - (2 * this.parentClass.EVENTS_BORDER_WIDTH);
var eventWidthCurrent = dojo.style(eventDivSecond, 'width'); var eventWidthCurrent = dojo.style(eventDivSecond, 'width');
skipping to change at line 1810 skipping to change at line 1810
((5 - this.parentClass.EVENTS_BORDER_WIDTH) * 2) - 7; ((5 - this.parentClass.EVENTS_BORDER_WIDTH) * 2) - 7;
// Depending on the view and browser the steppedHeight value may be diff erent: // Depending on the view and browser the steppedHeight value may be diff erent:
if (this.parentClass.main.dayListSelf !== null) { if (this.parentClass.main.dayListSelf !== null) {
steppedHeight += 3; steppedHeight += 3;
if (dojo.isIE) { if (dojo.isIE) {
steppedHeight += 2; steppedHeight += 2;
} }
} }
// Maximum height - Set for the event end time not to be after 20:00 // Maximum height - Set for the event end time not to be after 20:00
var maxY = parseInt(dojo.byId('eventsArea').offsetHeight) + step; var maxY = parseInt(dojo.byId('eventsArea').offsetHeight, 10) + ste
var eventTopY = parseInt(this.targetDomNode.parentNode.style.top); p;
var eventTopY = parseInt(this.targetDomNode.parentNode.style.top, 10);
var proposedY = eventTopY + proposedHeight + step + sizerDivHeight; var proposedY = eventTopY + proposedHeight + step + sizerDivHeight;
// The event bottom border will be moved? // The event bottom border will be moved?
if (proposedY <= maxY && steppedHeight != currentHeight) { if (proposedY <= maxY && steppedHeight != currentHeight) {
tmp.h = steppedHeight; tmp.h = steppedHeight;
if (this.targetWidget && dojo.isFunction(this.targetWidget.resize)) { if (this.targetWidget && dojo.isFunction(this.targetWidget.resize)) {
this.targetWidget.resize(tmp); this.targetWidget.resize(tmp);
} else { } else {
if (this.animateSizing) { if (this.animateSizing) {
 End of changes. 14 change blocks. 
20 lines changed or deleted 22 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)