Index: branches/RC/core/units/general/cat_event_handler.php =================================================================== diff -u -N -r10796 -r10870 --- branches/RC/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 10796) +++ branches/RC/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 10870) @@ -19,10 +19,9 @@ 'OnBeforeDeleteOriginal' => Array('self' => 'edit|advanced:approve'), 'OnDownloadFile' => Array('self' => 'view'), - 'OnCancelAction' => Array('self' => true), - 'OnItemBuild' => Array('self' => true), + 'OnMakeVote' => Array ('self' => true), ); $this->permMapping = array_merge($this->permMapping, $permissions); @@ -1118,7 +1117,15 @@ } foreach ($field_list as $field) { - $config_elem = $search_config[ $search_config_map[$field] ]; + + if (!array_key_exists($field, $search_config_map)) { + $map_key = $search_config_map[$items_table . '.' . $field]; + } + else { + $map_key = $search_config_map[$field]; + } + + $config_elem = $search_config[ $map_key ]; $weight = $config_elem['Priority']; $revelance_parts[] = 'IF('.$field.' LIKE "%'.implode(' ', $positive_words).'%", '.$weight_sum.', 0)'; foreach ($positive_words as $keyword) { @@ -2432,6 +2439,31 @@ $filename = $object->GetField($field, 'full_path'); $file_helper->DownloadFile($filename); } + + /** + * Saves user's vote + * + * @param kEvent $event + */ + function OnMakeVote(&$event) + { + $event->status = erSTOP; + + if ($this->Application->GetVar('ajax') != 'yes') { + // this is supposed to call from AJAX only + return ; + } + + $rating_helper =& $this->Application->recallObject('RatingHelper'); + /* @var $rating_helper RatingHelper */ + + $object =& $event->getObject( Array ('skip_autoload' => true) ); + /* @var $object kDBItem */ + + $object->Load( $this->Application->GetVar('id') ); + + echo $rating_helper->makeVote($object); + } } ?> \ No newline at end of file