Index: trunk/core/units/categories/categories_event_handler.php =================================================================== diff -u -N -r8428 -r8451 --- trunk/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 8428) +++ trunk/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 8451) @@ -284,7 +284,7 @@ * @param kEvent $event * @return int */ - function GetPassedId(&$event) + function getPassedID(&$event) { if ( $this->Application->IsAdmin()) { return parent::getPassedID($event); @@ -605,6 +605,69 @@ { $this->Application->RemoveVar('clipboard'); } + + /** + * Sets correct status for new categories created on front-end + * + * @param kEvent $event + */ + function OnBeforeItemCreate(&$event) + { + if ($this->Application->IsAdmin()) { + return ; + } + + $perm_helper =& $this->Application->recallObject('PermissionsHelper'); + /* @var $perm_helper kPermissionsHelper */ + + $new_status = false; + $category_id = $this->Application->GetVar('m_cat_id'); + if ($perm_helper->CheckPermission('CATEGORY.ADD', 0, $category_id)) { + $new_status = STATUS_ACTIVE; + } + else if ($perm_helper->CheckPermission('CATEGORY.ADD.PENDING', 0, $category_id)) { + $new_status = STATUS_PENDING; + } + + if ($new_status) { + $object =& $event->getObject(); + /* @var $object kDBItem */ + + $object->SetDBField('Status', $new_status); + } + else { + $event->status = erPERM_FAIL; + return ; + } + } + + /** + * Performs redirect to correct suggest confirmation template + * + * @param kEvent $event + */ + function OnCreate(&$event) + { + parent::OnCreate($event); + + if ($this->Application->IsAdmin() || $event->status != erSUCCESS) { + return ; + } + + $object =& $event->getObject(); + $is_active = ($object->GetDBField('Status') == STATUS_ACTIVE); + + $next_template = $is_active ? 'suggest_confirm_template' : 'suggest_pending_confirm_template'; + $event->redirect = $this->Application->GetVar($next_template); + $event->SetRedirectParam('opener', 's'); + + // send email events + $perm_prefix = $this->Application->getUnitOption($event->Prefix, 'PermItemPrefix'); + + $event_suffix = $is_active ? 'ADD' : 'ADD.PENDING'; + $this->Application->EmailEventAdmin($perm_prefix.'.'.$event_suffix); + $this->Application->EmailEventUser($perm_prefix.'.'.$event_suffix, $object->GetDBField('CreatedById')); + } } ?> \ No newline at end of file Index: trunk/core/units/general/cat_event_handler.php =================================================================== diff -u -N -r8446 -r8451 --- trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 8446) +++ trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 8451) @@ -1936,7 +1936,7 @@ $object =& $event->getObject(); $is_active = ($object->GetDBField('Status') == STATUS_ACTIVE); - $next_template = ($object->GetDBField('Status') == STATUS_ACTIVE) ? 'confirm_template' : 'pending_confirm_template'; + $next_template = $is_active ? 'confirm_template' : 'pending_confirm_template'; $event->redirect = $this->Application->GetVar($template_key.'_'.$next_template); $event->SetRedirectParam('opener', 's'); Index: trunk/themes/default2007/platform/categories/suggest_confirm.tpl =================================================================== diff -u -N --- trunk/themes/default2007/platform/categories/suggest_confirm.tpl (revision 0) +++ trunk/themes/default2007/platform/categories/suggest_confirm.tpl (revision 8451) @@ -0,0 +1,27 @@ + + + + + + + + + + + + +

+ "> +
+ + + +
+ + \ No newline at end of file Index: trunk/themes/default2007/platform/categories/suggest_category.tpl =================================================================== diff -u -N --- trunk/themes/default2007/platform/categories/suggest_category.tpl (revision 0) +++ trunk/themes/default2007/platform/categories/suggest_category.tpl (revision 8451) @@ -0,0 +1,50 @@ + + + + + + + + + + + + + Navigation Bar:

+ + + + +
+
+ + *
+
+ + + + + + + +
+ + + "/> +
+
+ + +
+
+ + + +
+ + \ No newline at end of file Index: trunk/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r8428 -r8451 --- trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 8428) +++ trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 8451) @@ -530,6 +530,25 @@ } return strpos($parent_path, $current_path) !== false; } + + /** + * 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('ParentPath') : $this->Application->GetVar('m_cat_id'); + return $perm_helper->TagPermissionCheck($params, $this->getPrefixSpecial().'_HasPermission'); + } } Index: trunk/themes/default2007/platform/categories/suggest_pending_confirm.tpl =================================================================== diff -u -N --- trunk/themes/default2007/platform/categories/suggest_pending_confirm.tpl (revision 0) +++ trunk/themes/default2007/platform/categories/suggest_pending_confirm.tpl (revision 8451) @@ -0,0 +1,27 @@ + + + + + + + + + + + + +

+ "> +
+ + + +
+ + \ No newline at end of file