diff --git a/web/skins/classic/views/group.php b/web/skins/classic/views/group.php index aa8ec4b56..abf2e4636 100644 --- a/web/skins/classic/views/group.php +++ b/web/skins/classic/views/group.php @@ -37,14 +37,14 @@ xhtmlHeaders(__FILE__, translate('Group').' - '.$newGroup->Name());

- Name()); ?>

-
+ - + @@ -88,19 +88,19 @@ function get_children($Group) { $kids = get_children($newGroup); if ( $newGroup->Id() ) $kids[] = $newGroup->Id(); -$sql = 'SELECT Id,Name from Groups'.(count($kids)?' WHERE Id NOT IN ('.implode(',',array_map(function(){return '?';}, $kids)).')' : '').' ORDER BY Name'; +$sql = 'SELECT Id,Name FROM `Groups`'.(count($kids)?' WHERE Id NOT IN ('.implode(',',array_map(function(){return '?';}, $kids)).')' : '').' ORDER BY Name'; $options = array(''=>'None'); foreach ( dbFetchAll($sql, null, $kids) as $option ) { $options[$option['Id']] = str_repeat('  ', $Groups[$option['Id']]->depth()) . $option['Name']; } -echo htmlSelect('newGroup[ParentId]', $options, $newGroup->ParentId(), array('onchange'=>'configureButtons(this);')); +echo htmlSelect('newGroup[ParentId]', $options, $newGroup->ParentId(), array('data-on-change'=>'configureButtons')); ?>
- MonitorIds(); diff --git a/web/skins/classic/views/js/group.js b/web/skins/classic/views/js/group.js index 0f0bd064b..26aa9cae6 100644 --- a/web/skins/classic/views/js/group.js +++ b/web/skins/classic/views/js/group.js @@ -1,21 +1,20 @@ -function selectMonitors() { - createPopup( '?view=monitorselect&callForm=groupForm&callField=newGroup[MonitorIds]', 'zmMonitors', 'monitorselect' ); -} - -if ( refreshParent ) { - opener.location.reload(true); -} - -function configureButtons( element ) { - if ( canEditGroups ) { - var form = element.form; - var disabled = false; - - if ( form.elements['newGroup[Name]'].value == '' ) { - disabled = true; - } - form.saveBtn.disabled = disabled; +function configureButtons() { + var form = $j('#groupForm')[0]; + if ( !form ) { + console.log("No groupForm found"); + return; } + if ( !canEditGroups ) { + console.log("Cannot edit groups"); + form.elements['action'].disabled = disabled; + return; + } + var disabled = false; + + if ( form.elements['newGroup[Name]'].value == '' ) { + disabled = true; + } + form.elements['action'].disabled = disabled; } window.focus();