Revert "* Calendar: Activate links in location & description in event tooltip"

This reverts commit 3da46fdfe9.
This commit is contained in:
nathan 2021-09-23 14:33:32 -06:00
parent 37a938f38d
commit 0de779e162

View File

@ -1,10 +1,9 @@
/*
* Egroupware Calendar event widget
*
* @license https://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package calendar
* @subpackage etemplate
* @link https://www.egroupware.org
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package etemplate
* @subpackage api
* @link http://www.egroupware.org
* @author Nathan Gray
* @version $Id$
*/
@ -20,13 +19,6 @@ import {ClassWithAttributes} from "../../api/js/etemplate/et2_core_inheritance";
import {et2_action_object_impl, et2_DOMWidget} from "../../api/js/etemplate/et2_core_DOMWidget";
import {et2_calendar_daycol} from "./et2_widget_daycol";
import {et2_calendar_planner_row} from "./et2_widget_planner_row";
import {et2_IDetachedDOM} from "../../api/js/etemplate/et2_core_interfaces";
import {et2_no_init} from "../../api/js/etemplate/et2_core_common";
import {egw_getAppObjectManager, egwActionObject} from '../../api/js/egw_action/egw_action.js';
import {egw} from "../../api/js/jsapi/egw_global";
import {et2_selectbox} from "../../api/js/etemplate/et2_widget_selectbox";
import {et2_container} from "../../api/js/etemplate/et2_core_baseWidget";
import {et2_dialog} from "../../api/js/etemplate/et2_widget_dialog";
/**
* Class for a single event, displayed in either the timegrid or planner view
@ -89,8 +81,7 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
.addClass("calendar_calEvent")
.addClass(this.options.class)
.css('width',this.options.width)
.on('mouseenter', function ()
{
.on('mouseenter', function() {
// Bind actions on first mouseover for faster creation
if(event._need_actions_linked)
{
@ -107,20 +98,16 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
}
}
// Hacky to remove egw's tooltip border and let the mouse in
window.setTimeout(function ()
{
window.setTimeout(function() {
jQuery('body .egw_tooltip')
.css('border','none')
.on('mouseenter', function ()
{
.on('mouseenter', function() {
event.div.off('mouseleave.tooltip');
jQuery('body.egw_tooltip').remove();
jQuery('body').append(this);
jQuery(this).stop(true).fadeTo(400, 1)
.on('mouseleave', function ()
{
jQuery(this).fadeOut('400', function ()
{
.on('mouseleave', function() {
jQuery(this).fadeOut('400', function() {
jQuery(this).remove();
// Set up to work again
event.set_statustext(event._tooltip());
@ -295,10 +282,7 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
const im = this.getInstanceManager();
et2_selectbox.cat_options({
_type:'select-cat',
getInstanceManager: function ()
{
return im;
}
getInstanceManager: function() {return im;}
},
{application:event.app||'calendar'}
);
@ -337,13 +321,11 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
.attr("tabindex",0)
.attr("aria-label", tooltip)
// Remove any category classes
.removeClass(function (index, css)
{
.removeClass(function(index, css) {
return (css.match (/(^|\s)cat_\S+/g) || []).join(' ');
})
// Remove any status classes
.removeClass(function (index, css)
{
.removeClass(function(index, css) {
return (css.match(/calendar_calEvent\S+/g) || []).join(' ');
})
.removeClass('calendar_calEventSmall')
@ -541,8 +523,7 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
cat_label = this.options.value.category.indexOf(',') <= 0 ? cat.span.text() : [];
if(typeof cat_label != 'string')
{
cat.span.children().each(function ()
{
cat.span.children().each(function() {
(<string[]>cat_label).push(jQuery(this).text());
});
cat_label = cat_label.join(', ');
@ -550,25 +531,12 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
cat.destroy();
}
// Activate links in description
let description_node = document.createElement("p");
description_node.className = "calendar_calEvent_description";
et2_insertLinkText(
et2_activateLinks(egw.htmlspecialchars(this.options.value.description)), description_node, '_blank'
);
// Location + Videoconference
let location = '';
if(this.options.value.location || this.options.value['##videoconference'])
{
location = '<p>';
let location_node = document.createElement("span");
location_node.className = "calendar_calEventLabel";
et2_insertLinkText(et2_activateLinks(
this.egw().lang('Location') + ':' +
egw.htmlspecialchars(this.options.value.location)), location_node, '_blank');
location += location_node.outerHTML;
location += '<p><span class="calendar_calEventLabel">' + this.egw().lang('Location') + '</span>:' +
egw.htmlspecialchars(this.options.value.location);
if(this.options.value['##videoconference'])
{
// Click handler is set in _bind_videoconference()
@ -605,8 +573,8 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
this.icons[0].outerHTML+
'</div>'+
'<div class="calendar_calEventBody">'+
'<h1 class="calendar_calEventTitle">' + egw.htmlspecialchars(this.options.value.title) + '</h1><br>' +
description_node.outerHTML +
'<h1 class="calendar_calEventTitle">'+egw.htmlspecialchars(this.options.value.title)+'</h1><br><p>'+
egw.htmlspecialchars(this.options.value.description)+'</p>'+
'<p style="margin: 2px 0px;">'+times+'</p>'+
location +
(cat_label ? '<p><h2 class="calendar_calEventLabel">'+this.egw().lang('Category') + ':</h2>' + cat_label +'</p>' : '')+
@ -743,13 +711,11 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
{
let vc_event = 'click.calendar_videoconference';
jQuery('body').off(vc_event)
.on(vc_event, '[data-videoconference]', function (event)
{
.on(vc_event, '[data-videoconference]',function(event) {
let data = egw.dataGetUIDdata("calendar::"+this.dataset.id);
app.calendar.joinVideoConference(this.dataset.videoconference, data.data||this.dataset);
});
}
/**
* Get a text representation of the timespan of the event. Either start
* - end, or 'all day'
@ -1140,13 +1106,10 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
{
action_parent = action_parent.getParent();
}
try
{
try {
this._link_actions(action_parent.options.actions||{});
this._need_actions_linked = false;
}
catch (e)
{
} catch (e) {
// something went wrong, but keep quiet about it
}
}
@ -1167,8 +1130,7 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
this._actionObject = objectManager.getObjectById('calendar::'+this.options.value.row_id);
}
if (this._actionObject == null)
{
if (this._actionObject == null) {
// Add a new container to the object manager which will hold the widget
// objects
this._actionObject = objectManager.insertObject(false, new egwActionObject(
@ -1284,18 +1246,14 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
{
// Add in groups, if we can get them from options, great
var resource;
if (options && options.find && (resource = options.find(function (element)
{
return element.id === id;
})) && resource.resources)
if(options && options.find && (resource = options.find(function(element) {return element.id === id;})) && resource.resources)
{
participants = participants.concat(resource.resources);
}
else
{
// Add in groups, if we can get them (this is asynchronous)
egw.accountData(id, 'account_id', true, function (members)
{
egw.accountData(id,'account_id',true,function(members) {
participants = participants.concat(Object.keys(members));
}, this);
}
@ -1360,8 +1318,7 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
{
egw = this.egw ? (typeof this.egw == 'function' ? this.egw() : this.egw) : window.opener && typeof window.opener.egw != 'undefined' ? window.opener.egw('calendar'):window.egw('calendar');
}
catch (e)
{
catch(e){
egw = window.egw('calendar');
}
@ -1397,10 +1354,7 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
{text: egw.lang("Cancel"), id: "cancel"}
];
et2_dialog.show_dialog(
function (button_id)
{
callback.call(that, button_id, event_data);
},
function(button_id) {callback.call(that, button_id, event_data);},
(!event_data.is_private ? event_data['title'] : egw.lang('private')) + "\n" +
egw.lang("Do you want to edit this event as an exception or the whole series?"),
egw.lang("This event is part of a series"), {}, buttons, et2_dialog.QUESTION_MESSAGE
@ -1434,12 +1388,10 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
let egw;
// seems window.opener somehow in certian conditions could be from different origin
// we try to catch the exception and in this case retrieve the egw object from current window.
try
{
try {
egw = this.egw ? (typeof this.egw == 'function' ? this.egw() : this.egw) : window.opener && typeof window.opener.egw != 'undefined' ? window.opener.egw('calendar'):window.egw('calendar');
}
catch (e)
{
catch(e){
egw = window.egw('calendar');
}
@ -1458,10 +1410,7 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
if(parseInt(event_data.recur_type))
{
et2_dialog.show_dialog(
function (button_id)
{
callback.call(that, button_id, event_data);
},
function(button_id) {callback.call(that, button_id, event_data);},
(!event_data.is_private ? event_data['title'] : egw.lang('private')) + "\n" +
egw.lang("Do you really want to change the start of this series? If you do, the original series will be terminated as of %1 and a new series for the future reflecting your changes will be created.", termination_date),
egw.lang("This event is part of a series"), {}, et2_dialog.BUTTONS_OK_CANCEL , et2_dialog.WARNING_MESSAGE
@ -1522,12 +1471,10 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
// _outerCall may be used to determine, whether the state change has been
// evoked from the outside and the stateChangeCallback has to be called
// or not.
aoi.doSetState = function (_state, _outerCall)
{
aoi.doSetState = function(_state, _outerCall) {
};
return aoi;
}
}
et2_register_widget(et2_calendar_event, ["calendar-event"]);