1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-20 13:21:54 +02:00

Implemented custom sorting for e_tree_model

In #3025, e_tree_model sorting was reimplemented in pure PHP, but this
broke custom sorting (like `?field=cat_name&asc=desc`).

This commit introduces a hack that simulates a subset of MySQL/MariaDB
ORDER BY clauses, which should be sufficient for all known custom
sorting that can be requested.

Tree formatting is always preserved, but custom sorting will apply for
all items at a certain depth under the same parent.

This commit also contains some minor formatting fixes and makes a minor
change to some regex to make use of non-capturing groups.

Fixes: #3029
This commit is contained in:
Deltik
2018-02-09 04:37:48 -06:00
parent e045c6c91c
commit 511bb9eae9
2 changed files with 80 additions and 15 deletions

4
e107_handlers/admin_ui.php Normal file → Executable file
View File

@@ -6188,7 +6188,7 @@ class e_admin_ui extends e_admin_controller_ui
$this->_tree_model = new e_admin_tree_model();
$this->_tree_model->setModelTable($this->table)
->setFieldIdName($this->pid)
->setUrl($this->url)
->setUrl($this->url)
->setMessageStackName('admin_ui_tree_'.$this->table)
->setParams(array('model_class' => 'e_admin_model',
'model_message_stack' => 'admin_ui_model_'.$this->table ,
@@ -6916,7 +6916,7 @@ class e_admin_form_ui extends e_form
// FIXME - use e_form::batchoptions(), nice way of buildig batch dropdown - news administration show_batch_options()
// FIXME - use e_form::batchoptions(), nice way of building batch dropdown - news administration show_batch_options()
/**
* @param array $options array of flags for copy, delete, url, featurebox, batch