Author: david
Date: Tue Aug 11 11:50:40 2009
New Revision: 3002

Log:
Display taxonomy name as root node for term treeview.

Modified:
   trunk/apps/qubit/modules/term/actions/contextMenuComponent.class.php
   trunk/apps/qubit/modules/term/actions/treeViewComponent.class.php
   trunk/apps/qubit/modules/term/templates/_contextMenu.php

Modified: trunk/apps/qubit/modules/term/actions/contextMenuComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/term/actions/contextMenuComponent.class.php        
Tue Aug 11 11:45:53 2009        (r3001)
+++ trunk/apps/qubit/modules/term/actions/contextMenuComponent.class.php        
Tue Aug 11 11:50:40 2009        (r3002)
@@ -18,7 +18,7 @@
  */
 
 /**
- * Context menu for taxonomies 
+ * Context menu for taxonomiesg
  *
  * @package    qubit
  * @subpackage term
@@ -39,7 +39,13 @@
     if (null !== $this->term->id)
     {
       $criteria = new Criteria;
-      $criteria->add(QubitTerm::TAXONOMY_ID, $this->term->taxonomyId, 
Criteria::EQUAL);
+
+      // Show terms in this taxonomy and the root term
+      $criterion1 = $criteria->getNewCriterion(QubitTerm::TAXONOMY_ID, 
$this->term->taxonomyId, Criteria::EQUAL);
+      $criterion2 = $criteria->getNewCriterion(QubitTerm::ID, 
QubitTerm::ROOT_ID, Criteria::EQUAL);
+      $criterion1->addOr($criterion2);
+      $criteria->add($criterion1);
+
       $criteria->addAscendingOrderByColumn(QubitTerm::LFT);
 
       // Omit non-preferred terms

Modified: trunk/apps/qubit/modules/term/actions/treeViewComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/term/actions/treeViewComponent.class.php   Tue Aug 
11 11:45:53 2009        (r3001)
+++ trunk/apps/qubit/modules/term/actions/treeViewComponent.class.php   Tue Aug 
11 11:50:40 2009        (r3002)
@@ -40,11 +40,23 @@
     foreach ($this->termTree as $term)
     {
       $treeViewObject = array();
-      $treeViewObject['label'] = $term->getName(array('cultureFallback' => 
true, 'truncate' => 50));
-      $treeViewObject['href'] = 
$this->getController()->genUrl('term/show?id='.$term->id);
-      $treeViewObject['id'] = $term->id;
-      $treeViewObject['parentId'] = $term->parentId;
-      $treeViewObject['isLeaf'] = (string) count($term->getDescendants()) == 0;
+
+      if (QubitTerm::ROOT_ID != $term->id)
+      {
+        $treeViewObject['label'] = $term->getName(array('cultureFallback' => 
true, 'truncate' => 50));
+        $treeViewObject['href'] = 
$this->getController()->genUrl('term/show?id='.$term->id);
+        $treeViewObject['id'] = $term->id;
+        $treeViewObject['parentId'] = $term->parentId;
+        $treeViewObject['isLeaf'] = (string) count($term->getDescendants()) == 
0;
+      }
+      else
+      {
+        $treeViewObject['label'] = 
$this->term->getTaxonomy()->getName(array('cultureFallback' => true, 'truncate' 
=> 50));
+        $treeViewObject['href'] = 
$this->getController()->genUrl(array('module' => 'term', 'action' => 'list', 
'taxonomyId' => $this->term->taxonomyId));
+        $treeViewObject['id'] = $term->id;
+        $treeViewObject['parentId'] = null;
+        $treeViewObject['isLeaf'] = (string) count($term->getDescendants()) == 
0;
+      }
 
       // TODO: Should be able to check equality of objects
       if ($term->id == $this->term->id)

Modified: trunk/apps/qubit/modules/term/templates/_contextMenu.php
==============================================================================
--- trunk/apps/qubit/modules/term/templates/_contextMenu.php    Tue Aug 11 
11:45:53 2009        (r3001)
+++ trunk/apps/qubit/modules/term/templates/_contextMenu.php    Tue Aug 11 
11:50:40 2009        (r3002)
@@ -6,13 +6,6 @@
 
 <div class="context-column-box">
   <div class="contextMenu">
-    <?php if (isset($taxonomy)): ?>
-      <div class="label">
-        <?php echo __('taxonomy') ?> 
-      </div>
-      <?php echo link_to($taxonomy->getName(array('cultureFallback' => true)), 
array('module' => 'term', 'action' => 'list', 'taxonomyId' => 
$taxonomy->getId())) ?>
-    <?php endif; ?>
-
     <?php if (1 < count($termTree)): ?>
       <div class="label">
         <?php echo __('taxonomy hierarchy') ?>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to