mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-03 20:10:19 +01:00
Added some JavaScript-Code to the date selector which handles clicks on the "Today" button
This commit is contained in:
parent
7ab47224c9
commit
95891c869f
@ -180,6 +180,43 @@ function dateChanged(calendar) {
|
|||||||
window.location = "'.$url.'&date=" + calendar.date.print("%Y%m%d");
|
window.location = "'.$url.'&date=" + calendar.date.print("%Y%m%d");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function todayClicked(calendar) {
|
||||||
|
var parts = window.location.search.split("&");
|
||||||
|
var newsearch = "";
|
||||||
|
var hasdate = false;
|
||||||
|
|
||||||
|
/* Assemble the new search string, if the "date" property is found, replace its value
|
||||||
|
with the current date */
|
||||||
|
for (i = 0; i < parts.length; i++)
|
||||||
|
{
|
||||||
|
var split = parts[i].split("=");
|
||||||
|
if (split[0] && split[0] == "date") {
|
||||||
|
split[1] = "'.date('Ymd').'";
|
||||||
|
hasdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (split[1])
|
||||||
|
newsearch += split[0] + "=" + split[1];
|
||||||
|
else
|
||||||
|
newsearch += split[0];
|
||||||
|
|
||||||
|
if (i < parts.length - 1)
|
||||||
|
newsearch += "&"
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If the date property hasn\'t been found, add it to the search string */
|
||||||
|
if (!hasdate) {
|
||||||
|
if (parts.length == 0)
|
||||||
|
newsearch = "?";
|
||||||
|
else
|
||||||
|
newsearch += "&";
|
||||||
|
newsearch += "date='.date('Ymd').'";
|
||||||
|
}
|
||||||
|
|
||||||
|
window.location.search = newsearch;
|
||||||
|
}
|
||||||
|
|
||||||
'.($weekUrl ? '
|
'.($weekUrl ? '
|
||||||
function weekClicked(calendar,weekstart) {
|
function weekClicked(calendar,weekstart) {
|
||||||
window.location = "'.$weekUrl.'&date=" + weekstart.print("%Y%m%d");
|
window.location = "'.$weekUrl.'&date=" + weekstart.print("%Y%m%d");
|
||||||
@ -198,6 +235,7 @@ function monthClicked(calendar,monthstart) {
|
|||||||
flatWeekTTip : "'.addslashes($weekTTip).'"' : '').($monthUrl ? ',
|
flatWeekTTip : "'.addslashes($weekTTip).'"' : '').($monthUrl ? ',
|
||||||
flatMonthCallback : monthClicked' : '').($monthTTip ? ',
|
flatMonthCallback : monthClicked' : '').($monthTTip ? ',
|
||||||
flatMonthTTip : "'.addslashes($monthTTip).'"' : '').($date ? ',
|
flatMonthTTip : "'.addslashes($monthTTip).'"' : '').($date ? ',
|
||||||
|
flatTodayCallback : todayClicked,
|
||||||
date : "'.$date.'"
|
date : "'.$date.'"
|
||||||
' : '').'
|
' : '').'
|
||||||
}
|
}
|
||||||
|
@ -693,6 +693,7 @@ Calendar.cellClick = function(el, ev) {
|
|||||||
return;
|
return;
|
||||||
case 0:
|
case 0:
|
||||||
// TODAY will bring us here
|
// TODAY will bring us here
|
||||||
|
cal.callTodayHandler();
|
||||||
if ((typeof cal.getDateStatus == "function") && cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) {
|
if ((typeof cal.getDateStatus == "function") && cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) {
|
||||||
// remember, "date" was previously set to new
|
// remember, "date" was previously set to new
|
||||||
// Date() if TODAY was clicked; thus, it
|
// Date() if TODAY was clicked; thus, it
|
||||||
@ -1251,6 +1252,17 @@ Calendar.prototype.callMonthHandler = function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Calls the today-clicked user handler (selectedHandler) */
|
||||||
|
Calendar.prototype.hasTodayHandler = function () {
|
||||||
|
return this.params && this.params.flat && this.params.flatTodayCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
Calendar.prototype.callTodayHandler = function () {
|
||||||
|
if (this.hasTodayHandler()) {
|
||||||
|
this.params.flatTodayCallback(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Calls the second user handler (closeHandler). */
|
/** Calls the second user handler (closeHandler). */
|
||||||
Calendar.prototype.callCloseHandler = function () {
|
Calendar.prototype.callCloseHandler = function () {
|
||||||
if (this.onClose) {
|
if (this.onClose) {
|
||||||
|
Loading…
Reference in New Issue
Block a user