Index: branches/1.0.x/units/sections/e_article_tp.php =================================================================== diff -u -N --- branches/1.0.x/units/sections/e_article_tp.php (revision 0) +++ branches/1.0.x/units/sections/e_article_tp.php (revision 12973) @@ -0,0 +1,28 @@ +Application->getUnitOption($event->Prefix, 'Fields'); #get regular fields -// $fields['Status']['default'] = 1; #add/edit configuration (make default = 1) +// $fields['Status']['default'] = STATUS_ACTIVE; #add/edit configuration (make default = STATUS_ACTIVE) $this->Application->setUnitOption($event->Prefix, 'Fields', $fields); #save fields # 2. Virtual Fields from /in-link/units/links/links_config.php Index: branches/1.0.x/units/sections/e_review_eh.php =================================================================== diff -u -N --- branches/1.0.x/units/sections/e_review_eh.php (revision 0) +++ branches/1.0.x/units/sections/e_review_eh.php (revision 12973) @@ -0,0 +1,127 @@ +Application->getUnitOption($event->Prefix, 'Fields'); +// $this->Application->setUnitOption($event->Prefix, 'Fields', $fields); + + // 2. calculated fields +// $calculated_fields = $this->Application->getUnitOption($event->Prefix, 'CalculatedFields'); +// $this->Application->setUnitOption($event->Prefix, 'CalculatedFields', $calculated_fields); + } + + + /** + * Before new item created + * + * @param kEvent $event + */ + function OnBeforeItemCreate(&$event) + { + parent::OnBeforeItemCreate($event); + + + } + + /** + * Before existing item updated + * + * @param kEvent $event + */ + function OnBeforeItemUpdate(&$event) + { + parent::OnBeforeItemUpdate($event); + + + } + + /** + * Before item deleted + * + * @param kEvent $event + */ + function OnBeforeItemDelete(&$event) + { + parent::OnBeforeItemDelete($event); + + + } + + /** + * After item loaded + * + * @param kEvent $event + */ + function OnBeforeItemLoad(&$event) + { + parent::OnBeforeItemLoad($event); + + + } + + + /** + * After new item created + * + * @param kEvent $event + */ + function OnAfterItemCreate(&$event) + { + parent::OnAfterItemCreate($event); + + + } + + /** + * After existing item updated + * + * @param kEvent $event + */ + function OnAfterItemUpdate(&$event) + { + parent::OnAfterItemUpdate($event); + + + } + + /** + * After item deleted + * + * @param kEvent $event + */ + function OnAfterItemDelete(&$event) + { + parent::OnAfterItemDelete($event); + + + } + + /** + * After item loaded + * + * @param kEvent $event + */ + function OnAfterItemLoad(&$event) + { + parent::OnAfterItemLoad($event); + + + } + + } Index: branches/1.0.x/units/sections/sections_config.php =================================================================== diff -u -N -r12914 -r12973 --- branches/1.0.x/units/sections/sections_config.php (.../sections_config.php) (revision 12914) +++ branches/1.0.x/units/sections/sections_config.php (.../sections_config.php) (revision 12973) @@ -7,7 +7,7 @@ * @package Custom (Development Kit) */ -defined('FULL_PATH') or die('restricted access!'); + defined('FULL_PATH') or die('restricted access!'); $config = Array ( @@ -35,7 +35,16 @@ # extend default Link /in-link/units/links/link_tag_processor.php / links_event_handler.php // Array ('pseudo' => 'l_TagProcessor', 'class' => 'ELinkTagProcessor', 'file' => 'e_link_tp.php'), // Array ('pseudo' => 'l_EventHandler', 'class' => 'ELinkEventHandler', 'file' => 'e_link_eh.php'), - + + # extend default Category /core/units/categories/categories_tag_processor.php / categories_event_handler.php +// Array ('pseudo' => 'c_TagProcessor', 'class' => 'ECategoryTagProcessor', 'file' => 'e_category_tp.php'), +// Array ('pseudo' => 'c_EventHandler', 'class' => 'ECategoryEventHandler', 'file' => 'e_category_eh.php'), + + # extend default Article /in-news/units/articles/article_tag_processor.php / articles_event_handler.php +// Array ('pseudo' => 'n_TagProcessor', 'class' => 'EArticleTagProcessor', 'file' => 'e_article_tp.php'), +// Array ('pseudo' => 'n_EventHandler', 'class' => 'EArticleEventHandler', 'file' => 'e_article_eh.php'), +// Array ('pseudo' => 'n-rev_EventHandler', 'class' => 'EReviewEventHandler', 'file' => 'e_review_eh.php'), + ), # Replace/substiture any admin default templates with custom ones Index: branches/1.0.x/units/sections/e_category_tp.php =================================================================== diff -u -N --- branches/1.0.x/units/sections/e_category_tp.php (revision 0) +++ branches/1.0.x/units/sections/e_category_tp.php (revision 12973) @@ -0,0 +1,28 @@ + Array ('self' => true), + + # front + 'OnCustomEvent2' => Array ('self' => true), + ); + + $this->permMapping = array_merge($this->permMapping, $permissions); + } + + /** + * Permission exceptions + * + * @param kEvent $event + */ + function CheckPermission(&$event) + { + $skip_permissions_check_events = Array ( + 'OnAnotherCustomEvent', + ); + + if ( in_array($event->Name, $skip_permissions_check_events) ) { + return true; + } + + return parent::CheckPermission($event); + } + + /** + * Updates structure config + * + * @param kEvent $event + */ + function OnAfterConfigRead(&$event) + { + parent::OnAfterConfigRead($event); + + # 1. Regular Fields from /in-news/units/articles/articles_config.php + $fields = $this->Application->getUnitOption($event->Prefix, 'Fields'); #get regular fields +// $fields['Status']['default'] = STATUS_ACTIVE; #add/edit configuration (make default = STATUS_ACTIVE) + $this->Application->setUnitOption($event->Prefix, 'Fields', $fields); #save fields + + # 2. Virtual Fields from /in-news/units/articles/articles_config.php + $virtual_fields = $this->Application->getUnitOption($event->Prefix, 'VirtualFields'); #get virtual fields +// $virtual_fields['UserName']['default'] = ''; #add/edit configuration + $this->Application->setUnitOption($event->Prefix, 'VirtualFields', $virtual_fields); #save virtual fields + } + + /** + * Sets custom query for the list + * + * @param kEvent $event + */ + function SetCustomQuery(&$event) + { + parent::SetCustomQuery($event); + + $object =& $event->getObject(); + /* @var $object kDBList */ + + # identifying event based on special and setting filter + if ($event->Special == 'custom-special') { +// $object->addFilter('primary_filter', '%1$s.Status = ' . STATUS_DISABLED); + } + + # identifying event based not admin condition and setting filter + if (!$this->Application->isAdminUser) { +// $object->addFilter('status_filter', '%1$s.Status = ' . STATUS_ACTIVE); + } + } + + /** + * Before new item created + * + * @param kEvent $event + */ + function OnBeforeItemCreate(&$event) + { + parent::OnBeforeItemCreate($event); + + + } + + /** + * Before existing item updated + * + * @param kEvent $event + */ + function OnBeforeItemUpdate(&$event) + { + parent::OnBeforeItemUpdate($event); + + + } + + /** + * Before item deleted + * + * @param kEvent $event + */ + function OnBeforeItemDelete(&$event) + { + parent::OnBeforeItemDelete($event); + + + } + + /** + * After item loaded + * + * @param kEvent $event + */ + function OnBeforeItemLoad(&$event) + { + parent::OnBeforeItemLoad($event); + + + } + + + /** + * After new item created + * + * @param kEvent $event + */ + function OnAfterItemCreate(&$event) + { + parent::OnAfterItemCreate($event); + + + } + + /** + * After existing item updated + * + * @param kEvent $event + */ + function OnAfterItemUpdate(&$event) + { + parent::OnAfterItemUpdate($event); + + + } + + /** + * After item deleted + * + * @param kEvent $event + */ + function OnAfterItemDelete(&$event) + { + parent::OnAfterItemDelete($event); + + + } + + /** + * After item loaded + * + * @param kEvent $event + */ + function OnAfterItemLoad(&$event) + { + parent::OnAfterItemLoad($event); + + + } + + } Index: branches/1.0.x/units/sections/e_user_tp.php =================================================================== diff -u -N -r12914 -r12973 --- branches/1.0.x/units/sections/e_user_tp.php (.../e_user_tp.php) (revision 12914) +++ branches/1.0.x/units/sections/e_user_tp.php (.../e_user_tp.php) (revision 12973) @@ -8,16 +8,15 @@ */ class EUserTagProcessor extends UsersTagProcessor { - /** * Returns formated user address * * @param Array * @return string */ - function PrintFormattedUserAddress($param) + function PrintFormattedUserAddress($params) { - $object =& $event->getObject(); + $object =& $this->getObject($params); /* @var $object kDBItem */ $ret = ''; Index: branches/1.0.x/units/sections/e_link_tp.php =================================================================== diff -u -N -r12914 -r12973 --- branches/1.0.x/units/sections/e_link_tp.php (.../e_link_tp.php) (revision 12914) +++ branches/1.0.x/units/sections/e_link_tp.php (.../e_link_tp.php) (revision 12973) @@ -24,33 +24,5 @@ return $o; } - - /** - * Variantion of overriding Field method for Link - * - * @param Array $params - * @return string - */ - function Field($params) - { - $object =& $this->getObject($params); - /* @var $object kDBItem */ - - $o = ''; - - // do some custom stuff here - if ( $object->isLoaded() ) { - $o = $object->GetField($this->SelectParam($params, 'name,field') ); #field Formatter applied - -// $o = $object->GetDBField($this->SelectParam($params, 'name,field') ); #field Formatter NOT applied - } - - // in case if no data found - if ($o != '') { - $this->Application->Parser->DataExists = true; - } - - return $o; - } - + } \ No newline at end of file Index: branches/1.0.x/units/sections/e_category_eh.php =================================================================== diff -u -N --- branches/1.0.x/units/sections/e_category_eh.php (revision 0) +++ branches/1.0.x/units/sections/e_category_eh.php (revision 12973) @@ -0,0 +1,188 @@ + Array ('self' => true), + + # front + 'OnCustomEvent2' => Array ('self' => true), + ); + + $this->permMapping = array_merge($this->permMapping, $permissions); + } + + /** + * Permission exceptions + * + * @param kEvent $event + */ + function CheckPermission(&$event) + { + $skip_permissions_check_events = Array ( + 'OnAnotherCustomEvent', + ); + + if ( in_array($event->Name, $skip_permissions_check_events) ) { + return true; + } + + return parent::CheckPermission($event); + } + + /** + * Updates structure config + * + * @param kEvent $event + */ + function OnAfterConfigRead(&$event) + { + parent::OnAfterConfigRead($event); + + # 1. Regular Fields from /core/units/categories/categories_config.php + $fields = $this->Application->getUnitOption($event->Prefix, 'Fields'); #get regular fields +// $fields['Status']['default'] = STATUS_ACTIVE; #add/edit configuration (make default = STATUS_ACTIVE) + $this->Application->setUnitOption($event->Prefix, 'Fields', $fields); #save fields + + # 2. Virtual Fields from /core/units/categories/categories_config.php + $virtual_fields = $this->Application->getUnitOption($event->Prefix, 'VirtualFields'); #get virtual fields +// $virtual_fields['UserName']['default'] = ''; #add/edit configuration + $this->Application->setUnitOption($event->Prefix, 'VirtualFields', $virtual_fields); #save virtual fields + } + + /** + * Sets custom query for the list + * + * @param kEvent $event + */ + function SetCustomQuery(&$event) + { + parent::SetCustomQuery($event); + + $object =& $event->getObject(); + /* @var $object kDBList */ + + # identifying event based on special and setting filter + if ($event->Special == 'custom-special') { +// $object->addFilter('primary_filter', '%1$s.Status = ' . STATUS_DISABLED); + } + + # identifying event based not admin condition and setting filter + if (!$this->Application->isAdminUser) { +// $object->addFilter('status_filter', '%1$s.Status = ' . STATUS_ACTIVE); + } + } + + /** + * Before new item created + * + * @param kEvent $event + */ + function OnBeforeItemCreate(&$event) + { + parent::OnBeforeItemCreate($event); + + + } + + /** + * Before existing item updated + * + * @param kEvent $event + */ + function OnBeforeItemUpdate(&$event) + { + parent::OnBeforeItemUpdate($event); + + + } + + /** + * Before item deleted + * + * @param kEvent $event + */ + function OnBeforeItemDelete(&$event) + { + parent::OnBeforeItemDelete($event); + + + } + + /** + * After item loaded + * + * @param kEvent $event + */ + function OnBeforeItemLoad(&$event) + { + parent::OnBeforeItemLoad($event); + + + } + + + /** + * After new item created + * + * @param kEvent $event + */ + function OnAfterItemCreate(&$event) + { + parent::OnAfterItemCreate($event); + + + } + + /** + * After existing item updated + * + * @param kEvent $event + */ + function OnAfterItemUpdate(&$event) + { + parent::OnAfterItemUpdate($event); + + + } + + /** + * After item deleted + * + * @param kEvent $event + */ + function OnAfterItemDelete(&$event) + { + parent::OnAfterItemDelete($event); + + + } + + /** + * After item loaded + * + * @param kEvent $event + */ + function OnAfterItemLoad(&$event) + { + parent::OnAfterItemLoad($event); + + + } + + } Index: branches/1.0.x/units/sections/e_product_eh.php =================================================================== diff -u -N -r12914 -r12973 --- branches/1.0.x/units/sections/e_product_eh.php (.../e_product_eh.php) (revision 12914) +++ branches/1.0.x/units/sections/e_product_eh.php (.../e_product_eh.php) (revision 12973) @@ -9,7 +9,7 @@ class EProductEventHandler extends ProductsEventHandler { /** - * Allows to override standart permission mapping + * Allows to override standard permission mapping * */ function mapPermissions() @@ -56,7 +56,7 @@ # 1. Regular Fields from /in-commerce/units/products/products_config.php $fields = $this->Application->getUnitOption($event->Prefix, 'Fields'); #get regular fields -// $fields['Status']['default'] = 1; #add/edit field configuration (make default = 1) +// $fields['Status']['default'] = STATUS_ACTIVE; #add/edit field configuration (make default = STATUS_ACTIVE) $this->Application->setUnitOption($event->Prefix, 'Fields', $fields); #save regular fields