Merge branch 'small_groups_fixes' into storageareas
commit
2b8fa653ed
|
@ -120,11 +120,12 @@ class Group {
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
} # end function find_one
|
||||||
|
|
||||||
public function delete() {
|
public function delete() {
|
||||||
if ( array_key_exists('Id', $this) ) {
|
if ( array_key_exists('Id', $this) ) {
|
||||||
dbQuery('DELETE FROM Groups_Monitors WHERE GroupId=?', array($this->{'Id'}));
|
dbQuery('DELETE FROM Groups_Monitors WHERE GroupId=?', array($this->{'Id'}));
|
||||||
|
dbQuery('UPDATE Groups SET ParentId=NULL WHERE ParentId=?', array($this->{'Id'}));
|
||||||
dbQuery('DELETE FROM Groups WHERE Id=?', array($this->{'Id'}));
|
dbQuery('DELETE FROM Groups WHERE Id=?', array($this->{'Id'}));
|
||||||
if ( isset($_COOKIE['zmGroup']) ) {
|
if ( isset($_COOKIE['zmGroup']) ) {
|
||||||
if ( $this->{'Id'} == $_COOKIE['zmGroup'] ) {
|
if ( $this->{'Id'} == $_COOKIE['zmGroup'] ) {
|
||||||
|
@ -150,16 +151,17 @@ class Group {
|
||||||
$this->{$k} = $v;
|
$this->{$k} = $v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} # end function set
|
||||||
|
|
||||||
public function depth( $new = null ) {
|
public function depth( $new = null ) {
|
||||||
if ( isset($new) ) {
|
if ( isset($new) ) {
|
||||||
$this->{'depth'} = $new;
|
$this->{'depth'} = $new;
|
||||||
}
|
}
|
||||||
if ( ! array_key_exists('depth', $this) or ($this->{'depth'} == null) ) {
|
if ( !array_key_exists('depth', $this) or ($this->{'depth'} === null) ) {
|
||||||
$this->{'depth'} = 1;
|
$this->{'depth'} = 0;
|
||||||
if ( $this->{'ParentId'} != null ) {
|
if ( $this->{'ParentId'} != null ) {
|
||||||
$Parent = Group::find_one(array('Id'=>$this->{'ParentId'}));
|
$Parent = Group::find_one(array('Id'=>$this->{'ParentId'}));
|
||||||
$this->{'depth'} += $Parent->depth();
|
$this->{'depth'} += $Parent->depth()+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->{'depth'};
|
return $this->{'depth'};
|
||||||
|
@ -210,7 +212,7 @@ class Group {
|
||||||
$children[$Group->ParentId()] = array();
|
$children[$Group->ParentId()] = array();
|
||||||
$children[$Group->ParentId()][] = $Group;
|
$children[$Group->ParentId()][] = $Group;
|
||||||
}
|
}
|
||||||
}
|
} # end foreach
|
||||||
|
|
||||||
function get_options($Group) {
|
function get_options($Group) {
|
||||||
global $children;
|
global $children;
|
||||||
|
@ -221,7 +223,8 @@ class Group {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $options;
|
return $options;
|
||||||
}
|
} # end function get_options
|
||||||
|
|
||||||
$group_options = array();
|
$group_options = array();
|
||||||
foreach ( $Groups as $id=>$Group ) {
|
foreach ( $Groups as $id=>$Group ) {
|
||||||
if ( ! $Group->ParentId() ) {
|
if ( ! $Group->ParentId() ) {
|
||||||
|
@ -229,7 +232,7 @@ class Group {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $group_options;
|
return $group_options;
|
||||||
}
|
} # end function get_dropdown_options
|
||||||
|
|
||||||
public static function get_group_sql($group_id) {
|
public static function get_group_sql($group_id) {
|
||||||
$groupSql = '';
|
$groupSql = '';
|
||||||
|
|
|
@ -642,16 +642,11 @@ if ( canEdit('Groups') ) {
|
||||||
$refreshParent = true;
|
$refreshParent = true;
|
||||||
} else if ( $action == 'delete' ) {
|
} else if ( $action == 'delete' ) {
|
||||||
if ( !empty($_REQUEST['gid']) ) {
|
if ( !empty($_REQUEST['gid']) ) {
|
||||||
if ( is_array($_REQUEST['gid']) ) {
|
foreach ( Group::find(array('Id'=>$_REQUEST['gid'])) as $Group ) {
|
||||||
foreach ( $_REQUEST['gid'] as $gid ) {
|
|
||||||
$Group = new Group($gid);
|
|
||||||
$Group->delete();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$Group = new Group($_REQUEST['gid'] );
|
|
||||||
$Group->delete();
|
$Group->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$redirect = ZM_BASE_URL.$_SERVER['PHP_SELF'].'?view=groups';
|
||||||
$refreshParent = true;
|
$refreshParent = true;
|
||||||
} # end if action
|
} # end if action
|
||||||
} // end if can edit groups
|
} // end if can edit groups
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
Chosen, a Select Box Enhancer for jQuery and Prototype
|
Chosen, a Select Box Enhancer for jQuery and Prototype
|
||||||
by Patrick Filler for Harvest, http://getharvest.com
|
by Patrick Filler for Harvest, http://getharvest.com
|
||||||
|
|
||||||
Version 1.8.2
|
Version 1.8.7
|
||||||
Full source at https://github.com/harvesthq/chosen
|
Full source at https://github.com/harvesthq/chosen
|
||||||
Copyright (c) 2011-2017 Harvest http://getharvest.com
|
Copyright (c) 2011-2018 Harvest http://getharvest.com
|
||||||
|
|
||||||
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
||||||
This file is generated by `grunt build`, do not edit it by hand.
|
This file is generated by `grunt build`, do not edit it by hand.
|
||||||
|
@ -38,10 +38,14 @@ This file is generated by `grunt build`, do not edit it by hand.
|
||||||
-webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
|
-webkit-box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
|
||||||
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
|
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
|
||||||
clip: rect(0, 0, 0, 0);
|
clip: rect(0, 0, 0, 0);
|
||||||
|
-webkit-clip-path: inset(100% 100%);
|
||||||
|
clip-path: inset(100% 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chosen-container.chosen-with-drop .chosen-drop {
|
.chosen-container.chosen-with-drop .chosen-drop {
|
||||||
clip: auto;
|
clip: auto;
|
||||||
|
-webkit-clip-path: none;
|
||||||
|
clip-path: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chosen-container a {
|
.chosen-container a {
|
||||||
|
@ -167,6 +171,8 @@ This file is generated by `grunt build`, do not edit it by hand.
|
||||||
.chosen-container-single.chosen-container-single-nosearch .chosen-search {
|
.chosen-container-single.chosen-container-single-nosearch .chosen-search {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
clip: rect(0, 0, 0, 0);
|
clip: rect(0, 0, 0, 0);
|
||||||
|
-webkit-clip-path: inset(100% 100%);
|
||||||
|
clip-path: inset(100% 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @end */
|
/* @end */
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
Chosen, a Select Box Enhancer for jQuery and Prototype
|
Chosen, a Select Box Enhancer for jQuery and Prototype
|
||||||
by Patrick Filler for Harvest, http://getharvest.com
|
by Patrick Filler for Harvest, http://getharvest.com
|
||||||
|
|
||||||
Version 1.8.2
|
Version 1.8.7
|
||||||
Full source at https://github.com/harvesthq/chosen
|
Full source at https://github.com/harvesthq/chosen
|
||||||
Copyright (c) 2011-2017 Harvest http://getharvest.com
|
Copyright (c) 2011-2018 Harvest http://getharvest.com
|
||||||
|
|
||||||
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
||||||
This file is generated by `grunt build`, do not edit it by hand.
|
This file is generated by `grunt build`, do not edit it by hand.
|
||||||
|
@ -161,7 +161,7 @@ This file is generated by `grunt build`, do not edit it by hand.
|
||||||
|
|
||||||
AbstractChosen.prototype.choice_label = function(item) {
|
AbstractChosen.prototype.choice_label = function(item) {
|
||||||
if (this.include_group_label_in_selected && (item.group_label != null)) {
|
if (this.include_group_label_in_selected && (item.group_label != null)) {
|
||||||
return "<b class='group-name'>" + item.group_label + "</b>" + item.html;
|
return "<b class='group-name'>" + (this.escape_html(item.group_label)) + "</b>" + item.html;
|
||||||
} else {
|
} else {
|
||||||
return item.html;
|
return item.html;
|
||||||
}
|
}
|
||||||
|
@ -267,7 +267,9 @@ This file is generated by `grunt build`, do not edit it by hand.
|
||||||
}
|
}
|
||||||
option_el = document.createElement("li");
|
option_el = document.createElement("li");
|
||||||
option_el.className = classes.join(" ");
|
option_el.className = classes.join(" ");
|
||||||
|
if (option.style) {
|
||||||
option_el.style.cssText = option.style;
|
option_el.style.cssText = option.style;
|
||||||
|
}
|
||||||
option_el.setAttribute("data-option-array-index", option.array_index);
|
option_el.setAttribute("data-option-array-index", option.array_index);
|
||||||
option_el.innerHTML = option.highlighted_html || option.html;
|
option_el.innerHTML = option.highlighted_html || option.html;
|
||||||
if (option.title) {
|
if (option.title) {
|
||||||
|
@ -341,7 +343,7 @@ This file is generated by `grunt build`, do not edit it by hand.
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AbstractChosen.prototype.winnow_results = function() {
|
AbstractChosen.prototype.winnow_results = function(options) {
|
||||||
var escapedQuery, fix, i, len, option, prefix, query, ref, regex, results, results_group, search_match, startpos, suffix, text;
|
var escapedQuery, fix, i, len, option, prefix, query, ref, regex, results, results_group, search_match, startpos, suffix, text;
|
||||||
this.no_results_clear();
|
this.no_results_clear();
|
||||||
results = 0;
|
results = 0;
|
||||||
|
@ -397,8 +399,10 @@ This file is generated by `grunt build`, do not edit it by hand.
|
||||||
return this.no_results(query);
|
return this.no_results(query);
|
||||||
} else {
|
} else {
|
||||||
this.update_results_content(this.results_option_build());
|
this.update_results_content(this.results_option_build());
|
||||||
|
if (!(options != null ? options.skip_highlight : void 0)) {
|
||||||
return this.winnow_results_set_highlight();
|
return this.winnow_results_set_highlight();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
|
AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
|
||||||
|
@ -540,7 +544,7 @@ This file is generated by `grunt build`, do not edit it by hand.
|
||||||
if (this.options.width != null) {
|
if (this.options.width != null) {
|
||||||
return this.options.width;
|
return this.options.width;
|
||||||
} else {
|
} else {
|
||||||
return this.form_field.offsetWidth + "px";
|
return this.form_field.offsetWidth+15 + "px";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -941,7 +945,7 @@ This file is generated by `grunt build`, do not edit it by hand.
|
||||||
this.results_data = SelectParser.select_to_array(this.form_field);
|
this.results_data = SelectParser.select_to_array(this.form_field);
|
||||||
if (this.is_multiple) {
|
if (this.is_multiple) {
|
||||||
this.search_choices.find("li.search-choice").remove();
|
this.search_choices.find("li.search-choice").remove();
|
||||||
} else if (!this.is_multiple) {
|
} else {
|
||||||
this.single_set_selected_text();
|
this.single_set_selected_text();
|
||||||
if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
|
if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
|
||||||
this.search_field[0].readOnly = true;
|
this.search_field[0].readOnly = true;
|
||||||
|
@ -1154,14 +1158,20 @@ This file is generated by `grunt build`, do not edit it by hand.
|
||||||
item.selected = true;
|
item.selected = true;
|
||||||
this.form_field.options[item.options_index].selected = true;
|
this.form_field.options[item.options_index].selected = true;
|
||||||
this.selected_option_count = null;
|
this.selected_option_count = null;
|
||||||
this.search_field.val("");
|
|
||||||
if (this.is_multiple) {
|
if (this.is_multiple) {
|
||||||
this.choice_build(item);
|
this.choice_build(item);
|
||||||
} else {
|
} else {
|
||||||
this.single_set_selected_text(this.choice_label(item));
|
this.single_set_selected_text(this.choice_label(item));
|
||||||
}
|
}
|
||||||
if (this.is_multiple && (!this.hide_results_on_select || (evt.metaKey || evt.ctrlKey))) {
|
if (this.is_multiple && (!this.hide_results_on_select || (evt.metaKey || evt.ctrlKey))) {
|
||||||
|
if (evt.metaKey || evt.ctrlKey) {
|
||||||
|
this.winnow_results({
|
||||||
|
skip_highlight: true
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.search_field.val("");
|
||||||
this.winnow_results();
|
this.winnow_results();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.results_hide();
|
this.results_hide();
|
||||||
this.show_search_field_default();
|
this.show_search_field_default();
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -53,7 +53,7 @@ xhtmlHeaders(__FILE__, translate('Groups'));
|
||||||
<table id="contentTable" class="major">
|
<table id="contentTable" class="major">
|
||||||
<thead class="thead-highlight">
|
<thead class="thead-highlight">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="colName" colspan="<?php echo $max_depth ?>"><?php echo translate('Name') ?></th>
|
<th class="colName" colspan="<?php echo $max_depth+1 ?>"><?php echo translate('Name') ?></th>
|
||||||
<th class="colIds"><?php echo translate('Monitors') ?></th>
|
<th class="colIds"><?php echo translate('Monitors') ?></th>
|
||||||
<th class="colSelect"><?php echo translate('Mark') ?></th>
|
<th class="colSelect"><?php echo translate('Mark') ?></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in New Issue