Author: sevein
Date: Sun Oct 11 18:38:56 2009
New Revision: 3725
Log:
This is for issue 826, a new widget for child levels when editing info objects.
Modified:
trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
trunk/apps/qubit/modules/informationobject/templates/editIsadSuccess.php
Modified:
trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
Sun Oct 11 14:27:31 2009 (r3724)
+++ trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
Sun Oct 11 18:38:56 2009 (r3725)
@@ -361,10 +361,13 @@
// save informationObject after setting all of its attributes...
$this->informationObject->save();
+ $this->updateChildLevels();
+
// delete related objects marked for deletion
$this->deleteNotes();
$this->deleteEvents();
$this->deleteObjectTermRelations();
+ $this->deleteChildLevels();
}
public function execute($request)
@@ -439,6 +442,9 @@
$this->titleNotes = $this->informationObject->getNotesByType($options =
array ('noteTypeId' => QubitTerm::TITLE_NOTE_ID));
$this->publicationNotes =
$this->informationObject->getNotesByType($options = array ('noteTypeId' =>
QubitTerm::PUBLICATION_NOTE_ID));
+ // Get child levels
+ $this->childLevels = $this->informationObject->getChildren();
+
if ($request->isMethod('post'))
{
$this->form->bind($request->getPostParameters());
@@ -661,6 +667,66 @@
}
}
+ public function updateChildLevels()
+ {
+ if (is_array($updateChildLevels =
$this->request->getParameter('updateChildLevels')) && count($updateChildLevels))
+ {
+ foreach ($updateChildLevels as $childLevelFormData)
+ {
+ if (isset($childLevelFormData['id']))
+ {
+ if (null === $childLevel =
QubitInformationObject::getById($childLevelFormData['id']))
+ {
+ continue;
+ }
+ }
+ else
+ {
+ $childLevel = new QubitInformationObject;
+ $childLevel->setParentId($this->informationObject->id);
+ }
+
+ $childLevel->setIdentifier($childLevelFormData['identifier']);
+ $childLevel->setTitle($childLevelFormData['title']);
+
+ if (0 < $childLevelFormData['levelOfDescription'] && (null !==
QubitTerm::getById($childLevelFormData['levelOfDescription'])))
+ {
+
$childLevel->setLevelOfDescriptionId($childLevelFormData['levelOfDescription']);
+ }
+
+ if (0 < $childLevelFormData['levelOfDescription'] ||
+ 0 < strlen($childLevelFormData['identifier']) ||
+ 0 < strlen($childLevelFormData['title'])
+ )
+ {
+ $childLevel->save();
+ }
+ }
+ }
+ }
+
+ public function deleteChildLevels()
+ {
+ if (is_array($deleteChildLevels =
$this->request->getParameter('deleteChildLevels')) && count($deleteChildLevels))
+ {
+ foreach ($deleteChildLevels as $deleteId => $doDelete)
+ {
+ if ('delete' == $doDelete && !is_null($child =
QubitInformationObject::getById($deleteId)))
+ {
+ foreach ($child->descendants->andSelf()->orderBy('rgt') as
$descendant)
+ {
+ foreach ($descendant->digitalObjects as $digitalObject)
+ {
+ $digitalObject->delete();
+ }
+
+ $descendant->delete();
+ }
+ }
+ }
+ }
+ }
+
public function updateStatus()
{
if (!QubitAcl::check($this->informationObject, QubitAclAction::PUBLISH_ID))
Modified:
trunk/apps/qubit/modules/informationobject/templates/editIsadSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/editIsadSuccess.php
Sun Oct 11 14:27:31 2009 (r3724)
+++ trunk/apps/qubit/modules/informationobject/templates/editIsadSuccess.php
Sun Oct 11 18:38:56 2009 (r3725)
@@ -73,7 +73,6 @@
<tr>
<td><div class="animateNicely">
<?php echo select_tag('updateEvents[new][typeId]',
options_for_select($isadEventTypes, QubitTerm::CREATION_ID)) ?>
-
</div></td>
<td><?php echo input_tag('updateEvents[new][startDate]') ?></td>
<td><?php echo input_tag('updateEvents[new][endDate]') ?></td>
@@ -86,6 +85,55 @@
<?php echo $form->levelOfDescription->help(__('Record the level of this
unit of description.'))->renderRow() ?>
+ <div class="form-item">
+ <label for=""><?php echo __('child levels') ?></label>
+ <table class="inline">
+ <thead>
+ <tr>
+ <th style="width: 20%"><?php echo __('identifier') ?></th>
+ <th style="width: 20%"><?php echo __('level') ?></th>
+ <th style="width: 60%"><?php echo __('title') ?></th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php if (0 < count($childLevels)): ?>
+ <?php foreach ($childLevels as $i => $child): ?>
+ <tr class="<?php echo 'related_obj_'.$child->id ?>">
+ <td><div class="animateNicely">
+ <input type="hidden" name="updateChildLevels[<?php echo $i
?>][id]" value="<?php echo $child->id ?>" />
+ <?php echo input_tag('updateChildLevels['.$i.'][identifier]',
$child->identifier) ?>
+ </div></td>
+ <td><div class="animateNicely">
+ <?php echo object_select_tag($child, 'getLevelOfDescriptionId',
array(
+ 'name' => 'updateChildLevels['.$i.'][levelOfDescription]',
+ 'related_class' => 'QubitTerm',
+ 'peer_method' => 'getLevelsOfDescription')) ?>
+ </div></td>
+ <td><div class="animateNicely">
+ <?php echo input_tag('updateChildLevels['.$i.'][title]',
$child->getTitle(array('fallback' => true))) ?>
+ </div></td>
+ <td style="text-align: right;"><div class="animateNicely">
+ <input type="checkbox" name="deleteChildLevels[<?php echo
$child->id ?>]" value="delete" class="multiDelete" />
+ </div></td>
+ </tr>
+ <?php endforeach; ?>
+ <?php endif; ?>
+ <tr>
+ <td><?php echo input_tag('updateChildLevels[new][identifier]')
?></td>
+ <td><div class="animateNicely">
+ <?php echo object_select_tag(new QubitInformationObject,
'getLevelOfDescriptionId', array(
+ 'include_blank' => true,
+ 'name' => 'updateChildLevels[new][levelOfDescription]',
+ 'related_class' => 'QubitTerm',
+ 'peer_method' => 'getLevelsOfDescription')) ?>
+ </div></td>
+ <td><?php echo input_tag('updateChildLevels[new][title]') ?></td>
+ <td> </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
<?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')) ?>
</fieldset>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---