Index: trunk/core/kernel/db/db_tag_processor.php =================================================================== diff -u -r3163 -r3307 --- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 3163) +++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 3307) @@ -825,7 +825,35 @@ return $this->PrintPages($params); } + /** + * Returns field name (processed by kMultiLanguage formatter + * if required) and item's id from it's IDField or field required + * + * @param Array $params + * @return Array (id,field) + * @access private + */ + function prepareInputName($params) + { + $field = $params['field']; + $object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params); + + $formatter_class = getArrayValue($object->Fields, $field, 'formatter'); + if ($formatter_class == 'kMultiLanguage') + { + $formatter =& $this->Application->recallObject($formatter_class); + $field = $formatter->LangFieldName($field); + } + + $id_field = getArrayValue($params, 'IdField'); + $id = $id_field ? $object->GetDBField($id_field) : $object->GetID(); + + return Array($id, $field); + } + + + /** * Returns input field name to * be placed on form (for correct * event processing) @@ -836,30 +864,30 @@ */ function InputName($params) { - $prefix_special=$this->getPrefixSpecial(); - $object =& $this->Application->recallObject($prefix_special); + list($id, $field) = $this->prepareInputName($params); - if ( $formatter = getArrayValue($object->Fields, $params['field'], 'formatter') ) { - if ( $formatter == 'kMultiLanguage' ) { - $formatter =& $this->Application->recallObject($formatter); - $params['field'] = $formatter->LangFieldName($params['field']); - } - } + $ret = $this->getPrefixSpecial().'['.$id.']['.$field.']'; + if( getArrayValue($params, 'as_preg') ) $ret = preg_quote($ret, '/'); + return $ret; + } + + /** + * Allows to override various field options through hidden fields with specific names in submit. + * This tag generates this special names + * + * @param Array $params + * @return string + * @author Alex + */ + function FieldModifier($params) + { + list($id, $field) = $this->prepareInputName($params); - if ( $idfield = getArrayValue($params, 'IdField') ) { - $id = $object->GetDBField($idfield); - } - else { - $id = $object->GetID(); - } - - $ret = $prefix_special.'['.$id.']['.$params['field'].']'; + $ret = 'field_modifiers['.$this->getPrefixSpecial().']['.$field.']['.$params['type'].']'; if( getArrayValue($params, 'as_preg') ) $ret = preg_quote($ret, '/'); return $ret; } - - /** * Returns index where 1st changable sorting field begins * @@ -1399,6 +1427,7 @@ } return '../../'.$module_folder.'/admin_templates/'; } + } ?> \ No newline at end of file