Author: jablko
Date: Thu Sep 24 14:56:00 2009
New Revision: 3513
Log:
Use symfony form for level of description, fixes issue 969
Modified:
trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
trunk/apps/qubit/modules/informationobject/actions/editIsadAction.class.php
trunk/apps/qubit/modules/informationobject/actions/editRadAction.class.php
trunk/apps/qubit/modules/informationobject/templates/editDcSuccess.php
trunk/apps/qubit/modules/informationobject/templates/editIsadSuccess.php
trunk/apps/qubit/modules/informationobject/templates/editModsSuccess.php
trunk/apps/qubit/modules/informationobject/templates/editRadSuccess.php
Modified:
trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
Thu Sep 24 14:46:11 2009 (r3512)
+++ trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
Thu Sep 24 14:56:00 2009 (r3513)
@@ -70,6 +70,21 @@
break;
+ case 'levelOfDescription':
+ $this->form->setDefault('levelOfDescription',
$this->context->routing->generage(null, array('module' => 'term', 'action' =>
'show', 'id' => $this->informationObject->levelOfDescription->id)));
+ $this->form->setValidator('levelOfDescription', new sfValidatorString);
+
+ $choices = array();
+ $choices[null] = null;
+ foreach
(QubitTaxonomy::getTermsById(QubitTaxonomy::LEVEL_OF_DESCRIPTION_ID) as $term)
+ {
+ $choices[$this->context->routing->generate(null, array('module' =>
'term', 'action' => 'show', 'id' => $term->id))] = $term;
+ }
+
+ $this->form->setWidget('levelOfDescription', new
sfWidgetFormSelect(array('choices' => $choices)));
+
+ break;
+
case 'publicationStatus':
$this->form->setDefault('publicationStatus',
$this->context->routing->generate(null, array('module' => 'term', 'action' =>
'show', 'id' => $this->informationObject->getStatus($options = array('typeId'
=> QubitTerm::STATUS_TYPE_PUBLICATION_ID))->statusId)));
$this->form->setValidator('publicationStatus', new sfValidatorString);
@@ -156,6 +171,7 @@
case 'descriptionDetail':
case 'descriptionStatus':
+ case 'levelOfDescription':
case 'repository':
$params =
$this->context->routing->parse(preg_replace('/.*'.preg_quote($this->request->getPathInfoPrefix(),
'/').'/', null, $this->form->getValue($field->getName())));
$this->informationObject[$field->getName().'Id'] = $params['id'];
@@ -179,7 +195,6 @@
// set the informationObject's attributes
$this->updateCollectionType();
- $this->updateHierarchy();
// Save related objects (save on $this->informationObject->save())
$this->updateObjectTermRelations();
@@ -287,22 +302,6 @@
}
}
- public function updateHierarchy()
- {
- if ($this->hasRequestParameter('parent_id') || null ===
$this->informationObject->getParentId())
- {
- // Empty form values must be converted to null
- if (0 == $parentId = $this->getRequestParameter('parent_id'))
- {
- $this->informationObject->setRoot();
- }
- else
- {
- $this->informationObject->setParentId($parentId);
- }
- }
- }
-
public function updateCollectionType()
{
if ($this->hasRequestParameter('collection_type_id'))
Modified:
trunk/apps/qubit/modules/informationobject/actions/editIsadAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/editIsadAction.class.php
Thu Sep 24 14:46:11 2009 (r3512)
+++ trunk/apps/qubit/modules/informationobject/actions/editIsadAction.class.php
Thu Sep 24 14:56:00 2009 (r3513)
@@ -45,6 +45,7 @@
'institutionResponsibleIdentifier',
'languageOfDescription',
'language',
+ 'levelOfDescription',
'descriptionDetail',
'locationOfCopies',
'locationOfOriginals',
Modified:
trunk/apps/qubit/modules/informationobject/actions/editRadAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/editRadAction.class.php
Thu Sep 24 14:46:11 2009 (r3512)
+++ trunk/apps/qubit/modules/informationobject/actions/editRadAction.class.php
Thu Sep 24 14:56:00 2009 (r3513)
@@ -47,6 +47,7 @@
'issuingJurisdictionAndDenomination',
'language',
'languageOfDescription',
+ 'levelOfDescription',
'descriptionDetail',
'locationOfCopies',
'locationOfOriginals',
Modified: trunk/apps/qubit/modules/informationobject/templates/editDcSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/editDcSuccess.php
Thu Sep 24 14:46:11 2009 (r3512)
+++ trunk/apps/qubit/modules/informationobject/templates/editDcSuccess.php
Thu Sep 24 14:56:00 2009 (r3513)
@@ -65,11 +65,6 @@
<?php echo render_field($form->scopeAndContent->label(__('Description')),
$informationObject, array('class' => 'resizable')) ?>
- <div class="form-item">
- <label for="parent_id"><?php echo __('relation').' - '.__('parent
level') ?></label>
- <?php echo object_select_tree($informationObject, 'getParentId',
array('disabled' =>
$informationObject->getDescendants()->andSelf()->indexBy('id'), 'include_blank'
=> true, 'peer_method' => 'getDescendants', 'related_class' =>
QubitInformationObject::getOne(QubitInformationObject::addRootsCriteria(new
Criteria)))) ?>
- </div>
-
<?php echo render_field($form->relation, $relation, array('name' =>
'value')) ?>
<?php echo $form->language->renderRow(array('class' =>
'form-autocomplete')) ?>
Modified:
trunk/apps/qubit/modules/informationobject/templates/editIsadSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/editIsadSuccess.php
Thu Sep 24 14:46:11 2009 (r3512)
+++ trunk/apps/qubit/modules/informationobject/templates/editIsadSuccess.php
Thu Sep 24 14:56:00 2009 (r3513)
@@ -85,20 +85,7 @@
</table>
</div>
- <table style="border: 0; width: 98%; margin: 0; padding: 0;"><tr><td
style="width: 150px;">
- <div class="form-item">
- <label for="level_of_description_id"><?php echo __('level of
description') ?></label>
- <?php echo object_select_tag($informationObject,
'getLevelOfDescriptionId', array('related_class' => 'QubitTerm',
'include_blank' => true, 'peer_method' => 'getLevelsOfDescription')) ?>
- </div>
-
- </td><td style="padding-left: 10px;">
-
- <div class="form-item">
- <label for="parent_id"><?php echo __('parent level') ?></label>
- <?php echo object_select_tree($informationObject, 'getParentId',
array('disabled' =>
$informationObject->getDescendants()->andSelf()->indexBy('id'), 'include_blank'
=> true, 'peer_method' => 'getDescendants', 'related_class' =>
QubitInformationObject::getOne(QubitInformationObject::addRootsCriteria(new
Criteria)))) ?>
- </div>
-
- </td></tr></table>
+ <?php echo $form->levelOfDescription->help(__('Record the level of this
unit of description.'))->renderRow() ?>
<?php echo render_field($form->extentAndMedium->help(__('Record the extent
of the unit of description by giving the number of physical or logical units in
arabic numerals and the unit of measurement. Give the specific medium (media)
of the unit of description.')), $informationObject, array('class' =>
'resizable')) ?>
Modified:
trunk/apps/qubit/modules/informationobject/templates/editModsSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/editModsSuccess.php
Thu Sep 24 14:46:11 2009 (r3512)
+++ trunk/apps/qubit/modules/informationobject/templates/editModsSuccess.php
Thu Sep 24 14:56:00 2009 (r3513)
@@ -95,11 +95,6 @@
</table>
</div>
- <div class="form-item">
- <label for="parent_id"><?php echo __('related item').' - '.__('parent
level') ?></label>
- <?php echo object_select_tree($informationObject, 'getParentId',
array('disabled' =>
$informationObject->getDescendants()->andSelf()->indexBy('id'), 'include_blank'
=> true, 'peer_method' => 'getDescendants', 'related_class' =>
QubitInformationObject::getOne(QubitInformationObject::addRootsCriteria(new
Criteria)))) ?>
- </div>
-
<?php echo render_field($form->accessConditions, $informationObject,
array('class' => 'resizable')) ?>
<div class="admin-info">
Modified:
trunk/apps/qubit/modules/informationobject/templates/editRadSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/editRadSuccess.php
Thu Sep 24 14:46:11 2009 (r3512)
+++ trunk/apps/qubit/modules/informationobject/templates/editRadSuccess.php
Thu Sep 24 14:56:00 2009 (r3513)
@@ -55,25 +55,7 @@
</table>
</div>
- <table style="border: 0; width: 98%; margin: 0; padding: 0;">
- <tr>
- <td style="width: 150px;">
- <div class="form-item">
- <label for="level_of_description_id"><?php echo __('level of
description') ?></label>
- <?php echo object_select_tag($informationObject,
'getLevelOfDescriptionId', array('related_class' => 'QubitTerm',
'include_blank' => true, 'peer_method' => 'getLevelsOfDescription')) ?>
- </div>
- </td>
- <td style="padding-left: 10px;">
- <div class="form-item">
- <label for="parent_id"><?php echo __('parent level') ?></label>
- <?php echo object_select_tree(
- $informationObject, 'getParentId', array('disabled' =>
$informationObject->getDescendants()->andSelf()->indexBy('id'),
- 'include_blank' => true, 'peer_method' => 'getDescendants',
- 'related_class' =>
QubitInformationObject::getOne(QubitInformationObject::addRootsCriteria(new
Criteria)))) ?>
- </div>
- </td>
- </tr>
- </table>
+ <?php echo $form->levelOfDescription->renderRow() ?>
<div class="form-item">
<?php echo $form->repository->renderLabel() ?>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---