Index: branches/unlabeled/unlabeled-1.9.2/core/units/categories/categories_item.php =================================================================== diff -u -N -r5615 -r5635 --- branches/unlabeled/unlabeled-1.9.2/core/units/categories/categories_item.php (.../categories_item.php) (revision 5615) +++ branches/unlabeled/unlabeled-1.9.2/core/units/categories/categories_item.php (.../categories_item.php) (revision 5635) @@ -133,8 +133,8 @@ { if ( !$this->GetDBField('AutomaticFilename') && $this->GetDBField('Filename') ) return false; - $title_field = $this->Application->getUnitOption($this->Prefix, 'TitleField'); - $name = $this->stripDisallowed( $this->GetDBField($title_field) ); + $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); + $name = $this->stripDisallowed( $this->GetDBField( $ml_formatter->LangFieldName('Name', true) ) ); if ( $name != $this->GetDBField('Filename') ) $this->SetDBField('Filename', $name); } Index: branches/unlabeled/unlabeled-1.9.2/kernel/units/categories/categories_item.php =================================================================== diff -u -N -r5615 -r5635 --- branches/unlabeled/unlabeled-1.9.2/kernel/units/categories/categories_item.php (.../categories_item.php) (revision 5615) +++ branches/unlabeled/unlabeled-1.9.2/kernel/units/categories/categories_item.php (.../categories_item.php) (revision 5635) @@ -133,8 +133,8 @@ { if ( !$this->GetDBField('AutomaticFilename') && $this->GetDBField('Filename') ) return false; - $title_field = $this->Application->getUnitOption($this->Prefix, 'TitleField'); - $name = $this->stripDisallowed( $this->GetDBField($title_field) ); + $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); + $name = $this->stripDisallowed( $this->GetDBField( $ml_formatter->LangFieldName('Name', true) ) ); if ( $name != $this->GetDBField('Filename') ) $this->SetDBField('Filename', $name); } Index: branches/unlabeled/unlabeled-1.6.2/core/units/categories/cache_updater.php =================================================================== diff -u -N -r5631 -r5635 --- branches/unlabeled/unlabeled-1.6.2/core/units/categories/cache_updater.php (.../cache_updater.php) (revision 5631) +++ branches/unlabeled/unlabeled-1.6.2/core/units/categories/cache_updater.php (.../cache_updater.php) (revision 5635) @@ -136,18 +136,22 @@ var $doneCats; var $table; + var $primaryLanguageId = 0; + var $languageCount = 0; var $root_prefixes = Array(); - var $TitleField = ''; function Init($prefix, $special, $event_params = null) { parent::Init($prefix, $special, $event_params); - $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); - $this->TitleField = $ml_formatter->LangFieldName('Name'); - $continuing = $event_params['continue']; + // cache widely used values to speed up process: begin + $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); + $this->languageCount = $ml_helper->getLanguageCount(); + $this->primaryLanguageId = $this->Application->GetDefaultLanguageId(); + // cache widely used values to speed up process: end + foreach ($this->Application->ModuleInfo as $module_name => $module_info) { $this->root_prefixes[ $module_info['RootCat'] ] = $module_info['Var']; } @@ -226,7 +230,7 @@ $data = $this->Stack->Get(); if ($data === false) { //If Stack is empty $data['current_id'] = 0; - $data['title'] = Array(); + $data['titles'] = Array(); $data['parent_path'] = Array(); $data['named_path'] = Array(); $data['category_template'] = ''; @@ -253,7 +257,7 @@ // if we have more children if (isset($data['children'][$data['current_child']])) { $next_data = Array(); - $next_data['title'] = $data['title']; + $next_data['titles'] = $data['titles']; $next_data['parent_path'] = $data['parent_path']; $next_data['named_path'] = $data['named_path']; $next_data['category_template'] = $data['category_template']; @@ -276,26 +280,37 @@ function UpdateCachedPath(&$data) { - $fields_hash = Array( 'CachedNavbar' => implode('>', $data['title']), - 'ParentPath' => '|'.implode('|', $data['parent_path']).'|', - 'NamedParentPath' => implode('/', $data['named_path'] ), - 'CachedCategoryTemplate'=> $data['category_template'], - 'CachedItemTemplate' => $data['item_template'], + $fields_hash = Array ( + 'ParentPath' => '|'.implode('|', $data['parent_path']).'|', + 'NamedParentPath' => implode('/', $data['named_path'] ), + 'CachedCategoryTemplate' => $data['category_template'], + 'CachedItemTemplate' => $data['item_template'], ); - + + $i = 1; + while ($i <= $this->languageCount) { + $fields_hash['l'.$i.'_CachedNavbar'] = implode('>', $data['titles'][$i]); + $i++; + } + $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$data['current_id']); } function QueryTitle(&$data) { $category_id = $data['current_id']; - $sql = 'SELECT '.$this->TitleField.', Filename, CategoryTemplate, ItemTemplate + $sql = 'SELECT * FROM '.TABLE_PREFIX.'Category WHERE CategoryId = '.$category_id; $record = $this->Conn->GetRow($sql); if ($record) { - $data['title'][] = $record[$this->TitleField]; + $i = 1; + while ($i <= $this->languageCount) { + $data['titles'][$i][] = $record['l'.$i.'_Name'] ? $record['l'.$i.'_Name'] : $record['l'.$this->primaryLanguageId.'_Name']; + $i++; + } + $data['parent_path'][] = $category_id; $data['named_path'][] = $record['Filename']; Index: branches/unlabeled/unlabeled-1.10.2/kernel/admin_templates/incs/tree.js =================================================================== diff -u -N -r5297 -r5635 --- branches/unlabeled/unlabeled-1.10.2/kernel/admin_templates/incs/tree.js (.../tree.js) (revision 5297) +++ branches/unlabeled/unlabeled-1.10.2/kernel/admin_templates/incs/tree.js (.../tree.js) (revision 5635) @@ -71,11 +71,14 @@ TreeItem.prototype.appendLink = function (td) { + var $node_text = document.createElement('span'); + $node_text.innerHTML = this.Title; + link = document.createElement('a'); link.nodeValue = this.Title; link.href = this.Url; link.target = 'main'; - link.appendChild( document.createTextNode(this.Title) ) + link.appendChild($node_text); link.treeItem = this; //addEvent(link, 'click', Index: branches/unlabeled/unlabeled-1.6.2/kernel/units/categories/cache_updater.php =================================================================== diff -u -N -r5631 -r5635 --- branches/unlabeled/unlabeled-1.6.2/kernel/units/categories/cache_updater.php (.../cache_updater.php) (revision 5631) +++ branches/unlabeled/unlabeled-1.6.2/kernel/units/categories/cache_updater.php (.../cache_updater.php) (revision 5635) @@ -136,18 +136,22 @@ var $doneCats; var $table; + var $primaryLanguageId = 0; + var $languageCount = 0; var $root_prefixes = Array(); - var $TitleField = ''; function Init($prefix, $special, $event_params = null) { parent::Init($prefix, $special, $event_params); - $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); - $this->TitleField = $ml_formatter->LangFieldName('Name'); - $continuing = $event_params['continue']; + // cache widely used values to speed up process: begin + $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); + $this->languageCount = $ml_helper->getLanguageCount(); + $this->primaryLanguageId = $this->Application->GetDefaultLanguageId(); + // cache widely used values to speed up process: end + foreach ($this->Application->ModuleInfo as $module_name => $module_info) { $this->root_prefixes[ $module_info['RootCat'] ] = $module_info['Var']; } @@ -226,7 +230,7 @@ $data = $this->Stack->Get(); if ($data === false) { //If Stack is empty $data['current_id'] = 0; - $data['title'] = Array(); + $data['titles'] = Array(); $data['parent_path'] = Array(); $data['named_path'] = Array(); $data['category_template'] = ''; @@ -253,7 +257,7 @@ // if we have more children if (isset($data['children'][$data['current_child']])) { $next_data = Array(); - $next_data['title'] = $data['title']; + $next_data['titles'] = $data['titles']; $next_data['parent_path'] = $data['parent_path']; $next_data['named_path'] = $data['named_path']; $next_data['category_template'] = $data['category_template']; @@ -276,26 +280,37 @@ function UpdateCachedPath(&$data) { - $fields_hash = Array( 'CachedNavbar' => implode('>', $data['title']), - 'ParentPath' => '|'.implode('|', $data['parent_path']).'|', - 'NamedParentPath' => implode('/', $data['named_path'] ), - 'CachedCategoryTemplate'=> $data['category_template'], - 'CachedItemTemplate' => $data['item_template'], + $fields_hash = Array ( + 'ParentPath' => '|'.implode('|', $data['parent_path']).'|', + 'NamedParentPath' => implode('/', $data['named_path'] ), + 'CachedCategoryTemplate' => $data['category_template'], + 'CachedItemTemplate' => $data['item_template'], ); - + + $i = 1; + while ($i <= $this->languageCount) { + $fields_hash['l'.$i.'_CachedNavbar'] = implode('>', $data['titles'][$i]); + $i++; + } + $this->Conn->doUpdate($fields_hash, TABLE_PREFIX.'Category', 'CategoryId = '.$data['current_id']); } function QueryTitle(&$data) { $category_id = $data['current_id']; - $sql = 'SELECT '.$this->TitleField.', Filename, CategoryTemplate, ItemTemplate + $sql = 'SELECT * FROM '.TABLE_PREFIX.'Category WHERE CategoryId = '.$category_id; $record = $this->Conn->GetRow($sql); if ($record) { - $data['title'][] = $record[$this->TitleField]; + $i = 1; + while ($i <= $this->languageCount) { + $data['titles'][$i][] = $record['l'.$i.'_Name'] ? $record['l'.$i.'_Name'] : $record['l'.$this->primaryLanguageId.'_Name']; + $i++; + } + $data['parent_path'][] = $category_id; $data['named_path'][] = $record['Filename']; Index: branches/unlabeled/unlabeled-1.32.2/core/units/general/cat_dbitem.php =================================================================== diff -u -N -r5559 -r5635 --- branches/unlabeled/unlabeled-1.32.2/core/units/general/cat_dbitem.php (.../cat_dbitem.php) (revision 5559) +++ branches/unlabeled/unlabeled-1.32.2/core/units/general/cat_dbitem.php (.../cat_dbitem.php) (revision 5635) @@ -234,6 +234,10 @@ if ( !$this->GetDBField('AutomaticFilename') && $this->GetDBField('Filename') ) return false; $title_field = $this->Application->getUnitOption($this->Prefix, 'TitleField'); + if (preg_match('/l([\d]+)_(.*)/', $title_field, $regs)) { + // if title field is multilingual, then use it's name from primary language + $title_field = 'l'.$this->Application->GetDefaultLanguageId().'_'.$regs[2]; + } $name = $this->stripDisallowed( $this->GetDBField($title_field) ); if ( $name != $this->GetDBField('Filename') ) $this->SetDBField('Filename', $name); Index: branches/unlabeled/unlabeled-1.32.2/kernel/units/general/cat_dbitem.php =================================================================== diff -u -N -r5559 -r5635 --- branches/unlabeled/unlabeled-1.32.2/kernel/units/general/cat_dbitem.php (.../cat_dbitem.php) (revision 5559) +++ branches/unlabeled/unlabeled-1.32.2/kernel/units/general/cat_dbitem.php (.../cat_dbitem.php) (revision 5635) @@ -234,6 +234,10 @@ if ( !$this->GetDBField('AutomaticFilename') && $this->GetDBField('Filename') ) return false; $title_field = $this->Application->getUnitOption($this->Prefix, 'TitleField'); + if (preg_match('/l([\d]+)_(.*)/', $title_field, $regs)) { + // if title field is multilingual, then use it's name from primary language + $title_field = 'l'.$this->Application->GetDefaultLanguageId().'_'.$regs[2]; + } $name = $this->stripDisallowed( $this->GetDBField($title_field) ); if ( $name != $this->GetDBField('Filename') ) $this->SetDBField('Filename', $name);