Author: jablko
Date: Mon Oct 25 13:41:47 2010
New Revision: 8479

Log:
Cosmetic changes

Modified:
   
trunk/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php
   trunk/apps/qubit/modules/informationobject/templates/_treeView.php
   trunk/apps/qubit/modules/term/actions/autocompleteAction.class.php
   trunk/apps/qubit/modules/term/actions/treeViewComponent.class.php
   trunk/apps/qubit/modules/term/templates/_treeView.php

Modified: 
trunk/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php
==============================================================================
--- 
trunk/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php  
    Mon Oct 25 13:28:37 2010        (r8478)
+++ 
trunk/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php  
    Mon Oct 25 13:41:47 2010        (r8479)
@@ -23,10 +23,10 @@
   {
     $resource = $request->getAttribute('sf_route')->resource;
 
-    // Get info object tree (limit to max 10 siblings and children)
+    // Get tree (limit 10 siblings and children)
     $this->treeViewObjects = $resource->getFullYuiTree(10);
 
-    // Check if treeview worth it
+    // Check if tree view worth it
     if (1 > count($this->treeViewObjects))
     {
       return sfView::NONE;

Modified: trunk/apps/qubit/modules/informationobject/templates/_treeView.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/_treeView.php  Mon Oct 
25 13:28:37 2010        (r8478)
+++ trunk/apps/qubit/modules/informationobject/templates/_treeView.php  Mon Oct 
25 13:41:47 2010        (r8479)
@@ -1,14 +1,18 @@
 <?php use_helper('Javascript') ?>
 
-<div id="treeView">
-</div>
-<?php $treeViewObjects = json_encode($sf_data->getRaw('treeViewObjects')) ?>
-<?php $treeViewExpands = json_encode($sf_data->getRaw('treeViewExpands')) ?>
-<?php $treeViewI18nLoading = __('Loading...') ?>
-<?php echo javascript_tag(<<<EOF
+<div id="treeView"></div>
+
+<?php
+
+$treeViewObjects = json_encode($treeViewObjects);
+$treeViewExpands = json_encode($treeViewExpands);
+$treeViewI18nLoading = __('Loading...');
+
+echo javascript_tag(<<<content
 Qubit.treeView.objects = $treeViewObjects;
 Qubit.treeView.expands = $treeViewExpands;
 Qubit.treeView.draggable = $treeViewDraggable;
 Qubit.treeView.i18nLoading = '$treeViewI18nLoading';
-EOF
-) ?>
+
+content
+);

Modified: trunk/apps/qubit/modules/term/actions/autocompleteAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/term/actions/autocompleteAction.class.php  Mon Oct 
25 13:28:37 2010        (r8478)
+++ trunk/apps/qubit/modules/term/actions/autocompleteAction.class.php  Mon Oct 
25 13:41:47 2010        (r8479)
@@ -36,8 +36,8 @@
       // circular inheritance)
       if (isset($params['id']))
       {
+        // TODO Self join would be ideal
         $term = QubitTerm::getById($params['id']);
-
         if (isset($term))
         {
           $criteria->add($criteria->getNewCriterion(QubitTerm::LFT, 
$term->lft, Criteria::LESS_THAN)
@@ -60,7 +60,6 @@
       // Sort by name
       $criteria->addAscendingOrderByColumn(QubitTermI18n::NAME);
 
-      // Show first 10 results
       $criteria->setLimit(10);
 
       $this->terms = QubitTerm::get($criteria);
@@ -72,8 +71,9 @@
       $s1 = 'SELECT qt.id, null, qti.name
         FROM '.QubitTerm::TABLE_NAME.' qt
           LEFT JOIN '.QubitTermI18n::TABLE_NAME.' qti
-            ON qt.id = qti.id WHERE qti.culture = :p1
-              AND taxonomy_id = :p2';
+            ON qt.id = qti.id
+        WHERE taxonomy_id = :p1
+          AND qti.culture = :p2';
 
       $s2 = 'SELECT qt.id, qon.id as altId, qoni.name
         FROM '.QubitOtherName::TABLE_NAME.' qon
@@ -81,8 +81,8 @@
             ON qon.id = qoni.id
           INNER JOIN '.QubitTerm::TABLE_NAME.' qt
             ON qon.object_id = qt.id
-        WHERE qoni.culture = :p1
-          AND qt.taxonomy_id = :p2';
+        WHERE qt.taxonomy_id = :p1
+          AND qoni.culture = :p2';
 
       // Narrow results by query
       if (isset($request->query))
@@ -93,10 +93,10 @@
 
       $connnection = Propel::getConnection();
       $statement = $conn->prepare("($s1) UNION ALL ($s2) ORDER BY name LIMIT 
10");
-      $statement->bindValue(':p1', $this->context->user->getCulture());
-
       $params = 
$this->context->routing->parse(Qubit::pathInfo($request->taxonomy));
-      $statement->bindValue(':p2', $params['id']);
+      $statement->bindValue(':p1', $params['id']);
+
+      $statement->bindValue(':p2', $this->context->user->getCulture());
 
       if (isset($request->query))
       {

Modified: trunk/apps/qubit/modules/term/actions/treeViewComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/term/actions/treeViewComponent.class.php   Mon Oct 
25 13:28:37 2010        (r8478)
+++ trunk/apps/qubit/modules/term/actions/treeViewComponent.class.php   Mon Oct 
25 13:41:47 2010        (r8479)
@@ -21,16 +21,12 @@
 {
   public function execute($request)
   {
-    $this->resource = $request->getAttribute('term');
-    if (!isset($this->resource->id))
-    {
-      return sfView::NONE;
-    }
+    $resource = $request->getAttribute('sf_route')->resource;
 
-    // Get term tree (limit to max 10 siblings and children)
+    // Get tree (limit 10 siblings and children)
     $this->treeViewObjects = $this->resource->getFullYuiTree(10);
 
-    // Check if treeview worth it
+    // Check if tree view worth it
     if (1 > count($this->treeViewObjects))
     {
       return sfView::NONE;

Modified: trunk/apps/qubit/modules/term/templates/_treeView.php
==============================================================================
--- trunk/apps/qubit/modules/term/templates/_treeView.php       Mon Oct 25 
13:28:37 2010        (r8478)
+++ trunk/apps/qubit/modules/term/templates/_treeView.php       Mon Oct 25 
13:41:47 2010        (r8479)
@@ -1,14 +1,18 @@
 <?php use_helper('Javascript') ?>
 
-<div id="treeView">
-</div>
-<?php $treeViewObjects = json_encode($sf_data->getRaw('treeViewObjects')) ?>
-<?php $treeViewExpands = json_encode($sf_data->getRaw('treeViewExpands')) ?>
-<?php $treeViewI18nLoading = __('Loading...') ?>
-<?php echo javascript_tag(<<<EOF
+<div id="treeView"></div>
+
+<?php
+
+$treeViewObjects = json_encode($treeViewObjects);
+$treeViewExpands = json_encode($treeViewExpands);
+$treeViewI18nLoading = __('Loading...');
+
+echo javascript_tag(<<<content
 Qubit.treeView.objects = $treeViewObjects;
 Qubit.treeView.expands = $treeViewExpands;
 Qubit.treeView.draggable = $treeViewDraggable;
 Qubit.treeView.i18nLoading = '$treeViewI18nLoading';
-EOF
-) ?>
+
+content
+);

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

Reply via email to