Index: trunk/core/units/general/cat_event_handler.php =================================================================== diff -u -N -r3852 -r4029 --- trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 3852) +++ trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 4029) @@ -112,42 +112,36 @@ $object =& $event->getObject(); $this->RemoveRequiredFields($object); $event->CallSubEvent('OnPreSave'); + if ($event->status == erSUCCESS) { -// $url = $this->Application->HREF($t, '', Array('pass'=>'all', $event->getPrefixSpecial(true).'_id' => $object->GetId())); -// $field = $this->Application->GetVar('translator_field'); - $cf_id = $this->Application->GetVar('translator_cf_id'); - if($cf_id) - { - $cv =& $this->Application->recallObject('cv.-item', null, Array('skip_autoload' => true) ); - $load_params = Array('CustomFieldId' => $cf_id, 'ResourceId'=> $object->GetDBField('ResourceId') ); - if( !$cv->Load($load_params) ) - { - $cv->SetFieldsFromHash($load_params); - $cv->Create(); + + $resource_id = $this->Application->GetVar('translator_resource_id'); + if ($resource_id) { + $t_prefixes = explode(',', $this->Application->GetVar('translator_prefixes')); + + $cdata =& $this->Application->recallObject($t_prefixes[1], null, Array('skip_autoload' => true)); + $cdata->Load($resource_id, 'ResourceId'); + if (!$cdata->isLoaded()) { + $cdata->SetDBField('ResourceId', $resource_id); + $cdata->Create(); } - $this->Application->SetVar('cv_id', $cv->getID() ); + $this->Application->SetVar($cdata->getPrefixSpecial().'_id', $cdata->GetID()); } $event->redirect = $this->Application->GetVar('translator_t'); $event->redirect_params = Array('pass'=>'all,trans,'.$this->Application->GetVar('translator_prefixes'), - $event->getPrefixSpecial(true).'_id' => $object->GetId(), - 'trans_event'=>'OnLoad', - 'trans_prefix'=> $this->Application->GetVar('translator_prefixes'), - 'trans_field'=>$this->Application->GetVar('translator_field'), - 'trans_multi_line'=>$this->Application->GetVar('translator_multi_line'), + $event->getPrefixSpecial(true).'_id' => $object->GetID(), + 'trans_event' => 'OnLoad', + 'trans_prefix' => $this->Application->GetVar('translator_prefixes'), + 'trans_field' => $this->Application->GetVar('translator_field'), + 'trans_multi_line' => $this->Application->GetVar('translator_multi_line'), ); // 1. SAVE LAST TEMPLATE TO SESSION $last_template = $this->Application->RecallVar('last_template'); preg_match('/index4\.php\|'.$this->Application->GetSID().'-(.*):/U', $last_template, $rets); -// $this->Application->StoreVar('return_template', $rets[1]); $this->Application->StoreVar('return_template', $this->Application->GetVar('t')); - - //$after_script = "openTranslator('".$event->getPrefixSpecial()."', '".$field."', '".$url."', '".$wnd_name."')"; } - -// $this->Application->SetVar('after_script', $after_script); -// $event->redirect = false; } /**