Merge branch 'small_groups_fixes' into storageareas
commit
2b8fa653ed
|
@ -120,12 +120,13 @@ class Group {
|
|||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} # end function find_one
|
||||
|
||||
public function delete() {
|
||||
if ( array_key_exists('Id', $this) ) {
|
||||
dbQuery( 'DELETE FROM Groups_Monitors WHERE GroupId=?', array($this->{'Id'}) );
|
||||
dbQuery( 'DELETE FROM Groups WHERE Id=?', 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'}));
|
||||
if ( isset($_COOKIE['zmGroup']) ) {
|
||||
if ( $this->{'Id'} == $_COOKIE['zmGroup'] ) {
|
||||
unset($_COOKIE['zmGroup']);
|
||||
|
@ -150,16 +151,17 @@ class Group {
|
|||
$this->{$k} = $v;
|
||||
}
|
||||
}
|
||||
}
|
||||
} # end function set
|
||||
|
||||
public function depth( $new = null ) {
|
||||
if ( isset($new) ) {
|
||||
$this->{'depth'} = $new;
|
||||
}
|
||||
if ( ! array_key_exists('depth', $this) or ($this->{'depth'} == null) ) {
|
||||
$this->{'depth'} = 1;
|
||||
if ( !array_key_exists('depth', $this) or ($this->{'depth'} === null) ) {
|
||||
$this->{'depth'} = 0;
|
||||
if ( $this->{'ParentId'} != null ) {
|
||||
$Parent = Group::find_one(array('Id'=>$this->{'ParentId'}));
|
||||
$this->{'depth'} += $Parent->depth();
|
||||
$this->{'depth'} += $Parent->depth()+1;
|
||||
}
|
||||
}
|
||||
return $this->{'depth'};
|
||||
|
@ -210,7 +212,7 @@ class Group {
|
|||
$children[$Group->ParentId()] = array();
|
||||
$children[$Group->ParentId()][] = $Group;
|
||||
}
|
||||
}
|
||||
} # end foreach
|
||||
|
||||
function get_options($Group) {
|
||||
global $children;
|
||||
|
@ -221,7 +223,8 @@ class Group {
|
|||
}
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
} # end function get_options
|
||||
|
||||
$group_options = array();
|
||||
foreach ( $Groups as $id=>$Group ) {
|
||||
if ( ! $Group->ParentId() ) {
|
||||
|
@ -229,7 +232,7 @@ class Group {
|
|||
}
|
||||
}
|
||||
return $group_options;
|
||||
}
|
||||
} # end function get_dropdown_options
|
||||
|
||||
public static function get_group_sql($group_id) {
|
||||
$groupSql = '';
|
||||
|
|
|
@ -642,16 +642,11 @@ if ( canEdit('Groups') ) {
|
|||
$refreshParent = true;
|
||||
} else if ( $action == 'delete' ) {
|
||||
if ( !empty($_REQUEST['gid']) ) {
|
||||
if ( is_array($_REQUEST['gid']) ) {
|
||||
foreach ( $_REQUEST['gid'] as $gid ) {
|
||||
$Group = new Group($gid);
|
||||
$Group->delete();
|
||||
}
|
||||
} else {
|
||||
$Group = new Group($_REQUEST['gid'] );
|
||||
foreach ( Group::find(array('Id'=>$_REQUEST['gid'])) as $Group ) {
|
||||
$Group->delete();
|
||||
}
|
||||
}
|
||||
$redirect = ZM_BASE_URL.$_SERVER['PHP_SELF'].'?view=groups';
|
||||
$refreshParent = true;
|
||||
} # end if action
|
||||
} // end if can edit groups
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
Chosen, a Select Box Enhancer for jQuery and Prototype
|
||||
by Patrick Filler for Harvest, http://getharvest.com
|
||||
|
||||
Version 1.8.2
|
||||
Version 1.8.7
|
||||
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
|
||||
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);
|
||||
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
|
||||
clip: rect(0, 0, 0, 0);
|
||||
-webkit-clip-path: inset(100% 100%);
|
||||
clip-path: inset(100% 100%);
|
||||
}
|
||||
|
||||
.chosen-container.chosen-with-drop .chosen-drop {
|
||||
clip: auto;
|
||||
-webkit-clip-path: none;
|
||||
clip-path: none;
|
||||
}
|
||||
|
||||
.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 {
|
||||
position: absolute;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
-webkit-clip-path: inset(100% 100%);
|
||||
clip-path: inset(100% 100%);
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
Chosen, a Select Box Enhancer for jQuery and Prototype
|
||||
by Patrick Filler for Harvest, http://getharvest.com
|
||||
|
||||
Version 1.8.2
|
||||
Version 1.8.7
|
||||
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
|
||||
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) {
|
||||
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 {
|
||||
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.className = classes.join(" ");
|
||||
option_el.style.cssText = option.style;
|
||||
if (option.style) {
|
||||
option_el.style.cssText = option.style;
|
||||
}
|
||||
option_el.setAttribute("data-option-array-index", option.array_index);
|
||||
option_el.innerHTML = option.highlighted_html || option.html;
|
||||
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;
|
||||
this.no_results_clear();
|
||||
results = 0;
|
||||
|
@ -397,7 +399,9 @@ This file is generated by `grunt build`, do not edit it by hand.
|
|||
return this.no_results(query);
|
||||
} else {
|
||||
this.update_results_content(this.results_option_build());
|
||||
return this.winnow_results_set_highlight();
|
||||
if (!(options != null ? options.skip_highlight : void 0)) {
|
||||
return this.winnow_results_set_highlight();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -540,7 +544,7 @@ This file is generated by `grunt build`, do not edit it by hand.
|
|||
if (this.options.width != null) {
|
||||
return this.options.width;
|
||||
} 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);
|
||||
if (this.is_multiple) {
|
||||
this.search_choices.find("li.search-choice").remove();
|
||||
} else if (!this.is_multiple) {
|
||||
} else {
|
||||
this.single_set_selected_text();
|
||||
if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
|
||||
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;
|
||||
this.form_field.options[item.options_index].selected = true;
|
||||
this.selected_option_count = null;
|
||||
this.search_field.val("");
|
||||
if (this.is_multiple) {
|
||||
this.choice_build(item);
|
||||
} else {
|
||||
this.single_set_selected_text(this.choice_label(item));
|
||||
}
|
||||
if (this.is_multiple && (!this.hide_results_on_select || (evt.metaKey || evt.ctrlKey))) {
|
||||
this.winnow_results();
|
||||
if (evt.metaKey || evt.ctrlKey) {
|
||||
this.winnow_results({
|
||||
skip_highlight: true
|
||||
});
|
||||
} else {
|
||||
this.search_field.val("");
|
||||
this.winnow_results();
|
||||
}
|
||||
} else {
|
||||
this.results_hide();
|
||||
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
|
@ -28,7 +28,7 @@ $group_id = 0;
|
|||
$max_depth = 0;
|
||||
|
||||
$Groups = array();
|
||||
foreach ( Group::find( ) as $Group ) {
|
||||
foreach ( Group::find() as $Group ) {
|
||||
$Groups[$Group->Id()] = $Group;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ xhtmlHeaders(__FILE__, translate('Groups'));
|
|||
<table id="contentTable" class="major">
|
||||
<thead class="thead-highlight">
|
||||
<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="colSelect"><?php echo translate('Mark') ?></th>
|
||||
</tr>
|
||||
|
|
Loading…
Reference in New Issue