Index: trunk/core/kernel/db/db_tag_processor.php =================================================================== diff -u -N -r8402 -r8460 --- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 8402) +++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 8460) @@ -291,27 +291,6 @@ return 'events['.$prefix_special.']['.$params['event'].']'; } - - function CombinedSortingDropDownName($params) - { - $list =& $this->GetList($params); - $prefix_special = $list->getPrefixSpecial(); - - return $prefix_special.'_CombinedSorting'; - } - - function SortingSelected($params) - { - $list =& $this->GetList($params); - $user_sorting_start = $this->getUserSortIndex(); - - $sorting = strtolower($list->GetOrderField($user_sorting_start).'|'.$list->GetOrderDirection($user_sorting_start)); - - if ($sorting == strtolower($params['sorting'])) return $params['selected']; - } - - - /** * Prints list content using block specified * @@ -387,7 +366,7 @@ $block_params['last_col'] = $column_number == $columns ? 1 : 0; $block_params['column_number'] = $column_number; - + $this->PrepareListElementParams($list, $block_params); // new, no need to rewrite PrintList $o.= $this->Application->ParseBlock($block_params, 1); array_push($displayed, $list->GetDBField($id_field)); @@ -447,10 +426,10 @@ function PrepareListElementParams(&$object, &$block_params) { // $fields_hash =& $object->Records[$this->CurrentIndex]; -// +// // $object->Records[$this->CurrentIndex] =& $fields_hash; } - + function MoreLink($params) { $per_page = $this->SelectParam($params, 'per_page,max_items'); @@ -868,7 +847,7 @@ $type = $params['type']; unset($params['type']); // remove parameters used only by current tag - + $ret = ''; switch ($type) { case 'current': @@ -1398,7 +1377,7 @@ { $object =& $this->GetList($params); /* @var $object kDBList */ - + switch ($params['type']) { case 'filtered': return $object->GetRecordsCount(); @@ -1822,7 +1801,6 @@ return $list->GetFormattedTotal($this->SelectParam($params, 'field,name'), $params['function']); } - function FCKEditor($params) { $params['no_special'] = 1; $value = $this->Field($params); @@ -1876,7 +1854,7 @@ return $this->Application->ProcessParsedTag('m', 't', $params); } - + function PresetFormFields($params) { $prefix = $this->getPrefixSpecial(); @@ -1901,7 +1879,7 @@ } return $o; } - + /** * Checks if current prefix is main item * Index: trunk/themes/default2007/platform/elements/pagination.tpl =================================================================== diff -u -N -r8369 -r8460 --- trunk/themes/default2007/platform/elements/pagination.tpl (.../pagination.tpl) (revision 8369) +++ trunk/themes/default2007/platform/elements/pagination.tpl (.../pagination.tpl) (revision 8460) @@ -18,17 +18,31 @@ - + + + + +
+ : +
+ + + " value="" /> + +
-
\ No newline at end of file Index: trunk/core/units/general/cat_event_handler.php =================================================================== diff -u -N -r8451 -r8460 --- trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 8451) +++ trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 8460) @@ -2052,6 +2052,125 @@ return $status == STATUS_ACTIVE; } + + /** + * Set sorting directly to session + * + * @param kEvent $event + */ + function OnSetSortingDirect(&$event) + { + $combined = $this->Application->GetVar($event->Prefix.'_CombinedSorting'); + if ($combined) { + list($field, $dir) = explode('|', $combined); + $this->Application->StoreVar($event->Prefix.'_Sort1', $field); + $this->Application->StoreVar($event->Prefix.'_Sort1_Dir', $dir); + return ; + } + + $field_pos = $this->Application->GetVar($event->Prefix.'_SortPos'); + $this->Application->LinkVar($event->Prefix.'_Sort'.$field_pos, $event->Prefix.'_Sort'.$field_pos); + $this->Application->LinkVar($event->Prefix.'_Sort'.$field_pos.'_Dir', $event->Prefix.'_Sort'.$field_pos.'_Dir'); + } + + /** + * Set's correct sorting for list + * based on data provided with event + * + * @param kEvent $event + * @access private + * @see OnListBuild + */ + function SetSorting(&$event) + { + if ($this->Application->IsAdmin()) { + parent::SetSorting($event); + return ; + } + + $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); + } + } + + /** + * Returns current per-page setting for list + * + * @param kEvent $event + * @return int + */ + function getPerPage(&$event) + { + if ($this->Application->IsAdmin()) { + return parent::getPerPage($event); + } + + $special = $event->Special; + $event->Init($event->Prefix); + $per_page = parent::getPerPage($event); + $event->Init($event->Prefix, $special); + + return $per_page; + } + } ?> \ No newline at end of file Index: trunk/themes/default2007/platform/elements/menu.tpl =================================================================== diff -u -N -r8453 -r8460 --- trunk/themes/default2007/platform/elements/menu.tpl (.../menu.tpl) (revision 8453) +++ trunk/themes/default2007/platform/elements/menu.tpl (.../menu.tpl) (revision 8460) @@ -28,7 +28,7 @@ - + Index: trunk/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r8428 -r8460 --- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 8428) +++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 8460) @@ -879,26 +879,6 @@ } /** - * Set sorting directly to session - * - * @param kEvent $event - */ - function OnSetSortingDirect(&$event) - { - $combined = $this->Application->GetVar($event->getPrefixSpecial(true).'_CombinedSorting'); - if ($combined) { - list($field,$dir) = explode('|',$combined); - $this->Application->StoreVar($event->Prefix_Special.'_Sort1', $field); - $this->Application->StoreVar($event->Prefix_Special.'_Sort1_Dir', $dir); - return; - } - - $field_pos = $this->Application->GetVar($event->getPrefixSpecial(true).'_SortPos'); - $this->Application->LinkVar( $event->getPrefixSpecial(true).'_Sort'.$field_pos, $event->Prefix_Special.'_Sort'.$field_pos); - $this->Application->LinkVar( $event->getPrefixSpecial(true).'_Sort'.$field_pos.'_Dir', $event->Prefix_Special.'_Sort'.$field_pos.'_Dir'); - } - - /** * Reset grid sorting to default (from config) * * @param kEvent $event Index: trunk/themes/default2007/platform/inc/styles.css =================================================================== diff -u -N -r8415 -r8460 --- trunk/themes/default2007/platform/inc/styles.css (.../styles.css) (revision 8415) +++ trunk/themes/default2007/platform/inc/styles.css (.../styles.css) (revision 8460) @@ -9,4 +9,8 @@ .error { color: #FF0000; +} + +form { + display: inline; } \ No newline at end of file Index: trunk/core/units/general/cat_tag_processor.php =================================================================== diff -u -N -r8435 -r8460 --- trunk/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 8435) +++ trunk/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 8460) @@ -299,6 +299,34 @@ { return $this->Application->GetVar($this->getPrefixSpecial().'_id') > 0; } + + function CombinedSortingDropDownName($params) + { + $list =& $this->GetList($params); + + return $this->Prefix.'_CombinedSorting'; + } + + function SortingSelected($params) + { + $list =& $this->GetList($params); + $user_sorting_start = $this->getUserSortIndex(); + + $sorting = strtolower($list->GetOrderField($user_sorting_start).'|'.$list->GetOrderDirection($user_sorting_start)); + + if ($sorting == strtolower($params['sorting'])) return $params['selected']; + } + + function PerPageSelected($params) + { + $list =& $this->GetList($params); + return $list->PerPage == $params['per_page'] ? $params['selected'] : ''; + } + + function SubmitName($params) + { + return 'events['.$this->Prefix.']['.$params['event'].']'; + } } ?> \ No newline at end of file Index: trunk/themes/default2007/platform/my_account/my_account.tpl =================================================================== diff -u -N --- trunk/themes/default2007/platform/my_account/my_account.tpl (revision 0) +++ trunk/themes/default2007/platform/my_account/my_account.tpl (revision 8460) @@ -0,0 +1,24 @@ + + + + + + + + + + + + + my account big + + + + + + + \ No newline at end of file