commit
9186c68b65
|
@ -21,6 +21,8 @@ class AutoRefreshForm extends Form
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$this->setName('form_auto_refresh');
|
$this->setName('form_auto_refresh');
|
||||||
|
// Post against the current location
|
||||||
|
$this->setAction('');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -535,7 +535,13 @@ class Form extends Zend_Form
|
||||||
->addCsrfCounterMeasure()
|
->addCsrfCounterMeasure()
|
||||||
->addSubmitButton();
|
->addSubmitButton();
|
||||||
|
|
||||||
if ($this->getAction() === '') {
|
if ($this->getAttrib('action') === null) {
|
||||||
|
// Use Form::getAttrib() instead of Form::getAction() here because we want to explicitly check against
|
||||||
|
// null. Form::getAction() would return the empty string '' if the action is not set.
|
||||||
|
// For not setting the action attribute use Form::setAction(''). This is required for for the
|
||||||
|
// accessibility's enable/disable auto-refresh mechanic
|
||||||
|
|
||||||
|
// TODO(el): Re-evalute this necessity. JavaScript could use the container's URL if there's no action set.
|
||||||
// We MUST set an action as JS gets confused otherwise, if
|
// We MUST set an action as JS gets confused otherwise, if
|
||||||
// this form is being displayed in an additional column
|
// this form is being displayed in an additional column
|
||||||
$this->setAction(Url::fromRequest()->without(array_keys($this->getElements())));
|
$this->setAction(Url::fromRequest()->without(array_keys($this->getElements())));
|
||||||
|
|
|
@ -239,10 +239,8 @@
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
icinga.logger.debug('Submitting form: ' + method + ' ' + url, method);
|
|
||||||
|
|
||||||
if ($button.length) {
|
if ($button.length) {
|
||||||
// activate spinner indicator
|
// Activate spinner
|
||||||
if ($button.hasClass('spinner')) {
|
if ($button.hasClass('spinner')) {
|
||||||
$button.addClass('active');
|
$button.addClass('active');
|
||||||
}
|
}
|
||||||
|
@ -252,6 +250,13 @@
|
||||||
$target = self.getLinkTargetFor($form);
|
$target = self.getLinkTargetFor($form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! url) {
|
||||||
|
// Use the URL of the target container if the form's action is not set
|
||||||
|
url = $target.closest('.container').data('icinga-url');
|
||||||
|
}
|
||||||
|
|
||||||
|
icinga.logger.debug('Submitting form: ' + method + ' ' + url, method);
|
||||||
|
|
||||||
if (method === 'GET') {
|
if (method === 'GET') {
|
||||||
var dataObj = $form.serializeObject();
|
var dataObj = $form.serializeObject();
|
||||||
|
|
||||||
|
@ -274,6 +279,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
icinga.loader.loadUrl(url, $target, data, method);
|
icinga.loader.loadUrl(url, $target, data, method);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -292,6 +292,12 @@
|
||||||
r.url = redirect;
|
r.url = redirect;
|
||||||
if (parts.length) {
|
if (parts.length) {
|
||||||
r.loadNext = parts;
|
r.loadNext = parts;
|
||||||
|
} else if (!! document.location.hash) {
|
||||||
|
// Retain detail URL if the layout is rerendered
|
||||||
|
parts = document.location.hash.split('#!').splice(1);
|
||||||
|
if (parts.length) {
|
||||||
|
r.loadNext = parts;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue