Author: david
Date: Tue Aug 30 09:43:18 2011
New Revision: 9621

Log:
Move upload limit display and usage bar into component with YUI dialog

Added:
   trunk/apps/qubit/modules/repository/actions/uploadLimitComponent.class.php
      - copied, changed from r9620, 
trunk/apps/qubit/modules/repository/actions/contextMenuComponent.class.php
Modified:
   trunk/apps/qubit/modules/repository/templates/_contextMenu.php
   trunk/apps/qubit/modules/repository/templates/_uploadLimit.php

Copied and modified: 
trunk/apps/qubit/modules/repository/actions/uploadLimitComponent.class.php 
(from r9620, 
trunk/apps/qubit/modules/repository/actions/contextMenuComponent.class.php)
==============================================================================
--- trunk/apps/qubit/modules/repository/actions/contextMenuComponent.class.php  
Mon Aug 29 17:04:50 2011        (r9620, copy source)
+++ trunk/apps/qubit/modules/repository/actions/uploadLimitComponent.class.php  
Tue Aug 30 09:43:18 2011        (r9621)
@@ -17,21 +17,10 @@
  * along with Qubit Toolkit.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-class RepositoryContextMenuComponent extends sfComponent
+class RepositoryUploadLimitComponent extends sfComponent
 {
   public function execute($request)
   {
-    if (!isset($request->limit))
-    {
-      $request->limit = sfConfig::get('app_hits_per_page');
-    }
-
-    $this->resource = $request->getAttribute('sf_route')->resource;
-    if (!isset($this->resource))
-    {
-      return sfView::NONE;
-    }
-
     // Show current disk usage vs. limit for repository, unless upload is
     // disabled (zero)
     if (0 != $this->resource->uploadLimit)
@@ -85,24 +74,5 @@
         }
       }
     }
-
-    $criteria = new Criteria;
-    $criteria->addJoin(QubitInformationObject::ID, QubitObject::ID);
-    $criteria->add(QubitInformationObject::REPOSITORY_ID, $this->resource->id);
-    $criteria->addAscendingOrderByColumn('title');
-
-    // Sort holdings alphabetically (w/ fallback)
-    $criteria = QubitCultureFallback::addFallbackCriteria($criteria, 
'QubitInformationObject');
-
-    // Filter draft descriptions
-    $criteria = QubitAcl::addFilterDraftsCriteria($criteria);
-
-    // Paginate holdings list
-    $this->pager = new QubitPager('QubitInformationObject');
-    $this->pager->setCriteria($criteria);
-    $this->pager->setMaxPerPage($request->limit);
-    $this->pager->setPage($request->page);
-
-    $this->holdings = $this->pager->getResults();
   }
 }

Modified: trunk/apps/qubit/modules/repository/templates/_contextMenu.php
==============================================================================
--- trunk/apps/qubit/modules/repository/templates/_contextMenu.php      Mon Aug 
29 17:04:50 2011        (r9620)
+++ trunk/apps/qubit/modules/repository/templates/_contextMenu.php      Tue Aug 
30 09:43:18 2011        (r9621)
@@ -1,33 +1,6 @@
 <?php if (QubitAcl::check($resource, 'update')): ?>
-<div>
-
-  <h3><?php echo __('Disk quota used') ?></h3>
-
-  <div style="margin: 5px 2px">
-
-<?php if (0 < floatval($resource->uploadLimit)): ?>
-
-    <div class="progressBar" style="padding: 1px; background-color: #CCC; 
height: 10px; width: 200px">
-    <div style="height: 10px; width: <?php echo $barPixels ?>px; 
background-color: <?php echo $barColor ?>;"></div>
-    </div>
-    <?php echo __('%1% of %2% <abbr title="1 GB = 1 000 000 000 
bytes">GB</abbr> (%3%%)', array('%1%' => $diskUsage, '%2%' => 
$resource->uploadLimit, '%3%' => $diskUsagePercent)) ?>
-
-<?php elseif (0 == $resource->uploadLimit): ?>
-
-    <?php echo __('Upload is disabled for this %1%', array('%1%' => 
strtolower(sfConfig::get('app_ui_label_repository')))) ?>
-
-<?php else: ?>
-
-    <?php echo __('%1% <abbr title="1 GB = 1 000 000 000 bytes">GB</abbr> of 
<em>Unlimited</em>', array('%1%' => $diskUsage)) ?>
-
-<?php endif; // Limited, disabled, unlimited disk usage ?>
-
-    <?php echo __('( %1%edit%2% )', array('%1%' => '<a href="#" 
id="editUploadLimit">', '%2%' => '</a>')) ?>
-
-  </div>
-
-</div>
-<?php endif; // Show disk quota box ?>
+  <?php include_component('repository', 'uploadLimit', array('resource' => 
$resource)) ?>
+<?php endif; ?>
 
 <div>
   <h3><?php echo sfConfig::get('app_ui_label_holdings') ?></h3>
@@ -53,4 +26,3 @@
 
 </div>
 
-<?php include_partial('repository/uploadLimit', array('resource' => 
$resource)) ?>

Modified: trunk/apps/qubit/modules/repository/templates/_uploadLimit.php
==============================================================================
--- trunk/apps/qubit/modules/repository/templates/_uploadLimit.php      Mon Aug 
29 17:04:50 2011        (r9620)
+++ trunk/apps/qubit/modules/repository/templates/_uploadLimit.php      Tue Aug 
30 09:43:18 2011        (r9621)
@@ -1,5 +1,36 @@
+<!-- Disk quota display with usage bar -->
+<div>
+
+  <h3><?php echo __('Disk quota used') ?></h3>
+
+  <div style="margin: 5px 2px">
+
+<?php if (0 < floatval($resource->uploadLimit)): ?>
+
+    <div class="progressBar" style="padding: 1px; background-color: #CCC; 
height: 10px; width: 200px">
+      <div style="height: 10px; width: <?php echo $barPixels ?>px; 
background-color: <?php echo $barColor ?>;"></div>
+    </div>
+    <?php echo __('%1% of %2% <abbr title="1 GB = 1 000 000 000 
bytes">GB</abbr> (%3%%)', array('%1%' => $diskUsage, '%2%' => 
$resource->uploadLimit, '%3%' => $diskUsagePercent)) ?>
+
+<?php elseif (0 == $resource->uploadLimit): ?>
+
+    <?php echo __('Upload is disabled for this %1%', array('%1%' => 
strtolower(sfConfig::get('app_ui_label_repository')))) ?>
+
+<?php else: ?>
+
+    <?php echo __('%1% <abbr title="1 GB = 1 000 000 000 bytes">GB</abbr> of 
<em>Unlimited</em>', array('%1%' => $diskUsage)) ?>
+
+<?php endif; // Limited, disabled, unlimited disk usage ?>
+
+    <?php echo __('( %1%edit%2% )', array('%1%' => '<a href="#" 
id="editUlLink">', '%2%' => '</a>')) ?>
+
+  </div>
+
+</div>
+
+<!-- Edit uploadLimit form -->
 <!-- NOTE YUI dialog wraps this *entire* div -->
-<div class="section" id="uploadLimit">
+<div class="section" id="editUploadLimit">
   <div class="hd"><?php echo __('Change disk upload quota') ?></div>
 
   <div class="bd form-item-uploadLimit">
@@ -51,7 +82,7 @@
           };
 
           // Instantiate the Dialog
-          var ulDialog = new YAHOO.widget.Dialog("uploadLimit",
+          var ulDialog = new YAHOO.widget.Dialog("editUploadLimit",
             { fixedcenter : true,
               visible : false,
               modal: true,
@@ -70,7 +101,7 @@
           ulDialog.render();
 
           // Bind dialog show to "edit" html element
-          $('#editUploadLimit').click(function ()
+          $('#editUlLink').click(function ()
           {
             ulDialog.show();
           });

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