function customObjectAttributeHTTPAction($http, $action, $contentObjectAttribute, $parameters)
 {
     $contentobjectID = false;
     if (eZDataType::fetchActionValue($action, 'new_class', $classID) or $action == 'new_class') {
         if ($action == 'new_class') {
             $base = $parameters['base_name'];
             $classVariableName = $base . '_new_class';
             if ($http->hasPostVariable($classVariableName)) {
                 $classVariable = $http->postVariable($classVariableName);
                 $classID = $classVariable[$contentObjectAttribute->attribute('id')];
                 $class = eZContentClass::fetch($classID);
             } else {
                 return false;
             }
         } else {
             $class = eZContentClass::fetch($classID);
         }
         if ($class) {
             $classAttribute = $contentObjectAttribute->attribute('contentclass_attribute');
             $class_content = $classAttribute->content();
             $content = $contentObjectAttribute->content();
             $priority = 0;
             for ($i = 0; $i < count($content['relation_list']); ++$i) {
                 if ($content['relation_list'][$i]['priority'] > $priority) {
                     $priority = $content['relation_list'][$i]['priority'];
                 }
             }
             $base = $parameters['base_name'];
             $nodePlacement = false;
             $nodePlacementName = $base . '_object_initial_node_placement';
             if ($http->hasPostVariable($nodePlacementName)) {
                 $nodePlacementMap = $http->postVariable($nodePlacementName);
                 if (isset($nodePlacementMap[$contentObjectAttribute->attribute('id')])) {
                     $nodePlacement = $nodePlacementMap[$contentObjectAttribute->attribute('id')];
                 }
             }
             $relationItem = $this->createInstance($class, $priority + 1, $contentObjectAttribute, $nodePlacement);
             if ($class_content['default_placement']) {
                 $relationItem['parent_node_id'] = $class_content['default_placement']['node_id'];
             }
             $content['relation_list'][] = $relationItem;
             $hasAttributeInput = false;
             $attributeInputVariable = $base . '_has_attribute_input';
             if ($http->hasPostVariable($attributeInputVariable)) {
                 $attributeInputMap = $http->postVariable($attributeInputVariable);
                 if (isset($attributeInputMap[$contentObjectAttribute->attribute('id')])) {
                     $hasAttributeInput = $attributeInputMap[$contentObjectAttribute->attribute('id')];
                 }
             }
             if ($hasAttributeInput) {
                 $object = $relationItem['object'];
                 $attributes = $object->contentObjectAttributes();
                 foreach ($attributes as $attribute) {
                     $attributeBase = $base . '_ezorl_init_class_' . $object->attribute('contentclass_id') . '_attr_' . $attribute->attribute('contentclassattribute_id');
                     $oldAttributeID = $attribute->attribute('id');
                     $attribute->setAttribute('id', false);
                     if ($attribute->fetchInput($http, $attributeBase)) {
                         $attribute->setAttribute('id', $oldAttributeID);
                         $attribute->store();
                     }
                 }
             }
             $contentObjectAttribute->setContent($content);
             $contentObjectAttribute->store();
         } else {
             eZDebug::writeError("Unknown class ID {$classID}, cannot instantiate object", __METHOD__);
         }
     } else {
         if (eZDataType::fetchActionValue($action, 'edit_objects', $contentobjectID) or $action == 'edit_objects' or $action == 'remove_objects') {
             $base = $parameters['base_name'];
             $selectionBase = $base . '_selection';
             $selections = array();
             $http = eZHTTPTool::instance();
             if ($http->hasPostVariable($selectionBase)) {
                 $selectionMap = $http->postVariable($selectionBase);
                 $selections = $selectionMap[$contentObjectAttribute->attribute('id')];
             }
             if ($contentobjectID !== false) {
                 $selections[] = $contentobjectID;
             }
             if ($action == 'edit_objects' or eZDataType::fetchActionValue($action, 'edit_objects', $contentobjectID)) {
                 $content = $contentObjectAttribute->content();
                 foreach ($content['relation_list'] as $key => $relationItem) {
                     if (!$relationItem['is_modified'] and in_array($relationItem['contentobject_id'], $selections)) {
                         $object = eZContentObject::fetch($relationItem['contentobject_id']);
                         if ($object->attribute('can_edit')) {
                             $content['relation_list'][$key]['is_modified'] = true;
                             $translationSourceBase = $base . '_translation_source_' . $contentObjectAttribute->attribute('id') . '_' . $relationItem['contentobject_id'];
                             $languageFrom = false;
                             if ($http->hasPostVariable($translationSourceBase) && $http->postVariable($translationSourceBase) !== '') {
                                 $languageFrom = $http->postVariable($translationSourceBase);
                             }
                             $version = $object->createNewVersionIn($contentObjectAttribute->attribute('language_code'), $languageFrom);
                             $content['relation_list'][$key]['contentobject_version'] = $version->attribute('version');
                         }
                     }
                 }
                 $contentObjectAttribute->setContent($content);
                 $contentObjectAttribute->store();
             } else {
                 if ($action == 'remove_objects') {
                     $content = $contentObjectAttribute->content();
                     $relationList = $content['relation_list'];
                     $newRelationList = array();
                     foreach ($relationList as $relationItem) {
                         if (in_array($relationItem['contentobject_id'], $selections)) {
                             $this->removeRelationObject($contentObjectAttribute, $relationItem);
                         } else {
                             $newRelationList[] = $relationItem;
                         }
                     }
                     $content['relation_list'] = $newRelationList;
                     $contentObjectAttribute->setContent($content);
                     $contentObjectAttribute->store();
                 }
             }
         } else {
             if ($action == 'browse_objects') {
                 $module = $parameters['module'];
                 $redirectionURI = $parameters['current-redirection-uri'];
                 $ini = eZINI::instance('content.ini');
                 $browseType = 'AddRelatedObjectListToDataType';
                 $browseTypeINIVariable = $ini->variable('ObjectRelationDataTypeSettings', 'ClassAttributeStartNode');
                 foreach ($browseTypeINIVariable as $value) {
                     list($classAttributeID, $type) = explode(';', $value);
                     if (is_numeric($classAttributeID) and $classAttributeID == $contentObjectAttribute->attribute('contentclassattribute_id') and strlen($type) > 0) {
                         $browseType = $type;
                         break;
                     }
                 }
                 // Fetch the list of "allowed" classes .
                 // A user can select objects of only those allowed classes when browsing.
                 $classAttribute = $contentObjectAttribute->attribute('contentclass_attribute');
                 $classContent = $classAttribute->content();
                 if (isset($classContent['class_constraint_list'])) {
                     $classConstraintList = $classContent['class_constraint_list'];
                 } else {
                     $classConstraintList = array();
                 }
                 $browseParameters = array('action_name' => 'AddRelatedObject_' . $contentObjectAttribute->attribute('id'), 'type' => $browseType, 'browse_custom_action' => array('name' => 'CustomActionButton[' . $contentObjectAttribute->attribute('id') . '_set_object_relation_list]', 'value' => $contentObjectAttribute->attribute('id')), 'persistent_data' => array('HasObjectInput' => 0), 'from_page' => $redirectionURI);
                 $base = $parameters['base_name'];
                 $nodePlacementName = $base . '_browse_for_object_start_node';
                 if ($http->hasPostVariable($nodePlacementName)) {
                     $nodePlacement = $http->postVariable($nodePlacementName);
                     if (isset($nodePlacement[$contentObjectAttribute->attribute('id')])) {
                         $browseParameters['start_node'] = eZContentBrowse::nodeAliasID($nodePlacement[$contentObjectAttribute->attribute('id')]);
                     }
                 }
                 if (count($classConstraintList) > 0) {
                     $browseParameters['class_array'] = $classConstraintList;
                 }
                 eZContentBrowse::browse($browseParameters, $module);
             } else {
                 if ($action == 'set_object_relation_list') {
                     if (!$http->hasPostVariable('BrowseCancelButton')) {
                         $selectedObjectIDArray = $http->postVariable("SelectedObjectIDArray");
                         $content = $contentObjectAttribute->content();
                         $priority = 0;
                         for ($i = 0; $i < count($content['relation_list']); ++$i) {
                             if ($content['relation_list'][$i]['priority'] > $priority) {
                                 $priority = $content['relation_list'][$i]['priority'];
                             }
                         }
                         if ($selectedObjectIDArray !== null) {
                             foreach ($selectedObjectIDArray as $objectID) {
                                 // Check if the given object ID has a numeric value, if not go to the next object.
                                 if (!is_numeric($objectID)) {
                                     eZDebug::writeError("Related object ID (objectID): '{$objectID}', is not a numeric value.", __METHOD__);
                                     continue;
                                 }
                                 /* Here we check if current object is already in the related objects list.
                                  * If so, we don't add it again.
                                  * FIXME: Stupid linear search. Maybe there's some better way?
                                  */
                                 $found = false;
                                 foreach ($content['relation_list'] as $i) {
                                     if ($i['contentobject_id'] == $objectID) {
                                         $found = true;
                                         break;
                                     }
                                 }
                                 if ($found) {
                                     continue;
                                 }
                                 ++$priority;
                                 $content['relation_list'][] = $this->appendObject($objectID, $priority, $contentObjectAttribute);
                                 $contentObjectAttribute->setContent($content);
                                 $contentObjectAttribute->store();
                             }
                         }
                     }
                 } else {
                     eZDebug::writeError("Unknown custom HTTP action: " . $action, 'eZObjectRelationListType');
                 }
             }
         }
     }
 }