Author: jablko
Date: Mon Oct 25 10:32:29 2010
New Revision: 8470
Log:
Use taxonomy field value for broad and related terms autocomplete
Modified:
trunk/apps/qubit/modules/term/actions/editAction.class.php
trunk/apps/qubit/modules/term/templates/editSuccess.php
Modified: trunk/apps/qubit/modules/term/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/term/actions/editAction.class.php Mon Oct 25
10:20:09 2010 (r8469)
+++ trunk/apps/qubit/modules/term/actions/editAction.class.php Mon Oct 25
10:32:29 2010 (r8470)
@@ -22,7 +22,7 @@
// Arrays not allowed in class constants
public static
$NAMES = array(
- 'altLabels',
+ 'useFor',
'code',
'displayNote',
'name',
@@ -82,7 +82,7 @@
{
switch ($name)
{
- case 'altLabels':
+ case 'useFor':
$criteria = new Criteria;
$criteria->add(QubitOtherName::OBJECT_ID, $this->resource->id);
$criteria->add(QubitOtherName::TYPE_ID,
QubitTerm::ALTERNATIVE_LABEL_ID);
@@ -93,9 +93,9 @@
$defaults[$value[] = $item->id] = $item;
}
- $this->form->setDefault('altLabels', $value);
- $this->form->setValidator('altLabels', new sfValidatorPass);
- $this->form->setWidget('altLabels', new
QubitWidgetFormInputMany(array('defaults' => $defaults)));
+ $this->form->setDefault('useFor', $value);
+ $this->form->setValidator('useFor', new sfValidatorPass);
+ $this->form->setWidget('useFor', new
QubitWidgetFormInputMany(array('defaults' => $defaults)));
break;
@@ -224,10 +224,10 @@
{
switch ($field->getName())
{
- case 'altLabels':
- $defaults = $this->form->getWidget('altLabels')->getOption('defaults');
+ case 'useFor':
+ $defaults = $this->form->getWidget('useFor')->getOption('defaults');
- foreach ($this->form->getValue('altLabels') as $key => $newName)
+ foreach ($this->form->getValue('useFor') as $key => $newName)
{
if ('new' == substr($key, 0, 3) && 0 < strlen(trim($newName)))
{
Modified: trunk/apps/qubit/modules/term/templates/editSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/term/templates/editSuccess.php Mon Oct 25
10:20:09 2010 (r8469)
+++ trunk/apps/qubit/modules/term/templates/editSuccess.php Mon Oct 25
10:32:29 2010 (r8470)
@@ -31,9 +31,7 @@
<?php echo render_field($form->name, $resource) ?>
<?php endif; ?>
- <?php echo $form->altLabels
- ->label(__('Use for'))
- ->renderRow() ?>
+ <?php echo $form->useFor->renderRow() ?>
<?php echo render_field($form->code, $resource) ?>
@@ -53,14 +51,14 @@
<legend><?php echo __('Relationships') ?></legend>
- <?php if (isset($sf_request->getAttribute('sf_route')->resource) ||
isset($resource->taxonomy)): ?>
+ <?php if (null !== $form->taxonomy->getValue()): ?>
<div class="form-item">
<?php echo $form->parent
->label(__('Broad term'))
->renderLabel() ?>
<?php echo $form->parent->render(array('class' =>
'form-autocomplete')) ?>
- <input class="list" type="hidden" value="<?php echo
url_for(array('module' => 'term', 'action' => 'autocomplete', 'taxonomyId' =>
$resource->taxonomyId)) ?>"/>
+ <input class="list" type="hidden" value="<?php echo
url_for(array('module' => 'term', 'action' => 'autocomplete', 'taxonomy' =>
$form->taxonomy->getValue())) ?>"/>
</div>
<div class="form-item">
@@ -68,7 +66,7 @@
->label(__('Related term(s)'))
->renderLabel() ?>
<?php echo $form->relatedTerms->render(array('class' =>
'form-autocomplete')) ?>
- <input class="list" type="hidden" value="<?php echo
url_for(array('module' => 'term', 'action' => 'autocomplete', 'taxonomyId' =>
$resource->taxonomyId)) ?>"/>
+ <input class="list" type="hidden" value="<?php echo
url_for(array('module' => 'term', 'action' => 'autocomplete', 'taxonomy' =>
$form->taxonomy->getValue())) ?>"/>
</div>
<?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.com/group/qubit-commits?hl=en.