Author: sevein
Date: Thu Aug 9 15:27:56 2012
New Revision: 12064
Log:
Adapt the term treeview to the new treeview.js approach with scrolling support
Added:
trunk/apps/qubit/modules/term/templates/treeViewSuccess.php (contents,
props changed)
Modified:
trunk/apps/qubit/modules/term/actions/treeViewAction.class.php
trunk/apps/qubit/modules/term/actions/treeViewComponent.class.php
trunk/apps/qubit/modules/term/templates/_treeView.php
trunk/css/graphic.css
trunk/js/treeView.js
trunk/lib/model/QubitInformationObject.php
trunk/lib/model/QubitTerm.php
Modified: trunk/apps/qubit/modules/term/actions/treeViewAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/term/actions/treeViewAction.class.php Thu Aug
9 12:00:37 2012 (r12063)
+++ trunk/apps/qubit/modules/term/actions/treeViewAction.class.php Thu Aug
9 15:27:56 2012 (r12064)
@@ -21,10 +21,46 @@
{
public function execute($request)
{
- $this->response->setHttpHeader('Content-Type', 'application/json;
charset=utf-8');
-
$this->resource = $this->getRoute()->resource;
- return
$this->renderText(json_encode($this->resource->getChildYuiNodes($request)));
+ // Number of siblings that we are showing above and below the current node
+ $numberOfPreviousOrNextSiblings = 4;
+
+ switch ($request->show)
+ {
+ case 'prevSiblings':
+
+ $this->items = $this->resource->getTreeViewSiblings(array('limit' =>
$numberOfPreviousOrNextSiblings + 1, 'position' => 'previous'));
+
+ $this->hasPrevSiblings = count($this->items) >
$numberOfPreviousOrNextSiblings;
+ if ($this->hasPrevSiblings)
+ {
+ array_pop($this->items);
+ }
+
+ // Reverse array
+ $this->items = array_reverse($this->items);
+
+ break;
+
+ case 'nextSiblings':
+
+ $this->items = $this->resource->getTreeViewSiblings(array('limit' =>
$numberOfPreviousOrNextSiblings + 1, 'position' => 'next'));
+
+ $this->hasNextSiblings = count($this->items) >
$numberOfPreviousOrNextSiblings;
+ if ($this->hasNextSiblings)
+ {
+ array_pop($this->items);
+ }
+
+ break;
+
+ case 'item':
+ default:
+
+ $this->items = $this->resource->getChildren();
+
+ break;
+ }
}
}
Modified: trunk/apps/qubit/modules/term/actions/treeViewComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/term/actions/treeViewComponent.class.php Thu Aug
9 12:00:37 2012 (r12063)
+++ trunk/apps/qubit/modules/term/actions/treeViewComponent.class.php Thu Aug
9 15:27:56 2012 (r12064)
@@ -23,22 +23,28 @@
{
$this->resource = $request->getAttribute('sf_route')->resource;
- // Get tree (limit 10 siblings and children)
- $this->treeViewObjects = $this->resource->getFullYuiTree(10);
+ $this->ancestors = $this->resource->getAncestors()->orderBy('lft');
- // Check if tree view worth it
- if (1 > count($this->treeViewObjects))
+ // Number of siblings that we are showing above and below the current node
+ $numberOfPreviousOrNextSiblings = 4;
+
+ // Previous siblings
+ $this->prevSiblings = $this->resource->getTreeViewSiblings(array('limit'
=> $numberOfPreviousOrNextSiblings + 1, 'position' => 'previous'));
+ $this->hasPrevSiblings = count($this->prevSiblings) >
$numberOfPreviousOrNextSiblings;
+ if ($this->hasPrevSiblings)
{
- return sfView::NONE;
+ array_pop($this->prevSiblings);
}
- $this->treeViewExpands = array();
- foreach ($this->resource->ancestors->andSelf()->orderBy('lft') as $item)
+ // Reverse array
+ $this->prevSiblings = array_reverse($this->prevSiblings);
+
+ // Next siblings
+ $this->nextSiblings = $this->resource->getTreeViewSiblings(array('limit'
=> $numberOfPreviousOrNextSiblings + 1, 'position' => 'next'));
+ $this->hasNextSiblings = count($this->nextSiblings) >
$numberOfPreviousOrNextSiblings;
+ if ($this->hasNextSiblings)
{
- $this->treeViewExpands[$item->id] = $item->id;
+ array_pop($this->nextSiblings);
}
-
- // Is it draggable?
- $this->treeViewDraggable =
json_encode(SecurityPriviliges::editCredentials($this->context->user, 'term'));
}
}
Modified: trunk/apps/qubit/modules/term/templates/_treeView.php
==============================================================================
--- trunk/apps/qubit/modules/term/templates/_treeView.php Thu Aug 9
12:00:37 2012 (r12063)
+++ trunk/apps/qubit/modules/term/templates/_treeView.php Thu Aug 9
15:27:56 2012 (r12064)
@@ -1,18 +1,63 @@
-<?php use_helper('Javascript') ?>
+<div id="treeview" data-current-id="<?php echo $resource->id ?>">
-<div id="treeView"></div>
+ <ul class="unstyled">
-<?php
+ <li class="header">
+ <?php echo link_to(render_title($resource->taxonomy),
array($resource->taxonomy, 'module' => 'taxonomy')) ?>
+ </li>
-$treeViewObjects = json_encode($treeViewObjects);
-$treeViewExpands = json_encode($treeViewExpands);
-$treeViewI18nLoading = __('Loading...');
+ <?php // Ancestors ?>
+ <?php foreach ($ancestors as $item): ?>
+ <?php if (QubitTerm::ROOT_ID == $item->id) continue; ?>
+ <?php echo render_treeview_node(
+ $item,
+ array('ancestor' => true),
+ array('xhr-location' => url_for(array('module' => 'term', 'action' =>
'treeView', 'slug' => $item->slug)))); ?>
+ <?php endforeach; ?>
-echo javascript_tag(<<<content
-Qubit.treeView.objects = $treeViewObjects;
-Qubit.treeView.expands = $treeViewExpands;
-Qubit.treeView.draggable = $treeViewDraggable;
-Qubit.treeView.i18nLoading = '$treeViewI18nLoading';
+ <?php // More button ?>
+ <?php if ($hasPrevSiblings): ?>
+ <?php echo render_treeview_node(
+ null,
+ array('more' => true),
+ array('xhr-location' => url_for(array('module' => 'term', 'action' =>
'treeView', 'slug' => $prevSiblings[0]->slug)))); ?>
+ <?php endif; ?>
-content
-);
+ <?php // N prev items ?>
+ <?php if (isset($prevSiblings)): ?>
+ <?php foreach ($prevSiblings as $prev): ?>
+ <?php echo render_treeview_node(
+ $prev,
+ array('expand' => 1 < $prev->rgt - $prev->lft),
+ array('xhr-location' => url_for(array('module' => 'term', 'action'
=> 'treeView', 'slug' => $prev->slug)))); ?>
+ <?php endforeach; ?>
+ <?php endif; ?>
+
+ <?php // Current ?>
+ <?php echo render_treeview_node(
+ $resource,
+ array('expand' => $resource->hasChildren(), 'active' => true),
+ array('xhr-location' => url_for(array($resource, 'module' => 'term',
'action' => 'treeView')))); ?>
+
+ <?php // N next items ?>
+ <?php if (isset($nextSiblings)): ?>
+ <?php foreach ($nextSiblings as $next): ?>
+ <?php echo render_treeview_node(
+ $next,
+ array('expand' => 1 < $next->rgt - $next->lft),
+ array('xhr-location' => url_for(array('module' => 'term', 'action'
=> 'treeView', 'slug' => $next->slug)))); ?>
+ <?php endforeach; ?>
+ <?php endif; ?>
+
+ <?php // More button ?>
+ <?php $last = isset($next) ? $next : $resource ?>
+ <?php if ($hasNextSiblings): ?>
+ <?php echo render_treeview_node(
+ null,
+ array('more' => true),
+ array('xhr-location' => url_for(array('module' => 'term', 'action' =>
'treeView', 'slug' => $last->slug)))); ?>
+ <?php endif; ?>
+
+ </ul>
+
+</div>
Added: trunk/apps/qubit/modules/term/templates/treeViewSuccess.php
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/apps/qubit/modules/term/templates/treeViewSuccess.php Thu Aug 9
15:27:56 2012 (r12064)
@@ -0,0 +1,20 @@
+<?php if (isset($hasPrevSiblings) && $hasPrevSiblings): ?>
+ <?php echo render_treeview_node(
+ null,
+ array('more' => true),
+ array('xhr-location' => url_for(array($items[0], 'module' => 'term',
'action' => 'treeView')))); ?>
+<?php endif; ?>
+
+<?php foreach ($items as $item): ?>
+ <?php echo render_treeview_node(
+ $item,
+ array('expand' => 1 < $item->rgt - $item->lft, 'active' =>
$sf_request->resourceId == $item->id),
+ array('xhr-location' => url_for(array($item, 'module' => 'term', 'action'
=> 'treeView')))); ?>
+<?php endforeach; ?>
+
+<?php if (isset($hasNextSiblings) && $hasNextSiblings): ?>
+ <?php echo render_treeview_node(
+ null,
+ array('more' => true),
+ array('xhr-location' => url_for(array($item, 'module' => 'term', 'action'
=> 'treeView')))); ?>
+<?php endif; ?>
Modified: trunk/css/graphic.css
==============================================================================
--- trunk/css/graphic.css Thu Aug 9 12:00:37 2012 (r12063)
+++ trunk/css/graphic.css Thu Aug 9 15:27:56 2012 (r12064)
@@ -278,11 +278,18 @@
}
#treeview .ancestor,
-#treeview .back
+#treeview .back,
+#treeview .header
{
background-color: #f5f5f5;
}
+#treeview .header a
+{
+ color: Black;
+ font-weight: bold;
+}
+
#treeview .back
{
cursor: pointer;
Modified: trunk/js/treeView.js
==============================================================================
--- trunk/js/treeView.js Thu Aug 9 12:00:37 2012 (r12063)
+++ trunk/js/treeView.js Thu Aug 9 15:27:56 2012 (r12064)
@@ -79,14 +79,14 @@
this.setLoading(false);
// Regular nodes selector
- this.nodesSelector = 'li:not(.back, .ancestor, .more)';
+ this.nodesSelector = 'li:not(.back, .ancestor, .more, .header)';
// Store the current resource id to highlight it
// during the treeview browsing
this.resourceId = this.$element.data('current-id');
// Check if the treeview is sortable
- this.sortable = !!this.$element.data('sortable');
+ this.sortable = undefined !== this.$element.data('sortable') &&
!!this.$element.data('sortable');
this.init();
};
Modified: trunk/lib/model/QubitInformationObject.php
==============================================================================
--- trunk/lib/model/QubitInformationObject.php Thu Aug 9 12:00:37 2012
(r12063)
+++ trunk/lib/model/QubitInformationObject.php Thu Aug 9 15:27:56 2012
(r12064)
@@ -1652,7 +1652,7 @@
$sort = $options['sort'];
}
- // This is the array of objects that we are buldind
+ // This is the array of objects that we are bulding
$results = array();
// We are using $current to store the last sibling found in the last
@@ -1875,206 +1875,6 @@
return $criteria;
}
- public function getFullYuiTree($limit = 0)
- {
- $tree = self::getFullTree($this, $limit);
-
- return self::renderYuiNodes($tree, array('currentNode' => $this));
- }
-
- public function getChildYuiNodes($options = array())
- {
- $limit = isset($options['limit']) ? $options['limit'] : 0;
- $offset = isset($options['offset']) ? $options['offset'] : 0;
-
- $nodes = array();
-
- $criteria = new Criteria;
- $criteria->add(QubitInformationObject::PARENT_ID, $this->id);
- $criteria = self::addTreeViewSortCriteria($criteria);
-
- $countCriteria = clone $criteria;
- $totalChildren = intval(BasePeer::doCount($countCriteria)->fetchColumn(0));
-
- if (0 < $limit)
- {
- $criteria->setLimit($limit);
- }
-
- if (0 < $offset)
- {
- $criteria->setOffset($offset);
- }
-
- if (0 < count($children = QubitInformationObject::get($criteria)))
- {
- foreach ($children as $child)
- {
- $nodes[] = $child;
- }
- }
-
- $shownChildren = $offset + count($children);
- if ($totalChildren > $shownChildren)
- {
- $nodes[] = array('total' => $totalChildren, 'limit' => $limit,
'parentId' => $this->id);
- }
-
- return self::renderYuiNodes($nodes);
- }
-
- private static function getFullTree($currentNode, $limit)
- {
- $tree = array();
-
- // Get direct ancestors
- $ancestors = $currentNode->getAncestors()->orderBy('lft');
- foreach ($ancestors as $ancestor)
- {
- if (QubitInformationObject::ROOT_ID != $ancestor->id)
- {
- $tree[$ancestor->id] = $ancestor;
- }
- }
-
- // Get siblings (with limit) - but don't show sibling collection roots
- $totalSiblings = 0;
- if (QubitInformationObject::ROOT_ID != $currentNode->parentId)
- {
- $criteria = new Criteria;
- $criteria->add(QubitInformationObject::PARENT_ID,
$currentNode->parentId);
- $criteria = self::addTreeViewSortCriteria($criteria);
-
- if (0 < $limit)
- {
- $criteria->setLimit($limit);
- }
-
- foreach (QubitInformationObject::get($criteria) as $item)
- {
- // Keep track of position of $currentNode in array
- if ($item === $currentNode)
- {
- $curIndex = count($tree);
- }
-
- $tree[] = $item;
- }
-
- $totalSiblings =
intval(BasePeer::doCount($criteria->setLimit(0))->fetchColumn(0));
- }
-
- // Add current object to $tree if it wasn't added as a sibling
- if (!isset($curIndex))
- {
- if ($totalSiblings >= $limit)
- {
- // replace last sibling with current object
- array_splice($tree, -1, 1, array($currentNode));
- }
- else
- {
- $tree[] = $currentNode;
- }
-
- $curIndex = count($tree) - 1;
- }
-
- if ($totalSiblings > $limit)
- {
- $tree[] = array('total' => $totalSiblings, 'limit' => $limit, 'parentId'
=> $currentNode->parentId);
- }
-
- // Get children (with limit)
- $totalChildren = 0;
- $criteria = new Criteria;
- $criteria->add(QubitInformationObject::PARENT_ID, $currentNode->id);
- $criteria = self::addTreeViewSortCriteria($criteria);
-
- if (0 < $limit)
- {
- $criteria->setLimit($limit);
- }
-
- if (0 < count($children = QubitInformationObject::get($criteria)))
- {
- foreach ($children as $item)
- {
- $childs[] = $item;
- }
-
- $totalChildren =
intval(BasePeer::doCount($criteria->setLimit(0))->fetchColumn(0));
-
- if ($totalChildren > $limit)
- {
- $childs[] = array('total' => $totalChildren, 'limit' => $limit,
'parentId' => $currentNode->id);
- }
-
- // Insert children right AFTER current info object in array
- if ($curIndex == count($tree) - 1)
- {
- $tree = array_merge($tree, $childs);
- }
- else
- {
- array_splice($tree, $curIndex + 1, 0, $childs);
- }
- }
-
- return $tree;
- }
-
- public static function renderYuiNodes($tree, $options = array())
- {
- ProjectConfiguration::getActive()->loadHelpers(array('Qubit', 'Text',
'Escaping'));
-
- $yuiTree = array();
- foreach ($tree as $key => $item)
- {
- $node = array();
-
- if ($item instanceof QubitInformationObject)
- {
- $label = render_title(self::getStandardsBasedInstance($item));
-
- $node['label'] = truncate_text($label, 50);
-
- if (50 < strlen($label))
- {
- $node['title'] = esc_specialchars($label);
- }
-
- $node['href'] = sfContext::getInstance()->routing->generate(null,
array($item, 'module' => 'informationobject'));
- $node['id'] = $item->id;
- $node['parentId'] = $item->parentId;
- $node['isLeaf'] = (string) !$item->hasChildren();
- $node['moveUrl'] = sfContext::getInstance()->routing->generate(null,
array($item, 'module' => 'default', 'action' => 'move'));
- $node['expandUrl'] = sfContext::getInstance()->routing->generate(null,
array($item, 'module' => 'informationobject', 'action' => 'treeView'));
-
- if (isset($options['currentNode']) && $options['currentNode'] ===
$item)
- {
- $node['style'] = 'ygtvlabel currentTextNode';
- }
- }
-
- // "Show all" link
- else
- {
- $count = intval($item['total']) - intval($item['limit']);
-
- $node['label'] = sfContext::getInstance()->i18n->__('+%1% ...',
array('%1%' => $count));
- $node['parentId'] = $item['parentId'];
- $node['href'] = sfContext::getInstance()->routing->generate(null,
array(QubitInformationObject::getById($item['parentId']), 'module' =>
'informationobject', 'action' => 'browse'));
- $node['isLeaf'] = 'true';
- $node['style'] = 'seeAllNode';
- }
-
- $yuiTree[] = $node;
- }
-
- return $yuiTree;
- }
-
/**
* Return the correct class instance for the current standards-based template
* (e.g. 'sfRadPlugin', 'sfIsadPlugin')
Modified: trunk/lib/model/QubitTerm.php
==============================================================================
--- trunk/lib/model/QubitTerm.php Thu Aug 9 12:00:37 2012 (r12063)
+++ trunk/lib/model/QubitTerm.php Thu Aug 9 15:27:56 2012 (r12064)
@@ -786,245 +786,72 @@
return QubitTerm::get($criteria, $options);
}
- /*****************************************************
- TreeView
- *****************************************************/
-
- public function getFullYuiTree($limit = 0)
- {
- $tree = self::getFullTree($this, $limit);
-
- return self::renderYuiNodes($tree, array('currentNode' => $this));
- }
-
- public function getChildYuiNodes($options = array())
+ public function getTreeViewSiblings(array $options = array())
{
- $limit = isset($options['limit']) ? $options['limit'] : 0;
- $offset = isset($options['offset']) ? $options['offset'] : 0;
-
- $nodes = array();
-
- $criteria = new Criteria;
- $criteria->add(QubitTerm::PARENT_ID, $this->id);
-
- if (QubitTerm::ROOT_ID == $this->id)
- {
- $params =
sfContext::getInstance()->routing->parse(Qubit::pathInfo(sfContext::getInstance()->request->getReferer()));
-
- $refererTerm = $params['_sf_route']->resource;
-
- if (isset($refererTerm))
- {
- $criteria->add(QubitTerm::TAXONOMY_ID, $refererTerm->taxonomyId);
- }
- }
-
- $criteria = QubitCultureFallback::addFallbackCriteria($criteria,
'QubitTerm');
- $criteria->addAscendingOrderByColumn('name');
-
- $countCriteria = clone $criteria;
- $totalChildren = intval(BasePeer::doCount($countCriteria)->fetchColumn(0));
-
- if (0 < $limit)
- {
- $criteria->setLimit($limit);
- }
-
- if (0 < $offset)
- {
- $criteria->setOffset($offset);
- }
-
- if (0 < count($children = QubitTerm::get($criteria)))
+ // The max number of items that will be shown
+ // The final amount may be smaller if there are no result enough
+ $limit = 5;
+ if (isset($options['limit']))
{
- foreach ($children as $child)
- {
- $nodes[] = $child;
- }
+ $limit = $options['limit'];
}
- $shownChildren = $offset + count($children);
- if ($totalChildren > $shownChildren)
- {
- $nodes[] = array('total' => $totalChildren, 'limit' => $limit,
'parentId' => $this->id);
- }
-
- return self::renderYuiNodes($nodes);
- }
-
- private static function getFullTree($currentNode, $limit)
- {
- $tree = array();
-
- // Get direct ancestors
- $ancestors = $currentNode->getAncestors()->orderBy('lft');
- foreach ($ancestors as $ancestor)
+ // Show 'previous' or 'next' siblings
+ $position = 'next';
+ if (isset($options['position']))
{
- $tree[$ancestor->id] = $ancestor;
+ $position = $options['position'];
}
- // Get siblings (with limit) - but don't show sibling collection roots
- $totalSiblings = 0;
-
$criteria = new Criteria;
- $criteria->add(QubitTerm::PARENT_ID, $currentNode->parentId);
+ $criteria->add(QubitTerm::PARENT_ID, $this->parentId);
+ $criteria->add(QubitTerm::TAXONOMY_ID, $this->taxonomyId);
- if (QubitTerm::ROOT_ID == $currentNode->parentId)
+ switch ($position)
{
- $criteria->add(QubitTerm::TAXONOMY_ID, $currentNode->taxonomyId);
- }
-
- $criteria = QubitCultureFallback::addFallbackCriteria($criteria,
'QubitTerm');
- $criteria->addAscendingOrderByColumn('name');
+ case 'previous':
- if (0 < $limit)
- {
- $criteria->setLimit($limit);
- }
+ $criteria->add('name', '
+ COALESCE(
+ (CASE
+ WHEN (current.NAME IS NOT NULL AND current.NAME <> "")
+ THEN current.NAME
+ ELSE
+ source.NAME
+ END), "") < '.Propel::getConnection()->quote($this->name),
Criteria::CUSTOM);
+
+ $criteria->addDescendingOrderByColumn('name');
+ $criteria->addDescendingOrderByColumn('lft');
+
+ break;
+
+ case 'next':
+ default:
+
+ $criteria->add('name', '
+ COALESCE(
+ (CASE
+ WHEN (current.NAME IS NOT NULL AND current.NAME <> "")
+ THEN current.NAME
+ ELSE
+ source.NAME
+ END), "") > '.Propel::getConnection()->quote($this->name),
Criteria::CUSTOM);
- foreach (QubitTerm::get($criteria) as $item)
- {
- // Keep track of position of $currentNode in array
- if ($item === $currentNode)
- {
- $curIndex = count($tree);
- }
-
- $tree[] = $item;
- }
-
- $totalSiblings =
intval(BasePeer::doCount($criteria->setLimit(0))->fetchColumn(0));
-
- // Add current object to $tree if it wasn't added as a sibling
- if (!isset($curIndex))
- {
- if ($totalSiblings >= $limit)
- {
- // replace last sibling with current object
- array_splice($tree, -1, 1, array($currentNode));
- }
- else
- {
- $tree[] = $currentNode;
- }
-
- $curIndex = count($tree) - 1;
- }
+ $criteria->addAscendingOrderByColumn('name');
+ $criteria->addAscendingOrderByColumn('lft');
- if ($totalSiblings > $limit)
- {
- $tree[] = array('total' => $totalSiblings, 'limit' => $limit, 'parentId'
=> $currentNode->parentId);
+ break;
}
- // Get children (with limit)
- $totalChildren = 0;
- $criteria = new Criteria;
- $criteria->add(QubitTerm::PARENT_ID, $currentNode->id);
$criteria = QubitCultureFallback::addFallbackCriteria($criteria,
'QubitTerm');
- $criteria->addAscendingOrderByColumn('name');
-
- if (0 < $limit)
- {
- $criteria->setLimit($limit);
- }
-
- if (0 < count($children = QubitTerm::get($criteria)))
- {
- foreach ($children as $item)
- {
- $childs[] = $item;
- }
-
- $totalChildren =
intval(BasePeer::doCount($criteria->setLimit(0))->fetchColumn(0));
-
- if ($totalChildren > $limit)
- {
- $childs[] = array('total' => $totalChildren, 'limit' => $limit,
'parentId' => $currentNode->id);
- }
-
- // Insert children right AFTER current info object in array
- if ($curIndex == count($tree) - 1)
- {
- $tree = array_merge($tree, $childs);
- }
- else
- {
- array_splice($tree, $curIndex + 1, 0, $childs);
- }
- }
+ $criteria->setLimit($limit);
- return $tree;
- }
-
- public static function renderYuiNodes($tree, $options = array())
- {
- ProjectConfiguration::getActive()->loadHelpers(array('Qubit', 'Text',
'Escaping'));
-
- $yuiTree = array();
- foreach ($tree as $key => $item)
+ $results = array();
+ foreach (QubitTerm::get($criteria) as $item)
{
- $node = array();
-
- if ($item instanceof QubitTerm)
- {
- if (QubitTerm::ROOT_ID != $item->id)
- {
- $label = render_title($item);
-
- $node['label'] = truncate_text($label, 50);
-
- if (50 < strlen($label))
- {
- $node['title'] = esc_specialchars($label);
- }
-
- $node['href'] = sfContext::getInstance()->routing->generate(null,
array($item, 'module' => 'term'));
- $node['id'] = $item->id;
- $node['parentId'] = $item->parentId;
- $node['isLeaf'] = (string) !$item->hasChildren();
- $node['moveUrl'] = sfContext::getInstance()->routing->generate(null,
array($item, 'module' => 'default', 'action' => 'move'));
- $node['expandUrl'] =
sfContext::getInstance()->routing->generate(null, array($item, 'module' =>
'term', 'action' => 'treeView'));
- }
- else
- {
- $label = render_title($options['currentNode']->taxonomy);
-
- $node['label'] = truncate_text($label, 50);
-
- if (50 < strlen($label))
- {
- $node['title'] = esc_specialchars($label);
- }
-
- $node['href'] = sfContext::getInstance()->routing->generate(null,
array($options['currentNode']->taxonomy, 'module' => 'taxonomy'));
- $node['id'] = $item->id;
- $node['parentId'] = null;
- $node['isLeaf'] = (string) !$item->hasChildren();
- $node['moveUrl'] = sfContext::getInstance()->routing->generate(null,
array($item, 'module' => 'default', 'action' => 'move'));
- $node['expandUrl'] =
sfContext::getInstance()->routing->generate(null, array($item, 'module' =>
'term', 'action' => 'treeView'));
- }
-
- if (isset($options['currentNode']) && $options['currentNode'] ===
$item)
- {
- $node['style'] = 'ygtvlabel currentTextNode';
- }
- }
-
- // "Show all" link
- else
- {
- $count = intval($item['total']) - intval($item['limit']);
-
- $node['label'] = sfContext::getInstance()->i18n->__('+%1% ...',
array('%1%' => $count));
- $node['parentId'] = $item['parentId'];
- $node['href'] = '#';
- $node['isLeaf'] = 'true';
- $node['style'] = 'seeAllNode XmlHttpRequest';
- }
-
- $yuiTree[] = $node;
+ $results[] = $item;
}
- return $yuiTree;
+ return $results;
}
}
--
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.