Index: branches/5.2.x/core/units/relationship/relationship_config.php =================================================================== diff -u -N -r15012 -r16388 --- branches/5.2.x/core/units/relationship/relationship_config.php (.../relationship_config.php) (revision 15012) +++ branches/5.2.x/core/units/relationship/relationship_config.php (.../relationship_config.php) (revision 16388) @@ -1,6 +1,6 @@ 'rel', +$config = Array ( + 'Prefix' => 'rel', - 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'), - 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'), - 'EventHandlerClass' => Array('class'=>'RelationshipEventHandler','file'=>'relationship_event_handler.php','build_event'=>'OnBuild'), - 'TagProcessorClass' => Array('class'=>'RelationshipTagProcessor','file'=>'relationship_tp.php','build_event'=>'OnBuild'), - 'AutoLoad' => true, - 'Hooks' => Array( - Array( - 'Mode' => hAFTER, - 'Conditional' => false, - 'HookToPrefix' => '#PARENT#', - 'HookToSpecial' => '*', - 'HookToEvent' => Array('OnAfterItemDelete'), - 'DoPrefix' => '', - 'DoSpecial' => '', - 'DoEvent' => 'OnDeleteForeignRelations', - ), - ), - 'QueryString' => Array( - 1 => 'id', - 2 => 'Page', - 3 => 'PerPage', - 4 => 'event', - ), - 'IDField' => 'RelationshipId', - 'StatusField' => Array('Enabled','Type'), - 'TableName' => TABLE_PREFIX.'CatalogRelationships', - 'ParentTableKey'=> 'ResourceId', - 'ForeignKey' => 'SourceId', - 'ParentPrefix' => 'p', - 'AutoDelete' => true, - 'AutoClone' => true, + 'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'), + 'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'), + 'EventHandlerClass' => Array ('class' => 'RelationshipEventHandler', 'file' => 'relationship_event_handler.php', 'build_event' => 'OnBuild'), + 'TagProcessorClass' => Array ('class' => 'RelationshipTagProcessor', 'file' => 'relationship_tp.php', 'build_event' => 'OnBuild'), - 'CalculatedFields' => Array ( - '' => Array ( - 'ItemName' => 'TRIM(CONCAT(#ITEM_NAMES#))', - 'ItemType' => '#ITEM_TYPES#', - ), - ), + 'AutoLoad' => true, - 'ListSQLs' => Array( ''=> 'SELECT %1$s.RelationshipId, %1$s.Priority, %1$s.Type, %1$s.Enabled %2$s - FROM %1$s #ITEM_JOIN#', - ), // key - special, value - list select sql + 'Hooks' => Array ( + Array ( + 'Mode' => hAFTER, + 'Conditional' => false, + 'HookToPrefix' => '#PARENT#', + 'HookToSpecial' => '*', + 'HookToEvent' => Array ('OnAfterItemDelete'), + 'DoPrefix' => '', + 'DoSpecial' => '', + 'DoEvent' => 'OnDeleteForeignRelations', + ), + ), - 'ListSortings' => Array( - '' => Array( - 'ForcedSorting' => Array('Priority' => 'desc'), - 'Sorting' => Array('ItemName' => 'asc', 'ItemType' => 'asc'), - ) - ), - 'ItemSQLs' => Array( '' => 'SELECT %1$s.* %2$s FROM %1$s #ITEM_JOIN#',), + 'QueryString' => Array ( + 1 => 'id', + 2 => 'Page', + 3 => 'PerPage', + 4 => 'event', + ), - 'Fields' => Array( - 'RelationshipId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0), - 'SourceId' => Array('type'=>'int', 'required' => 1, 'default' => NULL), - 'TargetId' => Array('type'=>'int', 'required' => 1, 'default' => NULL), - 'SourceType' => Array('type'=>'int','not_null'=>1,'default'=>0), - 'TargetType' => Array('type'=>'int','not_null'=>1,'default'=>0), - 'Type' => Array('type'=>'int','formatter'=>'kOptionsFormatter', 'required' => 1, 'options'=>Array(1=>'la_Reciprocal',0=>'la_OneWay'), 'not_null'=>1,'default'=>0,'use_phrases'=>1), - 'Enabled' => Array ( - 'type' => 'int', - 'formatter' => 'kOptionsFormatter', - 'options' => Array (0 => 'la_Disabled', 1 => 'la_Enabled'), 'use_phrases' => 1, - 'not_null' => 1, 'default' => 1, - ), - 'Priority' => Array('type'=>'int','not_null'=>1,'default'=>0), - ), - 'VirtualFields' => Array( - 'ItemName' => Array ('type' => 'string', 'default' => ''), - 'ItemType' => Array ('type' => 'string', 'default' => ''), - ), + 'IDField' => 'RelationshipId', + 'StatusField' => Array ('Enabled', 'Type'), + 'TableName' => TABLE_PREFIX.'CatalogRelationships', + 'ParentTableKey'=> 'ResourceId', + 'ForeignKey' => 'SourceId', + 'ParentPrefix' => 'p', + 'AutoDelete' => true, + 'AutoClone' => true, - 'Grids' => Array( - 'Default' => Array( - 'Icons' => Array( - 'default' => 'icon16_item.png', - '1_0' => 'icon16_relation_one-way.gif', - '0_0' => 'icon16_relation_one-way_disabled.gif', - '1_1' => 'icon16_relation_reciprocal.gif', - '0_1' => 'icon16_relation_reciprocal_disabled.gif' - ), // icons for each StatusField values, if no matches or no statusfield selected, then "default" icon is used - 'Fields' => Array( - 'RelationshipId' => Array ('title' => 'column:la_fld_Id', 'filter_block' => 'grid_range_filter', 'width' => 50, ), - 'ItemName' => Array( 'title' => 'column:la_fld_TargetId', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_like_filter', 'width' => 200, ), - 'ItemType' => Array( 'title' => 'la_col_TargetType', 'filter_block' => 'grid_like_filter', 'width' => 80, ), - 'Type' => Array( 'title' => 'column:la_fld_RelationshipType', 'filter_block' => 'grid_options_filter', 'width' => 80, ), - 'Enabled' => Array('filter_block' => 'grid_options_filter', 'width' => 70, ), - ), - ), - ), - ); \ No newline at end of file + 'CalculatedFields' => Array ( + '' => Array ( + 'ItemName' => 'TRIM(CONCAT(#ITEM_NAMES#))', + 'ItemType' => '#ITEM_TYPES#', + ), + ), + + 'ListSQLs' => Array ( + '' => ' SELECT %1$s.RelationshipId, %1$s.Priority, %1$s.Type, %1$s.Enabled %2$s + FROM %1$s #ITEM_JOIN#', + ), + + 'ListSortings' => Array ( + '' => Array ( + 'ForcedSorting' => Array ('Priority' => 'desc'), + 'Sorting' => Array ('ItemName' => 'asc', 'ItemType' => 'asc'), + ) + ), + + 'ItemSQLs' => Array ( + '' => ' SELECT %1$s.* %2$s + FROM %1$s #ITEM_JOIN#', + ), + + 'Fields' => Array ( + 'RelationshipId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0), + 'SourceId' => Array ('type' => 'int', 'required' => 1, 'default' => NULL), + 'TargetId' => Array ('type' => 'int', 'required' => 1, 'default' => NULL), + 'SourceType' => Array ('type' => 'int', 'not_null'=>1,'default'=>0), + 'TargetType' => Array ('type' => 'int', 'not_null'=>1,'default'=>0), + 'Type' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'required' => 1, 'options'=>Array (1=>'la_Reciprocal',0=>'la_OneWay'), 'not_null'=>1,'default'=>0,'use_phrases'=>1), + 'Enabled' => Array ( + 'type' => 'int', + 'formatter' => 'kOptionsFormatter', + 'options' => Array (0 => 'la_Disabled', 1 => 'la_Enabled'), 'use_phrases' => 1, + 'not_null' => 1, 'default' => 1, + ), + 'Priority' => Array ('type' => 'int', 'not_null'=>1,'default'=>0), + ), + 'VirtualFields' => Array ( + 'ItemName' => Array ('type' => 'string', 'default' => ''), + 'ItemType' => Array ('type' => 'string', 'default' => ''), + ), + + 'Grids' => Array ( + 'Default' => Array ( + 'Icons' => Array ( + 'default' => 'icon16_item.png', + '1_0' => 'icon16_relation_one-way.gif', + '0_0' => 'icon16_relation_one-way_disabled.gif', + '1_1' => 'icon16_relation_reciprocal.gif', + '0_1' => 'icon16_relation_reciprocal_disabled.gif' + ), // icons for each StatusField values, if no matches or no statusfield selected, then "default" icon is used + 'Fields' => Array ( + 'RelationshipId' => Array ('title' => 'column:la_fld_Id', 'filter_block' => 'grid_range_filter', 'width' => 50, ), + 'ItemName' => Array ( 'title' => 'column:la_fld_TargetId', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_like_filter', 'width' => 200, ), + 'ItemType' => Array ( 'title' => 'la_col_TargetType', 'filter_block' => 'grid_like_filter', 'width' => 80, ), + 'Type' => Array ( 'title' => 'column:la_fld_RelationshipType', 'filter_block' => 'grid_options_filter', 'width' => 80, ), + 'Enabled' => Array ('filter_block' => 'grid_options_filter', 'width' => 70, ), + ), + ), + ), +); \ No newline at end of file