Index: branches/unlabeled/unlabeled-1.28.2/kernel/units/categories/categories_tag_processor.php =================================================================== diff -u -r5833 -r5883 --- branches/unlabeled/unlabeled-1.28.2/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5833) +++ branches/unlabeled/unlabeled-1.28.2/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5883) @@ -2,27 +2,6 @@ class CategoriesTagProcessor extends kDBTagProcessor { - function &GetList($params) - { - $special = $this->BuildListSpecial($params); - - $prefix_special = $this->Prefix.'.'.$special; - $this->Special = $special; - - $params['skip_counting'] = true; - - $list =& $this->Application->recallObject( $prefix_special, $this->Prefix.'_List',$params); - -// $list->clearFilters(); -// $list->addFilter('parent_filter', 'ParentId = '.$parent_cat_id, WHERE_FILTER, FLT_SYSTEM); - - //unset($params['skip_counting']); -// $this->Application->HandleEvent($event, $prefix_special.':SetPagination', $params ); - - $list->Query(); - return $list; - } - function SubCatCount($params) { $cat_object =& $this->Application->recallObject($this->getPrefixSpecial(),$this->Prefix, $params); @@ -128,7 +107,7 @@ else { $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); $navbar_field = $ml_formatter->LangFieldName('CachedNavBar'); - + $id_field = $this->Application->getUnitOption($this->Prefix, 'IDField'); $table_name = $this->Application->getUnitOption($this->Prefix, 'TableName'); $sql = 'SELECT '.$navbar_field.', ParentPath @@ -139,36 +118,36 @@ if ($category_data) { $category_names = explode('&|&', $category_data[$navbar_field]); $category_ids = explode('|', substr($category_data['ParentPath'], 1, -1)); - + // add "Home" category at beginning of path array_unshift($category_names, $this->Application->ProcessParsedTag('m', 'RootCategoryName', $params)); array_unshift($category_ids, 0); - + foreach ($category_ids as $category_pos => $category_id) { $block_params['cat_id'] = $category_id; $block_params['cat_name'] = $category_names[$category_pos]; $block_params['current'] = ($params['cat_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 ($category_id == 0) { $block_params['name'] = $this->SelectParam($params, 'root_cat_render_as,block_root_cat,rootcatblock,render_as,block'); } - + if ($block_params['is_module_root'] == 1) { // module root $block_params['name'] = $this->SelectParam($params, 'module_root_render_as,block_module_root,rootmoduleblock,render_as,block'); } - + if ($block_params['current'] == 1) { // current cat (label) $block_params['name'] = $this->SelectParam($params, 'current_render_as,block_current,currentblock,render_as,block'); } - + $this->Application->SetVar($this->Prefix.'_id', $category_id); $ret .= $this->Application->ParseBlock($block_params, 1); } } - + return $ret; } } @@ -187,15 +166,15 @@ $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); return $ml_formatter->LangFieldName('Name'); } - + function CategoryLink($params) { // 'p_id'=>'0', ?? $params = array_merge(array('pass'=>'m'), $params); $cat_id = getArrayValue($params,'cat_id'); if ($cat_id === false) { // $cat_id = $this->Application->Parser->GetParam('cat_id'); - $cat_id = $this->Application->GetVar($this->Prefix.'_id'); + $cat_id = $this->Application->GetVar($this->getPrefixSpecial().'_id'); } if($cat_id == 'Root') { @@ -237,7 +216,7 @@ if (isset($params['block_row_start'])) { $params['row_start_block'] = $params['block_row_start']; } - + if (isset($params['block_row_end'])) { $params['row_end_block'] = $params['block_row_end']; } @@ -285,7 +264,7 @@ $no_special = isset($params['no_special']) && $params['no_special']; if ($no_special) return $this->Special; - + if ($types.$except.$parent_cat_id == '') { return parent::BuildListSpecial($params); } @@ -298,7 +277,7 @@ { return false; } - + /** * Substitutes category in last template base on current category * @@ -307,16 +286,16 @@ function UpdateLastTemplate($params) { $category_id = $this->Application->GetVar('m_cat_id'); - + list($index_file, $env) = explode('|', $this->Application->RecallVar('last_template'), 2); $this->Application->SetVar(ENV_VAR_NAME, str_replace('%5C', '\\', $env)); $this->Application->HttpQuery->processQueryString(); - + // update required fields $this->Application->SetVar('m_cat_id', $category_id); $this->Application->Session->SaveLastTemplate($params['template']); } - + function GetParentCategory($params) { $parent_id = 0; @@ -331,30 +310,30 @@ } return $parent_id; } - + function InitCacheUpdater($params) { safeDefine('CACHE_PERM_CHUNK_SIZE', 30); $continue = $this->Application->GetVar('continue'); $total_cats = (int) $this->Conn->GetOne('SELECT COUNT(*) FROM '.TABLE_PREFIX.'Category'); - + if ($continue === false && $total_cats > CACHE_PERM_CHUNK_SIZE) { // first step, if category count > CACHE_PERM_CHUNK_SIZE, then ask for cache update return true; } - + if ($continue === false) { // if we don't have to ask, then assume user selected "Yes" in permcache update dialog $continue = 1; } - + $updater =& $this->Application->recallObject('kPermCacheUpdater', null, Array('continue' => $continue)); if ($continue === '0') { // No in dialog $updater->clearData(); $this->Application->Redirect($params['destination_template']); } - + $ret = false; // don't ask for update if ($continue == 1) { // Initial run $updater->setData(); @@ -366,7 +345,7 @@ // until proceeeded in this step category count exceeds category per step limit $needs_more = $updater->DoTheJob(); } - + if ($needs_more) { // still some categories are left for next step $updater->setData(); @@ -377,12 +356,12 @@ $this->Application->RemoveVar('PermCache_UpdateRequired'); $this->Application->Redirect($params['destination_template']); } - + $ret = $updater->getDonePercent(); } return $ret; } - + function SaveWarning($params) { $main_prefix = getArrayValue($params, 'main_prefix'); @@ -395,12 +374,12 @@ $temp_tables = $this->Application->GetVar($top_prefix.'_mode') == 't'; $modified = $this->Application->RecallVar($top_prefix.'_modified'); - + if (!$temp_tables) { $this->Application->RemoveVar($top_prefix.'_modified'); return ''; } - + $block_name = $this->SelectParam($params, 'render_as,name'); if ($block_name) { $block_params = $this->prepareTagParams($params); @@ -414,7 +393,7 @@ } return ; } - + /** * Allows to detect if this prefix has something in clipboard * @@ -434,7 +413,7 @@ } return 0; } - + /** * Allows to detect if root category being edited * @@ -445,7 +424,7 @@ $object =& $this->getObject($params); return $object->IsRoot(); } - + function CatalogItemCount($params) { $object =& $this->GetList($params); @@ -454,7 +433,7 @@ } return $object->NoFilterCount != $object->RecordsCount ? $object->RecordsCount.' / '.$object->NoFilterCount : $object->RecordsCount; } - + /** * Print grid pagination using * block names specified @@ -470,20 +449,20 @@ } return parent::PrintPages($params); } - + function InitCatalog($params) { $tab_prefixes = $this->Application->GetVar('tp'); // {all, , none} if ($tab_prefixes === false) $tab_prefixes = 'all'; $skip_prefixes = isset($params['skip_prefixes']) && $params['skip_prefixes'] ? explode(',', $params['skip_prefixes']) : Array(); - + // get all prefixes available $prefixes = Array(); foreach ($this->Application->ModuleInfo as $module_name => $module_data) { if ($module_data['Var'] == 'm') continue; $prefixes[] = $module_data['Var']; } - + if ($tab_prefixes == 'none') { $skip_prefixes = array_unique(array_merge($skip_prefixes, $prefixes)); } @@ -492,7 +471,7 @@ $tab_prefixes = explode(',', $tab_prefixes); // list of prefixes that should stay $skip_prefixes = array_unique(array_merge($skip_prefixes, array_diff($prefixes, $tab_prefixes))); } - + $params['name'] = $params['render_as']; $params['skip_prefixes'] = implode(',', $skip_prefixes); return $this->Application->ParseBlock($params, 1);