Attached Files |
dynamic_clone_OnAfterConfigRead.patch [^] (849 bytes) 2009-12-09 22:50
[Show Content]
Index: unit_config_reader.php
===================================================================
--- unit_config_reader.php (revision 9)
+++ unit_config_reader.php (working copy)
@@ -815,11 +815,15 @@
$file = $this->prefixFiles[$prefix];
$prefix = $this->PreloadConfigFile($file);
+ if ($this->FinalStage) {
+ $this->Application->HandleEvent( new kEvent($prefix.':OnAfterConfigRead') );
+ }
+
$clones = $this->postProcessConfig($prefix, 'AggregateConfigs', 'sub_prefix');
$clones = array_merge($this->postProcessConfig($prefix, 'Clones', 'prefix'), $clones);
if ($this->FinalStage) {
- array_unshift($clones, $prefix);
+ // array_unshift($clones, $prefix);
$clones = array_unique($clones);
foreach ($clones as $a_prefix) {
$this->Application->HandleEvent( new kEvent($a_prefix.':OnAfterConfigRead') );
dynamic_clone_OnAfterConfigRead_core_v2.patch [^] (16,568 bytes) 2010-03-21 07:52
[Show Content]
Index: kernel/db/cat_event_handler.php
===================================================================
--- kernel/db/cat_event_handler.php (revision 13268)
+++ kernel/db/cat_event_handler.php (working copy)
@@ -2642,4 +2642,24 @@
echo $rating_helper->makeVote($object);
}
+
+ /**
+ * [HOOK] Allows to add cloned subitem to given prefix
+ *
+ * @param kEvent $event
+ */
+ function OnCloneSubItem(&$event)
+ {
+ parent::OnCloneSubItem($event);
+
+ if ($event->MasterEvent->Prefix == 'fav') {
+ $clones = $this->Application->getUnitOption($event->MasterEvent->Prefix, 'Clones');
+ $subitem_prefix = $event->Prefix . '-' . $event->MasterEvent->Prefix;
+
+ $clones[$subitem_prefix]['ParentTableKey'] = 'ResourceId';
+ $clones[$subitem_prefix]['ForeignKey'] = 'ResourceId';
+
+ $this->Application->setUnitOption($event->MasterEvent->Prefix, 'Clones', $clones);
+ }
+ }
}
\ No newline at end of file
Index: kernel/db/db_event_handler.php
===================================================================
--- kernel/db/db_event_handler.php (revision 13268)
+++ kernel/db/db_event_handler.php (working copy)
@@ -2104,13 +2104,15 @@
}
$event->redirect = $this->Application->GetVar('translator_t');
- $event->redirect_params = Array('pass'=>'all,trans,'.$this->Application->GetVar('translator_prefixes'),
- $event->getPrefixSpecial(true).'_id' => $object->GetID(),
- 'trans_event' => 'OnLoad',
- 'trans_prefix' => $this->Application->GetVar('translator_prefixes'),
- 'trans_field' => $this->Application->GetVar('translator_field'),
- 'trans_multi_line' => $this->Application->GetVar('translator_multi_line'),
- );
+ $event->redirect_params = Array (
+ 'pass' => 'all,trans,' . $this->Application->GetVar('translator_prefixes'),
+ 'opener' => 's',
+ $event->getPrefixSpecial(true) . '_id' => $object->GetID(),
+ 'trans_event' => 'OnLoad',
+ 'trans_prefix' => $this->Application->GetVar('translator_prefixes'),
+ 'trans_field' => $this->Application->GetVar('translator_field'),
+ 'trans_multi_line' => $this->Application->GetVar('translator_multi_line'),
+ );
// 1. SAVE LAST TEMPLATE TO SESSION (really needed here, because of tweaky redirect)
$last_template = $this->Application->RecallVar('last_template');
@@ -2572,4 +2574,17 @@
// abstract, for hooking
}
+ /**
+ * [HOOK] Allows to add cloned subitem to given prefix
+ *
+ * @param kEvent $event
+ */
+ function OnCloneSubItem(&$event)
+ {
+ $clones = $this->Application->getUnitOption($event->MasterEvent->Prefix, 'Clones');
+
+ $subitem_prefix = $event->Prefix . '-' . preg_replace('/^#/', '', $event->MasterEvent->Prefix);
+ $clones[$subitem_prefix] = Array ('ParentPrefix' => $event->Prefix);
+ $this->Application->setUnitOption($event->MasterEvent->Prefix, 'Clones', $clones);
+ }
}
\ No newline at end of file
Index: kernel/utility/unit_config_reader.php
===================================================================
--- kernel/utility/unit_config_reader.php (revision 13274)
+++ kernel/utility/unit_config_reader.php (working copy)
@@ -806,11 +806,16 @@
$file = $this->prefixFiles[$prefix];
$prefix = $this->PreloadConfigFile($file);
+ if ($this->FinalStage) {
+ // run prefix OnAfterConfigRead so all
+ // hooks to it can define their clonses
+ $this->runAfterConfigRead($prefix);
+ }
+
$clones = $this->postProcessConfig($prefix, 'AggregateConfigs', 'sub_prefix');
$clones = array_merge($this->postProcessConfig($prefix, 'Clones', 'prefix'), $clones);
if ($this->FinalStage) {
- array_unshift($clones, $prefix);
$clones = array_unique($clones);
foreach ($clones as $a_prefix) {
$this->runAfterConfigRead($a_prefix);
Index: units/categories/categories_config.php
===================================================================
--- units/categories/categories_config.php (revision 13270)
+++ units/categories/categories_config.php (working copy)
@@ -48,6 +48,28 @@
'DoSpecial' => '*',
'DoEvent' => 'OnDefineCustomFields',
),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'rel',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'img',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
),
'AutoLoad' => true,
Index: units/category_items/category_items_config.php
===================================================================
--- units/category_items/category_items_config.php (revision 13268)
+++ units/category_items/category_items_config.php (working copy)
@@ -22,13 +22,6 @@
'TagProcessorClass' => Array('class'=>'CategoryItemsTagProcessor','file'=>'category_items_tag_processor.php','build_event'=>'OnBuild'),
'AutoLoad' => true,
- 'Clones' => Array(
- 'l-ci' => Array('ParentPrefix' => 'l'),
- 'n-ci' => Array('ParentPrefix' => 'n'),
- 'bb-ci' => Array('ParentPrefix' => 'bb'),
- 'p-ci' => Array('ParentPrefix' => 'p'),
- 'cms-ci'=> Array('ParentPrefix' => 'cms',),
- ),
'QueryString' => Array(
1 => 'id',
2 => 'page',
Index: units/favorites/favorites_config.php
===================================================================
--- units/favorites/favorites_config.php (revision 13268)
+++ units/favorites/favorites_config.php (working copy)
@@ -23,32 +23,6 @@
'AutoLoad' => true,
- 'Clones' => Array (
- 'l-fav' => Array(
- 'ParentPrefix' => 'l',
- 'ParentTableKey' => 'ResourceId',
- 'ForeignKey' => 'ResourceId',
- ),
-
- 'n-fav' => Array (
- 'ParentPrefix' => 'n',
- 'ParentTableKey' => 'ResourceId',
- 'ForeignKey' => 'ResourceId',
- ),
-
- 'bb-fav' => Array(
- 'ParentPrefix' => 'bb',
- 'ParentTableKey' => 'ResourceId',
- 'ForeignKey' => 'ResourceId',
- ),
-
- 'p-fav' => Array(
- 'ParentPrefix' => 'p',
- 'ParentTableKey' => 'ResourceId',
- 'ForeignKey' => 'ResourceId',
- ),
- ),
-
'Hooks' => Array (
Array(
'Mode' => hAFTER,
Index: units/files/file_eh.php
===================================================================
--- units/files/file_eh.php (revision 13268)
+++ units/files/file_eh.php (working copy)
@@ -31,21 +31,6 @@
}
/**
- * [HOOK] Allows to apply file functionality to specific config
- * When main item is created, then #file config is cloned
- *
- * @param kEvent $event
- */
- function OnDefineFiles(&$event)
- {
- $clones = $this->Application->getUnitOption('#file', 'Clones');
- $clones[$event->MasterEvent->Prefix.'-file'] = Array (
- 'ParentPrefix' => $event->MasterEvent->Prefix,
- );
- $this->Application->setUnitOption('#file', 'Clones', $clones);
- }
-
- /**
* Remembers user, who is created file record. Makes file primary if no other files are uploaded.
*
* @param kEvent $event
Index: units/images/images_config.php
===================================================================
--- units/images/images_config.php (revision 13270)
+++ units/images/images_config.php (working copy)
@@ -17,14 +17,7 @@
$config = Array(
'Prefix' => 'img',
'Clones' => Array (
- 'u-img' => Array('ParentPrefix' => 'u'),
-
- 'l-img' => Array('ParentPrefix' => 'l'),
- 'n-img' => Array('ParentPrefix' => 'n'),
- 'bb-img'=> Array('ParentPrefix' => 'bb'),
'bb-post-img'=> Array('ParentPrefix' => 'bb-post'),
- /*'p-img' => Array('ParentPrefix' => 'p'),*/
- 'c-img' => Array('ParentPrefix' => 'c'),
),
'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
@@ -171,7 +164,7 @@
'default' => 1, 'not_null' => 1, 'use_phrases' => 1,
),
),
-
+
'VirtualFields' => Array(
'Preview' => Array(),
'ImageUrl' => Array(),
Index: units/related_searches/related_searches_config.php
===================================================================
--- units/related_searches/related_searches_config.php (revision 13270)
+++ units/related_searches/related_searches_config.php (working copy)
@@ -19,11 +19,6 @@
'Clones' => Array(
'c-search' => Array('ParentPrefix' => 'c'),
- /*'l-rel' => Array('ParentPrefix' => 'l'),
- 'n-rel' => Array('ParentPrefix' => 'n'),
- 'bb-rel'=> Array('ParentPrefix' => 'bb'),
- 'p-rel' => Array('ParentPrefix' => 'p'),
- 'cms-rel'=> Array('ParentPrefix' => 'cms'),*/
),
'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
Index: units/relationship/relationship_config.php
===================================================================
--- units/relationship/relationship_config.php (revision 13270)
+++ units/relationship/relationship_config.php (working copy)
@@ -17,15 +17,6 @@
$config = Array(
'Prefix' => 'rel',
- 'Clones' => Array(
- 'c-rel' => Array('ParentPrefix' => 'c'),
- 'l-rel' => Array('ParentPrefix' => 'l'),
- 'n-rel' => Array('ParentPrefix' => 'n'),
- 'bb-rel'=> Array('ParentPrefix' => 'bb'),
- /*'p-rel' => Array('ParentPrefix' => 'p'),*/
- /*'cms-rel'=> Array('ParentPrefix' => 'cms'),*/
- ),
-
'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'),
@@ -101,7 +92,7 @@
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_Disabled', 1 => 'la_Enabled'), 'use_phrases' => 1,
- 'not_null' => 1, 'default' => 1,
+ 'not_null' => 1, 'default' => 1,
),
'Priority' => Array('type'=>'int','not_null'=>1,'default'=>0),
),
Index: units/reviews/reviews_config.php
===================================================================
--- units/reviews/reviews_config.php (revision 13270)
+++ units/reviews/reviews_config.php (working copy)
@@ -17,58 +17,6 @@
$config = Array (
'Prefix' => 'rev',
- 'Clones' => Array (
- 'l-rev' => Array (
- 'ParentPrefix' => 'l',
- 'ConfigMapping' => Array (
- 'PerPage' => 'Perpage_LinkReviews',
- 'ShortListPerPage' => 'Perpage_LinkReviews_Short',
- 'DefaultSorting1Field' => 'Link_ReviewsSort',
- 'DefaultSorting2Field' => 'Link_ReviewsSort2',
- 'DefaultSorting1Dir' => 'Link_ReviewsOrder',
- 'DefaultSorting2Dir' => 'Link_ReviewsOrder2',
-
- 'ReviewDelayInterval' => 'link_ReviewDelay_Interval',
- 'ReviewDelayValue' => 'link_ReviewDelay_Value',
- ),
- ),
-
- 'n-rev' => Array (
- 'ParentPrefix' => 'n',
- 'ConfigMapping' => Array (
- 'PerPage' => 'Perpage_NewsReviews',
- 'ShortListPerPage' => 'Perpage_NewsReviews_Short',
- 'DefaultSorting1Field' => 'News_SortReviews',
- 'DefaultSorting2Field' => 'News_SortReviews2',
- 'DefaultSorting1Dir' => 'News_SortReviewsOrder',
- 'DefaultSorting2Dir' => 'News_SortReviewsOrder2',
-
- 'ReviewDelayInterval' => 'News_ReviewDelay_Interval',
- 'ReviewDelayValue' => 'News_ReviewDelay_Value',
- ),
- ),
-
- 'bb-rev' => Array (
- 'ParentPrefix' => 'bb',
- 'ConfigMapping' => Array (
- 'PerPage' => 'Perpage_TopicReviews',
-
- 'ReviewDelayInterval' => 'topic_ReviewDelay_Interval',
- 'ReviewDelayValue' => 'topic_ReviewDelay_Value',
- ),
- ),
-
- 'p-rev' => Array (
- 'ParentPrefix' => 'p',
- 'ConfigMapping' => Array (
- 'PerPage' => 'Comm_Perpage_Reviews',
-
- 'ReviewDelayInterval' => 'product_ReviewDelay_Value',
- 'ReviewDelayValue' => 'product_ReviewDelay_Interval',
- ),
- ),
- ),
-
'ItemClass' => Array ('class' => 'kDBItem', 'file' => '', 'build_event' => 'OnItemBuild'),
'ListClass' => Array ('class' => 'kDBList', 'file' => '', 'build_event' => 'OnListBuild'),
'EventHandlerClass' => Array ('class' => 'ReviewsEventHandler', 'file' => 'reviews_event_handler.php', 'build_event' => 'OnBuild'),
@@ -169,8 +117,8 @@
'formatter' => 'kDateFormatter', 'default' => '#NOW#',
),
'ReviewText' => Array (
- 'type' => 'string',
- 'formatter' => 'kFormatter',
+ 'type' => 'string',
+ 'formatter' => 'kFormatter',
'using_fck' => 1, 'default' => null, 'required' => 1,
),
'Rating' => Array (
@@ -187,7 +135,7 @@
'min_value_inc' => 0, 'max_value_inc' => 5, 'default' => 0,
),
'IPAddress' => Array (
- 'type' => 'string',
+ 'type' => 'string',
'max_value_inc' => 15, 'not_null' =>1, 'default' => '',
),
'ItemId' => Array (
@@ -201,8 +149,8 @@
'left_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'PortalUser
WHERE `%s` = \'%s\' ',
'left_key_field' => 'PortalUserId',
- 'left_title_field' => 'Login',
- 'required' => 1, 'not_null' => 1, 'default' => -1,
+ 'left_title_field' => 'Login',
+ 'required' => 1, 'not_null' => 1, 'default' => -1,
'error_msgs' => Array ('invalid_option' => '!la_error_UserNotFound!'),
),
'ItemType' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
@@ -213,7 +161,7 @@
'options' => Array (
0 => 'la_Disabled',
1 => 'la_Active',
- 2 => 'la_Pending',
+ 2 => 'la_Pending',
),
'not_null' =>1, 'default' => 2,
),
Index: units/structure/structure_config.php
===================================================================
--- units/structure/structure_config.php (revision 13268)
+++ units/structure/structure_config.php (working copy)
@@ -41,6 +41,28 @@
'DoSpecial' => '*',
'DoEvent' => 'OnDefineCustomFields',
),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'rel',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'img',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
),
'IDField' => 'CategoryId',
Index: units/users/users_config.php
===================================================================
--- units/users/users_config.php (revision 13268)
+++ units/users/users_config.php (working copy)
@@ -71,6 +71,17 @@
'DoEvent' => 'OnAutoLoginUser',
),
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'img',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
// Captcha processing
Array (
'Mode' => hAFTER,
@@ -474,7 +485,7 @@
'PortalUserId' => Array ('title' => 'la_col_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 70),
'Login' => Array ('title' => 'la_col_Username', 'filter_block' => 'grid_like_filter', 'width' => 150, ),
'FirstName' => Array ('title' => 'la_col_FirstName', 'filter_block' => 'grid_like_filter', 'width' => 150, ),
- 'LastName' => Array ('title' => 'la_col_LastName', 'filter_block' => 'grid_like_filter', 'width' => 150, ),
+ 'LastName' => Array ('title' => 'la_col_LastName', 'filter_block' => 'grid_like_filter', 'width' => 150, ),
'Email' => Array ('title' => 'la_col_Email', 'filter_block' => 'grid_like_filter', 'width' => 200, ),
'PrimaryGroup' => Array ('title' => 'la_col_PrimaryGroup', 'filter_block' => 'grid_like_filter', 'width' => 140),
'Status' => Array ('title' => 'la_col_Status', 'filter_block' => 'grid_options_filter', 'width' => 100, ),
dynamic_clone_OnAfterConfigRead_modules_v2.patch [^] (21,393 bytes) 2010-03-21 07:52
[Show Content]
Index: in-bulletin/units/topics/topics_config.php
===================================================================
--- in-bulletin/units/topics/topics_config.php (revision 13268)
+++ in-bulletin/units/topics/topics_config.php (working copy)
@@ -44,6 +44,61 @@
'DoSpecial' => '*',
'DoEvent' => 'OnDefineCustomFields',
),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'rev',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'fav',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'rel',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'img',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'ci',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
),
'CatalogItem' => true,
@@ -331,7 +386,7 @@
'type' => 'int',
'formatter' => 'kOptionsFormatter',
'options' => Array (
- 0 => 'la_Disabled',
+ 0 => 'la_Disabled',
1 => 'la_Active',
2 => 'la_Pending',
),
Index: in-bulletin/units/topics/topics_event_handler.php
===================================================================
--- in-bulletin/units/topics/topics_event_handler.php (revision 13268)
+++ in-bulletin/units/topics/topics_event_handler.php (working copy)
@@ -207,4 +207,28 @@
$virtual_fields['ShowSignatures']['default'] = (int)$this->Application->RecallPersistentVar('show_sig');
$this->Application->setUnitOption($event->Prefix, 'VirtualFields', $virtual_fields);
}
+
+ /**
+ * [HOOK] Allows to add cloned subitem to given prefix
+ *
+ * @param kEvent $event
+ */
+ function OnCloneSubItem(&$event)
+ {
+ parent::OnCloneSubItem($event);
+
+ if ($event->MasterEvent->Prefix == 'rev') {
+ $clones = $this->Application->getUnitOption($event->MasterEvent->Prefix, 'Clones');
+ $subitem_prefix = $event->Prefix . '-' . $event->MasterEvent->Prefix;
+
+ $clones[$subitem_prefix]['ConfigMapping'] = Array (
+ 'PerPage' => 'Perpage_TopicReviews',
+
+ 'ReviewDelayInterval' => 'topic_ReviewDelay_Interval',
+ 'ReviewDelayValue' => 'topic_ReviewDelay_Value',
+ );
+
+ $this->Application->setUnitOption($event->MasterEvent->Prefix, 'Clones', $clones);
+ }
+ }
}
\ No newline at end of file
Index: in-commerce/units/products/products_config.php
===================================================================
--- in-commerce/units/products/products_config.php (revision 13268)
+++ in-commerce/units/products/products_config.php (working copy)
@@ -105,6 +105,39 @@
'DoSpecial' => '*',
'DoEvent' => 'OnDefineCustomFields',
),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'rev',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'fav',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'ci',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
),
'IDField' => 'ProductId',
@@ -426,10 +459,10 @@
'ProductId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0,),
'Name' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'required' => 1, 'max_len' =>255, 'default' => ''),
'AutomaticFilename' => Array (
- 'type' => 'int',
- 'formatter' => 'kOptionsFormatter',
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'),
- 'use_phrases' => 1, 'not_null' => 1, 'default' => 1,
+ 'use_phrases' => 1, 'not_null' => 1, 'default' => 1,
),
'SKU' => Array ('type' => 'string', 'required' => 1, 'max_len' =>255, 'error_msgs' => Array ('required' => 'Please fill in'), 'default' => NULL),
'Description' => Array ('type' => 'string', 'formatter' => 'kMultiLanguage', 'using_fck' => 1, 'default' => NULL),
@@ -439,7 +472,7 @@
'ManufacturerId' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' =>Array (0 => ''), 'options_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Manufacturers ORDER BY Name', 'option_key_field' => 'ManufacturerId', 'option_title_field' => 'Name', 'not_null' => 1, 'default' => 0),
'Status' => Array (
'type' => 'int',
- 'formatter' => 'kOptionsFormatter',
+ 'formatter' => 'kOptionsFormatter',
'options' => Array (1 => 'la_Active', 2 => 'la_Pending', 0 => 'la_Disabled'), 'use_phrases' => 1,
'default' => 2, 'not_null' => 1,
),
@@ -497,10 +530,10 @@
'ProcessingData' => Array ('type' => 'string', 'default' => ''),
'PackageContent' => Array ('type' => 'string', 'default' => NULL),
'IsRecurringBilling' => Array (
- 'type' => 'int',
- 'formatter' => 'kOptionsFormatter',
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'),
- 'use_phrases' => 1, 'not_null' => 1, 'default' => 0,
+ 'use_phrases' => 1, 'not_null' => 1, 'default' => 0,
),
//'PayPalRecurring' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'not_null' => '1', 'default' => '0'),
'ShippingMode' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'use_phrases' => 1, 'options' =>Array (0 => 'la_shipping_AnyAndSelected', 1 => 'la_shipping_Limited'), 'not_null' => 1, 'default' =>0),
@@ -519,7 +552,7 @@
'MetaKeywords' => Array ('type' => 'string', 'default' => null),
'MetaDescription' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
),
-
+
'VirtualFields' => Array (
'Qty' => 1,
'Price' => Array ('type' => 'float', 'formatter' => 'kFormatter', 'format' => '%.2f', 'default' => NULL),
@@ -538,8 +571,8 @@
'LineEndings' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'Windows', 2 => 'UNIX'), 'default' => 1),
'LineEndingsInside' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'CRLF', 2 => 'LF'), 'default' => 2),
'IncludeFieldTitles' => Array (
- 'type' => 'int',
- 'formatter' => 'kOptionsFormatter',
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'),
'use_phrases' => 1, 'not_null' => 1, 'default' => 1,
),
@@ -548,8 +581,8 @@
'CategoryFormat' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_MixedCategoryPath', 2 => 'la_SeparatedCategoryPath'), 'use_phrases' => 1, 'default' => 1),
'CategorySeparator' => Array ('type' => 'string', 'default' => ':'),
'IsBaseCategory' => Array (
- 'type' => 'int',
- 'formatter' => 'kOptionsFormatter',
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'),
'use_phrases' => 1, 'not_null' => 1, 'default' => 0,
),
@@ -587,7 +620,7 @@
'LocalPath' => Array ('type' => 'string', 'default' => ''),
'FullUrl' => Array ('type' => 'string', 'default' => ''),
),
-
+
'Grids' => Array (
'Default' => Array (
'Icons' => Array (
Index: in-commerce/units/products/products_event_handler.php
===================================================================
--- in-commerce/units/products/products_event_handler.php (revision 13268)
+++ in-commerce/units/products/products_event_handler.php (working copy)
@@ -1289,4 +1289,28 @@
$edit_tab_presets['Default']['shopping_cart'] = Array ('title' => 'la_tab_ShopCartEntry', 't' => 'in-commerce/paid_listings/paid_listing_type_shopcart', 'priority' => 2);
$this->Application->setUnitOption($event->MasterEvent->Prefix, 'EditTabPresets', $edit_tab_presets);
}
+
+ /**
+ * [HOOK] Allows to add cloned subitem to given prefix
+ *
+ * @param kEvent $event
+ */
+ function OnCloneSubItem(&$event)
+ {
+ parent::OnCloneSubItem($event);
+
+ if ($event->MasterEvent->Prefix == 'rev') {
+ $clones = $this->Application->getUnitOption($event->MasterEvent->Prefix, 'Clones');
+ $subitem_prefix = $event->Prefix . '-' . $event->MasterEvent->Prefix;
+
+ $clones[$subitem_prefix]['ConfigMapping'] = Array (
+ 'PerPage' => 'Comm_Perpage_Reviews',
+
+ 'ReviewDelayInterval' => 'product_ReviewDelay_Value',
+ 'ReviewDelayValue' => 'product_ReviewDelay_Interval',
+ );
+
+ $this->Application->setUnitOption($event->MasterEvent->Prefix, 'Clones', $clones);
+ }
+ }
}
\ No newline at end of file
Index: in-link/units/links/links_config.php
===================================================================
--- in-link/units/links/links_config.php (revision 13268)
+++ in-link/units/links/links_config.php (working copy)
@@ -42,14 +42,70 @@
Array (
'Mode' => hBEFORE,
'Conditional' => false,
- 'HookToPrefix' => '',
+ 'HookToPrefix' => '#file',
'HookToSpecial' => '*',
'HookToEvent' => Array ('OnAfterConfigRead'),
- 'DoPrefix' => '#file',
+ 'DoPrefix' => '',
'DoSpecial' => '*',
- 'DoEvent' => 'OnDefineFiles',
+ 'DoEvent' => 'OnCloneSubItem',
),
+
Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'rev',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'fav',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'rel',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'img',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'ci',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
+ Array (
'Mode' => hAFTER,
'Conditional' => false,
'HookToPrefix' => '',
@@ -58,7 +114,7 @@
'DoPrefix' => 'captcha',
'DoSpecial' => '*',
'DoEvent' => 'OnPrepareCaptcha',
- ),
+ ),
),
'QueryString' => Array (
@@ -467,8 +523,8 @@
'LineEndings' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'Windows', 2 => 'UNIX'), 'default' => 1),
'LineEndingsInside' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'CRLF', 2 => 'LF'), 'default' => 2),
'IncludeFieldTitles' => Array (
- 'type' => 'int',
- 'formatter' => 'kOptionsFormatter',
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'),
'use_phrases' => 1, 'not_null' => 1, 'default' => 1,
),
@@ -477,8 +533,8 @@
'CategoryFormat' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_MixedCategoryPath', 2 => 'la_SeparatedCategoryPath'), 'use_phrases' => 1, 'default' => 1),
'CategorySeparator' => Array ('type' => 'string', 'error_field' => 'CategoryFormat', 'default' => ':'),
'IsBaseCategory' => Array (
- 'type' => 'int',
- 'formatter' => 'kOptionsFormatter',
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'),
'use_phrases' => 1, 'not_null' => 1, 'default' => 0,
),
Index: in-link/units/links/links_event_handler.php
===================================================================
--- in-link/units/links/links_event_handler.php (revision 13268)
+++ in-link/units/links/links_event_handler.php (working copy)
@@ -485,4 +485,33 @@
return $events;
}
+
+ /**
+ * [HOOK] Allows to add cloned subitem to given prefix
+ *
+ * @param kEvent $event
+ */
+ function OnCloneSubItem(&$event)
+ {
+ parent::OnCloneSubItem($event);
+
+ if ($event->MasterEvent->Prefix == 'rev') {
+ $clones = $this->Application->getUnitOption($event->MasterEvent->Prefix, 'Clones');
+ $subitem_prefix = $event->Prefix . '-' . $event->MasterEvent->Prefix;
+
+ $clones[$subitem_prefix]['ConfigMapping'] = Array (
+ 'PerPage' => 'Perpage_LinkReviews',
+ 'ShortListPerPage' => 'Perpage_LinkReviews_Short',
+ 'DefaultSorting1Field' => 'Link_ReviewsSort',
+ 'DefaultSorting2Field' => 'Link_ReviewsSort2',
+ 'DefaultSorting1Dir' => 'Link_ReviewsOrder',
+ 'DefaultSorting2Dir' => 'Link_ReviewsOrder2',
+
+ 'ReviewDelayInterval' => 'link_ReviewDelay_Interval',
+ 'ReviewDelayValue' => 'link_ReviewDelay_Value',
+ );
+
+ $this->Application->setUnitOption($event->MasterEvent->Prefix, 'Clones', $clones);
+ }
+ }
}
\ No newline at end of file
Index: in-news/units/articles/articles_config.php
===================================================================
--- in-news/units/articles/articles_config.php (revision 13268)
+++ in-news/units/articles/articles_config.php (working copy)
@@ -46,21 +46,76 @@
'HookToPrefix' => '',
'HookToSpecial' => '*',
'HookToEvent' => Array ('OnAfterConfigRead'),
- 'DoPrefix' => '#file',
+ 'DoPrefix' => 'cdata',
'DoSpecial' => '*',
- 'DoEvent' => 'OnDefineFiles',
+ 'DoEvent' => 'OnDefineCustomFields',
),
Array (
'Mode' => hBEFORE,
'Conditional' => false,
- 'HookToPrefix' => '',
+ 'HookToPrefix' => '#file',
'HookToSpecial' => '*',
'HookToEvent' => Array ('OnAfterConfigRead'),
- 'DoPrefix' => 'cdata',
+ 'DoPrefix' => '',
'DoSpecial' => '*',
- 'DoEvent' => 'OnDefineCustomFields',
+ 'DoEvent' => 'OnCloneSubItem',
),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'rev',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'fav',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'rel',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'img',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
+
+ Array (
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'ci',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterConfigRead'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCloneSubItem',
+ ),
),
'CatalogItem' => true,
@@ -339,8 +394,8 @@
'NewsId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0,),
'Title' => Array ('type' => 'string', /*'formatter' => 'kMultiLanguage', */'not_null' => 1, 'required' => 1, 'default' => '', 'max_len' => 255),
'AutomaticFilename' => Array (
- 'type' => 'int',
- 'formatter' => 'kOptionsFormatter',
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'),
'use_phrases' => 1, 'not_null' => 1, 'default' => 1,
),
@@ -423,8 +478,8 @@
'LineEndings' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'Windows', 2 => 'UNIX'), 'default' => 1),
'LineEndingsInside' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'CRLF', 2 => 'LF'), 'default' => 2),
'IncludeFieldTitles' => Array (
- 'type' => 'int',
- 'formatter' => 'kOptionsFormatter',
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'),
'use_phrases' => 1, 'not_null' => 1, 'default' => 1,
),
@@ -433,8 +488,8 @@
'CategoryFormat' => Array ('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_MixedCategoryPath', 2 => 'la_SeparatedCategoryPath'), 'use_phrases' => 1, 'default' => 1),
'CategorySeparator' => Array ('type' => 'string', 'default' => ':'),
'IsBaseCategory' => Array (
- 'type' => 'int',
- 'formatter' => 'kOptionsFormatter',
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter',
'options' => Array (0 => 'la_No', 1 => 'la_Yes'),
'use_phrases' => 1, 'not_null' => 1, 'default' => 0,
),
Index: in-news/units/articles/articles_event_handler.php
===================================================================
--- in-news/units/articles/articles_event_handler.php (revision 13268)
+++ in-news/units/articles/articles_event_handler.php (working copy)
@@ -512,4 +512,33 @@
}
}
}
+
+ /**
+ * [HOOK] Allows to add cloned subitem to given prefix
+ *
+ * @param kEvent $event
+ */
+ function OnCloneSubItem(&$event)
+ {
+ parent::OnCloneSubItem($event);
+
+ if ($event->MasterEvent->Prefix == 'rev') {
+ $clones = $this->Application->getUnitOption($event->MasterEvent->Prefix, 'Clones');
+ $subitem_prefix = $event->Prefix . '-' . $event->MasterEvent->Prefix;
+
+ $clones[$subitem_prefix]['ConfigMapping'] = Array (
+ 'PerPage' => 'Perpage_NewsReviews',
+ 'ShortListPerPage' => 'Perpage_NewsReviews_Short',
+ 'DefaultSorting1Field' => 'News_SortReviews',
+ 'DefaultSorting2Field' => 'News_SortReviews2',
+ 'DefaultSorting1Dir' => 'News_SortReviewsOrder',
+ 'DefaultSorting2Dir' => 'News_SortReviewsOrder2',
+
+ 'ReviewDelayInterval' => 'News_ReviewDelay_Interval',
+ 'ReviewDelayValue' => 'News_ReviewDelay_Value',
+ );
+
+ $this->Application->setUnitOption($event->MasterEvent->Prefix, 'Clones', $clones);
+ }
+ }
}
\ No newline at end of file
|