Index: trunk/core/units/general/cat_event_handler.php =================================================================== diff -u -N -r8460 -r8472 --- trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 8460) +++ trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 8472) @@ -2083,72 +2083,11 @@ */ function SetSorting(&$event) { - if ($this->Application->IsAdmin()) { - parent::SetSorting($event); - return ; + if (!$this->Application->IsAdmin()) { + $event->setEventParam('same_special', true); } - $event->setPseudoClass('_List'); - $object =& $event->getObject(); - - $cur_sort1 = $this->Application->RecallVar($event->Prefix.'_Sort1'); - $cur_sort1_dir = $this->Application->RecallVar($event->Prefix.'_Sort1_Dir'); - $cur_sort2 = $this->Application->RecallVar($event->Prefix.'_Sort2'); - $cur_sort2_dir = $this->Application->RecallVar($event->Prefix.'_Sort2_Dir'); - - - $sorting_configs = $this->Application->getUnitOption($event->Prefix, 'ConfigMapping'); - $list_sortings = $this->Application->getUnitOption($event->Prefix, 'ListSortings'); - $sorting_prefix = getArrayValue($list_sortings, $event->Special) ? $event->Special : ''; - - $tag_sort_by = $event->getEventParam('sort_by'); - if ($tag_sort_by) { - if ($tag_sort_by == 'random') { - $by = 'RAND()'; - $dir = ''; - } - else { - list($by, $dir) = explode(',', $tag_sort_by); - } - $object->AddOrderField($by, $dir); - } - - if ($sorting_configs && isset ($sorting_configs['DefaultSorting1Field'])){ - $list_sortings[$sorting_prefix]['Sorting'] = Array( - $this->Application->ConfigValue($sorting_configs['DefaultSorting1Field']) => $this->Application->ConfigValue($sorting_configs['DefaultSorting1Dir']), - $this->Application->ConfigValue($sorting_configs['DefaultSorting2Field']) => $this->Application->ConfigValue($sorting_configs['DefaultSorting2Dir']), - ); - } - - // Use default if not specified - if ( !$cur_sort1 || !$cur_sort1_dir) - { - if ( $sorting = getArrayValue($list_sortings, $sorting_prefix, 'Sorting') ) { - reset($sorting); - $cur_sort1 = key($sorting); - $cur_sort1_dir = current($sorting); - if (next($sorting)) { - $cur_sort2 = key($sorting); - $cur_sort2_dir = current($sorting); - } - } - } - - if ( $forced_sorting = getArrayValue($list_sortings, $sorting_prefix, 'ForcedSorting') ) { - foreach ($forced_sorting as $field => $dir) { - $object->AddOrderField($field, $dir); - } - } - - if($cur_sort1 != '' && $cur_sort1_dir != '') - { - $object->AddOrderField($cur_sort1, $cur_sort1_dir); - } - - if($cur_sort2 != '' && $cur_sort2_dir != '') - { - $object->AddOrderField($cur_sort2, $cur_sort2_dir); - } + parent::SetSorting($event); } /** @@ -2159,16 +2098,11 @@ */ function getPerPage(&$event) { - if ($this->Application->IsAdmin()) { - return parent::getPerPage($event); + if (!$this->Application->IsAdmin()) { + $event->setEventParam('same_special', true); } - $special = $event->Special; - $event->Init($event->Prefix); - $per_page = parent::getPerPage($event); - $event->Init($event->Prefix, $special); - - return $per_page; + return parent::getPerPage($event); } }