Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sat, Jul 19, 2:14 PM

in-portal

Index: branches/unlabeled/unlabeled-1.9.2/kernel/units/relationship/relationship_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.9.2/kernel/units/relationship/relationship_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.9.2/kernel/units/relationship/relationship_event_handler.php (revision 6628)
@@ -0,0 +1,261 @@
+<?php
+
+ class RelationshipEventHandler extends kDBEventHandler
+ {
+ /**
+ * Allows to override standart permission mapping
+ *
+ */
+ function mapPermissions()
+ {
+ parent::mapPermissions();
+ $permissions = Array(
+ 'OnProcessSelected' => Array('subitem' => 'add|edit'),
+ );
+ $this->permMapping = array_merge($this->permMapping, $permissions);
+ }
+
+ /**
+ * Initializes new relation
+ *
+ * @param kEvent $event
+ */
+ function OnNew(&$event)
+ {
+ parent::OnNew($event);
+
+ $object =& $event->getObject();
+ $table_info = $object->getLinkedInfo();
+
+ $object->SetDBField('SourceId', $table_info['ParentId']);
+ $source_itemtype = $this->Application->getUnitOption($table_info['ParentPrefix'], 'ItemType');
+ $object->SetDBField('SourceType', $source_itemtype);
+
+ $object->SetDBField('TargetId', $this->Application->GetVar('target_id'));
+ $object->SetDBField('TargetType', $this->Application->GetVar('target_type'));
+
+ $this->OnAfterItemLoad($event);
+ }
+
+ /**
+ * Add new relation
+ *
+ * @param kEvent $event
+ */
+ function OnProcessSelected(&$event)
+ {
+ $dst_field = $this->Application->RecallVar('dst_field');
+ if ($dst_field == 'TargetId') {
+ // prepare target_id & target_type
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+
+ $selected_ids = $this->Application->GetVar('selected_ids');
+ $target_prefix = false;
+ foreach ($selected_ids as $selected_prefix => $target_id) {
+ if ($target_id > 0) {
+ $target_prefix = $selected_prefix;
+ break;
+ }
+ }
+
+ if (!$target_prefix) {
+ $this->finalizePopup($event);
+ return;
+ }
+
+ $sql = 'SELECT ResourceId
+ FROM '.$this->Application->getUnitOption($target_prefix, 'TableName').'
+ WHERE '.$this->Application->getUnitOption($target_prefix, 'IDField').' = '.$target_id;
+ $target_id = $this->Conn->GetOne($sql);
+ $target_type = $this->Application->getUnitOption($target_prefix, 'ItemType');
+
+ // don't add same relation twice
+ $table_info = $object->getLinkedInfo();
+ $sql = 'SELECT TargetId
+ FROM '.$object->TableName.'
+ WHERE (SourceId = '.$table_info['ParentId'].') AND (TargetId = '.$target_id.')';
+ $duplicate_relation = $this->Conn->GetOne($sql) == $target_id;
+
+ $this->finalizePopup($event);
+
+ if (!$duplicate_relation) {
+ // place correct template in opener stack
+ $source_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix');
+ $template = $this->Application->getUnitOption($source_prefix, 'AdminTemplatePath').'/relations_edit';
+ $redirect_params = Array($event->Prefix.'_event' => 'OnNew', 'target_id' => $target_id, 'target_type' => $target_type);
+ $this->Application->EventManager->openerStackPush($template, $redirect_params, 'all,'.$event->Prefix);
+ }
+ }
+ else {
+ $this->finalizePopup($event);
+ }
+ }
+
+ /**
+ * Set ItemName & ItemType virtual fields based on loaded item data
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemLoad(&$event)
+ {
+ $object =& $event->getObject();
+
+ $sql = 'SELECT Prefix
+ FROM '.TABLE_PREFIX.'ItemTypes
+ WHERE ItemType = '.$object->GetDBField('TargetType');
+ $target_prefix = $this->Conn->GetOne($sql);
+
+ $title_field = $this->getTitleField($target_prefix);
+ $title_phrase = $this->Application->getUnitOption($target_prefix, 'TitlePhrase');
+
+ $sql = 'SELECT '.$title_field.'
+ FROM '.$this->Application->getUnitOption($target_prefix, 'TableName').'
+ WHERE ResourceId = '.$object->GetDBField('TargetId');
+
+ $object->SetDBField('ItemName', $this->Conn->GetOne($sql));
+ $object->SetDBField('ItemType', $this->Application->Phrase($title_phrase));
+ }
+
+ /**
+ * Creates needed sql query to load list,
+ * if no query is defined in config for
+ * special requested, then use default
+ * query
+ *
+ * @param kEvent $event
+ * @access protected
+ */
+ function ListPrepareQuery(&$event)
+ {
+ return $this->BaseQuery($event, 'ListSQLs');
+ }
+
+ /**
+ * Creates needed sql query to load item,
+ * if no query is defined in config for
+ * special requested, then use default
+ * query
+ *
+ * @param kEvent $event
+ * @access protected
+ */
+ function ItemPrepareQuery(&$event)
+ {
+ return $this->BaseQuery($event, 'ItemSQLs');
+ }
+
+
+ /**
+ * Get item name & type based on relation type & modules installed
+ *
+ * @param kEvent $event
+ * @param string $sql_field
+ */
+ function BaseQuery(&$event, $sql_field)
+ {
+ $sqls = $this->Application->getUnitOption($event->Prefix,$sql_field);
+ $sql = isset($sqls[$event->Special]) ? $sqls[$event->Special] : $sqls[''];
+
+ $configs = $this->extractModulesInfo();
+
+ // 2. build sql based on information queried
+ $sql_templates['ItemName'] = 'IFNULL(%s.%s,\' \')';
+ $sql_templates['TableJoin'] = 'LEFT JOIN %1$s ON %1$s.ResourceId = rel.TargetId';
+ $sql_templates['TargetName'] = 'IF(rel.TargetType = %s, \'%s\', %s)';
+
+ $sql_parts = Array();
+ $sql_parts['TargetName'] = "''";
+ foreach ($configs as $prefix => $config_data) {
+ $title_field = $this->getTitleField($prefix);
+
+ $sql_parts['ItemName'][] = sprintf($sql_templates['ItemName'], $config_data['TableName'], $title_field);
+ $sql_parts['TableJoin'][] = sprintf($sql_templates['TableJoin'], $config_data['TableName']);
+
+ $sql_parts['TargetName'] = sprintf( $sql_templates['TargetName'],
+ $config_data['ItemType'],
+ '!'.$config_data['TitlePhrase'].'!',
+ $sql_parts['TargetName']);
+ $sql_parts['TargetName'] = str_replace('rel','%1$s',$sql_parts['TargetName']);
+ }
+
+ $object =& $event->getObject();
+
+ $vars = Array('#ITEM_NAMES#', '#ITEM_TYPES#');
+ $replacements = Array( implode(', ',$sql_parts['ItemName']), $sql_parts['TargetName'] );
+
+ $calculated_fields =& $object->getProperty('CalculatedFields');
+ foreach ($calculated_fields as $field_name => $field_expression) {
+ $calculated_fields[$field_name] = str_replace($vars, $replacements, $field_expression);
+ }
+
+ $object->setProperty('CalculatedFields', $calculated_fields);
+
+ $sql = str_replace('#ITEM_JOIN#', implode(' ',$sql_parts['TableJoin']), $sql);
+ $sql = str_replace('rel.','%1$s.',$sql);
+
+ return $sql;
+ }
+
+ /**
+ * Convert TitleField field of kMultiLanguage formatter used for it
+ *
+ * @param string $prefix
+ * @return string
+ */
+ function getTitleField($prefix)
+ {
+ $lang_prefix = 'l'.$this->Application->GetVar('m_lang').'_';
+
+ $title_field = $this->Application->getUnitOption($prefix, 'TitleField');
+ $field_options = $this->Application->getUnitOption($prefix.'.'.$title_field, 'Fields');
+
+ $formatter_class = isset($field_options['formatter']) ? $field_options['formatter'] : '';
+ if ($formatter_class == 'kMultiLanguage' && !isset($field_options['master_field'])) {
+ $title_field = $lang_prefix.$title_field;
+ }
+ return $title_field;
+ }
+
+ /**
+ * Get configs from modules installed
+ *
+ * @return Array
+ * @access private
+ */
+ function extractModulesInfo()
+ {
+ // get installed modules & their config info
+ // maybe we should leave only prefixes, that have "view" permission
+ $configs = Array();
+ foreach ($this->Application->ModuleInfo as $module_name => $module_data) {
+ $prefix = $module_data['Var'];
+ if ($prefix == 'm') {
+ $prefix = 'c';
+ }
+ $configs[$prefix] = $this->Application->getUnitOptions($prefix);
+ if($configs[$prefix] === false) unset($configs[$prefix]);
+ if(!isset($configs[$prefix]['CatalogItem']) || !$configs[$prefix]['CatalogItem']) unset($configs[$prefix]);
+ }
+ return $configs;
+ }
+
+ /**
+ * Deletes relations to hooked item from other items
+ *
+ * @param kEvent $event
+ */
+ function OnDeleteForeignRelations(&$event)
+ {
+ $main_object =& $event->MasterEvent->getObject();
+ $resource_id = $main_object->GetDBField('ResourceId');
+
+ $table = $this->Application->getUnitOption($event->Prefix,'TableName');
+ $sql = 'DELETE FROM '.$table.' WHERE TargetId = '.$resource_id;
+ $this->Conn->Query($sql);
+ }
+
+
+ }
+
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.9.2/kernel/units/relationship/relationship_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.9
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.9.2/kernel/units/modules/modules_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.9.2/kernel/units/modules/modules_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.9.2/kernel/units/modules/modules_event_handler.php (revision 6628)
@@ -0,0 +1,79 @@
+<?php
+
+ class ModulesEventHandler extends kDBEventHandler {
+
+ /**
+ * Builds item
+ *
+ * @param kEvent $event
+ * @access protected
+ */
+ function OnItemBuild(&$event)
+ {
+ $this->Application->SetVar($event->getPrefixSpecial(true).'_id', $event->Special);
+ parent::OnItemBuild($event);
+ }
+
+ /**
+ * List with one record if special passed
+ *
+ * @param kEvent $event
+ */
+ function SetCustomQuery(&$event)
+ {
+ if ($event->Special) {
+ $object =& $event->getObject();
+ $object->addFilter('current_module', 'Name = '.$event->Special);
+ }
+ }
+
+ function mapEvents()
+ {
+ parent::mapEvents();
+ $this->eventMethods['OnMassApprove'] = 'moduleAction';
+ $this->eventMethods['OnMassDecline'] = 'moduleAction';
+ }
+
+ /**
+ * Disabled modules, but not In-Portal
+ *
+ * @param kEvent $event
+ */
+ function moduleAction(&$event)
+ {
+ if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
+ return;
+ }
+
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+ $ids = $this->StoreSelectedIDs($event);
+
+
+ if (!$ids) return true;
+
+ $status_field = array_shift( $this->Application->getUnitOption($event->Prefix, 'StatusField') );
+
+ foreach($ids as $id)
+ {
+ $object->Load($id);
+ if ($object->GetID() == 'In-Portal') continue;
+ $object->SetDBField($status_field, $event->Name == 'OnMassApprove' ? 1 : 0);
+
+ if ($object->Update()) {
+ $event->status = erSUCCESS;
+ $event->redirect_params = Array('opener' => 's', 'pass_events' => true); //stay!
+ }
+ else {
+ $event->status = erFAIL;
+ $event->redirect = false;
+ break;
+ }
+ }
+
+ $this->Application->UnitConfigReader->ResetParsedData(true); //true to reset sections cache also
+ $event->SetRedirectParam('RefreshTree', 1);
+ }
+
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.9.2/kernel/units/modules/modules_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.9
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.9.2/kernel/units/config_search/config_search_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.9.2/kernel/units/config_search/config_search_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.9.2/kernel/units/config_search/config_search_config.php (revision 6628)
@@ -0,0 +1,115 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'confs',
+
+ 'Clones' => Array(
+ 'confs-cf' => Array(
+ 'Prefix' => 'confs-cf',
+ 'ParentPrefix' => 'cf',
+ 'ParentTableKey' => 'CustomFieldId', // linked field in master table
+ 'ForeignKey' => 'CustomFieldId', // linked field in subtable
+ 'AutoClone' => false, // because OnCreateCustomField hook does the stuff
+ 'AutoDelete' => true,
+
+ 'Hooks' => Array(
+ Array(
+ 'Mode' => hAFTER,
+ 'Conditional' => false,
+ 'HookToPrefix' => '#PARENT#',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array('OnAfterItemCreate', 'OnAfterItemUpdate'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCreateCustomField',
+ ),
+ ),
+ ),
+ ),
+
+ 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
+ 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
+ 'EventHandlerClass' => Array('class'=>'ConfigSearchEventHandler','file'=>'config_search_event_handler.php','build_event'=>'OnBuild'),
+ 'TagProcessorClass' => Array('class'=>'ConfigSearchTagProcessor','file'=>'config_search_tag_processor.php','build_event'=>'OnBuild'),
+ 'AutoLoad' => true,
+ 'hooks' => Array(),
+ 'QueryString' => Array(
+ 1 => 'id',
+ 2 => 'page',
+ 3 => 'event',
+ ),
+
+ 'IDField' => 'SearchConfigId',
+
+ 'TitleField' => 'FieldName',
+
+ 'TitlePresets' => Array(
+ 'default' => Array( 'new_status_labels' => Array('confs'=>'!la_title_Adding_ConfigSearch!'),
+ 'edit_status_labels' => Array('confs'=>'!la_title_Editing_ConfigSearch!'),
+ 'new_titlefield' => Array('confs'=>'!la_title_New_ConfigSearch!'),
+ ),
+
+ 'configsearch_edit' => Array('prefixes' => Array('confs'), 'format' => "#confs_status# '#confs_titlefield#' - !la_title_General!"),
+ 'config_list_search' => Array('prefixes' => Array('confs_List'), 'tag_params' => Array('confs' => Array('per_page' => -1) ), 'format' => "!la_updating_config!"),
+ ),
+
+ 'TableName' => TABLE_PREFIX.'SearchConfig',
+
+ 'CalculatedFields' => Array(
+ '' => Array(
+ 'IsCustom' => 'IF(CustomFieldId IS NULL, 0, 1)',
+ ),
+ ),
+
+ 'ListSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'),
+
+ 'ItemSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'),
+
+
+
+ 'Fields' => Array(
+ 'TableName' => Array('type' => 'string','not_null' => '1', 'required' => 1, 'default' => ''),
+ 'FieldName' => Array('type' => 'string','not_null' => '1', 'required' => 1, 'default' => ''),
+ 'SimpleSearch' => Array('type' => 'int','not_null' => '1','default' => '1'),
+ 'AdvancedSearch' => Array('type' => 'int','not_null' => '1','default' => '1'),
+ 'Description' => Array('type' => 'string','default' => ''),
+ 'DisplayName' => Array('type' => 'string', 'required' => 1, 'default' => ''),
+ 'ModuleName' => Array('type' => 'string', 'formatter'=>'kOptionsFormatter', 'options'=>Array(''=>''), 'options_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Modules WHERE Loaded = 1 ORDER BY LoadOrder', 'option_key_field'=>'Name', 'option_title_field'=>'Name', 'not_null' => '1','default' => 'In-Portal'),
+ 'ConfigHeader' => Array('type' => 'string', 'required' => 1, 'default' => ''),
+ 'DisplayOrder' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'SearchConfigId' => Array('type' => 'int','not_null' => '1','default' => ''),
+ 'Priority' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'FieldType' => Array('type' => 'string', 'formatter' => 'kOptionsFormatter', 'options' => Array('text' => 'text', 'range' => 'range', 'boolean' => 'boolean', 'date' => 'date'), 'not_null' => '1', 'required' => 1, 'default' => 'text'),
+ 'ForeignField' => Array('type' => 'string','default' => null),
+ 'JoinClause' => Array('type' => 'string','default' => null),
+ 'IsWhere' => Array('type' => 'string','default' => null),
+ 'IsNotWhere' => Array('type' => 'string','default' => null),
+ 'ContainsWhere' => Array('type' => 'string','default' => null),
+ 'NotContainsWhere' => Array('type' => 'string','default' => null),
+ 'CustomFieldId' => Array('type' => 'int', 'default' => null),
+ ),
+
+ 'VirtualFields' => Array(
+ 'IsCustom' => Array('type' => 'int', 'default' => 0),
+ ),
+
+ 'ListSortings' => Array(
+ '' => Array(
+ 'ForcedSorting' => Array('IsCustom' => 'asc'),
+ 'Sorting' => Array('DisplayOrder' => 'asc'),
+ )
+ ),
+
+ 'Grids' => Array(
+ 'Default' => Array(
+ 'Icons' => Array('default'=>'icon16_custom.gif'), // icons for each StatusField values, if no matches or no statusfield selected, then "default" icon is used
+ 'Fields' => Array(
+ 'TableName' => Array( 'title'=>'la_col_TableName', 'data_block' => 'grid_data_td'),
+ 'FieldName' => Array( 'title'=>'la_col_FieldName', 'data_block' => 'grid_data_td' ),
+ 'SimpleSearch' => Array( 'title'=>'la_col_SimpleSearch', 'data_block' => 'grid_data_td'),
+ ),
+ ),
+ ),
+ );
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.9.2/kernel/units/config_search/config_search_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.9
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.9.2/kernel/units/permissions/permissions_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.9.2/kernel/units/permissions/permissions_tag_processor.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.9.2/kernel/units/permissions/permissions_tag_processor.php (revision 6628)
@@ -0,0 +1,188 @@
+<?php
+
+ class PermissionsTagProcessor extends kDBTagProcessor {
+
+ function HasPermission($params)
+ {
+ $section_name = $params['section_name'];
+
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+
+ return array_search($params['perm_name'], $section_data['permissions']) !== false;
+ }
+
+ function HasAdvancedPermissions($params)
+ {
+ $section_name = $params['section_name'];
+
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+
+ $ret = false;
+ foreach ($section_data['permissions'] as $perm_name) {
+ if (preg_match('/^advanced:(.*)/', $perm_name)) {
+ $ret = true;
+ break;
+ }
+ }
+ return $ret;
+ }
+
+ function PermissionValue($params)
+ {
+ $section_name = $params['section_name'];
+
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+ $perm_name = $params['perm_name'];
+
+ $permissions_helper =& $this->Application->recallObject('PermissionsHelper');
+ if (!$permissions_helper->isOldPermission($section_name, $perm_name)) {
+ $perm_name = $section_name.'.'.$perm_name;
+ }
+
+ return $permissions_helper->getPermissionValue($perm_name);
+ }
+
+ function LoadPermissions($params)
+ {
+ $permissions_helper =& $this->Application->recallObject('PermissionsHelper');
+ $prefix_parts = explode('-', $this->Prefix, 2);
+ $permissions_helper->LoadPermissions($this->Application->GetVar('g_id'), 0, 1);
+ }
+
+ function LevelIndicator($params)
+ {
+ return $params['level'] * $params['multiply'];
+ }
+
+ function PrintPermissions($params)
+ {
+ $category =& $this->Application->recallObject('c');
+
+ $group_id = $this->Application->GetVar('group_id');
+ $prefix = $this->Application->GetVar('item_prefix');
+ $module = $this->Application->findModule('Var', $prefix, 'Name');
+
+ $perm_live_table = $this->Application->getUnitOption('c-perm', 'TableName');
+ $perm_temp_table = $this->Application->GetTempName($perm_live_table);
+
+ if ($category->GetID() == 0) {
+ $categories = Array(0);
+ }
+ else {
+ $categories = explode('|', substr($category->GetDBField('ParentPath'), 1, -1));
+ }
+
+ if (count($categories) == 1 || $category->GetID() == 0) {
+ // category located in root category ("Home") => then add it to path virtually
+ array_unshift($categories, 0);
+ }
+ $this_cat = array_pop($categories);
+
+ // get permission name + category position in parent path that has value set for that permission
+ $case = 'MAX(CASE c.CategoryId';
+ foreach ($categories as $pos => $cat_id) {
+ $case .= ' WHEN '.$cat_id.' THEN '.$pos;
+ }
+ $case .= ' END) AS InheritedPosition';
+ $sql = 'SELECT '.$case.', p.Permission AS Perm
+ FROM '.TABLE_PREFIX.'Category c
+ LEFT JOIN '.$perm_live_table.' p ON p.CatId = c.CategoryId
+ LEFT JOIN '.TABLE_PREFIX.'PermissionConfig pc ON pc.PermissionName = p.Permission
+ WHERE
+ CategoryId IN ('.implode(',', $categories).') AND
+ ModuleId = "'.$module.'" AND
+ (
+ (p.GroupId = '.$group_id.' AND p.Type = 0)
+ )
+ GROUP BY Perm';
+ $perm_positions = $this->Conn->GetCol($sql, 'Perm');
+
+ $pos_sql = '';
+ foreach ($perm_positions as $perm_name => $category_pos) {
+ $pos_sql .= '(#TABLE_PREFIX#.Permission = "'.$perm_name.'" AND #TABLE_PREFIX#.CatId = '.$categories[$category_pos].') OR ';
+ }
+ $pos_sql = $pos_sql ? preg_replace('/(.*) OR $/', '\\1', $pos_sql) : '0';
+
+ // get all permissions list with iheritence status, inherited category id and permission value
+ $sql = 'SELECT pc.PermissionName,
+ pc.Description,
+ IF (tmp_p.PermissionValue IS NULL AND p.PermissionValue IS NULL,
+ 0,
+ IF (tmp_p.PermissionValue IS NOT NULL, tmp_p.PermissionValue, p.PermissionValue)
+ ) AS Value,
+ IF (tmp_p.CatId IS NOT NULL, tmp_p.CatId, IF(p.CatId IS NOT NULL, p.CatId, 0) ) AS InheritedFrom,
+ IF(tmp_p.CatId = '.$category->GetID().', 0, 1) AS Inherited,
+ IF(p.PermissionValue IS NOT NULL, p.PermissionValue, 0) AS InheritedValue
+ FROM '.TABLE_PREFIX.'PermissionConfig pc
+ LEFT JOIN '.$perm_live_table.' p
+ ON (p.Permission = pc.PermissionName) AND ('.str_replace('#TABLE_PREFIX#', 'p', $pos_sql).') AND (p.GroupId = '.$group_id.')
+ LEFT JOIN '.$perm_temp_table.' tmp_p
+ ON (tmp_p.Permission = pc.PermissionName) AND (tmp_p.CatId = '.$this_cat.') AND (tmp_p.GroupId = '.$group_id.')
+ WHERE ModuleId = "'.$module.'"';
+ $permissions = $this->Conn->Query($sql);
+
+ $ret = '';
+ $block_params = array_merge_recursive2( $this->prepareTagParams($params), Array('name' => $params['render_as']));
+ foreach ($permissions as $perm_record) {
+ $block_params = array_merge_recursive2($block_params, $perm_record);
+ $ret .= $this->Application->ParseBlock($block_params);
+ }
+ return $ret;
+ }
+
+ /**
+ * Print module tab for each module
+ *
+ * @param Array $params
+ * @return string
+ */
+ function PrintTabs($params)
+ {
+ $ret = '';
+ $block_params = $params;
+ foreach ($this->Application->ModuleInfo as $module_name => $module_data) {
+ $params['item_prefix'] = $module_data['Var'];
+ $ret .= $this->Application->ProcessParsedTag('m', 'MyInclude', $params);
+ }
+ return $ret;
+ }
+
+ /**
+ * Returns category name by ID
+ *
+ * @param Array $params
+ */
+ function CategoryPath($params)
+ {
+ $category_id = $params['cat_id'];
+ $category_path = $this->Application->getCache('category_paths', $category_id);
+ if ($category_path === false) {
+ // not chached
+ if ($category_id > 0) {
+ $id_field = $this->Application->getUnitOption('c', 'IDField');
+ $table_name = $this->Application->getUnitOption('c', 'TableName');
+ $ml_formatter =& $this->Application->recallObject('kMultiLanguage');
+ $sql = 'SELECT '.$ml_formatter->LangFieldName('CachedNavbar').'
+ FROM '.$table_name.'
+ WHERE '.$id_field.' = '.$category_id;
+ $category_path = trim($this->CategoryPath( Array('cat_id' => 0) ).' > '.str_replace('&|&', ' > ', $this->Conn->GetOne($sql)), ' > ');
+ }
+ else {
+ $category_path = $this->Application->Phrase( $this->Application->ConfigValue('Root_Name') );
+ }
+ $this->Application->setCache('category_paths', $category_id, $category_path);
+ }
+ return $category_path;
+ }
+
+ function PermInputName($params)
+ {
+ return $this->Prefix.'['.$this->Application->GetVar('group_id').']['.$this->Application->Parser->GetParam('PermissionName').']['.$params['sub_key'].']';
+ }
+
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.9.2/kernel/units/permissions/permissions_tag_processor.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.9
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.9.2/core/units/relationship/relationship_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.9.2/core/units/relationship/relationship_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.9.2/core/units/relationship/relationship_event_handler.php (revision 6628)
@@ -0,0 +1,261 @@
+<?php
+
+ class RelationshipEventHandler extends kDBEventHandler
+ {
+ /**
+ * Allows to override standart permission mapping
+ *
+ */
+ function mapPermissions()
+ {
+ parent::mapPermissions();
+ $permissions = Array(
+ 'OnProcessSelected' => Array('subitem' => 'add|edit'),
+ );
+ $this->permMapping = array_merge($this->permMapping, $permissions);
+ }
+
+ /**
+ * Initializes new relation
+ *
+ * @param kEvent $event
+ */
+ function OnNew(&$event)
+ {
+ parent::OnNew($event);
+
+ $object =& $event->getObject();
+ $table_info = $object->getLinkedInfo();
+
+ $object->SetDBField('SourceId', $table_info['ParentId']);
+ $source_itemtype = $this->Application->getUnitOption($table_info['ParentPrefix'], 'ItemType');
+ $object->SetDBField('SourceType', $source_itemtype);
+
+ $object->SetDBField('TargetId', $this->Application->GetVar('target_id'));
+ $object->SetDBField('TargetType', $this->Application->GetVar('target_type'));
+
+ $this->OnAfterItemLoad($event);
+ }
+
+ /**
+ * Add new relation
+ *
+ * @param kEvent $event
+ */
+ function OnProcessSelected(&$event)
+ {
+ $dst_field = $this->Application->RecallVar('dst_field');
+ if ($dst_field == 'TargetId') {
+ // prepare target_id & target_type
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+
+ $selected_ids = $this->Application->GetVar('selected_ids');
+ $target_prefix = false;
+ foreach ($selected_ids as $selected_prefix => $target_id) {
+ if ($target_id > 0) {
+ $target_prefix = $selected_prefix;
+ break;
+ }
+ }
+
+ if (!$target_prefix) {
+ $this->finalizePopup($event);
+ return;
+ }
+
+ $sql = 'SELECT ResourceId
+ FROM '.$this->Application->getUnitOption($target_prefix, 'TableName').'
+ WHERE '.$this->Application->getUnitOption($target_prefix, 'IDField').' = '.$target_id;
+ $target_id = $this->Conn->GetOne($sql);
+ $target_type = $this->Application->getUnitOption($target_prefix, 'ItemType');
+
+ // don't add same relation twice
+ $table_info = $object->getLinkedInfo();
+ $sql = 'SELECT TargetId
+ FROM '.$object->TableName.'
+ WHERE (SourceId = '.$table_info['ParentId'].') AND (TargetId = '.$target_id.')';
+ $duplicate_relation = $this->Conn->GetOne($sql) == $target_id;
+
+ $this->finalizePopup($event);
+
+ if (!$duplicate_relation) {
+ // place correct template in opener stack
+ $source_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix');
+ $template = $this->Application->getUnitOption($source_prefix, 'AdminTemplatePath').'/relations_edit';
+ $redirect_params = Array($event->Prefix.'_event' => 'OnNew', 'target_id' => $target_id, 'target_type' => $target_type);
+ $this->Application->EventManager->openerStackPush($template, $redirect_params, 'all,'.$event->Prefix);
+ }
+ }
+ else {
+ $this->finalizePopup($event);
+ }
+ }
+
+ /**
+ * Set ItemName & ItemType virtual fields based on loaded item data
+ *
+ * @param kEvent $event
+ */
+ function OnAfterItemLoad(&$event)
+ {
+ $object =& $event->getObject();
+
+ $sql = 'SELECT Prefix
+ FROM '.TABLE_PREFIX.'ItemTypes
+ WHERE ItemType = '.$object->GetDBField('TargetType');
+ $target_prefix = $this->Conn->GetOne($sql);
+
+ $title_field = $this->getTitleField($target_prefix);
+ $title_phrase = $this->Application->getUnitOption($target_prefix, 'TitlePhrase');
+
+ $sql = 'SELECT '.$title_field.'
+ FROM '.$this->Application->getUnitOption($target_prefix, 'TableName').'
+ WHERE ResourceId = '.$object->GetDBField('TargetId');
+
+ $object->SetDBField('ItemName', $this->Conn->GetOne($sql));
+ $object->SetDBField('ItemType', $this->Application->Phrase($title_phrase));
+ }
+
+ /**
+ * Creates needed sql query to load list,
+ * if no query is defined in config for
+ * special requested, then use default
+ * query
+ *
+ * @param kEvent $event
+ * @access protected
+ */
+ function ListPrepareQuery(&$event)
+ {
+ return $this->BaseQuery($event, 'ListSQLs');
+ }
+
+ /**
+ * Creates needed sql query to load item,
+ * if no query is defined in config for
+ * special requested, then use default
+ * query
+ *
+ * @param kEvent $event
+ * @access protected
+ */
+ function ItemPrepareQuery(&$event)
+ {
+ return $this->BaseQuery($event, 'ItemSQLs');
+ }
+
+
+ /**
+ * Get item name & type based on relation type & modules installed
+ *
+ * @param kEvent $event
+ * @param string $sql_field
+ */
+ function BaseQuery(&$event, $sql_field)
+ {
+ $sqls = $this->Application->getUnitOption($event->Prefix,$sql_field);
+ $sql = isset($sqls[$event->Special]) ? $sqls[$event->Special] : $sqls[''];
+
+ $configs = $this->extractModulesInfo();
+
+ // 2. build sql based on information queried
+ $sql_templates['ItemName'] = 'IFNULL(%s.%s,\' \')';
+ $sql_templates['TableJoin'] = 'LEFT JOIN %1$s ON %1$s.ResourceId = rel.TargetId';
+ $sql_templates['TargetName'] = 'IF(rel.TargetType = %s, \'%s\', %s)';
+
+ $sql_parts = Array();
+ $sql_parts['TargetName'] = "''";
+ foreach ($configs as $prefix => $config_data) {
+ $title_field = $this->getTitleField($prefix);
+
+ $sql_parts['ItemName'][] = sprintf($sql_templates['ItemName'], $config_data['TableName'], $title_field);
+ $sql_parts['TableJoin'][] = sprintf($sql_templates['TableJoin'], $config_data['TableName']);
+
+ $sql_parts['TargetName'] = sprintf( $sql_templates['TargetName'],
+ $config_data['ItemType'],
+ '!'.$config_data['TitlePhrase'].'!',
+ $sql_parts['TargetName']);
+ $sql_parts['TargetName'] = str_replace('rel','%1$s',$sql_parts['TargetName']);
+ }
+
+ $object =& $event->getObject();
+
+ $vars = Array('#ITEM_NAMES#', '#ITEM_TYPES#');
+ $replacements = Array( implode(', ',$sql_parts['ItemName']), $sql_parts['TargetName'] );
+
+ $calculated_fields =& $object->getProperty('CalculatedFields');
+ foreach ($calculated_fields as $field_name => $field_expression) {
+ $calculated_fields[$field_name] = str_replace($vars, $replacements, $field_expression);
+ }
+
+ $object->setProperty('CalculatedFields', $calculated_fields);
+
+ $sql = str_replace('#ITEM_JOIN#', implode(' ',$sql_parts['TableJoin']), $sql);
+ $sql = str_replace('rel.','%1$s.',$sql);
+
+ return $sql;
+ }
+
+ /**
+ * Convert TitleField field of kMultiLanguage formatter used for it
+ *
+ * @param string $prefix
+ * @return string
+ */
+ function getTitleField($prefix)
+ {
+ $lang_prefix = 'l'.$this->Application->GetVar('m_lang').'_';
+
+ $title_field = $this->Application->getUnitOption($prefix, 'TitleField');
+ $field_options = $this->Application->getUnitOption($prefix.'.'.$title_field, 'Fields');
+
+ $formatter_class = isset($field_options['formatter']) ? $field_options['formatter'] : '';
+ if ($formatter_class == 'kMultiLanguage' && !isset($field_options['master_field'])) {
+ $title_field = $lang_prefix.$title_field;
+ }
+ return $title_field;
+ }
+
+ /**
+ * Get configs from modules installed
+ *
+ * @return Array
+ * @access private
+ */
+ function extractModulesInfo()
+ {
+ // get installed modules & their config info
+ // maybe we should leave only prefixes, that have "view" permission
+ $configs = Array();
+ foreach ($this->Application->ModuleInfo as $module_name => $module_data) {
+ $prefix = $module_data['Var'];
+ if ($prefix == 'm') {
+ $prefix = 'c';
+ }
+ $configs[$prefix] = $this->Application->getUnitOptions($prefix);
+ if($configs[$prefix] === false) unset($configs[$prefix]);
+ if(!isset($configs[$prefix]['CatalogItem']) || !$configs[$prefix]['CatalogItem']) unset($configs[$prefix]);
+ }
+ return $configs;
+ }
+
+ /**
+ * Deletes relations to hooked item from other items
+ *
+ * @param kEvent $event
+ */
+ function OnDeleteForeignRelations(&$event)
+ {
+ $main_object =& $event->MasterEvent->getObject();
+ $resource_id = $main_object->GetDBField('ResourceId');
+
+ $table = $this->Application->getUnitOption($event->Prefix,'TableName');
+ $sql = 'DELETE FROM '.$table.' WHERE TargetId = '.$resource_id;
+ $this->Conn->Query($sql);
+ }
+
+
+ }
+
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.9.2/core/units/relationship/relationship_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.9
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.9.2/core/units/phrases/phrases_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.9.2/core/units/phrases/phrases_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.9.2/core/units/phrases/phrases_config.php (revision 6628)
@@ -0,0 +1,133 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'phrases',
+ 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
+ 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
+ 'EventHandlerClass' => Array('class'=>'PhrasesEventHandler','file'=>'phrases_event_handler.php','build_event'=>'OnBuild'),
+ 'TagProcessorClass' => Array('class'=>'kDBTagProcessor','file'=>'','build_event'=>'OnBuild'),
+ 'AutoLoad' => true,
+
+ 'Hooks' => Array(
+ Array(
+ 'Mode' => hBEFORE,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'phrases',
+ 'HookToSpecial' => '',
+ 'HookToEvent' => Array('OnCreate'),
+ 'DoPrefix' => 'phrases',
+ 'DoSpecial' => '',
+ 'DoEvent' => 'OnBeforePhraseCreate',
+ ),
+
+ Array(
+ 'Mode' => hAFTER,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'phrases',
+ 'HookToSpecial' => '',
+ 'HookToEvent' => Array('OnBeforeItemCreate','OnBeforeItemUpdate'),
+ 'DoPrefix' => 'phrases',
+ 'DoSpecial' => '',
+ 'DoEvent' => 'OnSetLastUpdated',
+ ),
+ ),
+
+ 'QueryString' => Array(
+ 1 => 'id',
+ 2 => 'page',
+ 3 => 'event',
+ 4 => 'label',
+ ),
+ 'IDField' => 'PhraseId',
+
+ 'TitleField' => 'Phrase',
+
+ 'TitlePresets' => Array(
+ 'default' => Array( 'new_status_labels' => Array('phrases'=>'!la_title_Adding_Phrase!'),
+ 'edit_status_labels' => Array('phrases'=>'!la_title_Editing_Phrase!'),
+ 'new_titlefield' => Array('phrases'=>'!la_title_New_Phrase!'),
+ ),
+
+ 'phrase_edit' => Array('prefixes' => Array('phrases'), 'format' => '#phrases_status# - #phrases_titlefield#'),
+
+ ),
+
+ 'FilterMenu' => Array(
+ 'Groups' => Array(
+ Array('mode' => 'AND', 'filters' => Array('show_front','show_admin','show_both'), 'type' => WHERE_FILTER),
+ Array('mode' => 'AND', 'filters' => Array('translated', 'not_translated'), 'type' => WHERE_FILTER),
+ ),
+ 'Filters' => Array(
+ 'show_front' => Array('label' =>'la_PhraseType_Front', 'on_sql' => '', 'off_sql' => '%1$s.PhraseType != 0'),
+ 'show_admin' => Array('label' => 'la_PhraseType_Admin', 'on_sql' => '', 'off_sql' => '%1$s.PhraseType != 1'),
+ 'show_both' => Array('label' => 'la_PhraseType_Both', 'on_sql' => '', 'off_sql' => '%1$s.PhraseType != 2'),
+ 's1' => Array(),
+ 'translated' => Array('label' => 'la_PhraseTranslated', 'on_sql' => '', 'off_sql' => '%1$s.Translation = pri.Translation'),
+ 'not_translated' => Array('label' => 'la_PhraseNotTranslated', 'on_sql' => '', 'off_sql' => '%1$s.Translation != pri.Translation'),
+ )
+ ),
+
+ 'TableName' => TABLE_PREFIX.'Phrase',
+
+ 'CalculatedFields' => Array(
+ '' => Array(
+ 'PrimaryTranslation' => 'pri.Translation',
+ ),
+
+ ),
+
+ 'ListSQLs' => Array( ''=>' SELECT %1$s.* %2$s
+ FROM %1$s
+ LEFT JOIN '.TABLE_PREFIX.'Phrase pri ON (%1$s.Phrase = pri.Phrase) AND (pri.LanguageId = 1)'),
+
+ 'ItemSQLs' => Array( ''=>' SELECT %1$s.* %2$s
+ FROM %1$s
+ LEFT JOIN '.TABLE_PREFIX.'Phrase pri ON (%1$s.Phrase = pri.Phrase) AND (pri.LanguageId = 1)',),
+
+ 'ListSortings' => Array(
+ '' => Array(
+ 'Sorting' => Array('Phrase' => 'asc'),
+ )
+ ),
+
+ 'ForeignKey' => 'LanguageId',
+ 'ParentTableKey' => 'LanguageId',
+ 'ParentPrefix' => 'lang',
+ 'AutoDelete' => true,
+ 'AutoClone' => true,
+
+ 'Fields' => Array(
+ 'Phrase' => Array('type' => 'string','required'=>1,'unique'=>Array('LanguageId'),'not_null' => '1','default' => ''),
+ 'Translation' => Array('type' => 'string','required'=>1,'not_null' => '1','default' => ''),
+ 'PhraseType' => Array('type' => 'int','required'=>1,'formatter'=>'kOptionsFormatter','options'=>Array(0=>'la_PhraseType_Front',1=>'la_PhraseType_Admin',2=>'la_PhraseType_Both'), 'use_phrases' => 1, 'not_null' => '1','default' => '0'),
+ 'PhraseId' => Array('type' => 'int','not_null' => '1','default' => ''),
+ 'LanguageId' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'LastChanged' => Array('type' => 'int', 'formatter'=>'kDateFormatter', 'not_null' => '1','default' => '0'),
+ 'LastChangeIP' => Array('type' => 'string','not_null' => '1','default' => ''),
+ 'Module' => Array('type' => 'string', 'formatter'=>'kOptionsFormatter', 'options'=>Array(''=>''), 'options_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Modules WHERE Loaded = 1 ORDER BY LoadOrder', 'option_key_field'=>'Name', 'option_title_field'=>'Name', 'not_null' => '1','default' => 'In-Portal'),
+ ),
+
+ 'VirtualFields' => Array(
+ 'PrimaryTranslation' => Array(),
+ 'LangFile' => Array(),
+ 'ImportOverwrite' => Array(),
+ 'DoNotEncode' => Array(),
+ ),
+
+ 'Grids' => Array(
+ 'Default' => Array(
+ 'Icons' => Array('default'=>'icon16_language_var.gif'),
+ 'Fields' => Array(
+ 'Phrase' => Array( 'title'=>'la_col_Label', 'data_block' => 'grid_checkbox_td'),
+ 'Translation' => Array( 'title'=>'la_col_Translation' ),
+ 'PrimaryTranslation' => Array( 'title'=>'la_col_PrimaryValue' ),
+ 'PhraseType' => Array( 'title'=>'la_col_PhraseType' ),
+ 'LastChanged' => Array( 'title'=>'la_col_LastChanged' ),
+ 'Module' => Array( 'title'=>'la_col_Module' ),
+ ),
+
+ ),
+ ),
+ );
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.9.2/core/units/phrases/phrases_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.9
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.9.2/core/units/modules/modules_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.9.2/core/units/modules/modules_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.9.2/core/units/modules/modules_event_handler.php (revision 6628)
@@ -0,0 +1,79 @@
+<?php
+
+ class ModulesEventHandler extends kDBEventHandler {
+
+ /**
+ * Builds item
+ *
+ * @param kEvent $event
+ * @access protected
+ */
+ function OnItemBuild(&$event)
+ {
+ $this->Application->SetVar($event->getPrefixSpecial(true).'_id', $event->Special);
+ parent::OnItemBuild($event);
+ }
+
+ /**
+ * List with one record if special passed
+ *
+ * @param kEvent $event
+ */
+ function SetCustomQuery(&$event)
+ {
+ if ($event->Special) {
+ $object =& $event->getObject();
+ $object->addFilter('current_module', 'Name = '.$event->Special);
+ }
+ }
+
+ function mapEvents()
+ {
+ parent::mapEvents();
+ $this->eventMethods['OnMassApprove'] = 'moduleAction';
+ $this->eventMethods['OnMassDecline'] = 'moduleAction';
+ }
+
+ /**
+ * Disabled modules, but not In-Portal
+ *
+ * @param kEvent $event
+ */
+ function moduleAction(&$event)
+ {
+ if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
+ return;
+ }
+
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+ $ids = $this->StoreSelectedIDs($event);
+
+
+ if (!$ids) return true;
+
+ $status_field = array_shift( $this->Application->getUnitOption($event->Prefix, 'StatusField') );
+
+ foreach($ids as $id)
+ {
+ $object->Load($id);
+ if ($object->GetID() == 'In-Portal') continue;
+ $object->SetDBField($status_field, $event->Name == 'OnMassApprove' ? 1 : 0);
+
+ if ($object->Update()) {
+ $event->status = erSUCCESS;
+ $event->redirect_params = Array('opener' => 's', 'pass_events' => true); //stay!
+ }
+ else {
+ $event->status = erFAIL;
+ $event->redirect = false;
+ break;
+ }
+ }
+
+ $this->Application->UnitConfigReader->ResetParsedData(true); //true to reset sections cache also
+ $event->SetRedirectParam('RefreshTree', 1);
+ }
+
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.9.2/core/units/modules/modules_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.9
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.9.2/core/units/translator/translator_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.9.2/core/units/translator/translator_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.9.2/core/units/translator/translator_event_handler.php (revision 6628)
@@ -0,0 +1,122 @@
+<?php
+
+ class TranslatorEventHandler extends kDBEventHandler
+ {
+ /**
+ * Allows to override standart permission mapping
+ *
+ */
+ function mapPermissions()
+ {
+ parent::mapPermissions();
+ $permissions = Array(
+ 'OnChangeLanguage' => Array('subitem' => 'add|edit'),
+ 'OnSaveAndClose' => Array('subitem' => 'add|edit'),
+ );
+ $this->permMapping = array_merge($this->permMapping, $permissions);
+ }
+
+ /**
+ * Check permission of item, that being translated
+ *
+ * @param kEvent $event
+ */
+ function CheckPermission(&$event)
+ {
+ list($prefix, $field) = $this->getPrefixAndField($event);
+
+ $top_prefix = $this->Application->GetTopmostPrefix($prefix);
+ $event->setEventParam('top_prefix', $top_prefix);
+ return parent::CheckPermission($event);
+ }
+
+
+ /**
+ * Returns prefix and field being translated
+ *
+ * @param kEvent $event
+ */
+ function getPrefixAndField(&$event)
+ {
+ $field = $this->Application->GetVar($event->getPrefixSpecial(true).'_field');
+
+ if (strpos($field,':') !== false) {
+ list($prefix, $field) = explode(':', $field);
+ }
+ else {
+ $prefix = $this->Application->GetVar($event->getPrefixSpecial(true).'_prefix');
+ }
+ return Array($prefix, $field);
+ }
+
+ function OnLoad(&$event)
+ {
+ list($obj_prefix, $field) = $this->getPrefixAndField($event);
+
+ $object =& $this->Application->recallObject($obj_prefix);
+ $translator =& $this->Application->recallObject($event->getPrefixSpecial());
+
+ $def_lang = $this->Application->GetDefaultLanguageId();
+
+ $current_lang = $translator->GetDBField('Language');
+ if (!$current_lang) $current_lang = $this->Application->RecallVar('trans_lang');
+ if (!$current_lang) $current_lang = $this->Application->GetVar('m_lang');
+ /*if ($current_lang == $def_lang) {
+ $current_lang = $def_lang + 1;
+ }*/
+ $this->Application->StoreVar('trans_lang', $current_lang); //remember translation language for user friendlyness
+
+ $translator->SetID(1);
+ $translator->SetDBField('Original', $object->GetDBField('l'.$this->Application->GetVar('m_lang').'_'.$field));
+ $translator->SetDBField('Language', $current_lang);
+ $translator->SetDBField('SwitchLanguage', $current_lang);
+
+ $translator->SetDBField('Translation', $object->GetDBField('l'.$current_lang.'_'.$field));
+
+ $cur_lang =& $this->Application->recallObject('lang.current');
+ $cur_lang->Load($current_lang);
+
+ $translator->SetDBField('Charset', $cur_lang->GetDBField('Charset'));
+
+ $event->redirect = false;
+ }
+
+ function OnSaveAndClose(&$event)
+ {
+ $event->CallSubEvent('OnPreSave');
+ $this->finalizePopup($event);
+ }
+
+ function OnPreSave(&$event)
+ {
+ $translator =& $this->Application->recallObject($event->getPrefixSpecial());
+
+ $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) );
+ if($items_info) $field_values = array_shift($items_info);
+
+ $translator->SetFieldsFromHash($field_values);
+
+ list($obj_prefix, $field) = $this->getPrefixAndField($event);
+
+ $object =& $this->Application->recallObject($obj_prefix);
+
+ $lang = $translator->GetDBField('Language');
+ $object->Fields['l'.$lang.'_'.$field] = Array();
+ $object->SetDBField('l'.$lang.'_'.$field, $translator->GetDBField('Translation'));
+ $this->RemoveRequiredFields($object);
+ $object->Update();
+ }
+
+ function OnChangeLanguage(&$event)
+ {
+ $event->CallSubEvent('OnPreSave');
+ $translator =& $this->Application->recallObject($event->getPrefixSpecial());
+ $translator->SetDBField('Language', $translator->GetDBField('SwitchLanguage'));
+ $event->CallSubEvent('OnLoad');
+ $event->redirect = false;
+ }
+
+ }
+
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.9.2/core/units/translator/translator_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.9
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.9.2/core/units/config_search/config_search_config.php
===================================================================
--- branches/unlabeled/unlabeled-1.9.2/core/units/config_search/config_search_config.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.9.2/core/units/config_search/config_search_config.php (revision 6628)
@@ -0,0 +1,115 @@
+<?php
+
+$config = Array(
+ 'Prefix' => 'confs',
+
+ 'Clones' => Array(
+ 'confs-cf' => Array(
+ 'Prefix' => 'confs-cf',
+ 'ParentPrefix' => 'cf',
+ 'ParentTableKey' => 'CustomFieldId', // linked field in master table
+ 'ForeignKey' => 'CustomFieldId', // linked field in subtable
+ 'AutoClone' => false, // because OnCreateCustomField hook does the stuff
+ 'AutoDelete' => true,
+
+ 'Hooks' => Array(
+ Array(
+ 'Mode' => hAFTER,
+ 'Conditional' => false,
+ 'HookToPrefix' => '#PARENT#',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array('OnAfterItemCreate', 'OnAfterItemUpdate'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnCreateCustomField',
+ ),
+ ),
+ ),
+ ),
+
+ 'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
+ 'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
+ 'EventHandlerClass' => Array('class'=>'ConfigSearchEventHandler','file'=>'config_search_event_handler.php','build_event'=>'OnBuild'),
+ 'TagProcessorClass' => Array('class'=>'ConfigSearchTagProcessor','file'=>'config_search_tag_processor.php','build_event'=>'OnBuild'),
+ 'AutoLoad' => true,
+ 'hooks' => Array(),
+ 'QueryString' => Array(
+ 1 => 'id',
+ 2 => 'page',
+ 3 => 'event',
+ ),
+
+ 'IDField' => 'SearchConfigId',
+
+ 'TitleField' => 'FieldName',
+
+ 'TitlePresets' => Array(
+ 'default' => Array( 'new_status_labels' => Array('confs'=>'!la_title_Adding_ConfigSearch!'),
+ 'edit_status_labels' => Array('confs'=>'!la_title_Editing_ConfigSearch!'),
+ 'new_titlefield' => Array('confs'=>'!la_title_New_ConfigSearch!'),
+ ),
+
+ 'configsearch_edit' => Array('prefixes' => Array('confs'), 'format' => "#confs_status# '#confs_titlefield#' - !la_title_General!"),
+ 'config_list_search' => Array('prefixes' => Array('confs_List'), 'tag_params' => Array('confs' => Array('per_page' => -1) ), 'format' => "!la_updating_config!"),
+ ),
+
+ 'TableName' => TABLE_PREFIX.'SearchConfig',
+
+ 'CalculatedFields' => Array(
+ '' => Array(
+ 'IsCustom' => 'IF(CustomFieldId IS NULL, 0, 1)',
+ ),
+ ),
+
+ 'ListSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'),
+
+ 'ItemSQLs' => Array('' => 'SELECT %1$s.* %2$s FROM %1$s'),
+
+
+
+ 'Fields' => Array(
+ 'TableName' => Array('type' => 'string','not_null' => '1', 'required' => 1, 'default' => ''),
+ 'FieldName' => Array('type' => 'string','not_null' => '1', 'required' => 1, 'default' => ''),
+ 'SimpleSearch' => Array('type' => 'int','not_null' => '1','default' => '1'),
+ 'AdvancedSearch' => Array('type' => 'int','not_null' => '1','default' => '1'),
+ 'Description' => Array('type' => 'string','default' => ''),
+ 'DisplayName' => Array('type' => 'string', 'required' => 1, 'default' => ''),
+ 'ModuleName' => Array('type' => 'string', 'formatter'=>'kOptionsFormatter', 'options'=>Array(''=>''), 'options_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Modules WHERE Loaded = 1 ORDER BY LoadOrder', 'option_key_field'=>'Name', 'option_title_field'=>'Name', 'not_null' => '1','default' => 'In-Portal'),
+ 'ConfigHeader' => Array('type' => 'string', 'required' => 1, 'default' => ''),
+ 'DisplayOrder' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'SearchConfigId' => Array('type' => 'int','not_null' => '1','default' => ''),
+ 'Priority' => Array('type' => 'int','not_null' => '1','default' => '0'),
+ 'FieldType' => Array('type' => 'string', 'formatter' => 'kOptionsFormatter', 'options' => Array('text' => 'text', 'range' => 'range', 'boolean' => 'boolean', 'date' => 'date'), 'not_null' => '1', 'required' => 1, 'default' => 'text'),
+ 'ForeignField' => Array('type' => 'string','default' => null),
+ 'JoinClause' => Array('type' => 'string','default' => null),
+ 'IsWhere' => Array('type' => 'string','default' => null),
+ 'IsNotWhere' => Array('type' => 'string','default' => null),
+ 'ContainsWhere' => Array('type' => 'string','default' => null),
+ 'NotContainsWhere' => Array('type' => 'string','default' => null),
+ 'CustomFieldId' => Array('type' => 'int', 'default' => null),
+ ),
+
+ 'VirtualFields' => Array(
+ 'IsCustom' => Array('type' => 'int', 'default' => 0),
+ ),
+
+ 'ListSortings' => Array(
+ '' => Array(
+ 'ForcedSorting' => Array('IsCustom' => 'asc'),
+ 'Sorting' => Array('DisplayOrder' => 'asc'),
+ )
+ ),
+
+ 'Grids' => Array(
+ 'Default' => Array(
+ 'Icons' => Array('default'=>'icon16_custom.gif'), // icons for each StatusField values, if no matches or no statusfield selected, then "default" icon is used
+ 'Fields' => Array(
+ 'TableName' => Array( 'title'=>'la_col_TableName', 'data_block' => 'grid_data_td'),
+ 'FieldName' => Array( 'title'=>'la_col_FieldName', 'data_block' => 'grid_data_td' ),
+ 'SimpleSearch' => Array( 'title'=>'la_col_SimpleSearch', 'data_block' => 'grid_data_td'),
+ ),
+ ),
+ ),
+ );
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.9.2/core/units/config_search/config_search_config.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.9
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.9.2/core/units/permissions/permissions_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.9.2/core/units/permissions/permissions_tag_processor.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.9.2/core/units/permissions/permissions_tag_processor.php (revision 6628)
@@ -0,0 +1,188 @@
+<?php
+
+ class PermissionsTagProcessor extends kDBTagProcessor {
+
+ function HasPermission($params)
+ {
+ $section_name = $params['section_name'];
+
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+
+ return array_search($params['perm_name'], $section_data['permissions']) !== false;
+ }
+
+ function HasAdvancedPermissions($params)
+ {
+ $section_name = $params['section_name'];
+
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+
+ $ret = false;
+ foreach ($section_data['permissions'] as $perm_name) {
+ if (preg_match('/^advanced:(.*)/', $perm_name)) {
+ $ret = true;
+ break;
+ }
+ }
+ return $ret;
+ }
+
+ function PermissionValue($params)
+ {
+ $section_name = $params['section_name'];
+
+ $sections_helper =& $this->Application->recallObject('SectionsHelper');
+ $section_data =& $sections_helper->getSectionData($section_name);
+ $perm_name = $params['perm_name'];
+
+ $permissions_helper =& $this->Application->recallObject('PermissionsHelper');
+ if (!$permissions_helper->isOldPermission($section_name, $perm_name)) {
+ $perm_name = $section_name.'.'.$perm_name;
+ }
+
+ return $permissions_helper->getPermissionValue($perm_name);
+ }
+
+ function LoadPermissions($params)
+ {
+ $permissions_helper =& $this->Application->recallObject('PermissionsHelper');
+ $prefix_parts = explode('-', $this->Prefix, 2);
+ $permissions_helper->LoadPermissions($this->Application->GetVar('g_id'), 0, 1);
+ }
+
+ function LevelIndicator($params)
+ {
+ return $params['level'] * $params['multiply'];
+ }
+
+ function PrintPermissions($params)
+ {
+ $category =& $this->Application->recallObject('c');
+
+ $group_id = $this->Application->GetVar('group_id');
+ $prefix = $this->Application->GetVar('item_prefix');
+ $module = $this->Application->findModule('Var', $prefix, 'Name');
+
+ $perm_live_table = $this->Application->getUnitOption('c-perm', 'TableName');
+ $perm_temp_table = $this->Application->GetTempName($perm_live_table);
+
+ if ($category->GetID() == 0) {
+ $categories = Array(0);
+ }
+ else {
+ $categories = explode('|', substr($category->GetDBField('ParentPath'), 1, -1));
+ }
+
+ if (count($categories) == 1 || $category->GetID() == 0) {
+ // category located in root category ("Home") => then add it to path virtually
+ array_unshift($categories, 0);
+ }
+ $this_cat = array_pop($categories);
+
+ // get permission name + category position in parent path that has value set for that permission
+ $case = 'MAX(CASE c.CategoryId';
+ foreach ($categories as $pos => $cat_id) {
+ $case .= ' WHEN '.$cat_id.' THEN '.$pos;
+ }
+ $case .= ' END) AS InheritedPosition';
+ $sql = 'SELECT '.$case.', p.Permission AS Perm
+ FROM '.TABLE_PREFIX.'Category c
+ LEFT JOIN '.$perm_live_table.' p ON p.CatId = c.CategoryId
+ LEFT JOIN '.TABLE_PREFIX.'PermissionConfig pc ON pc.PermissionName = p.Permission
+ WHERE
+ CategoryId IN ('.implode(',', $categories).') AND
+ ModuleId = "'.$module.'" AND
+ (
+ (p.GroupId = '.$group_id.' AND p.Type = 0)
+ )
+ GROUP BY Perm';
+ $perm_positions = $this->Conn->GetCol($sql, 'Perm');
+
+ $pos_sql = '';
+ foreach ($perm_positions as $perm_name => $category_pos) {
+ $pos_sql .= '(#TABLE_PREFIX#.Permission = "'.$perm_name.'" AND #TABLE_PREFIX#.CatId = '.$categories[$category_pos].') OR ';
+ }
+ $pos_sql = $pos_sql ? preg_replace('/(.*) OR $/', '\\1', $pos_sql) : '0';
+
+ // get all permissions list with iheritence status, inherited category id and permission value
+ $sql = 'SELECT pc.PermissionName,
+ pc.Description,
+ IF (tmp_p.PermissionValue IS NULL AND p.PermissionValue IS NULL,
+ 0,
+ IF (tmp_p.PermissionValue IS NOT NULL, tmp_p.PermissionValue, p.PermissionValue)
+ ) AS Value,
+ IF (tmp_p.CatId IS NOT NULL, tmp_p.CatId, IF(p.CatId IS NOT NULL, p.CatId, 0) ) AS InheritedFrom,
+ IF(tmp_p.CatId = '.$category->GetID().', 0, 1) AS Inherited,
+ IF(p.PermissionValue IS NOT NULL, p.PermissionValue, 0) AS InheritedValue
+ FROM '.TABLE_PREFIX.'PermissionConfig pc
+ LEFT JOIN '.$perm_live_table.' p
+ ON (p.Permission = pc.PermissionName) AND ('.str_replace('#TABLE_PREFIX#', 'p', $pos_sql).') AND (p.GroupId = '.$group_id.')
+ LEFT JOIN '.$perm_temp_table.' tmp_p
+ ON (tmp_p.Permission = pc.PermissionName) AND (tmp_p.CatId = '.$this_cat.') AND (tmp_p.GroupId = '.$group_id.')
+ WHERE ModuleId = "'.$module.'"';
+ $permissions = $this->Conn->Query($sql);
+
+ $ret = '';
+ $block_params = array_merge_recursive2( $this->prepareTagParams($params), Array('name' => $params['render_as']));
+ foreach ($permissions as $perm_record) {
+ $block_params = array_merge_recursive2($block_params, $perm_record);
+ $ret .= $this->Application->ParseBlock($block_params);
+ }
+ return $ret;
+ }
+
+ /**
+ * Print module tab for each module
+ *
+ * @param Array $params
+ * @return string
+ */
+ function PrintTabs($params)
+ {
+ $ret = '';
+ $block_params = $params;
+ foreach ($this->Application->ModuleInfo as $module_name => $module_data) {
+ $params['item_prefix'] = $module_data['Var'];
+ $ret .= $this->Application->ProcessParsedTag('m', 'MyInclude', $params);
+ }
+ return $ret;
+ }
+
+ /**
+ * Returns category name by ID
+ *
+ * @param Array $params
+ */
+ function CategoryPath($params)
+ {
+ $category_id = $params['cat_id'];
+ $category_path = $this->Application->getCache('category_paths', $category_id);
+ if ($category_path === false) {
+ // not chached
+ if ($category_id > 0) {
+ $id_field = $this->Application->getUnitOption('c', 'IDField');
+ $table_name = $this->Application->getUnitOption('c', 'TableName');
+ $ml_formatter =& $this->Application->recallObject('kMultiLanguage');
+ $sql = 'SELECT '.$ml_formatter->LangFieldName('CachedNavbar').'
+ FROM '.$table_name.'
+ WHERE '.$id_field.' = '.$category_id;
+ $category_path = trim($this->CategoryPath( Array('cat_id' => 0) ).' > '.str_replace('&|&', ' > ', $this->Conn->GetOne($sql)), ' > ');
+ }
+ else {
+ $category_path = $this->Application->Phrase( $this->Application->ConfigValue('Root_Name') );
+ }
+ $this->Application->setCache('category_paths', $category_id, $category_path);
+ }
+ return $category_path;
+ }
+
+ function PermInputName($params)
+ {
+ return $this->Prefix.'['.$this->Application->GetVar('group_id').']['.$this->Application->Parser->GetParam('PermissionName').']['.$params['sub_key'].']';
+ }
+
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.9.2/core/units/permissions/permissions_tag_processor.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.9
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: branches/unlabeled/unlabeled-1.9.2/core/units/category_items/category_items_event_handler.php
===================================================================
--- branches/unlabeled/unlabeled-1.9.2/core/units/category_items/category_items_event_handler.php (nonexistent)
+++ branches/unlabeled/unlabeled-1.9.2/core/units/category_items/category_items_event_handler.php (revision 6628)
@@ -0,0 +1,127 @@
+<?php
+
+ class CategoryItemsEventHander extends kDBEventHandler
+ {
+
+ /**
+ * Setting language dependant navbar as calculated field
+ *
+ * @param kEvent $event
+ */
+ function SetCustomQuery(&$event)
+ {
+ $object =& $event->getObject();
+
+ $ml_formatter =& $this->Application->recallObject('kMultiLanguage');
+ $object->addCalculatedField('CategoryName', 'c.'.$ml_formatter->LangFieldName('CachedNavbar'));
+ }
+
+ /**
+ * Set's new category as primary for product
+ *
+ * @param kEvent $event
+ */
+ function OnSetPrimary(&$event)
+ {
+ $object =& $event->getObject( Array('skip_autoload' => true) );
+ $this->StoreSelectedIDs($event);
+ $ids=$this->getSelectedIDs($event);
+ if($ids)
+ {
+ $id = array_shift($ids);
+ $table_info = $object->getLinkedInfo();
+
+ $this->Conn->Query('UPDATE '.$object->TableName.' SET PrimaryCat = 0 WHERE '.$table_info['ForeignKey'].' = '.$table_info['ParentId']);
+ $this->Conn->Query('UPDATE '.$object->TableName.' SET PrimaryCat = 1 WHERE ('.$table_info['ForeignKey'].' = '.$table_info['ParentId'].') AND (CategoryId = '.$id.')');
+ }
+ $event->redirect_params = Array('opener' => 's', 'pass_events' => true); //stay!
+ }
+
+ /**
+ * Apply custom processing to item
+ *
+ * @param kEvent $event
+ */
+ function customProcessing(&$event, $type)
+ {
+ if($event->Name == 'OnMassDelete')
+ {
+ $object =& $event->getObject();
+ $table_info = $object->getLinkedInfo();
+
+ switch ($type)
+ {
+ case 'before':
+ $ids = $event->getEventParam('ids');
+ if($ids)
+ {
+ $ids = $this->Conn->GetCol('SELECT CategoryId FROM '.$object->TableName.' WHERE (PrimaryCat=0) AND ('.$table_info['ForeignKey'].'='.$table_info['ParentId'].') AND CategoryId IN ('.implode(',',$ids).')');
+ $event->setEventParam('ids',$ids);
+ }
+ break;
+
+ // not needed because 'before' does not allow to delete primary cat!
+ /*case 'after':
+ // set 1st not deleted category as primary
+ $has_primary = $this->Conn->GetOne('SELECT COUNT(*) FROM '.$object->TableName.' WHERE (PrimaryCat=1) AND ('.$table_info['ForeignKey'].' = '.$table_info['ParentId'].')');
+ if(!$has_primary)
+ {
+ $cat_id = $this->Conn->GetOne('SELECT CategoryId FROM '.$object->TableName.' WHERE '.$table_info['ForeignKey'].' = '.$table_info['ParentId']);
+ $this->Conn->Query('UPDATE '.$object->TableName.' SET PrimaryCat = 1 WHERE ('.$table_info['ForeignKey'].' = '.$table_info['ParentId'].') AND (CategoryId = '.$cat_id.')');
+ }
+ break;*/
+ }
+ }
+ }
+
+ /**
+ * Removes primary mark from cloned category items record
+ *
+ * @param kEvent $event
+ */
+ function OnAfterClone(&$event)
+ {
+ $id = $event->getEventParam('id');
+ $table = $this->Application->getUnitOption($event->Prefix, 'TableName');
+ $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField');
+ $sql = 'UPDATE %s SET PrimaryCat = 0 WHERE %s = %s';
+
+ $this->Conn->Query( sprintf($sql, $table, $id_field, $id) );
+ }
+
+ /**
+ * Deletes items of requested type from requested categories.
+ * In case if item is deleted from it's last category, then delete item too.
+ *
+ * @param kEvent $event
+ */
+ function OnDeleteFromCategory(&$event)
+ {
+ $category_ids = $event->getEventParam('category_ids');
+ if(!$category_ids) return false;
+
+ $item_prefix = $event->getEventParam('item_prefix');
+ $item =& $this->Application->recallObject($item_prefix.'.-item', null, Array('skip_autoload' => true));
+
+ $ci_table = $this->Application->getUnitOption($event->Prefix, 'TableName');
+ $item_table = $this->Application->getUnitOption($item_prefix, 'TableName');
+
+ $sql = 'SELECT ItemResourceId, CategoryId FROM %1$s INNER JOIN %2$s ON (%1$s.ResourceId = %2$s.ItemResourceId) WHERE CategoryId IN (%3$s)';
+ $category_items = $this->Conn->Query( sprintf($sql, $item_table, $ci_table, implode(',', $category_ids) ) );
+
+ $item_hash = Array();
+ foreach($category_items as $ci_row)
+ {
+ $item_hash[ $ci_row['ItemResourceId'] ][] = $ci_row['CategoryId'];
+ }
+
+ foreach($item_hash as $item_resource_id => $delete_category_ids)
+ {
+ $item->Load($item_resource_id, 'ResourceId');
+ $item->DeleteFromCategories($delete_category_ids);
+ }
+ }
+
+ }
+
+?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.9.2/core/units/category_items/category_items_event_handler.php
___________________________________________________________________
Added: cvs2svn:cvs-rev
## -0,0 +1 ##
+1.9
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

Event Timeline