Index: branches/unlabeled/unlabeled-1.28.2/kernel/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r5614 -r5615 --- branches/unlabeled/unlabeled-1.28.2/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5614) +++ branches/unlabeled/unlabeled-1.28.2/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5615) @@ -430,6 +430,17 @@ } return 0; } + + /** + * Allows to detect if root category being edited + * + * @param Array $params + */ + function IsRootCategory($params) + { + $object =& $this->getObject($params); + return $object->IsRoot(); + } } Index: branches/unlabeled/unlabeled-1.62.2/core/kernel/db/db_tag_processor.php =================================================================== diff -u -N -r5447 -r5615 --- branches/unlabeled/unlabeled-1.62.2/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 5447) +++ branches/unlabeled/unlabeled-1.62.2/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 5615) @@ -1180,7 +1180,7 @@ $tag_params = array_merge_recursive2($params, $tag_params); $objects[ $prefix_data['prefix_special'] ] =& $this->Application->recallObject($prefix_data['prefix_special'], $prefix_data['prefix'], $tag_params); - $object_status[ $prefix_data['prefix_special'] ] = $objects[ $prefix_data['prefix_special'] ]->GetID() ? 'edit' : 'new'; + $object_status[ $prefix_data['prefix_special'] ] = $objects[ $prefix_data['prefix_special'] ]->IsNewItem() ? 'new' : 'edit'; // a. set object's status field (adding item/editing item) for each object in title if( getArrayValue($title_info[ $object_status[ $prefix_data['prefix_special'] ].'_status_labels' ],$prefix_data['prefix_special']) ) Index: branches/unlabeled/unlabeled-1.22.2/core/units/categories/categories_event_handler.php =================================================================== diff -u -N -r5610 -r5615 --- branches/unlabeled/unlabeled-1.22.2/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5610) +++ branches/unlabeled/unlabeled-1.22.2/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5615) @@ -318,7 +318,7 @@ $this->clearSelectedIDs($event); } - /** + /** * Add selected items to clipboard with mode = COPY (CLONE) * * @param kEvent $event Index: branches/unlabeled/unlabeled-1.9.2/core/units/categories/categories_item.php =================================================================== diff -u -N -r5450 -r5615 --- branches/unlabeled/unlabeled-1.9.2/core/units/categories/categories_item.php (.../categories_item.php) (revision 5450) +++ branches/unlabeled/unlabeled-1.9.2/core/units/categories/categories_item.php (.../categories_item.php) (revision 5615) @@ -138,6 +138,42 @@ if ( $name != $this->GetDBField('Filename') ) $this->SetDBField('Filename', $name); } + + /** + * Allows to detect if root category being edited + * + * @param Array $params + */ + function IsRoot() + { + $category_id = $this->Application->GetVar($this->getPrefixSpecial().'_id'); + if (is_numeric($category_id) && $category_id == 0) { + $sql = 'SELECT '.$this->IDField.' + FROM '.$this->TableName.' + WHERE '.$this->IDField.' = '.$category_id; + if ($this->Conn->GetOne($sql) === false) { + return true; + } + } + + return false; + } + + /** + * Sets correct name to Home category while editing it + * + * @return bool + */ + function IsNewItem() + { + if ($this->IsRoot()) { + $title_field = $this->Application->getUnitOption($this->Prefix, 'TitleField'); + $category_name = $this->Application->Phrase( $this->Application->ConfigValue('Root_Name') ); + $this->SetDBField($title_field, $category_name); + return false; + } + return parent::IsNewItem(); + } } ?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.28.2/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r5614 -r5615 --- branches/unlabeled/unlabeled-1.28.2/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5614) +++ branches/unlabeled/unlabeled-1.28.2/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 5615) @@ -430,6 +430,17 @@ } return 0; } + + /** + * Allows to detect if root category being edited + * + * @param Array $params + */ + function IsRootCategory($params) + { + $object =& $this->getObject($params); + return $object->IsRoot(); + } } Index: branches/unlabeled/unlabeled-1.22.2/core/kernel/kbase.php =================================================================== diff -u -N -r5056 -r5615 --- branches/unlabeled/unlabeled-1.22.2/core/kernel/kbase.php (.../kbase.php) (revision 5056) +++ branches/unlabeled/unlabeled-1.22.2/core/kernel/kbase.php (.../kbase.php) (revision 5615) @@ -590,6 +590,16 @@ } /** + * Allows kDBTagProcessor.SectionTitle to detect if it's editing or new item creation + * + * @return bool + */ + function IsNewItem() + { + return $this->GetID() ? false : true; + } + + /** * Returns parent table information * * @param bool $from_temp load parent item from temp table Index: branches/unlabeled/unlabeled-1.9.2/kernel/units/categories/categories_item.php =================================================================== diff -u -N -r5450 -r5615 --- branches/unlabeled/unlabeled-1.9.2/kernel/units/categories/categories_item.php (.../categories_item.php) (revision 5450) +++ branches/unlabeled/unlabeled-1.9.2/kernel/units/categories/categories_item.php (.../categories_item.php) (revision 5615) @@ -138,6 +138,42 @@ if ( $name != $this->GetDBField('Filename') ) $this->SetDBField('Filename', $name); } + + /** + * Allows to detect if root category being edited + * + * @param Array $params + */ + function IsRoot() + { + $category_id = $this->Application->GetVar($this->getPrefixSpecial().'_id'); + if (is_numeric($category_id) && $category_id == 0) { + $sql = 'SELECT '.$this->IDField.' + FROM '.$this->TableName.' + WHERE '.$this->IDField.' = '.$category_id; + if ($this->Conn->GetOne($sql) === false) { + return true; + } + } + + return false; + } + + /** + * Sets correct name to Home category while editing it + * + * @return bool + */ + function IsNewItem() + { + if ($this->IsRoot()) { + $title_field = $this->Application->getUnitOption($this->Prefix, 'TitleField'); + $category_name = $this->Application->Phrase( $this->Application->ConfigValue('Root_Name') ); + $this->SetDBField($title_field, $category_name); + return false; + } + return parent::IsNewItem(); + } } ?> \ No newline at end of file Index: branches/unlabeled/unlabeled-1.2.2/core/admin_templates/categories/categories_tabs.tpl =================================================================== diff -u -N -r5614 -r5615 --- branches/unlabeled/unlabeled-1.2.2/core/admin_templates/categories/categories_tabs.tpl (.../categories_tabs.tpl) (revision 5614) +++ branches/unlabeled/unlabeled-1.2.2/core/admin_templates/categories/categories_tabs.tpl (.../categories_tabs.tpl) (revision 5615) @@ -16,16 +16,16 @@ - + - +
Index: branches/unlabeled/unlabeled-1.2.2/kernel/admin_templates/categories/categories_tabs.tpl =================================================================== diff -u -N -r5614 -r5615 --- branches/unlabeled/unlabeled-1.2.2/kernel/admin_templates/categories/categories_tabs.tpl (.../categories_tabs.tpl) (revision 5614) +++ branches/unlabeled/unlabeled-1.2.2/kernel/admin_templates/categories/categories_tabs.tpl (.../categories_tabs.tpl) (revision 5615) @@ -16,16 +16,16 @@ - + - +
Index: branches/unlabeled/unlabeled-1.22.2/kernel/units/categories/categories_event_handler.php =================================================================== diff -u -N -r5610 -r5615 --- branches/unlabeled/unlabeled-1.22.2/kernel/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5610) +++ branches/unlabeled/unlabeled-1.22.2/kernel/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 5615) @@ -318,7 +318,7 @@ $this->clearSelectedIDs($event); } - /** + /** * Add selected items to clipboard with mode = COPY (CLONE) * * @param kEvent $event