- First implementation of documents

- small cleanup to remove a global Config variable (and removed some deprecated utils:: functions)
- removed the 'DocumentVersion' object since previous versions are now tracked as normal change objects.

SVN:trunk[220]
This commit is contained in:
Denis Flaven
2009-12-31 09:08:09 +00:00
parent 9247b326c8
commit 966d4820ca
16 changed files with 403 additions and 132 deletions

View File

@@ -8,8 +8,12 @@ class WizardHelper
public function __construct()
{
}
public function GetTargetObject()
/**
* Constructs the PHP target object from the parameters sent to the web page by the wizard
* @param boolean $bReadUploadedFiles True to also ready any uploaded file (for blob/document fields)
* @return object
*/
public function GetTargetObject($bReadUploadedFiles = false)
{
$oObj = MetaModel::NewObject($this->m_aData['m_sClass']);
foreach($this->m_aData['m_aCurrentValues'] as $iIndex => $value)
@@ -60,6 +64,20 @@ class WizardHelper
$oSet = DBObjectSet::FromArray($sLinkedClass, $aLinkedObjectsArray);
$oObj->Set($sAttCode, $oSet);
}
else if ( $oAttDef->GetEditClass() == 'Document' )
{
if ($bReadUploadedFiles)
{
$oDocument = utils::ReadPostedDocument('file_'.$sAttCode);
$oObj->Set($sAttCode, $oDocument);
}
else
{
// Create a new empty document, just for displaying the file name
$oDocument = new ormDocument(null, '', $value);
$oObj->Set($sAttCode, $oDocument);
}
}
else if (($oAttDef->IsExternalKey()) && (!empty($value)) )
{
// For external keys: load the target object so that external fields