}
$owner = $this->getOwnerEntity();
- $owner->image_repo_size = (int)$owner->image_repo_size + $size;
+ $owner->image_repo_size = (int)$owner->image_repo_size + $this->size();
return true;
}
+ /**
+ * Need to restore sanity to this function
+ * @param type $data
+ */
protected function checkUploadErrors($data) {
// check for upload errors
if ($data['error']) {
'tidypics:settings:uploader' => "Use Flash uploader",
'tidypics:settings:grp_perm_override' => "Allow group members full access to group albums",
'tidypics:settings:maxfilesize' => "Maximum image size in megabytes (MB):",
- 'tidypics:settings:quota' => "User/Group Quota (MB) - 0 equals no quota",
+ 'tidypics:settings:quota' => "User Quota (MB) - 0 equals no quota",
'tidypics:settings:watermark' => "Enter text to appear in the watermark",
'tidypics:settings:im_path' => "Enter the path to your ImageMagick commands",
'tidypics:settings:img_river_view' => "How many entries in activity river for each batch of uploaded images",
'album:tags' => "Tags",
'album:cover' => "Make image album cover?",
'album:cover_link' => 'Set cover image',
+ 'tidypics:title:quota' => 'Quota',
'tidypics:quota' => "Quota usage:",
'tidypics:uploader:choose' => "Choose photos",
'tidypics:uploader:upload' => "Upload photos",
'tidypics:uploader:describe' => "Describe photos",
'tidypics:uploader:filedesc' => 'Image files (jpeg, png, gif)',
- 'tidypics:uploader:instructs' => 'There are three easy steps for adding photos to your album using this uploader: choosing, uploading, and describing them. If you do not have Flash, there is also a <a href="%s">basic uploader</a> available.',
+ 'tidypics:uploader:instructs' => 'There are three easy steps for adding photos to your album using this uploader: choosing, uploading, and describing them. There is a %s MB maximum per photo. If you do not have Flash, there is also a <a href="%s">basic uploader</a> available.',
'tidypics:uploader:basic' => 'You can upload up to 10 photos at a time (%s MB maximum per photo)',
'tidypics:sort:instruct' => 'Sort the album photos by dragging and dropping the images. Then click the save button.',
'tidypics:sort:no_images' => 'No images found to sort. Upload images using the link above.',
// no quota
return true;
}
-
- $image_repo_size_md = get_metadata_byname($owner_guid, "image_repo_size");
- $image_repo_size = (int)$image_repo_size_md->value;
+
+ $owner = get_entity($owner_guid);
+ $image_repo_size_md = (int)$owner->image_repo_size;
return ($image_repo_size + $image_size) < $quota;
}
\ No newline at end of file
'content' => $content,
'title' => $title,
'filter' => '',
+ 'sidebar' => elgg_view('photos/sidebar', array('page' => 'upload')),
));
echo elgg_view_page($title, $body);
/**
* 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');
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>";
-
'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>';
$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">
$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));
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
--- /dev/null
+<?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);
+}