Index: branches/5.2.x/core/kernel/db/dbitem.php =================================================================== diff -u -N -r15252 -r15446 --- branches/5.2.x/core/kernel/db/dbitem.php (.../dbitem.php) (revision 15252) +++ branches/5.2.x/core/kernel/db/dbitem.php (.../dbitem.php) (revision 15446) @@ -1,6 +1,6 @@ _getUploaderFields(); + + foreach ($uploader_fields as $field) { + $formatter = $this->Application->recallObject($this->GetFieldOption($field, 'formatter')); + /* @var $formatter kUploadFormatter */ + + $this->SetDBField($field, $formatter->processFlashUpload($this, $field, $id)); + } + + if ( $this->GetChangedFields() ) { + $this->Update(); + } + } + + /** + * Removes any info about queued uploaded files + * + * @param int $id + * @return void + * @access public + */ + public function resetUploads($id = NULL) + { + $uploader_fields = $this->_getUploaderFields(); + + foreach ($uploader_fields as $field) { + $this->Application->RemoveVar($this->getFileInfoVariableName($field, $id)); + } + } + + /** + * Returns uploader fields + * + * @return Array + * @access protected + */ + protected function _getUploaderFields() + { + $ret = Array (); + + foreach ($this->Fields as $field => $options) { + if ( !isset($options['formatter']) ) { + continue; + } + + $formatter = $this->Application->recallObject($options['formatter']); + /* @var $formatter kUploadFormatter */ + + if ( $formatter instanceof kUploadFormatter ) { + $ret[] = $field; + } + } + + return $ret; + } + + /** + * Returns variable name, used to store pending file actions + * + * @return string + * @access public + */ + public function getPendingActionVariableName() + { + $window_id = $this->Application->GetTopmostWid($this->Prefix); + + return $this->Prefix . '_file_pending_actions' . $window_id; + } + + /** + * Returns variable name, which stores file information for object/field/window combination + * + * @param string $field_name + * @param int $id + * @return string + * @access public + */ + public function getFileInfoVariableName($field_name, $id = NULL) + { + if ( !isset($id) ) { + $id = $this->GetID(); + } + + $window_id = $this->Application->GetTopmostWid($this->Prefix); + + return $this->Prefix . '[' . $id . '][' . $field_name . ']_file_info' . $window_id; + } + + /** * Allows to skip certain fields from getting into sql queries * * @param string $field_name