Author: sevein
Date: Wed Oct  5 16:49:38 2011
New Revision: 9956

Log:
New digital object browser, js intensive

Modified:
   trunk/apps/qubit/modules/digitalobject/actions/browseAction.class.php
   trunk/apps/qubit/modules/digitalobject/actions/imageflowComponent.class.php
   trunk/apps/qubit/modules/digitalobject/config/view.yml
   trunk/apps/qubit/modules/digitalobject/templates/browseSuccess.php

Modified: trunk/apps/qubit/modules/digitalobject/actions/browseAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/digitalobject/actions/browseAction.class.php       
Wed Oct  5 16:34:20 2011        (r9955)
+++ trunk/apps/qubit/modules/digitalobject/actions/browseAction.class.php       
Wed Oct  5 16:49:38 2011        (r9956)
@@ -31,7 +31,7 @@
   {
     if (!isset($request->limit))
     {
-      $request->limit = sfConfig::get('app_hits_per_page');
+      $request->limit = 25;
     }
 
     $this->mediaType = QubitTerm::getById($request->mediatype);

Modified: 
trunk/apps/qubit/modules/digitalobject/actions/imageflowComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/digitalobject/actions/imageflowComponent.class.php 
Wed Oct  5 16:34:20 2011        (r9955)
+++ trunk/apps/qubit/modules/digitalobject/actions/imageflowComponent.class.php 
Wed Oct  5 16:49:38 2011        (r9956)
@@ -53,8 +53,8 @@
 
       if (!$thumbnail)
       {
-        $thumbnail = 
QubitDigitalObject::getGenericRepresentation($digitalObject->mimeType, 
QubitTerm::THUMBNAIL_ID);
-        $thumbnail->setParent($digitalObject);
+        $thumbnail = 
QubitDigitalObject::getGenericRepresentation($item->mimeType, 
QubitTerm::THUMBNAIL_ID);
+        $thumbnail->setParent($item);
       }
 
       $this->thumbnails[] = $thumbnail;

Modified: trunk/apps/qubit/modules/digitalobject/config/view.yml
==============================================================================
--- trunk/apps/qubit/modules/digitalobject/config/view.yml      Wed Oct  5 
16:34:20 2011        (r9955)
+++ trunk/apps/qubit/modules/digitalobject/config/view.yml      Wed Oct  5 
16:49:38 2011        (r9956)
@@ -3,3 +3,7 @@
     /plugins/sfDrupalPlugin/vendor/drupal/misc/jquery.once.js:
     /plugins/sfDrupalPlugin/vendor/drupal/misc/collapse:
     /plugins/sfDrupalPlugin/vendor/drupal/misc/form:
+
+browseSuccess:
+  javascripts:
+    /vendor/jquery.hoverIntent.js:

Modified: trunk/apps/qubit/modules/digitalobject/templates/browseSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/digitalobject/templates/browseSuccess.php  Wed Oct 
 5 16:34:20 2011        (r9955)
+++ trunk/apps/qubit/modules/digitalobject/templates/browseSuccess.php  Wed Oct 
 5 16:49:38 2011        (r9956)
@@ -1,3 +1,121 @@
+<?php use_helper('Javascript') ?>
+
+<?php
+
+echo javascript_tag(<<<content
+
+(function ($)
+  {
+
+    $(document).ready(function()
+      {
+
+        $('.digital-object li > a')
+
+          .click(function(event)
+            {
+              event.preventDefault();
+            })
+          .mouseover(function()
+            {
+              \$this = $(this).addClass('hover');
+              
+            })
+          .mouseout(function()
+            {
+              \$this = $(this).removeClass('hover');
+            })
+
+          .hoverIntent({
+            over: function()
+              {
+                \$layer = $(this)
+                  .before('<div class="digital-object-detail" />')
+                  .prev()
+                  .mouseleave(function(event)
+                    {
+                      $(this).fadeOut(100, function()
+                        {
+                          $(this).remove();
+                        });
+                    });
+
+                \$layer
+                  .append(\$this.clone(false).wrap('div').addClass('img'))
+                  .append(\$this.nextAll().clone(false).show());
+                
+                \$layer
+                  .css({
+                    'top': (\$layer.height() - \$this.height()) / -2,
+                    'left': (\$layer.width() - \$this.width()) / -2
+                   });
+
+              },
+            timeout: 500,
+            out: function()
+              {
+
+              }})
+
+          .parent().find('> h2, > div').hide();
+
+      });
+
+    $(window).load(function()
+      {
+        var maxWidth = 0;
+        var maxHeight = 0;
+
+        $('.digital-object-browser li').each(function()
+          {
+            \$this = $(this);
+
+            width = \$this.width();
+            height = \$this.height();
+            
+            if (width > maxWidth)
+            {
+              maxWidth = width;
+            }
+
+            if (height > maxHeight)
+            {
+              maxHeight = height;
+            }
+
+          });
+
+        // Set maxWidth
+        $('.digital-object-browser li').width(maxWidth);
+
+        // Set maxWidth
+        $('.digital-object-browser li').height(maxHeight);
+
+        $('.digital-object-browser li').each(function()
+          {
+            \$this = $(this);
+
+            \$this.height(maxHeight);
+
+            if (maxHeight > \$this.children().height())
+            {
+              \$this.find('> a > img')
+                .css('position', 'relative')
+                .css('top', (maxHeight - \$this.children().height()) / 2);
+            }
+
+          });
+
+      });
+
+  })(jQuery);
+
+content
+
+);
+
+?>
+
 <h1><?php echo __('Browse %1% - %2%', array('%1%' => 
sfConfig::get('app_ui_label_digitalobject'), '%2%' => 
$mediaType->getName(array('cultureFallback' => true)))) ?></h1>
 
 <div class="digital-object-browser">
@@ -6,17 +124,21 @@
 
     <?php foreach ($pager->getResults() as $key => $item): ?>
 
-      <?php if ($item->showAsCompoundDigitalObject()): ?>
-        <li><?php echo get_component('digitalobject', 'show', array('resource' 
=> $item->getPage(0), 'usageType' => QubitTerm::THUMBNAIL_ID, 'link' => 
array($item->informationObject, 'module' => 'informationobject'), 'iconOnly' => 
true)) ?></li>
-      <?php else: ?>
-        <li><?php echo get_component('digitalobject', 'show', array('resource' 
=> $item, 'usageType' => QubitTerm::THUMBNAIL_ID, 'link' => 
array($item->informationObject, 'module' => 'informationobject'), 'iconOnly' => 
true)) ?></li>
-      <?php endif; ?>
-
-    <!-- <h2><?php echo link_to(render_title($item->informationObject), 
array($item->informationObject, 'module' => 'informationobject')) ?><?php if 
(QubitTerm::PUBLICATION_STATUS_DRAFT_ID == 
$item->informationObject->getPublicationStatus()->status->id): ?> <span 
class="publicationStatus"><?php echo 
$item->informationObject->getPublicationStatus()->status ?></span><?php endif; 
?></h2> -->
-
-    <?php if ($item->informationObject->getCollectionRoot() !== 
$item->informationObject): ?>
-      <?php // echo render_show(__('Part of'), 
link_to(render_title($item->informationObject->getCollectionRoot()), 
array($item->informationObject->getCollectionRoot(), 'module' => 
'informationobject'))) ?>
-    <?php endif; ?>
+      <li>
+
+        <?php if ($item->showAsCompoundDigitalObject()): ?>
+          <?php echo get_component('digitalobject', 'show', array('resource' 
=> $item->getPage(0), 'usageType' => QubitTerm::THUMBNAIL_ID, 'link' => 
array($item->informationObject, 'module' => 'informationobject'), 'iconOnly' => 
true)) ?>
+        <?php else: ?>
+          <?php echo get_component('digitalobject', 'show', array('resource' 
=> $item, 'usageType' => QubitTerm::THUMBNAIL_ID, 'link' => 
array($item->informationObject, 'module' => 'informationobject'), 'iconOnly' => 
true)) ?>
+        <?php endif; ?>
+
+        <h2><?php echo link_to(render_title($item->informationObject), 
array($item->informationObject, 'module' => 'informationobject')) ?><?php if 
(QubitTerm::PUBLICATION_STATUS_DRAFT_ID == 
$item->informationObject->getPublicationStatus()->status->id): ?> <span 
class="publicationStatus"><?php echo 
$item->informationObject->getPublicationStatus()->status ?></span><?php endif; 
?></h2>
+
+        <?php if ($item->informationObject->getCollectionRoot() !== 
$item->informationObject): ?>
+          <?php echo render_show(__('Part of'), 
link_to(render_title($item->informationObject->getCollectionRoot()), 
array($item->informationObject->getCollectionRoot(), 'module' => 
'informationobject'))) ?>
+        <?php endif; ?>
+
+      </li>
 
   <?php endforeach; ?>
 

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