Merge pull request #4655 from Icinga/fix/duplicate-ids-in-html-3762
Fix duplicate ids in html
This commit is contained in:
commit
49ced694e7
|
@ -1085,7 +1085,7 @@ class Form extends Zend_Form
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
if ($this->getElement($this->tokenElementName) === null) {
|
if ($this->getElement($this->tokenElementName) === null) {
|
||||||
$this->addElement(new CsrfCounterMeasure($this->tokenElementName));
|
$this->addElement('CsrfCounterMeasure', $this->tokenElementName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
|
|
|
@ -40,7 +40,7 @@ class CsrfCounterMeasure extends FormElement
|
||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$this->addDecorator('ViewHelper');
|
$this->setDecorators(['ViewHelper']);
|
||||||
$this->setValue($this->generateCsrfToken());
|
$this->setValue($this->generateCsrfToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<li>
|
<li>
|
||||||
<?php
|
<?php
|
||||||
$removeAckForm = clone $removeAckForm;
|
$removeAckForm = clone $removeAckForm;
|
||||||
|
$removeAckForm->setName('quickAction_' . $removeAckForm->getName()); // Avoids id duplication
|
||||||
$removeAckForm->setLabelEnabled(true);
|
$removeAckForm->setLabelEnabled(true);
|
||||||
echo $removeAckForm;
|
echo $removeAckForm;
|
||||||
?>
|
?>
|
||||||
|
@ -42,6 +43,7 @@
|
||||||
</li>
|
</li>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php if (isset($checkNowForm)): // Form is unset if the current user lacks the respective permission ?>
|
<?php if (isset($checkNowForm)): // Form is unset if the current user lacks the respective permission ?>
|
||||||
|
<?php ($checkNowForm = clone $checkNowForm)->setName('quickAction_' . $checkNowForm->getName()); // Avoids id duplication ?>
|
||||||
<li><?= $checkNowForm ?></li>
|
<li><?= $checkNowForm ?></li>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php if ($this->hasPermission('monitoring/command/comment/add')): ?>
|
<?php if ($this->hasPermission('monitoring/command/comment/add')): ?>
|
||||||
|
|
|
@ -373,8 +373,8 @@
|
||||||
while (true) {
|
while (true) {
|
||||||
var id = element.id;
|
var id = element.id;
|
||||||
|
|
||||||
// Ignore forms and form controls because id generation is unreliable :(
|
// Only use ids if they're truly unique
|
||||||
if (id && ! element.form && ! (element instanceof HTMLFormElement)) {
|
if (!! id && document.querySelectorAll('* #' + id).length === 1) {
|
||||||
path.push('#' + id);
|
path.push('#' + id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue