Author: jablko
Date: Wed Sep 2 17:24:41 2009
New Revision: 3152
Log:
Process form if method is POST
Modified:
trunk/apps/qubit/modules/digitalobject/actions/editAction.class.php
trunk/apps/qubit/modules/digitalobject/templates/editSuccess.php
Modified: trunk/apps/qubit/modules/digitalobject/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/digitalobject/actions/editAction.class.php Wed Sep
2 17:05:54 2009 (r3151)
+++ trunk/apps/qubit/modules/digitalobject/actions/editAction.class.php Wed Sep
2 17:24:41 2009 (r3152)
@@ -57,6 +57,12 @@
$this->form = new sfForm;
+ $this->form->setValidator('file', new sfValidatorFile);
+ $this->form->setWidget('file', new sfWidgetFormInputFile);
+
+ $this->form->setValidator('informationObject', new sfValidatorString);
+ $this->form->setWidget('informationObject', new sfWidgetFormInputHidden);
+
// Get 'show as compound digital object' toggle value
$compoundDigitalObject =
QubitProperty::getOneByObjectIdAndName($this->informationObject->getId(),
'display_as_compound_object');
if (!is_null($compoundDigitalObject))
@@ -89,6 +95,25 @@
$representations[QubitTerm::THUMBNAIL_ID] =
$this->digitalObject->getChildByUsageId(QubitTerm::THUMBNAIL_ID);
$this->representations = $representations;
}
+
+ $this->form->bind($request->getGetParameters(), $request->getFiles());
+ if ($request->isMethod('post'))
+ {
+ $this->form->bind($request->getPostParameters(), $request->getFiles());
+
+ if ($this->form->isValid())
+ {
+ $this->digitalObject->assets[] = new
QubitAsset($this->form->getValue('file')->getOriginalName(),
file_get_contents($this->form->getValue('file')->getTempName()));
+
+ $this->informationObject->digitalObjects[] = $this->digitalObject;
+
+ $this->updateDigitalObjects();
+
+ $this->informationObject->save();
+
+ $this->redirect(array('module' => 'informationobject', 'action' =>
'show', 'id' => $this->informationObject->id));
+ }
+ }
}
/**
Modified: trunk/apps/qubit/modules/digitalobject/templates/editSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/digitalobject/templates/editSuccess.php Wed Sep
2 17:05:54 2009 (r3151)
+++ trunk/apps/qubit/modules/digitalobject/templates/editSuccess.php Wed Sep
2 17:24:41 2009 (r3152)
@@ -32,10 +32,9 @@
<?php echo $form->renderFormTag(url_for(array('module' => 'digitalobject',
'action' => 'create'))) ?>
- <div class="form-item">
- <label for="upload"><?php echo __('upload') ?></label>
- <?php include_component('digitalobject', 'upload',
array('informationObject'=>$informationObject)) ?>
- </div>
+ <?php echo $form->informationObject ?>
+
+ <?php echo $form->file->label(__('Select a %1% to upload', array('%1%' =>
sfConfig::get('app_ui_label_digitalobject'))))->renderRow() ?>
<?php endif; ?>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---