parent
3e06a9c8aa
commit
d03647f2e6
|
@ -28,7 +28,7 @@ class JavaScript
|
||||||
'js/icinga/behavior/navigation.js',
|
'js/icinga/behavior/navigation.js',
|
||||||
'js/icinga/behavior/form.js',
|
'js/icinga/behavior/form.js',
|
||||||
'js/icinga/behavior/actiontable.js',
|
'js/icinga/behavior/actiontable.js',
|
||||||
'js/icinga/behavior/dblclickselect.js'
|
'js/icinga/behavior/selectable.js'
|
||||||
);
|
);
|
||||||
|
|
||||||
protected static $vendorFiles = array(
|
protected static $vendorFiles = array(
|
||||||
|
|
|
@ -10,17 +10,17 @@ use Icinga\Module\Monitoring\Object\Host;
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?= $this->iconImage()->host($object) ?>
|
<?= $this->iconImage()->host($object) ?>
|
||||||
<strong class="dblclickselect"><?= $this->escape($object->host_display_name); ?></strong>
|
<strong class="selectable"><?= $this->escape($object->host_display_name); ?></strong>
|
||||||
<?php if ($object->host_display_name !== $object->host_name): ?>
|
<?php if ($object->host_display_name !== $object->host_name): ?>
|
||||||
<small class="dblclickselect">(<?= $this->escape($object->host_name); ?>)</small>
|
<small class="selectable">(<?= $this->escape($object->host_name); ?>)</small>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?= $this->render('partials/host/statusicons.phtml'); ?>
|
<?= $this->render('partials/host/statusicons.phtml'); ?>
|
||||||
<br/>
|
<br/>
|
||||||
<?php if ($object->host_address6 && $object->host_address6 !== $object->host_name): ?>
|
<?php if ($object->host_address6 && $object->host_address6 !== $object->host_name): ?>
|
||||||
<span class="address padded dblclickselect" title="IPv6 address"><?= $this->escape($object->host_address6); ?></span>
|
<span class="selectable" title="IPv6 address"><?= $this->escape($object->host_address6); ?></span>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php if ($object->host_address && $object->host_address !== $object->host_name): ?>
|
<?php if ($object->host_address && $object->host_address !== $object->host_name): ?>
|
||||||
<span class="address padded dblclickselect" title="IPv4 address"><?= $this->escape($object->host_address); ?></span>
|
<span class="selectable" title="IPv4 address"><?= $this->escape($object->host_address); ?></span>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -11,16 +11,16 @@ use Icinga\Module\Monitoring\Object\Service;
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?= $this->iconImage()->service($object) ?>
|
<?= $this->iconImage()->service($object) ?>
|
||||||
<strong class="dblclickselect"><?= $this->escape($object->host_display_name); ?></strong>
|
<strong class="selectable"><?= $this->escape($object->host_display_name); ?></strong>
|
||||||
<?php if ($object->host_display_name !== $object->host_name): ?>
|
<?php if ($object->host_display_name !== $object->host_name): ?>
|
||||||
<small class="dblclickselect">(<?= $this->escape($object->host_name); ?>)</small>
|
<small class="selectable">(<?= $this->escape($object->host_name); ?>)</small>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<br/>
|
<br/>
|
||||||
<?php if ($object->host_address6 && $object->host_address6 !== $object->host_name): ?>
|
<?php if ($object->host_address6 && $object->host_address6 !== $object->host_name): ?>
|
||||||
<span class="address padded dblclickselect" title="IPv6 address"><?= $this->escape($object->host_address6); ?></span>
|
<span class="selectable" title="IPv6 address"><?= $this->escape($object->host_address6); ?></span>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php if ($object->host_address && $object->host_address !== $object->host_name): ?>
|
<?php if ($object->host_address && $object->host_address !== $object->host_name): ?>
|
||||||
<span class="address padded dblclickselect" title="IPv4 address"><?= $this->escape($object->host_address); ?></span>
|
<span class="selectable" title="IPv4 address"><?= $this->escape($object->host_address); ?></span>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -31,7 +31,7 @@ use Icinga\Module\Monitoring\Object\Service;
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?= $this->iconImage()->host($object) ?>
|
<?= $this->iconImage()->host($object) ?>
|
||||||
<strong><?= $this->translate('Service'); ?>: <span class="dblclickselect"><?= $this->escape($object->service_display_name); ?></span></strong>
|
<strong><?= $this->translate('Service'); ?>: <span class="selectable"><?= $this->escape($object->service_display_name); ?></span></strong>
|
||||||
<?php if ($object->service_display_name !== $object->service_description): ?>
|
<?php if ($object->service_display_name !== $object->service_description): ?>
|
||||||
<small>(<?= $this->escape($object->service_description); ?>)</small>
|
<small>(<?= $this->escape($object->service_description); ?>)</small>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
/*! Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
|
||||||
|
|
||||||
(function(Icinga, $) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
Icinga.Behaviors = Icinga.Behaviors || {};
|
|
||||||
|
|
||||||
var DblClickSelect = function (icinga) {
|
|
||||||
Icinga.EventListener.call(this, icinga);
|
|
||||||
this.on('rendered', this.onRendered, this);
|
|
||||||
};
|
|
||||||
DblClickSelect.prototype = new Icinga.EventListener();
|
|
||||||
|
|
||||||
DblClickSelect.prototype.onRendered = function(evt) {
|
|
||||||
$(evt.target).on('dblclick', '.dblclickselect', function() { $(this).selectText(); });
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* extend jQuery with a selectText function
|
|
||||||
*
|
|
||||||
* This function will create a browser selection of the choosen DOM object.
|
|
||||||
*/
|
|
||||||
$.fn.selectText = function() {
|
|
||||||
if (this.length === 0) return;
|
|
||||||
var e = this[0];
|
|
||||||
|
|
||||||
var b = document.body, r;
|
|
||||||
if (b.createTextRange) {
|
|
||||||
r = b.createTextRange();
|
|
||||||
r.moveToElementText(e);
|
|
||||||
r.select();
|
|
||||||
} else if (window.getSelection) {
|
|
||||||
var s = window.getSelection();
|
|
||||||
r = document.createRange();
|
|
||||||
r.selectNodeContents(e);
|
|
||||||
s.removeAllRanges();
|
|
||||||
s.addRange(r);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Export
|
|
||||||
Icinga.Behaviors.DblClickSelect = DblClickSelect;
|
|
||||||
|
|
||||||
}) (Icinga, jQuery);
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*! Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
|
||||||
|
|
||||||
|
;(function(Icinga, $) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
Icinga.Behaviors = Icinga.Behaviors || {};
|
||||||
|
|
||||||
|
var Selectable = function(icinga) {
|
||||||
|
Icinga.EventListener.call(this, icinga);
|
||||||
|
this.on('rendered', this.onRendered, this);
|
||||||
|
};
|
||||||
|
|
||||||
|
$.extend(Selectable.prototype, new Icinga.EventListener(), {
|
||||||
|
onRendered: function(e) {
|
||||||
|
$('.selectable', e.target).on('dblclick', e.data.self.selectText);
|
||||||
|
},
|
||||||
|
|
||||||
|
selectText: function(e) {
|
||||||
|
var b = document.body,
|
||||||
|
r;
|
||||||
|
if (b.createTextRange) {
|
||||||
|
r = b.createTextRange();
|
||||||
|
r.moveToElementText(e.target);
|
||||||
|
r.select();
|
||||||
|
} else if (window.getSelection) {
|
||||||
|
var s = window.getSelection();
|
||||||
|
r = document.createRange();
|
||||||
|
r.selectNodeContents(e.target);
|
||||||
|
s.removeAllRanges();
|
||||||
|
s.addRange(r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Icinga.Behaviors.Selectable = Selectable;
|
||||||
|
})(Icinga, jQuery);
|
Loading…
Reference in New Issue