summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.php27
-rw-r--r--quota_inc.php23
-rw-r--r--templates/quota.tpl28
-rw-r--r--templates/quota_inc.tpl29
4 files changed, 56 insertions, 51 deletions
diff --git a/index.php b/index.php
index 8cfcb08..3832d6a 100644
--- a/index.php
+++ b/index.php
@@ -1,6 +1,6 @@
<?php
/**
- * $Header: /cvsroot/bitweaver/_bit_quota/index.php,v 1.3 2005/08/01 18:41:18 squareing Exp $
+ * $Header: /cvsroot/bitweaver/_bit_quota/index.php,v 1.4 2006/05/18 18:37:49 squareing Exp $
*
* Copyright (c) 2004 bitweaver.org
* Copyright (c) 2003 tikwiki.org
@@ -8,7 +8,7 @@
* All Rights Reserved. See copyright.txt for details and a complete list of authors.
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
*
- * $Id: index.php,v 1.3 2005/08/01 18:41:18 squareing Exp $
+ * $Id: index.php,v 1.4 2006/05/18 18:37:49 squareing Exp $
* @package quota
*/
@@ -19,28 +19,7 @@ require_once( '../bit_setup_inc.php' );
$gBitSystem->verifyPackage( 'quota' );
-require_once( QUOTA_PKG_PATH.'LibertyQuota.php' );
-
-$quota = new LibertyQuota();
-$diskUsage = $quota->getUserUsage( $gBitUser->mUserId );
-$diskQuota = $quota->getUserQuota( $gBitUser->mUserId );
-
-if( $diskQuota != 0 ) {
- $quotaPercent = round( (($diskUsage / $diskQuota) * 100), 0 );
-} else {
- $quotaPercent = 0;
-}
-
-if( $quotaPercent > 100 ) {
- $errors['disk_quota'] = "You are over your disk quota.";
- $gBitSmarty->assign_by_ref( 'errors', $errors );
- $quotaPercent = 100;
-}
-
-$gBitSmarty->assign( 'usage', round( ($diskUsage / 1000000), 2 ) );
-$gBitSmarty->assign( 'quota', round( ($diskQuota / 1000000), 2 ) );
-$gBitSmarty->assign_by_ref( 'quotaPercent', $quotaPercent );
+require_once( QUOTA_PKG_PATH.'quota_inc.php' );
$gBitSystem->display( 'bitpackage:quota/quota.tpl', 'View Quota' );
-
?>
diff --git a/quota_inc.php b/quota_inc.php
new file mode 100644
index 0000000..d05679b
--- /dev/null
+++ b/quota_inc.php
@@ -0,0 +1,23 @@
+<?php
+require_once( QUOTA_PKG_PATH.'LibertyQuota.php' );
+
+$quota = new LibertyQuota();
+$diskUsage = $quota->getUserUsage( $gBitUser->mUserId );
+$diskQuota = $quota->getUserQuota( $gBitUser->mUserId );
+
+if( $diskQuota != 0 ) {
+ $quotaPercent = round( (($diskUsage / $diskQuota) * 100), 0 );
+} else {
+ $quotaPercent = 0;
+}
+
+if( $quotaPercent > 100 ) {
+ $errors['disk_quota'] = "You are over your disk quota.";
+ $gBitSmarty->assign_by_ref( 'errors', $errors );
+ $quotaPercent = 100;
+}
+
+$gBitSmarty->assign( 'usage', round( ($diskUsage / 1000000), 2 ) );
+$gBitSmarty->assign( 'quota', round( ($diskQuota / 1000000), 2 ) );
+$gBitSmarty->assign_by_ref( 'quotaPercent', $quotaPercent );
+?>
diff --git a/templates/quota.tpl b/templates/quota.tpl
index af1df16..f6f181c 100644
--- a/templates/quota.tpl
+++ b/templates/quota.tpl
@@ -6,32 +6,6 @@
{include file="bitpackage:users/my_bitweaver_bar.tpl"}
<div class="body">
- {legend legend="Your Personal Usage Quota"}
- {if $gBitUser->isAdmin()}
- Administrators have no enforced quota limit
- {else}
- {formfeedback error=$errors.disk_quota}
-
- <div class="row">
- {formlabel label="Your disk quota"}
- {forminput}
- {formfeedback note="$quota MB"}
- {/forminput}
- </div>
-
- <div class="row">
- {formlabel label="Your current usage"}
- {forminput}
- {formfeedback note="$usage MB <small>( `$quotaPercent`% )</small>"}
- {/forminput}
- </div>
-
- <div class="row">
- <div style="border:1px solid #ccc;background:#eee;">
- <div style="width:{$quotaPercent}%;background:#f80;text-align:left;color:#000;line-height:30px;"><small>{$quotaPercent}%</small></div>
- </div>
- </div>
- {/if}
- {/legend}
+ {include file="bitpackage:quota/quota_inc.tpl"}
</div> <!-- end .body -->
</div> <!-- end .fisheye -->
diff --git a/templates/quota_inc.tpl b/templates/quota_inc.tpl
new file mode 100644
index 0000000..19ff33d
--- /dev/null
+++ b/templates/quota_inc.tpl
@@ -0,0 +1,29 @@
+{strip}
+{legend legend="Your Personal Usage Quota"}
+ {if $gBitUser->isAdmin()}
+ Administrators have no enforced quota limit
+ {else}
+ {formfeedback error=$errors.disk_quota}
+
+ <div class="row">
+ {formlabel label="Your disk quota"}
+ {forminput}
+ {formfeedback note="$quota MB"}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ {formlabel label="Your current usage"}
+ {forminput}
+ {formfeedback note="$usage MB <small>( `$quotaPercent`% )</small>"}
+ {/forminput}
+ </div>
+
+ <div class="row">
+ <div style="border:1px solid #ccc;background:#eee;">
+ <div style="width:{$quotaPercent}%;background:#f80;text-align:left;color:#000;line-height:30px;"><small>{$quotaPercent}%</small></div>
+ </div>
+ </div>
+ {/if}
+{/legend}
+{/strip}