diff --git a/web/zm_actions.php b/web/zm_actions.php index 49509b7e1..4d8affe26 100644 --- a/web/zm_actions.php +++ b/web/zm_actions.php @@ -1257,9 +1257,9 @@ if ( isset($action) ) { if ( $action == "group" ) { - if ( count($mark_gids) ) + if ( !empty($gid) ) { - setcookie( "cgroup", $mark_gids[0], time()+3600*24*30*12*10 ); + setcookie( "cgroup", $gid, time()+3600*24*30*12*10 ); } else { @@ -1526,17 +1526,14 @@ if ( isset($action) ) userLogout(); } } - if ( $mark_gids ) + if ( !empty($gid) ) { - foreach( $mark_gids as $mark_gid ) + simpleQuery( "delete from Groups where Id = '$gid'" ); + if ( $gid == $cgroup ) { - simpleQuery( "delete from Groups where Id = '$mark_gid'" ); - if ( $mark_gid == $cgroup ) - { - unset( $cgroup ); - setcookie( "cgroup", "", time()-3600*24*2 ); - $refresh_parent = true; - } + unset( $cgroup ); + setcookie( "cgroup", "", time()-3600*24*2 ); + $refresh_parent = true; } } } diff --git a/web/zm_html_view_groups.php b/web/zm_html_view_groups.php index 2e371127f..1cf8eee94 100644 --- a/web/zm_html_view_groups.php +++ b/web/zm_html_view_groups.php @@ -28,8 +28,14 @@ $result = mysql_query( "select * from Groups order by Id" ); if ( !$result ) die( mysql_error() ); $groups = array(); +$selected = false; while ( $row = mysql_fetch_assoc( $result ) ) { + if ( $row['Id'] == $cgroup ) + { + $row['selected'] = true; + $selected = true; + } $groups[] = $row; } ?> @@ -47,40 +53,29 @@ function validateForm( form ) { return( true ); } -function configureButtons(form,name) +function configureButtons(element) { - var count = 0; - for (var i = 0; i < form.elements.length; i++) + var form = element.form; + if ( element.checked ) { - if ( form.elements[i].name.indexOf(name) == 0) - { - if ( form.elements[i].checked ) - { - count++; - } - } + form.delete_btn.disabled = (element.value == 0); } - form.select_btn.disabled = (count != 1); - form.new_btn.disabled = (count > 0); - form.delete_btn.disabled = (count < 1); } function monitorIds() { - with ( opener.document.monitor_form ) + var form = opener.document.monitor_form; + var monitor_ids = new Array(); + for ( var i = 0; i < form.elements.length; i++ ) { - var monitor_ids = new Array(); - for (var i = 0; i < elements.length; i++) + if ( form.elements[i].name.indexOf('mark_mids') == 0) { - if ( elements[i].name.indexOf('mark_mids') == 0) + if ( form.elements[i].checked ) { - if ( elements[i].checked ) - { - monitor_ids[monitor_ids.length] = elements[i].value; - } + monitor_ids[monitor_ids.length] = form.elements[i].value; } } - return( monitor_ids.join( ',' ) ); } + return( monitor_ids.join( ',' ) ); } window.focus(); @@ -89,8 +84,13 @@ window.focus();