details: https://code.openbravo.com/erp/devel/pi/rev/d90c71dfe010
changeset: 21241:d90c71dfe010
user: David Baz Fayos <david.baz <at> openbravo.com>
date: Mon Oct 07 14:49:34 2013 +0200
summary: [calendar] Now in OBMultiCalendar, the 'Book a Resource' button
opens the event editor popup with the start time rounded to the next quarter
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/calendar/ob-calendar.js
| 18 ++++++++++
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/calendar/ob-multicalendar.js
| 5 ++-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-date.js
| 18 +++++++++-
3 files changed, 39 insertions(+), 2 deletions(-)
diffs (77 lines):
diff -r 38eedfd11da4 -r d90c71dfe010
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/calendar/ob-calendar.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/calendar/ob-calendar.js
Mon Oct 07 13:13:45 2013 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/calendar/ob-calendar.js
Mon Oct 07 14:49:34 2013 +0200
@@ -551,6 +551,24 @@
endDate.logicalDate = false;
return this.Super('addEvent', [startDate, endDate, name, description,
otherFields, ignoreDataChanged]);
+ },
+
+ addEventWithDialog: function (startDate, endDate) {
+ if (!startDate) {
+ startDate = new Date();
+ }
+ if (!endDate) {
+ endDate = new Date();
+ }
+ this.eventDialog.event = null;
+ this.eventDialog.currentStart = startDate;
+ this.eventDialog.currentEnd = endDate;
+ this.eventDialog.currentLane = null;
+ this.eventDialog.calendar = this;
+ try {
+ //To avoid js error due to conflicts with Smartclient default EventDialog
+ this.eventDialog.show();
+ } catch (e) {}
}
});
diff -r 38eedfd11da4 -r d90c71dfe010
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/calendar/ob-multicalendar.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/calendar/ob-multicalendar.js
Mon Oct 07 13:13:45 2013 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/calendar/ob-multicalendar.js
Mon Oct 07 14:49:34 2013 +0200
@@ -471,7 +471,10 @@
width: 180,
title: this.multiCalendar.addEventButtonName,
click: function () {
- leftControls.multiCalendar.calendar.addEventButton.click();
+ var startDate = OB.Utilities.Date.roundToNextQuarter(new Date()),
+ endDate = new Date(startDate);
+ endDate.setHours(endDate.getHours() + 1);
+ leftControls.multiCalendar.calendar.addEventWithDialog(startDate,
endDate);
}
});
this.dateChooser = isc.OBDateChooser.create({
diff -r 38eedfd11da4 -r d90c71dfe010
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-date.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-date.js
Mon Oct 07 13:13:45 2013 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/utilities/ob-utilities-date.js
Mon Oct 07 14:49:34 2013 +0200
@@ -11,7 +11,7 @@
* under the License.
* The Original Code is Openbravo ERP.
* The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2009-2012 Openbravo SLU
+ * All portions are Copyright (C) 2009-2013 Openbravo SLU
* All Rights Reserved.
* Contributor(s): ______________________________________.
************************************************************************
@@ -293,4 +293,20 @@
var UTCHourOffset = isc.Time.getUTCHoursDisplayOffset(new Date()),
UTCMinuteOffset = isc.Time.getUTCMinutesDisplayOffset(new Date());
return (UTCHourOffset * 60 * 60 * 1000) + (UTCMinuteOffset * 60 * 1000);
+};
+
+//** {{{ OB.Utilities.Date.roundToNextQuarter }}} **
+//
+// Round any date to the next quarter
+OB.Utilities.Date.roundToNextQuarter = function (date) {
+ var newDate = new Date(date);
+ var minutes = newDate.getMinutes();
+ var roundedMinutes = (parseInt((minutes + 15) / 15, 10) * 15) % 60;
+ newDate.setMilliseconds(0);
+ newDate.setSeconds(0);
+ newDate.setMinutes(roundedMinutes);
+ if (roundedMinutes === 0) {
+ newDate.setHours(newDate.getHours() + 1);
+ }
+ return newDate;
};
\ No newline at end of file
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits