diff --git a/modoboa/static/js/jquery.htmltable.js b/modoboa/static/js/jquery.htmltable.js index 71c866412..25737c089 100644 --- a/modoboa/static/js/jquery.htmltable.js +++ b/modoboa/static/js/jquery.htmltable.js @@ -54,28 +54,28 @@ } }, - /** - * Set the row's state, cancel the change if the current state - * and the new state are identical - */ - _set_select: function($row, selected) { - var $input = $row.find(this.options.input_selector); + /** + * Set the row's state, cancel the change if the current state + * and the new state are identical + */ + _set_select: function($row, selected) { + var $input = $row.find(this.options.input_selector); - if (this.is_selected($row) == selected) - return; - $input.prop('checked', selected); - if (selected) { - $row.addClass(this.options.row_selected_class); + if (this.is_selected($row) == selected) + return; + $input.prop('checked', selected); + if (selected) { + $row.addClass(this.options.row_selected_class); if (this.options.row_unselected_event !== undefined) { this.options.row_unselected_event($row); - } - } else { - $row.removeClass(this.options.row_selected_class); + } + } else { + $row.removeClass(this.options.row_selected_class); if (this.options.row_selected_event !== undefined) { this.options.row_selected_event($row); } - } - }, + } + }, /** * Change the selection state of a given row. @@ -90,29 +90,42 @@ var $row = $(e.target).parents(this.options.row_selector); if (this.shift_pressed && this.last_selection) { - var select = !this.is_selected($row); - var itfunc = ($row.index() >= this.last_selection.index()) ? + var select = !this.is_selected($row); + var itfunc = ($row.index() >= this.last_selection.index()) ? "next" : "prev"; - var $cur_row; - + var $cur_row; + for ($cur_row = this.last_selection; - $cur_row.length; - $cur_row = $cur_row[itfunc](this.options.row_selector)) { + $cur_row.length; + $cur_row = $cur_row[itfunc](this.options.row_selector)) { this._set_select($cur_row, select); if ($row.attr("id") == $cur_row.attr("id")) { break; } } - this.last_selection = $row; + this.last_selection = $row; return; } else if (!this.options.keep_selection && !this.ctrl_pressed && - (!this.last_selection || !this.last_selection.is($row))) { + (!this.last_selection || !this.last_selection.is($row))) { this.clear_selection(); } this.last_selection = $row; this._toggle_select($row); }, + /** + * Change the selection state of all rows. + */ + toggleSelectAll: function(value) { + if (!value) { + this.clear_selection(); + } else { + $(this.options.row_selector).each((index, row) => { + this._set_select($(row), true); + }); + } + }, + /** * Check if $row is selected or not. */ diff --git a/mysql-requirements.txt b/mysql-requirements.txt index ca302042c..4843142bf 100644 --- a/mysql-requirements.txt +++ b/mysql-requirements.txt @@ -1 +1 @@ -mysqlclient<2.2.1 +mysqlclient<2.2.2 diff --git a/requirements.txt b/requirements.txt index 9dd1c3eeb..fcfc4518b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,7 +19,7 @@ bcrypt # Requires libffi-dev and python-dev asgiref dnspython==2.4.2 -feedparser==6.0.10 +feedparser==6.0.11 gevent==23.9.1 jsonfield==3.1.0 Pillow # Optional dependency for django-ckeditor