Author: jablko
Date: Tue Oct 19 16:27:28 2010
New Revision: 8314
Log:
Use ->setNameFormat()
Modified:
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/actions/eventComponent.class.php
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/_event.php
Modified:
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/actions/eventComponent.class.php
==============================================================================
---
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/actions/eventComponent.class.php
Tue Oct 19 16:17:11 2010 (r8313)
+++
trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/actions/eventComponent.class.php
Tue Oct 19 16:27:28 2010 (r8314)
@@ -22,30 +22,30 @@
// Arrays not allowed in class constants
public static
$NAMES = array(
- 'editEvents[new][typeId]',
- 'editEvents[new][startDate]',
- 'editEvents[new][endDate]',
- 'editEvents[new][dateDisplay]');
+ 'typeId',
+ 'startDate',
+ 'endDate',
+ 'dateDisplay');
protected function addField($name)
{
switch ($name)
{
- case 'editEvents[new][typeId]':
+ case 'typeId':
foreach (sfIsadPlugin::eventTypes() as $item)
{
$choices[$item->id] = $item->__toString();
}
- $this->form->setValidator('editEvents[new][typeId]', new
sfValidatorString);
- $this->form->setWidget('editEvents[new][typeId]', new
sfWidgetFormSelect(array('choices' => $choices)));
+ $this->form->setValidator('typeId', new sfValidatorString);
+ $this->form->setWidget('typeId', new
sfWidgetFormSelect(array('choices' => $choices)));
break;
- case 'editEvents[new][startDate]':
- case 'editEvents[new][endDate]':
- case 'editEvents[new][dateDisplay]':
+ case 'startDate':
+ case 'endDate':
+ case 'dateDisplay':
$this->form->setValidator($name, new sfValidatorString);
$this->form->setWidget($name, new sfWidgetFormInput);
@@ -57,6 +57,13 @@
}
}
+ public function execute($request)
+ {
+ parent::execute($request);
+
+ $this->form->getWidgetSchema()->setNameFormat('editEvents[new][%s]');
+ }
+
/**
* ISAD form only allows entering data for creation dates and creator names,
* as two separate events.
Modified: trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/_event.php
==============================================================================
--- trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/_event.php
Tue Oct 19 16:17:11 2010 (r8313)
+++ trunk/plugins/sfIsadPlugin/modules/sfIsadPlugin/templates/_event.php
Tue Oct 19 16:27:28 2010 (r8314)
@@ -23,30 +23,30 @@
<tr class="related_obj_<?php echo $eventDate->id ?>">
<td>
<div class="animateNicely">
- <input type="hidden" name="updateEvents[<?php echo $i ?>][id]"
value="<?php echo $eventDate->id ?>" />
+ <input type="hidden" name="editEvents[<?php echo $i ?>][id]"
value="<?php echo $eventDate->id ?>" />
<?php if (in_array($eventDate->typeId,
sfIsadPlugin::eventTypes())): ?>
- <select name="updateEvents[<?php echo $i ?>][typeId]">
+ <select name="editEvents[<?php echo $i ?>][typeId]">
<?php foreach (sfIsadPlugin::eventTypes() as $item): ?>
<option value="<?php echo $item->id ?>"<?php if
($eventDate->typeId == $item->id): ?> selected="selected"<?php endif; ?>><?php
echo $item->__toString() ?></option>
<?php endforeach; ?>
</select>
<?php else: ?>
- <select name="updateEvents[<?php echo $i ?>][typeId]"
readonly="readonly">
+ <select name="editEvents[<?php echo $i ?>][typeId]"
readonly="readonly">
<option value="<?php echo $eventDate->type->id ?>"
selected="selected"><?php echo $eventDate->type->__toString() ?></option>
</select>
<?php endif; ?>
</div>
</td><td>
<div class="animateNicely">
- <input name="updateEvents[<?php echo $i ?>][startDate]'"
value="<?php echo Qubit::renderDate($eventDate->startDate) ?>"/>
+ <input name="editEvents[<?php echo $i ?>][startDate]'"
value="<?php echo Qubit::renderDate($eventDate->startDate) ?>"/>
</div>
</td><td>
<div class="animateNicely">
- <input name="updateEvents[<?php echo $i ?>][endDate]'"
value="<?php echo Qubit::renderDate($eventDate->endDate) ?>"/>
+ <input name="editEvents[<?php echo $i ?>][endDate]'"
value="<?php echo Qubit::renderDate($eventDate->endDate) ?>"/>
</div>
</td><td>
<div class="animateNicely">
- <input name="updateEvents[<?php echo $i ?>][dateDisplay]'"
value="<?php echo
esc_entities($eventDate->getDateDisplay(array('cultureFallback' => true))) ?>"/>
+ <input name="editEvents[<?php echo $i ?>][dateDisplay]'"
value="<?php echo
esc_entities($eventDate->getDateDisplay(array('cultureFallback' => true))) ?>"/>
</div>
</td><td style="text-align: right">
<div class="animateNicely">
@@ -59,14 +59,14 @@
<tr>
<td>
<div class="animateNicely">
- <?php echo $form['updateEvents[new][typeId]'] ?>
+ <?php echo $form->typeId ?>
</div>
</td><td>
- <?php echo $form['updateEvents[new][startDate]'] ?>
+ <?php echo $form->startDate ?>
</td><td>
- <?php echo $form['updateEvents[new][endDate]'] ?>
+ <?php echo $form->endDate ?>
</td><td>
- <?php echo $form['updateEvents[new][dateDisplay]'] ?>
+ <?php echo $form->dateDisplay ?>
</td><td>
</td>
--
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.com/group/qubit-commits?hl=en.