Fix tooltip on plannerEvent, replace the handle with jquery tooltip

This commit is contained in:
Hadi Nategh 2014-01-08 16:36:15 +00:00
parent 957683087c
commit e6ce77b303
2 changed files with 43 additions and 3 deletions

View File

@ -140,7 +140,7 @@ class calendar_uiviews extends calendar_ui
*/
function __construct($set_states=null)
{
parent::__construct(false,$set_states); // call the parent's constructor
$this->extraRowsOriginal = $this->extraRows; //save original extraRows value
@ -569,12 +569,13 @@ class calendar_uiviews extends calendar_ui
$width = $this->time2pos($event['end_m'] - $event['start_m']);
$color = $data['color'] ? $data['color'] : 'gray';
$tooltip = html::htmlspecialchars(str_replace(array("\n","\r","'",'"'),array('','',"\\'",'"'),$data['tooltip']));
$content .= $indent.'<div class="calendar_plannerEvent'.($data['private'] ? 'Private' : '').
'" data-tooltip ="'.$tooltip .
'" style="position: absolute; left: '.$left.'%; width: '.$width.'%; height: '.
$row_height.'%; top: '.($n * $row_height).'%;'.
'background-color: '.$color.';" '.$data['popup'].' '.
html::tooltip($data['tooltip'],False,array('BorderWidth'=>0,'Padding'=>0)).
'>'."\n".$data['html'].$indent."</div>\n";
'>'."\n".$data['html'].$indent.'" data-tooltip ="'.$tooltip ."</div>\n";
}
}
}

View File

@ -266,6 +266,45 @@ app.classes.calendar = AppJS.extend(
jQuery(this).tooltip("disable");
}
});
//Click Handler for calendar planner
jQuery("div.calendar_plannerEvent").on({
click:function(ev){
var eventId = ev.currentTarget.id.replace(/drag_/g,'').split("_")[0];
var startDate = ev.currentTarget.getAttribute('data-resize').split("|")[0];
if (ev.currentTarget.id.match(/drag_/g))
{
egw.open(eventId,'calendar','edit');
}
else
{
that.edit_series(event,eventId,startDate);
}
},
mouseover: function(){
var ttp = jQuery(this).tooltip({
items: "[data-tooltip]",
content: function()
{
var elem = jQuery(this);
if (elem.is("[data-tooltip]"))
return this.getAttribute('data-tooltip') ;
},
track:true,
open: function(event,ui){
ui.tooltip.removeClass("ui-tooltip");
ui.tooltip.addClass("calendar_uitooltip");
}
});
ttp.tooltip("enable");
},
mousedown: function(){
jQuery(this).tooltip("disable");
}
});
//onClick Handler for calendar cells
jQuery("div.calendar_calAddEvent").click(function(ev)
{