Author: david
Date: Fri Oct 2 14:39:36 2009
New Revision: 3647
Log:
Fix auto-generation of digital object derivatives. Fixes issue #963.
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 Fri Oct
2 13:44:51 2009 (r3646)
+++ trunk/apps/qubit/modules/digitalobject/actions/editAction.class.php Fri Oct
2 14:39:36 2009 (r3647)
@@ -85,6 +85,10 @@
{
$this->form->setValidator('repFile_'.$usageId, new sfValidatorFile);
$this->form->setWidget('repFile_'.$usageId, new
sfWidgetFormInputFile);
+
+ // Add 'auto-generate' checkbox
+ $this->form->setValidator('generateDerivative_'.$usageId, new
sfValidatorPass);
+ $this->form->setWidget('generateDerivative_'.$usageId, new
sfWidgetFormInputCheckbox(array(), array('value' => 1)));
}
}
}
@@ -160,10 +164,6 @@
$this->redirect(array('module' => 'informationobject', 'action' =>
'show', 'id' => $this->informationObject->id));
}
}
- else
- {
- echo 'BOO-URNS!';
- }
}
}
@@ -219,18 +219,16 @@
$representation->save();
}
- // Generate new derivatives from existing MASTER
- if (null != ($createDeriviates =
$this->form->getValue('createDerivative')))
+ // Generate new reference
+ if (null !=
$this->form->getValue('generateDerivative_'.QubitTerm::REFERENCE_ID))
{
- switch ($createDerivative)
- {
- case QubitTerm::REFERENCE_ID:
- $digitalObject->createReferenceImage();
- break;
- case QubitTerm::THUMBNAIL_ID:
- $digitalObject->createThumbnail();
- break;
- }
+ $this->digitalObject->createReferenceImage();
+ }
+
+ // Generate new thumb
+ if (null !=
$this->form->getValue('generateDerivative_'.QubitTerm::THUMBNAIL_ID))
+ {
+ $this->digitalObject->createThumbnail();
}
$this->digitalObject->save();
Modified: trunk/apps/qubit/modules/digitalobject/templates/editSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/digitalobject/templates/editSuccess.php Fri Oct
2 13:44:51 2009 (r3646)
+++ trunk/apps/qubit/modules/digitalobject/templates/editSuccess.php Fri Oct
2 14:39:36 2009 (r3647)
@@ -57,11 +57,11 @@
<td>
<?php echo __('Select a %1% to upload',
array('%1%'=>sfConfig::get('app_ui_label_digitalobject'))) ?>
<span class="note"><?php echo __('max. size ~%1%', array('%1%' =>
hr_filesize($maxUploadSize))) ?></span>
- <?php echo $form['repFile_'.$usageId]->renderRow() ?>
+ <?php echo $form['repFile_'.$usageId]->render() ?><br />
<?php if ($digitalObject->canThumbnail()): ?>
<?php echo __('<i>or</i> Auto-generate a new representation from
master image'); ?>
- <?php //echo checkbox_tag('createDerivative', $usageId, false,
array('class'=>'checkbox')); ?>
+ <?php echo $form['generateDerivative_'.$usageId]->render() ?>
<?php endif; ?>
</td>
</tr>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---