Author: david
Date: Wed Sep 21 11:16:40 2011
New Revision: 9773

Log:
Simplify column sorting in preparation for adding javascript to progressively 
add sort icons

Modified:
   trunk/apps/qubit/modules/physicalobject/actions/browseAction.class.php
   trunk/apps/qubit/modules/physicalobject/templates/browseSuccess.php

Modified: trunk/apps/qubit/modules/physicalobject/actions/browseAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/physicalobject/actions/browseAction.class.php      
Wed Sep 21 11:01:08 2011        (r9772)
+++ trunk/apps/qubit/modules/physicalobject/actions/browseAction.class.php      
Wed Sep 21 11:16:40 2011        (r9773)
@@ -38,33 +38,34 @@
 
     switch ($request->sort)
     {
-      case 'nameDown':
+      case 'nameDescending':
         $criteria->addDescendingOrderByColumn('name');
 
         break;
 
-      case 'locationDown':
+      case 'locationDescending':
         $criteria->addDescendingOrderByColumn('location');
 
         break;
 
-      case 'locationUp':
+      case 'locationAscending':
         $criteria->addAscendingOrderByColumn('location');
 
         break;
 
-      case 'typeDown':
+      case 'typeDescending':
         $criteria->addDescendingOrderByColumn('type');
 
         break;
 
-      case 'typeUp':
+      case 'typeAscending':
         $criteria->addAscendingOrderByColumn('type');
 
         break;
 
-      case 'nameUp':
+      case 'nameAscending':
       default:
+        $request->sort = 'nameAscending';
         $criteria->addAscendingOrderByColumn('name');
     }
 

Modified: trunk/apps/qubit/modules/physicalobject/templates/browseSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/physicalobject/templates/browseSuccess.php Wed Sep 
21 11:01:08 2011        (r9772)
+++ trunk/apps/qubit/modules/physicalobject/templates/browseSuccess.php Wed Sep 
21 11:16:40 2011        (r9773)
@@ -5,29 +5,14 @@
 <table class="sticky-enabled">
   <thead>
     <tr>
-      <th>
-        <?php echo __('Name') ?>
-        <?php if ('nameDown' == $sf_request->sort): ?>
-          <?php echo link_to(image_tag('up.gif'), array('sort' => 'nameUp') + 
$sf_request->getParameterHolder()->getAll(), array('title' => __('Sort'))) ?>
-        <?php else: ?>
-          <?php echo link_to(image_tag('down.gif'), array('sort' => 
'nameDown') + $sf_request->getParameterHolder()->getAll(), array('title' => 
__('Sort'))) ?>
-        <?php endif; ?>
+      <th class="sortable">
+        <?php echo link_to(__('Name'), array('sort' => ('nameAscending' == 
$sf_request->sort) ? 'nameDescending' : 'nameAscending') + 
$sf_request->getParameterHolder()->getAll(), array('title' => __('Sort'), 
'class' => 'sortable')) ?>
       </th>
-      <th>
-        <?php echo __('Location') ?>
-        <?php if ('locationUp' == $sf_request->sort): ?>
-          <?php echo link_to(image_tag('up.gif'), array('sort' => 
'locationDown') + $sf_request->getParameterHolder()->getAll(), array('title' => 
__('Sort'))) ?>
-        <?php else: ?>
-          <?php echo link_to(image_tag('down.gif'), array('sort' => 
'locationUp') + $sf_request->getParameterHolder()->getAll(), array('title' => 
__('Sort'))) ?>
-        <?php endif; ?>
+      <th class="sortable">
+        <?php echo link_to(__('Location'), array('sort' => 
('locationAscending' == $sf_request->sort) ? 'locationDescending' : 
'locationAscending') + $sf_request->getParameterHolder()->getAll(), 
array('title' => __('Sort'), 'class' => 'sortable')) ?>
       </th>
-      <th>
-        <?php echo __('Type') ?>
-        <?php if ('typeUp' == $sf_request->sort): ?>
-          <?php echo link_to(image_tag('up.gif'), array('sort' => 'typeDown') 
+ $sf_request->getParameterHolder()->getAll(), array('title' => __('Sort'))) ?>
-        <?php else: ?>
-          <?php echo link_to(image_tag('down.gif'), array('sort' => 'typeUp') 
+ $sf_request->getParameterHolder()->getAll(), array('title' => __('Sort'))) ?>
-        <?php endif; ?>
+      <th class="sortable">
+        <?php echo link_to(__('Type'), array('sort' => ('typeAscending' == 
$sf_request->sort) ? 'typeDescending' : 'typeAscending') + 
$sf_request->getParameterHolder()->getAll(), array('title' => __('Sort'), 
'class' => 'sortable')) ?>
       </th>
     </tr>
   </thead><tbody>

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