Attached Files |
navigation_bar_refactoring_and_page_info_tag_fix_core.patch [^] (36,165 bytes) 2012-04-05 08:12
[Show Content]
Index: install.php
===================================================================
--- install.php (revision 15175)
+++ install.php (working copy)
@@ -654,9 +654,9 @@
// can't use USER_ROOT constant, since Application isn't available here
$fields_hash = Array (
- 'l1_Name' => 'Content', 'Filename' => 'Content', 'AutomaticFilename' => 0,
- 'CreatedById' => -1, 'CreatedOn' => time(), 'ResourceId' => $resource_id - 1,
- 'l1_Description' => 'Content', 'Status' => 4,
+ 'l1_Name' => 'Content', 'l1_MenuTitle' => 'Content', 'Filename' => 'Content',
+ 'AutomaticFilename' => 0, 'CreatedById' => -1, 'CreatedOn' => time(),
+ 'ResourceId' => $resource_id - 1, 'l1_Description' => 'Content', 'Status' => 4,
);
$this->Conn->doInsert($fields_hash, $this->toolkit->getSystemConfig('Database', 'TablePrefix') . 'Categories');
Index: install/upgrades.sql
===================================================================
--- install/upgrades.sql (revision 15268)
+++ install/upgrades.sql (working copy)
@@ -2738,3 +2738,5 @@
l4_ColumnTranslation = l4_Translation,
l5_ColumnTranslation = l5_Translation
WHERE PhraseKey IN ('LA_FLD_BINDTOSYSTEMEVENT', 'LA_FLD_CATEGORYID');
+
+UPDATE Categories SET l1_MenuTitle = l1_Name WHERE l1_Name = 'Content';
Index: kernel/db/cat_tag_processor.php
===================================================================
--- kernel/db/cat_tag_processor.php (revision 15226)
+++ kernel/db/cat_tag_processor.php (working copy)
@@ -152,7 +152,10 @@
$params['cat_id'] = $object->GetDBField('CategoryId');
}
- return $this->Application->ProcessParsedTag('c', 'CategoryPath', $params);
+ $navigation_bar = $this->Application->recallObject('kNavigationBar');
+ /* @var $navigation_bar kNavigationBar */
+
+ return $navigation_bar->build($params);
}
function BuildListSpecial($params)
Index: units/categories/categories_tag_processor.php
===================================================================
--- units/categories/categories_tag_processor.php (revision 15257)
+++ units/categories/categories_tag_processor.php (working copy)
@@ -181,10 +181,10 @@
function CategoryPath($params)
{
- $category_helper = $this->Application->recallObject('CategoryHelper');
- /* @var $category_helper CategoryHelper */
+ $navigation_bar = $this->Application->recallObject('kNavigationBar');
+ /* @var $navigation_bar kNavigationBar */
- return $category_helper->NavigationBar($params);
+ return $navigation_bar->build($params);
}
/**
@@ -203,7 +203,11 @@
if ($category_id) {
$params['cat_id'] = $category_id;
- return $this->CategoryPath($params);
+
+ $navigation_bar = $this->Application->recallObject('kNavigationBar');
+ /* @var $navigation_bar kNavigationBar */
+
+ return $navigation_bar->build($params);
}
return '';
@@ -1258,11 +1262,13 @@
switch ($params['type']) {
case 'title':
- $db_field = 'Title';
+ // TODO: rename column to SectionTitle
+ $db_field = 'Name'; // "Section Title" - title to show on page (e.g. in <h1> tag)
break;
case 'htmlhead_title':
- $db_field = 'Name';
+ // TODO: rename column to HtmlTitle
+ $db_field = 'Title'; // "Title (on Page)" - in <title> html tag
break;
case 'meta_title':
@@ -1270,7 +1276,7 @@
break;
case 'menu_title':
- $db_field = 'MenuTitle';
+ $db_field = 'MenuTitle'; // "Title (Menu Item)" - in menu and navigation bar
break;
case 'meta_keywords':
@@ -2154,4 +2160,43 @@
return !$object->GetDBField('Protected');
}
+
+ /**
+ * Returns element for "__item__" navigation bar part
+ *
+ * @param Array $params
+ * @return string
+ * @access protected
+ */
+ protected function CategoryItemElement($params)
+ {
+ $category_helper = $this->Application->recallObject('CategoryHelper');
+ /* @var $category_helper CategoryHelper */
+
+ $navigation_bar = $this->Application->recallObject('kNavigationBar');
+ /* @var $navigation_bar kNavigationBar */
+
+ $category_id = isset($params['cat_id']) ? $params['cat_id'] : $this->Application->GetVar('m_cat_id');
+ $parent_path = explode('|', substr($navigation_bar->getParentPath($category_id), 1, -1));
+ array_shift($parent_path); // remove "Content" category
+ $module_info = $category_helper->getCategoryModule($params, $parent_path);
+
+ if ( !$module_info ) {
+ return '';
+ }
+
+ $module_prefix = $module_info['Var'];
+
+ $object = $this->Application->recallObject($module_prefix);
+ /* @var $object kCatDBItem */
+
+ $title_field = $this->Application->getUnitOption($module_prefix, 'TitleField');
+ $block_params = $this->prepareTagParams($params);
+ $block_params['name'] = $params['render_as'];
+
+ $block_params['title'] = $object->GetField($title_field);
+ $block_params['prefix'] = $module_prefix;
+
+ return $this->Application->ParseBlock($block_params);
+ }
}
\ No newline at end of file
Index: units/configuration/configuration_tag_processor.php
===================================================================
--- units/configuration/configuration_tag_processor.php (revision 15165)
+++ units/configuration/configuration_tag_processor.php (working copy)
@@ -190,7 +190,10 @@
$params['cat_id'] = $this->ModuleRootCategory( Array() );
}
- return $this->Application->ProcessParsedTag('c', 'CategoryPath', $params);
+ $navigation_bar = $this->Application->recallObject('kNavigationBar');
+ /* @var $navigation_bar kNavigationBar */
+
+ return $navigation_bar->build($params);
}
/**
Index: units/helpers/category_helper.php
===================================================================
--- units/helpers/category_helper.php (revision 15226)
+++ units/helpers/category_helper.php (working copy)
@@ -31,206 +31,23 @@
var $_primaryLanguageId = false;
/**
- * Prints category path using given blocks. Also supports used defined path elements at the end.
- *
- * @param Array $params
- * @return string
- */
- function NavigationBar($params)
- {
- $params['is_first'] = 1;
- $main_category_id = isset($params['cat_id']) ? $params['cat_id'] : $this->Application->GetVar('m_cat_id');
-
- if (array_key_exists('shift', $params) && $params['shift']) {
- $home_element = '';
- $params['shift']--;
- }
- else {
- $home_element = $this->getHomeCategoryPath($params, $main_category_id);
- unset($params['is_first']);
- }
-
- if (!getArrayValue($params, 'titles') && !getArrayValue($params, 'templates')) {
- // no static templates given, show only category path
- return $home_element . $this->getCategoryPath($main_category_id, $params);
- }
-
- $navigation_parts = $this->getNavigationParts($params['titles'], $params['templates']);
-
- $ret = '';
- $block_params = Array (); //$params; // sort of TagProcessor:prepareTagParams
- $block_params['no_editing'] = 1;
- $block_params['category'] = 0;
- $block_params['separator'] = $params['separator'];
- $show_category = getArrayValue($params, 'show_category');
-
- $current_template = $this->Application->GetVar('t');
- $physical_template = $this->Application->getPhysicalTemplate($current_template);
-
- if ($physical_template !== false) {
- // replace menu template name with it's actual template name on disk
- list ($current_template) = explode(':', $physical_template, 2);
- }
-
- foreach ($navigation_parts as $template => $title) {
- $block_params['template'] = $template;
-
- if ($title == '__item__') {
- if ($show_category) {
- $ret .= $this->getCategoryPath($main_category_id, $params);
- $show_category = false;
- }
-
- $category_path = $this->getCategoryParentPath($main_category_id);
- $module_info = $this->getCategoryModule($params, array_keys($category_path));
- if (!$module_info) {
- continue;
- }
-
- $module_prefix = $module_info['Var'];
- $object = $this->Application->recallObject($module_prefix);
- /* @var $object kCatDBItem */
-
- $title_field = $this->Application->getUnitOption($module_prefix, 'TitleField');
- $block_params['title'] = $object->GetField($title_field);
- $block_params['prefix'] = $module_prefix;
- $block_params['current'] = 0;
-
- $block_params['name'] = $this->SelectParam($params, 'module_item_render_as,render_as');
- }
- else {
- $block_params['current'] = ($template == $current_template);
-
- if ($title == '__page__') {
- $block_params['title'] = $this->Application->ProcessParsedTag('st', 'PageInfo', Array ('type' => 'title'));
- }
- else {
- $block_params['title'] = $this->Application->Phrase($title);
- }
-
-
- $block_params['name'] = $template == $current_template ? $params['current_render_as'] : $params['render_as'];
- }
-
- $ret .= $this->Application->ParseBlock($block_params);
- }
-
- if ($show_category) {
- $params['no_current'] = true;
- return $home_element . ($show_category ? $this->getCategoryPath($main_category_id, $params) : '') . $ret;
- }
-
- return $home_element . $ret;
- }
-
- /**
- * Get navigation parts
- *
- * @param Array $titles
- * @param Array $templates
- * @return Array
- */
- function getNavigationParts($titles, $templates)
- {
- $titles = explode(',', $titles);
- $templates = explode(',', $templates);
-
- $ret = Array ();
- foreach ($templates as $template_pos => $template) {
- $ret[$template] = $titles[$template_pos];
- }
-
- return $ret;
- }
-
- /**
- * Renders path to given category using given blocks.
- *
- * @param int $main_category_id
- * @param Array $params
- * @return string
- */
- function getCategoryPath($main_category_id, $params)
- {
- $category_path = $this->getCategoryParentPath($main_category_id);
- if (!$category_path) {
- // in "Home" category
- return '';
- }
-
- if (array_key_exists('shift', $params) && $params['shift']) {
- array_splice($category_path, 0, $params['shift']);
- }
-
- $module_info = $this->getCategoryModule($params, array_keys($category_path));
-
- $module_category_id = $module_info['RootCat'];
- $module_item_id = $this->Application->GetVar($module_info['Var'].'_id');
-
- $ret = '';
- $block_params['category'] = 1;
- $block_params['no_editing'] = 1;
-
- if (array_key_exists('is_first', $params)) {
- $block_params['is_first'] = $params['is_first'];
- }
-
- $block_params['separator'] = $params['separator'];
- $no_current = isset($params['no_current']) && $params['no_current'];
-
- $backup_category_id = $this->Application->GetVar('c_id');
- foreach ($category_path as $category_id => $category_name) {
- $block_params['cat_id'] = $category_id;
- $block_params['cat_name'] = $block_params['title'] = $category_name;
-
- if ($no_current) {
- $block_params['current'] = 0;
- }
- else {
- $block_params['current'] = ($main_category_id == $category_id) && !$module_item_id ? 1 : 0;
- }
-
- $block_params['is_module_root'] = $category_id == $module_category_id ? 1 : 0;
- $block_params['name'] = $this->SelectParam($params, 'render_as,block');
-
- // which block to parse as current ?
- if ($block_params['is_module_root']) {
- $block_params['name'] = $this->SelectParam($params, 'module_root_render_as,render_as');
- $block_params['module_index'] = $module_info['TemplatePath'].'index';
- }
-
- if ($block_params['current']) {
- $block_params['name'] = $this->SelectParam($params, 'current_render_as,render_as');
- }
-
- $this->Application->SetVar('c_id', $category_id);
- $ret .= $this->Application->ParseBlock($block_params);
-
- if (array_key_exists('is_first', $block_params)) {
- unset($block_params['is_first']);
- }
- }
-
- $this->Application->SetVar('c_id', $backup_category_id);
-
- return $ret;
- }
-
- /**
* Returns module information based on given module name or current category (relative to module root categories)
*
* @param Array $params
* @param Array $category_ids category parent path (already as array)
* @return Array
+ * @access public
*/
- function getCategoryModule($params, $category_ids)
+ public function getCategoryModule($params, $category_ids)
{
- if (isset($params['module'])) {
+ $module_info = Array ();
+
+ if ( isset($params['module']) ) {
// get module by name specified
$module_info = $this->Application->findModule('Name', $params['module']);
}
- elseif ($category_ids) {
+ elseif ( $category_ids ) {
// get module by category path
$module_root_categories = $this->getModuleRootCategories();
$common_categories = array_intersect($category_ids, $module_root_categories);
@@ -242,37 +59,18 @@
}
/**
- * Renders path to top catalog category
- *
- * @param Array $params
- * @param int $current_category
- * @return string
- */
- function getHomeCategoryPath($params, $current_category)
- {
- $block_params['cat_id'] = $this->Application->getBaseCategory();
- $block_params['no_editing'] = 1;
- $block_params['current'] = $current_category == $block_params['cat_id'] ? 1 : 0;
- $block_params['separator'] = $params['separator'];
- $block_params['is_first'] = $params['is_first'];
- $block_params['cat_name'] = $this->Application->Phrase(($this->Application->isAdmin ? 'la_' : 'lu_') . 'rootcategory_name');
- $block_params['name'] = $this->SelectParam($params, 'root_cat_render_as,render_as');
-
- return $this->Application->ParseBlock($block_params);
- }
-
- /**
* Returns root categories from all modules
*
* @return Array
+ * @access protected
*/
- function getModuleRootCategories()
+ protected function getModuleRootCategories()
{
static $root_categories = null;
- if (!isset($root_categories)) {
+ if ( !isset($root_categories) ) {
$root_categories = Array ();
- foreach ($this->Application->ModuleInfo as $module_name => $module_info) {
+ foreach ($this->Application->ModuleInfo as $module_info) {
array_push($root_categories, $module_info['RootCat']);
}
@@ -283,106 +81,27 @@
}
/**
- * Returns given category's parent path as array of id=>name elements
- *
- * @param int $main_category_id
- * @return Array
- */
- function getCategoryParentPath($main_category_id)
- {
- if ( $main_category_id == 0 ) {
- // don't query path for "Home" category
- return Array ();
- }
-
- $cache_key = 'parent_paths_named[%CIDSerial:' . $main_category_id . '%]';
- $cached_path = $this->Application->getCache($cache_key);
-
- if ( $cached_path === false ) {
- $ml_formatter = $this->Application->recallObject('kMultiLanguage');
- /* @var $ml_formatter kMultiLanguage */
-
- $navbar_field = $ml_formatter->LangFieldName('CachedNavBar');
-
- $id_field = $this->Application->getUnitOption('c', 'IDField');
- $table_name = $this->Application->getUnitOption('c', 'TableName');
-
- $this->Conn->nextQueryCachable = true;
- $sql = 'SELECT ' . $navbar_field . ', ParentPath
- FROM ' . $table_name . '
- WHERE ' . $id_field . ' = ' . $main_category_id;
- $category_data = $this->Conn->GetRow($sql);
-
- $cached_path = Array ();
- $skip_category = $this->Application->getBaseCategory();
-
- if ( $category_data ) {
- $category_names = explode('&|&', $category_data[$navbar_field]);
- $category_ids = explode('|', substr($category_data['ParentPath'], 1, -1));
-
- foreach ($category_ids as $category_index => $category_id) {
- if ( $category_id == $skip_category ) {
- continue;
- }
-
- $cached_path[$category_id] = $category_names[$category_index];
- }
- }
-
- $this->Application->setCache($cache_key, $cached_path);
- }
-
- return $cached_path;
- }
-
- /**
- * Not tag. Method for parameter selection from list in this TagProcessor
- *
- * @param Array $params
- * @param Array $possible_names
- *
- * @return string
- * @access protected
- */
- protected function SelectParam($params, $possible_names)
- {
- if ( !is_array($params) ) {
- return '';
- }
- if ( !is_array($possible_names) ) {
- $possible_names = explode(',', $possible_names);
- }
-
- foreach ($possible_names as $name) {
- if ( isset($params[$name]) ) {
- return $params[$name];
- }
- }
-
- return '';
- }
-
- /**
* Converts multi-dimensional category structure in one-dimensional option array (category_id=>category_name)
*
* @param Array $data
* @param int $parent_category_id
- * @param int_type $language_id
+ * @param int $language_id
* @param int $theme_id
* @param int $level
* @return Array
+ * @access protected
*/
- function _printChildren(&$data, $parent_category_id, $language_id, $theme_id, $level = 0)
+ protected function _printChildren(&$data, $parent_category_id, $language_id, $theme_id, $level = 0)
{
- if ($data['ThemeId'] != $theme_id && $data['ThemeId'] != 0) {
+ if ( $data['ThemeId'] != $theme_id && $data['ThemeId'] != 0 ) {
// don't show system templates from different themes
return Array ();
}
$category_language = $data['l' . $language_id . '_Name'] ? $language_id : $this->_primaryLanguageId;
- $ret = Array($parent_category_id => str_repeat('—', $level).' '.$data['l' . $category_language . '_Name']);
+ $ret = Array ($parent_category_id => str_repeat('—', $level) . ' ' . $data['l' . $category_language . '_Name']);
- if ($data['children']) {
+ if ( $data['children'] ) {
$level++;
foreach ($data['children'] as $category_id => $category_data) {
// numeric keys
@@ -399,8 +118,9 @@
* @param int $parent_category_id
* @param Array $languages
* @return Array
+ * @access protected
*/
- function _getChildren($parent_category_id, $languages)
+ protected function _getChildren($parent_category_id, $languages)
{
static $items_by_parent = null, $parent_mapping = null;
@@ -433,18 +153,18 @@
$index_category = $this->findIndexCategoryId($items_by_parent[$base_category]);
// rename "Content" into "Home" keeping it's ID
- $items_by_parent[ $parent_mapping[$base_category] ][$base_category]['l1_Name'] = $this->Application->Phrase('la_rootcategory_name');
+ $items_by_parent[$parent_mapping[$base_category]][$base_category]['l1_Name'] = $this->Application->Phrase('la_rootcategory_name');
// remove category of "index.tpl" template
unset($items_by_parent[$base_category][$index_category]);
unset($parent_mapping[$index_category]);
}
- $data = $items_by_parent[ $parent_mapping[$parent_category_id] ][$parent_category_id];
+ $data = $items_by_parent[$parent_mapping[$parent_category_id]][$parent_category_id];
$categories = array_key_exists($parent_category_id, $items_by_parent) ? $items_by_parent[$parent_category_id] : Array ();
foreach ($categories as $category_id => $category_data) {
- if ($category_id == $parent_category_id) {
+ if ( $category_id == $parent_category_id ) {
// don't process myself - prevents recursion
continue;
}
@@ -455,7 +175,14 @@
return $data;
}
- function findIndexCategoryId($top_categories)
+ /**
+ * Finds "Home" category among given top level categories
+ *
+ * @param Array $top_categories
+ * @return bool|int
+ * @access protected
+ */
+ protected function findIndexCategoryId($top_categories)
{
foreach ($top_categories as $category_id => $category_info) {
if ($category_info['Template'] == 'index') {
@@ -470,8 +197,9 @@
* Generates OR retrieves from cache structure tree
*
* @return Array
+ * @access protected
*/
- function &_getStructureTree()
+ protected function &_getStructureTree()
{
// get cached version of structure tree
if ( $this->Application->isCachingType(CACHING_TYPE_MEMORY) ) {
@@ -481,7 +209,7 @@
$data = $this->Application->getDBCache('StructureTree', CacheSettings::$structureTreeRebuildTime);
}
- if ($data) {
+ if ( $data ) {
$data = unserialize($data);
return $data;
@@ -495,7 +223,7 @@
$root_category = $this->Application->getBaseCategory();
$data = $this->_getChildren($root_category, $languages);
- if ($this->Application->isCachingType(CACHING_TYPE_MEMORY)) {
+ if ( $this->Application->isCachingType(CACHING_TYPE_MEMORY) ) {
$this->Application->setCache('master:StructureTree', serialize($data));
}
else {
@@ -505,7 +233,13 @@
return $data;
}
- function getTemplateMapping()
+ /**
+ * Returns template mapping (between physical and virtual pages)
+ *
+ * @return Array
+ * @access public
+ */
+ public function getTemplateMapping()
{
if ( $this->Application->isCachingType(CACHING_TYPE_MEMORY) ) {
$data = $this->Application->getCache('master:template_mapping', false, CacheSettings::$templateMappingRebuildTime);
@@ -537,10 +271,10 @@
foreach ($pages as $src_template => $page) {
// process external url, before placing in cache
- if ($page['UseExternalUrl']) {
+ if ( $page['UseExternalUrl'] ) {
$external_url = $page['ExternalUrl'];
- if (!preg_match('/^(.*?):\/\/(.*)$/', $external_url)) {
+ if ( !preg_match('/^(.*?):\/\/(.*)$/', $external_url) ) {
// url without protocol will be relative url to our site
$external_url = $base_url . $external_url;
}
@@ -554,7 +288,7 @@
$mapping[$src_template] = $dst_template;
}
- if ($this->Application->isCachingType(CACHING_TYPE_MEMORY)) {
+ if ( $this->Application->isCachingType(CACHING_TYPE_MEMORY) ) {
$data = $this->Application->setCache('master:template_mapping', serialize($mapping));
}
else {
@@ -568,16 +302,17 @@
* Returns category structure as field option list
*
* @return Array
+ * @access public
*/
- function getStructureTreeAsOptions()
+ public function getStructureTreeAsOptions()
{
- if ((defined('IS_INSTALL') && IS_INSTALL) || !$this->Application->isAdmin) {
+ if ( (defined('IS_INSTALL') && IS_INSTALL) || !$this->Application->isAdmin ) {
// no need to create category structure during install
// OR on Front-End, because it's not used there
return Array ();
}
- if (isset($this->_structureTree)) {
+ if ( isset($this->_structureTree) ) {
return $this->_structureTree;
}
@@ -599,10 +334,11 @@
*
* @param string $text
* @return string
+ * @access public
*/
- function replacePageIds($text)
+ public function replacePageIds($text)
{
- if (!preg_match_all('/@@(\\d+)@@/', $text, $regs)) {
+ if ( !preg_match_all('/@@(\\d+)@@/', $text, $regs) ) {
return $text;
}
Index: units/helpers/helpers_config.php
===================================================================
--- units/helpers/helpers_config.php (revision 15225)
+++ units/helpers/helpers_config.php (working copy)
@@ -39,6 +39,7 @@
Array ('pseudo' => 'ImageHelper', 'class' => 'ImageHelper', 'file' => 'image_helper.php', 'build_event' => ''),
Array ('pseudo' => 'FileHelper', 'class' => 'FileHelper', 'file' => 'file_helper.php', 'build_event' => ''),
Array ('pseudo' => 'CategoryHelper', 'class' => 'CategoryHelper', 'file' => 'category_helper.php', 'build_event' => ''),
+ Array ('pseudo' => 'kNavigationBar', 'class' => 'kNavigationBar', 'file' => 'navigation_bar.php', 'build_event' => ''),
Array ('pseudo' => 'CSVHelper', 'class' => 'kCSVHelper', 'file' => 'csv_helper.php', 'build_event' => ''),
Array ('pseudo' => 'ChartHelper', 'class' => 'kChartHelper', 'file' => 'chart_helper.php', 'build_event' => ''),
Array ('pseudo' => 'RatingHelper', 'class' => 'RatingHelper', 'file' => 'rating_helper.php', 'build_event' => ''),
Index: units/helpers/navigation_bar.php
===================================================================
--- units/helpers/navigation_bar.php (revision 0)
+++ units/helpers/navigation_bar.php (revision 0)
@@ -0,0 +1,374 @@
+<?php
+/**
+ * @version $Id$
+ * @package In-Portal
+ * @copyright Copyright (C) 1997 - 2012 Intechnic. All rights reserved.
+ * @license GNU/GPL
+ * In-Portal is Open Source software.
+ * This means that this software may have been modified pursuant
+ * the GNU General Public License, and as distributed it includes
+ * or is derivative of works licensed under the GNU General Public License
+ * or other free or open source software licenses.
+ * See http://www.in-portal.org/license for copyright notices and details.
+ */
+
+defined('FULL_PATH') or die('restricted access!');
+
+class kNavigationBar extends kBase {
+
+ /**
+ * Parameters to indicate how exactly navigation bar should look like
+ *
+ * @var Array
+ * @access protected
+ */
+ protected $_params = Array ();
+
+ /**
+ * Prints category path using given blocks. Also supports used defined path elements at the end.
+ *
+ * @param Array $params
+ * @return string
+ */
+ public function build($params)
+ {
+ // elements:
+ // - current_render_as - currently selected element (automatic detection)
+ // - render_as - link to a regular template
+ // - category_render_as - link to category path element
+ // - custom_render_as - link to custom element (that have "__" in front of them)
+ // - root_cat_render_as - link to Home page
+
+ $this->_params = $params;
+ $this->_params['is_first'] = 1;
+
+ $home_element = $this->_getHomeElement();
+
+ if ( !getArrayValue($this->_params, 'titles') && !getArrayValue($this->_params, 'templates') ) {
+ // no static templates given, show only category path
+ return $home_element . $this->getCategoryPath();
+ }
+
+ $ret = '';
+ $block_params = $this->_getBaseParams();
+ $current_template = $this->_getCurrentTemplate();
+ $navigation_parts = $this->getNavigationParts();
+
+ foreach ($navigation_parts as $template => $title) {
+ $block_params['template'] = $template;
+
+ if ( $title == '__categorypath__' ) {
+ $ret .= $this->getCategoryPath();
+ }
+ elseif ( substr($title, 0, 2) == '__' ) {
+ $block_params['title'] = $title;
+ $block_params['name'] = $this->SelectParam($this->_params, 'custom_render_as,render_as');
+
+ $ret .= $this->Application->ParseBlock($block_params);
+ }
+ else {
+ $is_current = $template == $current_template;
+ $block_params['current'] = $is_current;
+ $block_params['title'] = $this->Application->Phrase($title);
+ $block_params['name'] = $this->_params[$is_current ? 'current_render_as' : 'render_as'];
+
+ $ret .= $this->Application->ParseBlock($block_params);
+ }
+ }
+
+ return $home_element . $ret;
+ }
+
+ /**
+ * Returns base params for rendering each navigation bar element
+ *
+ * @return Array
+ * @access protected
+ */
+ protected function _getBaseParams()
+ {
+ $block_params = Array (
+ 'no_editing' => 1,
+ 'category' => 0,
+ 'separator' => $this->_params['separator'],
+ 'current' => 0,
+ );
+
+ return $block_params;
+ }
+
+ /**
+ * Returns the name of current physical template
+ *
+ * @return string
+ * @access protected
+ */
+ protected function _getCurrentTemplate()
+ {
+ $current_template = $this->Application->GetVar('t');
+ $physical_template = $this->Application->getPhysicalTemplate($current_template);
+
+ if ( $physical_template !== false ) {
+ // replace menu template name with it's actual template name on disk
+ list ($current_template) = explode(':', $physical_template, 2);
+ }
+
+ return $current_template;
+ }
+
+ /**
+ * Returns element for "Home" category
+ *
+ * @return string
+ * @access protected
+ */
+ protected function _getHomeElement()
+ {
+ if ( isset($this->_params['shift']) && $this->_params['shift'] ) {
+ $home_element = '';
+ $this->_params['shift']--;
+ }
+ else {
+ $home_element = $this->_getHomeCategoryPath();
+ unset($this->_params['is_first']);
+ }
+
+ return $home_element;
+ }
+
+ /**
+ * Renders path to top catalog category
+ *
+ * @return string
+ * @access protected
+ */
+ protected function _getHomeCategoryPath()
+ {
+ $block_params = $this->_getBaseParams();
+ $block_params['cat_id'] = $this->Application->getBaseCategory();
+ $block_params['current'] = $this->_getCurrentCategoryId() == $block_params['cat_id'] || $this->_getCurrentCategoryId() == 0 ? 1 : 0;
+ $block_params['is_first'] = $this->_params['is_first'];
+ $block_params['template'] = ''; // to prevent warning when category element is rendered using general "render_as" block
+
+ $category_name = $this->Application->Phrase(($this->Application->isAdmin ? 'la_' : 'lu_') . 'rootcategory_name');
+ $block_params['cat_name'] = $block_params['title'] = $category_name;
+
+ $block_params['name'] = $this->SelectParam($this->_params, 'root_cat_render_as,category_render_as,render_as');
+
+ if ( $block_params['current'] ) {
+ $block_params['name'] = $this->SelectParam($this->_params, 'current_render_as,render_as');
+ }
+
+ return $this->Application->ParseBlock($block_params);
+ }
+
+ /**
+ * Returns currently selected category
+ *
+ * @return mixed
+ */
+ protected function _getCurrentCategoryId()
+ {
+ return isset($this->_params['cat_id']) ? $this->_params['cat_id'] : $this->Application->GetVar('m_cat_id');
+ }
+
+ /**
+ * Get navigation parts
+ *
+ * @return Array
+ * @access protected
+ */
+ protected function getNavigationParts()
+ {
+ $titles = explode(',', $this->_params['titles']);
+ $templates = explode(',', $this->_params['templates']);
+
+ if ( getArrayValue($this->_params, 'show_category') && !in_array('__categorypath__', $titles) ) {
+ // insert before __item__ or first element, when __item__ isn't specified
+ $item_index = (int)array_search('__item__', $titles);
+ array_splice($titles, $item_index, 0, '__categorypath__');
+ array_splice($templates, $item_index, 0, '__categorypath__');
+ }
+
+ return array_combine($templates, $titles);
+ }
+
+ /**
+ * Renders path to given category using given blocks.
+ *
+ * @return string
+ * @access protected
+ */
+ protected function getCategoryPath()
+ {
+ $category_path = $this->getCategoryParentPath();
+
+ if ( !$category_path ) {
+ // in "Home" category
+ return '';
+ }
+
+ $main_category_id = $this->_getCurrentCategoryId();
+
+ if ( isset($this->_params['shift']) && $this->_params['shift'] ) {
+ array_splice($category_path, 0, $this->_params['shift']);
+ }
+
+ $category_helper = $this->Application->recallObject('CategoryHelper');
+ /* @var $category_helper CategoryHelper */
+
+ $module_info = $category_helper->getCategoryModule($this->_params, array_keys($category_path));
+ $module_item_id = $this->Application->GetVar($module_info['Var'] . '_id');
+
+ $ret = '';
+ $block_params = $this->_getBaseParams();
+ $block_params['category'] = 1;
+ $block_params['template'] = ''; // to prevent warning when category element is rendered using general "render_as" block
+
+ if ( isset($this->_params['is_first']) ) {
+ $block_params['is_first'] = $this->_params['is_first'];
+ }
+
+ $block_params['separator'] = $this->_params['separator'];
+ $no_current = isset($this->_params['no_current']) && $this->_params['no_current'];
+ $backup_category_id = $this->Application->GetVar('c_id');
+
+ foreach ($category_path as $category_id => $category_name) {
+ $block_params['cat_id'] = $category_id;
+ $block_params['cat_name'] = $block_params['title'] = $category_name;
+
+ if ( $no_current ) {
+ $block_params['current'] = 0;
+ }
+ else {
+ $block_params['current'] = ($main_category_id == $category_id) && !$module_item_id ? 1 : 0;
+ }
+
+ $block_params['name'] = $this->SelectParam($this->_params, 'category_render_as,render_as');
+
+ if ( $block_params['current'] ) {
+ $block_params['name'] = $this->SelectParam($this->_params, 'current_render_as,render_as');
+ }
+
+ $this->Application->SetVar('c_id', $category_id);
+ $ret .= $this->Application->ParseBlock($block_params);
+
+ if ( array_key_exists('is_first', $block_params) ) {
+ unset($block_params['is_first']);
+ }
+ }
+
+ $this->Application->SetVar('c_id', $backup_category_id);
+
+ return $ret;
+ }
+
+ /**
+ * Returns given category's parent path as array of id=>name elements
+ *
+ * @return Array
+ * @access protected
+ */
+ protected function getCategoryParentPath()
+ {
+ $main_category_id = $this->_getCurrentCategoryId();
+
+ if ( $main_category_id == 0 ) {
+ // don't query path for "Home" category
+ return Array ();
+ }
+
+ $category_title = isset($this->_params['category_title']) ? $this->_params['category_title'] : 'Name';
+ $cache_key = 'parent_paths_named[%CIDSerial:' . $main_category_id . '%]:' . $category_title;
+ $cached_path = $this->Application->getCache($cache_key);
+
+ if ( $cached_path === false ) {
+ $parent_path = explode('|', substr($this->getParentPath($main_category_id), 1, -1));
+
+ $ml_formatter = $this->Application->recallObject('kMultiLanguage');
+ /* @var $ml_formatter kMultiLanguage */
+
+ $navbar_field = $ml_formatter->LangFieldName($category_title);
+
+ $id_field = $this->Application->getUnitOption('c', 'IDField');
+ $table_name = $this->Application->getUnitOption('c', 'TableName');
+
+ $this->Conn->nextQueryCachable = true;
+ $sql = 'SELECT ' . $navbar_field . ', ' . $id_field . '
+ FROM ' . $table_name . '
+ WHERE ' . $id_field . ' IN (' . implode(',', $parent_path) . ')';
+ $category_names = $this->Conn->GetCol($sql, $id_field);
+
+ $cached_path = Array ();
+ $skip_category = $this->Application->getBaseCategory();
+
+ if ( $category_names ) {
+ foreach ($parent_path as $category_id) {
+ if ( $category_id == $skip_category ) {
+ continue;
+ }
+
+ $cached_path[$category_id] = $category_names[$category_id];
+ }
+ }
+
+ $this->Application->setCache($cache_key, $cached_path);
+ }
+
+ return $cached_path;
+ }
+
+ /**
+ * Returns parent path from a given category
+ *
+ * @param int $category_id
+ * @return string
+ * @access public
+ */
+ public function getParentPath($category_id)
+ {
+ $cache_key = 'parent_paths[%CIDSerial:' . $category_id . '%]';
+ $parent_path = $this->Application->getCache($cache_key);
+
+ if ( $parent_path !== false ) {
+ return $parent_path;
+ }
+
+ $this->Conn->nextQueryCachable = true;
+ $sql = 'SELECT ParentPath
+ FROM ' . $this->Application->getUnitOption('c', 'TableName') . '
+ WHERE ' . $this->Application->getUnitOption('c', 'IDField') . ' = ' . $category_id;
+ $parent_path = $this->Conn->GetOne($sql);
+
+ $this->Application->setCache($cache_key, $parent_path);
+
+ return $parent_path;
+ }
+
+ /**
+ * Not tag. Method for parameter selection from list in this TagProcessor
+ *
+ * @param Array $params
+ * @param Array $possible_names
+ *
+ * @return string
+ * @access protected
+ */
+ protected function SelectParam($params, $possible_names)
+ {
+ if ( !is_array($params) ) {
+ return '';
+ }
+ if ( !is_array($possible_names) ) {
+ $possible_names = explode(',', $possible_names);
+ }
+
+ foreach ($possible_names as $name) {
+ if ( isset($params[$name]) ) {
+ return $params[$name];
+ }
+ }
+
+ return '';
+ }
+}
\ No newline at end of file
Property changes on: units\helpers\navigation_bar.php
___________________________________________________________________
Added: svn:keywords
+ Id
Added: svn:eol-style
+ LF
Index: units/system_event_subscriptions/system_event_subscription_tp.php
===================================================================
--- units/system_event_subscriptions/system_event_subscription_tp.php (revision 15268)
+++ units/system_event_subscriptions/system_event_subscription_tp.php (working copy)
@@ -42,7 +42,10 @@
$params['cat_id'] = $category_id;
- return $this->Application->ProcessParsedTag('c', 'CategoryPath', $params);
+ $navigation_bar = $this->Application->recallObject('kNavigationBar');
+ /* @var $navigation_bar kNavigationBar */
+
+ return $navigation_bar->build($params);
}
/**
navigation_bar_refactoring_and_page_info_tag_fix_modules.patch [^] (684 bytes) 2012-04-05 08:12
[Show Content]
Index: in-link/units/listing_types/listing_types_tag_processor.php
===================================================================
--- in-link/units/listing_types/listing_types_tag_processor.php (revision 15165)
+++ in-link/units/listing_types/listing_types_tag_processor.php (working copy)
@@ -21,7 +21,10 @@
$object = $this->getObject($params);
$params['cat_id'] = $object->GetDBField($params['field']);
- return $this->Application->ProcessParsedTag('c', 'CategoryPath', $params);
+ $navigation_bar = $this->Application->recallObject('kNavigationBar');
+ /* @var $navigation_bar kNavigationBar */
+
+ return $navigation_bar->build($params);
}
/**
navigation_bar_refactoring_and_page_info_tag_fix_themes.patch [^] (22,512 bytes) 2012-04-05 08:12
[Show Content]
Index: advanced/platform/designs/default_design.des.tpl
===================================================================
--- advanced/platform/designs/default_design.des.tpl (revision 15256)
+++ advanced/platform/designs/default_design.des.tpl (working copy)
@@ -14,7 +14,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<inp2:m_DefineElement name="cms_page_title">
- <inp2:st_PageInfo type="htmlhead_title"/>
+ <inp2:st_PageInfo type="htmlhead_title" html_escape="1"/>
</inp2:m_DefineElement>
<title><inp2:m_GetConfig name="Site_Name"/> :: <inp2:m_RenderElement name="page_title" default_element="cms_page_title" no_editing="1"/></title>
@@ -39,7 +39,7 @@
</script>
<inp2:m_DefineElement name="default_add_to_head"></inp2:m_DefineElement>
- <inp2:m_RenderElement name="add_to_head" default_element="default_add_to_head"/>
+ <inp2:m_RenderElement name="add_to_head" default_element="default_add_to_head" no_editing="1"/>
<inp2:st_EditingScripts/>
<!--## /Include module specific HEADER template ##-->
Index: advanced/platform/designs/form.tpl
===================================================================
--- advanced/platform/designs/form.tpl (revision 15246)
+++ advanced/platform/designs/form.tpl (working copy)
@@ -10,12 +10,6 @@
<inp2:m_include template="platform/elements/dynamic_forms.elm"/>
-<!--## PAGE TITLE ELEMENT ##-->
-<inp2:m_DefineElement name="page_title">
- <inp2:st_PageInfo type="title"/>
-</inp2:m_DefineElement>
-<!--## //PAGE TITLE ELEMENT ##-->
-
<!--## SIDE-BAR ELEMENT ##-->
<inp2:m_DefineElement name="sidebar">
<div class="movable-area">
Index: advanced/platform/designs/general.tpl
===================================================================
--- advanced/platform/designs/general.tpl (revision 15246)
+++ advanced/platform/designs/general.tpl (working copy)
@@ -3,11 +3,6 @@
<DESC>General</DESC>
<SECTION>Platform</SECTION>
##-->
-<!--## PAGE TITLE ELEMENT ##-->
-<inp2:m_DefineElement name="page_title">
- <inp2:st_PageInfo type="title"/>
-</inp2:m_DefineElement>
-<!--## //PAGE TITLE ELEMENT ##-->
<!--## SIDE-BAR ELEMENT ##-->
<inp2:m_DefineElement name="sidebar">
Index: advanced/platform/elements/forms.elm.tpl
===================================================================
--- advanced/platform/elements/forms.elm.tpl (revision 15246)
+++ advanced/platform/elements/forms.elm.tpl (working copy)
@@ -580,23 +580,23 @@
<inp2:m_RenderElement name="inp_edit_field_separator" is_last="$is_last"/>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="primary_category">
- <inp2:m_param name="separator"/> <inp2:m_param name="title"/>
-</inp2:m_DefineElement>
+<inp2:m_DefineElement name="ci_category_element">
+ <inp2:m_ifnot check="m_Param" name="is_first">
+ <inp2:m_param name="separator"/>
+ </inp2:m_ifnot>
-<inp2:m_DefineElement name="primary_root_category">
- <inp2:m_Phrase name="lu_rootcategory_name"/>
+ <inp2:m_param name="title"/>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="inp_pr_category_label" no_editing="1" is_last="0" editing="0">
<tr class="<inp2:m_odd_even odd="table_color1" even="table_color2"/>">
<inp2:m_RenderElement name="inp_edit_field_caption" prefix="$prefix" field="$field" title="$title"/>
<td valign="top" class="field-value">
- <inp2:m_if check="m_Param" name="editing">
- <inp2:{$prefix}_CategoryName />
- <inp2:m_else />
- <inp2:c_CategoryPath separator=">" render_as="primary_category" root_cat_render_as="primary_root_category" titles="$titles" />
- </inp2:m_if>
+ <inp2:m_if check="m_Param" name="editing">
+ <inp2:{$prefix}_CategoryName />
+ <inp2:m_else />
+ <inp2:c_CategoryPath separator=">" render_as="ci_category_element"/>
+ </inp2:m_if>
</td>
</tr>
<inp2:m_RenderElement name="inp_edit_field_separator" is_last="$is_last"/>
Index: advanced/platform/elements/navigation_bar.elm.tpl
===================================================================
--- advanced/platform/elements/navigation_bar.elm.tpl (revision 15246)
+++ advanced/platform/elements/navigation_bar.elm.tpl (working copy)
@@ -1,38 +1,70 @@
-<inp2:m_DefaultParam titles="" templates="" show_category="0"/>
+<inp2:m_DefaultParam titles="" templates="" show_category="0" category_title="MenuTitle"/>
-<inp2:m_DefineElement name="root_category">
- <img src="<inp2:m_TemplatesBase module="In-Portal"/>img/icon_home.gif" width="9" height="9" alt=""/> <a href="<inp2:c_CategoryLink template="__default__" />"><inp2:m_Phrase name="lu_rootcategory_name"/></a>
+<inp2:m_DefineElement name="nb_root_category_element">
+ <img src="<inp2:m_TemplatesBase module='In-Portal'/>img/icon_home.gif" width="9" height="9" alt=""/>
+
+ <inp2:m_if check="m_Param" name="current">
+ <inp2:m_Param name="cat_name"/>
+ <inp2:m_else/>
+ <a href="<inp2:c_CategoryLink template='__default__'/>"><inp2:m_Param name="title"/></a>
+ </inp2:m_if>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="module_root">
- <inp2:m_param name="separator"/>
- <a href="<inp2:c_CategoryLink template="$module_index" cat_id="$cat_id"/>"><inp2:m_param name="title"/></a>
+<inp2:m_DefineElement name="nb_current_element">
+ <inp2:m_ifnot check="m_Param" name="is_first">
+ <inp2:m_param name="separator"/>
+ </inp2:m_ifnot>
+
+ <span><inp2:m_param name="title"/></span>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="nav_link">
- <inp2:m_param name="separator"/>
- <inp2:m_if check="m_Param" name="category">
- <a href="<inp2:c_CategoryLink template="__default__" m_cat_page="1"/>"><inp2:m_param name="title"/></a>
- <inp2:m_else/>
- <a href="<inp2:m_Link template="$template" m_cat_id="0" m_cat_page="1"/>"><inp2:m_param name="title"/></a>
- </inp2:m_if>
+<inp2:m_DefineElement name="nb_element">
+ <inp2:m_ifnot check="m_Param" name="is_first">
+ <inp2:m_param name="separator"/>
+ </inp2:m_ifnot>
+
+ <a href="<inp2:m_Link template='$template' m_cat_id='0" m_cat_page='1'/>"><inp2:m_param name="title"/></a>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="module_item">
- <inp2:m_param name="separator"/>
+<inp2:m_DefineElement name="nb_category_element">
+ <inp2:m_ifnot check="m_Param" name="is_first">
+ <inp2:m_param name="separator"/>
+ </inp2:m_ifnot>
+
+ <a href="<inp2:c_CategoryLink template='__default__' m_cat_page='1'/>"><inp2:m_param name="title"/></a>
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="nb_module_item_element">
<a href="<inp2:{$prefix}_ItemLink template="$template" />"><inp2:m_param name="title"/></a>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="current_item">
- <inp2:m_param name="separator"/>
- <span> <inp2:m_param name="title"/></span>
+<inp2:m_DefineElement name="nb_custom_element">
+ <inp2:m_ifnot check="m_Param" name="is_first">
+ <inp2:m_param name="separator"/>
+ </inp2:m_ifnot>
+
+ <inp2:m_if check="m_Param" name="title" equals_to="__page__">
+ <a href="<inp2:m_Link template='$template' m_cat_id='0' m_cat_page='1'/>"><inp2:st_PageInfo type="title"/></a>
+ <inp2:m_elseif check="m_Param" name="title" equals_to="__item__"/>
+ <inp2:c_CategoryItemElement render_as="nb_module_item_element" pass_params="1"/>
+ </inp2:m_if>
</inp2:m_DefineElement>
<table class="fullwidth groupItem">
<tr class="movable-header">
<td class="navigation-bar">
- <!-- module_root_render_as="module_root" -->
- <inp2:c_CategoryPath separator=">" render_as="nav_link" current_render_as="current_item" module_item_render_as="module_item" root_cat_render_as="root_category" titles="$titles" templates="$templates" show_category="$show_category"/>
+ <inp2:c_CategoryPath
+ separator=">"
+ render_as="nb_element"
+ current_render_as="nb_current_element"
+
+ root_cat_render_as="nb_root_category_element"
+ category_render_as="nb_category_element"
+ custom_render_as="nb_custom_element"
+
+ titles="$titles" templates="$templates"
+ show_category="$show_category" category_title="$category_title"
+ />
</td>
</tr>
</table>
\ No newline at end of file
Index: advanced/platform/elements/title_bar.elm.tpl
===================================================================
--- advanced/platform/elements/title_bar.elm.tpl (revision 15246)
+++ advanced/platform/elements/title_bar.elm.tpl (working copy)
@@ -1,17 +1,9 @@
-<inp2:m_DefineElement name="pagetitle_category_caption">
- <inp2:m_if check="m_ParamEquals" name="cat_id" value="0" inverse="inverse">
- <inp2:m_if check="m_ParamEquals" name="is_module_root" value="0">
- <inp2:m_param name="separator"/>
- </inp2:m_if>
- </inp2:m_if>
- <inp2:m_param name="cat_name"/>
-</inp2:m_DefineElement>
+<inp2:m_DefineElement name="nb_titlebar_element">
+ <inp2:m_ifnot check="m_Param" name="is_first">
+ <inp2:m_param name="separator"/>
+ </inp2:m_ifnot>
-<inp2:m_DefineElement name="pagetitle_root_category">
-</inp2:m_DefineElement>
-
-<inp2:m_DefineElement name="pagetitle_module_root">
<inp2:m_param name="cat_name"/>
</inp2:m_DefineElement>
-<inp2:c_CategoryPath separator=" > " render_as="pagetitle_category_caption" root_cat_render_as="pagetitle_root_category" module_root_render_as="pagetitle_module_root" />
\ No newline at end of file
+<inp2:c_CategoryPath separator=" > " render_as="nb_titlebar_element" strip_nl="2"/>
\ No newline at end of file
Index: advanced/platform/my_account/restore_email.tpl
===================================================================
--- advanced/platform/my_account/restore_email.tpl (revision 15246)
+++ advanced/platform/my_account/restore_email.tpl (working copy)
@@ -4,12 +4,6 @@
<SECTION>My Account</SECTION>
##-->
-<!--## PAGE TITLE ELEMENT ##-->
-<inp2:m_DefineElement name="page_title">
- <inp2:st_PageInfo type="htmlhead_title"/>
-</inp2:m_DefineElement>
-<!--## //PAGE TITLE ELEMENT ##-->
-
<!--## SIDE-BAR ELEMENT ##-->
<inp2:m_DefineElement name="sidebar">
<div class="movable-area">
Index: advanced/platform/my_account/verify_email.tpl
===================================================================
--- advanced/platform/my_account/verify_email.tpl (revision 15246)
+++ advanced/platform/my_account/verify_email.tpl (working copy)
@@ -4,12 +4,6 @@
<SECTION>My Account</SECTION>
##-->
-<!--## PAGE TITLE ELEMENT ##-->
-<inp2:m_DefineElement name="page_title">
- <inp2:st_PageInfo type="htmlhead_title"/>
-</inp2:m_DefineElement>
-<!--## //PAGE TITLE ELEMENT ##-->
-
<!--## SIDE-BAR ELEMENT ##-->
<inp2:m_DefineElement name="sidebar">
<div class="movable-area">
Index: default/designs/default_design.des.tpl
===================================================================
--- default/designs/default_design.des.tpl (revision 15246)
+++ default/designs/default_design.des.tpl (working copy)
@@ -5,7 +5,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<inp2:lang.current_Field name="Locale" db="1"/>" lang="<inp2:lang.current_Field name="Locale" db="1"/>">
<head>
<title>
- <inp2:st_PageInfo type="title"/> (<inp2:m_GetConfig name="Site_Name"/>)
+ <inp2:st_PageInfo type="htmlhead_title" html_escape="1"/> (<inp2:m_GetConfig name="Site_Name"/>)
</title>
<inp2:m_Include template="elements/html_head.elm" />
Index: modern-store/elements/content_boxes.elm.tpl
===================================================================
--- modern-store/elements/content_boxes.elm.tpl (revision 15246)
+++ modern-store/elements/content_boxes.elm.tpl (working copy)
@@ -7,8 +7,6 @@
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="default_page_title"><inp2:m_GetConfig name="Site_Name"/> — <inp2:st_PageInfo type="htmlhead_title"/></inp2:m_DefineElement>
-
<inp2:m_DefineElement name="default_add_to_footer" no_editing="1">
</inp2:m_DefineElement>
@@ -19,7 +17,7 @@
</inp2:m_DefineElement>
<inp2:m_DefineElement name="default_page_title">
- <inp2:st_PageInfo type="htmlhead_title"/>
+ <inp2:st_PageInfo type="htmlhead_title" html_escape="1"/>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="image_element">
Index: modern-store/elements/navigation_bar.elm.tpl
===================================================================
--- modern-store/elements/navigation_bar.elm.tpl (revision 15246)
+++ modern-store/elements/navigation_bar.elm.tpl (working copy)
@@ -1,35 +1,60 @@
-<inp2:m_DefaultParam titles="" templates="" show_category="0" navigation_buttons="0"/>
+<inp2:m_DefaultParam titles="" templates="" show_category="0" navigation_buttons="0" category_title="MenuTitle"/>
-<inp2:m_DefineElement name="root_category">
- <a href="<inp2:c_CategoryLink template="__default__" />"><inp2:m_Phrase name="lu_rootcategory_name"/></a>
+<inp2:m_DefineElement name="nb_current_element">
+ <inp2:m_ifnot check="m_Param" name="is_first">
+ <i></i>
+ </inp2:m_ifnot>
+
+ <em><inp2:m_param name="title"/></em>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="module_root">
- <i></i> <a href="<inp2:c_CategoryLink template="$module_index" cat_id="$cat_id"/>"><inp2:m_param name="title"/></a>
+<inp2:m_DefineElement name="nb_element">
+ <inp2:m_ifnot check="m_Param" name="is_first">
+ <i></i>
+ </inp2:m_ifnot>
+
+ <a href="<inp2:m_Link template='$template' m_cat_id='0" m_cat_page='1'/>"><inp2:m_param name="title"/></a>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="nav_link">
- <i></i>
- <inp2:m_if check="m_Param" name="category">
- <a href="<inp2:c_CategoryLink template="__default__" m_cat_page="1"/>"><inp2:m_param name="title"/></a>
- <inp2:m_else/>
- <a href="<inp2:m_Link template="$template" m_cat_id="0" m_cat_page="1"/>"><inp2:m_param name="title"/></a>
- </inp2:m_if>
+<inp2:m_DefineElement name="nb_category_element">
+ <inp2:m_ifnot check="m_Param" name="is_first">
+ <i></i>
+ </inp2:m_ifnot>
+
+ <a href="<inp2:c_CategoryLink template='__default__' m_cat_page='1'/>"><inp2:m_param name="title"/></a>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="module_item">
- <i></i> <a href="<inp2:{$prefix}_ItemLink template="$template" />"><inp2:m_param name="title"/></a>
+<inp2:m_DefineElement name="nb_module_item_element">
+ <a href="<inp2:{$prefix}_ItemLink template="$template" />"><inp2:m_param name="title"/></a>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="current_item">
- <i></i> <em><inp2:m_param name="title"/></em>
+<inp2:m_DefineElement name="nb_custom_element">
+ <inp2:m_ifnot check="m_Param" name="is_first">
+ <i></i>
+ </inp2:m_ifnot>
+
+ <inp2:m_if check="m_Param" name="title" equals_to="__page__">
+ <a href="<inp2:m_Link template='$template' m_cat_id='0' m_cat_page='1'/>"><inp2:st_PageInfo type="title"/></a>
+ <inp2:m_elseif check="m_Param" name="title" equals_to="__item__"/>
+ <inp2:c_CategoryItemElement render_as="nb_module_item_element" pass_params="1"/>
+ </inp2:m_if>
</inp2:m_DefineElement>
<h2>
- <inp2:c_CategoryPath separator="" render_as="nav_link" current_render_as="current_item" module_item_render_as="module_item" root_cat_render_as="root_category" module_root_render_as="html:" titles="$titles" templates="$templates" show_category="$show_category"/><span></span>
+ <inp2:c_CategoryPath
+ separator=""
+ render_as="nb_element"
+ current_render_as="nb_current_element"
-<inp2:m_if check="m_Param" name="navigation_buttons">
- <inp2:m_RenderElement name="prev_next_element" prefix="p" id_field="ProductId" special="product-navigation" main_list="1"/>
-</inp2:m_if>
+ category_render_as="nb_category_element"
+ custom_render_as="nb_custom_element"
+ titles="$titles" templates="$templates"
+ show_category="$show_category" category_title="$category_title"
+ />
+ <span></span>
+
+ <inp2:m_if check="m_Param" name="navigation_buttons">
+ <inp2:m_RenderElement name="prev_next_element" prefix="p" id_field="ProductId" special="product-navigation" main_list="1"/>
+ </inp2:m_if>
</h2>
\ No newline at end of file
Index: modern-store/elements/title_bar.elm.tpl
===================================================================
--- modern-store/elements/title_bar.elm.tpl (revision 15246)
+++ modern-store/elements/title_bar.elm.tpl (working copy)
@@ -1,12 +1,9 @@
-<inp2:m_DefineElement name="pagetitle_category_caption">
- <inp2:m_if check="m_ParamEquals" name="cat_id" value="0" inverse="inverse">
- <inp2:m_if check="m_ParamEquals" name="is_module_root" value="0"><inp2:m_param name="separator"/></inp2:m_if>
- </inp2:m_if>
+<inp2:m_DefineElement name="nb_titlebar_element">
+ <inp2:m_ifnot check="m_Param" name="is_first">
+ <inp2:m_param name="separator"/>
+ </inp2:m_ifnot>
+
<inp2:m_param name="cat_name"/>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="pagetitle_root_category"> </inp2:m_DefineElement>
-
-<inp2:m_DefineElement name="pagetitle_module_root"><inp2:m_param name="cat_name"/></inp2:m_DefineElement>
-
-<inp2:c_CategoryPath separator=" > " render_as="pagetitle_category_caption" root_cat_render_as="pagetitle_root_category" module_root_render_as="pagetitle_module_root" />
\ No newline at end of file
+<inp2:c_CategoryPath separator=" > " render_as="nb_titlebar_element" strip_nl="2"/>
\ No newline at end of file
Index: modern-store/index.tpl
===================================================================
--- modern-store/index.tpl (revision 15246)
+++ modern-store/index.tpl (working copy)
@@ -4,10 +4,6 @@
<SECTION></SECTION>
##-->
-<!--## PAGE TITLE ELEMENT ##-->
-<inp2:m_DefineElement name="page_title"><inp2:st_PageInfo type="htmlhead_title"/></inp2:m_DefineElement>
-<!--## //PAGE TITLE ELEMENT ##-->
-
<!--## SIDE-BAR ELEMENT ##-->
<inp2:m_DefineElement name="sidebar">
<inp2:m_Include template="elements/side_boxes/categories.elm" data_exists="1"/>
Index: modern-store/products/compare.tpl
===================================================================
--- modern-store/products/compare.tpl (revision 15246)
+++ modern-store/products/compare.tpl (working copy)
@@ -3,7 +3,6 @@
<DESC>Product comparison page</DESC>
<SECTION>Pages||Compare Products</SECTION>
##-->
-<inp2:m_DefineElement name="page_title"><inp2:st_PageInfo type="htmlhead_title" html_escape="1"/></inp2:m_DefineElement>
<!--## MAIN CONTENT ##-->
<inp2:m_DefineElement name="content">
Index: simple/designs/default_design.des.tpl
===================================================================
--- simple/designs/default_design.des.tpl (revision 15246)
+++ simple/designs/default_design.des.tpl (working copy)
@@ -8,7 +8,7 @@
<head>
<title>
- <inp2:st_PageInfo type="title"/> (<inp2:m_GetConfig name="Site_Name"/>)
+ <inp2:st_PageInfo type="htmlhead_title" html_escape="1"/> (<inp2:m_GetConfig name="Site_Name"/>)
</title>
Index: simple/designs/default_design_inner.des.tpl
===================================================================
--- simple/designs/default_design_inner.des.tpl (revision 15246)
+++ simple/designs/default_design_inner.des.tpl (working copy)
@@ -8,7 +8,7 @@
<head>
<title>
- <inp2:st_PageInfo type="title"/> (<inp2:m_GetConfig name="Site_Name"/>)
+ <inp2:st_PageInfo type="htmlhead_title" html_escape="1"/> (<inp2:m_GetConfig name="Site_Name"/>)
</title>
Index: simple/elements/navigation_bar.elm.tpl
===================================================================
--- simple/elements/navigation_bar.elm.tpl (revision 15246)
+++ simple/elements/navigation_bar.elm.tpl (working copy)
@@ -1,33 +1,55 @@
-<inp2:m_DefaultParam titles="" templates="" show_category="0"/>
+<inp2:m_DefaultParam titles="" templates="" show_category="0" category_title="MenuTitle"/>
-<inp2:m_DefineElement name="root_category">
- <a href="<inp2:c_CategoryLink template="__default__" />"><inp2:m_Phrase name="lu_rootcategory_name"/></a>
+<inp2:m_DefineElement name="nb_current_element">
+ <inp2:m_ifnot check="m_Param" name="is_first">
+ <inp2:m_param name="separator"/>
+ </inp2:m_ifnot>
+
+ <inp2:m_param name="title"/>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="module_root">
- <inp2:m_param name="separator"/>
- <a href="<inp2:c_CategoryLink template="$module_index" cat_id="$cat_id"/>"><inp2:m_param name="title"/></a>
+<inp2:m_DefineElement name="nb_element">
+ <inp2:m_ifnot check="m_Param" name="is_first">
+ <inp2:m_param name="separator"/>
+ </inp2:m_ifnot>
+
+ <a href="<inp2:m_Link template='$template' m_cat_id='0" m_cat_page='1'/>"><inp2:m_param name="title"/></a>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="nav_link">
- <inp2:m_param name="separator"/>
- <inp2:m_if check="m_Param" name="category">
- <a href="<inp2:c_CategoryLink template="__default__" m_cat_page="1"/>"><inp2:m_param name="title"/></a>
- <inp2:m_else/>
- <a href="<inp2:m_Link template="$template" m_cat_id="0" m_cat_page="1"/>"><inp2:m_param name="title"/></a>
- </inp2:m_if>
+<inp2:m_DefineElement name="nb_category_element">
+ <inp2:m_ifnot check="m_Param" name="is_first">
+ <inp2:m_param name="separator"/>
+ </inp2:m_ifnot>
+
+ <a href="<inp2:c_CategoryLink template='__default__' m_cat_page='1'/>"><inp2:m_param name="title"/></a>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="module_item">
- <inp2:m_param name="separator"/>
+<inp2:m_DefineElement name="nb_module_item_element">
<a href="<inp2:{$prefix}_ItemLink template="$template" />"><inp2:m_param name="title"/></a>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="current_item">
- <inp2:m_param name="separator"/>
- <inp2:m_param name="title"/>
+<inp2:m_DefineElement name="nb_custom_element">
+ <inp2:m_ifnot check="m_Param" name="is_first">
+ <inp2:m_param name="separator"/>
+ </inp2:m_ifnot>
+
+ <inp2:m_if check="m_Param" name="title" equals_to="__page__">
+ <a href="<inp2:m_Link template='$template' m_cat_id='0' m_cat_page='1'/>"><inp2:st_PageInfo type="title"/></a>
+ <inp2:m_elseif check="m_Param" name="title" equals_to="__item__"/>
+ <inp2:c_CategoryItemElement render_as="nb_module_item_element" pass_params="1"/>
+ </inp2:m_if>
</inp2:m_DefineElement>
<p id="breadcrumb">
- <inp2:c_CategoryPath separator=">" render_as="nav_link" current_render_as="current_item" module_item_render_as="module_item" root_cat_render_as="root_category" titles="$titles" templates="$templates" show_category="$show_category"/>
-</p>
+ <inp2:c_CategoryPath
+ separator=">"
+ render_as="nb_element"
+ current_render_as="nb_current_element"
+
+ category_render_as="nb_category_element"
+ custom_render_as="nb_custom_element"
+
+ titles="$titles" templates="$templates"
+ show_category="$show_category" category_title="$category_title"
+ />
+</p>
\ No newline at end of file
current_template_not_detected_in_custom_navbar_block_core.patch [^] (1,239 bytes) 2012-04-08 15:44
[Show Content]
Index: navigation_bar.php
===================================================================
--- navigation_bar.php (revision 15274)
+++ navigation_bar.php (working copy)
@@ -60,18 +60,19 @@
if ( $title == '__categorypath__' ) {
$ret .= $this->getCategoryPath();
}
- elseif ( substr($title, 0, 2) == '__' ) {
- $block_params['title'] = $title;
- $block_params['name'] = $this->SelectParam($this->_params, 'custom_render_as,render_as');
-
- $ret .= $this->Application->ParseBlock($block_params);
- }
else {
$is_current = $template == $current_template;
$block_params['current'] = $is_current;
- $block_params['title'] = $this->Application->Phrase($title);
- $block_params['name'] = $this->_params[$is_current ? 'current_render_as' : 'render_as'];
+ if ( substr($title, 0, 2) == '__' ) {
+ $block_params['title'] = $title;
+ $block_params['name'] = $this->SelectParam($this->_params, 'custom_render_as,render_as');
+ }
+ else {
+ $block_params['title'] = $this->Application->Phrase($title);
+ $block_params['name'] = $this->_params[$is_current ? 'current_render_as' : 'render_as'];
+ }
+
$ret .= $this->Application->ParseBlock($block_params);
}
}
current_template_not_detected_in_custom_navbar_block_themes.patch [^] (1,361 bytes) 2012-04-08 15:45
[Show Content]
Index: platform/elements/navigation_bar.elm.tpl
===================================================================
--- platform/elements/navigation_bar.elm.tpl (revision 15269)
+++ platform/elements/navigation_bar.elm.tpl (working copy)
@@ -35,7 +35,11 @@
</inp2:m_DefineElement>
<inp2:m_DefineElement name="nb_module_item_element">
- <a href="<inp2:{$prefix}_ItemLink template="$template" />"><inp2:m_param name="title"/></a>
+ <inp2:m_if check="m_Param" name="current">
+ <span><inp2:m_param name="title"/></span>
+ <inp2:m_else/>
+ <a href="<inp2:{$prefix}_ItemLink template="$template" />"><inp2:m_param name="title"/></a>
+ </inp2:m_if>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="nb_custom_element">
@@ -44,7 +48,11 @@
</inp2:m_ifnot>
<inp2:m_if check="m_Param" name="title" equals_to="__page__">
- <a href="<inp2:m_Link template='$template' m_cat_id='0' m_cat_page='1'/>"><inp2:st_PageInfo type="title"/></a>
+ <inp2:m_if check="m_Param" name="current">
+ <span><inp2:st_PageInfo type="title"/></span>
+ <inp2:m_else/>
+ <a href="<inp2:m_Link template='$template' m_cat_id='0' m_cat_page='1'/>"><inp2:st_PageInfo type="title"/></a>
+ </inp2:m_if>
<inp2:m_elseif check="m_Param" name="title" equals_to="__item__"/>
<inp2:c_CategoryItemElement render_as="nb_module_item_element" pass_params="1"/>
</inp2:m_if>
|