Index: trunk/core/kernel/db/db_tag_processor.php =================================================================== diff -u -N -r8360 -r8369 --- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 8360) +++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 8369) @@ -550,7 +550,6 @@ $currency =& $this->Application->recallObject('curr.-'.$iso, null, Array('skip_autoload' => true)); if( !$currency->isLoaded() ) $currency->Load($iso, 'ISO'); - $symbol = $currency->GetDBField('Symbol'); if (!$symbol) $symbol = $currency->GetDBField('ISO').' '; if ($currency->GetDBField('SymbolPosition') == 0) { @@ -1400,11 +1399,12 @@ } } - function GridInfo($params) { + function GridInfo($params) + { $object =& $this->GetList($params); /* @var $object kDBList */ - switch ($params['type']) - { + + switch ($params['type']) { case 'filtered': return $object->GetRecordsCount(); case 'total': @@ -1416,7 +1416,7 @@ case 'total_pages': return $object->GetTotalPages(); case 'needs_pagination': - return $object->RecordsCount > $object->PerPage; + return ($object->RecordsCount > $object->PerPage) || ($object->Page > 1); } } Index: trunk/themes/default2007/platform/designs/side_boxes.tpl =================================================================== diff -u -N -r8368 -r8369 --- trunk/themes/default2007/platform/designs/side_boxes.tpl (.../side_boxes.tpl) (revision 8368) +++ trunk/themes/default2007/platform/designs/side_boxes.tpl (.../side_boxes.tpl) (revision 8369) @@ -1,12 +1,12 @@ - - Index: trunk/themes/default2007/platform/elements/pagination.tpl =================================================================== diff -u -N -r8368 -r8369 --- trunk/themes/default2007/platform/elements/pagination.tpl (.../pagination.tpl) (revision 8368) +++ trunk/themes/default2007/platform/elements/pagination.tpl (.../pagination.tpl) (revision 8369) @@ -24,7 +24,7 @@ - + Index: trunk/kernel/units/reviews/reviews_event_handler.php =================================================================== diff -u -N -r7635 -r8369 --- trunk/kernel/units/reviews/reviews_event_handler.php (.../reviews_event_handler.php) (revision 7635) +++ trunk/kernel/units/reviews/reviews_event_handler.php (.../reviews_event_handler.php) (revision 8369) @@ -46,52 +46,47 @@ function SetCustomQuery(&$event) { $object =& $event->getObject(); + + if (!$this->Application->IsAdmin()) { + $object->addFilter('active', '%1$s.Status = '.STATUS_ACTIVE); + } + switch ($event->Special) { case 'showall': $object->clearFilters(); break; - case 'products': - $object->removeFilter('parent_filter'); // this is important - $object->addFilter('product_reviews', '%1$s.ItemId = pr.ResourceId'); - // $object->addFilter('active', '%1$s.Status = 1'); - - /*$this->Application->setUnitOption('p', 'AutoLoad', true); - $product =& $this->Application->recallObject('p'); - $object->addFilter('current_product', 'pr.ResourceId = '.$product->GetDBField('ResourceId'));*/ - break; - case 'item': $object->clearFilters(); $info = $object->getLinkedInfo(); $this->Application->setUnitOption($info['ParentPrefix'], 'AutoLoad', true); $parent =& $this->Application->recallObject($info['ParentPrefix']); $object->addFilter('item_reviews', '%1$s.ItemId = '.$parent->GetDBField('ResourceId')); - $object->addFilter('active', '%1$s.Status = 1'); break; + case 'products': + $object->removeFilter('parent_filter'); // this is important + $object->addFilter('product_reviews', '%1$s.ItemId = pr.ResourceId'); + break; + case 'product': $object->clearFilters(); $object->addFilter('product_reviews', '%1$s.ItemId = pr.ResourceId'); - $object->addFilter('active', '%1$s.Status = 1'); $this->Application->setUnitOption('p', 'AutoLoad', true); $product =& $this->Application->recallObject('p'); $object->addFilter('current_product', 'pr.ResourceId = '.$product->GetDBField('ResourceId')); - break; } - if($event->getEventParam('type') == 'current_user') - { + if ($event->getEventParam('type') == 'current_user') { $user_id = $this->getUserID(); $ip = $_SERVER['REMOTE_ADDR']; $object =& $event->getObject( Array('skip_autoload' => true) ); $product_info = $object->getLinkedInfo(); $object->addFilter('current_item', '%1$s.ItemId = '.$product_info['ParentId']); $object->addFilter('current_user', '%1$s.CreatedById = '.$user_id); $object->addFilter('current_ip', '%1$s.IPAddress = "'.$ip.'"'); - } } Index: trunk/core/units/reviews/reviews_event_handler.php =================================================================== diff -u -N -r7635 -r8369 --- trunk/core/units/reviews/reviews_event_handler.php (.../reviews_event_handler.php) (revision 7635) +++ trunk/core/units/reviews/reviews_event_handler.php (.../reviews_event_handler.php) (revision 8369) @@ -46,52 +46,47 @@ function SetCustomQuery(&$event) { $object =& $event->getObject(); + + if (!$this->Application->IsAdmin()) { + $object->addFilter('active', '%1$s.Status = '.STATUS_ACTIVE); + } + switch ($event->Special) { case 'showall': $object->clearFilters(); break; - case 'products': - $object->removeFilter('parent_filter'); // this is important - $object->addFilter('product_reviews', '%1$s.ItemId = pr.ResourceId'); - // $object->addFilter('active', '%1$s.Status = 1'); - - /*$this->Application->setUnitOption('p', 'AutoLoad', true); - $product =& $this->Application->recallObject('p'); - $object->addFilter('current_product', 'pr.ResourceId = '.$product->GetDBField('ResourceId'));*/ - break; - case 'item': $object->clearFilters(); $info = $object->getLinkedInfo(); $this->Application->setUnitOption($info['ParentPrefix'], 'AutoLoad', true); $parent =& $this->Application->recallObject($info['ParentPrefix']); $object->addFilter('item_reviews', '%1$s.ItemId = '.$parent->GetDBField('ResourceId')); - $object->addFilter('active', '%1$s.Status = 1'); break; + case 'products': + $object->removeFilter('parent_filter'); // this is important + $object->addFilter('product_reviews', '%1$s.ItemId = pr.ResourceId'); + break; + case 'product': $object->clearFilters(); $object->addFilter('product_reviews', '%1$s.ItemId = pr.ResourceId'); - $object->addFilter('active', '%1$s.Status = 1'); $this->Application->setUnitOption('p', 'AutoLoad', true); $product =& $this->Application->recallObject('p'); $object->addFilter('current_product', 'pr.ResourceId = '.$product->GetDBField('ResourceId')); - break; } - if($event->getEventParam('type') == 'current_user') - { + if ($event->getEventParam('type') == 'current_user') { $user_id = $this->getUserID(); $ip = $_SERVER['REMOTE_ADDR']; $object =& $event->getObject( Array('skip_autoload' => true) ); $product_info = $object->getLinkedInfo(); $object->addFilter('current_item', '%1$s.ItemId = '.$product_info['ParentId']); $object->addFilter('current_user', '%1$s.CreatedById = '.$user_id); $object->addFilter('current_ip', '%1$s.IPAddress = "'.$ip.'"'); - } } Index: trunk/core/units/users/users_tag_processor.php =================================================================== diff -u -N -r8363 -r8369 --- trunk/core/units/users/users_tag_processor.php (.../users_tag_processor.php) (revision 8363) +++ trunk/core/units/users/users_tag_processor.php (.../users_tag_processor.php) (revision 8369) @@ -203,7 +203,7 @@ $perm_helper =& $this->Application->recallObject('PermissionsHelper'); /* @var $perm_helper kPermissionsHelper */ - return $perm_helper->TagPermissionCheck($params, 'm_RequireLogin'); + return $perm_helper->TagPermissionCheck($params, 'u_HasPermission'); } } Index: trunk/core/units/general/helpers/permissions_helper.php =================================================================== diff -u -N -r8363 -r8369 --- trunk/core/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 8363) +++ trunk/core/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 8369) @@ -163,16 +163,13 @@ $owner_id = $item_info['CreatedById']; } - $item_prefix = $this->Application->getUnitOption($top_prefix, 'PermItemPrefix'); - + // specific permission check for pending & owner permissions: begin if (substr($event->Name, 0, 9) == 'OnPreSave' || $event->Name == 'OnCreate' || $event->Name == 'OnUpdate') { if ($event_handler->isNewItemCreate($event)) { - $check_status = $this->CheckPermission($item_prefix.'.ADD', 0, $category_id) || - $this->CheckPermission($item_prefix.'.ADD.PENDING', 0, $category_id); + $check_status = $this->AddCheckPermission($category_id, $top_prefix); } else { - $check_status = $this->CheckPermission($item_prefix.'.ADD', 0, $category_id) || - $this->CheckPermission($item_prefix.'.ADD.PENDING', 0, $category_id) || + $check_status = $this->AddCheckPermission($category_id, $top_prefix) || $this->ModifyCheckPermission($owner_id, $category_id, $top_prefix); } @@ -182,6 +179,16 @@ return $check_status; } + if ($event->Name == 'OnMassDelete') { + $check_status = $this->DeleteCheckPermission($owner_id, $category_id, $top_prefix); + if (!$check_status) { + $event->status = erPERM_FAIL; + } + return $check_status; + } + // specific permission check for pending & owner permissions: end + + $perm_status = false; $check_perms = $this->getPermissionByEvent($event, $event_perm_mapping); @@ -190,6 +197,7 @@ return true; } + $item_prefix = $this->Application->getUnitOption($top_prefix, 'PermItemPrefix'); foreach ($check_perms as $perm_name) { // check if at least one of required permissions is set if (!isset($perm_mapping[$perm_name])) { @@ -239,7 +247,7 @@ $permission_groups = explode('|', $permission_groups); $group_has_permission = false; - $perm_category = $this->Application->GetVar('m_cat_id'); + $perm_category = isset($params['cat_id']) ? $params['cat_id'] : $this->Application->GetVar('m_cat_id'); if ($perm_prefix) { // use primary category of item with id from {perm_prefix}_id as base for permission checking @@ -471,6 +479,34 @@ } /** + * Allows to check DELETE & OWNER.DELETE permission combinations on item + * + * @param int $owner_id user_id, that is owner of the item + * @param int $category_id primary category of item + * @param string $prefix prefix of item + * @return int {0 - no DELETE permission, 1 - has DELETE/OWNER.DELETE permission} + */ + function DeleteCheckPermission($owner_id, $category_id, $prefix) + { + $perm_prefix = $this->Application->getUnitOption($prefix, 'PermItemPrefix'); + + $live_delete = $this->CheckPermission($perm_prefix.'.DELETE', ptCATEGORY, $category_id); + if ($live_delete) { + return 1; + } + + if ($owner_id == $this->Application->RecallVar('user_id')) { + // user is item's OWNER -> check this permissions first + $live_delete = $this->CheckPermission($perm_prefix.'.OWNER.DELETE', ptCATEGORY, $category_id); + if ($live_delete) { + return 1; + } + } + + return 0; + } + + /** * Allows to check ADD +/- PENDING permission combinations on item * * @param int $category_id primary category of item @@ -481,8 +517,8 @@ { $perm_prefix = $this->Application->getUnitOption($prefix, 'PermItemPrefix'); - $live_modify = $this->CheckPermission($perm_prefix.'.ADD', ptCATEGORY, $category_id); - if ($live_modify) { + $live_add = $this->CheckPermission($perm_prefix.'.ADD', ptCATEGORY, $category_id); + if ($live_add) { return 1; } else if ($this->CheckPermission($perm_prefix.'.ADD.PENDING', ptCATEGORY, $category_id)) { Index: trunk/core/units/reviews/reviews_config.php =================================================================== diff -u -N -r8029 -r8369 --- trunk/core/units/reviews/reviews_config.php (.../reviews_config.php) (revision 8029) +++ trunk/core/units/reviews/reviews_config.php (.../reviews_config.php) (revision 8369) @@ -1,77 +1,87 @@ 'rev', + $config = Array ( + 'Prefix' => 'rev', + + 'Clones' => Array ( + 'l-rev' => Array( + 'ParentPrefix' => 'l', + 'ConfigMapping' => Array ( + 'PerPage' => 'Perpage_LinkReviews', + 'ShortListPerPage' => 'Perpage_LinkReviews', + 'DefaultSorting1Field' => 'Link_ReviewsSort', + 'DefaultSorting2Field' => 'Link_ReviewsSort2', + 'DefaultSorting1Dir' => 'Link_ReviewsOrder', + 'DefaultSorting2Dir' => 'Link_ReviewsOrder2', + ), + ), + + 'n-rev' => Array( + 'ParentPrefix' => 'n', + ), + 'bb-rev'=> Array( + 'ParentPrefix' => 'bb', + ), + /*'p-rev' => Array('ParentPrefix' => 'p'),*/ + ), + + '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'), + 'TagProcessorClass' => Array('class'=>'ReviewsTagProcessor','file'=>'reviews_tag_processor.php','build_event'=>'OnBuild'), + 'AutoLoad' => true, + + 'QueryString' => Array ( + 1 => 'id', + 2 => 'Page', + 3 => 'event', + 4 => 'mode', + ), + + 'ParentPrefix' => 'p', // replace all usage of rev to "p-rev" and then remove this param from here and Prefix too + + 'IDField' => 'ReviewId', + 'StatusField' => Array('Status'), // field, that is affected by Approve/Decline events + 'TableName' => TABLE_PREFIX.'ItemReview', + 'ParentTableKey' => 'ResourceId', // linked field in master table + 'ForeignKey' => 'ItemId', // linked field in subtable + + 'AutoDelete' => true, + 'AutoClone' => true, + + 'TitlePresets' => Array ( + 'reviews_edit' => Array('format' => "!la_title_Editing_Review!"), + ), + + 'FilterMenu' => Array ( + 'Groups' => Array( + Array('mode' => 'AND', 'filters' => Array('show_active','show_pending','show_disabled'), 'type' => WHERE_FILTER), + ), + 'Filters' => Array( + 'show_active' => Array('label' =>'la_Active', 'on_sql' => '', 'off_sql' => '%1$s.Status != 1' ), + 'show_pending' => Array('label' => 'la_Pending', 'on_sql' => '', 'off_sql' => '%1$s.Status != 2' ), + 'show_disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Status != 0' ), + ) + ), - 'Clones' => Array( - 'l-rev' => Array( - 'ParentPrefix' => 'l', - ), - 'n-rev' => Array( - 'ParentPrefix' => 'n', - ), - 'bb-rev'=> Array( - 'ParentPrefix' => 'bb', - ), - /*'p-rev' => Array('ParentPrefix' => 'p'),*/ - ), + 'CalculatedFields' => Array ( + '' => Array ( + 'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )', + ), + + 'products' => Array ( + 'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )', + 'ItemName' => 'pr.l1_Name', + 'ProductId' => 'pr.ProductId', + ), + + 'product' => Array ( + 'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )', + 'ItemName' => 'pr.l1_Name', + 'ProductId' => 'pr.ProductId', + ), + ), - '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'), - 'TagProcessorClass' => Array('class'=>'ReviewsTagProcessor','file'=>'reviews_tag_processor.php','build_event'=>'OnBuild'), - 'AutoLoad' => true, - - 'QueryString' => Array( - 1 => 'id', - 2 => 'page', - 3 => 'event', - 4 => 'mode', - ), - - - 'ParentPrefix' => 'p', // replace all usage of rev to "p-rev" and then remove this param from here and Prefix too - - 'IDField' => 'ReviewId', - 'StatusField' => Array('Status'), // field, that is affected by Approve/Decline events - 'TableName' => TABLE_PREFIX.'ItemReview', - 'ParentTableKey' => 'ResourceId', // linked field in master table - 'ForeignKey' => 'ItemId', // linked field in subtable - - 'AutoDelete' => true, - 'AutoClone' => true, - - 'TitlePresets' => Array( - 'reviews_edit' => Array('format' => "!la_title_Editing_Review!"), - ), - 'FilterMenu' => Array( - 'Groups' => Array( - Array('mode' => 'AND', 'filters' => Array('show_active','show_pending','show_disabled'), 'type' => WHERE_FILTER), - ), - 'Filters' => Array( - 'show_active' => Array('label' =>'la_Active', 'on_sql' => '', 'off_sql' => '%1$s.Status != 1' ), - 'show_pending' => Array('label' => 'la_Pending', 'on_sql' => '', 'off_sql' => '%1$s.Status != 2' ), - 'show_disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Status != 0' ), - ) - ), - - 'CalculatedFields' => Array( - '' => Array( - 'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )', - ), - 'products' => Array( - 'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )', - 'ItemName' => 'pr.l1_Name', - 'ProductId' => 'pr.ProductId', - ), - 'product' => Array( - 'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )', - 'ItemName' => 'pr.l1_Name', - 'ProductId' => 'pr.ProductId', - ), - - ), - // key - special, value - list select sql 'ListSQLs' => Array( ''=>'SELECT %1$s.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'PortalUser pu ON pu.PortalUserId = %1$s.CreatedById', Index: trunk/core/kernel/db/dblist.php =================================================================== diff -u -N -r8067 -r8369 --- trunk/core/kernel/db/dblist.php (.../dblist.php) (revision 8067) +++ trunk/core/kernel/db/dblist.php (.../dblist.php) (revision 8369) @@ -862,6 +862,16 @@ $this->addFilter('parent_filter', '`'.$this->TableName.'`.`'.$foreign_key_field.'` = '.$parent_id); // only for list in this case } } + + /** + * Returns true if list was queried (same name as for kDBItem for easy usage) + * + * @return bool + */ + function isLoaded() + { + return $this->Queried; + } } ?> \ No newline at end of file Index: trunk/kernel/units/reviews/reviews_config.php =================================================================== diff -u -N -r8029 -r8369 --- trunk/kernel/units/reviews/reviews_config.php (.../reviews_config.php) (revision 8029) +++ trunk/kernel/units/reviews/reviews_config.php (.../reviews_config.php) (revision 8369) @@ -1,77 +1,87 @@ 'rev', + $config = Array ( + 'Prefix' => 'rev', + + 'Clones' => Array ( + 'l-rev' => Array( + 'ParentPrefix' => 'l', + 'ConfigMapping' => Array ( + 'PerPage' => 'Perpage_LinkReviews', + 'ShortListPerPage' => 'Perpage_LinkReviews', + 'DefaultSorting1Field' => 'Link_ReviewsSort', + 'DefaultSorting2Field' => 'Link_ReviewsSort2', + 'DefaultSorting1Dir' => 'Link_ReviewsOrder', + 'DefaultSorting2Dir' => 'Link_ReviewsOrder2', + ), + ), + + 'n-rev' => Array( + 'ParentPrefix' => 'n', + ), + 'bb-rev'=> Array( + 'ParentPrefix' => 'bb', + ), + /*'p-rev' => Array('ParentPrefix' => 'p'),*/ + ), + + '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'), + 'TagProcessorClass' => Array('class'=>'ReviewsTagProcessor','file'=>'reviews_tag_processor.php','build_event'=>'OnBuild'), + 'AutoLoad' => true, + + 'QueryString' => Array ( + 1 => 'id', + 2 => 'Page', + 3 => 'event', + 4 => 'mode', + ), + + 'ParentPrefix' => 'p', // replace all usage of rev to "p-rev" and then remove this param from here and Prefix too + + 'IDField' => 'ReviewId', + 'StatusField' => Array('Status'), // field, that is affected by Approve/Decline events + 'TableName' => TABLE_PREFIX.'ItemReview', + 'ParentTableKey' => 'ResourceId', // linked field in master table + 'ForeignKey' => 'ItemId', // linked field in subtable + + 'AutoDelete' => true, + 'AutoClone' => true, + + 'TitlePresets' => Array ( + 'reviews_edit' => Array('format' => "!la_title_Editing_Review!"), + ), + + 'FilterMenu' => Array ( + 'Groups' => Array( + Array('mode' => 'AND', 'filters' => Array('show_active','show_pending','show_disabled'), 'type' => WHERE_FILTER), + ), + 'Filters' => Array( + 'show_active' => Array('label' =>'la_Active', 'on_sql' => '', 'off_sql' => '%1$s.Status != 1' ), + 'show_pending' => Array('label' => 'la_Pending', 'on_sql' => '', 'off_sql' => '%1$s.Status != 2' ), + 'show_disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Status != 0' ), + ) + ), - 'Clones' => Array( - 'l-rev' => Array( - 'ParentPrefix' => 'l', - ), - 'n-rev' => Array( - 'ParentPrefix' => 'n', - ), - 'bb-rev'=> Array( - 'ParentPrefix' => 'bb', - ), - /*'p-rev' => Array('ParentPrefix' => 'p'),*/ - ), + 'CalculatedFields' => Array ( + '' => Array ( + 'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )', + ), + + 'products' => Array ( + 'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )', + 'ItemName' => 'pr.l1_Name', + 'ProductId' => 'pr.ProductId', + ), + + 'product' => Array ( + 'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )', + 'ItemName' => 'pr.l1_Name', + 'ProductId' => 'pr.ProductId', + ), + ), - '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'), - 'TagProcessorClass' => Array('class'=>'ReviewsTagProcessor','file'=>'reviews_tag_processor.php','build_event'=>'OnBuild'), - 'AutoLoad' => true, - - 'QueryString' => Array( - 1 => 'id', - 2 => 'page', - 3 => 'event', - 4 => 'mode', - ), - - - 'ParentPrefix' => 'p', // replace all usage of rev to "p-rev" and then remove this param from here and Prefix too - - 'IDField' => 'ReviewId', - 'StatusField' => Array('Status'), // field, that is affected by Approve/Decline events - 'TableName' => TABLE_PREFIX.'ItemReview', - 'ParentTableKey' => 'ResourceId', // linked field in master table - 'ForeignKey' => 'ItemId', // linked field in subtable - - 'AutoDelete' => true, - 'AutoClone' => true, - - 'TitlePresets' => Array( - 'reviews_edit' => Array('format' => "!la_title_Editing_Review!"), - ), - 'FilterMenu' => Array( - 'Groups' => Array( - Array('mode' => 'AND', 'filters' => Array('show_active','show_pending','show_disabled'), 'type' => WHERE_FILTER), - ), - 'Filters' => Array( - 'show_active' => Array('label' =>'la_Active', 'on_sql' => '', 'off_sql' => '%1$s.Status != 1' ), - 'show_pending' => Array('label' => 'la_Pending', 'on_sql' => '', 'off_sql' => '%1$s.Status != 2' ), - 'show_disabled' => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Status != 0' ), - ) - ), - - 'CalculatedFields' => Array( - '' => Array( - 'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )', - ), - 'products' => Array( - 'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )', - 'ItemName' => 'pr.l1_Name', - 'ProductId' => 'pr.ProductId', - ), - 'product' => Array( - 'ReviewedBy' => 'IF( ISNULL(pu.Login), IF (%1$s.CreatedById = -1, \'root\', IF (%1$s.CreatedById = -2, \'Guest\', \'n/a\')), pu.Login )', - 'ItemName' => 'pr.l1_Name', - 'ProductId' => 'pr.ProductId', - ), - - ), - // key - special, value - list select sql 'ListSQLs' => Array( ''=>'SELECT %1$s.* %2$s FROM %1$s LEFT JOIN '.TABLE_PREFIX.'PortalUser pu ON pu.PortalUserId = %1$s.CreatedById', Index: trunk/themes/default2007/error_notfound.tpl =================================================================== diff -u -N --- trunk/themes/default2007/error_notfound.tpl (revision 0) +++ trunk/themes/default2007/error_notfound.tpl (revision 8369) @@ -0,0 +1,26 @@ + + + + + + + + + + + +

+ +

+
+ + + +
+ + \ No newline at end of file Index: trunk/kernel/units/reviews/reviews_tag_processor.php =================================================================== diff -u -N -r7391 -r8369 --- trunk/kernel/units/reviews/reviews_tag_processor.php (.../reviews_tag_processor.php) (revision 7391) +++ trunk/kernel/units/reviews/reviews_tag_processor.php (.../reviews_tag_processor.php) (revision 8369) @@ -105,6 +105,18 @@ return $user_id; } + + function PageLink($params) + { + $object =& $this->getObject($params); + /* @var kDBList */ + + $parent_info = $object->getLinkedInfo(); + if ($parent_info['ParentId'] > 0) { + $params['pass'] = 'm,'.$this->getPrefixSpecial().','.$parent_info['ParentPrefix']; + } + return parent::PageLink($params); + } } Index: trunk/core/units/general/cat_event_handler.php =================================================================== diff -u -N -r8365 -r8369 --- trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 8365) +++ trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 8369) @@ -303,7 +303,7 @@ // add category filter if needed if ($event->Special != 'showall') { - if ( $event->getEventParam('parent_cat_id') ) { + if ($event->getEventParam('parent_cat_id') !== false) { $parent_cat_id = $event->getEventParam('parent_cat_id'); } else { @@ -1800,6 +1800,21 @@ } } } + + /** + * Deletes items & preserves clean env + * + * @param kEvent $event + */ + function OnMassDelete(&$event) + { + parent::OnMassDelete($event); + + if ($event->status == erSUCCESS && !$this->Application->IsAdmin()) { + $event->SetRedirectParam('pass', 'm'); + $event->SetRedirectParam('m_cat_id', 0); + } + } } ?> \ No newline at end of file Index: trunk/core/units/reviews/reviews_tag_processor.php =================================================================== diff -u -N -r7391 -r8369 --- trunk/core/units/reviews/reviews_tag_processor.php (.../reviews_tag_processor.php) (revision 7391) +++ trunk/core/units/reviews/reviews_tag_processor.php (.../reviews_tag_processor.php) (revision 8369) @@ -105,6 +105,18 @@ return $user_id; } + + function PageLink($params) + { + $object =& $this->getObject($params); + /* @var kDBList */ + + $parent_info = $object->getLinkedInfo(); + if ($parent_info['ParentId'] > 0) { + $params['pass'] = 'm,'.$this->getPrefixSpecial().','.$parent_info['ParentPrefix']; + } + return parent::PageLink($params); + } } Index: trunk/core/units/general/cat_tag_processor.php =================================================================== diff -u -N -r7855 -r8369 --- trunk/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 7855) +++ trunk/core/units/general/cat_tag_processor.php (.../cat_tag_processor.php) (revision 8369) @@ -185,7 +185,26 @@ return $display_original && ($perm_value == 1) && $this->Application->GetVar($this->Prefix.'.original_id'); } + + /** + * Checks if user have one of required permissions + * + * @param Array $params + * @return bool + */ + function HasPermission($params) + { + $perm_helper =& $this->Application->recallObject('PermissionsHelper'); + /* @var $perm_helper kPermissionsHelper */ + $params['raise_warnings'] = 0; + $object =& $this->getObject($params); + /* @var $object kDBItem */ + + $params['cat_id'] = $object->isLoaded() ? $object->GetDBField('CategoryId') : $this->Application->GetVar('m_cat_id'); + return $perm_helper->TagPermissionCheck($params, $this->getPrefixSpecial().'_HasPermission'); + } + } ?> \ No newline at end of file Index: trunk/core/kernel/kbase.php =================================================================== diff -u -N -r8067 -r8369 --- trunk/core/kernel/kbase.php (.../kbase.php) (revision 8067) +++ trunk/core/kernel/kbase.php (.../kbase.php) (revision 8369) @@ -643,6 +643,15 @@ return false; } + /** + * Returns true if item was queried/loaded + * + * @return bool + */ + function isLoaded() + { + return false; + } } ?> \ No newline at end of file
+
+
- Index: trunk/themes/default2007/no_permission.tpl =================================================================== diff -u -N -r8368 -r8369 --- trunk/themes/default2007/no_permission.tpl (.../no_permission.tpl) (revision 8368) +++ trunk/themes/default2007/no_permission.tpl (.../no_permission.tpl) (revision 8369) @@ -15,7 +15,7 @@

- +

Index: trunk/themes/default2007/platform/designs/content_boxes.tpl =================================================================== diff -u -N -r8368 -r8369 --- trunk/themes/default2007/platform/designs/content_boxes.tpl (.../content_boxes.tpl) (revision 8368) +++ trunk/themes/default2007/platform/designs/content_boxes.tpl (.../content_boxes.tpl) (revision 8369) @@ -8,11 +8,15 @@
- - "> + + "> + + "> +