Replace onClick inline-script with jQuery for todos in calendar

This commit is contained in:
Hadi Nategh 2014-01-17 10:28:15 +00:00
parent 9aa1506a84
commit 8f29c5a15b
2 changed files with 23 additions and 11 deletions

View File

@ -960,7 +960,7 @@ class calendar_uiviews extends calendar_ui
$todo_label .= ' '.html::a_href( html::image('infolog',$type,lang('Add')),'infolog.infolog_ui.edit',array(
'type' => $type,
'start_time' => $ts,
),' target="_blank" onclick="window.open(this.href,this.target,\'dependent=yes,width=750,height=590,scrollbars=yes,status=yes\'); return false;"');
),' data-todo="app|750x590"');
}
}
$cols[1] = html::div(
@ -1045,8 +1045,8 @@ class calendar_uiviews extends calendar_ui
if($todo['edit']) {
list($width, $height) = explode('x', $todo['edit']['size']);
unset($todo['edit']['size']);
$edit_icon_href = html::a_href( $icons, $todo['edit'],'',' target="_blank" onclick="window.open(this.href,this.target,\'dependent=yes,width='.$width.',height='.$height.',scrollbars=yes,status=yes\'); return false;"');
$edit_href = html::a_href( $todo['title'], $todo['edit'],'',' target="_blank" onclick="window.open(this.href,this.target,\'dependent=yes,width=750,height=590,scrollbars=yes,status=yes\'); return false;"');
$edit_icon_href = html::a_href( $icons, $todo['edit'],'',' data-todo="app|'.$width.'x'.$height.'" ');
$edit_href = html::a_href( $todo['title'], $todo['edit'],'',' data-todo="app|750x590" ');
}
$icon_href = html::a_href($icons,$todo['view']);
$href = html::a_href($todo['title'], $todo['view']);
@ -1877,12 +1877,11 @@ class calendar_uiviews extends calendar_ui
if ($popup_size)
{
list($w,$h) = explode('x',$popup_size);
$popup = ' onclick="'.$this->popup($view_link,'_blank',$w,$h).'; return false;"';
$popup = ' data-app="app|'.$popup_size.'"';
}
else
{
$popup = ' onclick="location.href=\''.$view_link.'\'; return false;"';
$popup = ' data-app="app|'.$app.'|'.'"';
}
}
return $popup;

View File

@ -232,11 +232,13 @@ app.classes.calendar = AppJS.extend(
//onClick Handler for calender entries
jQuery("div.calendar_calEvent").on({
click:function(ev){
var eventId = ev.currentTarget.id.replace(/drag_/g,'').split("_")[0];
var Id = ev.currentTarget.id.replace(/drag_/g,'').split("_")[0];
var eventId = Id.match(/-?\d+\.?\d*/g)[0];
var appName = Id.replace(/-?\d+\.?\d*/g,'');
var startDate = ev.currentTarget.getAttribute('data-resize').split("|")[0];
if (ev.currentTarget.id.match(/drag_/g))
if (ev.currentTarget.id.match(/drag_/g) || appName)
{
egw.open(eventId,'calendar','edit');
that.egw.open(eventId,appName !=""?appName:'calendar','edit');
}
else
{
@ -267,6 +269,17 @@ app.classes.calendar = AppJS.extend(
}
});
//Click handler for calendar todos
jQuery("div.calendar_calDayTodos").find("[data-todo^='app|']").on({
click:function(ev)
{
var windowSize = ev.currentTarget.getAttribute('data-todo').split("|")[1];
var link = ev.currentTarget.getAttribute('href');
that.egw.open_link(link,'_blank',windowSize);
return false;
}
});
//Click Handler for calendar planner
jQuery("div.calendar_plannerEvent").on({
click:function(ev){
@ -322,11 +335,11 @@ app.classes.calendar = AppJS.extend(
var minute = timestamp[2];
if (ownerId == 0)
{
egw.open_link('calendar.calendar_uiforms.edit&date='+date+'&hour='+hour+'&minute='+minute,'_blank','700x700');
that.egw.open_link('calendar.calendar_uiforms.edit&date='+date+'&hour='+hour+'&minute='+minute,'_blank','700x700');
}
else
{
egw.open_link('calendar.calendar_uiforms.edit&date='+date+'&hour='+hour+'&minute='+minute+'&owner='+ownerId,'_blank','700x700');
that.egw.open_link('calendar.calendar_uiforms.edit&date='+date+'&hour='+hour+'&minute='+minute+'&owner='+ownerId,'_blank','700x700');
}
});