aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/default/forms/photos/admin/settings.php14
-rw-r--r--views/default/forms/photos/admin/settings/main.php12
-rw-r--r--views/default/forms/photos/ajax_upload.php23
-rw-r--r--views/default/forms/photos/basic_upload.php27
-rw-r--r--views/default/photos/sidebar.php6
-rw-r--r--views/default/photos/sidebar/quota.php27
6 files changed, 51 insertions, 58 deletions
diff --git a/views/default/forms/photos/admin/settings.php b/views/default/forms/photos/admin/settings.php
index 7e9c17ac2..403203f69 100644
--- a/views/default/forms/photos/admin/settings.php
+++ b/views/default/forms/photos/admin/settings.php
@@ -2,7 +2,7 @@
/**
* Tidypics admin settings form body
*
- * @todo watermark, quota, remove original image, group only upload not delete
+ * @todo remove original image, group only upload not delete
*/
$plugin = elgg_get_plugin_from_id('tidypics');
@@ -24,15 +24,3 @@ $content = elgg_view('forms/photos/admin/settings/thumbnails', array('plugin' =>
echo elgg_view_module('inline', $title, $content);
echo elgg_view('input/submit', array('value' => elgg_echo("save")));
-
-return true;
-
-
-// Quota Size
-$quota = $plugin->quota;
-if (!$quota) {
- $quota = 0;
-}
-$form_body .= "<p>" . elgg_echo('tidypics:settings:quota') . "<br />";
-$form_body .= elgg_view("input/text",array('internalname' => 'params[quota]', 'value' => $quota)) . "</p>";
-
diff --git a/views/default/forms/photos/admin/settings/main.php b/views/default/forms/photos/admin/settings/main.php
index 352a9c5a1..c99b9d688 100644
--- a/views/default/forms/photos/admin/settings/main.php
+++ b/views/default/forms/photos/admin/settings/main.php
@@ -34,3 +34,15 @@ echo elgg_view("input/text", array(
'value' => $plugin->watermark_text,
));
echo '</div>';
+
+// Quota Size
+$quota = $plugin->quota;
+if (!$quota) {
+ $quota = 0;
+}
+echo '<div>' . elgg_echo('tidypics:settings:quota');
+echo elgg_view('input/text', array(
+ 'name' => 'params[quota]',
+ 'value' => $quota,
+));
+echo '</div>';
diff --git a/views/default/forms/photos/ajax_upload.php b/views/default/forms/photos/ajax_upload.php
index be25d628e..3ab578a38 100644
--- a/views/default/forms/photos/ajax_upload.php
+++ b/views/default/forms/photos/ajax_upload.php
@@ -17,26 +17,13 @@ if (!$maxfilesize) {
$maxfilesize = 5;
}
-$quota = elgg_get_plugin_setting('quota', 'tidypics');
-if ($quota) {
- $image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size");
- $image_repo_size = (int)$image_repo_size_md->value;
- $image_repo_size = $image_repo_size / 1024 / 1024;
- $quote_percentage = round(100 * ($image_repo_size / $quota));
- // for small quotas, so one decimal place
- if ($quota < 10) {
- $image_repo_size = sprintf('%.1f', $image_repo_size);
- } else {
- $image_repo_size = round($image_repo_size);
- }
- if ($image_repo_size > $quota) {
- $image_repo_size = $quota;
- }
-}
-
?>
-<p><?php echo elgg_echo('tidypics:uploader:instructs', array($basic_uploader_url)); ?></p>
+<p>
+<?php
+ echo elgg_echo('tidypics:uploader:instructs', array($maxfilesize, $basic_uploader_url));
+?>
+</p>
<ul id="tidypics-uploader-steps">
<li class="mbm">
diff --git a/views/default/forms/photos/basic_upload.php b/views/default/forms/photos/basic_upload.php
index e4535814b..ba849d1b4 100644
--- a/views/default/forms/photos/basic_upload.php
+++ b/views/default/forms/photos/basic_upload.php
@@ -15,33 +15,6 @@ $album = $vars['entity'];
$access_id = $album->access_id;
$maxfilesize = (float) elgg_get_plugin_setting('maxfilesize', 'tidypics');
-$quota = elgg_get_plugin_setting('quota', 'tidypics');
-/*
-if ($quota) {
- $image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size");
- $image_repo_size = (int)$image_repo_size_md->value;
- $image_repo_size = $image_repo_size / 1024 / 1024;
- $quote_percentage = round(100 * ($image_repo_size / $quota));
- // for small quotas, so one decimal place
- if ($quota < 10) {
- $image_repo_size = sprintf('%.1f', $image_repo_size);
- } else {
- $image_repo_size = round($image_repo_size);
- }
- if ($image_repo_size > $quota) {
- $image_repo_size = $quota;
- }
-}
- <?php
- if ($quota) {
- ?>
- <i><?php echo elgg_echo("tidypics:quota") . ' ' . $image_repo_size . '/' . $quota . " MB ({$quote_percentage}%)"; ?></i><br />
- <?php
- }
- ?>
-
- *
-*/
$instructions = elgg_echo("tidypics:uploader:upload");
$max = elgg_echo('tidypics:uploader:basic', array($maxfilesize));
diff --git a/views/default/photos/sidebar.php b/views/default/photos/sidebar.php
index 4c0feb72c..fd5202691 100644
--- a/views/default/photos/sidebar.php
+++ b/views/default/photos/sidebar.php
@@ -10,3 +10,9 @@ if ($image && $page == 'view') {
echo elgg_view('photos/sidebar/exif', $vars);
}
}
+
+if ($page == 'upload') {
+ if (elgg_get_plugin_setting('quota', 'tidypics')) {
+ echo elgg_view('photos/sidebar/quota', $vars);
+ }
+} \ No newline at end of file
diff --git a/views/default/photos/sidebar/quota.php b/views/default/photos/sidebar/quota.php
new file mode 100644
index 000000000..16b7885c4
--- /dev/null
+++ b/views/default/photos/sidebar/quota.php
@@ -0,0 +1,27 @@
+<?php
+/**
+ * User quota
+ */
+
+$user = elgg_get_logged_in_user_entity();
+
+
+$quota = elgg_get_plugin_setting('quota', 'tidypics');
+if ($quota) {
+ $image_repo_size = (int)$user->image_repo_size;
+ $image_repo_size = $image_repo_size / 1024 / 1024;
+ $quote_percentage = round(100 * ($image_repo_size / $quota));
+ // for small quotas, so one decimal place
+ if ($quota < 10) {
+ $image_repo_size = sprintf('%.1f', $image_repo_size);
+ } else {
+ $image_repo_size = round($image_repo_size);
+ }
+ if ($image_repo_size > $quota) {
+ $image_repo_size = $quota;
+ }
+
+ $title = elgg_echo('tidypics:title:quota');
+ $body = elgg_echo("tidypics:quota") . ' ' . $image_repo_size . '/' . $quota . " MB ({$quote_percentage}%)";
+ echo elgg_view_module('aside', $title, $body);
+}