Author: david
Date: Thu Aug 23 16:56:03 2012
New Revision: 12195
Log:
Update move function to work with parent slugs. Fixes issue 2358.
Modified:
trunk/apps/qubit/modules/default/actions/moveAction.class.php
trunk/apps/qubit/modules/default/templates/moveSuccess.php
trunk/lib/QubitSearchInformationObject.class.php
Modified: trunk/apps/qubit/modules/default/actions/moveAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/default/actions/moveAction.class.php Thu Aug
23 16:44:41 2012 (r12194)
+++ trunk/apps/qubit/modules/default/actions/moveAction.class.php Thu Aug
23 16:56:03 2012 (r12195)
@@ -50,11 +50,11 @@
// Root is default parent
if ($this->resource instanceof QubitInformationObject)
{
- $this->form->bind($request->getGetParameters() + array('parent' =>
$this->context->routing->generate(null,
array(QubitInformationObject::getById(QubitInformationObject::ROOT_ID),
'module' => 'informationobject'))));
+ $this->form->bind($request->getGetParameters() + array('parent' =>
QubitInformationObject::getById(QubitInformationObject::ROOT_ID)->slug,
'module' => 'informationobject'));
}
else if ($this->resource instanceof QubitTerm)
{
- $this->form->bind($request->getGetParameters() + array('parent' =>
$this->context->routing->generate(null,
array(QubitTerm::getById(QubitTerm::ROOT_ID), 'module' => 'term'))));
+ $this->form->bind($request->getGetParameters() + array('parent' =>
QubitTerm::getById(QubitTerm::ROOT_ID)->slug, 'module' => 'term'));
}
if ($request->isMethod('post'))
@@ -63,16 +63,16 @@
if ($this->form->isValid())
{
- $params =
$this->context->routing->parse(Qubit::pathInfo($this->form->parent->getValue()));
+ $parent = QubitObject::getBySlug($this->form->parent->getValue());
// In term treeview, root node links (href) to taxonomy, but it
represents the term root object
- if ($this->resource instanceOf QubitTerm &&
QubitObject::getById($params['_sf_route']->resource->id) instanceof
QubitTaxonomy)
+ if ($this->resource instanceOf QubitTerm && $parent instanceof
QubitTaxonomy)
{
$this->resource->parentId = QubitTerm::ROOT_ID;
}
else
{
- $this->resource->parentId = $params['_sf_route']->resource->id;
+ $this->resource->parentId = $parent->id;
}
$this->resource->save();
@@ -95,9 +95,7 @@
}
}
- $params =
$this->context->routing->parse(Qubit::pathInfo($this->form->parent->getValue()));
- $this->parent = QubitObject::getById($params['_sf_route']->resource->id);
-
+ $this->parent = QubitObject::getBySlug($this->form->parent->getValue());
$query = QubitSearch::getInstance()->addTerm($this->parent->slug,
'parent');
if (isset($request->query))
Modified: trunk/apps/qubit/modules/default/templates/moveSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/default/templates/moveSuccess.php Thu Aug 23
16:44:41 2012 (r12194)
+++ trunk/apps/qubit/modules/default/templates/moveSuccess.php Thu Aug 23
16:56:03 2012 (r12195)
@@ -16,7 +16,7 @@
<?php foreach ($parent->ancestors as $item): ?>
<?php if (isset($item->parent)): ?>
- <li><?php echo link_to(render_title($item), array($resource,
'module' => 'default', 'action' => 'move', 'parent' => url_for(array($item,
'module' => 'informationobject')))) ?></li>
+ <li><?php echo link_to(render_title($item), array($resource,
'module' => 'default', 'action' => 'move', 'parent' => $item->parent->slug))
?></li>
<?php endif; ?>
<?php endforeach; ?>
@@ -40,7 +40,7 @@
<?php foreach ($results as $item): ?>
<tr class="<?php echo 0 == @++$row % 2 ? 'even' : 'odd' ?>">
<td>
- <?php echo link_to_if($resource->lft > $item->lft || $resource->rgt
< $item->rgt, render_title($item), array($resource, 'module' => 'default',
'action' => 'move', 'parent' => url_for(array($item, 'module' =>
'informationobject')))) ?>
+ <?php echo link_to_if($resource->lft > $item->lft || $resource->rgt
< $item->rgt, render_title($item), array($resource, 'module' => 'default',
'action' => 'move', 'parent' => $item->slug)) ?>
</td>
</tr>
<?php endforeach; ?>
Modified: trunk/lib/QubitSearchInformationObject.class.php
==============================================================================
--- trunk/lib/QubitSearchInformationObject.class.php Thu Aug 23 16:44:41
2012 (r12194)
+++ trunk/lib/QubitSearchInformationObject.class.php Thu Aug 23 16:56:03
2012 (r12195)
@@ -359,7 +359,8 @@
break;
case 'parent':
- $field = Zend_Search_Lucene_Field::Unstored($camelName,
$this->ancestors[count($this->ancestors)-1]->slug);
+ // Use "Keyword" so value is no broken on hyphens by tokenizer
+ $field = Zend_Search_Lucene_Field::Keyword($camelName,
$this->ancestors[count($this->ancestors)-1]->slug);
break;
--
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.