+ 'Icons' => Array('default'=>'icon16_custom.gif'), // icons for each StatusField values, if no matches or no statusfield selected, then "default" icon is used
+ $debugger->appendHTML("mode: ".$this->SkipModeName()." tag ".$debugger->highlightString($tag_data)." in ".$debugger->getFileLink($debugger->getLocalFile(DOC_ROOT.BASE_PATH.THEMES_PATH.'/'.$this->TemplateName).'.tpl', $this->CurrentLineNumber(), '', true));
+ }
+ $tag =& new MyTag($tag_data, $this);
+ if (!$this->CheckRecursion($tag)) //we do NOT process closing tags
+ {
+ $tag->Process();
+ }
+ }
+
+ if ( !$this->GetParam('from_inportal') ) {
+ if ( strpos($this->Output, '<inp:') !== false) {
+ $already_added = $this->Conn->GetOne('SELECT * FROM '.$object->TableName.' WHERE CategoryId='.$cat_id.' AND '.$table_info['ForeignKey'].'='.$table_info['ParentId']);
+ $this->Conn->Query('UPDATE '.$object->TableName.' SET PrimaryCat = 0 WHERE '.$table_info['ForeignKey'].' = '.$table_info['ParentId']);
+ $this->Conn->Query('UPDATE '.$object->TableName.' SET PrimaryCat = 1 WHERE ('.$table_info['ForeignKey'].' = '.$table_info['ParentId'].') AND (CategoryId = '.$id.')');
+ $ids = $this->Conn->GetCol('SELECT CategoryId FROM '.$object->TableName.' WHERE (PrimaryCat=0) AND ('.$table_info['ForeignKey'].'='.$table_info['ParentId'].') AND CategoryId IN ('.implode(',',$ids).')');
+ $event->setEventParam('ids',$ids);
+ }
+ break;
+
+ // not needed because 'before' does not allow to delete primary cat!
+ /*case 'after':
+ // set 1st not deleted category as primary
+ $has_primary = $this->Conn->GetOne('SELECT COUNT(*) FROM '.$object->TableName.' WHERE (PrimaryCat=1) AND ('.$table_info['ForeignKey'].' = '.$table_info['ParentId'].')');
+ if(!$has_primary)
+ {
+ $cat_id = $this->Conn->GetOne('SELECT CategoryId FROM '.$object->TableName.' WHERE '.$table_info['ForeignKey'].' = '.$table_info['ParentId']);
+ $this->Conn->Query('UPDATE '.$object->TableName.' SET PrimaryCat = 1 WHERE ('.$table_info['ForeignKey'].' = '.$table_info['ParentId'].') AND (CategoryId = '.$cat_id.')');
+ }
+ break;*/
+ }
+ }
+ }
+
+ }
+
+?>
\ No newline at end of file
Property changes on: trunk/kernel/units/category_items/category_items_event_handler.php
+ 'Icons' => Array('default'=>'icon16_custom.gif'), // icons for each StatusField values, if no matches or no statusfield selected, then "default" icon is used
+ $debugger->appendHTML("mode: ".$this->SkipModeName()." tag ".$debugger->highlightString($tag_data)." in ".$debugger->getFileLink($debugger->getLocalFile(DOC_ROOT.BASE_PATH.THEMES_PATH.'/'.$this->TemplateName).'.tpl', $this->CurrentLineNumber(), '', true));
+ }
+ $tag =& new MyTag($tag_data, $this);
+ if (!$this->CheckRecursion($tag)) //we do NOT process closing tags
+ {
+ $tag->Process();
+ }
+ }
+
+ if ( !$this->GetParam('from_inportal') ) {
+ if ( strpos($this->Output, '<inp:') !== false) {
+ $already_added = $this->Conn->GetOne('SELECT * FROM '.$object->TableName.' WHERE CategoryId='.$cat_id.' AND '.$table_info['ForeignKey'].'='.$table_info['ParentId']);
+ $this->Conn->Query('UPDATE '.$object->TableName.' SET PrimaryCat = 0 WHERE '.$table_info['ForeignKey'].' = '.$table_info['ParentId']);
+ $this->Conn->Query('UPDATE '.$object->TableName.' SET PrimaryCat = 1 WHERE ('.$table_info['ForeignKey'].' = '.$table_info['ParentId'].') AND (CategoryId = '.$id.')');
+ $ids = $this->Conn->GetCol('SELECT CategoryId FROM '.$object->TableName.' WHERE (PrimaryCat=0) AND ('.$table_info['ForeignKey'].'='.$table_info['ParentId'].') AND CategoryId IN ('.implode(',',$ids).')');
+ $event->setEventParam('ids',$ids);
+ }
+ break;
+
+ // not needed because 'before' does not allow to delete primary cat!
+ /*case 'after':
+ // set 1st not deleted category as primary
+ $has_primary = $this->Conn->GetOne('SELECT COUNT(*) FROM '.$object->TableName.' WHERE (PrimaryCat=1) AND ('.$table_info['ForeignKey'].' = '.$table_info['ParentId'].')');
+ if(!$has_primary)
+ {
+ $cat_id = $this->Conn->GetOne('SELECT CategoryId FROM '.$object->TableName.' WHERE '.$table_info['ForeignKey'].' = '.$table_info['ParentId']);
+ $this->Conn->Query('UPDATE '.$object->TableName.' SET PrimaryCat = 1 WHERE ('.$table_info['ForeignKey'].' = '.$table_info['ParentId'].') AND (CategoryId = '.$cat_id.')');
+ }
+ break;*/
+ }
+ }
+ }
+
+ }
+
+?>
\ No newline at end of file
Property changes on: trunk/core/units/category_items/category_items_event_handler.php
+ 'Icons' => Array('default'=>'icon16_custom.gif'), // icons for each StatusField values, if no matches or no statusfield selected, then "default" icon is used