Author: david
Date: Tue Sep 20 14:48:53 2011
New Revision: 9766

Log:
Add a physical object browse page

Added:
   trunk/apps/qubit/modules/physicalobject/actions/browseAction.class.php
      - copied, changed from r9764, 
trunk/apps/qubit/modules/rightsholder/actions/browseAction.class.php
   trunk/apps/qubit/modules/physicalobject/templates/browseSuccess.php
      - copied, changed from r9764, 
trunk/apps/qubit/modules/rightsholder/templates/browseSuccess.php

Copied and modified: 
trunk/apps/qubit/modules/physicalobject/actions/browseAction.class.php (from 
r9764, trunk/apps/qubit/modules/rightsholder/actions/browseAction.class.php)
==============================================================================
--- trunk/apps/qubit/modules/rightsholder/actions/browseAction.class.php        
Mon Sep 19 17:44:54 2011        (r9764, copy source)
+++ trunk/apps/qubit/modules/physicalobject/actions/browseAction.class.php      
Tue Sep 20 14:48:53 2011        (r9766)
@@ -17,11 +17,11 @@
  * along with Qubit Toolkit.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-class RightsHolderBrowseAction extends sfAction
+class PhysicalObjectBrowseAction extends sfAction
 {
   public function execute($request)
   {
-    if (!$this->context->user->hasCredential(array('contributor', 'editor', 
'administrator'), false))
+    if (!$this->getUser()->isAuthenticated())
     {
       QubitAcl::forwardUnauthorized();
     }
@@ -34,43 +34,42 @@
     $criteria = new Criteria;
 
     // Do source culture fallback
-    $criteria = QubitCultureFallback::addFallbackCriteria($criteria, 
'QubitActor');
+    $criteria = QubitCultureFallback::addFallbackCriteria($criteria, 
'QubitPhysicalObject');
 
     switch ($request->sort)
     {
       case 'nameDown':
-        $criteria->addDescendingOrderByColumn('authorized_form_of_name');
+        $criteria->addDescendingOrderByColumn('name');
 
         break;
 
-      case 'nameUp':
-        $criteria->addAscendingOrderByColumn('authorized_form_of_name');
+      case 'locationDown':
+        $criteria->addDescendingOrderByColumn('location');
 
         break;
 
-      case 'updatedDown':
-        $criteria->addDescendingOrderByColumn(QubitObject::UPDATED_AT);
+      case 'locationUp':
+        $criteria->addAscendingOrderByColumn('location');
 
         break;
 
-      case 'updatedUp':
-        $criteria->addAscendingOrderByColumn(QubitObject::UPDATED_AT);
+      case 'typeDown':
+        $criteria->addDescendingOrderByColumn('type');
 
         break;
 
+      case 'typeUp':
+        $criteria->addAscendingOrderByColumn('type');
+
+        break;
+
+      case 'nameUp':
       default:
-        if (!$this->getUser()->isAuthenticated())
-        {
-          $criteria->addAscendingOrderByColumn('authorized_form_of_name');
-        }
-        else
-        {
-          $criteria->addDescendingOrderByColumn(QubitObject::UPDATED_AT);
-        }
+        $criteria->addAscendingOrderByColumn('name');
     }
 
     // Page results
-    $this->pager = new QubitPager('QubitRightsHolder');
+    $this->pager = new QubitPager('QubitPhysicalObject');
     $this->pager->setCriteria($criteria);
     $this->pager->setMaxPerPage($request->limit);
     $this->pager->setPage($request->page);

Copied and modified: 
trunk/apps/qubit/modules/physicalobject/templates/browseSuccess.php (from 
r9764, trunk/apps/qubit/modules/rightsholder/templates/browseSuccess.php)
==============================================================================
--- trunk/apps/qubit/modules/rightsholder/templates/browseSuccess.php   Mon Sep 
19 17:44:54 2011        (r9764, copy source)
+++ trunk/apps/qubit/modules/physicalobject/templates/browseSuccess.php Tue Sep 
20 14:48:53 2011        (r9766)
@@ -1,19 +1,6 @@
 <?php use_helper('Date') ?>
 
-<div class="section tabs">
-
-  <h2 class="element-invisible"><?php echo __('Rights holder browse options') 
?></h2>
-
-  <div class="content">
-    <ul class="clearfix links">
-      <li<?php if ('nameDown' != $sf_request->sort && 'nameUp' != 
$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 ('nameDown' == $sf_request->sort || 'nameUp' == 
$sf_request->sort): ?> class="active"<?php endif; ?>><?php echo 
link_to(__('Alphabetic'), array('sort' => 'nameUp') + 
$sf_request->getParameterHolder()->getAll(), array('title' => __('Sort'))) 
?></li>
-    </ul>
-  </div>
-
-</div>
-
-<h1><?php echo __('Browse rights holder') ?></h1>
+<h1><?php echo __('Browse %1%', array('%1%' => 
sfConfig::get('app_ui_label_physicalobject'))) ?></h1>
 
 <table class="sticky-enabled">
   <thead>
@@ -26,38 +13,38 @@
           <?php echo link_to(image_tag('down.gif'), array('sort' => 
'nameDown') + $sf_request->getParameterHolder()->getAll(), array('title' => 
__('Sort'))) ?>
         <?php endif; ?>
       </th>
-      <?php if (!in_array($sf_request->sort, array('nameDown', 'nameUp'))): ?>
-        <th>
-          <?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; ?>
-        </th>
-      <?php endif; ?>
+      <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>
+      <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>
     </tr>
   </thead><tbody>
     <?php foreach ($pager->getResults() as $item): ?>
       <tr class="<?php echo 0 == @++$row % 2 ? 'even' : 'odd' ?>">
         <td>
-          <?php echo link_to(render_title($item), array($item, 'module' => 
'rightsholder')) ?>
+          <?php echo link_to(render_title($item), array($item, 'module' => 
'physicalobject')) ?>
+        </td>
+        <td>
+          <?php echo $item->location ?>
+        </td>
+        <td>
+          <?php echo $item->type?>
         </td>
-        <?php if (!in_array($sf_request->sort, array('nameDown', 'nameUp'))): 
?>
-          <td>
-            <?php echo format_date($item->updatedAt, 'f') ?>
-          </td>
-        <?php endif; ?>
       </tr>
     <?php endforeach; ?>
   </tbody>
 </table>
 
 <?php echo get_partial('default/pager', array('pager' => $pager)) ?>
-
-<div class="search">
-  <form action="<?php echo url_for(array('module' => 'rightsholder', 'action' 
=> 'list')) ?>">
-    <input name="subquery" value="<?php echo 
esc_entities($sf_request->subquery) ?>"/>
-    <input class="form-submit" type="submit" value="<?php echo __('Search 
rightsholder') ?>"/>
-  </form>
-</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