get navigation-calendar to use egw_link_handler too, so listview does not reload top window

This commit is contained in:
Ralf Becker 2013-12-18 05:23:45 +00:00
parent f7843e4507
commit 8ad1e7ed20
2 changed files with 6 additions and 37 deletions

View File

@ -708,13 +708,14 @@ class calendar_ui
{ {
if ($this->view == 'planner' || $this->view == 'listview') if ($this->view == 'planner' || $this->view == 'listview')
{ {
$link_vars['menuaction'] = $this->view_menuaction; // must be first one
switch($view) switch($view)
{ {
case 'day': $link_vars[$this->view.'_days'] = $this->view == 'planner' ? 1 : ''; break; case 'day': $link_vars[$this->view.'_days'] = $this->view == 'planner' ? 1 : ''; break;
case 'week': $link_vars[$this->view.'_days'] = $this->cal_prefs['days_in_weekview'] == 5 ? 5 : 7; break; case 'week': $link_vars[$this->view.'_days'] = $this->cal_prefs['days_in_weekview'] == 5 ? 5 : 7; break;
case 'month': $link_vars[$this->view.'_days'] = 0; break; case 'month': $link_vars[$this->view.'_days'] = 0; break;
} }
$link_vars['menuaction'] = $this->view_menuaction; // stay in the planner if ($this->view == 'listview') $link_vars['ajax'] = 'true';
} }
elseif(substr($this->view,0,4) == 'week' && $view == 'week') elseif(substr($this->view,0,4) == 'week' && $view == 'week')
{ {

View File

@ -174,53 +174,21 @@ function dateChanged(calendar) {
// clicked you can use the dateClicked property of the calendar: // clicked you can use the dateClicked property of the calendar:
// redirect to $url extended with a &date=YYYYMMDD // redirect to $url extended with a &date=YYYYMMDD
' if (calendar.dateClicked) { ' if (calendar.dateClicked) {
egw_appWindow("calendar").location = "'.$url.'&date=" + calendar.date.print("%Y%m%d"); egw_link_handler("'.$url.'&date=" + calendar.date.print("%Y%m%d"),"calendar");
} }
}; };
function todayClicked(calendar) { function todayClicked(calendar) {
var parts = egw_appWindow("calendar").location.search.split("&"); egw_link_handler("'.$url.'&date='.egw_time::to('now', 'Ymd').'","calendar");
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] = "'.egw_time::to('now','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='.egw_time::to('now','Ymd').'";
}
egw_appWindow("calendar").location.search = newsearch;
} }
'.($weekUrl ? ' '.($weekUrl ? '
function weekClicked(calendar,weekstart) { function weekClicked(calendar,weekstart) {
egw_appWindow("calendar").location = "'.$weekUrl.'&date=" + weekstart.print("%Y%m%d"); egw_link_handler("'.$weekUrl.'&date=" + weekstart.print("%Y%m%d"),"calendar");
} }
' : '').($monthUrl ? ' ' : '').($monthUrl ? '
function monthClicked(calendar,monthstart) { function monthClicked(calendar,monthstart) {
egw_appWindow("calendar").location = "'.$monthUrl.'&date=" + monthstart.print("%Y%m%d"); egw_link_handler("'.$monthUrl.'&date=" + monthstart.print("%Y%m%d"),"calendar");
} }
' : '').' ' : '').'