Author: sevein
Date: Thu Apr 14 09:08:56 2011
New Revision: 9073

Log:
New default sort based on whether used logged in and add institution column to 
'recent changes' view to information object browser screen (see issues 1951 and 
1932). Wu's contribution.

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

Modified: 
trunk/apps/qubit/modules/informationobject/actions/browseAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/browseAction.class.php   
Thu Apr 14 00:03:04 2011        (r9072)
+++ trunk/apps/qubit/modules/informationobject/actions/browseAction.class.php   
Thu Apr 14 09:08:56 2011        (r9073)
@@ -47,7 +47,6 @@
 
     $fallbackTable = 'QubitInformationObject';
 
-    // Sort results
     switch ($request->sort)
     {
       case 'repositoryDown':
@@ -75,7 +74,6 @@
         break;
 
       case 'updatedDown':
-      default:
         $criteria->addDescendingOrderByColumn(QubitObject::UPDATED_AT);
 
         break;
@@ -84,6 +82,16 @@
         $criteria->addAscendingOrderByColumn(QubitObject::UPDATED_AT);
 
         break;
+
+      default:
+        if (!$this->getUser()->isAuthenticated())
+        {
+          $criteria->addAscendingOrderByColumn('title');
+        }
+        else
+        {
+          $criteria->addDescendingOrderByColumn(QubitObject::UPDATED_AT);
+        }
     }
 
     // Do source culture fallback
@@ -98,4 +106,4 @@
     $this->pager->setMaxPerPage($request->limit);
     $this->pager->setPage($request->page);
   }
-}
+}
\ No newline at end of file

Modified: trunk/apps/qubit/modules/informationobject/templates/browseSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/browseSuccess.php      
Thu Apr 14 00:03:04 2011        (r9072)
+++ trunk/apps/qubit/modules/informationobject/templates/browseSuccess.php      
Thu Apr 14 09:08:56 2011        (r9073)
@@ -6,8 +6,13 @@
 
   <div class="content">
     <ul class="clearfix links">
-      <li<?php if ('titleDown' != $sf_request->sort && 'titleUp' != 
$sf_request->sort): ?> class="active"<?php endif; ?>><?php echo 
link_to(__('Recent changes'), array('sort' => 'updatedDown') + 
$sf_request->getParameterHolder()->getAll(), array('title' => __('Sort'))) 
?></li>
-      <li<?php if ('titleDown' == $sf_request->sort || 'titleUp' == 
$sf_request->sort): ?> class="active"<?php endif; ?>><?php echo 
link_to(__('Alphabetic'), array('sort' => 'titleUp') + 
$sf_request->getParameterHolder()->getAll(), array('title' => __('Sort'))) 
?></li>
+      <?php if ($sf_user->isAuthenticated()): ?>
+        <li<?php if ('titleDown' != $sf_request->sort && 'titleUp' != 
$sf_request->sort): ?> class="active"<?php endif; ?>><?php echo 
link_to(__('Recent changes'), array('sort' => 'updatedDown') + 
$sf_request->getParameterHolder()->getAll(), array('title' => __('Sort'))) 
?></li>
+        <li<?php if ('titleDown' == $sf_request->sort || 'titleUp' == 
$sf_request->sort): ?> class="active"<?php endif; ?>><?php echo 
link_to(__('Alphabetic'), array('sort' => 'titleUp') + 
$sf_request->getParameterHolder()->getAll(), array('title' => __('Sort'))) 
?></li>
+      <?php else: ?>
+        <li<?php if ('updatedDown' == $sf_request->sort || 'updatedUp' == 
$sf_request->sort): ?> class="active"<?php endif; ?>><?php echo 
link_to(__('Recent changes'), array('sort' => 'updatedDown') + 
$sf_request->getParameterHolder()->getAll(), array('title' => __('Sort'))) 
?></li>
+        <li<?php if ('updatedDown' != $sf_request->sort && 'updatedUp' != 
$sf_request->sort): ?> class="active"<?php endif; ?>><?php echo 
link_to(__('Alphabetic'), array('sort' => 'titleUp') + 
$sf_request->getParameterHolder()->getAll(), array('title' => __('Sort'))) 
?></li>
+      <?php endif; ?> 
     </ul>
   </div>
 
@@ -26,7 +31,27 @@
           <?php echo link_to(image_tag('down.gif'), array('sort' => 
'titleDown') + $sf_request->getParameterHolder()->getAll(), array('title' => 
__('Sort'))) ?>
         <?php endif; ?>
       </th><th>
-        <?php echo __('Level') ?>
+        <?php if ($sf_user->isAuthenticated()): ?>
+          <?php if ('titleUp' == $sf_request->sort || 'titleDown' == 
$sf_request->sort): ?>
+            <?php echo __('Level') ?>
+          <?php else: ?>
+            <?php if (sfConfig::get('app_multi_repository')): ?>
+              <?php echo sfConfig::get('app_ui_label_repository') ?>
+            <?php else: ?>
+              <?php echo __('Level') ?>
+            <?php endif; ?>
+          <?php endif; ?>
+        <?php else: ?>
+          <?php if ('updatedUp' == $sf_request->sort || 'updatedDown' == 
$sf_request->sort): ?>
+            <?php if (sfConfig::get('app_multi_repository')): ?>
+              <?php echo sfConfig::get('app_ui_label_repository') ?>
+            <?php else: ?>
+              <?php echo __('Level') ?>
+            <?php endif; ?>
+          <?php else: ?>
+            <?php echo __('Level') ?>
+          <?php endif; ?>
+        <?php endif; ?>
       </th><th>
         <?php if ('titleDown' == $sf_request->sort || 'titleUp' == 
$sf_request->sort): ?>
           <?php if (sfConfig::get('app_multi_repository')): ?>
@@ -35,11 +60,19 @@
             <?php echo __(sfConfig::get('app_ui_label_creator')) ?>
           <?php endif; ?>
         <?php else: ?>
-          <?php echo __('Updated') ?>
-          <?php if ('updatedUp' == $sf_request->sort): ?>
-            <?php echo link_to(image_tag('up.gif'), array('sort' => 
'updatedDown') + $sf_request->getParameterHolder()->getAll(), array('title' => 
__('Sort'))) ?>
+          <?php if ('updatedDown' == $sf_request->sort || 'updatedUp' == 
$sf_request->sort || $sf_user->isAuthenticated()): ?>
+            <?php echo __('Updated') ?>
+            <?php if ('updatedUp' == $sf_request->sort): ?>
+              <?php echo link_to(image_tag('up.gif'), array('sort' => 
'updatedDown') + $sf_request->getParameterHolder()->getAll(), array('title' => 
__('Sort'))) ?>
+            <?php else: ?>
+              <?php echo link_to(image_tag('down.gif'), array('sort' => 
'updatedUp') + $sf_request->getParameterHolder()->getAll(), array('title' => 
__('Sort'))) ?>
+            <?php endif; ?>
           <?php else: ?>
-            <?php echo link_to(image_tag('down.gif'), array('sort' => 
'updatedUp') + $sf_request->getParameterHolder()->getAll(), array('title' => 
__('Sort'))) ?>
+            <?php if (sfConfig::get('app_multi_repository')): ?>
+              <?php echo __(sfConfig::get('app_ui_label_repository')) ?>
+            <?php else: ?>
+              <?php echo __(sfConfig::get('app_ui_label_creator')) ?>
+            <?php endif; ?>
           <?php endif; ?>
         <?php endif; ?>
       </th>
@@ -50,7 +83,31 @@
         <td>
           <?php echo link_to(render_title($item), array($item, 'module' => 
'informationobject')) ?><?php if (QubitTerm::PUBLICATION_STATUS_DRAFT_ID == 
$item->getPublicationStatus()->status->id): ?> <span 
class="publicationStatus"><?php echo $item->getPublicationStatus()->status 
?></span><?php endif; ?>
         </td><td>
-          <?php echo $item->levelOfDescription ?>
+          <?php if ($sf_user->isAuthenticated()): ?>
+            <?php if ('titleUp' == $sf_request->sort || 'titleDown' == 
$sf_request->sort): ?>
+              <?php echo $item->levelOfDescription ?>
+            <?php else: ?>
+              <?php if (sfConfig::get('app_multi_repository')): ?>
+                <?php if (null !== $repository = 
$item->getRepository(array('inherit' => true))): ?>
+                  <?php echo link_to(render_title($repository), 
array($repository, 'module' => 'repository')) ?>
+                <?php endif; ?>
+              <?php else: ?>
+                <?php echo $item->levelOfDescription ?>
+              <?php endif; ?>
+            <?php endif; ?>
+          <?php else: ?>
+            <?php if ('updatedUp' == $sf_request->sort || 'updatedDown' == 
$sf_request->sort): ?>
+              <?php if (sfConfig::get('app_multi_repository')): ?>
+                <?php if (null !== $repository = 
$item->getRepository(array('inherit' => true))): ?>
+                  <?php echo link_to(render_title($repository), 
array($repository, 'module' => 'repository')) ?>
+                <?php endif; ?>
+              <?php else: ?>
+               <?php echo $item->levelOfDescription ?>
+              <?php endif; ?>
+            <?php else: ?>
+              <?php echo $item->levelOfDescription ?>
+            <?php endif; ?>
+          <?php endif; ?>
         </td><td>
           <?php if ('titleDown' == $sf_request->sort || 'titleUp' == 
$sf_request->sort): ?>
             <?php if (sfConfig::get('app_multi_repository')): ?>
@@ -65,7 +122,21 @@
               </ul>
             <?php endif; ?>
           <?php else: ?>
-            <?php echo format_date($item->updatedAt, 'f') ?>
+            <?php if ('updatedDown' == $sf_request->sort || 'updatedUp' == 
$sf_request->sort || $sf_user->isAuthenticated()): ?>
+              <?php echo format_date($item->updatedAt, 'f') ?>
+            <?php else: ?>
+              <?php if (sfConfig::get('app_multi_repository')): ?>
+                <?php if (null !== $repository = 
$item->getRepository(array('inherit' => true))): ?>
+                  <?php echo link_to(render_title($repository), 
array($repository, 'module' => 'repository')) ?>
+                <?php endif; ?>
+              <?php else: ?>
+                <ul>
+                  <?php foreach ($item->getCreators(array('inherit' => true)) 
as $creator): ?>
+                    <li><?php echo link_to(render_title($creator), 
array($creator, 'module' => 'actor')) ?></li>
+                  <?php endforeach; ?>
+                </ul>
+              <?php endif; ?>
+            <?php endif; ?>
           <?php endif; ?>
         </td>
       </tr>
@@ -80,4 +151,4 @@
     <input name="query" value="<?php echo $sf_request->query ?>"/>
     <input class="form-submit" type="submit" value="<?php echo __('Search 
%1%', array('%1%' => sfConfig::get('app_ui_label_informationobject'))) ?>"/>
   </form>
-</div>
+</div>
\ No newline at end of file

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