Author: david
Date: Tue Aug 30 14:03:08 2011
New Revision: 9632

Log:
Replace disk usage display div with HTML returned from editUploadLimit. So 
cool\!

Modified:
   trunk/apps/qubit/modules/repository/actions/uploadLimitComponent.class.php
   trunk/apps/qubit/modules/repository/templates/_uploadLimit.php

Modified: 
trunk/apps/qubit/modules/repository/actions/uploadLimitComponent.class.php
==============================================================================
--- trunk/apps/qubit/modules/repository/actions/uploadLimitComponent.class.php  
Tue Aug 30 13:54:17 2011        (r9631)
+++ trunk/apps/qubit/modules/repository/actions/uploadLimitComponent.class.php  
Tue Aug 30 14:03:08 2011        (r9632)
@@ -19,17 +19,15 @@
 
 class RepositoryUploadLimitComponent extends sfComponent
 {
-  public
-    // Usage bar
-    $usageBarDisplay = 'none',
-    $usageBarPixels = 0,
-    $usageBarColors = array(
+  public function execute($request)
+  {
+    // Usage bar defaults
+    $this->usageBarPixels = 0;
+    $this->usageBarColors = array(
       'default' => '#390',
       'warning' => '#C33'
     );
 
-  public function execute($request)
-  {
     // Hide edit component for ajax response
     if (!isset($this->noedit))
     {
@@ -67,9 +65,6 @@
     // Calc progress bar and percentages values for usage limit > 0
     if (0 < $this->resource->uploadLimit)
     {
-      // Show usage bar
-      $this->usageBarDisplay = 'block';
-
       // Calc percent
       $dup = $this->diskUsage / floatval($this->resource->uploadLimit) * 100;
 

Modified: trunk/apps/qubit/modules/repository/templates/_uploadLimit.php
==============================================================================
--- trunk/apps/qubit/modules/repository/templates/_uploadLimit.php      Tue Aug 
30 13:54:17 2011        (r9631)
+++ trunk/apps/qubit/modules/repository/templates/_uploadLimit.php      Tue Aug 
30 14:03:08 2011        (r9632)
@@ -1,15 +1,14 @@
 <!-- Disk quota display with usage bar -->
-<div>
+<div id="diskQuotaDisplay">
 
   <h3><?php echo __('Disk quota used') ?></h3>
 
   <div style="margin: 5px 2px">
 
+<?php if (0 < floatval($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 style="height: 10px; width: <?php echo $usageBarPixels ?>px; 
background-color: <?php echo $usageBarColor ?>;"></div>
     </div>
-
-<?php if (0 < floatval($uploadLimit)): ?>
     <?php echo __('%du% of %limit% <abbr title="1 GB = 1 000 000 000 
bytes">GB</abbr> (%percent%%)', array('%du%' => $diskUsage, '%limit%' => 
$uploadLimit, '%percent%' => $diskUsagePercent)) ?>
 <?php elseif (0 == $uploadLimit): ?>
     <?php echo __('Upload is disabled') ?>
@@ -72,8 +71,10 @@
             this.cancel();
           };
           var handleSuccess = function(o) {
-            // var response = o.responseText;
-            alert('Success!');
+            var response = o.responseText;
+
+            // Replace previous HTML with response from editUploadLimit
+            $('#diskQuotaDisplay').replaceWith(response);
           };
           var handleFailure = function(o) {
             alert('The Fail!');

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