Attached Files |
category search in advanced theme.patch [^] (26,609 bytes) 2009-10-06 04:12
[Show Content]
Index: core/kernel/db/cat_event_handler.php
===================================================================
--- core/kernel/db/cat_event_handler.php (revision 12650)
+++ core/kernel/db/cat_event_handler.php (working copy)
@@ -379,29 +379,26 @@
$type_clauses['displayed']['having_filter'] = false;
if (in_array('search', $types) || in_array('search', $except_types)) {
- $event_mapping = Array(
- 'simple' => 'OnSimpleSearch',
- 'subsearch' => 'OnSubSearch',
- 'advanced' => 'OnAdvancedSearch');
- if($this->Application->GetVar('INPORTAL_ON') && $this->Application->GetVar('Action') == 'm_simple_subsearch')
- {
- $type = 'subsearch';
- }
- else
- {
- $type = $this->Application->GetVar('search_type') ? $this->Application->GetVar('search_type') : 'simple';
- }
+ $event_mapping = Array (
+ 'simple' => 'OnSimpleSearch',
+ 'subsearch' => 'OnSubSearch',
+ 'advanced' => 'OnAdvancedSearch'
+ );
- if($keywords = $event->getEventParam('keyword_string')) // processing keyword_string param of ListProducts tag
- {
+ $type = $this->Application->GetVar('search_type', 'simple');
+
+ if ($keywords = $event->getEventParam('keyword_string')) {
+ // processing keyword_string param of ListProducts tag
$this->Application->SetVar('keywords', $keywords);
$type = 'simple';
}
+
$search_event = $event_mapping[$type];
$this->$search_event($event);
$search_table = TABLE_PREFIX.'ses_'.$this->Application->GetSID().'_'.TABLE_PREFIX.'Search';
$sql = 'SHOW TABLES LIKE "'.$search_table.'"';
+
if ($this->Conn->Query($sql)) {
$search_res_ids = $this->Conn->GetCol('SELECT ResourceId FROM '.$search_table);
}
@@ -414,6 +411,7 @@
$type_clauses['search']['include'] = '0';
$type_clauses['search']['except'] = '1';
}
+
$type_clauses['search']['having_filter'] = false;
}
@@ -1037,19 +1035,13 @@
}
/**
- * Makes simple search for products
+ * Makes simple search for category items
* based on keywords string
*
* @param kEvent $event
- * @todo Change all hardcoded Products table & In-Commerce module usage to dynamic usage from item config !!!
*/
function OnSimpleSearch(&$event)
{
- if($this->Application->GetVar('INPORTAL_ON') && !($this->Application->GetVar('Action') == 'm_simple_search'))
- {
- return;
- }
-
$event->redirect = false;
$search_table = TABLE_PREFIX.'ses_'.$this->Application->GetSID().'_'.TABLE_PREFIX.'Search';
@@ -1072,11 +1064,9 @@
}
$this->Application->StoreVar('keywords', $keywords);
- if (!$this->Application->GetVar('INPORTAL_ON')) {
- // don't save search log, because in-portal already saved it
- $this->saveToSearchLog($keywords, 0); // 0 - simple search, 1 - advanced search
- }
+ $this->saveToSearchLog($keywords, 0); // 0 - simple search, 1 - advanced search
+
$keywords = strtr($keywords, Array('%' => '\\%', '_' => '\\_'));
$event->setPseudoClass('_List');
@@ -1227,17 +1217,8 @@
$where_clause = $where_clause.' AND '.$items_table.'.Status=1';
- if($this->Application->GetVar('Action') == 'm_simple_subsearch') // subsearch, In-portal
- {
- if( $event->getEventParam('ResultIds') )
- {
- $where_clause .= ' AND '.$items_table.'.ResourceId IN ('.implode(',', $event->specificParams['ResultIds']).')';
- }
- }
- if( $event->MasterEvent && $event->MasterEvent->Name == 'OnListBuild' ) // subsearch, k4
- {
- if( $event->MasterEvent->getEventParam('ResultIds') )
- {
+ if ($event->MasterEvent && $event->MasterEvent->Name == 'OnListBuild') {
+ if ($event->MasterEvent->getEventParam('ResultIds')) {
$where_clause .= ' AND '.$items_table.'.ResourceId IN ('.implode(',', $event->MasterEvent->getEventParam('ResultIds')).')';
}
}
@@ -1268,6 +1249,9 @@
$revelance_parts[] = 'IF('.$field.' LIKE "%'.$keyword.'%", '.$weight.', 0)';
}
}
+
+ $revelance_parts = array_unique($revelance_parts);
+
$conf_postfix = $this->Application->getUnitOption($event->Prefix, 'SearchConfigPostfix');
$rel_keywords = $this->Application->ConfigValue('SearchRel_Keyword_'.$conf_postfix) / 100;
$rel_pop = $this->Application->ConfigValue('SearchRel_Pop_'.$conf_postfix) / 100;
@@ -1281,7 +1265,7 @@
}
// building final search query
- if (!$this->Application->GetVar('do_not_drop_search_table') && !$this->Application->GetVar('INPORTAL_ON')) {
+ if (!$this->Application->GetVar('do_not_drop_search_table')) {
$this->Conn->Query('DROP TABLE IF EXISTS '.$search_table); // erase old search table if clean k4 event
$this->Application->SetVar('do_not_drop_search_table', true);
}
Index: core/kernel/processors/main_processor.php
===================================================================
--- core/kernel/processors/main_processor.php (revision 12650)
+++ core/kernel/processors/main_processor.php (working copy)
@@ -586,6 +586,8 @@
$skip_prefixes = isset($params['skip_prefixes']) ? explode(',', $params['skip_prefixes']) : Array();
$cms_mode = $this->Application->GetVar('admin');
+ $included = Array ();
+
foreach ($this->Application->ModuleInfo as $module_name => $module_data) {
$module_key = mb_strtolower($module_name);
@@ -598,10 +600,18 @@
// Front-End still relies on In-Portal module
$module_prefix = $module_data['TemplatePath'];
}
+ elseif ($this->Application->IsAdmin()) {
+ $module_prefix = $module_data['Path']; // was $module_key . '/';
+ }
else {
- $module_prefix = $this->Application->IsAdmin() ? $module_key.'/' : rtrim($module_data['TemplatePath'], '/').'/';
+ $module_prefix = $module_data['TemplatePath']; // always have trailing "/"
}
+ if (in_array($module_prefix, $included)) {
+ // template by this path was already included by other module (e.g. in-portal used core's template)
+ continue;
+ }
+
$block_params['t'] = $module_prefix.$this->SelectParam($params, $module_key.'_template,'.$module_key.'_t,template,t');
$check_prefix = $module_data['Var'];
@@ -620,6 +630,7 @@
}
$ret .= $this->Application->Parser->IncludeTemplate($block_params, isset($block_params['is_silent']) ? 1 : 0);
+ $included[] = $module_prefix;
}
return $ret;
Index: core/units/categories/categories_config.php
===================================================================
--- core/units/categories/categories_config.php (revision 12650)
+++ core/units/categories/categories_config.php (working copy)
@@ -54,6 +54,7 @@
'CatalogItem' => true,
'AdminTemplatePath' => 'categories',
'AdminTemplatePrefix' => 'categories_',
+ 'SearchConfigPostfix' => 'category',
'QueryString' => Array (
1 => 'id',
Index: core/units/categories/categories_event_handler.php
===================================================================
--- core/units/categories/categories_event_handler.php (revision 12650)
+++ core/units/categories/categories_event_handler.php (working copy)
@@ -470,6 +470,43 @@
$type_clauses['menu']['include'] = '%1$s.IsMenu = 1';
$type_clauses['menu']['except'] = '%1$s.IsMenu = 0';
+ if (in_array('search', $types) || in_array('search', $except_types)) {
+ $event_mapping = Array (
+ 'simple' => 'OnSimpleSearch',
+ 'subsearch' => 'OnSubSearch',
+ 'advanced' => 'OnAdvancedSearch'
+ );
+
+ $type = $this->Application->GetVar('search_type', 'simple');
+
+ if ($keywords = $event->getEventParam('keyword_string')) {
+ // processing keyword_string param of ListProducts tag
+ $this->Application->SetVar('keywords', $keywords);
+ $type = 'simple';
+ }
+
+ $search_event = $event_mapping[$type];
+ $this->$search_event($event);
+
+ $search_table = TABLE_PREFIX.'ses_'.$this->Application->GetSID().'_'.TABLE_PREFIX.'Search';
+ $sql = 'SHOW TABLES LIKE "'.$search_table.'"';
+
+ if ($this->Conn->Query($sql)) {
+ $search_res_ids = $this->Conn->GetCol('SELECT ResourceId FROM '.$search_table);
+ }
+
+ if (isset($search_res_ids) && $search_res_ids) {
+ $type_clauses['search']['include'] = '%1$s.ResourceId IN ('.implode(',', $search_res_ids).')';
+ $type_clauses['search']['except'] = '%1$s.ResourceId NOT IN ('.implode(',', $search_res_ids).')';
+ }
+ else {
+ $type_clauses['search']['include'] = '0';
+ $type_clauses['search']['except'] = '1';
+ }
+
+ $type_clauses['search']['having_filter'] = false;
+ }
+
$search_helper =& $this->Application->recallObject('SearchHelper');
/* @var $search_helper kSearchHelper */
@@ -1993,4 +2030,277 @@
$this->Application->StoreVar('_editor_preview_content_', $string);
}
+
+ /**
+ * Makes simple search for categories
+ * based on keywords string
+ *
+ * @param kEvent $event
+ */
+ function OnSimpleSearch(&$event)
+ {
+ $event->redirect = false;
+ $search_table = TABLE_PREFIX.'ses_'.$this->Application->GetSID().'_'.TABLE_PREFIX.'Search';
+
+ $keywords = unhtmlentities( trim($this->Application->GetVar('keywords')) );
+
+ $query_object =& $this->Application->recallObject('HTTPQuery');
+ $sql = 'SHOW TABLES LIKE "'.$search_table.'"';
+
+ if(!isset($query_object->Get['keywords']) &&
+ !isset($query_object->Post['keywords']) &&
+ $this->Conn->Query($sql))
+ {
+ return; // used when navigating by pages or changing sorting in search results
+ }
+ if(!$keywords || strlen($keywords) < $this->Application->ConfigValue('Search_MinKeyword_Length'))
+ {
+ $this->Conn->Query('DROP TABLE IF EXISTS '.$search_table);
+ $this->Application->SetVar('keywords_too_short', 1);
+ return; // if no or too short keyword entered, doing nothing
+ }
+
+ $this->Application->StoreVar('keywords', $keywords);
+
+ $this->saveToSearchLog($keywords, 0); // 0 - simple search, 1 - advanced search
+
+ $keywords = strtr($keywords, Array('%' => '\\%', '_' => '\\_'));
+
+ $event->setPseudoClass('_List');
+
+ $object =& $event->getObject();
+ /* @var $object kDBList */
+
+ $this->Application->SetVar($event->getPrefixSpecial().'_Page', 1);
+ $lang = $this->Application->GetVar('m_lang');
+ $items_table = $this->Application->getUnitOption($event->Prefix, 'TableName');
+ $module_name = 'In-Portal';
+
+ $sql = 'SELECT *
+ FROM ' . $this->Application->getUnitOption('confs', 'TableName') . '
+ WHERE ModuleName = ' . $this->Conn->qstr($module_name) . ' AND SimpleSearch = 1';
+ $search_config = $this->Conn->Query($sql, 'FieldName');
+
+ $field_list = array_keys($search_config);
+
+ $join_clauses = Array();
+
+ // field processing
+ $weight_sum = 0;
+
+ $alias_counter = 0;
+
+ $custom_fields = $this->Application->getUnitOption($event->Prefix, 'CustomFields');
+ if ($custom_fields) {
+ $custom_table = $this->Application->getUnitOption($event->Prefix.'-cdata', 'TableName');
+ $join_clauses[] = ' LEFT JOIN '.$custom_table.' custom_data ON '.$items_table.'.ResourceId = custom_data.ResourceId';
+ }
+
+ // what field in search config becomes what field in sql (key - new field, value - old field (from searchconfig table))
+ $search_config_map = Array();
+
+ foreach ($field_list as $key => $field) {
+ $options = $object->getFieldOptions($field);
+ $local_table = TABLE_PREFIX.$search_config[$field]['TableName'];
+ $weight_sum += $search_config[$field]['Priority']; // counting weight sum; used when making relevance clause
+
+ // processing multilingual fields
+ if (getArrayValue($options, 'formatter') == 'kMultiLanguage') {
+ $field_list[$key.'_primary'] = 'l'.$this->Application->GetDefaultLanguageId().'_'.$field;
+ $field_list[$key] = 'l'.$lang.'_'.$field;
+
+ if (!isset($search_config[$field]['ForeignField'])) {
+ $field_list[$key.'_primary'] = $local_table.'.'.$field_list[$key.'_primary'];
+ $search_config_map[ $field_list[$key.'_primary'] ] = $field;
+ }
+ }
+
+ // processing fields from other tables
+ if ($foreign_field = $search_config[$field]['ForeignField']) {
+ $exploded = explode(':', $foreign_field, 2);
+ if ($exploded[0] == 'CALC') {
+ // ignoring having type clauses in simple search
+ unset($field_list[$key]);
+ continue;
+ }
+ else {
+ $multi_lingual = false;
+ if ($exploded[0] == 'MULTI') {
+ $multi_lingual = true;
+ $foreign_field = $exploded[1];
+ }
+
+ $exploded = explode('.', $foreign_field); // format: table.field_name
+ $foreign_table = TABLE_PREFIX.$exploded[0];
+
+ $alias_counter++;
+ $alias = 't'.$alias_counter;
+
+ if ($multi_lingual) {
+ $field_list[$key] = $alias.'.'.'l'.$lang.'_'.$exploded[1];
+ $field_list[$key.'_primary'] = 'l'.$this->Application->GetDefaultLanguageId().'_'.$field;
+ $search_config_map[ $field_list[$key] ] = $field;
+ $search_config_map[ $field_list[$key.'_primary'] ] = $field;
+ }
+ else {
+ $field_list[$key] = $alias.'.'.$exploded[1];
+ $search_config_map[ $field_list[$key] ] = $field;
+ }
+
+ $join_clause = str_replace('{ForeignTable}', $alias, $search_config[$field]['JoinClause']);
+ $join_clause = str_replace('{LocalTable}', $items_table, $join_clause);
+
+ $join_clauses[] = ' LEFT JOIN '.$foreign_table.' '.$alias.'
+ ON '.$join_clause;
+ }
+ }
+ else {
+ // processing fields from local table
+ if ($search_config[$field]['CustomFieldId']) {
+ $local_table = 'custom_data';
+
+ // search by custom field value on current language
+ $custom_field_id = array_search($field_list[$key], $custom_fields);
+ $field_list[$key] = 'l'.$lang.'_cust_'.$custom_field_id;
+
+ // search by custom field value on primary language
+ $field_list[$key.'_primary'] = $local_table.'.l'.$this->Application->GetDefaultLanguageId().'_cust_'.$custom_field_id;
+ $search_config_map[ $field_list[$key.'_primary'] ] = $field;
+ }
+
+ $field_list[$key] = $local_table.'.'.$field_list[$key];
+ $search_config_map[ $field_list[$key] ] = $field;
+ }
+ }
+
+ // keyword string processing
+ $search_helper =& $this->Application->recallObject('SearchHelper');
+ /* @var $search_helper kSearchHelper */
+
+ $where_clause = Array ();
+ foreach ($field_list as $field) {
+ if (preg_match('/^' . preg_quote($items_table, '/') . '\.(.*)/', $field, $regs)) {
+ // local real field
+ $filter_data = $search_helper->getSearchClause($object, $regs[1], $keywords, false);
+ if ($filter_data) {
+ $where_clause[] = $filter_data['value'];
+ }
+ }
+ elseif (preg_match('/^custom_data\.(.*)/', $field, $regs)) {
+ $custom_field_name = 'cust_' . $search_config_map[$field];
+ $filter_data = $search_helper->getSearchClause($object, $custom_field_name, $keywords, false);
+ if ($filter_data) {
+ $where_clause[] = str_replace('`' . $custom_field_name . '`', $field, $filter_data['value']);
+ }
+ }
+ else {
+ $where_clause[] = $search_helper->buildWhereClause($keywords, Array ($field));
+ }
+ }
+
+ $where_clause = '(' . implode(') OR (', $where_clause) . ')';
+
+ $where_clause = $where_clause.' AND '.$items_table.'.Status=1';
+
+ if ($event->MasterEvent && $event->MasterEvent->Name == 'OnListBuild') {
+ if ($event->MasterEvent->getEventParam('ResultIds')) {
+ $where_clause .= ' AND '.$items_table.'.ResourceId IN ('.implode(',', $event->MasterEvent->getEventParam('ResultIds')).')';
+ }
+ }
+
+ // making relevance clause
+ $positive_words = $search_helper->getPositiveKeywords($keywords);
+ $this->Application->StoreVar('highlight_keywords', serialize($positive_words));
+ $revelance_parts = Array();
+ reset($search_config);
+
+ foreach ($positive_words as $keyword_index => $positive_word) {
+ $positive_words[$keyword_index] = mysql_real_escape_string($positive_word);
+ }
+
+ foreach ($field_list as $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) {
+ $revelance_parts[] = 'IF('.$field.' LIKE "%'.$keyword.'%", '.$weight.', 0)';
+ }
+ }
+
+ $revelance_parts = array_unique($revelance_parts);
+
+ $conf_postfix = $this->Application->getUnitOption($event->Prefix, 'SearchConfigPostfix');
+ $rel_keywords = $this->Application->ConfigValue('SearchRel_Keyword_'.$conf_postfix) / 100;
+ $rel_pop = $this->Application->ConfigValue('SearchRel_Pop_'.$conf_postfix) / 100;
+ $rel_rating = $this->Application->ConfigValue('SearchRel_Rating_'.$conf_postfix) / 100;
+ $relevance_clause = '('.implode(' + ', $revelance_parts).') / '.$weight_sum.' * '.$rel_keywords;
+ if ($rel_pop && isset($object->Fields['Hits'])) {
+ $relevance_clause .= ' + (Hits + 1) / (MAX(Hits) + 1) * '.$rel_pop;
+ }
+ if ($rel_rating && isset($object->Fields['CachedRating'])) {
+ $relevance_clause .= ' + (CachedRating + 1) / (MAX(CachedRating) + 1) * '.$rel_rating;
+ }
+
+ // building final search query
+ if (!$this->Application->GetVar('do_not_drop_search_table')) {
+ $this->Conn->Query('DROP TABLE IF EXISTS '.$search_table); // erase old search table if clean k4 event
+ $this->Application->SetVar('do_not_drop_search_table', true);
+ }
+
+
+ $search_table_exists = $this->Conn->Query('SHOW TABLES LIKE "'.$search_table.'"');
+ if ($search_table_exists) {
+ $select_intro = 'INSERT INTO '.$search_table.' (Relevance, ItemId, ResourceId, ItemType, EdPick) ';
+ }
+ else {
+ $select_intro = 'CREATE TABLE '.$search_table.' AS ';
+ }
+
+ $edpick_clause = $this->Application->getUnitOption($event->Prefix.'.EditorsPick', 'Fields') ? $items_table.'.EditorsPick' : '0';
+
+
+ $sql = $select_intro.' SELECT '.$relevance_clause.' AS Relevance,
+ '.$items_table.'.'.$this->Application->getUnitOption($event->Prefix, 'IDField').' AS ItemId,
+ '.$items_table.'.ResourceId,
+ '.$this->Application->getUnitOption($event->Prefix, 'ItemType').' AS ItemType,
+ '.$edpick_clause.' AS EdPick
+ FROM '.$object->TableName.'
+ '.implode(' ', $join_clauses).'
+ WHERE '.$where_clause.'
+ GROUP BY '.$items_table.'.'.$this->Application->getUnitOption($event->Prefix, 'IDField');
+
+ $res = $this->Conn->Query($sql);
+ }
+
+ /**
+ * Make record to search log
+ *
+ * @param string $keywords
+ * @param int $search_type 0 - simple search, 1 - advanced search
+ */
+ function saveToSearchLog($keywords, $search_type = 0)
+ {
+ // don't save keywords for each module separately, just one time
+ // static variable can't help here, because each module uses it's own class instance !
+ if (!$this->Application->GetVar('search_logged')) {
+ $sql = 'UPDATE '.TABLE_PREFIX.'SearchLog
+ SET Indices = Indices + 1
+ WHERE Keyword = '.$this->Conn->qstr($keywords).' AND SearchType = '.$search_type; // 0 - simple search, 1 - advanced search
+ $this->Conn->Query($sql);
+ if ($this->Conn->getAffectedRows() == 0) {
+ $fields_hash = Array('Keyword' => $keywords, 'Indices' => 1, 'SearchType' => $search_type);
+ $this->Conn->doInsert($fields_hash, TABLE_PREFIX.'SearchLog');
+ }
+
+ $this->Application->SetVar('search_logged', 1);
+ }
+ }
}
\ No newline at end of file
Index: core/units/categories/categories_tag_processor.php
===================================================================
--- core/units/categories/categories_tag_processor.php (revision 12650)
+++ core/units/categories/categories_tag_processor.php (working copy)
@@ -2172,4 +2172,26 @@
return $this->Application->HREF($edit_template,'', $url_params);
}
+
+ function RelevanceIndicator($params)
+ {
+ $object =& $this->getObject($params);
+
+ $search_results_table = TABLE_PREFIX.'ses_'.$this->Application->GetSID().'_'.TABLE_PREFIX.'Search';
+ $sql = 'SELECT Relevance
+ FROM '.$search_results_table.'
+ WHERE ResourceId = '.$object->GetDBField('ResourceId');
+
+ $percents_off = (int)(100 - (100 * $this->Conn->GetOne($sql)));
+ $percents_off = ($percents_off < 0) ? 0 : $percents_off;
+ if ($percents_off) {
+ $params['percent_off'] = $percents_off;
+ $params['percent_on'] = 100 - $percents_off;
+ $params['name'] = $this->SelectParam($params, 'relevance_normal_render_as,block_relevance_normal');
+ }
+ else {
+ $params['name'] = $this->SelectParam($params, 'relevance_full_render_as,block_relevance_full');
+ }
+ return $this->Application->ParseBlock($params);
+ }
}
\ No newline at end of file
Index: themes/advanced/platform/categories/search_results.tpl
===================================================================
--- themes/advanced/platform/categories/search_results.tpl (revision 0)
+++ themes/advanced/platform/categories/search_results.tpl (revision 0)
@@ -0,0 +1,55 @@
+<!--##
+<NAME>Section - Search Results</NAME>
+<DESC>List of Section Search Results</DESC>
+<SECTION>Platform</SECTION>
+##-->
+
+<!--## PAGE TITLE ELEMENT ##-->
+<inp2:m_DefineElement name="page_title">
+ <inp2:m_Phrase label="lu_title_CategorySearchResults"/>
+</inp2:m_DefineElement>
+<!--## //PAGE TITLE ELEMENT ##-->
+
+<!--## SIDE-BAR ELEMENT ##-->
+<inp2:m_DefineElement name="sidebar">
+ <div class="movable-area">
+ <div class="movable-element">
+ <inp2:m_RenderElement name="platform/elements/side_boxes/login.elm" design="blue_box"/>
+ </div>
+ <div class="movable-element">
+ <inp2:m_RenderElement name="platform/elements/side_boxes/search.elm" design="blue_box"/>
+ </div>
+ </div>
+</inp2:m_DefineElement>
+<!--## //SIDE-BAR ELEMENT ##-->
+
+<inp2:m_DefineElement name="content">
+
+<div class="movable-element">
+ <inp2:m_include template="platform/elements/navigation_bar.elm" titles="lu_title_CategorySearchResults" templates="platform/categories/search_results"/>
+</div>
+
+<div class="movable-element">
+ <inp2:m_RenderElement design="content_box">
+ <inp2:c_InitList list_name="category_search_results" types="search" parent_cat_id="any" recursive="1"/>
+
+ <inp2:m_Capture to_var="header">
+ <inp2:m_Phrase label="lu_title_CategorySearchResults"/> (<inp2:c_TotalRecords list_name="category_search_results"/>)
+ </inp2:m_Capture>
+
+ <!--##<inp2:m_include template="platform/elements/sorting.elm" list_name="category_search_results"/>##-->
+
+ <inp2:m_include template="platform/elements/categories.elm"/>
+ <inp2:m_include template="platform/elements/search_results.elm"/>
+
+ <table class="fullwidth">
+ <inp2:c_ListCategories list_name="category_search_results" render_as="category_element" columns="2" show_relevance="1" direction="H"/>
+ </table>
+
+ <inp2:m_include template="platform/elements/pagination.elm" prefix="c" list_name="category_search_results"/>
+ </inp2:m_RenderElement>
+</div>
+
+</inp2:m_DefineElement>
+
+<inp2:m_include template="platform/designs/default_design.des" pass_params="1"/>
\ No newline at end of file
Index: themes/advanced/platform/elements/categories.elm.tpl
===================================================================
--- themes/advanced/platform/elements/categories.elm.tpl (revision 12650)
+++ themes/advanced/platform/elements/categories.elm.tpl (working copy)
@@ -27,6 +27,13 @@
<img src="<inp2:m_TemplatesBase module="In-Portal"/>img/s.gif" width="1" height="4" alt="" /><br />
<inp2:Field name="Description" first_chars="200"/>
+
+ <inp2:m_if check="m_Param" name="show_relevance">
+ <br/>
+
+ <inp2:m_if check="Field" name="Description"><br/></inp2:m_if>
+ <inp2:RelevanceIndicator on_color="Red" off_color="White" relevance_normal_render_as="search_relevance_normal" relevance_full_render_as="search_relevance_full" />
+ </inp2:m_if>
</td>
</tr>
</table>
Index: themes/advanced/platform/elements/content_boxes/search_results.elm.tpl
===================================================================
--- themes/advanced/platform/elements/content_boxes/search_results.elm.tpl (revision 0)
+++ themes/advanced/platform/elements/content_boxes/search_results.elm.tpl (revision 0)
@@ -0,0 +1,26 @@
+<inp2:m_RenderElement design="content_box" data_exists="1">
+ <inp2:c_InitList list_name="category_search_results" types="search" parent_cat_id="any" per_page="short_list"/>
+
+ <inp2:m_Capture to_var="header">
+ <inp2:m_phrase name="lu_title_CategorySearchResults"/> (<inp2:c_TotalRecords list_name="category_search_results" />)
+ </inp2:m_Capture>
+
+ <inp2:m_include template="platform/elements/categories.elm"/>
+ <inp2:m_include template="platform/elements/search_results.elm"/>
+
+ <table class="fullwidth">
+ <inp2:c_ListCategories list_name="category_search_results" render_as="category_element" columns="2" show_relevance="1" direction="H"/>
+ </table>
+
+ <div class="horizontal-separator"><img src="<inp2:m_TemplatesBase module="In-Portal"/>img/s.gif" width="1" height="1" alt="" /><br /></div>
+
+ <inp2:m_if check="c_TotalRecords" list_name="category_search_results">
+ <inp2:m_Set items_found="1"/>
+ </inp2:m_if>
+
+ <inp2:m_DefineElement name="more_link">
+ <img src="<inp2:m_TemplatesBase module="In-Portal"/>img/s.gif" width="1" height="5" alt="" /><br />
+ <a href="<inp2:m_Link template="platform/categories/search_results" />"><inp2:m_Phrase label="lu_More"/>...</a>
+ </inp2:m_DefineElement>
+ <inp2:c_MoreLink list_name="category_search_results" render_as="more_link"/>
+</inp2:m_RenderElement>
\ No newline at end of file
Index: themes/advanced/platform/search/search_results.tpl
===================================================================
--- themes/advanced/platform/search/search_results.tpl (revision 12650)
+++ themes/advanced/platform/search/search_results.tpl (working copy)
@@ -36,7 +36,7 @@
</div>
<div class="movable-element">
<inp2:m_Set items_found="0"/>
- <inp2:m_ModuleInclude template="elements/content_boxes/search_results.elm"/>
+ <inp2:m_ModuleInclude template="elements/content_boxes/search_results.elm" in-portal_template="platform/elements/content_boxes/search_results.elm"/>
<inp2:m_if check="m_GetEquals" var="items_found" value="0">
<inp2:m_include template="platform/elements/content_boxes/nothing_found.elm"/>
356-missing_section_search_func-Dmitry-2009_10_08-v1.patch [^] (2,993 bytes) 2009-10-08 17:17
[Show Content]
Index: themes/simple/search-results.tpl
===================================================================
--- themes/simple/search-results.tpl (revision 12659)
+++ themes/simple/search-results.tpl (working copy)
@@ -11,19 +11,22 @@
<div id="block-latest" class="block">
<div class="round-top"></div>
<div class="content">
- <inp2:st_InitList list_name="search_results" types="search" parent_cat_id="any" recursive="1"/>
+ <inp2:c_InitList list_name="search_results" types="search" parent_cat_id="any" recursive="1"/>
- <h1 class="movable-header"><inp2:m_phrase name="lu_title_SearchResults"/> (<inp2:st_TotalRecords list_name="search_results"/>)</h1>
- <inp2:m_if check="st_TotalRecords" list_name="search_results">
- <inp2:m_DefineElement name="search_element">
- <li>
- <a href="<inp2:m_if check='m_Param' name='external_url'><inp2:m_Param name='external_url'/><inp2:m_else/><inp2:m_Link template='$template' m_cat_id='$cat_id' m_cat_page='1'/></inp2:m_if>" title="<inp2:m_Param name="title"/>"><inp2:m_Param name="title"/></a>
- </li>
+ <h1 class="movable-header"><inp2:m_phrase name="lu_title_SearchResults"/> (<inp2:c_TotalRecords list_name="search_results"/>)</h1>
+ <inp2:m_if check="c_TotalRecords" list_name="search_results">
+ <inp2:m_DefineElement name="search_element">
+ <li>
+ <a href="<inp2:CategoryLink template="__default__" m_cat_page="1"/>" title="<inp2:Field name="Name" html_escape="1"/>"><inp2:Field name="Name" html_escape="1"/></a>
+ <!-- ##
+ <span>(<inp2:SubCatCount/> / <inp2:ItemCount/>)</span>
+ -->
+ </li>
</inp2:m_DefineElement>
<ul>
- <inp2:st_PrintList list_name="search_results" render_as="search_element" per_page="-1"/>
- </ul>
+ <inp2:c_ListCategories list_name="search_results" render_as="search_element" per_page="-1" show_relevance="0" />
+ </ul>
<inp2:m_else/>
<inp2:m_Phrase label="lu_text_NothingFound"/>!
</inp2:m_if>
Index: themes/simple/elements/search.elm.tpl
===================================================================
--- themes/simple/elements/search.elm.tpl (revision 12659)
+++ themes/simple/elements/search.elm.tpl (working copy)
@@ -1,7 +1,6 @@
-<form method="post" action="<inp2:m_Link template="search-results" m_cat_id="0"/>">
+<form method="get" action="<inp2:m_Link template="search-results" m_cat_id="0"/>">
<fieldset id="site-search">
- <inp2:m_GetFormHiddens template="search-results" />
- <input type="hidden" name="mode" value="results" />
+ <inp2:m_GetFormHiddens template="search-results" />
<input type="text" name="keywords" value="" size="5" class="sq-form-field" id="queries_keywords_query" onfocus="if (this.value == '') { this.value = ''; }" onblur="if (this.value == '') { this.value=''; }" />
<span class="submit"><input type="submit" value="<inp2:m_Phrase label="lu_search" no_editing="1"/>" /></span>
</fieldset>
356-missing_section_search_func_NEW_PHRASE-Dmitry-2009_10_08-v1.patch [^] (953 bytes) 2009-10-08 17:35
[Show Content]
Index: core/install/english.lang
===================================================================
--- core/install/english.lang (revision 12659)
+++ core/install/english.lang (working copy)
@@ -1987,6 +1987,7 @@
<PHRASE Label="lu_title_Advertisements" Module="Core" Type="0">QWR2ZXJ0aXNlbWVudHM=</PHRASE>
<PHRASE Label="lu_title_BackToTop" Module="Core" Type="0">QmFjayB0byB0b3A=</PHRASE>
<PHRASE Label="lu_title_Categories" Module="Core" Type="0">Q2F0ZWdvcmllcw==</PHRASE>
+ <PHRASE Label="lu_title_CategorySearchResults" Module="Core" Type="0">Q2F0ZWdvcnkgU2VhcmNoIFJlc3VsdHM=</PHRASE>
<PHRASE Label="lu_title_DisabledAccountWarning" Module="Core" Type="0">UGVuZGluZyBvciBkaXNhYmxlZCB1c2VyIGFjY291bnQgd2FybmluZw==</PHRASE>
<PHRASE Label="lu_title_EditAddress" Module="Core" Type="0">RWRpdCBBZGRyZXNz</PHRASE>
<PHRASE Label="lu_title_enhancementconfirmation" Module="Core" Type="0">WW91ciBGYXZvcml0ZSBJdGVtcw==</PHRASE>
|