Add List button and make Edit go directly to the selected Control as well as being a button.
parent
2ed2b270f6
commit
95ad036f73
|
@ -815,5 +815,20 @@ function devices_onchange(devices) {
|
|||
device.style['display'] = 'inline';
|
||||
}
|
||||
}
|
||||
function ControlId_onChange(ddm) {
|
||||
const ControlEditButton = document.getElementById('ControlEditButton');
|
||||
if (ControlEditButton) ControlEditButton.disabled = ddm.value ? false : true;
|
||||
}
|
||||
|
||||
function ControlEdit_onClick() {
|
||||
const ControlId = document.getElementById('ControlId');
|
||||
if (ControlId) {
|
||||
window.location = '?view=controlcap&cid='+ControlId.value;
|
||||
}
|
||||
}
|
||||
|
||||
function ControlList_onClick() {
|
||||
window.location = '?view=options&tab=control';
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', initPage);
|
||||
|
|
|
@ -1444,9 +1444,12 @@ $codecs = array(
|
|||
$controlTypes[$control->Id()] = $control->Name();
|
||||
}
|
||||
|
||||
echo htmlSelect('newMonitor[ControlId]', $controlTypes, $monitor->ControlId());
|
||||
if ( canEdit('Control') ) {
|
||||
echo ' '.makeLink('?view=options&tab=control', translate('Edit'));
|
||||
echo htmlSelect('newMonitor[ControlId]', $controlTypes, $monitor->ControlId(), ['id'=>'ControlId', 'data-on-click-this'=>'ControlId_onChange']);
|
||||
if (canEdit('Control')) {
|
||||
if ($monitor->ControlId()) {
|
||||
echo ' <button type="button" data-on-click="ControlEdit_onClick" id="ControlEdit">'.translate('Edit').'</button>';
|
||||
}
|
||||
echo ' <button type="button" data-on-click="ControlList_onClick" id="ControlList">'.translate('List').'</button>';
|
||||
}
|
||||
?>
|
||||
</li>
|
||||
|
|
Loading…
Reference in New Issue