Author: david
Date: Mon Oct 10 14:42:45 2011
New Revision: 10004

Log:
Copy basic file list templates from browse page

Added:
   trunk/apps/qubit/modules/informationobject/actions/fileListAction.class.php
      - copied, changed from r10001, 
trunk/apps/qubit/modules/informationobject/actions/browseAction.class.php
   trunk/apps/qubit/modules/informationobject/templates/fileListSuccess.php
      - copied, changed from r10001, 
trunk/apps/qubit/modules/informationobject/templates/browseSuccess.php

Copied and modified: 
trunk/apps/qubit/modules/informationobject/actions/fileListAction.class.php 
(from r10001, 
trunk/apps/qubit/modules/informationobject/actions/browseAction.class.php)
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/browseAction.class.php   
Mon Oct 10 00:13:00 2011        (r10001, copy source)
+++ trunk/apps/qubit/modules/informationobject/actions/fileListAction.class.php 
Mon Oct 10 14:42:45 2011        (r10004)
@@ -18,62 +18,35 @@
  */
 
 /**
+ * File list report
+ *
  * @package    qubit
- * @subpackage repository
+ * @subpackage informationobject
  * @author     Peter Van Garderen <[email protected]>
- * @author     Wu Liu <[email protected]>
+ * @author     David Juhasz <[email protected]>
  * @version    svn:$Id$
  */
-class InformationObjectBrowseAction extends sfAction
+class InformationObjectFileListAction extends sfAction
 {
   public function execute($request)
   {
-    if (!isset($request->limit))
-    {
-      $request->limit = sfConfig::get('app_hits_per_page');
-    }
-
-    $criteria = new Criteria;
-
-    if (isset($this->getRoute()->resource))
-    {
-      $this->resource = $this->getRoute()->resource;
-
-      $criteria->add(QubitInformationObject::PARENT_ID, $this->resource->id);
-    }
-    else
+    $this->resource = $this->getRoute()->resource;
+    if (!isset($this->resource))
     {
-      $criteria->add(QubitInformationObject::PARENT_ID, 
QubitInformationObject::ROOT_ID);
+      $this->forward404();
     }
 
-    if (isset($request->repositoryId))
-    {
-      $criteria->add(QubitInformationObject::REPOSITORY_ID, 
$request->repositoryId);
-    }
-
-    if (isset($request->collectionType))
+    if (!isset($request->limit))
     {
-      $criteria->add(QubitInformationObject::COLLECTION_TYPE_ID, 
$request->collectionType);
+      $request->limit = sfConfig::get('app_hits_per_page');
     }
 
-    $fallbackTable = 'QubitInformationObject';
+    $criteria = new Criteria;
+    $criteria->add(QubitInformationObject::LFT, $this->resource->lft, 
Criteria::GREATER_EQUAL);
+    $criteria->add(QubitInformationObject::RGT, $this->resource->rgt, 
Criteria::LESS_EQUAL);
 
     switch ($request->sort)
     {
-      case 'repositoryDown':
-        $fallbackTable = 'QubitActor';
-        $criteria->addJoin(QubitInformationObject::REPOSITORY_ID, 
QubitActor::ID, Criteria::LEFT_JOIN);
-        $criteria->addDescendingOrderByColumn('authorized_form_of_name');
-
-        break;
-
-      case 'repositoryUp':
-        $fallbackTable = 'QubitActor';
-        $criteria->addJoin(QubitInformationObject::REPOSITORY_ID, 
QubitActor::ID, Criteria::LEFT_JOIN);
-        $criteria->addAscendingOrderByColumn('authorized_form_of_name');
-
-        break;
-
       case 'titleDown':
         $criteria->addDescendingOrderByColumn('title');
 
@@ -95,18 +68,11 @@
         break;
 
       default:
-        if (!$this->getUser()->isAuthenticated())
-        {
-          $criteria->addAscendingOrderByColumn('title');
-        }
-        else
-        {
-          $criteria->addDescendingOrderByColumn(QubitObject::UPDATED_AT);
-        }
+        $criteria->addAscendingOrderByColumn('title');
     }
 
     // Do source culture fallback
-    $criteria = QubitCultureFallback::addFallbackCriteria($criteria, 
$fallbackTable);
+    $criteria = QubitCultureFallback::addFallbackCriteria($criteria, 
'QubitInformationObject');
 
     // Filter drafts
     $criteria = QubitAcl::addFilterDraftsCriteria($criteria);

Copied and modified: 
trunk/apps/qubit/modules/informationobject/templates/fileListSuccess.php (from 
r10001, trunk/apps/qubit/modules/informationobject/templates/browseSuccess.php)
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/browseSuccess.php      
Mon Oct 10 00:13:00 2011        (r10001, copy source)
+++ trunk/apps/qubit/modules/informationobject/templates/fileListSuccess.php    
Mon Oct 10 14:42:45 2011        (r10004)
@@ -1,24 +1,8 @@
 <?php use_helper('Date') ?>
 
-<div class="section tabs">
+<h1><?php echo __('File list report') ?></h1>
 
-  <h2 class="element-invisible"><?php echo __('Information Object Browse 
Options') ?></h2>
-
-  <div class="content">
-    <ul class="clearfix links">
-      <?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>
-
-</div>
-
-<h1><?php echo __('Browse %1%', array('%1%' => 
sfConfig::get('app_ui_label_informationobject'))) ?></h1>
+<h1 class="label"><?php $isad = new sfIsadPlugin($resource); echo 
$isad->__toString() ?></h1>
 
 <table class="sticky-enabled">
   <thead>
@@ -160,4 +144,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>
\ No newline at end of file
+</div>

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