Index: trunk/core/kernel/session/session.php =================================================================== diff -u -N -r5013 -r5024 --- trunk/core/kernel/session/session.php (.../session.php) (revision 5013) +++ trunk/core/kernel/session/session.php (.../session.php) (revision 5024) @@ -680,18 +680,22 @@ function SaveData() { if (!$this->Application->GetVar('skip_last_template') && $this->Application->GetVar('ajax') != 'yes') { - $t = $this->Application->GetVar('t'); - $last_env = $this->Application->BuildEnv($t, Array('m_opener' => 'u', '__URLENCODE__' => 1), 'all'); - $last_template = basename($_SERVER['PHP_SELF']).'|'; - $last_template .= substr($last_env, strlen(ENV_VAR_NAME) + 1); - $this->StoreVar('last_template', $last_template); - $this->StoreVar('last_env', substr($this->Application->BuildEnv($t, Array('pass'=>'all', '__URLENCODE__' => 1)), strlen(ENV_VAR_NAME)+1)); + $this->SaveLastTemplate( $this->Application->GetVar('t') ); } $this->PrintSession('after save'); $this->Storage->SaveData($this); } + function SaveLastTemplate($t) + { + $last_env = $this->Application->BuildEnv($t, Array('m_opener' => 'u', '__URLENCODE__' => 1), 'all'); + $last_template = basename($_SERVER['PHP_SELF']).'|'.substr($last_env, strlen(ENV_VAR_NAME) + 1); + $this->StoreVar('last_template', $last_template); + + $this->StoreVar('last_env', substr($this->Application->BuildEnv($t, Array('__URLENCODE__' => 1), 'all'), strlen(ENV_VAR_NAME)+1)); + } + function StoreVar($name, $value) { $this->Data->Set($name, $value); Index: trunk/core/admin_templates/js/catalog.js =================================================================== diff -u -N -r5022 -r5024 --- trunk/core/admin_templates/js/catalog.js (.../catalog.js) (revision 5022) +++ trunk/core/admin_templates/js/catalog.js (.../catalog.js) (revision 5024) @@ -69,6 +69,11 @@ // sets new category to kernel_form in case if item tab // loads faster and will check if it's category is same // as parent category of categories list + + if (get_hidden_field('m_cat_id') == $cat_id) { + // it's the same category, then don't reload category list + return true; + } set_hidden_field('m_cat_id', $cat_id); } Index: trunk/core/kernel/application.php =================================================================== diff -u -N -r5018 -r5024 --- trunk/core/kernel/application.php (.../application.php) (revision 5018) +++ trunk/core/kernel/application.php (.../application.php) (revision 5024) @@ -125,7 +125,7 @@ /** * Holds a reference to Session * - * @var kSession + * @var Session */ var $Session = null; Index: trunk/kernel/admin_templates/incs/catalog.js =================================================================== diff -u -N -r5022 -r5024 --- trunk/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5022) +++ trunk/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5024) @@ -69,6 +69,11 @@ // sets new category to kernel_form in case if item tab // loads faster and will check if it's category is same // as parent category of categories list + + if (get_hidden_field('m_cat_id') == $cat_id) { + // it's the same category, then don't reload category list + return true; + } set_hidden_field('m_cat_id', $cat_id); } Index: trunk/kernel/admin_templates/xml/categories_list.tpl =================================================================== diff -u -N -r5022 -r5024 --- trunk/kernel/admin_templates/xml/categories_list.tpl (.../categories_list.tpl) (revision 5022) +++ trunk/kernel/admin_templates/xml/categories_list.tpl (.../categories_list.tpl) (revision 5024) @@ -36,6 +36,7 @@ a_toolbar.EnableButton('homecat'); #separator# + Index: trunk/core/admin_templates/categories/xml/categories_list.tpl =================================================================== diff -u -N -r5022 -r5024 --- trunk/core/admin_templates/categories/xml/categories_list.tpl (.../categories_list.tpl) (revision 5022) +++ trunk/core/admin_templates/categories/xml/categories_list.tpl (.../categories_list.tpl) (revision 5024) @@ -36,6 +36,7 @@ a_toolbar.EnableButton('homecat'); #separator# +
Index: trunk/kernel/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r4997 -r5024 --- trunk/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 4997) +++ trunk/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5024) @@ -288,6 +288,24 @@ { return false; } + + /** + * Substitutes category in last template base on current category + * + * @param Array $params + */ + 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, $env); + $this->Application->HttpQuery->processQueryString(); + + // update required fields + $this->Application->SetVar('m_cat_id', $category_id); + $this->Application->Session->SaveLastTemplate($params['template']); + } } Index: trunk/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r4997 -r5024 --- trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 4997) +++ trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5024) @@ -288,6 +288,24 @@ { return false; } + + /** + * Substitutes category in last template base on current category + * + * @param Array $params + */ + 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, $env); + $this->Application->HttpQuery->processQueryString(); + + // update required fields + $this->Application->SetVar('m_cat_id', $category_id); + $this->Application->Session->SaveLastTemplate($params['template']); + } }